Imports
/- Copyright (c) 2026 Google LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. -/ module public import BusyBeaver.Basic public import BusyBeaver.Bridge

Shared Stack Encodings for BB(6) Accelerations (BusyBeaver/BB6/Accelerations/Stack.lean)

Shared half-tape encodings (encStack, encStack2, encRun) and head-digit update operations (incRun, bumpHead, bumpHeadBy) used across the BB(6) multi-layer acceleration modules.

@[expose] public sectionnamespace BusyBeaver.Stackopen Turing

Encode a digit stack s as 1^{a + 1} 0 ... from the tape head outward.

def encStack : List ℕ → ListBlank (Fin 2) | [] => default | a :: s => ListBlank.append (([1] : List (Fin 2)) ^ (a + 1)) (ListBlank.cons 0 (encStack s))

Encode a digit stack s as 1^{a + 1} 00 ... from the tape head outward.

def encStack2 : List ℕ → ListBlank (Fin 2) | [] => default | a :: s => ListBlank.append (([1] : List (Fin 2)) ^ (a + 1)) (ListBlank.cons 0 (ListBlank.cons 0 (encStack2 s)))

Encode a zero-run stack s as 0^k 1 ... from the tape head outward.

def encRun : List ℕ → ListBlank (Fin 2) | [] => default | k :: xs => ListBlank.append (([0] : List (Fin 2)) ^ k) (ListBlank.cons 1 (encRun xs))

Prepend a leading 0 to encRun xs (incrementing the head run on non-empty stacks).

def incRun : List ℕ → List ℕ | [] => [] | k :: xs => (k + 1) :: xs

Increment the head digit of a stack, or push 0 onto an empty stack.

def bumpHead : List ℕ → List ℕ | [] => [0] | a :: s => (a + 1) :: s

Iterate bumpHead k times on a stack.

def bumpHeadBy : ℕ → List ℕ → List ℕ | 0, s => s | k + 1, s => bumpHeadBy k (bumpHead s)

Appending 0 ^ n onto the blank half-tape yields the blank half-tape.

theorem zeros_append_default (n : ℕ) : ListBlank.append (([0] : List (Fin 2)) ^ n) (default : ListBlank (Fin 2)) = default := n:ℕ⊢ [0] ^ n +> default = default induction n with ⊢ [0] ^ 0 +> default = default All goals completed! 🐙 k:ℕih:[0] ^ k +> default = default⊢ [0] ^ (k + 1) +> default = default k:ℕih:[0] ^ k +> default = default⊢ [0] +> default = default All goals completed! 🐙

Increment the primary coordinate of the top pair-stack element, or push (0, 0) if empty.

def bumpPairHead : List (ℕ × ℕ) → List (ℕ × ℕ) | [] => [(0, 0)] | (a, b) :: s => (a + 1, b) :: sprivate def liftPairList : List ℕ → List (ℕ × ℕ) | [] => [] | x :: xs => (x, 0) :: liftPairList xsprivate theorem map_fst_liftPairList : ∀ s : List ℕ, (liftPairList s).map Prod.fst = s | [] => rfl | _ :: xs => congrArg (_ :: ·) (map_fst_liftPairList xs)private theorem length_liftPairList : ∀ s : List ℕ, (liftPairList s).length = s.length | [] => rfl | _ :: xs => congrArg Nat.succ (length_liftPairList xs)private theorem mem_liftPairList : ∀ {a : ℕ} {s : List ℕ}, a ∈ s → (a, 0) ∈ liftPairList s | _, _ :: _, .head _ => .head _ | _, _ :: _, .tail _ h => .tail _ (mem_liftPairList h)

One-digit (List ℕ) sufficient conditions for HasStackReduction (maxSepL = maxSepR = 1).

def OneDigitStackReduction {Λ : Type*} [Inhabited Λ] (M : Machine (Fin 2) Λ) (StackMode : Type) (encLeft1 encRight1 : List ℕ → ListBlank (Fin 2)) (evalStackCfg1 : StackMode → List ℕ → List ℕ → Cfg (Fin 2) Λ) (IsInStackSystem1 : Cfg (Fin 2) Λ → Prop) : Prop := encLeft1 [] = default ∧ encRight1 [] = default ∧ (∀ a L, (encLeft1 (a :: L)).head = (1 : Fin 2)) ∧ (∀ d R, (encRight1 (d :: R)).head = (1 : Fin 2)) ∧ (∃ t : ListBlank (Fin 2), t.head = (1 : Fin 2) ∧ ∀ L : List ℕ, encLeft1 L ≠ t) ∧ (∃ t : ListBlank (Fin 2), t.head = (1 : Fin 2) ∧ ∀ R : List ℕ, encRight1 R ≠ t) ∧ (∃ strideL offsetL sepL strideR offsetR sepR : ℕ, strideL > 0 ∧ offsetL > 0 ∧ sepL > 0 ∧ strideR > 0 ∧ offsetR > 0 ∧ sepR > 0 ∧ (∀ a L, encLeft1 (a :: L) = ListBlank.append (([1] : List (Fin 2)) ^ (strideL * a + offsetL)) (ListBlank.append (([0] : List (Fin 2)) ^ sepL) (encLeft1 L))) ∧ (∀ d R, encRight1 (d :: R) = ListBlank.append (([1] : List (Fin 2)) ^ (strideR * d + offsetR)) (ListBlank.append (([0] : List (Fin 2)) ^ sepR) (encRight1 R)))) ∧ (∃ modes : List StackMode, modes.length ≤ 6 ∧ ∀ m : StackMode, m ∈ modes) ∧ IsValidStackModes encLeft1 encRight1 evalStackCfg1 ∧ (∀ cfg, IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L R) ∧ (∀ m L R, IsInStackSystem1 (evalStackCfg1 m L R)) ∧ (∃ (m_g : StackMode) (L_g R_g : List ℕ), ReachesPlus M (init []) (evalStackCfg1 m_g L_g R_g) ∧ 3 ≤ L_g.length + R_g.length ∧ (∃ a ∈ L_g ++ R_g, 1 ≤ a)) ∧ ((∃ (m m' : StackMode) (x : ℕ) (g : ℕ → ℕ) (f : List ℕ → List ℕ), (∀ s, s.length ≤ (f s).length) ∧ ∀ z L R, ReachesPlus M (evalStackCfg1 m (x :: z :: L) R) (evalStackCfg1 m' (g z :: L) (f R))) ∨ (∃ (m m' : StackMode) (x : ℕ) (g : ℕ → ℕ) (f : List ℕ → List ℕ), (∀ s, s.length ≤ (f s).length) ∧ ∀ z L R, ReachesPlus M (evalStackCfg1 m L (x :: z :: R)) (evalStackCfg1 m' (f L) (g z :: R)))) ∧ (∀ cfg, IsInStackSystem1 cfg → ∃ cfg', ReachesPlus M cfg cfg' ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone))

Lift a 1-digit (List ℕ) stack reduction to HasStackReduction (List (ℕ × ℕ)).

theorem HasStackReduction.of_oneDigit {Λ : Type*} [Inhabited Λ] (M : Machine (Fin 2) Λ) (StackMode : Type) (encLeft1 encRight1 : List ℕ → ListBlank (Fin 2)) (evalStackCfg1 : StackMode → List ℕ → List ℕ → Cfg (Fin 2) Λ) (IsInStackSystem1 : Cfg (Fin 2) Λ → Prop) (h : OneDigitStackReduction M StackMode encLeft1 encRight1 evalStackCfg1 IsInStackSystem1) : HasStackReduction M := Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → Proph:OneDigitStackReduction M StackMode encLeft1 encRight1 evalStackCfg1 IsInStackSystem1⊢ HasStackReduction M Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → Proph:OneDigitStackReduction M StackMode encLeft1 encRight1 evalStackCfg1 IsInStackSystem1⊢ IsValidStackPolarity 1 0 ∧ (fun L ↦ encLeft1 (List.map Prod.fst L)) [] = default ∧ (fun R ↦ encRight1 (List.map Prod.fst R)) [] = default ∧ (∀ (a : ℕ) (b : Nat.rec ℕ (fun x ih ↦ ℕ × ih) 0) (L : List (StackTuple (0 + 2))), ((fun L ↦ encLeft1 (List.map Prod.fst L)) ((a, b) :: L)).head = 1) ∧ (∀ (d : ℕ) (b : Nat.rec ℕ (fun x ih ↦ ℕ × ih) 0) (R : List (StackTuple (0 + 2))), ((fun R ↦ encRight1 (List.map Prod.fst R)) ((d, b) :: R)).head = 1) ∧ (∃ t, t.head = 1 ∧ ∀ (L : List (StackTuple (0 + 2))), (fun L ↦ encLeft1 (List.map Prod.fst L)) L ≠ t) ∧ (∃ t, t.head = 1 ∧ ∀ (R : List (StackTuple (0 + 2))), (fun R ↦ encRight1 (List.map Prod.fst R)) R ≠ t) ∧ (∃ strideL offsetL sepL maxSepL strideR offsetR sepR maxSepR, strideL > 0 ∧ offsetL > 0 ∧ sepL > 0 ∧ 1 ≤ maxSepL ∧ maxSepL ≤ 4 ∧ strideR > 0 ∧ offsetR > 0 ∧ sepR > 0 ∧ 1 ≤ maxSepR ∧ maxSepR ≤ 4 ∧ (∀ (a : ℕ) (b : Nat.rec ℕ (fun x ih ↦ ℕ × ih) 0) (L : List (StackTuple (0 + 2))), (fun L ↦ encLeft1 (List.map Prod.fst L)) ((a, b) :: L) = [1] ^ (strideL * a + offsetL) +> [0] ^ stackSepLen sepL maxSepL b +> (fun L ↦ encLeft1 (List.map Prod.fst L)) L) ∧ ∀ (d : ℕ) (b : Nat.rec ℕ (fun x ih ↦ ℕ × ih) 0) (R : List (StackTuple (0 + 2))), (fun R ↦ encRight1 (List.map Prod.fst R)) ((d, b) :: R) = [1] ^ (strideR * d + offsetR) +> [0] ^ stackSepLen sepR maxSepR b +> (fun R ↦ encRight1 (List.map Prod.fst R)) R) ∧ (∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modes) ∧ (IsValidStackModes (fun L ↦ encLeft1 (List.map Prod.fst L)) (fun R ↦ encRight1 (List.map Prod.fst R)) fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) ∧ (∀ (cfg : Cfg (Fin (0 + 2)) Λ), (fun cfg ↦ ∃ m L R, cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) cfg ↔ ∃ m L R, cfg = (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R) ∧ (∀ (m : StackMode) (L R : List (StackTuple (0 + 2))), (fun cfg ↦ ∃ m L R, cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) ((fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R)) ∧ (∃ m_g L_g R_g, (init [] [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m_g L_g R_g) ∧ 3 ≤ L_g.length + R_g.length ∧ ∃ x ∈ L_g ++ R_g, 1 ≤ x.1) ∧ ((∃ m m' x g f, (∀ (s : List (StackTuple (0 + 2))), s.length ≤ (f s).length) ∧ ∀ (z : StackTuple (0 + 2)) (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m (x :: z :: L) R [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List (StackTuple (0 + 2))), s.length ≤ (f s).length) ∧ ∀ (z : StackTuple (0 + 2)) (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L (x :: z :: R) [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m' (f L) (g z :: R)) ∧ ∀ (cfg : Cfg (Fin (0 + 2)) Λ), (fun cfg ↦ ∃ m L R, cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ ((fun cfg ↦ ∃ m L R, cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) cfg' ∨ (step M cfg').isNone = true) Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)⊢ IsValidStackPolarity 1 0 ∧ (fun L ↦ encLeft1 (List.map Prod.fst L)) [] = default ∧ (fun R ↦ encRight1 (List.map Prod.fst R)) [] = default ∧ (∀ (a : ℕ) (b : Nat.rec ℕ (fun x ih ↦ ℕ × ih) 0) (L : List (StackTuple (0 + 2))), ((fun L ↦ encLeft1 (List.map Prod.fst L)) ((a, b) :: L)).head = 1) ∧ (∀ (d : ℕ) (b : Nat.rec ℕ (fun x ih ↦ ℕ × ih) 0) (R : List (StackTuple (0 + 2))), ((fun R ↦ encRight1 (List.map Prod.fst R)) ((d, b) :: R)).head = 1) ∧ (∃ t, t.head = 1 ∧ ∀ (L : List (StackTuple (0 + 2))), (fun L ↦ encLeft1 (List.map Prod.fst L)) L ≠ t) ∧ (∃ t, t.head = 1 ∧ ∀ (R : List (StackTuple (0 + 2))), (fun R ↦ encRight1 (List.map Prod.fst R)) R ≠ t) ∧ (∃ strideL offsetL sepL maxSepL strideR offsetR sepR maxSepR, strideL > 0 ∧ offsetL > 0 ∧ sepL > 0 ∧ 1 ≤ maxSepL ∧ maxSepL ≤ 4 ∧ strideR > 0 ∧ offsetR > 0 ∧ sepR > 0 ∧ 1 ≤ maxSepR ∧ maxSepR ≤ 4 ∧ (∀ (a : ℕ) (b : Nat.rec ℕ (fun x ih ↦ ℕ × ih) 0) (L : List (StackTuple (0 + 2))), (fun L ↦ encLeft1 (List.map Prod.fst L)) ((a, b) :: L) = [1] ^ (strideL * a + offsetL) +> [0] ^ stackSepLen sepL maxSepL b +> (fun L ↦ encLeft1 (List.map Prod.fst L)) L) ∧ ∀ (d : ℕ) (b : Nat.rec ℕ (fun x ih ↦ ℕ × ih) 0) (R : List (StackTuple (0 + 2))), (fun R ↦ encRight1 (List.map Prod.fst R)) ((d, b) :: R) = [1] ^ (strideR * d + offsetR) +> [0] ^ stackSepLen sepR maxSepR b +> (fun R ↦ encRight1 (List.map Prod.fst R)) R) ∧ (∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modes) ∧ (IsValidStackModes (fun L ↦ encLeft1 (List.map Prod.fst L)) (fun R ↦ encRight1 (List.map Prod.fst R)) fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) ∧ (∀ (cfg : Cfg (Fin (0 + 2)) Λ), (fun cfg ↦ ∃ m L R, cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) cfg ↔ ∃ m L R, cfg = (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R) ∧ (∀ (m : StackMode) (L R : List (StackTuple (0 + 2))), (fun cfg ↦ ∃ m L R, cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) ((fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R)) ∧ (∃ m_g L_g R_g, (init [] [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m_g L_g R_g) ∧ 3 ≤ L_g.length + R_g.length ∧ ∃ x ∈ L_g ++ R_g, 1 ≤ x.1) ∧ ((∃ m m' x g f, (∀ (s : List (StackTuple (0 + 2))), s.length ≤ (f s).length) ∧ ∀ (z : StackTuple (0 + 2)) (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m (x :: z :: L) R [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List (StackTuple (0 + 2))), s.length ≤ (f s).length) ∧ ∀ (z : StackTuple (0 + 2)) (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L (x :: z :: R) [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m' (f L) (g z :: R)) ∧ ∀ (cfg : Cfg (Fin (0 + 2)) Λ), (fun cfg ↦ ∃ m L R, cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ ((fun cfg ↦ ∃ m L R, cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) cfg' ∨ (step M cfg').isNone = true) refine ⟨Or.inl ⟨rfl, rfl⟩, hnilL, hnilR, fun a _ L => hheadL a (L.map Prod.fst), fun d _ R => hheadR d (R.map Prod.fst), ⟨tL, htL, fun L => hnsL (L.map Prod.fst)⟩, ⟨tR, htR, fun R => hnsR (R.map Prod.fst)⟩, ⟨sL, oL, sepL, 1, sR, oR, sepR, 1, hsL, hoL, hsepL, le_refl 1, Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)⊢ 1 ≤ 4 All goals completed! 🐙, hsR, hoR, hsepR, le_refl 1, Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)⊢ 1 ≤ 4 All goals completed! 🐙, fun a b L => Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)a:ℕb:Nat.rec ℕ (fun x ih ↦ ℕ × ih) 0L:List (StackTuple (0 + 2))⊢ (fun L ↦ encLeft1 (List.map Prod.fst L)) ((a, b) :: L) = [1] ^ (sL * a + oL) +> [0] ^ stackSepLen sepL 1 b +> (fun L ↦ encLeft1 (List.map Prod.fst L)) L All goals completed! 🐙, fun d b R => Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)d:ℕb:Nat.rec ℕ (fun x ih ↦ ℕ × ih) 0R:List (StackTuple (0 + 2))⊢ (fun R ↦ encRight1 (List.map Prod.fst R)) ((d, b) :: R) = [1] ^ (sR * d + oR) +> [0] ^ stackSepLen sepR 1 b +> (fun R ↦ encRight1 (List.map Prod.fst R)) R All goals completed! 🐙⟩, hmodes, fun m => ?_, fun _ => Iff.rfl, fun m L R => ⟨m, L, R, rfl⟩, ?_, ?_, ?_⟩ Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackMode⊢ ∃ q vL vR, HalfTapeView.casesOn vL List.length List.length ≤ 8 ∧ HalfTapeView.casesOn vR List.length List.length ≤ 8 ∧ ((∀ (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R = { q := some q, tape := { head := 0, left := applyView vL ((fun L ↦ encLeft1 (List.map Prod.fst L)) L), right := applyView vR ((fun R ↦ encRight1 (List.map Prod.fst R)) R) } }) ∨ (∀ (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R = Cfg.headLeft q (applyView vL ((fun L ↦ encLeft1 (List.map Prod.fst L)) L)) (applyView vR ((fun R ↦ encRight1 (List.map Prod.fst R)) R))) ∨ ∀ (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R = Cfg.headRight q (applyView vL ((fun L ↦ encLeft1 (List.map Prod.fst L)) L)) (applyView vR ((fun R ↦ encRight1 (List.map Prod.fst R)) R))) Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModeq:ΛvL:HalfTapeView (Fin 2)vR:HalfTapeView (Fin 2)hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h1:∀ (L R : List ℕ), evalStackCfg1 m L R = { q := some q, tape := { head := 0, left := applyView vL (encLeft1 L), right := applyView vR (encRight1 R) } }⊢ ∃ q vL vR, HalfTapeView.casesOn vL List.length List.length ≤ 8 ∧ HalfTapeView.casesOn vR List.length List.length ≤ 8 ∧ ((∀ (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R = { q := some q, tape := { head := 0, left := applyView vL ((fun L ↦ encLeft1 (List.map Prod.fst L)) L), right := applyView vR ((fun R ↦ encRight1 (List.map Prod.fst R)) R) } }) ∨ (∀ (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R = Cfg.headLeft q (applyView vL ((fun L ↦ encLeft1 (List.map Prod.fst L)) L)) (applyView vR ((fun R ↦ encRight1 (List.map Prod.fst R)) R))) ∨ ∀ (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R = Cfg.headRight q (applyView vL ((fun L ↦ encLeft1 (List.map Prod.fst L)) L)) (applyView vR ((fun R ↦ encRight1 (List.map Prod.fst R)) R)))Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModeq:ΛvL:HalfTapeView (Fin 2)vR:HalfTapeView (Fin 2)hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h2:∀ (L R : List ℕ), evalStackCfg1 m L R = Cfg.headLeft q (applyView vL (encLeft1 L)) (applyView vR (encRight1 R))⊢ ∃ q vL vR, HalfTapeView.casesOn vL List.length List.length ≤ 8 ∧ HalfTapeView.casesOn vR List.length List.length ≤ 8 ∧ ((∀ (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R = { q := some q, tape := { head := 0, left := applyView vL ((fun L ↦ encLeft1 (List.map Prod.fst L)) L), right := applyView vR ((fun R ↦ encRight1 (List.map Prod.fst R)) R) } }) ∨ (∀ (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R = Cfg.headLeft q (applyView vL ((fun L ↦ encLeft1 (List.map Prod.fst L)) L)) (applyView vR ((fun R ↦ encRight1 (List.map Prod.fst R)) R))) ∨ ∀ (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R = Cfg.headRight q (applyView vL ((fun L ↦ encLeft1 (List.map Prod.fst L)) L)) (applyView vR ((fun R ↦ encRight1 (List.map Prod.fst R)) R)))Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModeq:ΛvL:HalfTapeView (Fin 2)vR:HalfTapeView (Fin 2)hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h3:∀ (L R : List ℕ), evalStackCfg1 m L R = Cfg.headRight q (applyView vL (encLeft1 L)) (applyView vR (encRight1 R))⊢ ∃ q vL vR, HalfTapeView.casesOn vL List.length List.length ≤ 8 ∧ HalfTapeView.casesOn vR List.length List.length ≤ 8 ∧ ((∀ (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R = { q := some q, tape := { head := 0, left := applyView vL ((fun L ↦ encLeft1 (List.map Prod.fst L)) L), right := applyView vR ((fun R ↦ encRight1 (List.map Prod.fst R)) R) } }) ∨ (∀ (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R = Cfg.headLeft q (applyView vL ((fun L ↦ encLeft1 (List.map Prod.fst L)) L)) (applyView vR ((fun R ↦ encRight1 (List.map Prod.fst R)) R))) ∨ ∀ (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R = Cfg.headRight q (applyView vL ((fun L ↦ encLeft1 (List.map Prod.fst L)) L)) (applyView vR ((fun R ↦ encRight1 (List.map Prod.fst R)) R))) Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModeq:ΛvL:HalfTapeView (Fin 2)vR:HalfTapeView (Fin 2)hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h1:∀ (L R : List ℕ), evalStackCfg1 m L R = { q := some q, tape := { head := 0, left := applyView vL (encLeft1 L), right := applyView vR (encRight1 R) } }⊢ ∃ q vL vR, HalfTapeView.casesOn vL List.length List.length ≤ 8 ∧ HalfTapeView.casesOn vR List.length List.length ≤ 8 ∧ ((∀ (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R = { q := some q, tape := { head := 0, left := applyView vL ((fun L ↦ encLeft1 (List.map Prod.fst L)) L), right := applyView vR ((fun R ↦ encRight1 (List.map Prod.fst R)) R) } }) ∨ (∀ (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R = Cfg.headLeft q (applyView vL ((fun L ↦ encLeft1 (List.map Prod.fst L)) L)) (applyView vR ((fun R ↦ encRight1 (List.map Prod.fst R)) R))) ∨ ∀ (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R = Cfg.headRight q (applyView vL ((fun L ↦ encLeft1 (List.map Prod.fst L)) L)) (applyView vR ((fun R ↦ encRight1 (List.map Prod.fst R)) R))) All goals completed! 🐙 Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModeq:ΛvL:HalfTapeView (Fin 2)vR:HalfTapeView (Fin 2)hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h2:∀ (L R : List ℕ), evalStackCfg1 m L R = Cfg.headLeft q (applyView vL (encLeft1 L)) (applyView vR (encRight1 R))⊢ ∃ q vL vR, HalfTapeView.casesOn vL List.length List.length ≤ 8 ∧ HalfTapeView.casesOn vR List.length List.length ≤ 8 ∧ ((∀ (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R = { q := some q, tape := { head := 0, left := applyView vL ((fun L ↦ encLeft1 (List.map Prod.fst L)) L), right := applyView vR ((fun R ↦ encRight1 (List.map Prod.fst R)) R) } }) ∨ (∀ (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R = Cfg.headLeft q (applyView vL ((fun L ↦ encLeft1 (List.map Prod.fst L)) L)) (applyView vR ((fun R ↦ encRight1 (List.map Prod.fst R)) R))) ∨ ∀ (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R = Cfg.headRight q (applyView vL ((fun L ↦ encLeft1 (List.map Prod.fst L)) L)) (applyView vR ((fun R ↦ encRight1 (List.map Prod.fst R)) R))) All goals completed! 🐙 Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModeq:ΛvL:HalfTapeView (Fin 2)vR:HalfTapeView (Fin 2)hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h3:∀ (L R : List ℕ), evalStackCfg1 m L R = Cfg.headRight q (applyView vL (encLeft1 L)) (applyView vR (encRight1 R))⊢ ∃ q vL vR, HalfTapeView.casesOn vL List.length List.length ≤ 8 ∧ HalfTapeView.casesOn vR List.length List.length ≤ 8 ∧ ((∀ (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R = { q := some q, tape := { head := 0, left := applyView vL ((fun L ↦ encLeft1 (List.map Prod.fst L)) L), right := applyView vR ((fun R ↦ encRight1 (List.map Prod.fst R)) R) } }) ∨ (∀ (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R = Cfg.headLeft q (applyView vL ((fun L ↦ encLeft1 (List.map Prod.fst L)) L)) (applyView vR ((fun R ↦ encRight1 (List.map Prod.fst R)) R))) ∨ ∀ (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L R = Cfg.headRight q (applyView vL ((fun L ↦ encLeft1 (List.map Prod.fst L)) L)) (applyView vR ((fun R ↦ encRight1 (List.map Prod.fst R)) R))) All goals completed! 🐙 Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)⊢ ∃ m_g L_g R_g, (init [] [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m_g L_g R_g) ∧ 3 ≤ L_g.length + R_g.length ∧ ∃ x ∈ L_g ++ R_g, 1 ≤ x.1 Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)⊢ init [] [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m_g (liftPairList L_g) (liftPairList R_g)Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)⊢ 3 ≤ (liftPairList L_g).length + (liftPairList R_g).lengthΛ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)⊢ ∃ x ∈ liftPairList L_g ++ liftPairList R_g, 1 ≤ x.1 Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)⊢ init [] [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m_g (liftPairList L_g) (liftPairList R_g) All goals completed! 🐙 Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)⊢ 3 ≤ (liftPairList L_g).length + (liftPairList R_g).length Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)⊢ 3 ≤ L_g.length + R_g.length All goals completed! 🐙 Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)⊢ ∃ x ∈ liftPairList L_g ++ liftPairList R_g, 1 ≤ x.1 Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)⊢ (a_g, 0) ∈ liftPairList L_g ++ liftPairList R_g Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)hL:a_g ∈ L_g⊢ (a_g, 0) ∈ liftPairList L_g ++ liftPairList R_gΛ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)hR:a_g ∈ R_g⊢ (a_g, 0) ∈ liftPairList L_g ++ liftPairList R_g Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)hL:a_g ∈ L_g⊢ (a_g, 0) ∈ liftPairList L_g ++ liftPairList R_g All goals completed! 🐙 Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)hR:a_g ∈ R_g⊢ (a_g, 0) ∈ liftPairList L_g ++ liftPairList R_g All goals completed! 🐙 Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)⊢ (∃ m m' x g f, (∀ (s : List (StackTuple (0 + 2))), s.length ≤ (f s).length) ∧ ∀ (z : StackTuple (0 + 2)) (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m (x :: z :: L) R [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List (StackTuple (0 + 2))), s.length ≤ (f s).length) ∧ ∀ (z : StackTuple (0 + 2)) (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L (x :: z :: R) [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m' (f L) (g z :: R) Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModem':StackModex:ℕg:ℕ → ℕf:List ℕ → List ℕhflen:∀ (s : List ℕ), s.length ≤ (f s).lengthhstep:∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)⊢ (∃ m m' x g f, (∀ (s : List (StackTuple (0 + 2))), s.length ≤ (f s).length) ∧ ∀ (z : StackTuple (0 + 2)) (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m (x :: z :: L) R [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List (StackTuple (0 + 2))), s.length ≤ (f s).length) ∧ ∀ (z : StackTuple (0 + 2)) (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L (x :: z :: R) [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m' (f L) (g z :: R)Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModem':StackModex:ℕg:ℕ → ℕf:List ℕ → List ℕhflen:∀ (s : List ℕ), s.length ≤ (f s).lengthhstep:∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)⊢ (∃ m m' x g f, (∀ (s : List (StackTuple (0 + 2))), s.length ≤ (f s).length) ∧ ∀ (z : StackTuple (0 + 2)) (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m (x :: z :: L) R [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List (StackTuple (0 + 2))), s.length ≤ (f s).length) ∧ ∀ (z : StackTuple (0 + 2)) (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L (x :: z :: R) [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m' (f L) (g z :: R) Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModem':StackModex:ℕg:ℕ → ℕf:List ℕ → List ℕhflen:∀ (s : List ℕ), s.length ≤ (f s).lengthhstep:∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)⊢ (∃ m m' x g f, (∀ (s : List (StackTuple (0 + 2))), s.length ≤ (f s).length) ∧ ∀ (z : StackTuple (0 + 2)) (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m (x :: z :: L) R [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List (StackTuple (0 + 2))), s.length ≤ (f s).length) ∧ ∀ (z : StackTuple (0 + 2)) (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L (x :: z :: R) [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m' (f L) (g z :: R) Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModem':StackModex:ℕg:ℕ → ℕf:List ℕ → List ℕhflen:∀ (s : List ℕ), s.length ≤ (f s).lengthhstep:∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)⊢ ∀ (s : List (StackTuple (0 + 2))), s.length ≤ ((fun s ↦ liftPairList (f (List.map Prod.fst s))) s).lengthΛ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModem':StackModex:ℕg:ℕ → ℕf:List ℕ → List ℕhflen:∀ (s : List ℕ), s.length ≤ (f s).lengthhstep:∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)⊢ ∀ (z : StackTuple (0 + 2)) (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m ((x, 0) :: z :: L) R [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m' ((fun p ↦ (g p.1, 0)) z :: L) ((fun s ↦ liftPairList (f (List.map Prod.fst s))) R) Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModem':StackModex:ℕg:ℕ → ℕf:List ℕ → List ℕhflen:∀ (s : List ℕ), s.length ≤ (f s).lengthhstep:∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)⊢ ∀ (s : List (StackTuple (0 + 2))), s.length ≤ ((fun s ↦ liftPairList (f (List.map Prod.fst s))) s).length Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModem':StackModex:ℕg:ℕ → ℕf:List ℕ → List ℕhflen:∀ (s : List ℕ), s.length ≤ (f s).lengthhstep:∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)s:List (StackTuple (0 + 2))⊢ s.length ≤ ((fun s ↦ liftPairList (f (List.map Prod.fst s))) s).length Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModem':StackModex:ℕg:ℕ → ℕf:List ℕ → List ℕhflen:∀ (s : List ℕ), s.length ≤ (f s).lengthhstep:∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)s:List (StackTuple (0 + 2))⊢ s.length ≤ (f (List.map Prod.fst s)).length All goals completed! 🐙 Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModem':StackModex:ℕg:ℕ → ℕf:List ℕ → List ℕhflen:∀ (s : List ℕ), s.length ≤ (f s).lengthhstep:∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)⊢ ∀ (z : StackTuple (0 + 2)) (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m ((x, 0) :: z :: L) R [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m' ((fun p ↦ (g p.1, 0)) z :: L) ((fun s ↦ liftPairList (f (List.map Prod.fst s))) R) Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModem':StackModex:ℕg:ℕ → ℕf:List ℕ → List ℕhflen:∀ (s : List ℕ), s.length ≤ (f s).lengthhstep:∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)z:StackTuple (0 + 2)L:List (StackTuple (0 + 2))R:List (StackTuple (0 + 2))⊢ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m ((x, 0) :: z :: L) R [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m' ((fun p ↦ (g p.1, 0)) z :: L) ((fun s ↦ liftPairList (f (List.map Prod.fst s))) R) Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModem':StackModex:ℕg:ℕ → ℕf:List ℕ → List ℕhflen:∀ (s : List ℕ), s.length ≤ (f s).lengthhstep:∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)z:StackTuple (0 + 2)L:List (StackTuple (0 + 2))R:List (StackTuple (0 + 2))⊢ evalStackCfg1 m (List.map Prod.fst ((x, 0) :: z :: L)) (List.map Prod.fst R) [M]⊢⁺ evalStackCfg1 m' (List.map Prod.fst ((g z.1, 0) :: L)) (List.map Prod.fst (liftPairList (f (List.map Prod.fst R)))) Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModem':StackModex:ℕg:ℕ → ℕf:List ℕ → List ℕhflen:∀ (s : List ℕ), s.length ≤ (f s).lengthhstep:∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)z:StackTuple (0 + 2)L:List (StackTuple (0 + 2))R:List (StackTuple (0 + 2))⊢ evalStackCfg1 m (List.map Prod.fst ((x, 0) :: z :: L)) (List.map Prod.fst R) [M]⊢⁺ evalStackCfg1 m' (List.map Prod.fst ((g z.1, 0) :: L)) (f (List.map Prod.fst R)) All goals completed! 🐙 Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModem':StackModex:ℕg:ℕ → ℕf:List ℕ → List ℕhflen:∀ (s : List ℕ), s.length ≤ (f s).lengthhstep:∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)⊢ (∃ m m' x g f, (∀ (s : List (StackTuple (0 + 2))), s.length ≤ (f s).length) ∧ ∀ (z : StackTuple (0 + 2)) (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m (x :: z :: L) R [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List (StackTuple (0 + 2))), s.length ≤ (f s).length) ∧ ∀ (z : StackTuple (0 + 2)) (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L (x :: z :: R) [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m' (f L) (g z :: R) Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModem':StackModex:ℕg:ℕ → ℕf:List ℕ → List ℕhflen:∀ (s : List ℕ), s.length ≤ (f s).lengthhstep:∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)⊢ ∀ (s : List (StackTuple (0 + 2))), s.length ≤ ((fun s ↦ liftPairList (f (List.map Prod.fst s))) s).lengthΛ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModem':StackModex:ℕg:ℕ → ℕf:List ℕ → List ℕhflen:∀ (s : List ℕ), s.length ≤ (f s).lengthhstep:∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)⊢ ∀ (z : StackTuple (0 + 2)) (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L ((x, 0) :: z :: R) [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m' ((fun s ↦ liftPairList (f (List.map Prod.fst s))) L) ((fun p ↦ (g p.1, 0)) z :: R) Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModem':StackModex:ℕg:ℕ → ℕf:List ℕ → List ℕhflen:∀ (s : List ℕ), s.length ≤ (f s).lengthhstep:∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)⊢ ∀ (s : List (StackTuple (0 + 2))), s.length ≤ ((fun s ↦ liftPairList (f (List.map Prod.fst s))) s).length Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModem':StackModex:ℕg:ℕ → ℕf:List ℕ → List ℕhflen:∀ (s : List ℕ), s.length ≤ (f s).lengthhstep:∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)s:List (StackTuple (0 + 2))⊢ s.length ≤ ((fun s ↦ liftPairList (f (List.map Prod.fst s))) s).length Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModem':StackModex:ℕg:ℕ → ℕf:List ℕ → List ℕhflen:∀ (s : List ℕ), s.length ≤ (f s).lengthhstep:∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)s:List (StackTuple (0 + 2))⊢ s.length ≤ (f (List.map Prod.fst s)).length All goals completed! 🐙 Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModem':StackModex:ℕg:ℕ → ℕf:List ℕ → List ℕhflen:∀ (s : List ℕ), s.length ≤ (f s).lengthhstep:∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)⊢ ∀ (z : StackTuple (0 + 2)) (L R : List (StackTuple (0 + 2))), (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L ((x, 0) :: z :: R) [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m' ((fun s ↦ liftPairList (f (List.map Prod.fst s))) L) ((fun p ↦ (g p.1, 0)) z :: R) Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModem':StackModex:ℕg:ℕ → ℕf:List ℕ → List ℕhflen:∀ (s : List ℕ), s.length ≤ (f s).lengthhstep:∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)z:StackTuple (0 + 2)L:List (StackTuple (0 + 2))R:List (StackTuple (0 + 2))⊢ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m L ((x, 0) :: z :: R) [M]⊢⁺ (fun m L R ↦ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) m' ((fun s ↦ liftPairList (f (List.map Prod.fst s))) L) ((fun p ↦ (g p.1, 0)) z :: R) Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModem':StackModex:ℕg:ℕ → ℕf:List ℕ → List ℕhflen:∀ (s : List ℕ), s.length ≤ (f s).lengthhstep:∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)z:StackTuple (0 + 2)L:List (StackTuple (0 + 2))R:List (StackTuple (0 + 2))⊢ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst ((x, 0) :: z :: R)) [M]⊢⁺ evalStackCfg1 m' (List.map Prod.fst (liftPairList (f (List.map Prod.fst L)))) (List.map Prod.fst ((g z.1, 0) :: R)) Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)m:StackModem':StackModex:ℕg:ℕ → ℕf:List ℕ → List ℕhflen:∀ (s : List ℕ), s.length ≤ (f s).lengthhstep:∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)z:StackTuple (0 + 2)L:List (StackTuple (0 + 2))R:List (StackTuple (0 + 2))⊢ evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst ((x, 0) :: z :: R)) [M]⊢⁺ evalStackCfg1 m' (f (List.map Prod.fst L)) (List.map Prod.fst ((g z.1, 0) :: R)) All goals completed! 🐙 Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)⊢ ∀ (cfg : Cfg (Fin (0 + 2)) Λ), (fun cfg ↦ ∃ m L R, cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ ((fun cfg ↦ ∃ m L R, cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) cfg' ∨ (step M cfg').isNone = true) Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)cfg:Cfg (Fin (0 + 2)) Λm:StackModeL:List (ℕ × ℕ)R:List (ℕ × ℕ)hcfg:cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)⊢ ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ ((fun cfg ↦ ∃ m L R, cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) cfg' ∨ (step M cfg').isNone = true) Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)cfg:Cfg (Fin (0 + 2)) Λm:StackModeL:List (ℕ × ℕ)R:List (ℕ × ℕ)hcfg:cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)hsys1:IsInStackSystem1 cfg⊢ ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ ((fun cfg ↦ ∃ m L R, cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) cfg' ∨ (step M cfg').isNone = true) Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)cfg:Cfg (Fin (0 + 2)) Λm:StackModeL:List (ℕ × ℕ)R:List (ℕ × ℕ)hcfg:cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)hsys1:IsInStackSystem1 cfgcfg':Cfg (Fin 2) Λhstep:cfg [M]⊢⁺ cfg'hnext:IsInStackSystem1 cfg'⊢ ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ ((fun cfg ↦ ∃ m L R, cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) cfg' ∨ (step M cfg').isNone = true)Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)cfg:Cfg (Fin (0 + 2)) Λm:StackModeL:List (ℕ × ℕ)R:List (ℕ × ℕ)hcfg:cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)hsys1:IsInStackSystem1 cfgcfg':Cfg (Fin 2) Λhstep:cfg [M]⊢⁺ cfg'hhalt:(step M cfg').isNone = true⊢ ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ ((fun cfg ↦ ∃ m L R, cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) cfg' ∨ (step M cfg').isNone = true) Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)cfg:Cfg (Fin (0 + 2)) Λm:StackModeL:List (ℕ × ℕ)R:List (ℕ × ℕ)hcfg:cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)hsys1:IsInStackSystem1 cfgcfg':Cfg (Fin 2) Λhstep:cfg [M]⊢⁺ cfg'hnext:IsInStackSystem1 cfg'⊢ ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ ((fun cfg ↦ ∃ m L R, cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) cfg' ∨ (step M cfg').isNone = true) Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)cfg:Cfg (Fin (0 + 2)) Λm:StackModeL:List (ℕ × ℕ)R:List (ℕ × ℕ)hcfg:cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)hsys1:IsInStackSystem1 cfgcfg':Cfg (Fin 2) Λhstep:cfg [M]⊢⁺ cfg'hnext:IsInStackSystem1 cfg'm':StackModeL1':List ℕR1':List ℕhcfg':cfg' = evalStackCfg1 m' L1' R1'⊢ ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ ((fun cfg ↦ ∃ m L R, cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) cfg' ∨ (step M cfg').isNone = true) Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)cfg:Cfg (Fin (0 + 2)) Λm:StackModeL:List (ℕ × ℕ)R:List (ℕ × ℕ)hcfg:cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)hsys1:IsInStackSystem1 cfgcfg':Cfg (Fin 2) Λhstep:cfg [M]⊢⁺ cfg'hnext:IsInStackSystem1 cfg'm':StackModeL1':List ℕR1':List ℕhcfg':cfg' = evalStackCfg1 m' L1' R1'⊢ cfg' = evalStackCfg1 m' (List.map Prod.fst (liftPairList L1')) (List.map Prod.fst (liftPairList R1')) Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)cfg:Cfg (Fin (0 + 2)) Λm:StackModeL:List (ℕ × ℕ)R:List (ℕ × ℕ)hcfg:cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)hsys1:IsInStackSystem1 cfgcfg':Cfg (Fin 2) Λhstep:cfg [M]⊢⁺ cfg'hnext:IsInStackSystem1 cfg'm':StackModeL1':List ℕR1':List ℕhcfg':cfg' = evalStackCfg1 m' L1' R1'⊢ cfg' = evalStackCfg1 m' L1' R1' All goals completed! 🐙 Λ:Type u_1inst✝:Inhabited ΛM:Machine (Fin 2) ΛStackMode:TypeencLeft1:List ℕ → ListBlank (Fin 2)encRight1:List ℕ → ListBlank (Fin 2)evalStackCfg1:StackMode → List ℕ → List ℕ → Cfg (Fin 2) ΛIsInStackSystem1:Cfg (Fin 2) Λ → ProphnilL:encLeft1 [] = defaulthnilR:encRight1 [] = defaulthheadL:∀ (a : ℕ) (L : List ℕ), (encLeft1 (a :: L)).head = 1hheadR:∀ (d : ℕ) (R : List ℕ), (encRight1 (d :: R)).head = 1tL:ListBlank (Fin 2)htL:tL.head = 1hnsL:∀ (L : List ℕ), encLeft1 L ≠ tLtR:ListBlank (Fin 2)htR:tR.head = 1hnsR:∀ (R : List ℕ), encRight1 R ≠ tRsL:ℕoL:ℕsepL:ℕsR:ℕoR:ℕsepR:ℕhsL:sL > 0hoL:oL > 0hsepL:sepL > 0hsR:sR > 0hoR:oR > 0hsepR:sepR > 0hblkL:∀ (a : ℕ) (L : List ℕ), encLeft1 (a :: L) = [1] ^ (sL * a + oL) +> [0] ^ sepL +> encLeft1 LhblkR:∀ (d : ℕ) (R : List ℕ), encRight1 (d :: R) = [1] ^ (sR * d + oR) +> [0] ^ sepR +> encRight1 Rhmodes:∃ modes, modes.length ≤ 6 ∧ ∀ (m : StackMode), m ∈ modeshvalid1:IsValidStackModes encLeft1 encRight1 evalStackCfg1hiff1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg ↔ ∃ m L R, cfg = evalStackCfg1 m L Rleft✝:∀ (m : StackMode) (L R : List ℕ), IsInStackSystem1 (evalStackCfg1 m L R)m_g:StackModeL_g:List ℕR_g:List ℕhreach_g:init [] [M]⊢⁺ evalStackCfg1 m_g L_g R_ghlen_g:3 ≤ L_g.length + R_g.lengtha_g:ℕhmem_g:a_g ∈ L_g ++ R_gha_g:1 ≤ a_ghtransfer:(∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m (x :: z :: L) R [M]⊢⁺ evalStackCfg1 m' (g z :: L) (f R)) ∨ ∃ m m' x g f, (∀ (s : List ℕ), s.length ≤ (f s).length) ∧ ∀ (z : ℕ) (L R : List ℕ), evalStackCfg1 m L (x :: z :: R) [M]⊢⁺ evalStackCfg1 m' (f L) (g z :: R)hclosed1:∀ (cfg : Cfg (Fin 2) Λ), IsInStackSystem1 cfg → ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step M cfg').isNone = true)cfg:Cfg (Fin (0 + 2)) Λm:StackModeL:List (ℕ × ℕ)R:List (ℕ × ℕ)hcfg:cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)hsys1:IsInStackSystem1 cfgcfg':Cfg (Fin 2) Λhstep:cfg [M]⊢⁺ cfg'hhalt:(step M cfg').isNone = true⊢ ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ ((fun cfg ↦ ∃ m L R, cfg = evalStackCfg1 m (List.map Prod.fst L) (List.map Prod.fst R)) cfg' ∨ (step M cfg').isNone = true) All goals completed! 🐙

Direction and Tape Reflection

Flip tape direction.

def reflectDir : Dir → Dir | .left => .right | .right => .left@[simp] theorem reflectDir_reflectDir (d : Dir) : reflectDir (reflectDir d) = d := d:Dir⊢ reflectDir (reflectDir d) = d ⊢ reflectDir (reflectDir Dir.left) = Dir.left⊢ reflectDir (reflectDir Dir.right) = Dir.right ⊢ reflectDir (reflectDir Dir.left) = Dir.left⊢ reflectDir (reflectDir Dir.right) = Dir.right All goals completed! 🐙

Reflect a doubly-infinite tape by swapping its left and right half-tapes.

def reflectTape {Γ : Type*} [Inhabited Γ] (T : Tape Γ) : Tape Γ := ⟨T.head, T.right, T.left⟩@[simp] theorem reflectTape_reflectTape {Γ : Type*} [Inhabited Γ] (T : Tape Γ) : reflectTape (reflectTape T) = T := Γ:Type u_1inst✝:Inhabited ΓT:Tape Γ⊢ reflectTape (reflectTape T) = T Γ:Type u_1inst✝:Inhabited Γhead✝:Γleft✝:ListBlank Γright✝:ListBlank Γ⊢ reflectTape (reflectTape { head := head✝, left := left✝, right := right✝ }) = { head := head✝, left := left✝, right := right✝ }; All goals completed! 🐙@[simp] theorem reflectTape_head {Γ : Type*} [Inhabited Γ] (T : Tape Γ) : (reflectTape T).head = T.head := rfl@[simp] theorem reflectTape_write {Γ : Type*} [Inhabited Γ] (b : Γ) (T : Tape Γ) : reflectTape (Tape.write b T) = Tape.write b (reflectTape T) := Γ:Type u_1inst✝:Inhabited Γb:ΓT:Tape Γ⊢ reflectTape (Tape.write b T) = Tape.write b (reflectTape T) Γ:Type u_1inst✝:Inhabited Γb:Γhead✝:Γleft✝:ListBlank Γright✝:ListBlank Γ⊢ reflectTape (Tape.write b { head := head✝, left := left✝, right := right✝ }) = Tape.write b (reflectTape { head := head✝, left := left✝, right := right✝ }); All goals completed! 🐙@[simp] theorem reflectTape_move {Γ : Type*} [Inhabited Γ] (d : Dir) (T : Tape Γ) : reflectTape (Tape.move d T) = Tape.move (reflectDir d) (reflectTape T) := Γ:Type u_1inst✝:Inhabited Γd:DirT:Tape Γ⊢ reflectTape (Tape.move d T) = Tape.move (reflectDir d) (reflectTape T) Γ:Type u_1inst✝:Inhabited ΓT:Tape Γ⊢ reflectTape (Tape.move Dir.left T) = Tape.move (reflectDir Dir.left) (reflectTape T)Γ:Type u_1inst✝:Inhabited ΓT:Tape Γ⊢ reflectTape (Tape.move Dir.right T) = Tape.move (reflectDir Dir.right) (reflectTape T) Γ:Type u_1inst✝:Inhabited ΓT:Tape Γ⊢ reflectTape (Tape.move Dir.left T) = Tape.move (reflectDir Dir.left) (reflectTape T)Γ:Type u_1inst✝:Inhabited ΓT:Tape Γ⊢ reflectTape (Tape.move Dir.right T) = Tape.move (reflectDir Dir.right) (reflectTape T) Γ:Type u_1inst✝:Inhabited Γhead✝:Γleft✝:ListBlank Γright✝:ListBlank Γ⊢ reflectTape (Tape.move Dir.right { head := head✝, left := left✝, right := right✝ }) = Tape.move (reflectDir Dir.right) (reflectTape { head := head✝, left := left✝, right := right✝ }) Γ:Type u_1inst✝:Inhabited Γhead✝:Γleft✝:ListBlank Γright✝:ListBlank Γ⊢ reflectTape (Tape.move Dir.left { head := head✝, left := left✝, right := right✝ }) = Tape.move (reflectDir Dir.left) (reflectTape { head := head✝, left := left✝, right := right✝ })Γ:Type u_1inst✝:Inhabited Γhead✝:Γleft✝:ListBlank Γright✝:ListBlank Γ⊢ reflectTape (Tape.move Dir.right { head := head✝, left := left✝, right := right✝ }) = Tape.move (reflectDir Dir.right) (reflectTape { head := head✝, left := left✝, right := right✝ }) All goals completed! 🐙@[simp] theorem reflectTape_step_tape {Γ : Type*} [Inhabited Γ] (b : Γ) (d : Dir) (T : Tape Γ) : reflectTape ((T.write b).move d) = ((reflectTape T).write b).move (reflectDir d) := Γ:Type u_1inst✝:Inhabited Γb:Γd:DirT:Tape Γ⊢ reflectTape (Tape.move d (Tape.write b T)) = Tape.move (reflectDir d) (Tape.write b (reflectTape T)) Γ:Type u_1inst✝:Inhabited Γb:ΓT:Tape Γ⊢ reflectTape (Tape.move Dir.left (Tape.write b T)) = Tape.move (reflectDir Dir.left) (Tape.write b (reflectTape T))Γ:Type u_1inst✝:Inhabited Γb:ΓT:Tape Γ⊢ reflectTape (Tape.move Dir.right (Tape.write b T)) = Tape.move (reflectDir Dir.right) (Tape.write b (reflectTape T)) Γ:Type u_1inst✝:Inhabited Γb:ΓT:Tape Γ⊢ reflectTape (Tape.move Dir.left (Tape.write b T)) = Tape.move (reflectDir Dir.left) (Tape.write b (reflectTape T))Γ:Type u_1inst✝:Inhabited Γb:ΓT:Tape Γ⊢ reflectTape (Tape.move Dir.right (Tape.write b T)) = Tape.move (reflectDir Dir.right) (Tape.write b (reflectTape T)) Γ:Type u_1inst✝:Inhabited Γb:Γhead✝:Γleft✝:ListBlank Γright✝:ListBlank Γ⊢ reflectTape (Tape.move Dir.right (Tape.write b { head := head✝, left := left✝, right := right✝ })) = Tape.move (reflectDir Dir.right) (Tape.write b (reflectTape { head := head✝, left := left✝, right := right✝ })) Γ:Type u_1inst✝:Inhabited Γb:Γhead✝:Γleft✝:ListBlank Γright✝:ListBlank Γ⊢ reflectTape (Tape.move Dir.left (Tape.write b { head := head✝, left := left✝, right := right✝ })) = Tape.move (reflectDir Dir.left) (Tape.write b (reflectTape { head := head✝, left := left✝, right := right✝ }))Γ:Type u_1inst✝:Inhabited Γb:Γhead✝:Γleft✝:ListBlank Γright✝:ListBlank Γ⊢ reflectTape (Tape.move Dir.right (Tape.write b { head := head✝, left := left✝, right := right✝ })) = Tape.move (reflectDir Dir.right) (Tape.write b (reflectTape { head := head✝, left := left✝, right := right✝ })) All goals completed! 🐙

Configuration Functors

Map state and tape across Turing machine configuration types.

def mapCfg {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] (σ : Option Λ₁ → Option Λ₂) (Tmap : Tape Γ → Tape Γ) (c : Cfg Γ Λ₁) : Cfg Γ Λ₂ := ⟨σ c.q, Tmap c.tape⟩

Relabel control states of a configuration.

def mapState {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] (f : Λ₁ → Λ₂) (c : Cfg Γ Λ₁) : Cfg Γ Λ₂ := ⟨c.q.map f, c.tape⟩

Relabel control states and reflect tape of a configuration.

def mirrorCfg {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] (f : Λ₁ → Λ₂) (c : Cfg Γ Λ₁) : Cfg Γ Λ₂ := ⟨c.q.map f, reflectTape c.tape⟩@[simp] theorem mapState_headRight {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] (f : Λ₁ → Λ₂) (q : Λ₁) (l r : ListBlank Γ) : mapState f (Cfg.headRight q l r) = Cfg.headRight (f q) l r := rfl@[simp] theorem mapState_headLeft {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] (f : Λ₁ → Λ₂) (q : Λ₁) (l r : ListBlank Γ) : mapState f (Cfg.headLeft q l r) = Cfg.headLeft (f q) l r := rfl@[simp] theorem mapState_zero {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] [OfNat Γ 0] (f : Λ₁ → Λ₂) (q : Λ₁) (l r : ListBlank Γ) : mapState f ⟨some q, ⟨(0 : Γ), l, r⟩⟩ = ⟨some (f q), ⟨(0 : Γ), l, r⟩⟩ := rfl@[simp] theorem mirrorCfg_headRight {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] (f : Λ₁ → Λ₂) (q : Λ₁) (l r : ListBlank Γ) : mirrorCfg f (Cfg.headRight q l r) = Cfg.headLeft (f q) r l := rfl@[simp] theorem mirrorCfg_headLeft {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] (f : Λ₁ → Λ₂) (q : Λ₁) (l r : ListBlank Γ) : mirrorCfg f (Cfg.headLeft q l r) = Cfg.headRight (f q) r l := rfl@[simp] theorem mirrorCfg_zero {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] [OfNat Γ 0] (f : Λ₁ → Λ₂) (q : Λ₁) (l r : ListBlank Γ) : mirrorCfg f ⟨some q, ⟨(0 : Γ), l, r⟩⟩ = ⟨some (f q), ⟨(0 : Γ), r, l⟩⟩ := rfl

Commutation with Machine Steps

theorem step_mapCfg {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] [Inhabited Λ₁] [Inhabited Λ₂] (M₁ : Machine Γ Λ₁) (M₂ : Machine Γ Λ₂) (f : Λ₁ → Λ₂) (dmap : Dir → Dir) (Tmap : Tape Γ → Tape Γ) (hT_head : ∀ (T : Tape Γ), (Tmap T).head = T.head) (hT : ∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap ((T.write b).move d) = ((Tmap T).write b).move (dmap d)) (hM : ∀ q a, M₂ (f q) a = (M₁ q a).map fun ⟨q', Stmt.write b d⟩ => ⟨q'.map f, Stmt.write b (dmap d)⟩) (c : Cfg Γ Λ₁) : step M₂ (mapCfg (Option.map f) Tmap c) = (step M₁ c).map (mapCfg (Option.map f) Tmap) := Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)c:Cfg Γ Λ₁⊢ step M₂ (mapCfg (Option.map f) Tmap c) = Option.map (mapCfg (Option.map f) Tmap) (step M₁ c) Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)T:Tape Γ⊢ step M₂ (mapCfg (Option.map f) Tmap { q := none, tape := T }) = Option.map (mapCfg (Option.map f) Tmap) (step M₁ { q := none, tape := T })Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)T:Tape Γq:Λ₁⊢ step M₂ (mapCfg (Option.map f) Tmap { q := some q, tape := T }) = Option.map (mapCfg (Option.map f) Tmap) (step M₁ { q := some q, tape := T }) Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)T:Tape Γ⊢ step M₂ (mapCfg (Option.map f) Tmap { q := none, tape := T }) = Option.map (mapCfg (Option.map f) Tmap) (step M₁ { q := none, tape := T }) All goals completed! 🐙 Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)T:Tape Γq:Λ₁⊢ step M₂ (mapCfg (Option.map f) Tmap { q := some q, tape := T }) = Option.map (mapCfg (Option.map f) Tmap) (step M₁ { q := some q, tape := T }) Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)T:Tape Γq:Λ₁⊢ (match M₂ (f q) (Tmap T).head with | some x => some { q := x.1, tape := Tape.move x.2.dir (Tape.write x.2.symbol (Tmap T)) } | none => none) = match match M₁ q T.head with | some x => some { q := x.1, tape := Tape.move x.2.dir (Tape.write x.2.symbol T) } | none => none with | some x => some { q := match x.q with | some x => some (f x) | none => none, tape := Tmap x.tape } | none => none Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)T:Tape Γq:Λ₁⊢ (match Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q T.head) with | some x => some { q := x.1, tape := Tape.move x.2.dir (Tape.write x.2.symbol (Tmap T)) } | none => none) = match match M₁ q T.head with | some x => some { q := x.1, tape := Tape.move x.2.dir (Tape.write x.2.symbol T) } | none => none with | some x => some { q := match x.q with | some x => some (f x) | none => none, tape := Tmap x.tape } | none => none cases h : M₁ q T.head with Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)T:Tape Γq:Λ₁h:M₁ q T.head = none⊢ (match Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) none with | some x => some { q := x.1, tape := Tape.move x.2.dir (Tape.write x.2.symbol (Tmap T)) } | none => none) = match match none with | some x => some { q := x.1, tape := Tape.move x.2.dir (Tape.write x.2.symbol T) } | none => none with | some x => some { q := match x.q with | some x => some (f x) | none => none, tape := Tmap x.tape } | none => none All goals completed! 🐙 Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)T:Tape Γq:Λ₁res:Option Λ₁ × Stmt Γh:M₁ q T.head = some res⊢ (match Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (some res) with | some x => some { q := x.1, tape := Tape.move x.2.dir (Tape.write x.2.symbol (Tmap T)) } | none => none) = match match some res with | some x => some { q := x.1, tape := Tape.move x.2.dir (Tape.write x.2.symbol T) } | none => none with | some x => some { q := match x.q with | some x => some (f x) | none => none, tape := Tmap x.tape } | none => none Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)T:Tape Γq:Λ₁q':Option Λ₁b:Γd:Dirh:M₁ q T.head = some (q', { symbol := b, dir := d })⊢ (match Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (some (q', { symbol := b, dir := d })) with | some x => some { q := x.1, tape := Tape.move x.2.dir (Tape.write x.2.symbol (Tmap T)) } | none => none) = match match some (q', { symbol := b, dir := d }) with | some x => some { q := x.1, tape := Tape.move x.2.dir (Tape.write x.2.symbol T) } | none => none with | some x => some { q := match x.q with | some x => some (f x) | none => none, tape := Tmap x.tape } | none => none Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)T:Tape Γq:Λ₁q':Option Λ₁b:Γd:Dirh:M₁ q T.head = some (q', { symbol := b, dir := d })⊢ some { q := match q' with | some x => some (f x) | none => none, tape := Tape.move (dmap d) (Tape.write b (Tmap T)) } = some { q := match q' with | some x => some (f x) | none => none, tape := Tmap (Tape.move d (Tape.write b T)) } All goals completed! 🐙theorem multiStep_mapCfg {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] [Inhabited Λ₁] [Inhabited Λ₂] (M₁ : Machine Γ Λ₁) (M₂ : Machine Γ Λ₂) (f : Λ₁ → Λ₂) (dmap : Dir → Dir) (Tmap : Tape Γ → Tape Γ) (hT_head : ∀ (T : Tape Γ), (Tmap T).head = T.head) (hT : ∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap ((T.write b).move d) = ((Tmap T).write b).move (dmap d)) (hM : ∀ q a, M₂ (f q) a = (M₁ q a).map fun ⟨q', Stmt.write b d⟩ => ⟨q'.map f, Stmt.write b (dmap d)⟩) (n : ℕ) (c : Cfg Γ Λ₁) : multiStep M₂ (mapCfg (Option.map f) Tmap c) n = (multiStep M₁ c n).map (mapCfg (Option.map f) Tmap) := Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)n:ℕc:Cfg Γ Λ₁⊢ multiStep M₂ (mapCfg (Option.map f) Tmap c) n = Option.map (mapCfg (Option.map f) Tmap) (multiStep M₁ c n) induction n generalizing c with Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)c:Cfg Γ Λ₁⊢ multiStep M₂ (mapCfg (Option.map f) Tmap c) 0 = Option.map (mapCfg (Option.map f) Tmap) (multiStep M₁ c 0) All goals completed! 🐙 Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)n:ℕih:∀ (c : Cfg Γ Λ₁), multiStep M₂ (mapCfg (Option.map f) Tmap c) n = Option.map (mapCfg (Option.map f) Tmap) (multiStep M₁ c n)c:Cfg Γ Λ₁⊢ multiStep M₂ (mapCfg (Option.map f) Tmap c) (n + 1) = Option.map (mapCfg (Option.map f) Tmap) (multiStep M₁ c (n + 1)) Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)n:ℕih:∀ (c : Cfg Γ Λ₁), multiStep M₂ (mapCfg (Option.map f) Tmap c) n = Option.map (mapCfg (Option.map f) Tmap) (multiStep M₁ c n)c:Cfg Γ Λ₁⊢ ((step M₂ (mapCfg (Option.map f) Tmap c)).bind fun c' ↦ multiStep M₂ c' n) = Option.map (mapCfg (Option.map f) Tmap) ((step M₁ c).bind fun c' ↦ multiStep M₁ c' n) Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)n:ℕih:∀ (c : Cfg Γ Λ₁), multiStep M₂ (mapCfg (Option.map f) Tmap c) n = Option.map (mapCfg (Option.map f) Tmap) (multiStep M₁ c n)c:Cfg Γ Λ₁⊢ ((Option.map (mapCfg (Option.map f) Tmap) (step M₁ c)).bind fun c' ↦ multiStep M₂ c' n) = Option.map (mapCfg (Option.map f) Tmap) ((step M₁ c).bind fun c' ↦ multiStep M₁ c' n) cases hs : step M₁ c with Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)n:ℕih:∀ (c : Cfg Γ Λ₁), multiStep M₂ (mapCfg (Option.map f) Tmap c) n = Option.map (mapCfg (Option.map f) Tmap) (multiStep M₁ c n)c:Cfg Γ Λ₁hs:step M₁ c = none⊢ ((Option.map (mapCfg (Option.map f) Tmap) none).bind fun c' ↦ multiStep M₂ c' n) = Option.map (mapCfg (Option.map f) Tmap) (none.bind fun c' ↦ multiStep M₁ c' n) All goals completed! 🐙 Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)n:ℕih:∀ (c : Cfg Γ Λ₁), multiStep M₂ (mapCfg (Option.map f) Tmap c) n = Option.map (mapCfg (Option.map f) Tmap) (multiStep M₁ c n)c:Cfg Γ Λ₁c':Cfg Γ Λ₁hs:c [M₁]⊢ c'⊢ ((Option.map (mapCfg (Option.map f) Tmap) (some c')).bind fun c' ↦ multiStep M₂ c' n) = Option.map (mapCfg (Option.map f) Tmap) ((some c').bind fun c' ↦ multiStep M₁ c' n) Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)n:ℕih:∀ (c : Cfg Γ Λ₁), multiStep M₂ (mapCfg (Option.map f) Tmap c) n = Option.map (mapCfg (Option.map f) Tmap) (multiStep M₁ c n)c:Cfg Γ Λ₁c':Cfg Γ Λ₁hs:c [M₁]⊢ c'⊢ multiStep M₂ (mapCfg (Option.map f) Tmap c') n = match multiStep M₁ c' n with | some x => some (mapCfg (Option.map f) Tmap x) | none => none All goals completed! 🐙theorem reachesPlus_mapCfg {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] [Inhabited Λ₁] [Inhabited Λ₂] (M₁ : Machine Γ Λ₁) (M₂ : Machine Γ Λ₂) (f : Λ₁ → Λ₂) (dmap : Dir → Dir) (Tmap : Tape Γ → Tape Γ) (hT_head : ∀ (T : Tape Γ), (Tmap T).head = T.head) (hT : ∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap ((T.write b).move d) = ((Tmap T).write b).move (dmap d)) (hM : ∀ q a, M₂ (f q) a = (M₁ q a).map fun ⟨q', Stmt.write b d⟩ => ⟨q'.map f, Stmt.write b (dmap d)⟩) {c₁ c₂ : Cfg Γ Λ₁} (h : ReachesPlus M₁ c₁ c₂) : ReachesPlus M₂ (mapCfg (Option.map f) Tmap c₁) (mapCfg (Option.map f) Tmap c₂) := Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)c₁:Cfg Γ Λ₁c₂:Cfg Γ Λ₁h:c₁ [M₁]⊢⁺ c₂⊢ mapCfg (Option.map f) Tmap c₁ [M₂]⊢⁺ mapCfg (Option.map f) Tmap c₂ Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)c₁:Cfg Γ Λ₁c₂:Cfg Γ Λ₁n:ℕhn:n > 0hstep:c₁ [M₁]⊢^{n} c₂⊢ mapCfg (Option.map f) Tmap c₁ [M₂]⊢⁺ mapCfg (Option.map f) Tmap c₂ Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)c₁:Cfg Γ Λ₁c₂:Cfg Γ Λ₁n:ℕhn:n > 0hstep:c₁ [M₁]⊢^{n} c₂⊢ mapCfg (Option.map f) Tmap c₁ [M₂]⊢^{n} mapCfg (Option.map f) Tmap c₂ Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)c₁:Cfg Γ Λ₁c₂:Cfg Γ Λ₁n:ℕhn:n > 0hstep:c₁ [M₁]⊢^{n} c₂⊢ Option.map (mapCfg (Option.map f) Tmap) (some c₂) = some (mapCfg (Option.map f) Tmap c₂) All goals completed! 🐙theorem step_isNone_mapCfg {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] [Inhabited Λ₁] [Inhabited Λ₂] (M₁ : Machine Γ Λ₁) (M₂ : Machine Γ Λ₂) (f : Λ₁ → Λ₂) (dmap : Dir → Dir) (Tmap : Tape Γ → Tape Γ) (hT_head : ∀ (T : Tape Γ), (Tmap T).head = T.head) (hT : ∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap ((T.write b).move d) = ((Tmap T).write b).move (dmap d)) (hM : ∀ q a, M₂ (f q) a = (M₁ q a).map fun ⟨q', Stmt.write b d⟩ => ⟨q'.map f, Stmt.write b (dmap d)⟩) (c : Cfg Γ Λ₁) : (step M₂ (mapCfg (Option.map f) Tmap c)).isNone = (step M₁ c).isNone := Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)c:Cfg Γ Λ₁⊢ (step M₂ (mapCfg (Option.map f) Tmap c)).isNone = (step M₁ c).isNone Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)c:Cfg Γ Λ₁⊢ (Option.map (mapCfg (Option.map f) Tmap) (step M₁ c)).isNone = (step M₁ c).isNone Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)c:Cfg Γ Λ₁⊢ (Option.map (mapCfg (Option.map f) Tmap) none).isNone = none.isNoneΓ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)c:Cfg Γ Λ₁val✝:Cfg Γ Λ₁⊢ (Option.map (mapCfg (Option.map f) Tmap) (some val✝)).isNone = (some val✝).isNone Γ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)c:Cfg Γ Λ₁⊢ (Option.map (mapCfg (Option.map f) Tmap) none).isNone = none.isNoneΓ:Type u_1Λ₁:Type u_2Λ₂:Type u_3inst✝²:Inhabited Γinst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine Γ Λ₁M₂:Machine Γ Λ₂f:Λ₁ → Λ₂dmap:Dir → DirTmap:Tape Γ → Tape ΓhT_head:∀ (T : Tape Γ), (Tmap T).head = T.headhT:∀ (b : Γ) (d : Dir) (T : Tape Γ), Tmap (Tape.move d (Tape.write b T)) = Tape.move (dmap d) (Tape.write b (Tmap T))hM:∀ (q : Λ₁) (a : Γ), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := dmap d })) (M₁ q a)c:Cfg Γ Λ₁val✝:Cfg Γ Λ₁⊢ (Option.map (mapCfg (Option.map f) Tmap) (some val✝)).isNone = (some val✝).isNone All goals completed! 🐙theorem reachesPlus_mapState {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] [Inhabited Λ₁] [Inhabited Λ₂] (M₁ : Machine Γ Λ₁) (M₂ : Machine Γ Λ₂) (f : Λ₁ → Λ₂) (hM : ∀ q a, M₂ (f q) a = (M₁ q a).map fun ⟨q', Stmt.write b d⟩ => ⟨q'.map f, Stmt.write b d⟩) {c₁ c₂ : Cfg Γ Λ₁} (h : ReachesPlus M₁ c₁ c₂) : ReachesPlus M₂ (mapState f c₁) (mapState f c₂) := reachesPlus_mapCfg M₁ M₂ f id id (fun _ => rfl) (fun _ _ _ => rfl) hM htheorem reachesPlus_mirrorCfg {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] [Inhabited Λ₁] [Inhabited Λ₂] (M₁ : Machine Γ Λ₁) (M₂ : Machine Γ Λ₂) (f : Λ₁ → Λ₂) (hM : ∀ q a, M₂ (f q) a = (M₁ q a).map fun ⟨q', Stmt.write b d⟩ => ⟨q'.map f, Stmt.write b (reflectDir d)⟩) {c₁ c₂ : Cfg Γ Λ₁} (h : ReachesPlus M₁ c₁ c₂) : ReachesPlus M₂ (mirrorCfg f c₁) (mirrorCfg f c₂) := reachesPlus_mapCfg M₁ M₂ f reflectDir reflectTape (fun _ => rfl) reflectTape_step_tape hM htheorem step_isNone_mapState {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] [Inhabited Λ₁] [Inhabited Λ₂] (M₁ : Machine Γ Λ₁) (M₂ : Machine Γ Λ₂) (f : Λ₁ → Λ₂) (hM : ∀ q a, M₂ (f q) a = (M₁ q a).map fun ⟨q', Stmt.write b d⟩ => ⟨q'.map f, Stmt.write b d⟩) (c : Cfg Γ Λ₁) : (step M₂ (mapState f c)).isNone = (step M₁ c).isNone := step_isNone_mapCfg M₁ M₂ f id id (fun _ => rfl) (fun _ _ _ => rfl) hM ctheorem step_isNone_mirrorCfg {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] [Inhabited Λ₁] [Inhabited Λ₂] (M₁ : Machine Γ Λ₁) (M₂ : Machine Γ Λ₂) (f : Λ₁ → Λ₂) (hM : ∀ q a, M₂ (f q) a = (M₁ q a).map fun ⟨q', Stmt.write b d⟩ => ⟨q'.map f, Stmt.write b (reflectDir d)⟩) (c : Cfg Γ Λ₁) : (step M₂ (mirrorCfg f c)).isNone = (step M₁ c).isNone := step_isNone_mapCfg M₁ M₂ f reflectDir reflectTape (fun _ => rfl) reflectTape_step_tape hM c

Closed Stack Transition Systems

A closed 2nd-order digit-stack transition system for a Turing machine M. Bundles the stack modes, polarity, unary-block recurrences, transfer rule, and closure under ReachesPlus, independent of blank-tape reachability.

structure ClosedStackSystem {k : ℕ} {Λ : Type*} [Inhabited Λ] (M : Machine (Fin (k + 2)) Λ) where StackMode : Type dSym : Fin (k + 2) sSym : Fin (k + 2) encLeft : List (StackTuple (k + 2)) → ListBlank (Fin (k + 2)) encRight : List (StackTuple (k + 2)) → ListBlank (Fin (k + 2)) evalStackCfg : StackMode → List (StackTuple (k + 2)) → List (StackTuple (k + 2)) → Cfg (Fin (k + 2)) Λ IsInStackSystem : Cfg (Fin (k + 2)) Λ → Prop hpolarity : IsValidStackPolarity dSym sSym hnilL : encLeft [] = default hnilR : encRight [] = default hheadL : ∀ a b L, (encLeft ((a, b) :: L)).head = dSym hheadR : ∀ d b R, (encRight ((d, b) :: R)).head = dSym hnsL : ∃ t : ListBlank (Fin (k + 2)), t.head = dSym ∧ ∀ L, encLeft L ≠ t hnsR : ∃ t : ListBlank (Fin (k + 2)), t.head = dSym ∧ ∀ R, encRight R ≠ t hparams : ∃ strideL offsetL sepL maxSepL strideR offsetR sepR maxSepR : ℕ, strideL > 0 ∧ offsetL > 0 ∧ sepL > 0 ∧ 1 ≤ maxSepL ∧ maxSepL ≤ 4 ∧ strideR > 0 ∧ offsetR > 0 ∧ sepR > 0 ∧ 1 ≤ maxSepR ∧ maxSepR ≤ 4 ∧ (∀ a b L, encLeft ((a, b) :: L) = ListBlank.append (([dSym] : List (Fin (k + 2))) ^ (strideL * a + offsetL)) (ListBlank.append (([sSym] : List (Fin (k + 2))) ^ (stackSepLen (n := k + 1) sepL maxSepL b)) (encLeft L))) ∧ (∀ d b R, encRight ((d, b) :: R) = ListBlank.append (([dSym] : List (Fin (k + 2))) ^ (strideR * d + offsetR)) (ListBlank.append (([sSym] : List (Fin (k + 2))) ^ (stackSepLen (n := k + 1) sepR maxSepR b)) (encRight R))) hmodes : ∃ modes : List StackMode, modes.length ≤ 6 ∧ ∀ m : StackMode, m ∈ modes hvalid : IsValidStackModes encLeft encRight evalStackCfg hiff : ∀ cfg, IsInStackSystem cfg ↔ ∃ m L R, cfg = evalStackCfg m L R hin : ∀ m L R, IsInStackSystem (evalStackCfg m L R) htransfer : (∃ (m m' : StackMode) (x : StackTuple (k + 2)) (g : StackTuple (k + 2) → StackTuple (k + 2)) (f : List (StackTuple (k + 2)) → List (StackTuple (k + 2))), (∀ s, s.length ≤ (f s).length) ∧ ∀ z L R, ReachesPlus M (evalStackCfg m (x :: z :: L) R) (evalStackCfg m' (g z :: L) (f R))) ∨ (∃ (m m' : StackMode) (x : StackTuple (k + 2)) (g : StackTuple (k + 2) → StackTuple (k + 2)) (f : List (StackTuple (k + 2)) → List (StackTuple (k + 2))), (∀ s, s.length ≤ (f s).length) ∧ ∀ z L R, ReachesPlus M (evalStackCfg m L (x :: z :: R)) (evalStackCfg m' (f L) (g z :: R))) hclosed : ∀ cfg, IsInStackSystem cfg → ∃ cfg', ReachesPlus M cfg cfg' ∧ (IsInStackSystem cfg' ∨ (step M cfg').isNone)

Derive HasStackReduction from a ClosedStackSystem together with an initial reachability path from the blank tape to a non-trivial stack configuration.

theorem HasStackReduction.of_closedSystem {k : ℕ} {Λ : Type*} [Inhabited Λ] {M : Machine (Fin (k + 2)) Λ} (W : ClosedStackSystem M) (m_g : W.StackMode) (L_g R_g : List (StackTuple (k + 2))) (hreach : ReachesPlus M (init []) (W.evalStackCfg m_g L_g R_g)) (hlen : 3 ≤ L_g.length + R_g.length) (hpos : ∃ x ∈ L_g ++ R_g, 1 ≤ x.1) : HasStackReduction M := k:ℕΛ:Type u_1inst✝:Inhabited ΛM:Machine (Fin (k + 2)) ΛW:ClosedStackSystem Mm_g:W.StackModeL_g:List (StackTuple (k + 2))R_g:List (StackTuple (k + 2))hreach:init [] [M]⊢⁺ W.evalStackCfg m_g L_g R_ghlen:3 ≤ L_g.length + R_g.lengthhpos:∃ x ∈ L_g ++ R_g, 1 ≤ x.1⊢ HasStackReduction M All goals completed! 🐙

Transport a ClosedStackSystem along a state relabeling bijection f.

def ClosedStackSystem.relabel {k : ℕ} {Λ₁ Λ₂ : Type*} [Inhabited Λ₁] [Inhabited Λ₂] {M₁ : Machine (Fin (k + 2)) Λ₁} {M₂ : Machine (Fin (k + 2)) Λ₂} (W : ClosedStackSystem M₁) (f : Λ₁ → Λ₂) (hM : ∀ q a, M₂ (f q) a = (M₁ q a).map fun ⟨q', Stmt.write b d⟩ => ⟨q'.map f, Stmt.write b d⟩) : ClosedStackSystem M₂ where StackMode := W.StackMode dSym := W.dSym sSym := W.sSym encLeft := W.encLeft encRight := W.encRight evalStackCfg m L R := mapState f (W.evalStackCfg m L R) IsInStackSystem cfg := ∃ m L R, cfg = mapState f (W.evalStackCfg m L R) hpolarity := W.hpolarity hnilL := W.hnilL hnilR := W.hnilR hheadL := W.hheadL hheadR := W.hheadR hnsL := W.hnsL hnsR := W.hnsR hparams := W.hparams hmodes := W.hmodes hvalid := k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)⊢ IsValidStackModes W.encLeft W.encRight fun m L R ↦ mapState f (W.evalStackCfg m L R) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)m:W.StackMode⊢ ∃ q vL vR, HalfTapeView.casesOn vL List.length List.length ≤ 8 ∧ HalfTapeView.casesOn vR List.length List.length ≤ 8 ∧ ((∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mapState f (W.evalStackCfg m L R)) m L R = { q := some q, tape := { head := 0, left := applyView vL (W.encLeft L), right := applyView vR (W.encRight R) } }) ∨ (∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mapState f (W.evalStackCfg m L R)) m L R = Cfg.headLeft q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))) ∨ ∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mapState f (W.evalStackCfg m L R)) m L R = Cfg.headRight q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)m:W.StackModeq:Λ₁vL:HalfTapeView (Fin (k + 2))vR:HalfTapeView (Fin (k + 2))hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h1:∀ (L R : List (StackTuple (k + 2))), W.evalStackCfg m L R = { q := some q, tape := { head := 0, left := applyView vL (W.encLeft L), right := applyView vR (W.encRight R) } }⊢ ∃ q vL vR, HalfTapeView.casesOn vL List.length List.length ≤ 8 ∧ HalfTapeView.casesOn vR List.length List.length ≤ 8 ∧ ((∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mapState f (W.evalStackCfg m L R)) m L R = { q := some q, tape := { head := 0, left := applyView vL (W.encLeft L), right := applyView vR (W.encRight R) } }) ∨ (∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mapState f (W.evalStackCfg m L R)) m L R = Cfg.headLeft q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))) ∨ ∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mapState f (W.evalStackCfg m L R)) m L R = Cfg.headRight q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R)))k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)m:W.StackModeq:Λ₁vL:HalfTapeView (Fin (k + 2))vR:HalfTapeView (Fin (k + 2))hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h2:∀ (L R : List (StackTuple (k + 2))), W.evalStackCfg m L R = Cfg.headLeft q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))⊢ ∃ q vL vR, HalfTapeView.casesOn vL List.length List.length ≤ 8 ∧ HalfTapeView.casesOn vR List.length List.length ≤ 8 ∧ ((∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mapState f (W.evalStackCfg m L R)) m L R = { q := some q, tape := { head := 0, left := applyView vL (W.encLeft L), right := applyView vR (W.encRight R) } }) ∨ (∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mapState f (W.evalStackCfg m L R)) m L R = Cfg.headLeft q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))) ∨ ∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mapState f (W.evalStackCfg m L R)) m L R = Cfg.headRight q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R)))k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)m:W.StackModeq:Λ₁vL:HalfTapeView (Fin (k + 2))vR:HalfTapeView (Fin (k + 2))hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h3:∀ (L R : List (StackTuple (k + 2))), W.evalStackCfg m L R = Cfg.headRight q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))⊢ ∃ q vL vR, HalfTapeView.casesOn vL List.length List.length ≤ 8 ∧ HalfTapeView.casesOn vR List.length List.length ≤ 8 ∧ ((∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mapState f (W.evalStackCfg m L R)) m L R = { q := some q, tape := { head := 0, left := applyView vL (W.encLeft L), right := applyView vR (W.encRight R) } }) ∨ (∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mapState f (W.evalStackCfg m L R)) m L R = Cfg.headLeft q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))) ∨ ∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mapState f (W.evalStackCfg m L R)) m L R = Cfg.headRight q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)m:W.StackModeq:Λ₁vL:HalfTapeView (Fin (k + 2))vR:HalfTapeView (Fin (k + 2))hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h1:∀ (L R : List (StackTuple (k + 2))), W.evalStackCfg m L R = { q := some q, tape := { head := 0, left := applyView vL (W.encLeft L), right := applyView vR (W.encRight R) } }⊢ ∃ q vL vR, HalfTapeView.casesOn vL List.length List.length ≤ 8 ∧ HalfTapeView.casesOn vR List.length List.length ≤ 8 ∧ ((∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mapState f (W.evalStackCfg m L R)) m L R = { q := some q, tape := { head := 0, left := applyView vL (W.encLeft L), right := applyView vR (W.encRight R) } }) ∨ (∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mapState f (W.evalStackCfg m L R)) m L R = Cfg.headLeft q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))) ∨ ∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mapState f (W.evalStackCfg m L R)) m L R = Cfg.headRight q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)m:W.StackModeq:Λ₁vL:HalfTapeView (Fin (k + 2))vR:HalfTapeView (Fin (k + 2))hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h1:∀ (L R : List (StackTuple (k + 2))), W.evalStackCfg m L R = { q := some q, tape := { head := 0, left := applyView vL (W.encLeft L), right := applyView vR (W.encRight R) } }L:List (StackTuple (k + 2))R:List (StackTuple (k + 2))⊢ (fun m L R ↦ mapState f (W.evalStackCfg m L R)) m L R = { q := some (f q), tape := { head := 0, left := applyView vL (W.encLeft L), right := applyView vR (W.encRight R) } } k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)m:W.StackModeq:Λ₁vL:HalfTapeView (Fin (k + 2))vR:HalfTapeView (Fin (k + 2))hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h1:∀ (L R : List (StackTuple (k + 2))), W.evalStackCfg m L R = { q := some q, tape := { head := 0, left := applyView vL (W.encLeft L), right := applyView vR (W.encRight R) } }L:List (StackTuple (k + 2))R:List (StackTuple (k + 2))⊢ mapState f (W.evalStackCfg m L R) = { q := some (f q), tape := { head := 0, left := applyView vL (W.encLeft L), right := applyView vR (W.encRight R) } } All goals completed! 🐙 k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)m:W.StackModeq:Λ₁vL:HalfTapeView (Fin (k + 2))vR:HalfTapeView (Fin (k + 2))hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h2:∀ (L R : List (StackTuple (k + 2))), W.evalStackCfg m L R = Cfg.headLeft q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))⊢ ∃ q vL vR, HalfTapeView.casesOn vL List.length List.length ≤ 8 ∧ HalfTapeView.casesOn vR List.length List.length ≤ 8 ∧ ((∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mapState f (W.evalStackCfg m L R)) m L R = { q := some q, tape := { head := 0, left := applyView vL (W.encLeft L), right := applyView vR (W.encRight R) } }) ∨ (∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mapState f (W.evalStackCfg m L R)) m L R = Cfg.headLeft q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))) ∨ ∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mapState f (W.evalStackCfg m L R)) m L R = Cfg.headRight q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)m:W.StackModeq:Λ₁vL:HalfTapeView (Fin (k + 2))vR:HalfTapeView (Fin (k + 2))hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h2:∀ (L R : List (StackTuple (k + 2))), W.evalStackCfg m L R = Cfg.headLeft q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))L:List (StackTuple (k + 2))R:List (StackTuple (k + 2))⊢ (fun m L R ↦ mapState f (W.evalStackCfg m L R)) m L R = Cfg.headLeft (f q) (applyView vL (W.encLeft L)) (applyView vR (W.encRight R)) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)m:W.StackModeq:Λ₁vL:HalfTapeView (Fin (k + 2))vR:HalfTapeView (Fin (k + 2))hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h2:∀ (L R : List (StackTuple (k + 2))), W.evalStackCfg m L R = Cfg.headLeft q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))L:List (StackTuple (k + 2))R:List (StackTuple (k + 2))⊢ mapState f (W.evalStackCfg m L R) = Cfg.headLeft (f q) (applyView vL (W.encLeft L)) (applyView vR (W.encRight R)) All goals completed! 🐙 k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)m:W.StackModeq:Λ₁vL:HalfTapeView (Fin (k + 2))vR:HalfTapeView (Fin (k + 2))hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h3:∀ (L R : List (StackTuple (k + 2))), W.evalStackCfg m L R = Cfg.headRight q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))⊢ ∃ q vL vR, HalfTapeView.casesOn vL List.length List.length ≤ 8 ∧ HalfTapeView.casesOn vR List.length List.length ≤ 8 ∧ ((∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mapState f (W.evalStackCfg m L R)) m L R = { q := some q, tape := { head := 0, left := applyView vL (W.encLeft L), right := applyView vR (W.encRight R) } }) ∨ (∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mapState f (W.evalStackCfg m L R)) m L R = Cfg.headLeft q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))) ∨ ∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mapState f (W.evalStackCfg m L R)) m L R = Cfg.headRight q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)m:W.StackModeq:Λ₁vL:HalfTapeView (Fin (k + 2))vR:HalfTapeView (Fin (k + 2))hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h3:∀ (L R : List (StackTuple (k + 2))), W.evalStackCfg m L R = Cfg.headRight q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))L:List (StackTuple (k + 2))R:List (StackTuple (k + 2))⊢ (fun m L R ↦ mapState f (W.evalStackCfg m L R)) m L R = Cfg.headRight (f q) (applyView vL (W.encLeft L)) (applyView vR (W.encRight R)) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)m:W.StackModeq:Λ₁vL:HalfTapeView (Fin (k + 2))vR:HalfTapeView (Fin (k + 2))hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h3:∀ (L R : List (StackTuple (k + 2))), W.evalStackCfg m L R = Cfg.headRight q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))L:List (StackTuple (k + 2))R:List (StackTuple (k + 2))⊢ mapState f (W.evalStackCfg m L R) = Cfg.headRight (f q) (applyView vL (W.encLeft L)) (applyView vR (W.encRight R)) All goals completed! 🐙 hiff := k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)⊢ ∀ (cfg : Cfg (Fin (k + 2)) Λ₂), (∃ m L R, cfg = mapState f (W.evalStackCfg m L R)) ↔ ∃ m L R, cfg = mapState f (W.evalStackCfg m L R) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)cfg:Cfg (Fin (k + 2)) Λ₂⊢ (∃ m L R, cfg = mapState f (W.evalStackCfg m L R)) ↔ ∃ m L R, cfg = mapState f (W.evalStackCfg m L R); All goals completed! 🐙 hin := k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)⊢ ∀ (m : W.StackMode) (L R : List (StackTuple (k + 2))), ∃ m_1 L_1 R_1, mapState f (W.evalStackCfg m L R) = mapState f (W.evalStackCfg m_1 L_1 R_1) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)m:W.StackModeL:List (StackTuple (k + 2))R:List (StackTuple (k + 2))⊢ ∃ m_1 L_1 R_1, mapState f (W.evalStackCfg m L R) = mapState f (W.evalStackCfg m_1 L_1 R_1); All goals completed! 🐙 htransfer := k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)⊢ (∃ m m' x g f_1, (∀ (s : List (StackTuple (k + 2))), s.length ≤ (f_1 s).length) ∧ ∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), mapState f (W.evalStackCfg m (x :: z :: L) R) [M₂]⊢⁺ mapState f (W.evalStackCfg m' (g z :: L) (f_1 R))) ∨ ∃ m m' x g f_1, (∀ (s : List (StackTuple (k + 2))), s.length ≤ (f_1 s).length) ∧ ∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), mapState f (W.evalStackCfg m L (x :: z :: R)) [M₂]⊢⁺ mapState f (W.evalStackCfg m' (f_1 L) (g z :: R)) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)m:W.StackModem':W.StackModex:StackTuple (k + 2)g:StackTuple (k + 2) → StackTuple (k + 2)fl:List (StackTuple (k + 2)) → List (StackTuple (k + 2))hflen:∀ (s : List (StackTuple (k + 2))), s.length ≤ (fl s).lengthhstep:∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), W.evalStackCfg m (x :: z :: L) R [M₁]⊢⁺ W.evalStackCfg m' (g z :: L) (fl R)⊢ (∃ m m' x g f_1, (∀ (s : List (StackTuple (k + 2))), s.length ≤ (f_1 s).length) ∧ ∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), mapState f (W.evalStackCfg m (x :: z :: L) R) [M₂]⊢⁺ mapState f (W.evalStackCfg m' (g z :: L) (f_1 R))) ∨ ∃ m m' x g f_1, (∀ (s : List (StackTuple (k + 2))), s.length ≤ (f_1 s).length) ∧ ∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), mapState f (W.evalStackCfg m L (x :: z :: R)) [M₂]⊢⁺ mapState f (W.evalStackCfg m' (f_1 L) (g z :: R))k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)m:W.StackModem':W.StackModex:StackTuple (k + 2)g:StackTuple (k + 2) → StackTuple (k + 2)fl:List (StackTuple (k + 2)) → List (StackTuple (k + 2))hflen:∀ (s : List (StackTuple (k + 2))), s.length ≤ (fl s).lengthhstep:∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), W.evalStackCfg m L (x :: z :: R) [M₁]⊢⁺ W.evalStackCfg m' (fl L) (g z :: R)⊢ (∃ m m' x g f_1, (∀ (s : List (StackTuple (k + 2))), s.length ≤ (f_1 s).length) ∧ ∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), mapState f (W.evalStackCfg m (x :: z :: L) R) [M₂]⊢⁺ mapState f (W.evalStackCfg m' (g z :: L) (f_1 R))) ∨ ∃ m m' x g f_1, (∀ (s : List (StackTuple (k + 2))), s.length ≤ (f_1 s).length) ∧ ∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), mapState f (W.evalStackCfg m L (x :: z :: R)) [M₂]⊢⁺ mapState f (W.evalStackCfg m' (f_1 L) (g z :: R)) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)m:W.StackModem':W.StackModex:StackTuple (k + 2)g:StackTuple (k + 2) → StackTuple (k + 2)fl:List (StackTuple (k + 2)) → List (StackTuple (k + 2))hflen:∀ (s : List (StackTuple (k + 2))), s.length ≤ (fl s).lengthhstep:∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), W.evalStackCfg m (x :: z :: L) R [M₁]⊢⁺ W.evalStackCfg m' (g z :: L) (fl R)⊢ (∃ m m' x g f_1, (∀ (s : List (StackTuple (k + 2))), s.length ≤ (f_1 s).length) ∧ ∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), mapState f (W.evalStackCfg m (x :: z :: L) R) [M₂]⊢⁺ mapState f (W.evalStackCfg m' (g z :: L) (f_1 R))) ∨ ∃ m m' x g f_1, (∀ (s : List (StackTuple (k + 2))), s.length ≤ (f_1 s).length) ∧ ∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), mapState f (W.evalStackCfg m L (x :: z :: R)) [M₂]⊢⁺ mapState f (W.evalStackCfg m' (f_1 L) (g z :: R)) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)m:W.StackModem':W.StackModex:StackTuple (k + 2)g:StackTuple (k + 2) → StackTuple (k + 2)fl:List (StackTuple (k + 2)) → List (StackTuple (k + 2))hflen:∀ (s : List (StackTuple (k + 2))), s.length ≤ (fl s).lengthhstep:∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), W.evalStackCfg m (x :: z :: L) R [M₁]⊢⁺ W.evalStackCfg m' (g z :: L) (fl R)z:StackTuple (k + 2)L:List (StackTuple (k + 2))R:List (StackTuple (k + 2))⊢ mapState f (W.evalStackCfg m (x :: z :: L) R) [M₂]⊢⁺ mapState f (W.evalStackCfg m' (g z :: L) (fl R)) All goals completed! 🐙 k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)m:W.StackModem':W.StackModex:StackTuple (k + 2)g:StackTuple (k + 2) → StackTuple (k + 2)fl:List (StackTuple (k + 2)) → List (StackTuple (k + 2))hflen:∀ (s : List (StackTuple (k + 2))), s.length ≤ (fl s).lengthhstep:∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), W.evalStackCfg m L (x :: z :: R) [M₁]⊢⁺ W.evalStackCfg m' (fl L) (g z :: R)⊢ (∃ m m' x g f_1, (∀ (s : List (StackTuple (k + 2))), s.length ≤ (f_1 s).length) ∧ ∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), mapState f (W.evalStackCfg m (x :: z :: L) R) [M₂]⊢⁺ mapState f (W.evalStackCfg m' (g z :: L) (f_1 R))) ∨ ∃ m m' x g f_1, (∀ (s : List (StackTuple (k + 2))), s.length ≤ (f_1 s).length) ∧ ∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), mapState f (W.evalStackCfg m L (x :: z :: R)) [M₂]⊢⁺ mapState f (W.evalStackCfg m' (f_1 L) (g z :: R)) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)m:W.StackModem':W.StackModex:StackTuple (k + 2)g:StackTuple (k + 2) → StackTuple (k + 2)fl:List (StackTuple (k + 2)) → List (StackTuple (k + 2))hflen:∀ (s : List (StackTuple (k + 2))), s.length ≤ (fl s).lengthhstep:∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), W.evalStackCfg m L (x :: z :: R) [M₁]⊢⁺ W.evalStackCfg m' (fl L) (g z :: R)z:StackTuple (k + 2)L:List (StackTuple (k + 2))R:List (StackTuple (k + 2))⊢ mapState f (W.evalStackCfg m L (x :: z :: R)) [M₂]⊢⁺ mapState f (W.evalStackCfg m' (fl L) (g z :: R)) All goals completed! 🐙 hclosed := k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)⊢ ∀ (cfg : Cfg (Fin (k + 2)) Λ₂), (∃ m L R, cfg = mapState f (W.evalStackCfg m L R)) → ∃ cfg', (cfg [M₂]⊢⁺ cfg') ∧ ((∃ m L R, cfg' = mapState f (W.evalStackCfg m L R)) ∨ (step M₂ cfg').isNone = true) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)cfg:Cfg (Fin (k + 2)) Λ₂m:W.StackModeL:List (StackTuple (k + 2))R:List (StackTuple (k + 2))hcfg:cfg = mapState f (W.evalStackCfg m L R)⊢ ∃ cfg', (cfg [M₂]⊢⁺ cfg') ∧ ((∃ m L R, cfg' = mapState f (W.evalStackCfg m L R)) ∨ (step M₂ cfg').isNone = true) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)cfg:Cfg (Fin (k + 2)) Λ₂m:W.StackModeL:List (StackTuple (k + 2))R:List (StackTuple (k + 2))hcfg:cfg = mapState f (W.evalStackCfg m L R)⊢ ∃ cfg', (mapState f (W.evalStackCfg m L R) [M₂]⊢⁺ cfg') ∧ ((∃ m L R, cfg' = mapState f (W.evalStackCfg m L R)) ∨ (step M₂ cfg').isNone = true) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)cfg:Cfg (Fin (k + 2)) Λ₂m:W.StackModeL:List (StackTuple (k + 2))R:List (StackTuple (k + 2))hcfg:cfg = mapState f (W.evalStackCfg m L R)hsys₁:W.IsInStackSystem (W.evalStackCfg m L R)⊢ ∃ cfg', (mapState f (W.evalStackCfg m L R) [M₂]⊢⁺ cfg') ∧ ((∃ m L R, cfg' = mapState f (W.evalStackCfg m L R)) ∨ (step M₂ cfg').isNone = true) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)cfg:Cfg (Fin (k + 2)) Λ₂m:W.StackModeL:List (StackTuple (k + 2))R:List (StackTuple (k + 2))hcfg:cfg = mapState f (W.evalStackCfg m L R)hsys₁:W.IsInStackSystem (W.evalStackCfg m L R)cfg':Cfg (Fin (k + 2)) Λ₁hreach:W.evalStackCfg m L R [M₁]⊢⁺ cfg'hsys':W.IsInStackSystem cfg'⊢ ∃ cfg', (mapState f (W.evalStackCfg m L R) [M₂]⊢⁺ cfg') ∧ ((∃ m L R, cfg' = mapState f (W.evalStackCfg m L R)) ∨ (step M₂ cfg').isNone = true)k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)cfg:Cfg (Fin (k + 2)) Λ₂m:W.StackModeL:List (StackTuple (k + 2))R:List (StackTuple (k + 2))hcfg:cfg = mapState f (W.evalStackCfg m L R)hsys₁:W.IsInStackSystem (W.evalStackCfg m L R)cfg':Cfg (Fin (k + 2)) Λ₁hreach:W.evalStackCfg m L R [M₁]⊢⁺ cfg'hhalt:(step M₁ cfg').isNone = true⊢ ∃ cfg', (mapState f (W.evalStackCfg m L R) [M₂]⊢⁺ cfg') ∧ ((∃ m L R, cfg' = mapState f (W.evalStackCfg m L R)) ∨ (step M₂ cfg').isNone = true) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)cfg:Cfg (Fin (k + 2)) Λ₂m:W.StackModeL:List (StackTuple (k + 2))R:List (StackTuple (k + 2))hcfg:cfg = mapState f (W.evalStackCfg m L R)hsys₁:W.IsInStackSystem (W.evalStackCfg m L R)cfg':Cfg (Fin (k + 2)) Λ₁hreach:W.evalStackCfg m L R [M₁]⊢⁺ cfg'hsys':W.IsInStackSystem cfg'⊢ ∃ cfg', (mapState f (W.evalStackCfg m L R) [M₂]⊢⁺ cfg') ∧ ((∃ m L R, cfg' = mapState f (W.evalStackCfg m L R)) ∨ (step M₂ cfg').isNone = true) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)cfg:Cfg (Fin (k + 2)) Λ₂m:W.StackModeL:List (StackTuple (k + 2))R:List (StackTuple (k + 2))hcfg:cfg = mapState f (W.evalStackCfg m L R)hsys₁:W.IsInStackSystem (W.evalStackCfg m L R)cfg':Cfg (Fin (k + 2)) Λ₁hreach:W.evalStackCfg m L R [M₁]⊢⁺ cfg'hsys':W.IsInStackSystem cfg'm':W.StackModeL':List (StackTuple (k + 2))R':List (StackTuple (k + 2))hcfg':cfg' = W.evalStackCfg m' L' R'⊢ ∃ cfg', (mapState f (W.evalStackCfg m L R) [M₂]⊢⁺ cfg') ∧ ((∃ m L R, cfg' = mapState f (W.evalStackCfg m L R)) ∨ (step M₂ cfg').isNone = true) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)cfg:Cfg (Fin (k + 2)) Λ₂m:W.StackModeL:List (StackTuple (k + 2))R:List (StackTuple (k + 2))hcfg:cfg = mapState f (W.evalStackCfg m L R)hsys₁:W.IsInStackSystem (W.evalStackCfg m L R)cfg':Cfg (Fin (k + 2)) Λ₁hreach:W.evalStackCfg m L R [M₁]⊢⁺ cfg'hsys':W.IsInStackSystem cfg'm':W.StackModeL':List (StackTuple (k + 2))R':List (StackTuple (k + 2))hcfg':cfg' = W.evalStackCfg m' L' R'⊢ mapState f cfg' = mapState f (W.evalStackCfg m' L' R') All goals completed! 🐙 k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)cfg:Cfg (Fin (k + 2)) Λ₂m:W.StackModeL:List (StackTuple (k + 2))R:List (StackTuple (k + 2))hcfg:cfg = mapState f (W.evalStackCfg m L R)hsys₁:W.IsInStackSystem (W.evalStackCfg m L R)cfg':Cfg (Fin (k + 2)) Λ₁hreach:W.evalStackCfg m L R [M₁]⊢⁺ cfg'hhalt:(step M₁ cfg').isNone = true⊢ ∃ cfg', (mapState f (W.evalStackCfg m L R) [M₂]⊢⁺ cfg') ∧ ((∃ m L R, cfg' = mapState f (W.evalStackCfg m L R)) ∨ (step M₂ cfg').isNone = true) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)cfg:Cfg (Fin (k + 2)) Λ₂m:W.StackModeL:List (StackTuple (k + 2))R:List (StackTuple (k + 2))hcfg:cfg = mapState f (W.evalStackCfg m L R)hsys₁:W.IsInStackSystem (W.evalStackCfg m L R)cfg':Cfg (Fin (k + 2)) Λ₁hreach:W.evalStackCfg m L R [M₁]⊢⁺ cfg'hhalt:(step M₁ cfg').isNone = true⊢ (step M₂ (mapState f cfg')).isNone = true k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂hM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := d })) (M₁ q a)cfg:Cfg (Fin (k + 2)) Λ₂m:W.StackModeL:List (StackTuple (k + 2))R:List (StackTuple (k + 2))hcfg:cfg = mapState f (W.evalStackCfg m L R)hsys₁:W.IsInStackSystem (W.evalStackCfg m L R)cfg':Cfg (Fin (k + 2)) Λ₁hreach:W.evalStackCfg m L R [M₁]⊢⁺ cfg'hhalt:(step M₁ cfg').isNone = true⊢ (step M₁ cfg').isNone = true All goals completed! 🐙

Transport a ClosedStackSystem along a state bijection f and tape reflection (mirror).

def ClosedStackSystem.mirror {k : ℕ} {Λ₁ Λ₂ : Type*} [Inhabited Λ₁] [Inhabited Λ₂] {M₁ : Machine (Fin (k + 2)) Λ₁} {M₂ : Machine (Fin (k + 2)) Λ₂} (W : ClosedStackSystem M₁) (f : Λ₁ → Λ₂) (h_symm : W.encLeft = W.encRight) (hM : ∀ q a, M₂ (f q) a = (M₁ q a).map fun ⟨q', Stmt.write b d⟩ => ⟨q'.map f, Stmt.write b (reflectDir d)⟩) : ClosedStackSystem M₂ where StackMode := W.StackMode dSym := W.dSym sSym := W.sSym encLeft := W.encLeft encRight := W.encRight evalStackCfg m L R := mirrorCfg f (W.evalStackCfg m R L) IsInStackSystem cfg := ∃ m L R, cfg = mirrorCfg f (W.evalStackCfg m R L) hpolarity := W.hpolarity hnilL := W.hnilL hnilR := W.hnilR hheadL := W.hheadL hheadR := W.hheadR hnsL := W.hnsL hnsR := W.hnsR hparams := W.hparams hmodes := W.hmodes hvalid := k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)⊢ IsValidStackModes W.encLeft W.encRight fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)m:W.StackMode⊢ ∃ q vL vR, HalfTapeView.casesOn vL List.length List.length ≤ 8 ∧ HalfTapeView.casesOn vR List.length List.length ≤ 8 ∧ ((∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L)) m L R = { q := some q, tape := { head := 0, left := applyView vL (W.encLeft L), right := applyView vR (W.encRight R) } }) ∨ (∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L)) m L R = Cfg.headLeft q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))) ∨ ∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L)) m L R = Cfg.headRight q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)m:W.StackModeq:Λ₁vL:HalfTapeView (Fin (k + 2))vR:HalfTapeView (Fin (k + 2))hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h1:∀ (L R : List (StackTuple (k + 2))), W.evalStackCfg m L R = { q := some q, tape := { head := 0, left := applyView vL (W.encLeft L), right := applyView vR (W.encRight R) } }⊢ ∃ q vL vR, HalfTapeView.casesOn vL List.length List.length ≤ 8 ∧ HalfTapeView.casesOn vR List.length List.length ≤ 8 ∧ ((∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L)) m L R = { q := some q, tape := { head := 0, left := applyView vL (W.encLeft L), right := applyView vR (W.encRight R) } }) ∨ (∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L)) m L R = Cfg.headLeft q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))) ∨ ∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L)) m L R = Cfg.headRight q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R)))k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)m:W.StackModeq:Λ₁vL:HalfTapeView (Fin (k + 2))vR:HalfTapeView (Fin (k + 2))hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h2:∀ (L R : List (StackTuple (k + 2))), W.evalStackCfg m L R = Cfg.headLeft q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))⊢ ∃ q vL vR, HalfTapeView.casesOn vL List.length List.length ≤ 8 ∧ HalfTapeView.casesOn vR List.length List.length ≤ 8 ∧ ((∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L)) m L R = { q := some q, tape := { head := 0, left := applyView vL (W.encLeft L), right := applyView vR (W.encRight R) } }) ∨ (∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L)) m L R = Cfg.headLeft q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))) ∨ ∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L)) m L R = Cfg.headRight q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R)))k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)m:W.StackModeq:Λ₁vL:HalfTapeView (Fin (k + 2))vR:HalfTapeView (Fin (k + 2))hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h3:∀ (L R : List (StackTuple (k + 2))), W.evalStackCfg m L R = Cfg.headRight q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))⊢ ∃ q vL vR, HalfTapeView.casesOn vL List.length List.length ≤ 8 ∧ HalfTapeView.casesOn vR List.length List.length ≤ 8 ∧ ((∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L)) m L R = { q := some q, tape := { head := 0, left := applyView vL (W.encLeft L), right := applyView vR (W.encRight R) } }) ∨ (∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L)) m L R = Cfg.headLeft q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))) ∨ ∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L)) m L R = Cfg.headRight q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)m:W.StackModeq:Λ₁vL:HalfTapeView (Fin (k + 2))vR:HalfTapeView (Fin (k + 2))hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h1:∀ (L R : List (StackTuple (k + 2))), W.evalStackCfg m L R = { q := some q, tape := { head := 0, left := applyView vL (W.encLeft L), right := applyView vR (W.encRight R) } }⊢ ∃ q vL vR, HalfTapeView.casesOn vL List.length List.length ≤ 8 ∧ HalfTapeView.casesOn vR List.length List.length ≤ 8 ∧ ((∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L)) m L R = { q := some q, tape := { head := 0, left := applyView vL (W.encLeft L), right := applyView vR (W.encRight R) } }) ∨ (∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L)) m L R = Cfg.headLeft q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))) ∨ ∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L)) m L R = Cfg.headRight q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)m:W.StackModeq:Λ₁vL:HalfTapeView (Fin (k + 2))vR:HalfTapeView (Fin (k + 2))hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h1:∀ (L R : List (StackTuple (k + 2))), W.evalStackCfg m L R = { q := some q, tape := { head := 0, left := applyView vL (W.encLeft L), right := applyView vR (W.encRight R) } }L:List (StackTuple (k + 2))R:List (StackTuple (k + 2))⊢ (fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L)) m L R = { q := some (f q), tape := { head := 0, left := applyView vR (W.encLeft L), right := applyView vL (W.encRight R) } } k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)m:W.StackModeq:Λ₁vL:HalfTapeView (Fin (k + 2))vR:HalfTapeView (Fin (k + 2))hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h1:∀ (L R : List (StackTuple (k + 2))), W.evalStackCfg m L R = { q := some q, tape := { head := 0, left := applyView vL (W.encLeft L), right := applyView vR (W.encRight R) } }L:List (StackTuple (k + 2))R:List (StackTuple (k + 2))⊢ mirrorCfg f (W.evalStackCfg m R L) = { q := some (f q), tape := { head := 0, left := applyView vR (W.encLeft L), right := applyView vL (W.encRight R) } } All goals completed! 🐙 k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)m:W.StackModeq:Λ₁vL:HalfTapeView (Fin (k + 2))vR:HalfTapeView (Fin (k + 2))hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h2:∀ (L R : List (StackTuple (k + 2))), W.evalStackCfg m L R = Cfg.headLeft q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))⊢ ∃ q vL vR, HalfTapeView.casesOn vL List.length List.length ≤ 8 ∧ HalfTapeView.casesOn vR List.length List.length ≤ 8 ∧ ((∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L)) m L R = { q := some q, tape := { head := 0, left := applyView vL (W.encLeft L), right := applyView vR (W.encRight R) } }) ∨ (∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L)) m L R = Cfg.headLeft q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))) ∨ ∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L)) m L R = Cfg.headRight q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)m:W.StackModeq:Λ₁vL:HalfTapeView (Fin (k + 2))vR:HalfTapeView (Fin (k + 2))hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h2:∀ (L R : List (StackTuple (k + 2))), W.evalStackCfg m L R = Cfg.headLeft q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))L:List (StackTuple (k + 2))R:List (StackTuple (k + 2))⊢ (fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L)) m L R = Cfg.headRight (f q) (applyView vR (W.encLeft L)) (applyView vL (W.encRight R)) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)m:W.StackModeq:Λ₁vL:HalfTapeView (Fin (k + 2))vR:HalfTapeView (Fin (k + 2))hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h2:∀ (L R : List (StackTuple (k + 2))), W.evalStackCfg m L R = Cfg.headLeft q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))L:List (StackTuple (k + 2))R:List (StackTuple (k + 2))⊢ mirrorCfg f (W.evalStackCfg m R L) = Cfg.headRight (f q) (applyView vR (W.encLeft L)) (applyView vL (W.encRight R)) All goals completed! 🐙 k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)m:W.StackModeq:Λ₁vL:HalfTapeView (Fin (k + 2))vR:HalfTapeView (Fin (k + 2))hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h3:∀ (L R : List (StackTuple (k + 2))), W.evalStackCfg m L R = Cfg.headRight q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))⊢ ∃ q vL vR, HalfTapeView.casesOn vL List.length List.length ≤ 8 ∧ HalfTapeView.casesOn vR List.length List.length ≤ 8 ∧ ((∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L)) m L R = { q := some q, tape := { head := 0, left := applyView vL (W.encLeft L), right := applyView vR (W.encRight R) } }) ∨ (∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L)) m L R = Cfg.headLeft q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))) ∨ ∀ (L R : List (StackTuple (k + 2))), (fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L)) m L R = Cfg.headRight q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)m:W.StackModeq:Λ₁vL:HalfTapeView (Fin (k + 2))vR:HalfTapeView (Fin (k + 2))hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h3:∀ (L R : List (StackTuple (k + 2))), W.evalStackCfg m L R = Cfg.headRight q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))L:List (StackTuple (k + 2))R:List (StackTuple (k + 2))⊢ (fun m L R ↦ mirrorCfg f (W.evalStackCfg m R L)) m L R = Cfg.headLeft (f q) (applyView vR (W.encLeft L)) (applyView vL (W.encRight R)) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)m:W.StackModeq:Λ₁vL:HalfTapeView (Fin (k + 2))vR:HalfTapeView (Fin (k + 2))hvL:HalfTapeView.casesOn vL List.length List.length ≤ 8hvR:HalfTapeView.casesOn vR List.length List.length ≤ 8h3:∀ (L R : List (StackTuple (k + 2))), W.evalStackCfg m L R = Cfg.headRight q (applyView vL (W.encLeft L)) (applyView vR (W.encRight R))L:List (StackTuple (k + 2))R:List (StackTuple (k + 2))⊢ mirrorCfg f (W.evalStackCfg m R L) = Cfg.headLeft (f q) (applyView vR (W.encLeft L)) (applyView vL (W.encRight R)) All goals completed! 🐙 hiff := k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)⊢ ∀ (cfg : Cfg (Fin (k + 2)) Λ₂), (∃ m L R, cfg = mirrorCfg f (W.evalStackCfg m R L)) ↔ ∃ m L R, cfg = mirrorCfg f (W.evalStackCfg m R L) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)cfg:Cfg (Fin (k + 2)) Λ₂⊢ (∃ m L R, cfg = mirrorCfg f (W.evalStackCfg m R L)) ↔ ∃ m L R, cfg = mirrorCfg f (W.evalStackCfg m R L); All goals completed! 🐙 hin := k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)⊢ ∀ (m : W.StackMode) (L R : List (StackTuple (k + 2))), ∃ m_1 L_1 R_1, mirrorCfg f (W.evalStackCfg m R L) = mirrorCfg f (W.evalStackCfg m_1 R_1 L_1) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)m:W.StackModeL:List (StackTuple (k + 2))R:List (StackTuple (k + 2))⊢ ∃ m_1 L_1 R_1, mirrorCfg f (W.evalStackCfg m R L) = mirrorCfg f (W.evalStackCfg m_1 R_1 L_1); All goals completed! 🐙 htransfer := k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)⊢ (∃ m m' x g f_1, (∀ (s : List (StackTuple (k + 2))), s.length ≤ (f_1 s).length) ∧ ∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), mirrorCfg f (W.evalStackCfg m R (x :: z :: L)) [M₂]⊢⁺ mirrorCfg f (W.evalStackCfg m' (f_1 R) (g z :: L))) ∨ ∃ m m' x g f_1, (∀ (s : List (StackTuple (k + 2))), s.length ≤ (f_1 s).length) ∧ ∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), mirrorCfg f (W.evalStackCfg m (x :: z :: R) L) [M₂]⊢⁺ mirrorCfg f (W.evalStackCfg m' (g z :: R) (f_1 L)) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)m:W.StackModem':W.StackModex:StackTuple (k + 2)g:StackTuple (k + 2) → StackTuple (k + 2)fl:List (StackTuple (k + 2)) → List (StackTuple (k + 2))hflen:∀ (s : List (StackTuple (k + 2))), s.length ≤ (fl s).lengthhstep:∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), W.evalStackCfg m (x :: z :: L) R [M₁]⊢⁺ W.evalStackCfg m' (g z :: L) (fl R)⊢ (∃ m m' x g f_1, (∀ (s : List (StackTuple (k + 2))), s.length ≤ (f_1 s).length) ∧ ∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), mirrorCfg f (W.evalStackCfg m R (x :: z :: L)) [M₂]⊢⁺ mirrorCfg f (W.evalStackCfg m' (f_1 R) (g z :: L))) ∨ ∃ m m' x g f_1, (∀ (s : List (StackTuple (k + 2))), s.length ≤ (f_1 s).length) ∧ ∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), mirrorCfg f (W.evalStackCfg m (x :: z :: R) L) [M₂]⊢⁺ mirrorCfg f (W.evalStackCfg m' (g z :: R) (f_1 L))k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)m:W.StackModem':W.StackModex:StackTuple (k + 2)g:StackTuple (k + 2) → StackTuple (k + 2)fl:List (StackTuple (k + 2)) → List (StackTuple (k + 2))hflen:∀ (s : List (StackTuple (k + 2))), s.length ≤ (fl s).lengthhstep:∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), W.evalStackCfg m L (x :: z :: R) [M₁]⊢⁺ W.evalStackCfg m' (fl L) (g z :: R)⊢ (∃ m m' x g f_1, (∀ (s : List (StackTuple (k + 2))), s.length ≤ (f_1 s).length) ∧ ∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), mirrorCfg f (W.evalStackCfg m R (x :: z :: L)) [M₂]⊢⁺ mirrorCfg f (W.evalStackCfg m' (f_1 R) (g z :: L))) ∨ ∃ m m' x g f_1, (∀ (s : List (StackTuple (k + 2))), s.length ≤ (f_1 s).length) ∧ ∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), mirrorCfg f (W.evalStackCfg m (x :: z :: R) L) [M₂]⊢⁺ mirrorCfg f (W.evalStackCfg m' (g z :: R) (f_1 L)) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)m:W.StackModem':W.StackModex:StackTuple (k + 2)g:StackTuple (k + 2) → StackTuple (k + 2)fl:List (StackTuple (k + 2)) → List (StackTuple (k + 2))hflen:∀ (s : List (StackTuple (k + 2))), s.length ≤ (fl s).lengthhstep:∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), W.evalStackCfg m (x :: z :: L) R [M₁]⊢⁺ W.evalStackCfg m' (g z :: L) (fl R)⊢ (∃ m m' x g f_1, (∀ (s : List (StackTuple (k + 2))), s.length ≤ (f_1 s).length) ∧ ∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), mirrorCfg f (W.evalStackCfg m R (x :: z :: L)) [M₂]⊢⁺ mirrorCfg f (W.evalStackCfg m' (f_1 R) (g z :: L))) ∨ ∃ m m' x g f_1, (∀ (s : List (StackTuple (k + 2))), s.length ≤ (f_1 s).length) ∧ ∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), mirrorCfg f (W.evalStackCfg m (x :: z :: R) L) [M₂]⊢⁺ mirrorCfg f (W.evalStackCfg m' (g z :: R) (f_1 L)) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)m:W.StackModem':W.StackModex:StackTuple (k + 2)g:StackTuple (k + 2) → StackTuple (k + 2)fl:List (StackTuple (k + 2)) → List (StackTuple (k + 2))hflen:∀ (s : List (StackTuple (k + 2))), s.length ≤ (fl s).lengthhstep:∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), W.evalStackCfg m (x :: z :: L) R [M₁]⊢⁺ W.evalStackCfg m' (g z :: L) (fl R)z:StackTuple (k + 2)L:List (StackTuple (k + 2))R:List (StackTuple (k + 2))⊢ mirrorCfg f (W.evalStackCfg m (x :: z :: R) L) [M₂]⊢⁺ mirrorCfg f (W.evalStackCfg m' (g z :: R) (fl L)) All goals completed! 🐙 k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)m:W.StackModem':W.StackModex:StackTuple (k + 2)g:StackTuple (k + 2) → StackTuple (k + 2)fl:List (StackTuple (k + 2)) → List (StackTuple (k + 2))hflen:∀ (s : List (StackTuple (k + 2))), s.length ≤ (fl s).lengthhstep:∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), W.evalStackCfg m L (x :: z :: R) [M₁]⊢⁺ W.evalStackCfg m' (fl L) (g z :: R)⊢ (∃ m m' x g f_1, (∀ (s : List (StackTuple (k + 2))), s.length ≤ (f_1 s).length) ∧ ∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), mirrorCfg f (W.evalStackCfg m R (x :: z :: L)) [M₂]⊢⁺ mirrorCfg f (W.evalStackCfg m' (f_1 R) (g z :: L))) ∨ ∃ m m' x g f_1, (∀ (s : List (StackTuple (k + 2))), s.length ≤ (f_1 s).length) ∧ ∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), mirrorCfg f (W.evalStackCfg m (x :: z :: R) L) [M₂]⊢⁺ mirrorCfg f (W.evalStackCfg m' (g z :: R) (f_1 L)) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)m:W.StackModem':W.StackModex:StackTuple (k + 2)g:StackTuple (k + 2) → StackTuple (k + 2)fl:List (StackTuple (k + 2)) → List (StackTuple (k + 2))hflen:∀ (s : List (StackTuple (k + 2))), s.length ≤ (fl s).lengthhstep:∀ (z : StackTuple (k + 2)) (L R : List (StackTuple (k + 2))), W.evalStackCfg m L (x :: z :: R) [M₁]⊢⁺ W.evalStackCfg m' (fl L) (g z :: R)z:StackTuple (k + 2)L:List (StackTuple (k + 2))R:List (StackTuple (k + 2))⊢ mirrorCfg f (W.evalStackCfg m R (x :: z :: L)) [M₂]⊢⁺ mirrorCfg f (W.evalStackCfg m' (fl R) (g z :: L)) All goals completed! 🐙 hclosed := k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)⊢ ∀ (cfg : Cfg (Fin (k + 2)) Λ₂), (∃ m L R, cfg = mirrorCfg f (W.evalStackCfg m R L)) → ∃ cfg', (cfg [M₂]⊢⁺ cfg') ∧ ((∃ m L R, cfg' = mirrorCfg f (W.evalStackCfg m R L)) ∨ (step M₂ cfg').isNone = true) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)cfg:Cfg (Fin (k + 2)) Λ₂m:W.StackModeL:List (StackTuple (k + 2))R:List (StackTuple (k + 2))hcfg:cfg = mirrorCfg f (W.evalStackCfg m R L)⊢ ∃ cfg', (cfg [M₂]⊢⁺ cfg') ∧ ((∃ m L R, cfg' = mirrorCfg f (W.evalStackCfg m R L)) ∨ (step M₂ cfg').isNone = true) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)cfg:Cfg (Fin (k + 2)) Λ₂m:W.StackModeL:List (StackTuple (k + 2))R:List (StackTuple (k + 2))hcfg:cfg = mirrorCfg f (W.evalStackCfg m R L)⊢ ∃ cfg', (mirrorCfg f (W.evalStackCfg m R L) [M₂]⊢⁺ cfg') ∧ ((∃ m L R, cfg' = mirrorCfg f (W.evalStackCfg m R L)) ∨ (step M₂ cfg').isNone = true) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)cfg:Cfg (Fin (k + 2)) Λ₂m:W.StackModeL:List (StackTuple (k + 2))R:List (StackTuple (k + 2))hcfg:cfg = mirrorCfg f (W.evalStackCfg m R L)hsys₁:W.IsInStackSystem (W.evalStackCfg m R L)⊢ ∃ cfg', (mirrorCfg f (W.evalStackCfg m R L) [M₂]⊢⁺ cfg') ∧ ((∃ m L R, cfg' = mirrorCfg f (W.evalStackCfg m R L)) ∨ (step M₂ cfg').isNone = true) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)cfg:Cfg (Fin (k + 2)) Λ₂m:W.StackModeL:List (StackTuple (k + 2))R:List (StackTuple (k + 2))hcfg:cfg = mirrorCfg f (W.evalStackCfg m R L)hsys₁:W.IsInStackSystem (W.evalStackCfg m R L)cfg':Cfg (Fin (k + 2)) Λ₁hreach:W.evalStackCfg m R L [M₁]⊢⁺ cfg'hsys':W.IsInStackSystem cfg'⊢ ∃ cfg', (mirrorCfg f (W.evalStackCfg m R L) [M₂]⊢⁺ cfg') ∧ ((∃ m L R, cfg' = mirrorCfg f (W.evalStackCfg m R L)) ∨ (step M₂ cfg').isNone = true)k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)cfg:Cfg (Fin (k + 2)) Λ₂m:W.StackModeL:List (StackTuple (k + 2))R:List (StackTuple (k + 2))hcfg:cfg = mirrorCfg f (W.evalStackCfg m R L)hsys₁:W.IsInStackSystem (W.evalStackCfg m R L)cfg':Cfg (Fin (k + 2)) Λ₁hreach:W.evalStackCfg m R L [M₁]⊢⁺ cfg'hhalt:(step M₁ cfg').isNone = true⊢ ∃ cfg', (mirrorCfg f (W.evalStackCfg m R L) [M₂]⊢⁺ cfg') ∧ ((∃ m L R, cfg' = mirrorCfg f (W.evalStackCfg m R L)) ∨ (step M₂ cfg').isNone = true) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)cfg:Cfg (Fin (k + 2)) Λ₂m:W.StackModeL:List (StackTuple (k + 2))R:List (StackTuple (k + 2))hcfg:cfg = mirrorCfg f (W.evalStackCfg m R L)hsys₁:W.IsInStackSystem (W.evalStackCfg m R L)cfg':Cfg (Fin (k + 2)) Λ₁hreach:W.evalStackCfg m R L [M₁]⊢⁺ cfg'hsys':W.IsInStackSystem cfg'⊢ ∃ cfg', (mirrorCfg f (W.evalStackCfg m R L) [M₂]⊢⁺ cfg') ∧ ((∃ m L R, cfg' = mirrorCfg f (W.evalStackCfg m R L)) ∨ (step M₂ cfg').isNone = true) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)cfg:Cfg (Fin (k + 2)) Λ₂m:W.StackModeL:List (StackTuple (k + 2))R:List (StackTuple (k + 2))hcfg:cfg = mirrorCfg f (W.evalStackCfg m R L)hsys₁:W.IsInStackSystem (W.evalStackCfg m R L)cfg':Cfg (Fin (k + 2)) Λ₁hreach:W.evalStackCfg m R L [M₁]⊢⁺ cfg'hsys':W.IsInStackSystem cfg'm':W.StackModeR':List (StackTuple (k + 2))L':List (StackTuple (k + 2))hcfg':cfg' = W.evalStackCfg m' R' L'⊢ ∃ cfg', (mirrorCfg f (W.evalStackCfg m R L) [M₂]⊢⁺ cfg') ∧ ((∃ m L R, cfg' = mirrorCfg f (W.evalStackCfg m R L)) ∨ (step M₂ cfg').isNone = true) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)cfg:Cfg (Fin (k + 2)) Λ₂m:W.StackModeL:List (StackTuple (k + 2))R:List (StackTuple (k + 2))hcfg:cfg = mirrorCfg f (W.evalStackCfg m R L)hsys₁:W.IsInStackSystem (W.evalStackCfg m R L)cfg':Cfg (Fin (k + 2)) Λ₁hreach:W.evalStackCfg m R L [M₁]⊢⁺ cfg'hsys':W.IsInStackSystem cfg'm':W.StackModeR':List (StackTuple (k + 2))L':List (StackTuple (k + 2))hcfg':cfg' = W.evalStackCfg m' R' L'⊢ mirrorCfg f cfg' = mirrorCfg f (W.evalStackCfg m' R' L') All goals completed! 🐙 k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)cfg:Cfg (Fin (k + 2)) Λ₂m:W.StackModeL:List (StackTuple (k + 2))R:List (StackTuple (k + 2))hcfg:cfg = mirrorCfg f (W.evalStackCfg m R L)hsys₁:W.IsInStackSystem (W.evalStackCfg m R L)cfg':Cfg (Fin (k + 2)) Λ₁hreach:W.evalStackCfg m R L [M₁]⊢⁺ cfg'hhalt:(step M₁ cfg').isNone = true⊢ ∃ cfg', (mirrorCfg f (W.evalStackCfg m R L) [M₂]⊢⁺ cfg') ∧ ((∃ m L R, cfg' = mirrorCfg f (W.evalStackCfg m R L)) ∨ (step M₂ cfg').isNone = true) k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)cfg:Cfg (Fin (k + 2)) Λ₂m:W.StackModeL:List (StackTuple (k + 2))R:List (StackTuple (k + 2))hcfg:cfg = mirrorCfg f (W.evalStackCfg m R L)hsys₁:W.IsInStackSystem (W.evalStackCfg m R L)cfg':Cfg (Fin (k + 2)) Λ₁hreach:W.evalStackCfg m R L [M₁]⊢⁺ cfg'hhalt:(step M₁ cfg').isNone = true⊢ (step M₂ (mirrorCfg f cfg')).isNone = true k:ℕΛ₁:Type u_1Λ₂:Type u_2inst✝¹:Inhabited Λ₁inst✝:Inhabited Λ₂M₁:Machine (Fin (k + 2)) Λ₁M₂:Machine (Fin (k + 2)) Λ₂W:ClosedStackSystem M₁f:Λ₁ → Λ₂h_symm:W.encLeft = W.encRighthM:∀ (q : Λ₁) (a : Fin (k + 2)), M₂ (f q) a = Option.map (fun x ↦ match x with | (q', { symbol := b, dir := d }) => (Option.map f q', { symbol := b, dir := reflectDir d })) (M₁ q a)cfg:Cfg (Fin (k + 2)) Λ₂m:W.StackModeL:List (StackTuple (k + 2))R:List (StackTuple (k + 2))hcfg:cfg = mirrorCfg f (W.evalStackCfg m R L)hsys₁:W.IsInStackSystem (W.evalStackCfg m R L)cfg':Cfg (Fin (k + 2)) Λ₁hreach:W.evalStackCfg m R L [M₁]⊢⁺ cfg'hhalt:(step M₁ cfg').isNone = true⊢ (step M₁ cfg').isNone = true All goals completed! 🐙end BusyBeaver.Stack