Theorem: Stream'.WSeq.get?_mem
File: Mathlib/Data/Seq/WSeq.lean

tactic: revert s
state_before: α : Type u
β : Type v
γ : Type w
s : WSeq α
a : α
n : ℕ
⊢ some a ∈ s.get? n → a ∈ s
state_after: α : Type u
β : Type v
γ : Type w
a : α
n : ℕ
⊢ ∀ {s : WSeq α}, some a ∈ s.get? n → a ∈ s

tactic: induction' n with n IH <;> intro s h
state_before: α : Type u
β : Type v
γ : Type w
a : α
n : ℕ
⊢ ∀ {s : WSeq α}, some a ∈ s.get? n → a ∈ s
state_after: case zero
α : Type u
β : Type v
γ : Type w
a : α
s : WSeq α
h : some a ∈ s.get? 0
⊢ a ∈ s

case succ
α : Type u
β : Type v
γ : Type w
a : α
n : ℕ
IH : ∀ {s : WSeq α}, some a ∈ s.get? n → a ∈ s
s : WSeq α
h : some a ∈ s.get? (n + 1)
⊢ a ∈ s

tactic: dsimp only [get?, head] at h
state_before: case zero
α : Type u
β : Type v
γ : Type w
a : α
s : WSeq α
h : some a ∈ s.get? 0
⊢ a ∈ s
state_after: case zero
α : Type u
β : Type v
γ : Type w
a : α
s : WSeq α
h : some a ∈ Computation.map (fun x => Prod.fst <$> x) (s.drop 0).destruct
⊢ a ∈ s

tactic: rcases Computation.exists_of_mem_map h with ⟨o, h1, h2⟩
state_before: case zero
α : Type u
β : Type v
γ : Type w
a : α
s : WSeq α
h : some a ∈ Computation.map (fun x => Prod.fst <$> x) (s.drop 0).destruct
⊢ a ∈ s
state_after: case zero.intro.intro
α : Type u
β : Type v
γ : Type w
a : α
s : WSeq α
h : some a ∈ Computation.map (fun x => Prod.fst <$> x) (s.drop 0).destruct
o : Option (α × WSeq α)
h1 : o ∈ (s.drop 0).destruct
h2 : Prod.fst <$> o = some a
⊢ a ∈ s

tactic: cases' o with o
state_before: case zero.intro.intro
α : Type u
β : Type v
γ : Type w
a : α
s : WSeq α
h : some a ∈ Computation.map (fun x => Prod.fst <$> x) (s.drop 0).destruct
o : Option (α × WSeq α)
h1 : o ∈ (s.drop 0).destruct
h2 : Prod.fst <$> o = some a
⊢ a ∈ s
state_after: case zero.intro.intro.none
α : Type u
β : Type v
γ : Type w
a : α
s : WSeq α
h : some a ∈ Computation.map (fun x => Prod.fst <$> x) (s.drop 0).destruct
h1 : none ∈ (s.drop 0).destruct
h2 : Prod.fst <$> none = some a
⊢ a ∈ s

case zero.intro.intro.some
α : Type u
β : Type v
γ : Type w
a : α
s : WSeq α
h : some a ∈ Computation.map (fun x => Prod.fst <$> x) (s.drop 0).destruct
o : α × WSeq α
h1 : some o ∈ (s.drop 0).destruct
h2 : Prod.fst <$> some o = some a
⊢ a ∈ s

tactic: injection h2 with h'
state_before: case zero.intro.intro.some
α : Type u
β : Type v
γ : Type w
a : α
s : WSeq α
h : some a ∈ Computation.map (fun x => Prod.fst <$> x) (s.drop 0).destruct
o : α × WSeq α
h1 : some o ∈ (s.drop 0).destruct
h2 : Prod.fst <$> some o = some a
⊢ a ∈ s
state_after: case zero.intro.intro.some
α : Type u
β : Type v
γ : Type w
a : α
s : WSeq α
h : some a ∈ Computation.map (fun x => Prod.fst <$> x) (s.drop 0).destruct
o : α × WSeq α
h1 : some o ∈ (s.drop 0).destruct
h' : o.1 = a
⊢ a ∈ s

tactic: cases' o with a' s'
state_before: case zero.intro.intro.some
α : Type u
β : Type v
γ : Type w
a : α
s : WSeq α
h : some a ∈ Computation.map (fun x => Prod.fst <$> x) (s.drop 0).destruct
o : α × WSeq α
h1 : some o ∈ (s.drop 0).destruct
h' : o.1 = a
⊢ a ∈ s
state_after: case zero.intro.intro.some.mk
α : Type u
β : Type v
γ : Type w
a : α
s : WSeq α
h : some a ∈ Computation.map (fun x => Prod.fst <$> x) (s.drop 0).destruct
a' : α
s' : WSeq α
h1 : some (a', s') ∈ (s.drop 0).destruct
h' : (a', s').1 = a
⊢ a ∈ s

tactic: exact (eq_or_mem_iff_mem h1).2 (Or.inl h'.symm)
state_before: case zero.intro.intro.some.mk
α : Type u
β : Type v
γ : Type w
a : α
s : WSeq α
h : some a ∈ Computation.map (fun x => Prod.fst <$> x) (s.drop 0).destruct
a' : α
s' : WSeq α
h1 : some (a', s') ∈ (s.drop 0).destruct
h' : (a', s').1 = a
⊢ a ∈ s
state_after: no goals

tactic: injection h2
state_before: case zero.intro.intro.none
α : Type u
β : Type v
γ : Type w
a : α
s : WSeq α
h : some a ∈ Computation.map (fun x => Prod.fst <$> x) (s.drop 0).destruct
h1 : none ∈ (s.drop 0).destruct
h2 : Prod.fst <$> none = some a
⊢ a ∈ s
state_after: no goals

tactic: have := @IH (tail s)
state_before: case succ
α : Type u
β : Type v
γ : Type w
a : α
n : ℕ
IH : ∀ {s : WSeq α}, some a ∈ s.get? n → a ∈ s
s : WSeq α
h : some a ∈ s.get? (n + 1)
⊢ a ∈ s
state_after: case succ
α : Type u
β : Type v
γ : Type w
a : α
n : ℕ
IH : ∀ {s : WSeq α}, some a ∈ s.get? n → a ∈ s
s : WSeq α
h : some a ∈ s.get? (n + 1)
this : some a ∈ s.tail.get? n → a ∈ s.tail
⊢ a ∈ s

tactic: rw [get?_tail] at this
state_before: case succ
α : Type u
β : Type v
γ : Type w
a : α
n : ℕ
IH : ∀ {s : WSeq α}, some a ∈ s.get? n → a ∈ s
s : WSeq α
h : some a ∈ s.get? (n + 1)
this : some a ∈ s.tail.get? n → a ∈ s.tail
⊢ a ∈ s
state_after: case succ
α : Type u
β : Type v
γ : Type w
a : α
n : ℕ
IH : ∀ {s : WSeq α}, some a ∈ s.get? n → a ∈ s
s : WSeq α
h : some a ∈ s.get? (n + 1)
this : some a ∈ s.get? (n + 1) → a ∈ s.tail
⊢ a ∈ s

tactic: exact mem_of_mem_tail (this h)
state_before: case succ
α : Type u
β : Type v
γ : Type w
a : α
n : ℕ
IH : ∀ {s : WSeq α}, some a ∈ s.get? n → a ∈ s
s : WSeq α
h : some a ∈ s.get? (n + 1)
this : some a ∈ s.get? (n + 1) → a ∈ s.tail
⊢ a ∈ s
state_after: no goals