Theorem: Turing.TM1to1.tr_supports
File: Mathlib/Computability/TuringMachine.lean

tactic: suffices ∀ q, SupportsStmt S q → (∀ q' ∈ writes q, q' ∈ trSupp M S) →
    SupportsStmt (trSupp M S) (trNormal dec q) ∧
    ∀ q' ∈ writes q, SupportsStmt (trSupp M S) (tr enc dec M q') by
  rcases Finset.mem_biUnion.1 h with ⟨l, hl, h⟩
  have :=
    this _ (ss.2 _ hl) fun q' hq ↦ Finset.mem_biUnion.2 ⟨_, hl, Finset.mem_insert_of_mem hq⟩
  rcases Finset.mem_insert.1 h with (rfl | h)
  exacts [this.1, this.2 _ h]
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (tr enc dec M q)

tactic: intro q hs hw
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
⊢ ∀ (q : Stmt₁),
    SupportsStmt S q →
      (∀ (q' : Λ'), q' ∈ writes q → q' ∈ trSupp M S) →
        SupportsStmt (trSupp M S) (trNormal dec q) ∧
          ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: induction q
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q✝ : Λ'
h : q✝ ∈ trSupp M S
q : Stmt₁
hs : SupportsStmt S q
hw : ∀ (q' : Λ'), q' ∈ writes q → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec q) ∧ ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: case move d q IH =>
  unfold writes at hw⊢
  replace IH := IH hs hw; refine' ⟨_, IH.2⟩
  cases d <;> simp only [trNormal, iterate, supportsStmt_move, IH]
state_before: case move
Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
a✝¹ : Dir
a✝ : Stmt₁
a_ih✝ :
  SupportsStmt S a✝ →
    (∀ (q' : Λ'), q' ∈ writes a✝ → q' ∈ trSupp M S) →
      SupportsStmt (trSupp M S) (trNormal dec a✝) ∧
        ∀ (q' : Λ'), q' ∈ writes a✝ → SupportsStmt (trSupp M S) (tr enc dec M q')
hs : SupportsStmt S (Stmt.move a✝¹ a✝)
hw : ∀ (q' : Λ'), q' ∈ writes (Stmt.move a✝¹ a✝) → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.move a✝¹ a✝)) ∧
    ∀ (q' : Λ'), q' ∈ writes (Stmt.move a✝¹ a✝) → SupportsStmt (trSupp M S) (tr enc dec M q')

case write
Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
a✝¹ : Γ → σ → Γ
a✝ : Stmt₁
a_ih✝ :
  SupportsStmt S a✝ →
    (∀ (q' : Λ'), q' ∈ writes a✝ → q' ∈ trSupp M S) →
      SupportsStmt (trSupp M S) (trNormal dec a✝) ∧
        ∀ (q' : Λ'), q' ∈ writes a✝ → SupportsStmt (trSupp M S) (tr enc dec M q')
hs : SupportsStmt S (Stmt.write a✝¹ a✝)
hw : ∀ (q' : Λ'), q' ∈ writes (Stmt.write a✝¹ a✝) → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.write a✝¹ a✝)) ∧
    ∀ (q' : Λ'), q' ∈ writes (Stmt.write a✝¹ a✝) → SupportsStmt (trSupp M S) (tr enc dec M q')

case load
Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
a✝¹ : Γ → σ → σ
a✝ : Stmt₁
a_ih✝ :
  SupportsStmt S a✝ →
    (∀ (q' : Λ'), q' ∈ writes a✝ → q' ∈ trSupp M S) →
      SupportsStmt (trSupp M S) (trNormal dec a✝) ∧
        ∀ (q' : Λ'), q' ∈ writes a✝ → SupportsStmt (trSupp M S) (tr enc dec M q')
hs : SupportsStmt S (Stmt.load a✝¹ a✝)
hw : ∀ (q' : Λ'), q' ∈ writes (Stmt.load a✝¹ a✝) → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.load a✝¹ a✝)) ∧
    ∀ (q' : Λ'), q' ∈ writes (Stmt.load a✝¹ a✝) → SupportsStmt (trSupp M S) (tr enc dec M q')

case branch
Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
a✝² : Γ → σ → Bool
a✝¹ a✝ : Stmt₁
a_ih✝¹ :
  SupportsStmt S a✝¹ →
    (∀ (q' : Λ'), q' ∈ writes a✝¹ → q' ∈ trSupp M S) →
      SupportsStmt (trSupp M S) (trNormal dec a✝¹) ∧
        ∀ (q' : Λ'), q' ∈ writes a✝¹ → SupportsStmt (trSupp M S) (tr enc dec M q')
a_ih✝ :
  SupportsStmt S a✝ →
    (∀ (q' : Λ'), q' ∈ writes a✝ → q' ∈ trSupp M S) →
      SupportsStmt (trSupp M S) (trNormal dec a✝) ∧
        ∀ (q' : Λ'), q' ∈ writes a✝ → SupportsStmt (trSupp M S) (tr enc dec M q')
hs : SupportsStmt S (Stmt.branch a✝² a✝¹ a✝)
hw : ∀ (q' : Λ'), q' ∈ writes (Stmt.branch a✝² a✝¹ a✝) → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.branch a✝² a✝¹ a✝)) ∧
    ∀ (q' : Λ'), q' ∈ writes (Stmt.branch a✝² a✝¹ a✝) → SupportsStmt (trSupp M S) (tr enc dec M q')

case goto
Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
a✝ : Γ → σ → Λ
hs : SupportsStmt S (Stmt.goto a✝)
hw : ∀ (q' : Λ'), q' ∈ writes (Stmt.goto a✝) → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.goto a✝)) ∧
    ∀ (q' : Λ'), q' ∈ writes (Stmt.goto a✝) → SupportsStmt (trSupp M S) (tr enc dec M q')

case halt
Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
hs : SupportsStmt S Stmt.halt
hw : ∀ (q' : Λ'), q' ∈ writes Stmt.halt → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec Stmt.halt) ∧
    ∀ (q' : Λ'), q' ∈ writes Stmt.halt → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: case load a q IH =>
  unfold writes at hw⊢
  replace IH := IH hs hw
  refine' ⟨supportsStmt_read _ fun _ ↦ IH.1, IH.2⟩
state_before: case load
Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
a✝¹ : Γ → σ → σ
a✝ : Stmt₁
a_ih✝ :
  SupportsStmt S a✝ →
    (∀ (q' : Λ'), q' ∈ writes a✝ → q' ∈ trSupp M S) →
      SupportsStmt (trSupp M S) (trNormal dec a✝) ∧
        ∀ (q' : Λ'), q' ∈ writes a✝ → SupportsStmt (trSupp M S) (tr enc dec M q')
hs : SupportsStmt S (Stmt.load a✝¹ a✝)
hw : ∀ (q' : Λ'), q' ∈ writes (Stmt.load a✝¹ a✝) → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.load a✝¹ a✝)) ∧
    ∀ (q' : Λ'), q' ∈ writes (Stmt.load a✝¹ a✝) → SupportsStmt (trSupp M S) (tr enc dec M q')

case branch
Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
a✝² : Γ → σ → Bool
a✝¹ a✝ : Stmt₁
a_ih✝¹ :
  SupportsStmt S a✝¹ →
    (∀ (q' : Λ'), q' ∈ writes a✝¹ → q' ∈ trSupp M S) →
      SupportsStmt (trSupp M S) (trNormal dec a✝¹) ∧
        ∀ (q' : Λ'), q' ∈ writes a✝¹ → SupportsStmt (trSupp M S) (tr enc dec M q')
a_ih✝ :
  SupportsStmt S a✝ →
    (∀ (q' : Λ'), q' ∈ writes a✝ → q' ∈ trSupp M S) →
      SupportsStmt (trSupp M S) (trNormal dec a✝) ∧
        ∀ (q' : Λ'), q' ∈ writes a✝ → SupportsStmt (trSupp M S) (tr enc dec M q')
hs : SupportsStmt S (Stmt.branch a✝² a✝¹ a✝)
hw : ∀ (q' : Λ'), q' ∈ writes (Stmt.branch a✝² a✝¹ a✝) → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.branch a✝² a✝¹ a✝)) ∧
    ∀ (q' : Λ'), q' ∈ writes (Stmt.branch a✝² a✝¹ a✝) → SupportsStmt (trSupp M S) (tr enc dec M q')

case goto
Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
a✝ : Γ → σ → Λ
hs : SupportsStmt S (Stmt.goto a✝)
hw : ∀ (q' : Λ'), q' ∈ writes (Stmt.goto a✝) → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.goto a✝)) ∧
    ∀ (q' : Λ'), q' ∈ writes (Stmt.goto a✝) → SupportsStmt (trSupp M S) (tr enc dec M q')

case halt
Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
hs : SupportsStmt S Stmt.halt
hw : ∀ (q' : Λ'), q' ∈ writes Stmt.halt → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec Stmt.halt) ∧
    ∀ (q' : Λ'), q' ∈ writes Stmt.halt → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: case branch p q₁ q₂ IH₁ IH₂ =>
  unfold writes at hw⊢
  simp only [Finset.mem_union] at hw⊢
  replace IH₁ := IH₁ hs.1 fun q hq ↦ hw q (Or.inl hq)
  replace IH₂ := IH₂ hs.2 fun q hq ↦ hw q (Or.inr hq)
  exact ⟨supportsStmt_read _ fun _ ↦ ⟨IH₁.1, IH₂.1⟩, fun q ↦ Or.rec (IH₁.2 _) (IH₂.2 _)⟩
state_before: case branch
Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
a✝² : Γ → σ → Bool
a✝¹ a✝ : Stmt₁
a_ih✝¹ :
  SupportsStmt S a✝¹ →
    (∀ (q' : Λ'), q' ∈ writes a✝¹ → q' ∈ trSupp M S) →
      SupportsStmt (trSupp M S) (trNormal dec a✝¹) ∧
        ∀ (q' : Λ'), q' ∈ writes a✝¹ → SupportsStmt (trSupp M S) (tr enc dec M q')
a_ih✝ :
  SupportsStmt S a✝ →
    (∀ (q' : Λ'), q' ∈ writes a✝ → q' ∈ trSupp M S) →
      SupportsStmt (trSupp M S) (trNormal dec a✝) ∧
        ∀ (q' : Λ'), q' ∈ writes a✝ → SupportsStmt (trSupp M S) (tr enc dec M q')
hs : SupportsStmt S (Stmt.branch a✝² a✝¹ a✝)
hw : ∀ (q' : Λ'), q' ∈ writes (Stmt.branch a✝² a✝¹ a✝) → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.branch a✝² a✝¹ a✝)) ∧
    ∀ (q' : Λ'), q' ∈ writes (Stmt.branch a✝² a✝¹ a✝) → SupportsStmt (trSupp M S) (tr enc dec M q')

case goto
Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
a✝ : Γ → σ → Λ
hs : SupportsStmt S (Stmt.goto a✝)
hw : ∀ (q' : Λ'), q' ∈ writes (Stmt.goto a✝) → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.goto a✝)) ∧
    ∀ (q' : Λ'), q' ∈ writes (Stmt.goto a✝) → SupportsStmt (trSupp M S) (tr enc dec M q')

case halt
Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
hs : SupportsStmt S Stmt.halt
hw : ∀ (q' : Λ'), q' ∈ writes Stmt.halt → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec Stmt.halt) ∧
    ∀ (q' : Λ'), q' ∈ writes Stmt.halt → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: case goto l =>
  simp only [writes, Finset.not_mem_empty]; refine' ⟨_, fun _ ↦ False.elim⟩
  refine' supportsStmt_read _ fun a _ s ↦ _
  exact Finset.mem_biUnion.2 ⟨_, hs _ _, Finset.mem_insert_self _ _⟩
state_before: case goto
Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
a✝ : Γ → σ → Λ
hs : SupportsStmt S (Stmt.goto a✝)
hw : ∀ (q' : Λ'), q' ∈ writes (Stmt.goto a✝) → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.goto a✝)) ∧
    ∀ (q' : Λ'), q' ∈ writes (Stmt.goto a✝) → SupportsStmt (trSupp M S) (tr enc dec M q')

case halt
Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
hs : SupportsStmt S Stmt.halt
hw : ∀ (q' : Λ'), q' ∈ writes Stmt.halt → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec Stmt.halt) ∧
    ∀ (q' : Λ'), q' ∈ writes Stmt.halt → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: case halt =>
  simp only [writes, Finset.not_mem_empty]; refine' ⟨_, fun _ ↦ False.elim⟩
  simp only [SupportsStmt, supportsStmt_move, trNormal]
state_before: case halt
Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
hs : SupportsStmt S Stmt.halt
hw : ∀ (q' : Λ'), q' ∈ writes Stmt.halt → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec Stmt.halt) ∧
    ∀ (q' : Λ'), q' ∈ writes Stmt.halt → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: rcases Finset.mem_biUnion.1 h with ⟨l, hl, h⟩
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
this :
  ∀ (q : Stmt₁),
    SupportsStmt S q →
      (∀ (q' : Λ'), q' ∈ writes q → q' ∈ trSupp M S) →
        SupportsStmt (trSupp M S) (trNormal dec q) ∧
          ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')
⊢ SupportsStmt (trSupp M S) (tr enc dec M q)

tactic: have :=
  this _ (ss.2 _ hl) fun q' hq ↦ Finset.mem_biUnion.2 ⟨_, hl, Finset.mem_insert_of_mem hq⟩
state_before: case intro.intro
Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h✝ : q ∈ trSupp M S
this :
  ∀ (q : Stmt₁),
    SupportsStmt S q →
      (∀ (q' : Λ'), q' ∈ writes q → q' ∈ trSupp M S) →
        SupportsStmt (trSupp M S) (trNormal dec q) ∧
          ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')
l : Λ
hl : l ∈ S
h : q ∈ insert (Λ'.normal l) (writes (M l))
⊢ SupportsStmt (trSupp M S) (tr enc dec M q)

tactic: rcases Finset.mem_insert.1 h with (rfl | h)
state_before: case intro.intro
Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h✝ : q ∈ trSupp M S
this✝ :
  ∀ (q : Stmt₁),
    SupportsStmt S q →
      (∀ (q' : Λ'), q' ∈ writes q → q' ∈ trSupp M S) →
        SupportsStmt (trSupp M S) (trNormal dec q) ∧
          ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')
l : Λ
hl : l ∈ S
h : q ∈ insert (Λ'.normal l) (writes (M l))
this :
  SupportsStmt (trSupp M S) (trNormal dec (M l)) ∧
    ∀ (q' : Λ'), q' ∈ writes (M l) → SupportsStmt (trSupp M S) (tr enc dec M q')
⊢ SupportsStmt (trSupp M S) (tr enc dec M q)

tactic: exacts [this.1, this.2 _ h]
state_before: case intro.intro.inl
Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
this✝ :
  ∀ (q : Stmt₁),
    SupportsStmt S q →
      (∀ (q' : Λ'), q' ∈ writes q → q' ∈ trSupp M S) →
        SupportsStmt (trSupp M S) (trNormal dec q) ∧
          ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')
l : Λ
hl : l ∈ S
this :
  SupportsStmt (trSupp M S) (trNormal dec (M l)) ∧
    ∀ (q' : Λ'), q' ∈ writes (M l) → SupportsStmt (trSupp M S) (tr enc dec M q')
h✝ : Λ'.normal l ∈ trSupp M S
h : Λ'.normal l ∈ insert (Λ'.normal l) (writes (M l))
⊢ SupportsStmt (trSupp M S) (tr enc dec M (Λ'.normal l))

case intro.intro.inr
Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h✝¹ : q ∈ trSupp M S
this✝ :
  ∀ (q : Stmt₁),
    SupportsStmt S q →
      (∀ (q' : Λ'), q' ∈ writes q → q' ∈ trSupp M S) →
        SupportsStmt (trSupp M S) (trNormal dec q) ∧
          ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')
l : Λ
hl : l ∈ S
h✝ : q ∈ insert (Λ'.normal l) (writes (M l))
this :
  SupportsStmt (trSupp M S) (trNormal dec (M l)) ∧
    ∀ (q' : Λ'), q' ∈ writes (M l) → SupportsStmt (trSupp M S) (tr enc dec M q')
h : q ∈ writes (M l)
⊢ SupportsStmt (trSupp M S) (tr enc dec M q)

tactic: unfold writes at hw⊢
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q✝ : Λ'
h : q✝ ∈ trSupp M S
d : Dir
q : Stmt₁
IH :
  SupportsStmt S q →
    (∀ (q' : Λ'), q' ∈ writes q → q' ∈ trSupp M S) →
      SupportsStmt (trSupp M S) (trNormal dec q) ∧
        ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')
hs : SupportsStmt S (Stmt.move d q)
hw : ∀ (q' : Λ'), q' ∈ writes (Stmt.move d q) → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.move d q)) ∧
    ∀ (q' : Λ'), q' ∈ writes (Stmt.move d q) → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: replace IH := IH hs hw
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q✝ : Λ'
h : q✝ ∈ trSupp M S
d : Dir
q : Stmt₁
IH :
  SupportsStmt S q →
    (∀ (q' : Λ'), q' ∈ writes q → q' ∈ trSupp M S) →
      SupportsStmt (trSupp M S) (trNormal dec q) ∧
        ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')
hs : SupportsStmt S (Stmt.move d q)
hw : ∀ (q' : Λ'), q' ∈ writes q → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.move d q)) ∧
    ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: refine' ⟨_, IH.2⟩
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q✝ : Λ'
h : q✝ ∈ trSupp M S
d : Dir
q : Stmt₁
hs : SupportsStmt S (Stmt.move d q)
hw : ∀ (q' : Λ'), q' ∈ writes q → q' ∈ trSupp M S
IH :
  SupportsStmt (trSupp M S) (trNormal dec q) ∧ ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.move d q)) ∧
    ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: cases d <;> simp only [trNormal, iterate, supportsStmt_move, IH]
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q✝ : Λ'
h : q✝ ∈ trSupp M S
d : Dir
q : Stmt₁
hs : SupportsStmt S (Stmt.move d q)
hw : ∀ (q' : Λ'), q' ∈ writes q → q' ∈ trSupp M S
IH :
  SupportsStmt (trSupp M S) (trNormal dec q) ∧ ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.move d q))

tactic: unfold writes at hw⊢
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q✝ : Λ'
h : q✝ ∈ trSupp M S
f : Γ → σ → Γ
q : Stmt₁
IH :
  SupportsStmt S q →
    (∀ (q' : Λ'), q' ∈ writes q → q' ∈ trSupp M S) →
      SupportsStmt (trSupp M S) (trNormal dec q) ∧
        ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')
hs : SupportsStmt S (Stmt.write f q)
hw : ∀ (q' : Λ'), q' ∈ writes (Stmt.write f q) → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.write f q)) ∧
    ∀ (q' : Λ'), q' ∈ writes (Stmt.write f q) → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: simp only [Finset.mem_image, Finset.mem_union, Finset.mem_univ, exists_prop, true_and_iff]
  at hw⊢
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q✝ : Λ'
h : q✝ ∈ trSupp M S
f : Γ → σ → Γ
q : Stmt₁
IH :
  SupportsStmt S q →
    (∀ (q' : Λ'), q' ∈ writes q → q' ∈ trSupp M S) →
      SupportsStmt (trSupp M S) (trNormal dec q) ∧
        ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')
hs : SupportsStmt S (Stmt.write f q)
hw : ∀ (q' : Λ'), q' ∈ Finset.image (fun a => Λ'.write a q) Finset.univ ∪ writes q → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.write f q)) ∧
    ∀ (q' : Λ'),
      q' ∈ Finset.image (fun a => Λ'.write a q) Finset.univ ∪ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: replace IH := IH hs fun q hq ↦ hw q (Or.inr hq)
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q✝ : Λ'
h : q✝ ∈ trSupp M S
f : Γ → σ → Γ
q : Stmt₁
IH :
  SupportsStmt S q →
    (∀ (q' : Λ'), q' ∈ writes q → q' ∈ trSupp M S) →
      SupportsStmt (trSupp M S) (trNormal dec q) ∧
        ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')
hs : SupportsStmt S (Stmt.write f q)
hw : ∀ (q' : Λ'), (∃ a, Λ'.write a q = q') ∨ q' ∈ writes q → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.write f q)) ∧
    ∀ (q' : Λ'), (∃ a, Λ'.write a q = q') ∨ q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: refine' ⟨supportsStmt_read _ fun a _ s ↦ hw _ (Or.inl ⟨_, rfl⟩), fun q' hq ↦ _⟩
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q✝ : Λ'
h : q✝ ∈ trSupp M S
f : Γ → σ → Γ
q : Stmt₁
hs : SupportsStmt S (Stmt.write f q)
hw : ∀ (q' : Λ'), (∃ a, Λ'.write a q = q') ∨ q' ∈ writes q → q' ∈ trSupp M S
IH :
  SupportsStmt (trSupp M S) (trNormal dec q) ∧ ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.write f q)) ∧
    ∀ (q' : Λ'), (∃ a, Λ'.write a q = q') ∨ q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: rcases hq with (⟨a, q₂, rfl⟩ | hq)
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q✝ : Λ'
h : q✝ ∈ trSupp M S
f : Γ → σ → Γ
q : Stmt₁
hs : SupportsStmt S (Stmt.write f q)
hw : ∀ (q' : Λ'), (∃ a, Λ'.write a q = q') ∨ q' ∈ writes q → q' ∈ trSupp M S
IH :
  SupportsStmt (trSupp M S) (trNormal dec q) ∧ ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')
q' : Λ'
hq : (∃ a, Λ'.write a q = q') ∨ q' ∈ writes q
⊢ SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: simp only [tr, supportsStmt_write, supportsStmt_move, IH.1]
state_before: case inl.intro.refl
Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q✝ : Λ'
h : q✝ ∈ trSupp M S
f : Γ → σ → Γ
q : Stmt₁
hs : SupportsStmt S (Stmt.write f q)
hw : ∀ (q' : Λ'), (∃ a, Λ'.write a q = q') ∨ q' ∈ writes q → q' ∈ trSupp M S
IH :
  SupportsStmt (trSupp M S) (trNormal dec q) ∧ ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')
a : Γ
⊢ SupportsStmt (trSupp M S) (tr enc dec M (Λ'.write a q))

tactic: exact IH.2 _ hq
state_before: case inr
Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q✝ : Λ'
h : q✝ ∈ trSupp M S
f : Γ → σ → Γ
q : Stmt₁
hs : SupportsStmt S (Stmt.write f q)
hw : ∀ (q' : Λ'), (∃ a, Λ'.write a q = q') ∨ q' ∈ writes q → q' ∈ trSupp M S
IH :
  SupportsStmt (trSupp M S) (trNormal dec q) ∧ ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')
q' : Λ'
hq : q' ∈ writes q
⊢ SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: unfold writes at hw⊢
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q✝ : Λ'
h : q✝ ∈ trSupp M S
a : Γ → σ → σ
q : Stmt₁
IH :
  SupportsStmt S q →
    (∀ (q' : Λ'), q' ∈ writes q → q' ∈ trSupp M S) →
      SupportsStmt (trSupp M S) (trNormal dec q) ∧
        ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')
hs : SupportsStmt S (Stmt.load a q)
hw : ∀ (q' : Λ'), q' ∈ writes (Stmt.load a q) → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.load a q)) ∧
    ∀ (q' : Λ'), q' ∈ writes (Stmt.load a q) → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: replace IH := IH hs hw
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q✝ : Λ'
h : q✝ ∈ trSupp M S
a : Γ → σ → σ
q : Stmt₁
IH :
  SupportsStmt S q →
    (∀ (q' : Λ'), q' ∈ writes q → q' ∈ trSupp M S) →
      SupportsStmt (trSupp M S) (trNormal dec q) ∧
        ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')
hs : SupportsStmt S (Stmt.load a q)
hw : ∀ (q' : Λ'), q' ∈ writes q → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.load a q)) ∧
    ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: refine' ⟨supportsStmt_read _ fun _ ↦ IH.1, IH.2⟩
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q✝ : Λ'
h : q✝ ∈ trSupp M S
a : Γ → σ → σ
q : Stmt₁
hs : SupportsStmt S (Stmt.load a q)
hw : ∀ (q' : Λ'), q' ∈ writes q → q' ∈ trSupp M S
IH :
  SupportsStmt (trSupp M S) (trNormal dec q) ∧ ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.load a q)) ∧
    ∀ (q' : Λ'), q' ∈ writes q → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: unfold writes at hw⊢
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
p : Γ → σ → Bool
q₁ q₂ : Stmt₁
IH₁ :
  SupportsStmt S q₁ →
    (∀ (q' : Λ'), q' ∈ writes q₁ → q' ∈ trSupp M S) →
      SupportsStmt (trSupp M S) (trNormal dec q₁) ∧
        ∀ (q' : Λ'), q' ∈ writes q₁ → SupportsStmt (trSupp M S) (tr enc dec M q')
IH₂ :
  SupportsStmt S q₂ →
    (∀ (q' : Λ'), q' ∈ writes q₂ → q' ∈ trSupp M S) →
      SupportsStmt (trSupp M S) (trNormal dec q₂) ∧
        ∀ (q' : Λ'), q' ∈ writes q₂ → SupportsStmt (trSupp M S) (tr enc dec M q')
hs : SupportsStmt S (Stmt.branch p q₁ q₂)
hw : ∀ (q' : Λ'), q' ∈ writes (Stmt.branch p q₁ q₂) → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.branch p q₁ q₂)) ∧
    ∀ (q' : Λ'), q' ∈ writes (Stmt.branch p q₁ q₂) → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: simp only [Finset.mem_union] at hw⊢
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
p : Γ → σ → Bool
q₁ q₂ : Stmt₁
IH₁ :
  SupportsStmt S q₁ →
    (∀ (q' : Λ'), q' ∈ writes q₁ → q' ∈ trSupp M S) →
      SupportsStmt (trSupp M S) (trNormal dec q₁) ∧
        ∀ (q' : Λ'), q' ∈ writes q₁ → SupportsStmt (trSupp M S) (tr enc dec M q')
IH₂ :
  SupportsStmt S q₂ →
    (∀ (q' : Λ'), q' ∈ writes q₂ → q' ∈ trSupp M S) →
      SupportsStmt (trSupp M S) (trNormal dec q₂) ∧
        ∀ (q' : Λ'), q' ∈ writes q₂ → SupportsStmt (trSupp M S) (tr enc dec M q')
hs : SupportsStmt S (Stmt.branch p q₁ q₂)
hw : ∀ (q' : Λ'), q' ∈ writes q₁ ∪ writes q₂ → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.branch p q₁ q₂)) ∧
    ∀ (q' : Λ'), q' ∈ writes q₁ ∪ writes q₂ → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: replace IH₁ := IH₁ hs.1 fun q hq ↦ hw q (Or.inl hq)
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
p : Γ → σ → Bool
q₁ q₂ : Stmt₁
IH₁ :
  SupportsStmt S q₁ →
    (∀ (q' : Λ'), q' ∈ writes q₁ → q' ∈ trSupp M S) →
      SupportsStmt (trSupp M S) (trNormal dec q₁) ∧
        ∀ (q' : Λ'), q' ∈ writes q₁ → SupportsStmt (trSupp M S) (tr enc dec M q')
IH₂ :
  SupportsStmt S q₂ →
    (∀ (q' : Λ'), q' ∈ writes q₂ → q' ∈ trSupp M S) →
      SupportsStmt (trSupp M S) (trNormal dec q₂) ∧
        ∀ (q' : Λ'), q' ∈ writes q₂ → SupportsStmt (trSupp M S) (tr enc dec M q')
hs : SupportsStmt S (Stmt.branch p q₁ q₂)
hw : ∀ (q' : Λ'), q' ∈ writes q₁ ∨ q' ∈ writes q₂ → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.branch p q₁ q₂)) ∧
    ∀ (q' : Λ'), q' ∈ writes q₁ ∨ q' ∈ writes q₂ → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: replace IH₂ := IH₂ hs.2 fun q hq ↦ hw q (Or.inr hq)
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
p : Γ → σ → Bool
q₁ q₂ : Stmt₁
IH₂ :
  SupportsStmt S q₂ →
    (∀ (q' : Λ'), q' ∈ writes q₂ → q' ∈ trSupp M S) →
      SupportsStmt (trSupp M S) (trNormal dec q₂) ∧
        ∀ (q' : Λ'), q' ∈ writes q₂ → SupportsStmt (trSupp M S) (tr enc dec M q')
hs : SupportsStmt S (Stmt.branch p q₁ q₂)
hw : ∀ (q' : Λ'), q' ∈ writes q₁ ∨ q' ∈ writes q₂ → q' ∈ trSupp M S
IH₁ :
  SupportsStmt (trSupp M S) (trNormal dec q₁) ∧
    ∀ (q' : Λ'), q' ∈ writes q₁ → SupportsStmt (trSupp M S) (tr enc dec M q')
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.branch p q₁ q₂)) ∧
    ∀ (q' : Λ'), q' ∈ writes q₁ ∨ q' ∈ writes q₂ → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: exact ⟨supportsStmt_read _ fun _ ↦ ⟨IH₁.1, IH₂.1⟩, fun q ↦ Or.rec (IH₁.2 _) (IH₂.2 _)⟩
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
p : Γ → σ → Bool
q₁ q₂ : Stmt₁
hs : SupportsStmt S (Stmt.branch p q₁ q₂)
hw : ∀ (q' : Λ'), q' ∈ writes q₁ ∨ q' ∈ writes q₂ → q' ∈ trSupp M S
IH₁ :
  SupportsStmt (trSupp M S) (trNormal dec q₁) ∧
    ∀ (q' : Λ'), q' ∈ writes q₁ → SupportsStmt (trSupp M S) (tr enc dec M q')
IH₂ :
  SupportsStmt (trSupp M S) (trNormal dec q₂) ∧
    ∀ (q' : Λ'), q' ∈ writes q₂ → SupportsStmt (trSupp M S) (tr enc dec M q')
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.branch p q₁ q₂)) ∧
    ∀ (q' : Λ'), q' ∈ writes q₁ ∨ q' ∈ writes q₂ → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: simp only [writes, Finset.not_mem_empty]
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
l : Γ → σ → Λ
hs : SupportsStmt S (Stmt.goto l)
hw : ∀ (q' : Λ'), q' ∈ writes (Stmt.goto l) → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.goto l)) ∧
    ∀ (q' : Λ'), q' ∈ writes (Stmt.goto l) → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: refine' ⟨_, fun _ ↦ False.elim⟩
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
l : Γ → σ → Λ
hs : SupportsStmt S (Stmt.goto l)
hw : ∀ (q' : Λ'), q' ∈ writes (Stmt.goto l) → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.goto l)) ∧
    ∀ (q' : Λ'), False → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: refine' supportsStmt_read _ fun a _ s ↦ _
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
l : Γ → σ → Λ
hs : SupportsStmt S (Stmt.goto l)
hw : ∀ (q' : Λ'), q' ∈ writes (Stmt.goto l) → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec (Stmt.goto l))

tactic: exact Finset.mem_biUnion.2 ⟨_, hs _ _, Finset.mem_insert_self _ _⟩
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
l : Γ → σ → Λ
hs : SupportsStmt S (Stmt.goto l)
hw : ∀ (q' : Λ'), q' ∈ writes (Stmt.goto l) → q' ∈ trSupp M S
a : Γ
x✝ : Bool
s : σ
⊢ (fun x s => Λ'.normal (l a s)) x✝ s ∈ trSupp M S

tactic: simp only [writes, Finset.not_mem_empty]
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
hs : SupportsStmt S Stmt.halt
hw : ∀ (q' : Λ'), q' ∈ writes Stmt.halt → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec Stmt.halt) ∧
    ∀ (q' : Λ'), q' ∈ writes Stmt.halt → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: refine' ⟨_, fun _ ↦ False.elim⟩
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
hs : SupportsStmt S Stmt.halt
hw : ∀ (q' : Λ'), q' ∈ writes Stmt.halt → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec Stmt.halt) ∧ ∀ (q' : Λ'), False → SupportsStmt (trSupp M S) (tr enc dec M q')

tactic: simp only [SupportsStmt, supportsStmt_move, trNormal]
state_before: Γ : Type u_2
inst✝³ : Inhabited Γ
Λ : Type u_1
inst✝² : Inhabited Λ
σ : Type u_3
inst✝¹ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
inst✝ : Fintype Γ
S : Finset Λ
ss : Supports M S
q : Λ'
h : q ∈ trSupp M S
hs : SupportsStmt S Stmt.halt
hw : ∀ (q' : Λ'), q' ∈ writes Stmt.halt → q' ∈ trSupp M S
⊢ SupportsStmt (trSupp M S) (trNormal dec Stmt.halt)