@@ -1238,7 +1238,7 @@ theorem move_ok {p k₁ k₂ q s L₁ o L₂} {S : K' → List Γ'} (h₁ : k₁
12381238 swap
12391239 · rw [Function.update_of_ne h₁.symm, List.reverseAux_nil]
12401240 refine TransGen.head' rfl ?_
1241- simp only [TM2.step, Option.mem_def, TM2.stepAux, Option.elim, ne_eq ]
1241+ rw [tr]; simp only [pop', TM2.stepAux]
12421242 revert e; cases' S k₁ with a Sk <;> intro e
12431243 · cases e
12441244 rfl
@@ -1248,7 +1248,7 @@ theorem move_ok {p k₁ k₂ q s L₁ o L₂} {S : K' → List Γ'} (h₁ : k₁
12481248 simp only [e]
12491249 rfl
12501250 · refine TransGen.head rfl ?_
1251- simp only [TM2.step , Option.mem_def , TM2.stepAux, Option.elim, ne_eq, List.reverseAux_cons ]
1251+ rw [tr]; simp only [pop' , Option.elim , TM2.stepAux, push' ]
12521252 cases' e₁ : S k₁ with a' Sk <;> rw [e₁, splitAtPred] at e
12531253 · cases e
12541254 cases e₂ : p a' <;> simp only [e₂, cond] at e
@@ -1273,16 +1273,15 @@ theorem move₂_ok {p k₁ k₂ q s L₁ o L₂} {S : K' → List Γ'} (h₁ : k
12731273 ⟨some q, none, update (update S k₁ (o.elim id List.cons L₂)) k₂ (L₁ ++ S k₂)⟩ := by
12741274 refine (move_ok h₁.1 e).trans (TransGen.head rfl ?_)
12751275 simp only [TM2.step, Option.mem_def, TM2.stepAux, id_eq, ne_eq, Option.elim]
1276- cases o <;> simp only [Option.elim, id ]
1277- · simp only [TM2.stepAux, Option.isSome, cond_false]
1278- convert move_ok h₁.2 .1 .symm (splitAtPred_false _) using 2
1276+ cases o <;> simp only [Option.elim] <;> rw [tr ]
1277+ <;> simp only [id, TM2.stepAux, Option.isSome, cond_true , cond_false]
1278+ · convert move_ok h₁.2 .1 .symm (splitAtPred_false _) using 2
12791279 simp only [Function.update_comm h₁.1 , Function.update_idem]
12801280 rw [show update S rev [] = S by rw [← h₂, Function.update_eq_self]]
12811281 simp only [Function.update_of_ne h₁.2 .2 .symm, Function.update_of_ne h₁.2 .1 ,
12821282 Function.update_of_ne h₁.1 .symm, List.reverseAux_eq, h₂, Function.update_self,
12831283 List.append_nil, List.reverse_reverse]
1284- · simp only [TM2.stepAux, Option.isSome, cond_true]
1285- convert move_ok h₁.2 .1 .symm (splitAtPred_false _) using 2
1284+ · convert move_ok h₁.2 .1 .symm (splitAtPred_false _) using 2
12861285 simp only [h₂, Function.update_comm h₁.1 , List.reverseAux_eq, Function.update_self,
12871286 List.append_nil, Function.update_idem]
12881287 rw [show update S rev [] = S by rw [← h₂, Function.update_eq_self]]
@@ -1293,7 +1292,7 @@ theorem clear_ok {p k q s L₁ o L₂} {S : K' → List Γ'} (e : splitAtPred p
12931292 Reaches₁ (TM2.step tr) ⟨some (Λ'.clear p k q), s, S⟩ ⟨some q, o, update S k L₂⟩ := by
12941293 induction' L₁ with a L₁ IH generalizing S s
12951294 · refine TransGen.head' rfl ?_
1296- simp only [TM2.step, Option.mem_def, TM2.stepAux, Option.elim]
1295+ rw [tr]; simp only [pop', TM2.step, Option.mem_def, TM2.stepAux, Option.elim]
12971296 revert e; cases' S k with a Sk <;> intro e
12981297 · cases e
12991298 rfl
@@ -1303,7 +1302,7 @@ theorem clear_ok {p k q s L₁ o L₂} {S : K' → List Γ'} (e : splitAtPred p
13031302 rcases e with ⟨e₁, e₂⟩
13041303 rw [e₁, e₂]
13051304 · refine TransGen.head rfl ?_
1306- simp only [TM2.step, Option.mem_def, TM2.stepAux, Option.elim]
1305+ rw [tr]; simp only [pop', TM2.step, Option.mem_def, TM2.stepAux, Option.elim]
13071306 cases' e₁ : S k with a' Sk <;> rw [e₁, splitAtPred] at e
13081307 · cases e
13091308 cases e₂ : p a' <;> simp only [e₂, cond] at e
@@ -1322,9 +1321,10 @@ theorem copy_ok (q s a b c d) :
13221321 · refine TransGen.single ?_
13231322 simp
13241323 refine TransGen.head rfl ?_
1324+ rw [tr]
13251325 simp only [TM2.step, Option.mem_def, TM2.stepAux, elim_rev, List.head?_cons, Option.isSome_some,
13261326 List.tail_cons, elim_update_rev, ne_eq, Function.update_of_ne, elim_main, elim_update_main,
1327- elim_stack, elim_update_stack, cond_true, List.reverseAux_cons]
1327+ elim_stack, elim_update_stack, cond_true, List.reverseAux_cons, pop', push' ]
13281328 exact IH _ _ _
13291329
13301330theorem trPosNum_natEnd : ∀ (n), ∀ x ∈ trPosNum n, natEnd x = false
@@ -1358,6 +1358,7 @@ theorem head_main_ok {q s L} {c d : List Γ'} :
13581358 (splitAtPred_eq _ _ (trNat L.headI) o (trList L.tail) (trNat_natEnd _) ?_)).trans
13591359 (TransGen.head rfl (TransGen.head rfl ?_))
13601360 · cases L <;> simp [o]
1361+ rw [tr]
13611362 simp only [TM2.step, Option.mem_def, TM2.stepAux, elim_update_main, elim_rev, elim_update_rev,
13621363 Function.update_self, trList]
13631364 rw [if_neg (show o ≠ some Γ'.consₗ by cases L <;> simp [o])]
@@ -1375,6 +1376,7 @@ theorem head_stack_ok {q s L₁ L₂ L₃} :
13751376 (move_ok (by decide)
13761377 (splitAtPred_eq _ _ [] (some Γ'.consₗ) L₃ (by rintro _ ⟨⟩) ⟨rfl, rfl⟩))
13771378 (TransGen.head rfl (TransGen.head rfl ?_))
1379+ rw [tr]
13781380 simp only [TM2.step, Option.mem_def, TM2.stepAux, ite_true, id_eq, trList, List.nil_append,
13791381 elim_update_stack, elim_rev, List.reverseAux_nil, elim_update_rev, Function.update_self,
13801382 List.headI_nil, trNat_default]
@@ -1428,7 +1430,8 @@ theorem succ_ok {q s n} {c d : List Γ'} :
14281430 simp [PosNum.succ, trPosNum]
14291431 rfl
14301432 · refine ⟨l₁, _, some Γ'.bit0, rfl, TransGen.single ?_⟩
1431- simp only [TM2.step, TM2.stepAux, elim_main, elim_update_main, ne_eq, Function.update_of_ne,
1433+ simp only [TM2.step]; rw [tr]
1434+ simp only [TM2.stepAux, pop', elim_main, elim_update_main, ne_eq, Function.update_of_ne,
14321435 elim_rev, elim_update_rev, Function.update_self, Option.mem_def, Option.some.injEq]
14331436 rfl
14341437
@@ -1445,11 +1448,9 @@ theorem pred_ok (q₁ q₂ s v) (c d : List Γ') : ∃ s',
14451448 simp only [TM2.step, trList, trNat.eq_1, trNum, Nat.cast_succ, Num.add_one, Num.succ,
14461449 List.tail_cons, List.headI_cons]
14471450 cases' (n : Num) with a
1448- · simp only [trPosNum, List.singleton_append, List.nil_append]
1451+ · simp only [trPosNum, Num.succ', List.singleton_append, List.nil_append]
14491452 refine TransGen.head rfl ?_
1450- simp only [Option.mem_def, TM2.stepAux, elim_main, List.head?_cons, Option.some.injEq,
1451- decide_false, List.tail_cons, elim_update_main, ne_eq, Function.update_of_ne, elim_rev,
1452- elim_update_rev, natEnd, Function.update_self, cond_true, cond_false]
1453+ rw [tr]; simp only [pop', TM2.stepAux, cond_false]
14531454 convert unrev_ok using 2
14541455 simp
14551456 simp only [Num.succ']
@@ -1555,13 +1556,11 @@ theorem tr_ret_respects (k v s) : ∃ b₂,
15551556 by_cases h : v.headI = 0 <;> simp only [h, ite_true, ite_false] at this ⊢
15561557 · obtain ⟨c, h₁, h₂⟩ := IH v.tail (trList v).head?
15571558 refine ⟨c, h₁, TransGen.head rfl ?_⟩
1558- simp only [Option.mem_def, TM2.stepAux, trContStack, contStack, elim_main, this, cond_true,
1559- elim_update_main]
1559+ rw [trCont, tr]; simp only [pop', TM2.stepAux, elim_main, this, elim_update_main]
15601560 exact h₂
15611561 · obtain ⟨s', h₁, h₂⟩ := trNormal_respects f (Cont.fix f k) v.tail (some Γ'.cons)
15621562 refine ⟨_, h₁, TransGen.head rfl <| TransGen.trans ?_ h₂⟩
1563- simp only [Option.mem_def, TM2.stepAux, elim_main, this.1 , cond_false, elim_update_main,
1564- trCont]
1563+ rw [trCont, tr]; simp only [pop', TM2.stepAux, elim_main, this.1 ]
15651564 convert clear_ok (splitAtPred_eq _ _ (trNat v.headI).tail (some Γ'.cons) _ _ _) using 2
15661565 · simp
15671566 convert rfl
0 commit comments