Theorem: Stream'.Seq.destruct_eq_cons
File: Mathlib/Data/Seq/Seq.lean

tactic: dsimp [destruct]
state_before: α : Type u
β : Type v
γ : Type w
s : Seq α
a : α
s' : Seq α
⊢ destruct s = some (a, s') → s = cons a s'

tactic: induction' f0 : get? s 0 with a' <;> intro h
state_before: α : Type u
β : Type v
γ : Type w
s : Seq α
a : α
s' : Seq α
⊢ Option.map (fun a' => (a', tail s)) (get? s 0) = some (a, s') → s = cons a s'

tactic: contradiction
state_before: case none
α : Type u
β : Type v
γ : Type w
s : Seq α
a : α
s' : Seq α
x✝ : Option α
f0✝ : get? s 0 = x✝
f0 : get? s 0 = none
h : Option.map (fun a' => (a', tail s)) none = some (a, s')
⊢ s = cons a s'

tactic: cases' s with f al
state_before: case some
α : Type u
β : Type v
γ : Type w
s : Seq α
a : α
s' : Seq α
x✝ : Option α
f0✝ : get? s 0 = x✝
a' : α
f0 : get? s 0 = some a'
h : Option.map (fun a' => (a', tail s)) (some a') = some (a, s')
⊢ s = cons a s'

tactic: injections _ h1 h2
state_before: case some.mk
α : Type u
β : Type v
γ : Type w
a : α
s' : Seq α
x✝ : Option α
a' : α
f : Stream' (Option α)
al : IsSeq f
f0✝ : get? { val := f, property := al } 0 = x✝
f0 : get? { val := f, property := al } 0 = some a'
h : Option.map (fun a' => (a', tail { val := f, property := al })) (some a') = some (a, s')
⊢ { val := f, property := al } = cons a s'

tactic: rw [← h2]
state_before: case some.mk
α : Type u
β : Type v
γ : Type w
a : α
s' : Seq α
x✝ : Option α
a' : α
f : Stream' (Option α)
al : IsSeq f
f0✝ : get? { val := f, property := al } 0 = x✝
f0 : get? { val := f, property := al } 0 = some a'
h1 : a' = a
h2 : tail { val := f, property := al } = s'
⊢ { val := f, property := al } = cons a s'

tactic: apply Subtype.eq
state_before: case some.mk
α : Type u
β : Type v
γ : Type w
a : α
s' : Seq α
x✝ : Option α
a' : α
f : Stream' (Option α)
al : IsSeq f
f0✝ : get? { val := f, property := al } 0 = x✝
f0 : get? { val := f, property := al } 0 = some a'
h1 : a' = a
h2 : tail { val := f, property := al } = s'
⊢ { val := f, property := al } = cons a (tail { val := f, property := al })

tactic: dsimp [tail, cons]
state_before: case some.mk.a
α : Type u
β : Type v
γ : Type w
a : α
s' : Seq α
x✝ : Option α
a' : α
f : Stream' (Option α)
al : IsSeq f
f0✝ : get? { val := f, property := al } 0 = x✝
f0 : get? { val := f, property := al } 0 = some a'
h1 : a' = a
h2 : tail { val := f, property := al } = s'
⊢ ↑{ val := f, property := al } = ↑(cons a (tail { val := f, property := al }))

tactic: rw [h1] at f0
state_before: case some.mk.a
α : Type u
β : Type v
γ : Type w
a : α
s' : Seq α
x✝ : Option α
a' : α
f : Stream' (Option α)
al : IsSeq f
f0✝ : get? { val := f, property := al } 0 = x✝
f0 : get? { val := f, property := al } 0 = some a'
h1 : a' = a
h2 : tail { val := f, property := al } = s'
⊢ f = some a :: Stream'.tail f

tactic: rw [← f0]
state_before: case some.mk.a
α : Type u
β : Type v
γ : Type w
a : α
s' : Seq α
x✝ : Option α
a' : α
f : Stream' (Option α)
al : IsSeq f
f0✝ : get? { val := f, property := al } 0 = x✝
f0 : get? { val := f, property := al } 0 = some a
h1 : a' = a
h2 : tail { val := f, property := al } = s'
⊢ f = some a :: Stream'.tail f

tactic: exact (Stream'.eta f).symm
state_before: case some.mk.a
α : Type u
β : Type v
γ : Type w
a : α
s' : Seq α
x✝ : Option α
a' : α
f : Stream' (Option α)
al : IsSeq f
f0✝ : get? { val := f, property := al } 0 = x✝
f0 : get? { val := f, property := al } 0 = some a
h1 : a' = a
h2 : tail { val := f, property := al } = s'
⊢ f = get? { val := f, property := al } 0 :: Stream'.tail f