Theorem: Computation.destruct_eq_think
File: Mathlib/Data/Seq/Computation.lean

tactic: dsimp [destruct]
state_before: α : Type u
β : Type v
γ : Type w
s s' : Computation α
⊢ s.destruct = Sum.inr s' → s = s'.think
state_after: α : Type u
β : Type v
γ : Type w
s s' : Computation α
⊢ (match ↑s 0 with
      | none => Sum.inr s.tail
      | some a => Sum.inl a) =
      Sum.inr s' →
    s = s'.think

tactic: induction' f0 : s.1 0 with a' <;> intro h
state_before: α : Type u
β : Type v
γ : Type w
s s' : Computation α
⊢ (match ↑s 0 with
      | none => Sum.inr s.tail
      | some a => Sum.inl a) =
      Sum.inr s' →
    s = s'.think
state_after: case none
α : Type u
β : Type v
γ : Type w
s s' : Computation α
f0 : ↑s 0 = none
h :
  (match none with
    | none => Sum.inr s.tail
    | some a => Sum.inl a) =
    Sum.inr s'
⊢ s = s'.think

case some
α : Type u
β : Type v
γ : Type w
s s' : Computation α
a' : α
f0 : ↑s 0 = some a'
h :
  (match some a' with
    | none => Sum.inr s.tail
    | some a => Sum.inl a) =
    Sum.inr s'
⊢ s = s'.think

tactic: injection h with h'
state_before: case none
α : Type u
β : Type v
γ : Type w
s s' : Computation α
f0 : ↑s 0 = none
h :
  (match none with
    | none => Sum.inr s.tail
    | some a => Sum.inl a) =
    Sum.inr s'
⊢ s = s'.think
state_after: case none
α : Type u
β : Type v
γ : Type w
s s' : Computation α
f0 : ↑s 0 = none
h' : s.tail = s'
⊢ s = s'.think

tactic: rw [← h']
state_before: case none
α : Type u
β : Type v
γ : Type w
s s' : Computation α
f0 : ↑s 0 = none
h' : s.tail = s'
⊢ s = s'.think
state_after: case none
α : Type u
β : Type v
γ : Type w
s s' : Computation α
f0 : ↑s 0 = none
h' : s.tail = s'
⊢ s = s.tail.think

tactic: cases' s with f al
state_before: case none
α : Type u
β : Type v
γ : Type w
s s' : Computation α
f0 : ↑s 0 = none
h' : s.tail = s'
⊢ s = s.tail.think
state_after: case none.mk
α : Type u
β : Type v
γ : Type w
s' : Computation α
f : Stream' (Option α)
al : ∀ ⦃n : ℕ⦄ ⦃a : α⦄, f n = some a → f (n + 1) = some a
f0 : ↑⟨f, al⟩ 0 = none
h' : tail ⟨f, al⟩ = s'
⊢ ⟨f, al⟩ = (tail ⟨f, al⟩).think

tactic: apply Subtype.eq
state_before: case none.mk
α : Type u
β : Type v
γ : Type w
s' : Computation α
f : Stream' (Option α)
al : ∀ ⦃n : ℕ⦄ ⦃a : α⦄, f n = some a → f (n + 1) = some a
f0 : ↑⟨f, al⟩ 0 = none
h' : tail ⟨f, al⟩ = s'
⊢ ⟨f, al⟩ = (tail ⟨f, al⟩).think
state_after: case none.mk.a
α : Type u
β : Type v
γ : Type w
s' : Computation α
f : Stream' (Option α)
al : ∀ ⦃n : ℕ⦄ ⦃a : α⦄, f n = some a → f (n + 1) = some a
f0 : ↑⟨f, al⟩ 0 = none
h' : tail ⟨f, al⟩ = s'
⊢ ↑⟨f, al⟩ = ↑(tail ⟨f, al⟩).think

tactic: dsimp [think, tail]
state_before: case none.mk.a
α : Type u
β : Type v
γ : Type w
s' : Computation α
f : Stream' (Option α)
al : ∀ ⦃n : ℕ⦄ ⦃a : α⦄, f n = some a → f (n + 1) = some a
f0 : ↑⟨f, al⟩ 0 = none
h' : tail ⟨f, al⟩ = s'
⊢ ↑⟨f, al⟩ = ↑(tail ⟨f, al⟩).think
state_after: case none.mk.a
α : Type u
β : Type v
γ : Type w
s' : Computation α
f : Stream' (Option α)
al : ∀ ⦃n : ℕ⦄ ⦃a : α⦄, f n = some a → f (n + 1) = some a
f0 : ↑⟨f, al⟩ 0 = none
h' : tail ⟨f, al⟩ = s'
⊢ f = Stream'.cons none f.tail

tactic: rw [← f0]
state_before: case none.mk.a
α : Type u
β : Type v
γ : Type w
s' : Computation α
f : Stream' (Option α)
al : ∀ ⦃n : ℕ⦄ ⦃a : α⦄, f n = some a → f (n + 1) = some a
f0 : ↑⟨f, al⟩ 0 = none
h' : tail ⟨f, al⟩ = s'
⊢ f = Stream'.cons none f.tail
state_after: case none.mk.a
α : Type u
β : Type v
γ : Type w
s' : Computation α
f : Stream' (Option α)
al : ∀ ⦃n : ℕ⦄ ⦃a : α⦄, f n = some a → f (n + 1) = some a
f0 : ↑⟨f, al⟩ 0 = none
h' : tail ⟨f, al⟩ = s'
⊢ f = Stream'.cons (↑⟨f, al⟩ 0) f.tail

tactic: exact (Stream'.eta f).symm
state_before: case none.mk.a
α : Type u
β : Type v
γ : Type w
s' : Computation α
f : Stream' (Option α)
al : ∀ ⦃n : ℕ⦄ ⦃a : α⦄, f n = some a → f (n + 1) = some a
f0 : ↑⟨f, al⟩ 0 = none
h' : tail ⟨f, al⟩ = s'
⊢ f = Stream'.cons (↑⟨f, al⟩ 0) f.tail
state_after: no goals

tactic: contradiction
state_before: case some
α : Type u
β : Type v
γ : Type w
s s' : Computation α
a' : α
f0 : ↑s 0 = some a'
h :
  (match some a' with
    | none => Sum.inr s.tail
    | some a => Sum.inl a) =
    Sum.inr s'
⊢ s = s'.think
state_after: no goals