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

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

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

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

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

tactic: apply Subtype.eq
state_before: case some
α : Type u
β : Type v
γ : Type w
s : Computation α
a val✝ : α
f0 : ↑s 0 = some val✝
h :
  (match some val✝ with
    | none => Sum.inr s.tail
    | some a => Sum.inl a) =
    Sum.inl a
⊢ s = pure a
state_after: case some.a
α : Type u
β : Type v
γ : Type w
s : Computation α
a val✝ : α
f0 : ↑s 0 = some val✝
h :
  (match some val✝ with
    | none => Sum.inr s.tail
    | some a => Sum.inl a) =
    Sum.inl a
⊢ ↑s = ↑(pure a)

tactic: funext n
state_before: case some.a
α : Type u
β : Type v
γ : Type w
s : Computation α
a val✝ : α
f0 : ↑s 0 = some val✝
h :
  (match some val✝ with
    | none => Sum.inr s.tail
    | some a => Sum.inl a) =
    Sum.inl a
⊢ ↑s = ↑(pure a)
state_after: case some.a.h
α : Type u
β : Type v
γ : Type w
s : Computation α
a val✝ : α
f0 : ↑s 0 = some val✝
h :
  (match some val✝ with
    | none => Sum.inr s.tail
    | some a => Sum.inl a) =
    Sum.inl a
n : ℕ
⊢ ↑s n = ↑(pure a) n

tactic: induction' n with n IH
state_before: case some.a.h
α : Type u
β : Type v
γ : Type w
s : Computation α
a val✝ : α
f0 : ↑s 0 = some val✝
h :
  (match some val✝ with
    | none => Sum.inr s.tail
    | some a => Sum.inl a) =
    Sum.inl a
n : ℕ
⊢ ↑s n = ↑(pure a) n
state_after: case some.a.h.zero
α : Type u
β : Type v
γ : Type w
s : Computation α
a val✝ : α
f0 : ↑s 0 = some val✝
h :
  (match some val✝ with
    | none => Sum.inr s.tail
    | some a => Sum.inl a) =
    Sum.inl a
⊢ ↑s 0 = ↑(pure a) 0

case some.a.h.succ
α : Type u
β : Type v
γ : Type w
s : Computation α
a val✝ : α
f0 : ↑s 0 = some val✝
h :
  (match some val✝ with
    | none => Sum.inr s.tail
    | some a => Sum.inl a) =
    Sum.inl a
n : ℕ
IH : ↑s n = ↑(pure a) n
⊢ ↑s (n + 1) = ↑(pure a) (n + 1)

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

tactic: rwa [h'] at f0
state_before: case some.a.h.zero
α : Type u
β : Type v
γ : Type w
s : Computation α
a val✝ : α
f0 : ↑s 0 = some val✝
h' : val✝ = a
⊢ ↑s 0 = ↑(pure a) 0
state_after: no goals

tactic: exact s.2 IH
state_before: case some.a.h.succ
α : Type u
β : Type v
γ : Type w
s : Computation α
a val✝ : α
f0 : ↑s 0 = some val✝
h :
  (match some val✝ with
    | none => Sum.inr s.tail
    | some a => Sum.inl a) =
    Sum.inl a
n : ℕ
IH : ↑s n = ↑(pure a) n
⊢ ↑s (n + 1) = ↑(pure a) (n + 1)
state_after: no goals