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

Spatial Word-Vocabulary Run-Length Simulation (BusyBeaver.WordRLE)

Reusable, machine-polymorphic infrastructure for kernel-verified Turing machine simulation over run-length-encoded (RLE) stacks of finite spatial words:

    withNat — Call-by-value ℕ normalizer (withNat n k = k n) forcing intermediate arithmetic results to weak-head normal form in Lean's C++ kernel.

    BTree & NatTrie — Logarithmic-depth tree and radix-trie containers for compact certificates.

    dirCfg & WordExit — Translation-invariant directed configurations (Cfg.headRight / Cfg.headLeft over ListBlank Γ) and verified local word-exit transitions.

    simWord & sweepWord_sound — Certified single-word zipper execution and k-copy homogeneous sweeps (ReachesIn M (dt * k) ...).

    simSubwords — Certified composite-word exit computation from a verified base-word exit table.

    EntryCfg & EntryReaches — Concrete RLE stack simulator with pluggable macro-transition hooks and O(1) chunked certificate composition.

@[expose] public sectionnamespace BusyBeaver.WordRLEopen Turing

Call-by-Value Kernel Normalizer (withNat)

Force n : ℕ to weak-head normal form (0 or Nat.succ m) before passing it to k, preventing call-by-name thunk accumulation during decide +kernel reduction while remaining definitionally equal to k n on numerals and provably k n for all n.

@[inline] def withNat {α : Type*} (n : ℕ) (k : ℕ → α) : α := match n with | 0 => k 0 | m + 1 => k (Nat.succ m)@[simp] theorem withNat_eq {α : Type*} (n : ℕ) (k : ℕ → α) : withNat n k = k n := α:Type u_1n:ℕk:ℕ → α⊢ withNat n k = k n α:Type u_1k:ℕ → α⊢ withNat 0 k = k 0α:Type u_1k:ℕ → αn✝:ℕ⊢ withNat (n✝ + 1) k = k (n✝ + 1) α:Type u_1k:ℕ → α⊢ withNat 0 k = k 0α:Type u_1k:ℕ → αn✝:ℕ⊢ withNat (n✝ + 1) k = k (n✝ + 1) All goals completed! 🐙

Force b : Bool to weak-head normal form (true or false) before passing it to k.

@[inline] def withBool {α : Type*} (b : Bool) (k : Bool → α) : α := if b then k true else k false@[simp] theorem withBool_eq {α : Type*} (b : Bool) (k : Bool → α) : withBool b k = k b := α:Type u_1b:Boolk:Bool → α⊢ withBool b k = k b α:Type u_1k:Bool → α⊢ withBool false k = k falseα:Type u_1k:Bool → α⊢ withBool true k = k true α:Type u_1k:Bool → α⊢ withBool false k = k falseα:Type u_1k:Bool → α⊢ withBool true k = k true All goals completed! 🐙

Balanced Binary Trees (BTree) and ℕ-Keyed Radix Tries (NatTrie)

Balanced binary tree keeping certificate expression depth logarithmic (O(log N)).

inductive BTree (α : Type) where

Empty tree.

| empty : BTree α

Single element leaf.

| leaf (val : α) : BTree α

Internal binary node.

| node (left right : BTree α) : BTree α deriving DecidableEq, Inhabited

Convert a BTree α to a List α in left-to-right order with accumulator acc.

def BTree.toListAcc {α : Type} : BTree α → List α → List α | .empty, acc => acc | .leaf x, acc => x :: acc | .node l r, acc => l.toListAcc (r.toListAcc acc)

Convert a BTree α to a List α in left-to-right order.

def BTree.toList {α : Type} (t : BTree α) : List α := t.toListAcc []

Little-endian binary radix trie keyed by ℕ, enabling O(log N) constructor-match lookups inside the Lean kernel with zero rebuild overhead when emitted directly as a certificate tree.

inductive NatTrie (α : Type) where

Empty subtrie.

| leaf : NatTrie α

Binary trie node with optional value at key 0 and even/odd child subtries.

| node (val : Option α) (even odd : NatTrie α) : NatTrie α deriving DecidableEq, Inhabitednamespace NatTrie

Look up key n in radix trie t.

def find? {α : Type} : NatTrie α → ℕ → Option α | .leaf, _ => none | .node v _ _, 0 => v | .node _ l r, n + 1 => let m := n + 1 if Nat.beq (m % 2) 0 then find? l (m / 2) else find? r (m / 2)

Fuel-bounded radix-trie insertion helper.

def insFuel {α : Type} : ℕ → NatTrie α → ℕ → α → NatTrie α | 0, t, _, _ => t | _ + 1, .leaf, 0, val => .node (some val) .leaf .leaf | fuel + 1, .leaf, n + 1, val => let m := n + 1 if Nat.beq (m % 2) 0 then .node none (insFuel fuel .leaf (m / 2) val) .leaf else .node none .leaf (insFuel fuel .leaf (m / 2) val) | _ + 1, .node _ l r, 0, val => .node (some val) l r | fuel + 1, .node v l r, n + 1, val => let m := n + 1 if Nat.beq (m % 2) 0 then .node v (insFuel fuel l (m / 2) val) r else .node v l (insFuel fuel r (m / 2) val)

Insert (k, val) into radix trie t (supports keys up to 2^32 - 1).

def insert {α : Type} (t : NatTrie α) (k : ℕ) (val : α) : NatTrie α := insFuel 33 t k val

Check predicate p key val on every stored entry in t, reconstructing keys as keyPrefix + localKey * bitMul.

def checkAll {α : Type} (p : ℕ → α → Bool) (keyPrefix bitMul : ℕ) : NatTrie α → Bool | .leaf => true | .node val? l r => let selfOk := match val? with | none => true | some v => p keyPrefix v selfOk && checkAll p keyPrefix (bitMul * 2) l && checkAll p (keyPrefix + bitMul) (bitMul * 2) rtheorem checkAll_node_iff {α : Type} (p : ℕ → α → Bool) (keyPrefix bitMul : ℕ) (val? : Option α) (l r : NatTrie α) : checkAll p keyPrefix bitMul (.node val? l r) = true ↔ (match val? with | none => true | some v => p keyPrefix v) = true ∧ checkAll p keyPrefix (bitMul * 2) l = true ∧ checkAll p (keyPrefix + bitMul) (bitMul * 2) r = true := α:Typep:ℕ → α → BoolkeyPrefix:ℕbitMul:ℕval?:Option αl:NatTrie αr:NatTrie α⊢ checkAll p keyPrefix bitMul (node val? l r) = true ↔ (match val? with | none => true | some v => p keyPrefix v) = true ∧ checkAll p keyPrefix (bitMul * 2) l = true ∧ checkAll p (keyPrefix + bitMul) (bitMul * 2) r = true All goals completed! 🐙

Any value found via NatTrie.find? in a checkAll-verified subtrie satisfies p.

theorem checkAll_find? {α : Type} {p : ℕ → α → Bool} : ∀ (t : NatTrie α) (keyPrefix bitMul n : ℕ) (val : α), checkAll p keyPrefix bitMul t = true → t.find? n = some val → p (keyPrefix + n * bitMul) val = true α:Typep:ℕ → α → Boolx✝⁴:ℕx✝³:ℕx✝²:ℕx✝¹:αx✝:checkAll p x✝⁴ x✝³ leaf = truehf:leaf.find? x✝² = some x✝¹⊢ p (x✝⁴ + x✝² * x✝³) x✝¹ = true α:Typep:ℕ → α → Boolx✝⁴:ℕx✝³:ℕx✝²:ℕx✝¹:αx✝:checkAll p x✝⁴ x✝³ leaf = truehf:leaf.find? x✝² = some x✝¹⊢ p (x✝⁴ + x✝² * x✝³) x✝¹ = true All goals completed! 🐙 α:Typep:ℕ → α → Boolval?:Option αl:NatTrie αr:NatTrie αkeyPrefix:ℕbitMul:ℕval:αhc:checkAll p keyPrefix bitMul (node val? l r) = truehf:(node val? l r).find? 0 = some val⊢ p (keyPrefix + 0 * bitMul) val = true α:Typep:ℕ → α → Boolval?:Option αl:NatTrie αr:NatTrie αkeyPrefix:ℕbitMul:ℕval:αhc:checkAll p keyPrefix bitMul (node val? l r) = truehf:(node val? l r).find? 0 = some val⊢ p (keyPrefix + 0 * bitMul) val = true α:Typep:ℕ → α → Boolval?:Option αl:NatTrie αr:NatTrie αkeyPrefix:ℕbitMul:ℕval:αhc:(match val? with | none => true | some v => p keyPrefix v) = true ∧ checkAll p keyPrefix (bitMul * 2) l = true ∧ checkAll p (keyPrefix + bitMul) (bitMul * 2) r = truehf:(node val? l r).find? 0 = some val⊢ p (keyPrefix + 0 * bitMul) val = true α:Typep:ℕ → α → Boolval?:Option αl:NatTrie αr:NatTrie αkeyPrefix:ℕbitMul:ℕval:αhc:(match val? with | none => true | some v => p keyPrefix v) = true ∧ checkAll p keyPrefix (bitMul * 2) l = true ∧ checkAll p (keyPrefix + bitMul) (bitMul * 2) r = truehf:val? = some val⊢ p (keyPrefix + 0 * bitMul) val = true α:Typep:ℕ → α → Booll:NatTrie αr:NatTrie αkeyPrefix:ℕbitMul:ℕval:αhc:(match some val with | none => true | some v => p keyPrefix v) = true ∧ checkAll p keyPrefix (bitMul * 2) l = true ∧ checkAll p (keyPrefix + bitMul) (bitMul * 2) r = true⊢ p (keyPrefix + 0 * bitMul) val = true All goals completed! 🐙 α:Typep:ℕ → α → Boolval?:Option αl:NatTrie αr:NatTrie αkeyPrefix:ℕbitMul:ℕn:ℕval:αhc:checkAll p keyPrefix bitMul (node val? l r) = truehf:(node val? l r).find? (n + 1) = some val⊢ p (keyPrefix + (n + 1) * bitMul) val = true α:Typep:ℕ → α → Boolval?:Option αl:NatTrie αr:NatTrie αkeyPrefix:ℕbitMul:ℕn:ℕval:αhc:checkAll p keyPrefix bitMul (node val? l r) = truehf:(node val? l r).find? (n + 1) = some val⊢ p (keyPrefix + (n + 1) * bitMul) val = true α:Typep:ℕ → α → Boolval?:Option αl:NatTrie αr:NatTrie αkeyPrefix:ℕbitMul:ℕn:ℕval:αhc:(match val? with | none => true | some v => p keyPrefix v) = true ∧ checkAll p keyPrefix (bitMul * 2) l = true ∧ checkAll p (keyPrefix + bitMul) (bitMul * 2) r = truehf:(node val? l r).find? (n + 1) = some val⊢ p (keyPrefix + (n + 1) * bitMul) val = true α:Typep:ℕ → α → Boolval?:Option αl:NatTrie αr:NatTrie αkeyPrefix:ℕbitMul:ℕn:ℕval:αhc:(match val? with | none => true | some v => p keyPrefix v) = true ∧ checkAll p keyPrefix (bitMul * 2) l = true ∧ checkAll p (keyPrefix + bitMul) (bitMul * 2) r = truehf:(if ((n + 1) % 2).beq 0 = true then l.find? ((n + 1) / 2) else r.find? ((n + 1) / 2)) = some val⊢ p (keyPrefix + (n + 1) * bitMul) val = true α:Typep:ℕ → α → Boolval?:Option αl:NatTrie αr:NatTrie αkeyPrefix:ℕbitMul:ℕn:ℕval:αhc:(match val? with | none => true | some v => p keyPrefix v) = true ∧ checkAll p keyPrefix (bitMul * 2) l = true ∧ checkAll p (keyPrefix + bitMul) (bitMul * 2) r = truehf:(if ((n + 1) % 2).beq 0 = true then l.find? ((n + 1) / 2) else r.find? ((n + 1) / 2)) = some valhev:((n + 1) % 2).beq 0 = true⊢ p (keyPrefix + (n + 1) * bitMul) val = trueα:Typep:ℕ → α → Boolval?:Option αl:NatTrie αr:NatTrie αkeyPrefix:ℕbitMul:ℕn:ℕval:αhc:(match val? with | none => true | some v => p keyPrefix v) = true ∧ checkAll p keyPrefix (bitMul * 2) l = true ∧ checkAll p (keyPrefix + bitMul) (bitMul * 2) r = truehf:(if ((n + 1) % 2).beq 0 = true then l.find? ((n + 1) / 2) else r.find? ((n + 1) / 2)) = some valhev:¬((n + 1) % 2).beq 0 = true⊢ p (keyPrefix + (n + 1) * bitMul) val = true α:Typep:ℕ → α → Boolval?:Option αl:NatTrie αr:NatTrie αkeyPrefix:ℕbitMul:ℕn:ℕval:αhc:(match val? with | none => true | some v => p keyPrefix v) = true ∧ checkAll p keyPrefix (bitMul * 2) l = true ∧ checkAll p (keyPrefix + bitMul) (bitMul * 2) r = truehf:(if ((n + 1) % 2).beq 0 = true then l.find? ((n + 1) / 2) else r.find? ((n + 1) / 2)) = some valhev:((n + 1) % 2).beq 0 = true⊢ p (keyPrefix + (n + 1) * bitMul) val = true α:Typep:ℕ → α → Boolval?:Option αl:NatTrie αr:NatTrie αkeyPrefix:ℕbitMul:ℕn:ℕval:αhc:(match val? with | none => true | some v => p keyPrefix v) = true ∧ checkAll p keyPrefix (bitMul * 2) l = true ∧ checkAll p (keyPrefix + bitMul) (bitMul * 2) r = truehev:((n + 1) % 2).beq 0 = truehf:l.find? ((n + 1) / 2) = some val⊢ p (keyPrefix + (n + 1) * bitMul) val = true α:Typep:ℕ → α → Boolval?:Option αl:NatTrie αr:NatTrie αkeyPrefix:ℕbitMul:ℕn:ℕval:αhc:(match val? with | none => true | some v => p keyPrefix v) = true ∧ checkAll p keyPrefix (bitMul * 2) l = true ∧ checkAll p (keyPrefix + bitMul) (bitMul * 2) r = truehev:((n + 1) % 2).beq 0 = truehf:l.find? ((n + 1) / 2) = some valhmod:(n + 1) % 2 = 0⊢ p (keyPrefix + (n + 1) * bitMul) val = true α:Typep:ℕ → α → Boolval?:Option αl:NatTrie αr:NatTrie αkeyPrefix:ℕbitMul:ℕn:ℕval:αhc:(match val? with | none => true | some v => p keyPrefix v) = true ∧ checkAll p keyPrefix (bitMul * 2) l = true ∧ checkAll p (keyPrefix + bitMul) (bitMul * 2) r = truehev:((n + 1) % 2).beq 0 = truehf:l.find? ((n + 1) / 2) = some valhmod:(n + 1) % 2 = 0ih:p (keyPrefix + (n + 1) / 2 * (bitMul * 2)) val = true⊢ p (keyPrefix + (n + 1) * bitMul) val = true α:Typep:ℕ → α → Boolval?:Option αl:NatTrie αr:NatTrie αkeyPrefix:ℕbitMul:ℕn:ℕval:αhc:(match val? with | none => true | some v => p keyPrefix v) = true ∧ checkAll p keyPrefix (bitMul * 2) l = true ∧ checkAll p (keyPrefix + bitMul) (bitMul * 2) r = truehev:((n + 1) % 2).beq 0 = truehf:l.find? ((n + 1) / 2) = some valhmod:(n + 1) % 2 = 0ih:p (keyPrefix + (n + 1) / 2 * (bitMul * 2)) val = truehkey:keyPrefix + (n + 1) / 2 * (bitMul * 2) = keyPrefix + (n + 1) * bitMul⊢ p (keyPrefix + (n + 1) * bitMul) val = true All goals completed! 🐙 α:Typep:ℕ → α → Boolval?:Option αl:NatTrie αr:NatTrie αkeyPrefix:ℕbitMul:ℕn:ℕval:αhc:(match val? with | none => true | some v => p keyPrefix v) = true ∧ checkAll p keyPrefix (bitMul * 2) l = true ∧ checkAll p (keyPrefix + bitMul) (bitMul * 2) r = truehf:(if ((n + 1) % 2).beq 0 = true then l.find? ((n + 1) / 2) else r.find? ((n + 1) / 2)) = some valhev:¬((n + 1) % 2).beq 0 = true⊢ p (keyPrefix + (n + 1) * bitMul) val = true α:Typep:ℕ → α → Boolval?:Option αl:NatTrie αr:NatTrie αkeyPrefix:ℕbitMul:ℕn:ℕval:αhc:(match val? with | none => true | some v => p keyPrefix v) = true ∧ checkAll p keyPrefix (bitMul * 2) l = true ∧ checkAll p (keyPrefix + bitMul) (bitMul * 2) r = truehf:(if ((n + 1) % 2).beq 0 = true then l.find? ((n + 1) / 2) else r.find? ((n + 1) / 2)) = some valhev:¬((n + 1) % 2).beq 0 = truehne:((n + 1) % 2).beq 0 = false⊢ p (keyPrefix + (n + 1) * bitMul) val = true α:Typep:ℕ → α → Boolval?:Option αl:NatTrie αr:NatTrie αkeyPrefix:ℕbitMul:ℕn:ℕval:αhc:(match val? with | none => true | some v => p keyPrefix v) = true ∧ checkAll p keyPrefix (bitMul * 2) l = true ∧ checkAll p (keyPrefix + bitMul) (bitMul * 2) r = truehev:¬((n + 1) % 2).beq 0 = truehne:((n + 1) % 2).beq 0 = falsehf:r.find? ((n + 1) / 2) = some val⊢ p (keyPrefix + (n + 1) * bitMul) val = true α:Typep:ℕ → α → Boolval?:Option αl:NatTrie αr:NatTrie αkeyPrefix:ℕbitMul:ℕn:ℕval:αhc:(match val? with | none => true | some v => p keyPrefix v) = true ∧ checkAll p keyPrefix (bitMul * 2) l = true ∧ checkAll p (keyPrefix + bitMul) (bitMul * 2) r = truehev:¬((n + 1) % 2).beq 0 = truehne:((n + 1) % 2).beq 0 = falsehf:r.find? ((n + 1) / 2) = some valhmod:(n + 1) % 2 = 1⊢ p (keyPrefix + (n + 1) * bitMul) val = true α:Typep:ℕ → α → Boolval?:Option αl:NatTrie αr:NatTrie αkeyPrefix:ℕbitMul:ℕn:ℕval:αhc:(match val? with | none => true | some v => p keyPrefix v) = true ∧ checkAll p keyPrefix (bitMul * 2) l = true ∧ checkAll p (keyPrefix + bitMul) (bitMul * 2) r = truehev:¬((n + 1) % 2).beq 0 = truehne:((n + 1) % 2).beq 0 = falsehf:r.find? ((n + 1) / 2) = some valhmod:(n + 1) % 2 = 1ih:p (keyPrefix + bitMul + (n + 1) / 2 * (bitMul * 2)) val = true⊢ p (keyPrefix + (n + 1) * bitMul) val = true α:Typep:ℕ → α → Boolval?:Option αl:NatTrie αr:NatTrie αkeyPrefix:ℕbitMul:ℕn:ℕval:αhc:(match val? with | none => true | some v => p keyPrefix v) = true ∧ checkAll p keyPrefix (bitMul * 2) l = true ∧ checkAll p (keyPrefix + bitMul) (bitMul * 2) r = truehev:¬((n + 1) % 2).beq 0 = truehne:((n + 1) % 2).beq 0 = falsehf:r.find? ((n + 1) / 2) = some valhmod:(n + 1) % 2 = 1ih:p (keyPrefix + bitMul + (n + 1) / 2 * (bitMul * 2)) val = truehkey:keyPrefix + bitMul + (n + 1) / 2 * (bitMul * 2) = keyPrefix + (n + 1) * bitMul⊢ p (keyPrefix + (n + 1) * bitMul) val = true All goals completed! 🐙

Root-level specialization of checkAll_find?: if checkAll p 0 1 t = true and t.find? n = some val, then p n val = true.

theorem checkAll_sound {α : Type} {p : ℕ → α → Bool} {t : NatTrie α} (hc : checkAll p 0 1 t = true) {n : ℕ} {val : α} (hf : t.find? n = some val) : p n val = true := α:Typep:ℕ → α → Boolt:NatTrie αhc:checkAll p 0 1 t = truen:ℕval:αhf:t.find? n = some val⊢ p n val = true All goals completed! 🐙end NatTrie

Word Repetition, Rotation, Concatenation, and Blank-Tape Identities

section ListIdentitiesvariable {Γ : Type*}

Reversing u ^ n reverses the base word u.

theorem reverse_pow (u : List Γ) (n : ℕ) : (u ^ n).reverse = u.reverse ^ n := Γ:Type u_1u:List Γn:ℕ⊢ (u ^ n).reverse = u.reverse ^ n induction n with Γ:Type u_1u:List Γ⊢ (u ^ 0).reverse = u.reverse ^ 0 All goals completed! 🐙 Γ:Type u_1u:List Γn:ℕih:(u ^ n).reverse = u.reverse ^ n⊢ (u ^ (n + 1)).reverse = u.reverse ^ (n + 1) All goals completed! 🐙

Word-power rotation identity: (u ++ w) ^ n ++ u = u ++ (w ++ u) ^ n.

theorem lpow_rot (u w : List Γ) (n : ℕ) : (u ++ w) ^ n ++ u = u ++ (w ++ u) ^ n := Γ:Type u_1u:List Γw:List Γn:ℕ⊢ (u ++ w) ^ n ++ u = u ++ (w ++ u) ^ n induction n with Γ:Type u_1u:List Γw:List Γ⊢ (u ++ w) ^ 0 ++ u = u ++ (w ++ u) ^ 0 All goals completed! 🐙 Γ:Type u_1u:List Γw:List Γn:ℕih:(u ++ w) ^ n ++ u = u ++ (w ++ u) ^ n⊢ (u ++ w) ^ (n + 1) ++ u = u ++ (w ++ u) ^ (n + 1) Γ:Type u_1u:List Γw:List Γn:ℕih:(u ++ w) ^ n ++ u = u ++ (w ++ u) ^ n⊢ u ++ w ++ (u ++ (w ++ u) ^ n) = u ++ (w ++ u ++ (w ++ u) ^ n) All goals completed! 🐙

Concatenate a list of subword indices left-to-right using baseWord : ℕ → List Γ.

def concatSubwords (baseWord : ℕ → List Γ) : List ℕ → List Γ | [] => [] | s :: ss => baseWord s ++ concatSubwords baseWord ss@[simp] theorem concatSubwords_append (baseWord : ℕ → List Γ) (xs ys : List ℕ) : concatSubwords baseWord (xs ++ ys) = concatSubwords baseWord xs ++ concatSubwords baseWord ys := Γ:Type u_1baseWord:ℕ → List Γxs:List ℕys:List ℕ⊢ concatSubwords baseWord (xs ++ ys) = concatSubwords baseWord xs ++ concatSubwords baseWord ys induction xs with Γ:Type u_1baseWord:ℕ → List Γys:List ℕ⊢ concatSubwords baseWord ([] ++ ys) = concatSubwords baseWord [] ++ concatSubwords baseWord ys All goals completed! 🐙 Γ:Type u_1baseWord:ℕ → List Γys:List ℕx:ℕxs:List ℕih:concatSubwords baseWord (xs ++ ys) = concatSubwords baseWord xs ++ concatSubwords baseWord ys⊢ concatSubwords baseWord (x :: xs ++ ys) = concatSubwords baseWord (x :: xs) ++ concatSubwords baseWord ys All goals completed! 🐙theorem lb_blank_word [Inhabited Γ] (z : List Γ) (hz : ∀ x ∈ z, x = default) : ListBlank.append z default = default := Γ:Type u_1inst✝:Inhabited Γz:List Γhz:∀ x ∈ z, x = default⊢ z +> default = default induction z with Γ:Type u_1inst✝:Inhabited Γhz:∀ x ∈ [], x = default⊢ [] +> default = default All goals completed! 🐙 Γ:Type u_1inst✝:Inhabited Γx:Γz:List Γih:(∀ x ∈ z, x = default) → z +> default = defaulthz:∀ x_1 ∈ x :: z, x_1 = default⊢ (x :: z) +> default = default All goals completed! 🐙theorem lb_blank_pow [Inhabited Γ] (z : List Γ) (hz : ∀ x ∈ z, x = default) (n : ℕ) : ListBlank.append (z ^ n) default = default := Γ:Type u_1inst✝:Inhabited Γz:List Γhz:∀ x ∈ z, x = defaultn:ℕ⊢ z ^ n +> default = default induction n with Γ:Type u_1inst✝:Inhabited Γz:List Γhz:∀ x ∈ z, x = default⊢ z ^ 0 +> default = default All goals completed! 🐙 Γ:Type u_1inst✝:Inhabited Γz:List Γhz:∀ x ∈ z, x = defaultn:ℕih:z ^ n +> default = default⊢ z ^ (n + 1) +> default = default All goals completed! 🐙end ListIdentities

Directed Configurations and Local Word-Exit Semantics

section WordSemanticsvariable {Γ Λ : Type*} [Inhabited Γ] [Inhabited Λ]

Directed machine configuration: Cfg.headRight when dir = true and Cfg.headLeft when dir = false, indexing control states via qOf : ℕ → Λ.

def dirCfg (qOf : ℕ → Λ) (q : ℕ) (dir : Bool) (l r : ListBlank Γ) : Cfg Γ Λ := if dir then Cfg.headRight (qOf q) l r else Cfg.headLeft (qOf q) l r

Agreement between a pure ℕ-indexed transition function stepCode and M : Machine Γ Λ.

def StepCodeAgrees (M : Machine Γ Λ) (qOf : ℕ → Λ) (stepCode : ℕ → Γ → Option (Γ × Bool × ℕ)) : Prop := ∀ q a b dir' q', stepCode q a = some (b, dir', q') → M (qOf q) a = some (some (qOf q'), Stmt.write b (if dir' then Dir.right else Dir.left))

Place spatial word w (written left-to-right) adjacent to the head on side side (true for right half-tape, false for left half-tape where nearest-to-head comes first via w.reverse).

def placeSide (side : Bool) (w : List Γ) (l r : ListBlank Γ) : ListBlank Γ × ListBlank Γ := if side then (l, ListBlank.append w r) else (ListBlank.append w.reverse l, r)

Semantic specification of a local finite-word exit: entering spatial word u in state q moving in direction dir exits in dt steps leaving spatial word v behind the head in state q' moving in direction dir', for arbitrary surrounding half-tapes l and r.

def WordExit (M : Machine Γ Λ) (qOf : ℕ → Λ) (u : List Γ) (q : ℕ) (dir : Bool) (v : List Γ) (q' : ℕ) (dir' : Bool) (dt : ℕ) : Prop := ∀ l r : ListBlank Γ, let (l₁, r₁) := placeSide dir u l r let (l₂, r₂) := placeSide (!dir') v l r ReachesIn M dt (dirCfg qOf q dir l₁ r₁) (dirCfg qOf q' dir' l₂ r₂)

Local symbol-level finite-word zipper simulator.

def simWord (stepCode : ℕ → Γ → Option (Γ × Bool × ℕ)) : ℕ → ℕ → Bool → List Γ → List Γ → ℕ → Option (List Γ × ℕ × Bool × ℕ) | 0, _, _, _, _, _ => none | _ + 1, q, true, lw, [], dt => withNat q fun q' ↦ withNat dt fun d ↦ some (lw.reverse, q', true, d) | fuel + 1, q, true, lw, a :: rw, dt => match stepCode q a with | none => none | some (b, true, q') => withNat (dt + 1) fun dt' ↦ simWord stepCode fuel q' true (b :: lw) rw dt' | some (b, false, q') => withNat (dt + 1) fun dt' ↦ simWord stepCode fuel q' false lw (b :: rw) dt' | _ + 1, q, false, [], rw, dt => withNat q fun q' ↦ withNat dt fun d ↦ some (rw, q', false, d) | fuel + 1, q, false, a :: lw, rw, dt => match stepCode q a with | none => none | some (b, true, q') => withNat (dt + 1) fun dt' ↦ simWord stepCode fuel q' true (b :: lw) rw dt' | some (b, false, q') => withNat (dt + 1) fun dt' ↦ simWord stepCode fuel q' false lw (b :: rw) dt'

Run simWord on spatial word u from state q and entry direction dir.

def runWordExit (stepCode : ℕ → Γ → Option (Γ × Bool × ℕ)) (fuel : ℕ) (u : List Γ) (q : ℕ) (dir : Bool) : Option (List Γ × ℕ × Bool × ℕ) := if dir then simWord stepCode fuel q true [] u 0 else simWord stepCode fuel q false u.reverse [] 0private theorem simWord_sound_aux {M : Machine Γ Λ} {qOf : ℕ → Λ} {stepCode : ℕ → Γ → Option (Γ × Bool × ℕ)} (hag : StepCodeAgrees M qOf stepCode) : ∀ (fuel q : ℕ) (dir : Bool) (lw rw : List Γ) (dt : ℕ) (v : List Γ) (q' : ℕ) (dir' : Bool) (dtOut : ℕ) (l r : ListBlank Γ), simWord stepCode fuel q dir lw rw dt = some (v, q', dir', dtOut) → dt ≤ dtOut ∧ let (l₂, r₂) := placeSide (!dir') v l r ReachesIn M (dtOut - dt) (dirCfg qOf q dir (ListBlank.append lw l) (ListBlank.append rw r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodex✝¹⁰:ℕx✝⁹:Boolx✝⁸:List Γx✝⁷:List Γx✝⁶:ℕx✝⁵:List Γx✝⁴:ℕx✝³:Boolx✝²:ℕx✝¹:ListBlank Γx✝:ListBlank Γh:simWord stepCode 0 x✝¹⁰ x✝⁹ x✝⁸ x✝⁷ x✝⁶ = some (x✝⁵, x✝⁴, x✝³, x✝²)⊢ x✝⁶ ≤ x✝² ∧ match placeSide (!x✝³) x✝⁵ x✝¹ x✝ with | (l₂, r₂) => ReachesIn M (x✝² - x✝⁶) (dirCfg qOf x✝¹⁰ x✝⁹ (x✝⁸ +> x✝¹) (x✝⁷ +> x✝)) (dirCfg qOf x✝⁴ x✝³ l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodex✝¹⁰:ℕx✝⁹:Boolx✝⁸:List Γx✝⁷:List Γx✝⁶:ℕx✝⁵:List Γx✝⁴:ℕx✝³:Boolx✝²:ℕx✝¹:ListBlank Γx✝:ListBlank Γh:simWord stepCode 0 x✝¹⁰ x✝⁹ x✝⁸ x✝⁷ x✝⁶ = some (x✝⁵, x✝⁴, x✝³, x✝²)⊢ x✝⁶ ≤ x✝² ∧ match placeSide (!x✝³) x✝⁵ x✝¹ x✝ with | (l₂, r₂) => ReachesIn M (x✝² - x✝⁶) (dirCfg qOf x✝¹⁰ x✝⁹ (x✝⁸ +> x✝¹) (x✝⁷ +> x✝)) (dirCfg qOf x✝⁴ x✝³ l₂ r₂) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCoden✝:ℕq:ℕlw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:simWord stepCode (n✝ + 1) q true lw [] dt = some (v, q', dir', dtOut)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (lw +> l) ([] +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCoden✝:ℕq:ℕlw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:simWord stepCode (n✝ + 1) q true lw [] dt = some (v, q', dir', dtOut)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (lw +> l) ([] +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCoden✝:ℕq:ℕlw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:lw.reverse = v ∧ q = q' ∧ true = dir' ∧ dt = dtOut⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (lw +> l) ([] +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCoden✝:ℕq:ℕlw:List Γdt:ℕl:ListBlank Γr:ListBlank Γ⊢ dt ≤ dt ∧ match placeSide (!true) lw.reverse l r with | (l₂, r₂) => ReachesIn M (dt - dt) (dirCfg qOf q true (lw +> l) ([] +> r)) (dirCfg qOf q true l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCoden✝:ℕq:ℕlw:List Γdt:ℕl:ListBlank Γr:ListBlank Γ⊢ match placeSide (!true) lw.reverse l r with | (l₂, r₂) => ReachesIn M (dt - dt) (dirCfg qOf q true (lw +> l) ([] +> r)) (dirCfg qOf q true l₂ r₂) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕlw:List Γa:Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:simWord stepCode (fuel + 1) q true lw (a :: rw) dt = some (v, q', dir', dtOut)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (lw +> l) ((a :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕlw:List Γa:Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:simWord stepCode (fuel + 1) q true lw (a :: rw) dt = some (v, q', dir', dtOut)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (lw +> l) ((a :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕlw:List Γa:Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:(match stepCode q a with | none => none | some (b, true, q') => simWord stepCode fuel q' true (b :: lw) rw (dt + 1) | some (b, false, q') => simWord stepCode fuel q' false lw (b :: rw) (dt + 1)) = some (v, q', dir', dtOut)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (lw +> l) ((a :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕlw:List Γa:Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:(match stepCode q a with | none => none | some (b, true, q') => simWord stepCode fuel q' true (b :: lw) rw (dt + 1) | some (b, false, q') => simWord stepCode fuel q' false lw (b :: rw) (dt + 1)) = some (v, q', dir', dtOut)hsc:stepCode q a = none⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (lw +> l) ((a :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂)Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕlw:List Γa:Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:(match stepCode q a with | none => none | some (b, true, q') => simWord stepCode fuel q' true (b :: lw) rw (dt + 1) | some (b, false, q') => simWord stepCode fuel q' false lw (b :: rw) (dt + 1)) = some (v, q', dir', dtOut)b:ΓdNext:BoolqNext:ℕhsc:stepCode q a = some (b, dNext, qNext)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (lw +> l) ((a :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕlw:List Γa:Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:(match stepCode q a with | none => none | some (b, true, q') => simWord stepCode fuel q' true (b :: lw) rw (dt + 1) | some (b, false, q') => simWord stepCode fuel q' false lw (b :: rw) (dt + 1)) = some (v, q', dir', dtOut)hsc:stepCode q a = none⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (lw +> l) ((a :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕlw:List Γa:Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:(match stepCode q a with | none => none | some (b, true, q') => simWord stepCode fuel q' true (b :: lw) rw (dt + 1) | some (b, false, q') => simWord stepCode fuel q' false lw (b :: rw) (dt + 1)) = some (v, q', dir', dtOut)b:ΓdNext:BoolqNext:ℕhsc:stepCode q a = some (b, dNext, qNext)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (lw +> l) ((a :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕlw:List Γa:Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓdNext:BoolqNext:ℕh:(match some (b, dNext, qNext) with | none => none | some (b, true, q') => simWord stepCode fuel q' true (b :: lw) rw (dt + 1) | some (b, false, q') => simWord stepCode fuel q' false lw (b :: rw) (dt + 1)) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, dNext, qNext)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (lw +> l) ((a :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕlw:List Γa:Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:(match some (b, false, qNext) with | none => none | some (b, true, q') => simWord stepCode fuel q' true (b :: lw) rw (dt + 1) | some (b, false, q') => simWord stepCode fuel q' false lw (b :: rw) (dt + 1)) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, false, qNext)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (lw +> l) ((a :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂)Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕlw:List Γa:Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:(match some (b, true, qNext) with | none => none | some (b, true, q') => simWord stepCode fuel q' true (b :: lw) rw (dt + 1) | some (b, false, q') => simWord stepCode fuel q' false lw (b :: rw) (dt + 1)) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, true, qNext)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (lw +> l) ((a :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕlw:List Γa:Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:(match some (b, false, qNext) with | none => none | some (b, true, q') => simWord stepCode fuel q' true (b :: lw) rw (dt + 1) | some (b, false, q') => simWord stepCode fuel q' false lw (b :: rw) (dt + 1)) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, false, qNext)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (lw +> l) ((a :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕlw:List Γa:Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:simWord stepCode fuel qNext false lw (b :: rw) (dt + 1) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, false, qNext)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (lw +> l) ((a :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕlw:List Γa:Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:simWord stepCode fuel qNext false lw (b :: rw) (dt + 1) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, false, qNext)hle:dt + 1 ≤ dtOuthreach:match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + 1)) (dirCfg qOf qNext false (lw +> l) ((b :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (lw +> l) ((a :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕlw:List Γa:Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:simWord stepCode fuel qNext false lw (b :: rw) (dt + 1) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, false, qNext)hle:dt + 1 ≤ dtOuthreach:match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + 1)) (dirCfg qOf qNext false (lw +> l) ((b :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂)hstep:Cfg.headRight (qOf q) (lw +> l) (a >> rw +> r) [M]⊢ Cfg.headLeft (qOf qNext) (lw +> l) (b >> rw +> r)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (lw +> l) ((a :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂) refine ⟨Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕlw:List Γa:Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:simWord stepCode fuel qNext false lw (b :: rw) (dt + 1) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, false, qNext)hle:dt + 1 ≤ dtOuthreach:match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + 1)) (dirCfg qOf qNext false (lw +> l) ((b :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂)hstep:Cfg.headRight (qOf q) (lw +> l) (a >> rw +> r) [M]⊢ Cfg.headLeft (qOf qNext) (lw +> l) (b >> rw +> r)⊢ dt ≤ dtOut All goals completed! 🐙, ?_⟩ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕlw:List Γa:Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:simWord stepCode fuel qNext false lw (b :: rw) (dt + 1) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, false, qNext)hle:dt + 1 ≤ dtOuthreach:match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + 1)) (dirCfg qOf qNext false (lw +> l) ((b :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂)hstep:Cfg.headRight (qOf q) (lw +> l) (a >> rw +> r) [M]⊢ Cfg.headLeft (qOf qNext) (lw +> l) (b >> rw +> r)hsub:dtOut - dt = dtOut - (dt + 1) + 1⊢ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (lw +> l) ((a :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕlw:List Γa:Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:simWord stepCode fuel qNext false lw (b :: rw) (dt + 1) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, false, qNext)hle:dt + 1 ≤ dtOuthreach:match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + 1)) (dirCfg qOf qNext false (lw +> l) ((b :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂)hstep:Cfg.headRight (qOf q) (lw +> l) (a >> rw +> r) [M]⊢ Cfg.headLeft (qOf qNext) (lw +> l) (b >> rw +> r)hsub:dtOut - dt = dtOut - (dt + 1) + 1⊢ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + 1) + 1) (dirCfg qOf q true (lw +> l) ((a :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕlw:List Γa:Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:(match some (b, true, qNext) with | none => none | some (b, true, q') => simWord stepCode fuel q' true (b :: lw) rw (dt + 1) | some (b, false, q') => simWord stepCode fuel q' false lw (b :: rw) (dt + 1)) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, true, qNext)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (lw +> l) ((a :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕlw:List Γa:Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:simWord stepCode fuel qNext true (b :: lw) rw (dt + 1) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, true, qNext)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (lw +> l) ((a :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕlw:List Γa:Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:simWord stepCode fuel qNext true (b :: lw) rw (dt + 1) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, true, qNext)hle:dt + 1 ≤ dtOuthreach:match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + 1)) (dirCfg qOf qNext true ((b :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (lw +> l) ((a :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕlw:List Γa:Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:simWord stepCode fuel qNext true (b :: lw) rw (dt + 1) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, true, qNext)hle:dt + 1 ≤ dtOuthreach:match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + 1)) (dirCfg qOf qNext true ((b :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂)hstep:Cfg.headRight (qOf q) (lw +> l) (a >> rw +> r) [M]⊢ Cfg.headRight (qOf qNext) (b >> lw +> l) (rw +> r)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (lw +> l) ((a :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂) refine ⟨Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕlw:List Γa:Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:simWord stepCode fuel qNext true (b :: lw) rw (dt + 1) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, true, qNext)hle:dt + 1 ≤ dtOuthreach:match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + 1)) (dirCfg qOf qNext true ((b :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂)hstep:Cfg.headRight (qOf q) (lw +> l) (a >> rw +> r) [M]⊢ Cfg.headRight (qOf qNext) (b >> lw +> l) (rw +> r)⊢ dt ≤ dtOut All goals completed! 🐙, ?_⟩ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕlw:List Γa:Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:simWord stepCode fuel qNext true (b :: lw) rw (dt + 1) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, true, qNext)hle:dt + 1 ≤ dtOuthreach:match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + 1)) (dirCfg qOf qNext true ((b :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂)hstep:Cfg.headRight (qOf q) (lw +> l) (a >> rw +> r) [M]⊢ Cfg.headRight (qOf qNext) (b >> lw +> l) (rw +> r)hsub:dtOut - dt = dtOut - (dt + 1) + 1⊢ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (lw +> l) ((a :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕlw:List Γa:Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:simWord stepCode fuel qNext true (b :: lw) rw (dt + 1) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, true, qNext)hle:dt + 1 ≤ dtOuthreach:match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + 1)) (dirCfg qOf qNext true ((b :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂)hstep:Cfg.headRight (qOf q) (lw +> l) (a >> rw +> r) [M]⊢ Cfg.headRight (qOf qNext) (b >> lw +> l) (rw +> r)hsub:dtOut - dt = dtOut - (dt + 1) + 1⊢ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + 1) + 1) (dirCfg qOf q true (lw +> l) ((a :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCoden✝:ℕq:ℕrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:simWord stepCode (n✝ + 1) q false [] rw dt = some (v, q', dir', dtOut)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false ([] +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCoden✝:ℕq:ℕrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:simWord stepCode (n✝ + 1) q false [] rw dt = some (v, q', dir', dtOut)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false ([] +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCoden✝:ℕq:ℕrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:rw = v ∧ q = q' ∧ false = dir' ∧ dt = dtOut⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false ([] +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCoden✝:ℕq:ℕrw:List Γdt:ℕl:ListBlank Γr:ListBlank Γ⊢ dt ≤ dt ∧ match placeSide (!false) rw l r with | (l₂, r₂) => ReachesIn M (dt - dt) (dirCfg qOf q false ([] +> l) (rw +> r)) (dirCfg qOf q false l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCoden✝:ℕq:ℕrw:List Γdt:ℕl:ListBlank Γr:ListBlank Γ⊢ match placeSide (!false) rw l r with | (l₂, r₂) => ReachesIn M (dt - dt) (dirCfg qOf q false ([] +> l) (rw +> r)) (dirCfg qOf q false l₂ r₂) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕa:Γlw:List Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:simWord stepCode (fuel + 1) q false (a :: lw) rw dt = some (v, q', dir', dtOut)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false ((a :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕa:Γlw:List Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:simWord stepCode (fuel + 1) q false (a :: lw) rw dt = some (v, q', dir', dtOut)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false ((a :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕa:Γlw:List Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:(match stepCode q a with | none => none | some (b, true, q') => simWord stepCode fuel q' true (b :: lw) rw (dt + 1) | some (b, false, q') => simWord stepCode fuel q' false lw (b :: rw) (dt + 1)) = some (v, q', dir', dtOut)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false ((a :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕa:Γlw:List Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:(match stepCode q a with | none => none | some (b, true, q') => simWord stepCode fuel q' true (b :: lw) rw (dt + 1) | some (b, false, q') => simWord stepCode fuel q' false lw (b :: rw) (dt + 1)) = some (v, q', dir', dtOut)hsc:stepCode q a = none⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false ((a :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂)Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕa:Γlw:List Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:(match stepCode q a with | none => none | some (b, true, q') => simWord stepCode fuel q' true (b :: lw) rw (dt + 1) | some (b, false, q') => simWord stepCode fuel q' false lw (b :: rw) (dt + 1)) = some (v, q', dir', dtOut)b:ΓdNext:BoolqNext:ℕhsc:stepCode q a = some (b, dNext, qNext)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false ((a :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕa:Γlw:List Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:(match stepCode q a with | none => none | some (b, true, q') => simWord stepCode fuel q' true (b :: lw) rw (dt + 1) | some (b, false, q') => simWord stepCode fuel q' false lw (b :: rw) (dt + 1)) = some (v, q', dir', dtOut)hsc:stepCode q a = none⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false ((a :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕa:Γlw:List Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:(match stepCode q a with | none => none | some (b, true, q') => simWord stepCode fuel q' true (b :: lw) rw (dt + 1) | some (b, false, q') => simWord stepCode fuel q' false lw (b :: rw) (dt + 1)) = some (v, q', dir', dtOut)b:ΓdNext:BoolqNext:ℕhsc:stepCode q a = some (b, dNext, qNext)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false ((a :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕa:Γlw:List Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓdNext:BoolqNext:ℕh:(match some (b, dNext, qNext) with | none => none | some (b, true, q') => simWord stepCode fuel q' true (b :: lw) rw (dt + 1) | some (b, false, q') => simWord stepCode fuel q' false lw (b :: rw) (dt + 1)) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, dNext, qNext)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false ((a :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕa:Γlw:List Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:(match some (b, false, qNext) with | none => none | some (b, true, q') => simWord stepCode fuel q' true (b :: lw) rw (dt + 1) | some (b, false, q') => simWord stepCode fuel q' false lw (b :: rw) (dt + 1)) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, false, qNext)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false ((a :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂)Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕa:Γlw:List Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:(match some (b, true, qNext) with | none => none | some (b, true, q') => simWord stepCode fuel q' true (b :: lw) rw (dt + 1) | some (b, false, q') => simWord stepCode fuel q' false lw (b :: rw) (dt + 1)) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, true, qNext)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false ((a :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕa:Γlw:List Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:(match some (b, false, qNext) with | none => none | some (b, true, q') => simWord stepCode fuel q' true (b :: lw) rw (dt + 1) | some (b, false, q') => simWord stepCode fuel q' false lw (b :: rw) (dt + 1)) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, false, qNext)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false ((a :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕa:Γlw:List Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:simWord stepCode fuel qNext false lw (b :: rw) (dt + 1) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, false, qNext)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false ((a :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕa:Γlw:List Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:simWord stepCode fuel qNext false lw (b :: rw) (dt + 1) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, false, qNext)hle:dt + 1 ≤ dtOuthreach:match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + 1)) (dirCfg qOf qNext false (lw +> l) ((b :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false ((a :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕa:Γlw:List Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:simWord stepCode fuel qNext false lw (b :: rw) (dt + 1) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, false, qNext)hle:dt + 1 ≤ dtOuthreach:match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + 1)) (dirCfg qOf qNext false (lw +> l) ((b :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂)hstep:Cfg.headLeft (qOf q) (a >> lw +> l) (rw +> r) [M]⊢ Cfg.headLeft (qOf qNext) (lw +> l) (b >> rw +> r)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false ((a :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂) refine ⟨Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕa:Γlw:List Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:simWord stepCode fuel qNext false lw (b :: rw) (dt + 1) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, false, qNext)hle:dt + 1 ≤ dtOuthreach:match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + 1)) (dirCfg qOf qNext false (lw +> l) ((b :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂)hstep:Cfg.headLeft (qOf q) (a >> lw +> l) (rw +> r) [M]⊢ Cfg.headLeft (qOf qNext) (lw +> l) (b >> rw +> r)⊢ dt ≤ dtOut All goals completed! 🐙, ?_⟩ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕa:Γlw:List Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:simWord stepCode fuel qNext false lw (b :: rw) (dt + 1) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, false, qNext)hle:dt + 1 ≤ dtOuthreach:match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + 1)) (dirCfg qOf qNext false (lw +> l) ((b :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂)hstep:Cfg.headLeft (qOf q) (a >> lw +> l) (rw +> r) [M]⊢ Cfg.headLeft (qOf qNext) (lw +> l) (b >> rw +> r)hsub:dtOut - dt = dtOut - (dt + 1) + 1⊢ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false ((a :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕa:Γlw:List Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:simWord stepCode fuel qNext false lw (b :: rw) (dt + 1) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, false, qNext)hle:dt + 1 ≤ dtOuthreach:match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + 1)) (dirCfg qOf qNext false (lw +> l) ((b :: rw) +> r)) (dirCfg qOf q' dir' l₂ r₂)hstep:Cfg.headLeft (qOf q) (a >> lw +> l) (rw +> r) [M]⊢ Cfg.headLeft (qOf qNext) (lw +> l) (b >> rw +> r)hsub:dtOut - dt = dtOut - (dt + 1) + 1⊢ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + 1) + 1) (dirCfg qOf q false ((a :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕa:Γlw:List Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:(match some (b, true, qNext) with | none => none | some (b, true, q') => simWord stepCode fuel q' true (b :: lw) rw (dt + 1) | some (b, false, q') => simWord stepCode fuel q' false lw (b :: rw) (dt + 1)) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, true, qNext)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false ((a :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕa:Γlw:List Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:simWord stepCode fuel qNext true (b :: lw) rw (dt + 1) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, true, qNext)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false ((a :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕa:Γlw:List Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:simWord stepCode fuel qNext true (b :: lw) rw (dt + 1) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, true, qNext)hle:dt + 1 ≤ dtOuthreach:match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + 1)) (dirCfg qOf qNext true ((b :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false ((a :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕa:Γlw:List Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:simWord stepCode fuel qNext true (b :: lw) rw (dt + 1) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, true, qNext)hle:dt + 1 ≤ dtOuthreach:match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + 1)) (dirCfg qOf qNext true ((b :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂)hstep:Cfg.headLeft (qOf q) (a >> lw +> l) (rw +> r) [M]⊢ Cfg.headRight (qOf qNext) (b >> lw +> l) (rw +> r)⊢ dt ≤ dtOut ∧ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false ((a :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂) refine ⟨Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕa:Γlw:List Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:simWord stepCode fuel qNext true (b :: lw) rw (dt + 1) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, true, qNext)hle:dt + 1 ≤ dtOuthreach:match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + 1)) (dirCfg qOf qNext true ((b :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂)hstep:Cfg.headLeft (qOf q) (a >> lw +> l) (rw +> r) [M]⊢ Cfg.headRight (qOf qNext) (b >> lw +> l) (rw +> r)⊢ dt ≤ dtOut All goals completed! 🐙, ?_⟩ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕa:Γlw:List Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:simWord stepCode fuel qNext true (b :: lw) rw (dt + 1) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, true, qNext)hle:dt + 1 ≤ dtOuthreach:match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + 1)) (dirCfg qOf qNext true ((b :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂)hstep:Cfg.headLeft (qOf q) (a >> lw +> l) (rw +> r) [M]⊢ Cfg.headRight (qOf qNext) (b >> lw +> l) (rw +> r)hsub:dtOut - dt = dtOut - (dt + 1) + 1⊢ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false ((a :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕq:ℕa:Γlw:List Γrw:List Γdt:ℕv:List Γq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γb:ΓqNext:ℕh:simWord stepCode fuel qNext true (b :: lw) rw (dt + 1) = some (v, q', dir', dtOut)hsc:stepCode q a = some (b, true, qNext)hle:dt + 1 ≤ dtOuthreach:match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + 1)) (dirCfg qOf qNext true ((b :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂)hstep:Cfg.headLeft (qOf q) (a >> lw +> l) (rw +> r) [M]⊢ Cfg.headRight (qOf qNext) (b >> lw +> l) (rw +> r)hsub:dtOut - dt = dtOut - (dt + 1) + 1⊢ match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + 1) + 1) (dirCfg qOf q false ((a :: lw) +> l) (rw +> r)) (dirCfg qOf q' dir' l₂ r₂) All goals completed! 🐙

Soundness of runWordExit: a successful finite-word zipper run establishes WordExit.

theorem runWordExit_sound {M : Machine Γ Λ} {qOf : ℕ → Λ} {stepCode : ℕ → Γ → Option (Γ × Bool × ℕ)} (hag : StepCodeAgrees M qOf stepCode) {fuel : ℕ} {u : List Γ} {q : ℕ} {dir : Bool} {v : List Γ} {q' : ℕ} {dir' : Bool} {dt : ℕ} (h : runWordExit stepCode fuel u q dir = some (v, q', dir', dt)) : WordExit M qOf u q dir v q' dir' dt := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕu:List Γq:ℕdir:Boolv:List Γq':ℕdir':Booldt:ℕh:runWordExit stepCode fuel u q dir = some (v, q', dir', dt)⊢ WordExit M qOf u q dir v q' dir' dt Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕu:List Γq:ℕdir:Boolv:List Γq':ℕdir':Booldt:ℕh:runWordExit stepCode fuel u q dir = some (v, q', dir', dt)l:ListBlank Γr:ListBlank Γ⊢ match placeSide dir u l r with | (l₁, r₁) => match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M dt (dirCfg qOf q dir l₁ r₁) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕu:List Γq:ℕdir:Boolv:List Γq':ℕdir':Booldt:ℕh:(if dir = true then simWord stepCode fuel q true [] u 0 else simWord stepCode fuel q false u.reverse [] 0) = some (v, q', dir', dt)l:ListBlank Γr:ListBlank Γ⊢ match placeSide dir u l r with | (l₁, r₁) => match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M dt (dirCfg qOf q dir l₁ r₁) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕu:List Γq:ℕv:List Γq':ℕdir':Booldt:ℕl:ListBlank Γr:ListBlank Γh:(if false = true then simWord stepCode fuel q true [] u 0 else simWord stepCode fuel q false u.reverse [] 0) = some (v, q', dir', dt)⊢ match placeSide false u l r with | (l₁, r₁) => match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M dt (dirCfg qOf q false l₁ r₁) (dirCfg qOf q' dir' l₂ r₂)Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕu:List Γq:ℕv:List Γq':ℕdir':Booldt:ℕl:ListBlank Γr:ListBlank Γh:(if true = true then simWord stepCode fuel q true [] u 0 else simWord stepCode fuel q false u.reverse [] 0) = some (v, q', dir', dt)⊢ match placeSide true u l r with | (l₁, r₁) => match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M dt (dirCfg qOf q true l₁ r₁) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕu:List Γq:ℕv:List Γq':ℕdir':Booldt:ℕl:ListBlank Γr:ListBlank Γh:(if false = true then simWord stepCode fuel q true [] u 0 else simWord stepCode fuel q false u.reverse [] 0) = some (v, q', dir', dt)⊢ match placeSide false u l r with | (l₁, r₁) => match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M dt (dirCfg qOf q false l₁ r₁) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕu:List Γq:ℕv:List Γq':ℕdir':Booldt:ℕl:ListBlank Γr:ListBlank Γh:simWord stepCode fuel q false u.reverse [] 0 = some (v, q', dir', dt)⊢ match placeSide false u l r with | (l₁, r₁) => match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M dt (dirCfg qOf q false l₁ r₁) (dirCfg qOf q' dir' l₂ r₂) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕu:List Γq:ℕv:List Γq':ℕdir':Booldt:ℕl:ListBlank Γr:ListBlank Γh:(if true = true then simWord stepCode fuel q true [] u 0 else simWord stepCode fuel q false u.reverse [] 0) = some (v, q', dir', dt)⊢ match placeSide true u l r with | (l₁, r₁) => match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M dt (dirCfg qOf q true l₁ r₁) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛstepCode:ℕ → Γ → Option (Γ × Bool × ℕ)hag:StepCodeAgrees M qOf stepCodefuel:ℕu:List Γq:ℕv:List Γq':ℕdir':Booldt:ℕl:ListBlank Γr:ListBlank Γh:simWord stepCode fuel q true [] u 0 = some (v, q', dir', dt)⊢ match placeSide true u l r with | (l₁, r₁) => match placeSide (!dir') v l r with | (l₂, r₂) => ReachesIn M dt (dirCfg qOf q true l₁ r₁) (dirCfg qOf q' dir' l₂ r₂) All goals completed! 🐙

Homogeneous k-copy sweep: if (u, q, dir) exits in the same state and direction (q, dir) leaving v in dt steps, then u ^ k exits in (q, dir) leaving v ^ k in dt * k steps.

theorem sweepWord_sound {M : Machine Γ Λ} {qOf : ℕ → Λ} {u v : List Γ} {q : ℕ} {dir : Bool} {dt : ℕ} (hex : WordExit M qOf u q dir v q dir dt) (k : ℕ) : WordExit M qOf (u ^ k) q dir (v ^ k) q dir (dt * k) := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdir:Booldt:ℕhex:WordExit M qOf u q dir v q dir dtk:ℕ⊢ WordExit M qOf (u ^ k) q dir (v ^ k) q dir (dt * k) induction k with Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdir:Booldt:ℕhex:WordExit M qOf u q dir v q dir dt⊢ WordExit M qOf (u ^ 0) q dir (v ^ 0) q dir (dt * 0) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdir:Booldt:ℕhex:WordExit M qOf u q dir v q dir dtl:ListBlank Γr:ListBlank Γ⊢ match placeSide dir (u ^ 0) l r with | (l₁, r₁) => match placeSide (!dir) (v ^ 0) l r with | (l₂, r₂) => ReachesIn M (dt * 0) (dirCfg qOf q dir l₁ r₁) (dirCfg qOf q dir l₂ r₂) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdir:Booldt:ℕhex:WordExit M qOf u q dir v q dir dtk:ℕih:WordExit M qOf (u ^ k) q dir (v ^ k) q dir (dt * k)⊢ WordExit M qOf (u ^ (k + 1)) q dir (v ^ (k + 1)) q dir (dt * (k + 1)) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdir:Booldt:ℕhex:WordExit M qOf u q dir v q dir dtk:ℕih:WordExit M qOf (u ^ k) q dir (v ^ k) q dir (dt * k)l:ListBlank Γr:ListBlank Γ⊢ match placeSide dir (u ^ (k + 1)) l r with | (l₁, r₁) => match placeSide (!dir) (v ^ (k + 1)) l r with | (l₂, r₂) => ReachesIn M (dt * (k + 1)) (dirCfg qOf q dir l₁ r₁) (dirCfg qOf q dir l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdt:ℕk:ℕl:ListBlank Γr:ListBlank Γhex:WordExit M qOf u q false v q false dtih:WordExit M qOf (u ^ k) q false (v ^ k) q false (dt * k)⊢ match placeSide false (u ^ (k + 1)) l r with | (l₁, r₁) => match placeSide (!false) (v ^ (k + 1)) l r with | (l₂, r₂) => ReachesIn M (dt * (k + 1)) (dirCfg qOf q false l₁ r₁) (dirCfg qOf q false l₂ r₂)Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdt:ℕk:ℕl:ListBlank Γr:ListBlank Γhex:WordExit M qOf u q true v q true dtih:WordExit M qOf (u ^ k) q true (v ^ k) q true (dt * k)⊢ match placeSide true (u ^ (k + 1)) l r with | (l₁, r₁) => match placeSide (!true) (v ^ (k + 1)) l r with | (l₂, r₂) => ReachesIn M (dt * (k + 1)) (dirCfg qOf q true l₁ r₁) (dirCfg qOf q true l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdt:ℕk:ℕl:ListBlank Γr:ListBlank Γhex:WordExit M qOf u q false v q false dtih:WordExit M qOf (u ^ k) q false (v ^ k) q false (dt * k)⊢ match placeSide false (u ^ (k + 1)) l r with | (l₁, r₁) => match placeSide (!false) (v ^ (k + 1)) l r with | (l₂, r₂) => ReachesIn M (dt * (k + 1)) (dirCfg qOf q false l₁ r₁) (dirCfg qOf q false l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdt:ℕk:ℕl:ListBlank Γr:ListBlank Γhex:WordExit M qOf u q false v q false dtih:WordExit M qOf (u ^ k) q false (v ^ k) q false (dt * k)⊢ ReachesIn M (dt * (k + 1)) (dirCfg qOf q false ((u ^ (k + 1)).reverse +> l) r) (dirCfg qOf q false l (v ^ (k + 1) +> r)) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdt:ℕk:ℕl:ListBlank Γr:ListBlank Γhex:WordExit M qOf u q false v q false dtih:WordExit M qOf (u ^ k) q false (v ^ k) q false (dt * k)⊢ ReachesIn M (dt * (k + 1)) (dirCfg qOf q false (u.reverse +> (u ^ k).reverse +> l) r) (dirCfg qOf q false l (v ^ k +> v +> r)) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdt:ℕk:ℕl:ListBlank Γr:ListBlank Γhex:WordExit M qOf u q false v q false dtih:WordExit M qOf (u ^ k) q false (v ^ k) q false (dt * k)h1:match placeSide false u ((u ^ k).reverse +> l) r with | (l₁, r₁) => match placeSide (!false) v ((u ^ k).reverse +> l) r with | (l₂, r₂) => ReachesIn M dt (dirCfg qOf q false l₁ r₁) (dirCfg qOf q false l₂ r₂)⊢ ReachesIn M (dt * (k + 1)) (dirCfg qOf q false (u.reverse +> (u ^ k).reverse +> l) r) (dirCfg qOf q false l (v ^ k +> v +> r)) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdt:ℕk:ℕl:ListBlank Γr:ListBlank Γhex:WordExit M qOf u q false v q false dtih:WordExit M qOf (u ^ k) q false (v ^ k) q false (dt * k)h1:ReachesIn M dt (dirCfg qOf q false (u.reverse +> (u ^ k).reverse +> l) r) (dirCfg qOf q false ((u ^ k).reverse +> l) (v +> r))⊢ ReachesIn M (dt * (k + 1)) (dirCfg qOf q false (u.reverse +> (u ^ k).reverse +> l) r) (dirCfg qOf q false l (v ^ k +> v +> r)) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdt:ℕk:ℕl:ListBlank Γr:ListBlank Γhex:WordExit M qOf u q false v q false dtih:WordExit M qOf (u ^ k) q false (v ^ k) q false (dt * k)h1:ReachesIn M dt (dirCfg qOf q false (u.reverse +> (u ^ k).reverse +> l) r) (dirCfg qOf q false ((u ^ k).reverse +> l) (v +> r))h2:match placeSide false (u ^ k) l (v +> r) with | (l₁, r₁) => match placeSide (!false) (v ^ k) l (v +> r) with | (l₂, r₂) => ReachesIn M (dt * k) (dirCfg qOf q false l₁ r₁) (dirCfg qOf q false l₂ r₂)⊢ ReachesIn M (dt * (k + 1)) (dirCfg qOf q false (u.reverse +> (u ^ k).reverse +> l) r) (dirCfg qOf q false l (v ^ k +> v +> r)) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdt:ℕk:ℕl:ListBlank Γr:ListBlank Γhex:WordExit M qOf u q false v q false dtih:WordExit M qOf (u ^ k) q false (v ^ k) q false (dt * k)h1:ReachesIn M dt (dirCfg qOf q false (u.reverse +> (u ^ k).reverse +> l) r) (dirCfg qOf q false ((u ^ k).reverse +> l) (v +> r))h2:ReachesIn M (dt * k) (dirCfg qOf q false ((u ^ k).reverse +> l) (v +> r)) (dirCfg qOf q false l (v ^ k +> v +> r))⊢ ReachesIn M (dt * (k + 1)) (dirCfg qOf q false (u.reverse +> (u ^ k).reverse +> l) r) (dirCfg qOf q false l (v ^ k +> v +> r)) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdt:ℕk:ℕl:ListBlank Γr:ListBlank Γhex:WordExit M qOf u q false v q false dtih:WordExit M qOf (u ^ k) q false (v ^ k) q false (dt * k)h1:ReachesIn M dt (dirCfg qOf q false (u.reverse +> (u ^ k).reverse +> l) r) (dirCfg qOf q false ((u ^ k).reverse +> l) (v +> r))h2:ReachesIn M (dt * k) (dirCfg qOf q false ((u ^ k).reverse +> l) (v +> r)) (dirCfg qOf q false l (v ^ k +> v +> r))htr:ReachesIn M (dt + dt * k) (dirCfg qOf q false (u.reverse +> (u ^ k).reverse +> l) r) (dirCfg qOf q false l (v ^ k +> v +> r))⊢ ReachesIn M (dt * (k + 1)) (dirCfg qOf q false (u.reverse +> (u ^ k).reverse +> l) r) (dirCfg qOf q false l (v ^ k +> v +> r)) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdt:ℕk:ℕl:ListBlank Γr:ListBlank Γhex:WordExit M qOf u q false v q false dtih:WordExit M qOf (u ^ k) q false (v ^ k) q false (dt * k)h1:ReachesIn M dt (dirCfg qOf q false (u.reverse +> (u ^ k).reverse +> l) r) (dirCfg qOf q false ((u ^ k).reverse +> l) (v +> r))h2:ReachesIn M (dt * k) (dirCfg qOf q false ((u ^ k).reverse +> l) (v +> r)) (dirCfg qOf q false l (v ^ k +> v +> r))htr:ReachesIn M (dt + dt * k) (dirCfg qOf q false (u.reverse +> (u ^ k).reverse +> l) r) (dirCfg qOf q false l (v ^ k +> v +> r))hdt:dt + dt * k = dt * (k + 1)⊢ ReachesIn M (dt * (k + 1)) (dirCfg qOf q false (u.reverse +> (u ^ k).reverse +> l) r) (dirCfg qOf q false l (v ^ k +> v +> r)) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdt:ℕk:ℕl:ListBlank Γr:ListBlank Γhex:WordExit M qOf u q true v q true dtih:WordExit M qOf (u ^ k) q true (v ^ k) q true (dt * k)⊢ match placeSide true (u ^ (k + 1)) l r with | (l₁, r₁) => match placeSide (!true) (v ^ (k + 1)) l r with | (l₂, r₂) => ReachesIn M (dt * (k + 1)) (dirCfg qOf q true l₁ r₁) (dirCfg qOf q true l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdt:ℕk:ℕl:ListBlank Γr:ListBlank Γhex:WordExit M qOf u q true v q true dtih:WordExit M qOf (u ^ k) q true (v ^ k) q true (dt * k)⊢ ReachesIn M (dt * (k + 1)) (dirCfg qOf q true l (u ^ (k + 1) +> r)) (dirCfg qOf q true ((v ^ (k + 1)).reverse +> l) r) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdt:ℕk:ℕl:ListBlank Γr:ListBlank Γhex:WordExit M qOf u q true v q true dtih:WordExit M qOf (u ^ k) q true (v ^ k) q true (dt * k)⊢ ReachesIn M (dt * (k + 1)) (dirCfg qOf q true l (u +> u ^ k +> r)) (dirCfg qOf q true ((v ^ k).reverse +> v.reverse +> l) r) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdt:ℕk:ℕl:ListBlank Γr:ListBlank Γhex:WordExit M qOf u q true v q true dtih:WordExit M qOf (u ^ k) q true (v ^ k) q true (dt * k)h1:match placeSide true u l (u ^ k +> r) with | (l₁, r₁) => match placeSide (!true) v l (u ^ k +> r) with | (l₂, r₂) => ReachesIn M dt (dirCfg qOf q true l₁ r₁) (dirCfg qOf q true l₂ r₂)⊢ ReachesIn M (dt * (k + 1)) (dirCfg qOf q true l (u +> u ^ k +> r)) (dirCfg qOf q true ((v ^ k).reverse +> v.reverse +> l) r) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdt:ℕk:ℕl:ListBlank Γr:ListBlank Γhex:WordExit M qOf u q true v q true dtih:WordExit M qOf (u ^ k) q true (v ^ k) q true (dt * k)h1:ReachesIn M dt (dirCfg qOf q true l (u +> u ^ k +> r)) (dirCfg qOf q true (v.reverse +> l) (u ^ k +> r))⊢ ReachesIn M (dt * (k + 1)) (dirCfg qOf q true l (u +> u ^ k +> r)) (dirCfg qOf q true ((v ^ k).reverse +> v.reverse +> l) r) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdt:ℕk:ℕl:ListBlank Γr:ListBlank Γhex:WordExit M qOf u q true v q true dtih:WordExit M qOf (u ^ k) q true (v ^ k) q true (dt * k)h1:ReachesIn M dt (dirCfg qOf q true l (u +> u ^ k +> r)) (dirCfg qOf q true (v.reverse +> l) (u ^ k +> r))h2:match placeSide true (u ^ k) (v.reverse +> l) r with | (l₁, r₁) => match placeSide (!true) (v ^ k) (v.reverse +> l) r with | (l₂, r₂) => ReachesIn M (dt * k) (dirCfg qOf q true l₁ r₁) (dirCfg qOf q true l₂ r₂)⊢ ReachesIn M (dt * (k + 1)) (dirCfg qOf q true l (u +> u ^ k +> r)) (dirCfg qOf q true ((v ^ k).reverse +> v.reverse +> l) r) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdt:ℕk:ℕl:ListBlank Γr:ListBlank Γhex:WordExit M qOf u q true v q true dtih:WordExit M qOf (u ^ k) q true (v ^ k) q true (dt * k)h1:ReachesIn M dt (dirCfg qOf q true l (u +> u ^ k +> r)) (dirCfg qOf q true (v.reverse +> l) (u ^ k +> r))h2:ReachesIn M (dt * k) (dirCfg qOf q true (v.reverse +> l) (u ^ k +> r)) (dirCfg qOf q true ((v ^ k).reverse +> v.reverse +> l) r)⊢ ReachesIn M (dt * (k + 1)) (dirCfg qOf q true l (u +> u ^ k +> r)) (dirCfg qOf q true ((v ^ k).reverse +> v.reverse +> l) r) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdt:ℕk:ℕl:ListBlank Γr:ListBlank Γhex:WordExit M qOf u q true v q true dtih:WordExit M qOf (u ^ k) q true (v ^ k) q true (dt * k)h1:ReachesIn M dt (dirCfg qOf q true l (u +> u ^ k +> r)) (dirCfg qOf q true (v.reverse +> l) (u ^ k +> r))h2:ReachesIn M (dt * k) (dirCfg qOf q true (v.reverse +> l) (u ^ k +> r)) (dirCfg qOf q true ((v ^ k).reverse +> v.reverse +> l) r)htr:ReachesIn M (dt + dt * k) (dirCfg qOf q true l (u +> u ^ k +> r)) (dirCfg qOf q true ((v ^ k).reverse +> v.reverse +> l) r)⊢ ReachesIn M (dt * (k + 1)) (dirCfg qOf q true l (u +> u ^ k +> r)) (dirCfg qOf q true ((v ^ k).reverse +> v.reverse +> l) r) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → Λu:List Γv:List Γq:ℕdt:ℕk:ℕl:ListBlank Γr:ListBlank Γhex:WordExit M qOf u q true v q true dtih:WordExit M qOf (u ^ k) q true (v ^ k) q true (dt * k)h1:ReachesIn M dt (dirCfg qOf q true l (u +> u ^ k +> r)) (dirCfg qOf q true (v.reverse +> l) (u ^ k +> r))h2:ReachesIn M (dt * k) (dirCfg qOf q true (v.reverse +> l) (u ^ k +> r)) (dirCfg qOf q true ((v ^ k).reverse +> v.reverse +> l) r)htr:ReachesIn M (dt + dt * k) (dirCfg qOf q true l (u +> u ^ k +> r)) (dirCfg qOf q true ((v ^ k).reverse +> v.reverse +> l) r)hdt:dt + dt * k = dt * (k + 1)⊢ ReachesIn M (dt * (k + 1)) (dirCfg qOf q true l (u +> u ^ k +> r)) (dirCfg qOf q true ((v ^ k).reverse +> v.reverse +> l) r) All goals completed! 🐙

Composite Subword Zipper (simSubwords)

Soundness predicate for a base-word exit function (q, dir, s) ↦ (s', q', dir', dt).

def BaseExitSound (M : Machine Γ Λ) (qOf : ℕ → Λ) (baseWord : ℕ → List Γ) (baseExit : ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)) : Prop := ∀ q dir s s' q' dir' dt, baseExit q dir s = some (s', q', dir', dt) → WordExit M qOf (baseWord s) q dir (baseWord s') q' dir' dt

Subword-level local zipper simulator over a verified baseExit table.

def simSubwords (baseExit : ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)) : ℕ → ℕ → Bool → List ℕ → List ℕ → ℕ → Option (List ℕ × ℕ × Bool × ℕ) | 0, _, _, _, _, _ => none | _ + 1, q, true, lw, [], dt => withNat q fun q' ↦ withNat dt fun d ↦ some (lw.reverse, q', true, d) | fuel + 1, q, true, lw, a :: rw, dt => match baseExit q true a with | none => none | some (s', q', dir', exDt) => withNat (dt + exDt) fun dt' ↦ if dir' then simSubwords baseExit fuel q' true (s' :: lw) rw dt' else simSubwords baseExit fuel q' false lw (s' :: rw) dt' | _ + 1, q, false, [], rw, dt => withNat q fun q' ↦ withNat dt fun d ↦ some (rw, q', false, d) | fuel + 1, q, false, a :: lw, rw, dt => match baseExit q false a with | none => none | some (s', q', dir', exDt) => withNat (dt + exDt) fun dt' ↦ if dir' then simSubwords baseExit fuel q' true (s' :: lw) rw dt' else simSubwords baseExit fuel q' false lw (s' :: rw) dt'

Compute the composite exit of subword list u from (q, dir) using baseExit.

def runCompositeExit (baseExit : ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)) (u : List ℕ) (q : ℕ) (dir : Bool) : Option (List ℕ × ℕ × Bool × ℕ) := withNat (u.length * 16 + 16) fun fuel ↦ if dir then simSubwords baseExit fuel q true [] u 0 else simSubwords baseExit fuel q false u.reverse [] 0private def leftSubTape (baseWord : ℕ → List Γ) : List ℕ → ListBlank Γ → ListBlank Γ | [], l => l | s :: lw, l => ListBlank.append (baseWord s).reverse (leftSubTape baseWord lw l)private def rightSubTape (baseWord : ℕ → List Γ) : List ℕ → ListBlank Γ → ListBlank Γ | [], r => r | s :: rw, r => ListBlank.append (baseWord s) (rightSubTape baseWord rw r)private theorem rightSubTape_eq (baseWord : ℕ → List Γ) (rw : List ℕ) (r : ListBlank Γ) : rightSubTape baseWord rw r = ListBlank.append (concatSubwords baseWord rw) r := Γ:Type u_1inst✝:Inhabited ΓbaseWord:ℕ → List Γrw:List ℕr:ListBlank Γ⊢ rightSubTape baseWord rw r = concatSubwords baseWord rw +> r induction rw with Γ:Type u_1inst✝:Inhabited ΓbaseWord:ℕ → List Γr:ListBlank Γ⊢ rightSubTape baseWord [] r = concatSubwords baseWord [] +> r All goals completed! 🐙 Γ:Type u_1inst✝:Inhabited ΓbaseWord:ℕ → List Γr:ListBlank Γs:ℕrw:List ℕih:rightSubTape baseWord rw r = concatSubwords baseWord rw +> r⊢ rightSubTape baseWord (s :: rw) r = concatSubwords baseWord (s :: rw) +> r All goals completed! 🐙private theorem leftSubTape_append (baseWord : ℕ → List Γ) (xs ys : List ℕ) (l : ListBlank Γ) : leftSubTape baseWord (xs ++ ys) l = leftSubTape baseWord xs (leftSubTape baseWord ys l) := Γ:Type u_1inst✝:Inhabited ΓbaseWord:ℕ → List Γxs:List ℕys:List ℕl:ListBlank Γ⊢ leftSubTape baseWord (xs ++ ys) l = leftSubTape baseWord xs (leftSubTape baseWord ys l) induction xs with Γ:Type u_1inst✝:Inhabited ΓbaseWord:ℕ → List Γys:List ℕl:ListBlank Γ⊢ leftSubTape baseWord ([] ++ ys) l = leftSubTape baseWord [] (leftSubTape baseWord ys l) All goals completed! 🐙 Γ:Type u_1inst✝:Inhabited ΓbaseWord:ℕ → List Γys:List ℕl:ListBlank Γx:ℕxs:List ℕih:leftSubTape baseWord (xs ++ ys) l = leftSubTape baseWord xs (leftSubTape baseWord ys l)⊢ leftSubTape baseWord (x :: xs ++ ys) l = leftSubTape baseWord (x :: xs) (leftSubTape baseWord ys l) All goals completed! 🐙private theorem leftSubTape_reverse_eq (baseWord : ℕ → List Γ) (u : List ℕ) (l : ListBlank Γ) : leftSubTape baseWord u.reverse l = ListBlank.append (concatSubwords baseWord u).reverse l := Γ:Type u_1inst✝:Inhabited ΓbaseWord:ℕ → List Γu:List ℕl:ListBlank Γ⊢ leftSubTape baseWord u.reverse l = (concatSubwords baseWord u).reverse +> l induction u generalizing l with Γ:Type u_1inst✝:Inhabited ΓbaseWord:ℕ → List Γl:ListBlank Γ⊢ leftSubTape baseWord [].reverse l = (concatSubwords baseWord []).reverse +> l All goals completed! 🐙 Γ:Type u_1inst✝:Inhabited ΓbaseWord:ℕ → List Γs:ℕu:List ℕih:∀ (l : ListBlank Γ), leftSubTape baseWord u.reverse l = (concatSubwords baseWord u).reverse +> ll:ListBlank Γ⊢ leftSubTape baseWord (s :: u).reverse l = (concatSubwords baseWord (s :: u)).reverse +> l Γ:Type u_1inst✝:Inhabited ΓbaseWord:ℕ → List Γs:ℕu:List ℕih:∀ (l : ListBlank Γ), leftSubTape baseWord u.reverse l = (concatSubwords baseWord u).reverse +> ll:ListBlank Γ⊢ leftSubTape baseWord u.reverse ((baseWord s).reverse +> l) = (concatSubwords baseWord u).reverse +> (baseWord s).reverse +> l All goals completed! 🐙private theorem leftSubTape_eq (baseWord : ℕ → List Γ) (lw : List ℕ) (l : ListBlank Γ) : leftSubTape baseWord lw l = ListBlank.append (concatSubwords baseWord lw.reverse).reverse l := Γ:Type u_1inst✝:Inhabited ΓbaseWord:ℕ → List Γlw:List ℕl:ListBlank Γ⊢ leftSubTape baseWord lw l = (concatSubwords baseWord lw.reverse).reverse +> l All goals completed! 🐙private theorem simSubwords_sound_aux {M : Machine Γ Λ} {qOf : ℕ → Λ} {baseWord : ℕ → List Γ} {baseExit : ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)} (hbase : BaseExitSound M qOf baseWord baseExit) : ∀ (fuel q : ℕ) (dir : Bool) (lw rw : List ℕ) (dt : ℕ) (v : List ℕ) (q' : ℕ) (dir' : Bool) (dtOut : ℕ) (l r : ListBlank Γ), simSubwords baseExit fuel q dir lw rw dt = some (v, q', dir', dtOut) → dt ≤ dtOut ∧ let (l₂, r₂) := placeSide (!dir') (concatSubwords baseWord v) l r ReachesIn M (dtOut - dt) (dirCfg qOf q dir (leftSubTape baseWord lw l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitx✝¹⁰:ℕx✝⁹:Boolx✝⁸:List ℕx✝⁷:List ℕx✝⁶:ℕx✝⁵:List ℕx✝⁴:ℕx✝³:Boolx✝²:ℕx✝¹:ListBlank Γx✝:ListBlank Γh:simSubwords baseExit 0 x✝¹⁰ x✝⁹ x✝⁸ x✝⁷ x✝⁶ = some (x✝⁵, x✝⁴, x✝³, x✝²)⊢ x✝⁶ ≤ x✝² ∧ match placeSide (!x✝³) (concatSubwords baseWord x✝⁵) x✝¹ x✝ with | (l₂, r₂) => ReachesIn M (x✝² - x✝⁶) (dirCfg qOf x✝¹⁰ x✝⁹ (leftSubTape baseWord x✝⁸ x✝¹) (rightSubTape baseWord x✝⁷ x✝)) (dirCfg qOf x✝⁴ x✝³ l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitx✝¹⁰:ℕx✝⁹:Boolx✝⁸:List ℕx✝⁷:List ℕx✝⁶:ℕx✝⁵:List ℕx✝⁴:ℕx✝³:Boolx✝²:ℕx✝¹:ListBlank Γx✝:ListBlank Γh:simSubwords baseExit 0 x✝¹⁰ x✝⁹ x✝⁸ x✝⁷ x✝⁶ = some (x✝⁵, x✝⁴, x✝³, x✝²)⊢ x✝⁶ ≤ x✝² ∧ match placeSide (!x✝³) (concatSubwords baseWord x✝⁵) x✝¹ x✝ with | (l₂, r₂) => ReachesIn M (x✝² - x✝⁶) (dirCfg qOf x✝¹⁰ x✝⁹ (leftSubTape baseWord x✝⁸ x✝¹) (rightSubTape baseWord x✝⁷ x✝)) (dirCfg qOf x✝⁴ x✝³ l₂ r₂) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitn✝:ℕq:ℕlw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:simSubwords baseExit (n✝ + 1) q true lw [] dt = some (v, q', dir', dtOut)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord [] r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitn✝:ℕq:ℕlw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:simSubwords baseExit (n✝ + 1) q true lw [] dt = some (v, q', dir', dtOut)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord [] r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitn✝:ℕq:ℕlw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:lw.reverse = v ∧ q = q' ∧ true = dir' ∧ dt = dtOut⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord [] r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitn✝:ℕq:ℕlw:List ℕdt:ℕl:ListBlank Γr:ListBlank Γ⊢ dt ≤ dt ∧ match placeSide (!true) (concatSubwords baseWord lw.reverse) l r with | (l₂, r₂) => ReachesIn M (dt - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord [] r)) (dirCfg qOf q true l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitn✝:ℕq:ℕlw:List ℕdt:ℕl:ListBlank Γr:ListBlank Γ⊢ match placeSide (!true) (concatSubwords baseWord lw.reverse) l r with | (l₂, r₂) => ReachesIn M (dt - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord [] r)) (dirCfg qOf q true l₂ r₂) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:simSubwords baseExit (fuel + 1) q true lw (a :: rw) dt = some (v, q', dir', dtOut)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord (a :: rw) r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:simSubwords baseExit (fuel + 1) q true lw (a :: rw) dt = some (v, q', dir', dtOut)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord (a :: rw) r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:(match baseExit q true a with | none => none | some (s', q', dir', exDt) => if dir' = true then simSubwords baseExit fuel q' true (s' :: lw) rw (dt + exDt) else simSubwords baseExit fuel q' false lw (s' :: rw) (dt + exDt)) = some (v, q', dir', dtOut)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord (a :: rw) r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:(match baseExit q true a with | none => none | some (s', q', dir', exDt) => if dir' = true then simSubwords baseExit fuel q' true (s' :: lw) rw (dt + exDt) else simSubwords baseExit fuel q' false lw (s' :: rw) (dt + exDt)) = some (v, q', dir', dtOut)hb:baseExit q true a = none⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord (a :: rw) r)) (dirCfg qOf q' dir' l₂ r₂)Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:(match baseExit q true a with | none => none | some (s', q', dir', exDt) => if dir' = true then simSubwords baseExit fuel q' true (s' :: lw) rw (dt + exDt) else simSubwords baseExit fuel q' false lw (s' :: rw) (dt + exDt)) = some (v, q', dir', dtOut)s':ℕqNext:ℕdNext:BoolexDt:ℕhb:baseExit q true a = some (s', qNext, dNext, exDt)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord (a :: rw) r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:(match baseExit q true a with | none => none | some (s', q', dir', exDt) => if dir' = true then simSubwords baseExit fuel q' true (s' :: lw) rw (dt + exDt) else simSubwords baseExit fuel q' false lw (s' :: rw) (dt + exDt)) = some (v, q', dir', dtOut)hb:baseExit q true a = none⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord (a :: rw) r)) (dirCfg qOf q' dir' l₂ r₂) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:(match baseExit q true a with | none => none | some (s', q', dir', exDt) => if dir' = true then simSubwords baseExit fuel q' true (s' :: lw) rw (dt + exDt) else simSubwords baseExit fuel q' false lw (s' :: rw) (dt + exDt)) = some (v, q', dir', dtOut)s':ℕqNext:ℕdNext:BoolexDt:ℕhb:baseExit q true a = some (s', qNext, dNext, exDt)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord (a :: rw) r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕdNext:BoolexDt:ℕh:(match some (s', qNext, dNext, exDt) with | none => none | some (s', q', dir', exDt) => if dir' = true then simSubwords baseExit fuel q' true (s' :: lw) rw (dt + exDt) else simSubwords baseExit fuel q' false lw (s' :: rw) (dt + exDt)) = some (v, q', dir', dtOut)hb:baseExit q true a = some (s', qNext, dNext, exDt)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord (a :: rw) r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕdNext:BoolexDt:ℕh:(match some (s', qNext, dNext, exDt) with | none => none | some (s', q', dir', exDt) => if dir' = true then simSubwords baseExit fuel q' true (s' :: lw) rw (dt + exDt) else simSubwords baseExit fuel q' false lw (s' :: rw) (dt + exDt)) = some (v, q', dir', dtOut)hb:baseExit q true a = some (s', qNext, dNext, exDt)hex:match placeSide true (baseWord a) (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₁, r₁) => match placeSide (!dNext) (baseWord s') (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₂, r₂) => ReachesIn M exDt (dirCfg qOf q true l₁ r₁) (dirCfg qOf qNext dNext l₂ r₂)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord (a :: rw) r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕh:(match some (s', qNext, false, exDt) with | none => none | some (s', q', dir', exDt) => if dir' = true then simSubwords baseExit fuel q' true (s' :: lw) rw (dt + exDt) else simSubwords baseExit fuel q' false lw (s' :: rw) (dt + exDt)) = some (v, q', dir', dtOut)hb:baseExit q true a = some (s', qNext, false, exDt)hex:match placeSide true (baseWord a) (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₁, r₁) => match placeSide (!false) (baseWord s') (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₂, r₂) => ReachesIn M exDt (dirCfg qOf q true l₁ r₁) (dirCfg qOf qNext false l₂ r₂)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord (a :: rw) r)) (dirCfg qOf q' dir' l₂ r₂)Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕh:(match some (s', qNext, true, exDt) with | none => none | some (s', q', dir', exDt) => if dir' = true then simSubwords baseExit fuel q' true (s' :: lw) rw (dt + exDt) else simSubwords baseExit fuel q' false lw (s' :: rw) (dt + exDt)) = some (v, q', dir', dtOut)hb:baseExit q true a = some (s', qNext, true, exDt)hex:match placeSide true (baseWord a) (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₁, r₁) => match placeSide (!true) (baseWord s') (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₂, r₂) => ReachesIn M exDt (dirCfg qOf q true l₁ r₁) (dirCfg qOf qNext true l₂ r₂)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord (a :: rw) r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕh:(match some (s', qNext, false, exDt) with | none => none | some (s', q', dir', exDt) => if dir' = true then simSubwords baseExit fuel q' true (s' :: lw) rw (dt + exDt) else simSubwords baseExit fuel q' false lw (s' :: rw) (dt + exDt)) = some (v, q', dir', dtOut)hb:baseExit q true a = some (s', qNext, false, exDt)hex:match placeSide true (baseWord a) (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₁, r₁) => match placeSide (!false) (baseWord s') (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₂, r₂) => ReachesIn M exDt (dirCfg qOf q true l₁ r₁) (dirCfg qOf qNext false l₂ r₂)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord (a :: rw) r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕhb:baseExit q true a = some (s', qNext, false, exDt)hex:match placeSide true (baseWord a) (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₁, r₁) => match placeSide (!false) (baseWord s') (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₂, r₂) => ReachesIn M exDt (dirCfg qOf q true l₁ r₁) (dirCfg qOf qNext false l₂ r₂)h:simSubwords baseExit fuel qNext false lw (s' :: rw) (dt + exDt) = some (v, q', dir', dtOut)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord (a :: rw) r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕhb:baseExit q true a = some (s', qNext, false, exDt)h:simSubwords baseExit fuel qNext false lw (s' :: rw) (dt + exDt) = some (v, q', dir', dtOut)hex:ReachesIn M exDt (dirCfg qOf q true (leftSubTape baseWord lw l) (baseWord a +> rightSubTape baseWord rw r)) (dirCfg qOf qNext false (leftSubTape baseWord lw l) (baseWord s' +> rightSubTape baseWord rw r))⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord (a :: rw) r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕhb:baseExit q true a = some (s', qNext, false, exDt)h:simSubwords baseExit fuel qNext false lw (s' :: rw) (dt + exDt) = some (v, q', dir', dtOut)hex:ReachesIn M exDt (dirCfg qOf q true (leftSubTape baseWord lw l) (baseWord a +> rightSubTape baseWord rw r)) (dirCfg qOf qNext false (leftSubTape baseWord lw l) (baseWord s' +> rightSubTape baseWord rw r))hle:dt + exDt ≤ dtOuthreach:match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + exDt)) (dirCfg qOf qNext false (leftSubTape baseWord lw l) (rightSubTape baseWord (s' :: rw) r)) (dirCfg qOf q' dir' l₂ r₂)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord (a :: rw) r)) (dirCfg qOf q' dir' l₂ r₂) refine ⟨Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕhb:baseExit q true a = some (s', qNext, false, exDt)h:simSubwords baseExit fuel qNext false lw (s' :: rw) (dt + exDt) = some (v, q', dir', dtOut)hex:ReachesIn M exDt (dirCfg qOf q true (leftSubTape baseWord lw l) (baseWord a +> rightSubTape baseWord rw r)) (dirCfg qOf qNext false (leftSubTape baseWord lw l) (baseWord s' +> rightSubTape baseWord rw r))hle:dt + exDt ≤ dtOuthreach:match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + exDt)) (dirCfg qOf qNext false (leftSubTape baseWord lw l) (rightSubTape baseWord (s' :: rw) r)) (dirCfg qOf q' dir' l₂ r₂)⊢ dt ≤ dtOut All goals completed! 🐙, ?_⟩ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕhb:baseExit q true a = some (s', qNext, false, exDt)h:simSubwords baseExit fuel qNext false lw (s' :: rw) (dt + exDt) = some (v, q', dir', dtOut)hex:ReachesIn M exDt (dirCfg qOf q true (leftSubTape baseWord lw l) (baseWord a +> rightSubTape baseWord rw r)) (dirCfg qOf qNext false (leftSubTape baseWord lw l) (baseWord s' +> rightSubTape baseWord rw r))hle:dt + exDt ≤ dtOuthreach:match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + exDt)) (dirCfg qOf qNext false (leftSubTape baseWord lw l) (rightSubTape baseWord (s' :: rw) r)) (dirCfg qOf q' dir' l₂ r₂)hsub:dtOut - dt = exDt + (dtOut - (dt + exDt))⊢ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord (a :: rw) r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕhb:baseExit q true a = some (s', qNext, false, exDt)h:simSubwords baseExit fuel qNext false lw (s' :: rw) (dt + exDt) = some (v, q', dir', dtOut)hex:ReachesIn M exDt (dirCfg qOf q true (leftSubTape baseWord lw l) (baseWord a +> rightSubTape baseWord rw r)) (dirCfg qOf qNext false (leftSubTape baseWord lw l) (baseWord s' +> rightSubTape baseWord rw r))hle:dt + exDt ≤ dtOuthreach:match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + exDt)) (dirCfg qOf qNext false (leftSubTape baseWord lw l) (rightSubTape baseWord (s' :: rw) r)) (dirCfg qOf q' dir' l₂ r₂)hsub:dtOut - dt = exDt + (dtOut - (dt + exDt))⊢ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (exDt + (dtOut - (dt + exDt))) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord (a :: rw) r)) (dirCfg qOf q' dir' l₂ r₂) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕh:(match some (s', qNext, true, exDt) with | none => none | some (s', q', dir', exDt) => if dir' = true then simSubwords baseExit fuel q' true (s' :: lw) rw (dt + exDt) else simSubwords baseExit fuel q' false lw (s' :: rw) (dt + exDt)) = some (v, q', dir', dtOut)hb:baseExit q true a = some (s', qNext, true, exDt)hex:match placeSide true (baseWord a) (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₁, r₁) => match placeSide (!true) (baseWord s') (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₂, r₂) => ReachesIn M exDt (dirCfg qOf q true l₁ r₁) (dirCfg qOf qNext true l₂ r₂)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord (a :: rw) r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕhb:baseExit q true a = some (s', qNext, true, exDt)hex:match placeSide true (baseWord a) (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₁, r₁) => match placeSide (!true) (baseWord s') (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₂, r₂) => ReachesIn M exDt (dirCfg qOf q true l₁ r₁) (dirCfg qOf qNext true l₂ r₂)h:simSubwords baseExit fuel qNext true (s' :: lw) rw (dt + exDt) = some (v, q', dir', dtOut)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord (a :: rw) r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕhb:baseExit q true a = some (s', qNext, true, exDt)h:simSubwords baseExit fuel qNext true (s' :: lw) rw (dt + exDt) = some (v, q', dir', dtOut)hex:ReachesIn M exDt (dirCfg qOf q true (leftSubTape baseWord lw l) (baseWord a +> rightSubTape baseWord rw r)) (dirCfg qOf qNext true (if false = true then (leftSubTape baseWord lw l, baseWord s' +> rightSubTape baseWord rw r) else ((baseWord s').reverse +> leftSubTape baseWord lw l, rightSubTape baseWord rw r)).1 (if false = true then (leftSubTape baseWord lw l, baseWord s' +> rightSubTape baseWord rw r) else ((baseWord s').reverse +> leftSubTape baseWord lw l, rightSubTape baseWord rw r)).2)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord (a :: rw) r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕhb:baseExit q true a = some (s', qNext, true, exDt)h:simSubwords baseExit fuel qNext true (s' :: lw) rw (dt + exDt) = some (v, q', dir', dtOut)hex:ReachesIn M exDt (dirCfg qOf q true (leftSubTape baseWord lw l) (baseWord a +> rightSubTape baseWord rw r)) (dirCfg qOf qNext true (if false = true then (leftSubTape baseWord lw l, baseWord s' +> rightSubTape baseWord rw r) else ((baseWord s').reverse +> leftSubTape baseWord lw l, rightSubTape baseWord rw r)).1 (if false = true then (leftSubTape baseWord lw l, baseWord s' +> rightSubTape baseWord rw r) else ((baseWord s').reverse +> leftSubTape baseWord lw l, rightSubTape baseWord rw r)).2)hle:dt + exDt ≤ dtOuthreach:match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + exDt)) (dirCfg qOf qNext true (leftSubTape baseWord (s' :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord (a :: rw) r)) (dirCfg qOf q' dir' l₂ r₂) refine ⟨Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕhb:baseExit q true a = some (s', qNext, true, exDt)h:simSubwords baseExit fuel qNext true (s' :: lw) rw (dt + exDt) = some (v, q', dir', dtOut)hex:ReachesIn M exDt (dirCfg qOf q true (leftSubTape baseWord lw l) (baseWord a +> rightSubTape baseWord rw r)) (dirCfg qOf qNext true (if false = true then (leftSubTape baseWord lw l, baseWord s' +> rightSubTape baseWord rw r) else ((baseWord s').reverse +> leftSubTape baseWord lw l, rightSubTape baseWord rw r)).1 (if false = true then (leftSubTape baseWord lw l, baseWord s' +> rightSubTape baseWord rw r) else ((baseWord s').reverse +> leftSubTape baseWord lw l, rightSubTape baseWord rw r)).2)hle:dt + exDt ≤ dtOuthreach:match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + exDt)) (dirCfg qOf qNext true (leftSubTape baseWord (s' :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂)⊢ dt ≤ dtOut All goals completed! 🐙, ?_⟩ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕhb:baseExit q true a = some (s', qNext, true, exDt)h:simSubwords baseExit fuel qNext true (s' :: lw) rw (dt + exDt) = some (v, q', dir', dtOut)hex:ReachesIn M exDt (dirCfg qOf q true (leftSubTape baseWord lw l) (baseWord a +> rightSubTape baseWord rw r)) (dirCfg qOf qNext true (if false = true then (leftSubTape baseWord lw l, baseWord s' +> rightSubTape baseWord rw r) else ((baseWord s').reverse +> leftSubTape baseWord lw l, rightSubTape baseWord rw r)).1 (if false = true then (leftSubTape baseWord lw l, baseWord s' +> rightSubTape baseWord rw r) else ((baseWord s').reverse +> leftSubTape baseWord lw l, rightSubTape baseWord rw r)).2)hle:dt + exDt ≤ dtOuthreach:match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + exDt)) (dirCfg qOf qNext true (leftSubTape baseWord (s' :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂)hsub:dtOut - dt = exDt + (dtOut - (dt + exDt))⊢ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord (a :: rw) r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕlw:List ℕa:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕhb:baseExit q true a = some (s', qNext, true, exDt)h:simSubwords baseExit fuel qNext true (s' :: lw) rw (dt + exDt) = some (v, q', dir', dtOut)hex:ReachesIn M exDt (dirCfg qOf q true (leftSubTape baseWord lw l) (baseWord a +> rightSubTape baseWord rw r)) (dirCfg qOf qNext true (if false = true then (leftSubTape baseWord lw l, baseWord s' +> rightSubTape baseWord rw r) else ((baseWord s').reverse +> leftSubTape baseWord lw l, rightSubTape baseWord rw r)).1 (if false = true then (leftSubTape baseWord lw l, baseWord s' +> rightSubTape baseWord rw r) else ((baseWord s').reverse +> leftSubTape baseWord lw l, rightSubTape baseWord rw r)).2)hle:dt + exDt ≤ dtOuthreach:match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + exDt)) (dirCfg qOf qNext true (leftSubTape baseWord (s' :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂)hsub:dtOut - dt = exDt + (dtOut - (dt + exDt))⊢ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (exDt + (dtOut - (dt + exDt))) (dirCfg qOf q true (leftSubTape baseWord lw l) (rightSubTape baseWord (a :: rw) r)) (dirCfg qOf q' dir' l₂ r₂) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitn✝:ℕq:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:simSubwords baseExit (n✝ + 1) q false [] rw dt = some (v, q', dir', dtOut)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false (leftSubTape baseWord [] l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitn✝:ℕq:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:simSubwords baseExit (n✝ + 1) q false [] rw dt = some (v, q', dir', dtOut)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false (leftSubTape baseWord [] l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitn✝:ℕq:ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:rw = v ∧ q = q' ∧ false = dir' ∧ dt = dtOut⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false (leftSubTape baseWord [] l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitn✝:ℕq:ℕrw:List ℕdt:ℕl:ListBlank Γr:ListBlank Γ⊢ dt ≤ dt ∧ match placeSide (!false) (concatSubwords baseWord rw) l r with | (l₂, r₂) => ReachesIn M (dt - dt) (dirCfg qOf q false (leftSubTape baseWord [] l) (rightSubTape baseWord rw r)) (dirCfg qOf q false l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitn✝:ℕq:ℕrw:List ℕdt:ℕl:ListBlank Γr:ListBlank Γ⊢ match placeSide (!false) (concatSubwords baseWord rw) l r with | (l₂, r₂) => ReachesIn M (dt - dt) (dirCfg qOf q false (leftSubTape baseWord [] l) (rightSubTape baseWord rw r)) (dirCfg qOf q false l₂ r₂) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:simSubwords baseExit (fuel + 1) q false (a :: lw) rw dt = some (v, q', dir', dtOut)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false (leftSubTape baseWord (a :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:simSubwords baseExit (fuel + 1) q false (a :: lw) rw dt = some (v, q', dir', dtOut)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false (leftSubTape baseWord (a :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:(match baseExit q false a with | none => none | some (s', q', dir', exDt) => if dir' = true then simSubwords baseExit fuel q' true (s' :: lw) rw (dt + exDt) else simSubwords baseExit fuel q' false lw (s' :: rw) (dt + exDt)) = some (v, q', dir', dtOut)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false (leftSubTape baseWord (a :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:(match baseExit q false a with | none => none | some (s', q', dir', exDt) => if dir' = true then simSubwords baseExit fuel q' true (s' :: lw) rw (dt + exDt) else simSubwords baseExit fuel q' false lw (s' :: rw) (dt + exDt)) = some (v, q', dir', dtOut)hb:baseExit q false a = none⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false (leftSubTape baseWord (a :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂)Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:(match baseExit q false a with | none => none | some (s', q', dir', exDt) => if dir' = true then simSubwords baseExit fuel q' true (s' :: lw) rw (dt + exDt) else simSubwords baseExit fuel q' false lw (s' :: rw) (dt + exDt)) = some (v, q', dir', dtOut)s':ℕqNext:ℕdNext:BoolexDt:ℕhb:baseExit q false a = some (s', qNext, dNext, exDt)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false (leftSubTape baseWord (a :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:(match baseExit q false a with | none => none | some (s', q', dir', exDt) => if dir' = true then simSubwords baseExit fuel q' true (s' :: lw) rw (dt + exDt) else simSubwords baseExit fuel q' false lw (s' :: rw) (dt + exDt)) = some (v, q', dir', dtOut)hb:baseExit q false a = none⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false (leftSubTape baseWord (a :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γh:(match baseExit q false a with | none => none | some (s', q', dir', exDt) => if dir' = true then simSubwords baseExit fuel q' true (s' :: lw) rw (dt + exDt) else simSubwords baseExit fuel q' false lw (s' :: rw) (dt + exDt)) = some (v, q', dir', dtOut)s':ℕqNext:ℕdNext:BoolexDt:ℕhb:baseExit q false a = some (s', qNext, dNext, exDt)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false (leftSubTape baseWord (a :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕdNext:BoolexDt:ℕh:(match some (s', qNext, dNext, exDt) with | none => none | some (s', q', dir', exDt) => if dir' = true then simSubwords baseExit fuel q' true (s' :: lw) rw (dt + exDt) else simSubwords baseExit fuel q' false lw (s' :: rw) (dt + exDt)) = some (v, q', dir', dtOut)hb:baseExit q false a = some (s', qNext, dNext, exDt)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false (leftSubTape baseWord (a :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕdNext:BoolexDt:ℕh:(match some (s', qNext, dNext, exDt) with | none => none | some (s', q', dir', exDt) => if dir' = true then simSubwords baseExit fuel q' true (s' :: lw) rw (dt + exDt) else simSubwords baseExit fuel q' false lw (s' :: rw) (dt + exDt)) = some (v, q', dir', dtOut)hb:baseExit q false a = some (s', qNext, dNext, exDt)hex:match placeSide false (baseWord a) (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₁, r₁) => match placeSide (!dNext) (baseWord s') (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₂, r₂) => ReachesIn M exDt (dirCfg qOf q false l₁ r₁) (dirCfg qOf qNext dNext l₂ r₂)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false (leftSubTape baseWord (a :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕh:(match some (s', qNext, false, exDt) with | none => none | some (s', q', dir', exDt) => if dir' = true then simSubwords baseExit fuel q' true (s' :: lw) rw (dt + exDt) else simSubwords baseExit fuel q' false lw (s' :: rw) (dt + exDt)) = some (v, q', dir', dtOut)hb:baseExit q false a = some (s', qNext, false, exDt)hex:match placeSide false (baseWord a) (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₁, r₁) => match placeSide (!false) (baseWord s') (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₂, r₂) => ReachesIn M exDt (dirCfg qOf q false l₁ r₁) (dirCfg qOf qNext false l₂ r₂)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false (leftSubTape baseWord (a :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂)Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕh:(match some (s', qNext, true, exDt) with | none => none | some (s', q', dir', exDt) => if dir' = true then simSubwords baseExit fuel q' true (s' :: lw) rw (dt + exDt) else simSubwords baseExit fuel q' false lw (s' :: rw) (dt + exDt)) = some (v, q', dir', dtOut)hb:baseExit q false a = some (s', qNext, true, exDt)hex:match placeSide false (baseWord a) (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₁, r₁) => match placeSide (!true) (baseWord s') (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₂, r₂) => ReachesIn M exDt (dirCfg qOf q false l₁ r₁) (dirCfg qOf qNext true l₂ r₂)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false (leftSubTape baseWord (a :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕh:(match some (s', qNext, false, exDt) with | none => none | some (s', q', dir', exDt) => if dir' = true then simSubwords baseExit fuel q' true (s' :: lw) rw (dt + exDt) else simSubwords baseExit fuel q' false lw (s' :: rw) (dt + exDt)) = some (v, q', dir', dtOut)hb:baseExit q false a = some (s', qNext, false, exDt)hex:match placeSide false (baseWord a) (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₁, r₁) => match placeSide (!false) (baseWord s') (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₂, r₂) => ReachesIn M exDt (dirCfg qOf q false l₁ r₁) (dirCfg qOf qNext false l₂ r₂)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false (leftSubTape baseWord (a :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕhb:baseExit q false a = some (s', qNext, false, exDt)hex:match placeSide false (baseWord a) (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₁, r₁) => match placeSide (!false) (baseWord s') (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₂, r₂) => ReachesIn M exDt (dirCfg qOf q false l₁ r₁) (dirCfg qOf qNext false l₂ r₂)h:simSubwords baseExit fuel qNext false lw (s' :: rw) (dt + exDt) = some (v, q', dir', dtOut)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false (leftSubTape baseWord (a :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕhb:baseExit q false a = some (s', qNext, false, exDt)h:simSubwords baseExit fuel qNext false lw (s' :: rw) (dt + exDt) = some (v, q', dir', dtOut)hex:ReachesIn M exDt (dirCfg qOf q false ((baseWord a).reverse +> leftSubTape baseWord lw l) (rightSubTape baseWord rw r)) (dirCfg qOf qNext false (leftSubTape baseWord lw l) (baseWord s' +> rightSubTape baseWord rw r))⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false (leftSubTape baseWord (a :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕhb:baseExit q false a = some (s', qNext, false, exDt)h:simSubwords baseExit fuel qNext false lw (s' :: rw) (dt + exDt) = some (v, q', dir', dtOut)hex:ReachesIn M exDt (dirCfg qOf q false ((baseWord a).reverse +> leftSubTape baseWord lw l) (rightSubTape baseWord rw r)) (dirCfg qOf qNext false (leftSubTape baseWord lw l) (baseWord s' +> rightSubTape baseWord rw r))hle:dt + exDt ≤ dtOuthreach:match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + exDt)) (dirCfg qOf qNext false (leftSubTape baseWord lw l) (rightSubTape baseWord (s' :: rw) r)) (dirCfg qOf q' dir' l₂ r₂)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false (leftSubTape baseWord (a :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) refine ⟨Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕhb:baseExit q false a = some (s', qNext, false, exDt)h:simSubwords baseExit fuel qNext false lw (s' :: rw) (dt + exDt) = some (v, q', dir', dtOut)hex:ReachesIn M exDt (dirCfg qOf q false ((baseWord a).reverse +> leftSubTape baseWord lw l) (rightSubTape baseWord rw r)) (dirCfg qOf qNext false (leftSubTape baseWord lw l) (baseWord s' +> rightSubTape baseWord rw r))hle:dt + exDt ≤ dtOuthreach:match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + exDt)) (dirCfg qOf qNext false (leftSubTape baseWord lw l) (rightSubTape baseWord (s' :: rw) r)) (dirCfg qOf q' dir' l₂ r₂)⊢ dt ≤ dtOut All goals completed! 🐙, ?_⟩ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕhb:baseExit q false a = some (s', qNext, false, exDt)h:simSubwords baseExit fuel qNext false lw (s' :: rw) (dt + exDt) = some (v, q', dir', dtOut)hex:ReachesIn M exDt (dirCfg qOf q false ((baseWord a).reverse +> leftSubTape baseWord lw l) (rightSubTape baseWord rw r)) (dirCfg qOf qNext false (leftSubTape baseWord lw l) (baseWord s' +> rightSubTape baseWord rw r))hle:dt + exDt ≤ dtOuthreach:match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + exDt)) (dirCfg qOf qNext false (leftSubTape baseWord lw l) (rightSubTape baseWord (s' :: rw) r)) (dirCfg qOf q' dir' l₂ r₂)hsub:dtOut - dt = exDt + (dtOut - (dt + exDt))⊢ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false (leftSubTape baseWord (a :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕhb:baseExit q false a = some (s', qNext, false, exDt)h:simSubwords baseExit fuel qNext false lw (s' :: rw) (dt + exDt) = some (v, q', dir', dtOut)hex:ReachesIn M exDt (dirCfg qOf q false ((baseWord a).reverse +> leftSubTape baseWord lw l) (rightSubTape baseWord rw r)) (dirCfg qOf qNext false (leftSubTape baseWord lw l) (baseWord s' +> rightSubTape baseWord rw r))hle:dt + exDt ≤ dtOuthreach:match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + exDt)) (dirCfg qOf qNext false (leftSubTape baseWord lw l) (rightSubTape baseWord (s' :: rw) r)) (dirCfg qOf q' dir' l₂ r₂)hsub:dtOut - dt = exDt + (dtOut - (dt + exDt))⊢ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (exDt + (dtOut - (dt + exDt))) (dirCfg qOf q false (leftSubTape baseWord (a :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕh:(match some (s', qNext, true, exDt) with | none => none | some (s', q', dir', exDt) => if dir' = true then simSubwords baseExit fuel q' true (s' :: lw) rw (dt + exDt) else simSubwords baseExit fuel q' false lw (s' :: rw) (dt + exDt)) = some (v, q', dir', dtOut)hb:baseExit q false a = some (s', qNext, true, exDt)hex:match placeSide false (baseWord a) (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₁, r₁) => match placeSide (!true) (baseWord s') (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₂, r₂) => ReachesIn M exDt (dirCfg qOf q false l₁ r₁) (dirCfg qOf qNext true l₂ r₂)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false (leftSubTape baseWord (a :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕhb:baseExit q false a = some (s', qNext, true, exDt)hex:match placeSide false (baseWord a) (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₁, r₁) => match placeSide (!true) (baseWord s') (leftSubTape baseWord lw l) (rightSubTape baseWord rw r) with | (l₂, r₂) => ReachesIn M exDt (dirCfg qOf q false l₁ r₁) (dirCfg qOf qNext true l₂ r₂)h:simSubwords baseExit fuel qNext true (s' :: lw) rw (dt + exDt) = some (v, q', dir', dtOut)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false (leftSubTape baseWord (a :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕhb:baseExit q false a = some (s', qNext, true, exDt)h:simSubwords baseExit fuel qNext true (s' :: lw) rw (dt + exDt) = some (v, q', dir', dtOut)hex:ReachesIn M exDt (dirCfg qOf q false ((baseWord a).reverse +> leftSubTape baseWord lw l) (rightSubTape baseWord rw r)) (dirCfg qOf qNext true ((baseWord s').reverse +> leftSubTape baseWord lw l) (rightSubTape baseWord rw r))⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false (leftSubTape baseWord (a :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕhb:baseExit q false a = some (s', qNext, true, exDt)h:simSubwords baseExit fuel qNext true (s' :: lw) rw (dt + exDt) = some (v, q', dir', dtOut)hex:ReachesIn M exDt (dirCfg qOf q false ((baseWord a).reverse +> leftSubTape baseWord lw l) (rightSubTape baseWord rw r)) (dirCfg qOf qNext true ((baseWord s').reverse +> leftSubTape baseWord lw l) (rightSubTape baseWord rw r))hle:dt + exDt ≤ dtOuthreach:match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + exDt)) (dirCfg qOf qNext true (leftSubTape baseWord (s' :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂)⊢ dt ≤ dtOut ∧ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false (leftSubTape baseWord (a :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) refine ⟨Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕhb:baseExit q false a = some (s', qNext, true, exDt)h:simSubwords baseExit fuel qNext true (s' :: lw) rw (dt + exDt) = some (v, q', dir', dtOut)hex:ReachesIn M exDt (dirCfg qOf q false ((baseWord a).reverse +> leftSubTape baseWord lw l) (rightSubTape baseWord rw r)) (dirCfg qOf qNext true ((baseWord s').reverse +> leftSubTape baseWord lw l) (rightSubTape baseWord rw r))hle:dt + exDt ≤ dtOuthreach:match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + exDt)) (dirCfg qOf qNext true (leftSubTape baseWord (s' :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂)⊢ dt ≤ dtOut All goals completed! 🐙, ?_⟩ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕhb:baseExit q false a = some (s', qNext, true, exDt)h:simSubwords baseExit fuel qNext true (s' :: lw) rw (dt + exDt) = some (v, q', dir', dtOut)hex:ReachesIn M exDt (dirCfg qOf q false ((baseWord a).reverse +> leftSubTape baseWord lw l) (rightSubTape baseWord rw r)) (dirCfg qOf qNext true ((baseWord s').reverse +> leftSubTape baseWord lw l) (rightSubTape baseWord rw r))hle:dt + exDt ≤ dtOuthreach:match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + exDt)) (dirCfg qOf qNext true (leftSubTape baseWord (s' :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂)hsub:dtOut - dt = exDt + (dtOut - (dt + exDt))⊢ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - dt) (dirCfg qOf q false (leftSubTape baseWord (a :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitfuel:ℕq:ℕa:ℕlw:List ℕrw:List ℕdt:ℕv:List ℕq':ℕdir':BooldtOut:ℕl:ListBlank Γr:ListBlank Γs':ℕqNext:ℕexDt:ℕhb:baseExit q false a = some (s', qNext, true, exDt)h:simSubwords baseExit fuel qNext true (s' :: lw) rw (dt + exDt) = some (v, q', dir', dtOut)hex:ReachesIn M exDt (dirCfg qOf q false ((baseWord a).reverse +> leftSubTape baseWord lw l) (rightSubTape baseWord rw r)) (dirCfg qOf qNext true ((baseWord s').reverse +> leftSubTape baseWord lw l) (rightSubTape baseWord rw r))hle:dt + exDt ≤ dtOuthreach:match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dtOut - (dt + exDt)) (dirCfg qOf qNext true (leftSubTape baseWord (s' :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂)hsub:dtOut - dt = exDt + (dtOut - (dt + exDt))⊢ match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (exDt + (dtOut - (dt + exDt))) (dirCfg qOf q false (leftSubTape baseWord (a :: lw) l) (rightSubTape baseWord rw r)) (dirCfg qOf q' dir' l₂ r₂) All goals completed! 🐙

Soundness of runCompositeExit: lifts base-word exits to composite subword exits.

theorem runCompositeExit_sound {M : Machine Γ Λ} {qOf : ℕ → Λ} {baseWord : ℕ → List Γ} {baseExit : ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)} (hbase : BaseExitSound M qOf baseWord baseExit) {u : List ℕ} {q : ℕ} {dir : Bool} {v : List ℕ} {q' : ℕ} {dir' : Bool} {dt : ℕ} (h : runCompositeExit baseExit u q dir = some (v, q', dir', dt)) : WordExit M qOf (concatSubwords baseWord u) q dir (concatSubwords baseWord v) q' dir' dt := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitu:List ℕq:ℕdir:Boolv:List ℕq':ℕdir':Booldt:ℕh:runCompositeExit baseExit u q dir = some (v, q', dir', dt)⊢ WordExit M qOf (concatSubwords baseWord u) q dir (concatSubwords baseWord v) q' dir' dt Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitu:List ℕq:ℕdir:Boolv:List ℕq':ℕdir':Booldt:ℕh:runCompositeExit baseExit u q dir = some (v, q', dir', dt)l:ListBlank Γr:ListBlank Γ⊢ match placeSide dir (concatSubwords baseWord u) l r with | (l₁, r₁) => match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M dt (dirCfg qOf q dir l₁ r₁) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitu:List ℕq:ℕdir:Boolv:List ℕq':ℕdir':Booldt:ℕh:(withNat (u.length * 16 + 16) fun fuel ↦ if dir = true then simSubwords baseExit fuel q true [] u 0 else simSubwords baseExit fuel q false u.reverse [] 0) = some (v, q', dir', dt)l:ListBlank Γr:ListBlank Γ⊢ match placeSide dir (concatSubwords baseWord u) l r with | (l₁, r₁) => match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M dt (dirCfg qOf q dir l₁ r₁) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitu:List ℕq:ℕdir:Boolv:List ℕq':ℕdir':Booldt:ℕh:(if dir = true then simSubwords baseExit (u.length * 16 + 16) q true [] u 0 else simSubwords baseExit (u.length * 16 + 16) q false u.reverse [] 0) = some (v, q', dir', dt)l:ListBlank Γr:ListBlank Γ⊢ match placeSide dir (concatSubwords baseWord u) l r with | (l₁, r₁) => match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M dt (dirCfg qOf q dir l₁ r₁) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitu:List ℕq:ℕv:List ℕq':ℕdir':Booldt:ℕl:ListBlank Γr:ListBlank Γh:(if false = true then simSubwords baseExit (u.length * 16 + 16) q true [] u 0 else simSubwords baseExit (u.length * 16 + 16) q false u.reverse [] 0) = some (v, q', dir', dt)⊢ match placeSide false (concatSubwords baseWord u) l r with | (l₁, r₁) => match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M dt (dirCfg qOf q false l₁ r₁) (dirCfg qOf q' dir' l₂ r₂)Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitu:List ℕq:ℕv:List ℕq':ℕdir':Booldt:ℕl:ListBlank Γr:ListBlank Γh:(if true = true then simSubwords baseExit (u.length * 16 + 16) q true [] u 0 else simSubwords baseExit (u.length * 16 + 16) q false u.reverse [] 0) = some (v, q', dir', dt)⊢ match placeSide true (concatSubwords baseWord u) l r with | (l₁, r₁) => match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M dt (dirCfg qOf q true l₁ r₁) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitu:List ℕq:ℕv:List ℕq':ℕdir':Booldt:ℕl:ListBlank Γr:ListBlank Γh:(if false = true then simSubwords baseExit (u.length * 16 + 16) q true [] u 0 else simSubwords baseExit (u.length * 16 + 16) q false u.reverse [] 0) = some (v, q', dir', dt)⊢ match placeSide false (concatSubwords baseWord u) l r with | (l₁, r₁) => match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M dt (dirCfg qOf q false l₁ r₁) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitu:List ℕq:ℕv:List ℕq':ℕdir':Booldt:ℕl:ListBlank Γr:ListBlank Γh:simSubwords baseExit (u.length * 16 + 16) q false u.reverse [] 0 = some (v, q', dir', dt)⊢ match placeSide false (concatSubwords baseWord u) l r with | (l₁, r₁) => match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M dt (dirCfg qOf q false l₁ r₁) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitu:List ℕq:ℕv:List ℕq':ℕdir':Booldt:ℕl:ListBlank Γr:ListBlank Γh:simSubwords baseExit (u.length * 16 + 16) q false u.reverse [] 0 = some (v, q', dir', dt)left✝:0 ≤ dthr:match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dt - 0) (dirCfg qOf q false (leftSubTape baseWord u.reverse l) (rightSubTape baseWord [] r)) (dirCfg qOf q' dir' l₂ r₂)⊢ match placeSide false (concatSubwords baseWord u) l r with | (l₁, r₁) => match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M dt (dirCfg qOf q false l₁ r₁) (dirCfg qOf q' dir' l₂ r₂) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitu:List ℕq:ℕv:List ℕq':ℕdir':Booldt:ℕl:ListBlank Γr:ListBlank Γh:(if true = true then simSubwords baseExit (u.length * 16 + 16) q true [] u 0 else simSubwords baseExit (u.length * 16 + 16) q false u.reverse [] 0) = some (v, q', dir', dt)⊢ match placeSide true (concatSubwords baseWord u) l r with | (l₁, r₁) => match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M dt (dirCfg qOf q true l₁ r₁) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitu:List ℕq:ℕv:List ℕq':ℕdir':Booldt:ℕl:ListBlank Γr:ListBlank Γh:simSubwords baseExit (u.length * 16 + 16) q true [] u 0 = some (v, q', dir', dt)⊢ match placeSide true (concatSubwords baseWord u) l r with | (l₁, r₁) => match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M dt (dirCfg qOf q true l₁ r₁) (dirCfg qOf q' dir' l₂ r₂) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛbaseWord:ℕ → List ΓbaseExit:ℕ → Bool → ℕ → Option (ℕ × ℕ × Bool × ℕ)hbase:BaseExitSound M qOf baseWord baseExitu:List ℕq:ℕv:List ℕq':ℕdir':Booldt:ℕl:ListBlank Γr:ListBlank Γh:simSubwords baseExit (u.length * 16 + 16) q true [] u 0 = some (v, q', dir', dt)left✝:0 ≤ dthr:match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M (dt - 0) (dirCfg qOf q true (leftSubTape baseWord [] l) (rightSubTape baseWord u r)) (dirCfg qOf q' dir' l₂ r₂)⊢ match placeSide true (concatSubwords baseWord u) l r with | (l₁, r₁) => match placeSide (!dir') (concatSubwords baseWord v) l r with | (l₂, r₂) => ReachesIn M dt (dirCfg qOf q true l₁ r₁) (dirCfg qOf q' dir' l₂ r₂) All goals completed! 🐙

Concrete RLE Stack Configurations and Multi-Step Reachability

A concrete run of count copies of vocabulary word sym (sym = 0 denotes the blank word).

structure Run where

Vocabulary index of the repeated spatial word.

sym : ℕ

Repetition count (count ≥ 1 in normalized stacks).

count : ℕ deriving DecidableEq, Inhabited

Concrete RLE configuration with head state q, direction dir, and RLE half-tape stacks.

structure EntryCfg where

Current state index.

q : ℕ

Head direction (true = right, false = left).

dir : Bool

Left half-tape stack (nearest-to-head run first).

left : List Run

Right half-tape stack (nearest-to-head run first).

right : List Run deriving DecidableEq, Inhabited

Push count ≥ 1 copies of sym onto stk, suppressing leading blank runs (sym = 0 on []) and merging adjacent runs of the same word.

@[inline] def pushLit (sym count : ℕ) : List Run → List Run | [] => if Nat.beq sym 0 then [] else [⟨sym, count⟩] | ⟨ts, tc⟩ :: rest => if Nat.beq ts sym then withNat (tc + count) fun c ↦ ⟨ts, c⟩ :: rest else ⟨sym, count⟩ :: ⟨ts, tc⟩ :: rest

Safe push handling count = 0 as a no-op.

def pushRun (sym count : ℕ) (stk : List Run) : List Run := if Nat.beq count 0 then stk else pushLit sym count stk

Push a spatial left-to-right list of (sym, count) runs onto a left RLE stack so the last pair in the list sits closest to the head.

def pushRunsLeft : List (ℕ × ℕ) → List Run → List Run | [], stk => stk | (s, n) :: rest, stk => pushRunsLeft rest (pushRun s n stk)

Evaluate an RLE stack on side side (true = right stack using wordOf w ^ c, false = left stack using (wordOf w).reverse ^ c).

def evalSide (side : Bool) (wordOf : ℕ → List Γ) : List Run → ListBlank Γ | [] => default | ⟨w, c⟩ :: rest => if side then ListBlank.append (wordOf w ^ c) (evalSide true wordOf rest) else ListBlank.append ((wordOf w).reverse ^ c) (evalSide false wordOf rest)

Evaluate a concrete EntryCfg into a BusyBeaver.Cfg Γ Λ.

def evalEntryCfg (qOf : ℕ → Λ) (wordOf : ℕ → List Γ) (c : EntryCfg) : Cfg Γ Λ := dirCfg qOf c.q c.dir (evalSide false wordOf c.left) (evalSide true wordOf c.right)

Soundness of pushLit when wordOf 0 consists solely of blank symbols (default).

theorem evalSide_pushLit {wordOf : ℕ → List Γ} (hz : ∀ x ∈ wordOf 0, x = default) (side : Bool) (sym count : ℕ) (stk : List Run) : evalSide side wordOf (pushLit sym count stk) = if side then ListBlank.append (wordOf sym ^ count) (evalSide true wordOf stk) else ListBlank.append ((wordOf sym).reverse ^ count) (evalSide false wordOf stk) := Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕstk:List Run⊢ evalSide side wordOf (pushLit sym count stk) = if side = true then wordOf sym ^ count +> evalSide true wordOf stk else (wordOf sym).reverse ^ count +> evalSide false wordOf stk Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕstk:List RunhzRev:∀ x ∈ (wordOf 0).reverse, x = default⊢ evalSide side wordOf (pushLit sym count stk) = if side = true then wordOf sym ^ count +> evalSide true wordOf stk else (wordOf sym).reverse ^ count +> evalSide false wordOf stk cases stk with Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = default⊢ evalSide side wordOf (pushLit sym count []) = if side = true then wordOf sym ^ count +> evalSide true wordOf [] else (wordOf sym).reverse ^ count +> evalSide false wordOf [] Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = default⊢ evalSide side wordOf (if sym.beq 0 = true then [] else [{ sym := sym, count := count }]) = if side = true then wordOf sym ^ count +> evalSide true wordOf [] else (wordOf sym).reverse ^ count +> evalSide false wordOf [] Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaulths:sym.beq 0 = true⊢ evalSide side wordOf (if sym.beq 0 = true then [] else [{ sym := sym, count := count }]) = if side = true then wordOf sym ^ count +> evalSide true wordOf [] else (wordOf sym).reverse ^ count +> evalSide false wordOf []Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaulths:¬sym.beq 0 = true⊢ evalSide side wordOf (if sym.beq 0 = true then [] else [{ sym := sym, count := count }]) = if side = true then wordOf sym ^ count +> evalSide true wordOf [] else (wordOf sym).reverse ^ count +> evalSide false wordOf [] Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaulths:sym.beq 0 = true⊢ evalSide side wordOf (if sym.beq 0 = true then [] else [{ sym := sym, count := count }]) = if side = true then wordOf sym ^ count +> evalSide true wordOf [] else (wordOf sym).reverse ^ count +> evalSide false wordOf [] Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaulths:sym.beq 0 = trueh0:sym = 0⊢ evalSide side wordOf (if sym.beq 0 = true then [] else [{ sym := sym, count := count }]) = if side = true then wordOf sym ^ count +> evalSide true wordOf [] else (wordOf sym).reverse ^ count +> evalSide false wordOf [] Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaulths:Nat.beq 0 0 = true⊢ evalSide side wordOf (if Nat.beq 0 0 = true then [] else [{ sym := 0, count := count }]) = if side = true then wordOf 0 ^ count +> evalSide true wordOf [] else (wordOf 0).reverse ^ count +> evalSide false wordOf [] Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaulths:Nat.beq 0 0 = true⊢ evalSide false wordOf (if Nat.beq 0 0 = true then [] else [{ sym := 0, count := count }]) = if false = true then wordOf 0 ^ count +> evalSide true wordOf [] else (wordOf 0).reverse ^ count +> evalSide false wordOf []Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaulths:Nat.beq 0 0 = true⊢ evalSide true wordOf (if Nat.beq 0 0 = true then [] else [{ sym := 0, count := count }]) = if true = true then wordOf 0 ^ count +> evalSide true wordOf [] else (wordOf 0).reverse ^ count +> evalSide false wordOf [] Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaulths:Nat.beq 0 0 = true⊢ evalSide false wordOf (if Nat.beq 0 0 = true then [] else [{ sym := 0, count := count }]) = if false = true then wordOf 0 ^ count +> evalSide true wordOf [] else (wordOf 0).reverse ^ count +> evalSide false wordOf []Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaulths:Nat.beq 0 0 = true⊢ evalSide true wordOf (if Nat.beq 0 0 = true then [] else [{ sym := 0, count := count }]) = if true = true then wordOf 0 ^ count +> evalSide true wordOf [] else (wordOf 0).reverse ^ count +> evalSide false wordOf [] All goals completed! 🐙 Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaulths:¬sym.beq 0 = true⊢ evalSide side wordOf (if sym.beq 0 = true then [] else [{ sym := sym, count := count }]) = if side = true then wordOf sym ^ count +> evalSide true wordOf [] else (wordOf sym).reverse ^ count +> evalSide false wordOf [] Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaulths:¬sym.beq 0 = truehne:sym.beq 0 = false⊢ evalSide side wordOf (if sym.beq 0 = true then [] else [{ sym := sym, count := count }]) = if side = true then wordOf sym ^ count +> evalSide true wordOf [] else (wordOf sym).reverse ^ count +> evalSide false wordOf [] Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaulths:¬sym.beq 0 = truehne:sym.beq 0 = false⊢ evalSide side wordOf (if false = true then [] else [{ sym := sym, count := count }]) = if side = true then wordOf sym ^ count +> evalSide true wordOf [] else (wordOf sym).reverse ^ count +> evalSide false wordOf [] Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaulths:¬sym.beq 0 = truehne:sym.beq 0 = false⊢ evalSide false wordOf (if false = true then [] else [{ sym := sym, count := count }]) = if false = true then wordOf sym ^ count +> evalSide true wordOf [] else (wordOf sym).reverse ^ count +> evalSide false wordOf []Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaulths:¬sym.beq 0 = truehne:sym.beq 0 = false⊢ evalSide true wordOf (if false = true then [] else [{ sym := sym, count := count }]) = if true = true then wordOf sym ^ count +> evalSide true wordOf [] else (wordOf sym).reverse ^ count +> evalSide false wordOf [] Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaulths:¬sym.beq 0 = truehne:sym.beq 0 = false⊢ evalSide false wordOf (if false = true then [] else [{ sym := sym, count := count }]) = if false = true then wordOf sym ^ count +> evalSide true wordOf [] else (wordOf sym).reverse ^ count +> evalSide false wordOf []Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaulths:¬sym.beq 0 = truehne:sym.beq 0 = false⊢ evalSide true wordOf (if false = true then [] else [{ sym := sym, count := count }]) = if true = true then wordOf sym ^ count +> evalSide true wordOf [] else (wordOf sym).reverse ^ count +> evalSide false wordOf [] All goals completed! 🐙 Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaulttop:Runrest:List Run⊢ evalSide side wordOf (pushLit sym count (top :: rest)) = if side = true then wordOf sym ^ count +> evalSide true wordOf (top :: rest) else (wordOf sym).reverse ^ count +> evalSide false wordOf (top :: rest) Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaultrest:List Runts:ℕtc:ℕ⊢ evalSide side wordOf (pushLit sym count ({ sym := ts, count := tc } :: rest)) = if side = true then wordOf sym ^ count +> evalSide true wordOf ({ sym := ts, count := tc } :: rest) else (wordOf sym).reverse ^ count +> evalSide false wordOf ({ sym := ts, count := tc } :: rest) Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaultrest:List Runts:ℕtc:ℕ⊢ evalSide side wordOf (if ts.beq sym = true then withNat (tc + count) fun c ↦ { sym := ts, count := c } :: rest else { sym := sym, count := count } :: { sym := ts, count := tc } :: rest) = if side = true then wordOf sym ^ count +> evalSide true wordOf ({ sym := ts, count := tc } :: rest) else (wordOf sym).reverse ^ count +> evalSide false wordOf ({ sym := ts, count := tc } :: rest) Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaultrest:List Runts:ℕtc:ℕhs:ts.beq sym = true⊢ evalSide side wordOf (if ts.beq sym = true then withNat (tc + count) fun c ↦ { sym := ts, count := c } :: rest else { sym := sym, count := count } :: { sym := ts, count := tc } :: rest) = if side = true then wordOf sym ^ count +> evalSide true wordOf ({ sym := ts, count := tc } :: rest) else (wordOf sym).reverse ^ count +> evalSide false wordOf ({ sym := ts, count := tc } :: rest)Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaultrest:List Runts:ℕtc:ℕhs:¬ts.beq sym = true⊢ evalSide side wordOf (if ts.beq sym = true then withNat (tc + count) fun c ↦ { sym := ts, count := c } :: rest else { sym := sym, count := count } :: { sym := ts, count := tc } :: rest) = if side = true then wordOf sym ^ count +> evalSide true wordOf ({ sym := ts, count := tc } :: rest) else (wordOf sym).reverse ^ count +> evalSide false wordOf ({ sym := ts, count := tc } :: rest) Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaultrest:List Runts:ℕtc:ℕhs:ts.beq sym = true⊢ evalSide side wordOf (if ts.beq sym = true then withNat (tc + count) fun c ↦ { sym := ts, count := c } :: rest else { sym := sym, count := count } :: { sym := ts, count := tc } :: rest) = if side = true then wordOf sym ^ count +> evalSide true wordOf ({ sym := ts, count := tc } :: rest) else (wordOf sym).reverse ^ count +> evalSide false wordOf ({ sym := ts, count := tc } :: rest) Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaultrest:List Runts:ℕtc:ℕhs:ts.beq sym = trueheq:ts = sym⊢ evalSide side wordOf (if ts.beq sym = true then withNat (tc + count) fun c ↦ { sym := ts, count := c } :: rest else { sym := sym, count := count } :: { sym := ts, count := tc } :: rest) = if side = true then wordOf sym ^ count +> evalSide true wordOf ({ sym := ts, count := tc } :: rest) else (wordOf sym).reverse ^ count +> evalSide false wordOf ({ sym := ts, count := tc } :: rest) Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaultrest:List Runts:ℕtc:ℕhs:ts.beq ts = true⊢ evalSide side wordOf (if ts.beq ts = true then withNat (tc + count) fun c ↦ { sym := ts, count := c } :: rest else { sym := ts, count := count } :: { sym := ts, count := tc } :: rest) = if side = true then wordOf ts ^ count +> evalSide true wordOf ({ sym := ts, count := tc } :: rest) else (wordOf ts).reverse ^ count +> evalSide false wordOf ({ sym := ts, count := tc } :: rest) Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaultrest:List Runts:ℕtc:ℕhs:ts.beq ts = true⊢ evalSide side wordOf ({ sym := ts, count := tc + count } :: rest) = if side = true then wordOf ts ^ count +> evalSide true wordOf ({ sym := ts, count := tc } :: rest) else (wordOf ts).reverse ^ count +> evalSide false wordOf ({ sym := ts, count := tc } :: rest) Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaultrest:List Runts:ℕtc:ℕhs:ts.beq ts = true⊢ evalSide false wordOf ({ sym := ts, count := tc + count } :: rest) = if false = true then wordOf ts ^ count +> evalSide true wordOf ({ sym := ts, count := tc } :: rest) else (wordOf ts).reverse ^ count +> evalSide false wordOf ({ sym := ts, count := tc } :: rest)Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaultrest:List Runts:ℕtc:ℕhs:ts.beq ts = true⊢ evalSide true wordOf ({ sym := ts, count := tc + count } :: rest) = if true = true then wordOf ts ^ count +> evalSide true wordOf ({ sym := ts, count := tc } :: rest) else (wordOf ts).reverse ^ count +> evalSide false wordOf ({ sym := ts, count := tc } :: rest) Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaultrest:List Runts:ℕtc:ℕhs:ts.beq ts = true⊢ evalSide false wordOf ({ sym := ts, count := tc + count } :: rest) = if false = true then wordOf ts ^ count +> evalSide true wordOf ({ sym := ts, count := tc } :: rest) else (wordOf ts).reverse ^ count +> evalSide false wordOf ({ sym := ts, count := tc } :: rest)Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaultrest:List Runts:ℕtc:ℕhs:ts.beq ts = true⊢ evalSide true wordOf ({ sym := ts, count := tc + count } :: rest) = if true = true then wordOf ts ^ count +> evalSide true wordOf ({ sym := ts, count := tc } :: rest) else (wordOf ts).reverse ^ count +> evalSide false wordOf ({ sym := ts, count := tc } :: rest) All goals completed! 🐙 Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaultrest:List Runts:ℕtc:ℕhs:¬ts.beq sym = true⊢ evalSide side wordOf (if ts.beq sym = true then withNat (tc + count) fun c ↦ { sym := ts, count := c } :: rest else { sym := sym, count := count } :: { sym := ts, count := tc } :: rest) = if side = true then wordOf sym ^ count +> evalSide true wordOf ({ sym := ts, count := tc } :: rest) else (wordOf sym).reverse ^ count +> evalSide false wordOf ({ sym := ts, count := tc } :: rest) Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaultrest:List Runts:ℕtc:ℕhs:¬ts.beq sym = truehne:ts.beq sym = false⊢ evalSide side wordOf (if ts.beq sym = true then withNat (tc + count) fun c ↦ { sym := ts, count := c } :: rest else { sym := sym, count := count } :: { sym := ts, count := tc } :: rest) = if side = true then wordOf sym ^ count +> evalSide true wordOf ({ sym := ts, count := tc } :: rest) else (wordOf sym).reverse ^ count +> evalSide false wordOf ({ sym := ts, count := tc } :: rest) Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaultrest:List Runts:ℕtc:ℕhs:¬ts.beq sym = truehne:ts.beq sym = false⊢ evalSide side wordOf (if false = true then withNat (tc + count) fun c ↦ { sym := ts, count := c } :: rest else { sym := sym, count := count } :: { sym := ts, count := tc } :: rest) = if side = true then wordOf sym ^ count +> evalSide true wordOf ({ sym := ts, count := tc } :: rest) else (wordOf sym).reverse ^ count +> evalSide false wordOf ({ sym := ts, count := tc } :: rest) Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaultrest:List Runts:ℕtc:ℕhs:¬ts.beq sym = truehne:ts.beq sym = false⊢ evalSide false wordOf (if false = true then withNat (tc + count) fun c ↦ { sym := ts, count := c } :: rest else { sym := sym, count := count } :: { sym := ts, count := tc } :: rest) = if false = true then wordOf sym ^ count +> evalSide true wordOf ({ sym := ts, count := tc } :: rest) else (wordOf sym).reverse ^ count +> evalSide false wordOf ({ sym := ts, count := tc } :: rest)Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaultrest:List Runts:ℕtc:ℕhs:¬ts.beq sym = truehne:ts.beq sym = false⊢ evalSide true wordOf (if false = true then withNat (tc + count) fun c ↦ { sym := ts, count := c } :: rest else { sym := sym, count := count } :: { sym := ts, count := tc } :: rest) = if true = true then wordOf sym ^ count +> evalSide true wordOf ({ sym := ts, count := tc } :: rest) else (wordOf sym).reverse ^ count +> evalSide false wordOf ({ sym := ts, count := tc } :: rest) Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaultrest:List Runts:ℕtc:ℕhs:¬ts.beq sym = truehne:ts.beq sym = false⊢ evalSide false wordOf (if false = true then withNat (tc + count) fun c ↦ { sym := ts, count := c } :: rest else { sym := sym, count := count } :: { sym := ts, count := tc } :: rest) = if false = true then wordOf sym ^ count +> evalSide true wordOf ({ sym := ts, count := tc } :: rest) else (wordOf sym).reverse ^ count +> evalSide false wordOf ({ sym := ts, count := tc } :: rest)Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultsym:ℕcount:ℕhzRev:∀ x ∈ (wordOf 0).reverse, x = defaultrest:List Runts:ℕtc:ℕhs:¬ts.beq sym = truehne:ts.beq sym = false⊢ evalSide true wordOf (if false = true then withNat (tc + count) fun c ↦ { sym := ts, count := c } :: rest else { sym := sym, count := count } :: { sym := ts, count := tc } :: rest) = if true = true then wordOf sym ^ count +> evalSide true wordOf ({ sym := ts, count := tc } :: rest) else (wordOf sym).reverse ^ count +> evalSide false wordOf ({ sym := ts, count := tc } :: rest) All goals completed! 🐙theorem evalSide_pushRun {wordOf : ℕ → List Γ} (hz : ∀ x ∈ wordOf 0, x = default) (side : Bool) (sym count : ℕ) (stk : List Run) : evalSide side wordOf (pushRun sym count stk) = if side then ListBlank.append (wordOf sym ^ count) (evalSide true wordOf stk) else ListBlank.append ((wordOf sym).reverse ^ count) (evalSide false wordOf stk) := Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕstk:List Run⊢ evalSide side wordOf (pushRun sym count stk) = if side = true then wordOf sym ^ count +> evalSide true wordOf stk else (wordOf sym).reverse ^ count +> evalSide false wordOf stk Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕstk:List Run⊢ evalSide side wordOf (if count.beq 0 = true then stk else pushLit sym count stk) = if side = true then wordOf sym ^ count +> evalSide true wordOf stk else (wordOf sym).reverse ^ count +> evalSide false wordOf stk Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕstk:List Runhc:count.beq 0 = true⊢ evalSide side wordOf (if count.beq 0 = true then stk else pushLit sym count stk) = if side = true then wordOf sym ^ count +> evalSide true wordOf stk else (wordOf sym).reverse ^ count +> evalSide false wordOf stkΓ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕstk:List Runhc:¬count.beq 0 = true⊢ evalSide side wordOf (if count.beq 0 = true then stk else pushLit sym count stk) = if side = true then wordOf sym ^ count +> evalSide true wordOf stk else (wordOf sym).reverse ^ count +> evalSide false wordOf stk Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕstk:List Runhc:count.beq 0 = true⊢ evalSide side wordOf (if count.beq 0 = true then stk else pushLit sym count stk) = if side = true then wordOf sym ^ count +> evalSide true wordOf stk else (wordOf sym).reverse ^ count +> evalSide false wordOf stk Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕstk:List Runhc:count.beq 0 = trueh0:count = 0⊢ evalSide side wordOf (if count.beq 0 = true then stk else pushLit sym count stk) = if side = true then wordOf sym ^ count +> evalSide true wordOf stk else (wordOf sym).reverse ^ count +> evalSide false wordOf stk Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕstk:List Runhc:Nat.beq 0 0 = true⊢ evalSide side wordOf (if Nat.beq 0 0 = true then stk else pushLit sym 0 stk) = if side = true then wordOf sym ^ 0 +> evalSide true wordOf stk else (wordOf sym).reverse ^ 0 +> evalSide false wordOf stk Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultsym:ℕstk:List Runhc:Nat.beq 0 0 = true⊢ evalSide false wordOf (if Nat.beq 0 0 = true then stk else pushLit sym 0 stk) = if false = true then wordOf sym ^ 0 +> evalSide true wordOf stk else (wordOf sym).reverse ^ 0 +> evalSide false wordOf stkΓ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultsym:ℕstk:List Runhc:Nat.beq 0 0 = true⊢ evalSide true wordOf (if Nat.beq 0 0 = true then stk else pushLit sym 0 stk) = if true = true then wordOf sym ^ 0 +> evalSide true wordOf stk else (wordOf sym).reverse ^ 0 +> evalSide false wordOf stk Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultsym:ℕstk:List Runhc:Nat.beq 0 0 = true⊢ evalSide false wordOf (if Nat.beq 0 0 = true then stk else pushLit sym 0 stk) = if false = true then wordOf sym ^ 0 +> evalSide true wordOf stk else (wordOf sym).reverse ^ 0 +> evalSide false wordOf stkΓ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultsym:ℕstk:List Runhc:Nat.beq 0 0 = true⊢ evalSide true wordOf (if Nat.beq 0 0 = true then stk else pushLit sym 0 stk) = if true = true then wordOf sym ^ 0 +> evalSide true wordOf stk else (wordOf sym).reverse ^ 0 +> evalSide false wordOf stk All goals completed! 🐙 Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕstk:List Runhc:¬count.beq 0 = true⊢ evalSide side wordOf (if count.beq 0 = true then stk else pushLit sym count stk) = if side = true then wordOf sym ^ count +> evalSide true wordOf stk else (wordOf sym).reverse ^ count +> evalSide false wordOf stk Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕstk:List Runhc:¬count.beq 0 = truehne:count.beq 0 = false⊢ evalSide side wordOf (if count.beq 0 = true then stk else pushLit sym count stk) = if side = true then wordOf sym ^ count +> evalSide true wordOf stk else (wordOf sym).reverse ^ count +> evalSide false wordOf stk Γ:Type u_1inst✝:Inhabited ΓwordOf:ℕ → List Γhz:∀ x ∈ wordOf 0, x = defaultside:Boolsym:ℕcount:ℕstk:List Runhc:¬count.beq 0 = truehne:count.beq 0 = false⊢ evalSide side wordOf (if false = true then stk else pushLit sym count stk) = if side = true then wordOf sym ^ count +> evalSide true wordOf stk else (wordOf sym).reverse ^ count +> evalSide false wordOf stk All goals completed! 🐙

Soundness predicate for a single-step concrete RLE transition function stepFn.

def StepFnSound (M : Machine Γ Λ) (qOf : ℕ → Λ) (wordOf : ℕ → List Γ) (stepFn : ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)) : Prop := ∀ q dir l r dt c', stepFn q dir l r = some (dt, c') → ReachesIn M dt (evalEntryCfg qOf wordOf ⟨q, dir, l, r⟩) (evalEntryCfg qOf wordOf c')

Execute exactly fuel accelerated RLE steps using stepFn, accumulating exact TM steps.

def runExact (stepFn : ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)) : ℕ → ℕ → EntryCfg → Option (ℕ × EntryCfg) | 0, acc, c => some (acc, c) | fuel + 1, acc, ⟨q, dir, l, r⟩ => match stepFn q dir l r with | none => none | some (dt, c') => withNat (acc + dt) fun acc' ↦ runExact stepFn fuel acc' c'

Boolean check that runExact stepFn fuel 0 c yields (expDt, expC).

def checkRunExact (stepFn : ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)) (fuel expDt : ℕ) (c expC : EntryCfg) : Bool := match runExact stepFn fuel 0 c with | none => false | some (dt, c') => Nat.beq dt expDt && (c' == expC)private theorem runExact_sound_aux {M : Machine Γ Λ} {qOf : ℕ → Λ} {wordOf : ℕ → List Γ} {stepFn : ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)} (hs : StepFnSound M qOf wordOf stepFn) : ∀ (fuel acc : ℕ) (c : EntryCfg) (accOut : ℕ) (cOut : EntryCfg), runExact stepFn fuel acc c = some (accOut, cOut) → acc ≤ accOut ∧ ReachesIn M (accOut - acc) (evalEntryCfg qOf wordOf c) (evalEntryCfg qOf wordOf cOut) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFnacc:ℕc:EntryCfgaccOut:ℕcOut:EntryCfgh:runExact stepFn 0 acc c = some (accOut, cOut)⊢ acc ≤ accOut ∧ ReachesIn M (accOut - acc) (evalEntryCfg qOf wordOf c) (evalEntryCfg qOf wordOf cOut) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFnacc:ℕc:EntryCfgaccOut:ℕcOut:EntryCfgh:runExact stepFn 0 acc c = some (accOut, cOut)⊢ acc ≤ accOut ∧ ReachesIn M (accOut - acc) (evalEntryCfg qOf wordOf c) (evalEntryCfg qOf wordOf cOut) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFnacc:ℕc:EntryCfgaccOut:ℕcOut:EntryCfgh:acc = accOut ∧ c = cOut⊢ acc ≤ accOut ∧ ReachesIn M (accOut - acc) (evalEntryCfg qOf wordOf c) (evalEntryCfg qOf wordOf cOut) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFnacc:ℕc:EntryCfg⊢ acc ≤ acc ∧ ReachesIn M (acc - acc) (evalEntryCfg qOf wordOf c) (evalEntryCfg qOf wordOf c) exact ⟨Nat.le_refl acc, Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFnacc:ℕc:EntryCfg⊢ ReachesIn M (acc - acc) (evalEntryCfg qOf wordOf c) (evalEntryCfg qOf wordOf c) All goals completed! 🐙⟩ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFnfuel:ℕacc:ℕq:ℕdir:Booll:List Runr:List RunaccOut:ℕcOut:EntryCfgh:runExact stepFn (fuel + 1) acc { q := q, dir := dir, left := l, right := r } = some (accOut, cOut)⊢ acc ≤ accOut ∧ ReachesIn M (accOut - acc) (evalEntryCfg qOf wordOf { q := q, dir := dir, left := l, right := r }) (evalEntryCfg qOf wordOf cOut) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFnfuel:ℕacc:ℕq:ℕdir:Booll:List Runr:List RunaccOut:ℕcOut:EntryCfgh:runExact stepFn (fuel + 1) acc { q := q, dir := dir, left := l, right := r } = some (accOut, cOut)⊢ acc ≤ accOut ∧ ReachesIn M (accOut - acc) (evalEntryCfg qOf wordOf { q := q, dir := dir, left := l, right := r }) (evalEntryCfg qOf wordOf cOut) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFnfuel:ℕacc:ℕq:ℕdir:Booll:List Runr:List RunaccOut:ℕcOut:EntryCfgh:(match stepFn q dir l r with | none => none | some (dt, c') => withNat (acc + dt) fun acc' ↦ runExact stepFn fuel acc' c') = some (accOut, cOut)⊢ acc ≤ accOut ∧ ReachesIn M (accOut - acc) (evalEntryCfg qOf wordOf { q := q, dir := dir, left := l, right := r }) (evalEntryCfg qOf wordOf cOut) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFnfuel:ℕacc:ℕq:ℕdir:Booll:List Runr:List RunaccOut:ℕcOut:EntryCfgh:(match stepFn q dir l r with | none => none | some (dt, c') => withNat (acc + dt) fun acc' ↦ runExact stepFn fuel acc' c') = some (accOut, cOut)hst:stepFn q dir l r = none⊢ acc ≤ accOut ∧ ReachesIn M (accOut - acc) (evalEntryCfg qOf wordOf { q := q, dir := dir, left := l, right := r }) (evalEntryCfg qOf wordOf cOut)Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFnfuel:ℕacc:ℕq:ℕdir:Booll:List Runr:List RunaccOut:ℕcOut:EntryCfgh:(match stepFn q dir l r with | none => none | some (dt, c') => withNat (acc + dt) fun acc' ↦ runExact stepFn fuel acc' c') = some (accOut, cOut)dt:ℕc':EntryCfghst:stepFn q dir l r = some (dt, c')⊢ acc ≤ accOut ∧ ReachesIn M (accOut - acc) (evalEntryCfg qOf wordOf { q := q, dir := dir, left := l, right := r }) (evalEntryCfg qOf wordOf cOut) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFnfuel:ℕacc:ℕq:ℕdir:Booll:List Runr:List RunaccOut:ℕcOut:EntryCfgh:(match stepFn q dir l r with | none => none | some (dt, c') => withNat (acc + dt) fun acc' ↦ runExact stepFn fuel acc' c') = some (accOut, cOut)hst:stepFn q dir l r = none⊢ acc ≤ accOut ∧ ReachesIn M (accOut - acc) (evalEntryCfg qOf wordOf { q := q, dir := dir, left := l, right := r }) (evalEntryCfg qOf wordOf cOut) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFnfuel:ℕacc:ℕq:ℕdir:Booll:List Runr:List RunaccOut:ℕcOut:EntryCfgh:(match stepFn q dir l r with | none => none | some (dt, c') => withNat (acc + dt) fun acc' ↦ runExact stepFn fuel acc' c') = some (accOut, cOut)dt:ℕc':EntryCfghst:stepFn q dir l r = some (dt, c')⊢ acc ≤ accOut ∧ ReachesIn M (accOut - acc) (evalEntryCfg qOf wordOf { q := q, dir := dir, left := l, right := r }) (evalEntryCfg qOf wordOf cOut) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFnfuel:ℕacc:ℕq:ℕdir:Booll:List Runr:List RunaccOut:ℕcOut:EntryCfgdt:ℕc':EntryCfgh:(match some (dt, c') with | none => none | some (dt, c') => withNat (acc + dt) fun acc' ↦ runExact stepFn fuel acc' c') = some (accOut, cOut)hst:stepFn q dir l r = some (dt, c')⊢ acc ≤ accOut ∧ ReachesIn M (accOut - acc) (evalEntryCfg qOf wordOf { q := q, dir := dir, left := l, right := r }) (evalEntryCfg qOf wordOf cOut) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFnfuel:ℕacc:ℕq:ℕdir:Booll:List Runr:List RunaccOut:ℕcOut:EntryCfgdt:ℕc':EntryCfghst:stepFn q dir l r = some (dt, c')h:runExact stepFn fuel (acc + dt) c' = some (accOut, cOut)⊢ acc ≤ accOut ∧ ReachesIn M (accOut - acc) (evalEntryCfg qOf wordOf { q := q, dir := dir, left := l, right := r }) (evalEntryCfg qOf wordOf cOut) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFnfuel:ℕacc:ℕq:ℕdir:Booll:List Runr:List RunaccOut:ℕcOut:EntryCfgdt:ℕc':EntryCfghst:stepFn q dir l r = some (dt, c')h:runExact stepFn fuel (acc + dt) c' = some (accOut, cOut)hle:acc + dt ≤ accOuthrest:ReachesIn M (accOut - (acc + dt)) (evalEntryCfg qOf wordOf c') (evalEntryCfg qOf wordOf cOut)⊢ acc ≤ accOut ∧ ReachesIn M (accOut - acc) (evalEntryCfg qOf wordOf { q := q, dir := dir, left := l, right := r }) (evalEntryCfg qOf wordOf cOut) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFnfuel:ℕacc:ℕq:ℕdir:Booll:List Runr:List RunaccOut:ℕcOut:EntryCfgdt:ℕc':EntryCfghst:stepFn q dir l r = some (dt, c')h:runExact stepFn fuel (acc + dt) c' = some (accOut, cOut)hle:acc + dt ≤ accOuthrest:ReachesIn M (accOut - (acc + dt)) (evalEntryCfg qOf wordOf c') (evalEntryCfg qOf wordOf cOut)h1:ReachesIn M dt (evalEntryCfg qOf wordOf { q := q, dir := dir, left := l, right := r }) (evalEntryCfg qOf wordOf c')⊢ acc ≤ accOut ∧ ReachesIn M (accOut - acc) (evalEntryCfg qOf wordOf { q := q, dir := dir, left := l, right := r }) (evalEntryCfg qOf wordOf cOut) refine ⟨Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFnfuel:ℕacc:ℕq:ℕdir:Booll:List Runr:List RunaccOut:ℕcOut:EntryCfgdt:ℕc':EntryCfghst:stepFn q dir l r = some (dt, c')h:runExact stepFn fuel (acc + dt) c' = some (accOut, cOut)hle:acc + dt ≤ accOuthrest:ReachesIn M (accOut - (acc + dt)) (evalEntryCfg qOf wordOf c') (evalEntryCfg qOf wordOf cOut)h1:ReachesIn M dt (evalEntryCfg qOf wordOf { q := q, dir := dir, left := l, right := r }) (evalEntryCfg qOf wordOf c')⊢ acc ≤ accOut All goals completed! 🐙, ?_⟩ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFnfuel:ℕacc:ℕq:ℕdir:Booll:List Runr:List RunaccOut:ℕcOut:EntryCfgdt:ℕc':EntryCfghst:stepFn q dir l r = some (dt, c')h:runExact stepFn fuel (acc + dt) c' = some (accOut, cOut)hle:acc + dt ≤ accOuthrest:ReachesIn M (accOut - (acc + dt)) (evalEntryCfg qOf wordOf c') (evalEntryCfg qOf wordOf cOut)h1:ReachesIn M dt (evalEntryCfg qOf wordOf { q := q, dir := dir, left := l, right := r }) (evalEntryCfg qOf wordOf c')hsub:accOut - acc = dt + (accOut - (acc + dt))⊢ ReachesIn M (accOut - acc) (evalEntryCfg qOf wordOf { q := q, dir := dir, left := l, right := r }) (evalEntryCfg qOf wordOf cOut) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFnfuel:ℕacc:ℕq:ℕdir:Booll:List Runr:List RunaccOut:ℕcOut:EntryCfgdt:ℕc':EntryCfghst:stepFn q dir l r = some (dt, c')h:runExact stepFn fuel (acc + dt) c' = some (accOut, cOut)hle:acc + dt ≤ accOuthrest:ReachesIn M (accOut - (acc + dt)) (evalEntryCfg qOf wordOf c') (evalEntryCfg qOf wordOf cOut)h1:ReachesIn M dt (evalEntryCfg qOf wordOf { q := q, dir := dir, left := l, right := r }) (evalEntryCfg qOf wordOf c')hsub:accOut - acc = dt + (accOut - (acc + dt))⊢ ReachesIn M (dt + (accOut - (acc + dt))) (evalEntryCfg qOf wordOf { q := q, dir := dir, left := l, right := r }) (evalEntryCfg qOf wordOf cOut) All goals completed! 🐙

Inductive certificate tree chaining kernel-checked checkRunExact chunks with O(1) proof composition.

inductive EntryReaches (stepFn : ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)) : ℕ → EntryCfg → EntryCfg → Prop where

Zero-step reflexive reachability.

| refl (c : EntryCfg) : EntryReaches stepFn 0 c c

Single kernel-checked fuel-loop chunk.

| chunk {fuel dt : ℕ} {c c' : EntryCfg} : checkRunExact stepFn fuel dt c c' = true → EntryReaches stepFn dt c c'

Transitive composition of two chunks.

| trans {d₁ d₂ : ℕ} {c₁ c₂ c₃ : EntryCfg} : EntryReaches stepFn d₁ c₁ c₂ → EntryReaches stepFn d₂ c₂ c₃ → EntryReaches stepFn (d₁ + d₂) c₁ c₃

Cast the accumulated step sum d₁ to a normalized ℕ literal d₂ via Nat.beq.

theorem EntryReaches.cast_dt {stepFn : ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)} {d₁ d₂ : ℕ} {c₁ c₂ : EntryCfg} (h : EntryReaches stepFn d₁ c₁ c₂) (heq : Nat.beq d₁ d₂ = true) : EntryReaches stepFn d₂ c₁ c₂ := stepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)d₁:ℕd₂:ℕc₁:EntryCfgc₂:EntryCfgh:EntryReaches stepFn d₁ c₁ c₂heq:d₁.beq d₂ = true⊢ EntryReaches stepFn d₂ c₁ c₂ stepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)d₁:ℕd₂:ℕc₁:EntryCfgc₂:EntryCfgh:EntryReaches stepFn d₁ c₁ c₂heq:d₁.beq d₂ = truehd:d₁ = d₂⊢ EntryReaches stepFn d₂ c₁ c₂ All goals completed! 🐙

Boolean check that (d₁, c₁, c₂) matches target (d₂, c₁', c₂').

def checkEntryEnds (d₁ d₂ : ℕ) (c₁ c₁' c₂ c₂' : EntryCfg) : Bool := Nat.beq d₁ d₂ && (c₁ == c₁') && (c₂ == c₂')

Cast (d₁, c₁, c₂) to target expressions (d₂, c₁', c₂') via a kernel-checked Bool certificate, avoiding elaborator isDefEq unfolding on large closed-form milestones.

theorem EntryReaches.cast_ends {stepFn : ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)} {d₁ d₂ : ℕ} {c₁ c₁' c₂ c₂' : EntryCfg} (h : EntryReaches stepFn d₁ c₁ c₂) (heq : checkEntryEnds d₁ d₂ c₁ c₁' c₂ c₂' = true) : EntryReaches stepFn d₂ c₁' c₂' := stepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)d₁:ℕd₂:ℕc₁:EntryCfgc₁':EntryCfgc₂:EntryCfgc₂':EntryCfgh:EntryReaches stepFn d₁ c₁ c₂heq:checkEntryEnds d₁ d₂ c₁ c₁' c₂ c₂' = true⊢ EntryReaches stepFn d₂ c₁' c₂' stepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)d₁:ℕd₂:ℕc₁:EntryCfgc₁':EntryCfgc₂:EntryCfgc₂':EntryCfgh:EntryReaches stepFn d₁ c₁ c₂heq:(d₁.beq d₂ && c₁ == c₁' && c₂ == c₂') = true⊢ EntryReaches stepFn d₂ c₁' c₂' stepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)d₁:ℕd₂:ℕc₁:EntryCfgc₁':EntryCfgc₂:EntryCfgc₂':EntryCfgh:EntryReaches stepFn d₁ c₁ c₂heq:(d₁.beq d₂ = true ∧ (c₁ == c₁') = true) ∧ (c₂ == c₂') = true⊢ EntryReaches stepFn d₂ c₁' c₂' stepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)d₁:ℕd₂:ℕc₁:EntryCfgc₁':EntryCfgc₂:EntryCfgc₂':EntryCfgh:EntryReaches stepFn d₁ c₁ c₂heq:(d₁.beq d₂ = true ∧ (c₁ == c₁') = true) ∧ (c₂ == c₂') = truehd:d₁ = d₂⊢ EntryReaches stepFn d₂ c₁' c₂' stepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)d₁:ℕd₂:ℕc₁:EntryCfgc₁':EntryCfgc₂:EntryCfgc₂':EntryCfgh:EntryReaches stepFn d₁ c₁ c₂heq:(d₁.beq d₂ = true ∧ (c₁ == c₁') = true) ∧ (c₂ == c₂') = truehd:d₁ = d₂hc1:c₁ = c₁'⊢ EntryReaches stepFn d₂ c₁' c₂' stepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)d₁:ℕd₂:ℕc₁:EntryCfgc₁':EntryCfgc₂:EntryCfgc₂':EntryCfgh:EntryReaches stepFn d₁ c₁ c₂heq:(d₁.beq d₂ = true ∧ (c₁ == c₁') = true) ∧ (c₂ == c₂') = truehd:d₁ = d₂hc1:c₁ = c₁'hc2:c₂ = c₂'⊢ EntryReaches stepFn d₂ c₁' c₂' stepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)d₁:ℕc₁:EntryCfgc₁':EntryCfgc₂:EntryCfgc₂':EntryCfgh:EntryReaches stepFn d₁ c₁ c₂hc1:c₁ = c₁'hc2:c₂ = c₂'heq:(d₁.beq d₁ = true ∧ (c₁ == c₁') = true) ∧ (c₂ == c₂') = true⊢ EntryReaches stepFn d₁ c₁' c₂'; stepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)d₁:ℕc₁:EntryCfgc₂:EntryCfgc₂':EntryCfgh:EntryReaches stepFn d₁ c₁ c₂hc2:c₂ = c₂'heq:(d₁.beq d₁ = true ∧ (c₁ == c₁) = true) ∧ (c₂ == c₂') = true⊢ EntryReaches stepFn d₁ c₁ c₂'; stepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)d₁:ℕc₁:EntryCfgc₂:EntryCfgh:EntryReaches stepFn d₁ c₁ c₂heq:(d₁.beq d₁ = true ∧ (c₁ == c₁) = true) ∧ (c₂ == c₂) = true⊢ EntryReaches stepFn d₁ c₁ c₂ All goals completed! 🐙

Soundness of EntryReaches: translates any EntryReaches derivation into ReachesIn M.

theorem EntryReaches.sound {M : Machine Γ Λ} {qOf : ℕ → Λ} {wordOf : ℕ → List Γ} {stepFn : ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)} (hs : StepFnSound M qOf wordOf stepFn) {dt : ℕ} {c₁ c₂ : EntryCfg} (h : EntryReaches stepFn dt c₁ c₂) : ReachesIn M dt (evalEntryCfg qOf wordOf c₁) (evalEntryCfg qOf wordOf c₂) := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFndt:ℕc₁:EntryCfgc₂:EntryCfgh:EntryReaches stepFn dt c₁ c₂⊢ ReachesIn M dt (evalEntryCfg qOf wordOf c₁) (evalEntryCfg qOf wordOf c₂) induction h with Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFndt:ℕc₁:EntryCfgc₂:EntryCfgc:EntryCfg⊢ ReachesIn M 0 (evalEntryCfg qOf wordOf c) (evalEntryCfg qOf wordOf c) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFndt:ℕc₁:EntryCfgc₂:EntryCfgfuel:ℕd:ℕc:EntryCfgc':EntryCfghc:checkRunExact stepFn fuel d c c' = true⊢ ReachesIn M d (evalEntryCfg qOf wordOf c) (evalEntryCfg qOf wordOf c') Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFndt:ℕc₁:EntryCfgc₂:EntryCfgfuel:ℕd:ℕc:EntryCfgc':EntryCfghc:(match runExact stepFn fuel 0 c with | none => false | some (dt, c'_1) => dt.beq d && c'_1 == c') = true⊢ ReachesIn M d (evalEntryCfg qOf wordOf c) (evalEntryCfg qOf wordOf c') Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFndt:ℕc₁:EntryCfgc₂:EntryCfgfuel:ℕd:ℕc:EntryCfgc':EntryCfghc:(match runExact stepFn fuel 0 c with | none => false | some (dt, c'_1) => dt.beq d && c'_1 == c') = truehr:runExact stepFn fuel 0 c = none⊢ ReachesIn M d (evalEntryCfg qOf wordOf c) (evalEntryCfg qOf wordOf c')Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFndt:ℕc₁:EntryCfgc₂:EntryCfgfuel:ℕd:ℕc:EntryCfgc':EntryCfghc:(match runExact stepFn fuel 0 c with | none => false | some (dt, c'_1) => dt.beq d && c'_1 == c') = truedOut:ℕcOut:EntryCfghr:runExact stepFn fuel 0 c = some (dOut, cOut)⊢ ReachesIn M d (evalEntryCfg qOf wordOf c) (evalEntryCfg qOf wordOf c') Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFndt:ℕc₁:EntryCfgc₂:EntryCfgfuel:ℕd:ℕc:EntryCfgc':EntryCfghc:(match runExact stepFn fuel 0 c with | none => false | some (dt, c'_1) => dt.beq d && c'_1 == c') = truehr:runExact stepFn fuel 0 c = none⊢ ReachesIn M d (evalEntryCfg qOf wordOf c) (evalEntryCfg qOf wordOf c') All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFndt:ℕc₁:EntryCfgc₂:EntryCfgfuel:ℕd:ℕc:EntryCfgc':EntryCfghc:(match runExact stepFn fuel 0 c with | none => false | some (dt, c'_1) => dt.beq d && c'_1 == c') = truedOut:ℕcOut:EntryCfghr:runExact stepFn fuel 0 c = some (dOut, cOut)⊢ ReachesIn M d (evalEntryCfg qOf wordOf c) (evalEntryCfg qOf wordOf c') Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFndt:ℕc₁:EntryCfgc₂:EntryCfgfuel:ℕd:ℕc:EntryCfgc':EntryCfgdOut:ℕcOut:EntryCfghc:(match some (dOut, cOut) with | none => false | some (dt, c'_1) => dt.beq d && c'_1 == c') = truehr:runExact stepFn fuel 0 c = some (dOut, cOut)⊢ ReachesIn M d (evalEntryCfg qOf wordOf c) (evalEntryCfg qOf wordOf c') Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFndt:ℕc₁:EntryCfgc₂:EntryCfgfuel:ℕd:ℕc:EntryCfgc':EntryCfgdOut:ℕcOut:EntryCfghr:runExact stepFn fuel 0 c = some (dOut, cOut)hc:dOut.beq d = true ∧ (cOut == c') = true⊢ ReachesIn M d (evalEntryCfg qOf wordOf c) (evalEntryCfg qOf wordOf c') Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFndt:ℕc₁:EntryCfgc₂:EntryCfgfuel:ℕd:ℕc:EntryCfgc':EntryCfgdOut:ℕcOut:EntryCfghr:runExact stepFn fuel 0 c = some (dOut, cOut)hc:dOut.beq d = true ∧ (cOut == c') = truehd:dOut = d⊢ ReachesIn M d (evalEntryCfg qOf wordOf c) (evalEntryCfg qOf wordOf c') Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFndt:ℕc₁:EntryCfgc₂:EntryCfgfuel:ℕd:ℕc:EntryCfgc':EntryCfgdOut:ℕcOut:EntryCfghr:runExact stepFn fuel 0 c = some (dOut, cOut)hc:dOut.beq d = true ∧ (cOut == c') = truehd:dOut = dhcEq:cOut = c'⊢ ReachesIn M d (evalEntryCfg qOf wordOf c) (evalEntryCfg qOf wordOf c') Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFndt:ℕc₁:EntryCfgc₂:EntryCfgfuel:ℕc:EntryCfgc':EntryCfgdOut:ℕcOut:EntryCfghr:runExact stepFn fuel 0 c = some (dOut, cOut)hcEq:cOut = c'hc:dOut.beq dOut = true ∧ (cOut == c') = true⊢ ReachesIn M dOut (evalEntryCfg qOf wordOf c) (evalEntryCfg qOf wordOf c') Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFndt:ℕc₁:EntryCfgc₂:EntryCfgfuel:ℕc:EntryCfgdOut:ℕcOut:EntryCfghr:runExact stepFn fuel 0 c = some (dOut, cOut)hc:dOut.beq dOut = true ∧ (cOut == cOut) = true⊢ ReachesIn M dOut (evalEntryCfg qOf wordOf c) (evalEntryCfg qOf wordOf cOut) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛqOf:ℕ → ΛwordOf:ℕ → List ΓstepFn:ℕ → Bool → List Run → List Run → Option (ℕ × EntryCfg)hs:StepFnSound M qOf wordOf stepFndt:ℕc₁:EntryCfgc₂:EntryCfgd₁✝:ℕd₂✝:ℕc₁✝:EntryCfgc₂✝:EntryCfgc₃✝:EntryCfga✝¹:EntryReaches stepFn d₁✝ c₁✝ c₂✝a✝:EntryReaches stepFn d₂✝ c₂✝ c₃✝ih₁:ReachesIn M d₁✝ (evalEntryCfg qOf wordOf c₁✝) (evalEntryCfg qOf wordOf c₂✝)ih₂:ReachesIn M d₂✝ (evalEntryCfg qOf wordOf c₂✝) (evalEntryCfg qOf wordOf c₃✝)⊢ ReachesIn M (d₁✝ + d₂✝) (evalEntryCfg qOf wordOf c₁✝) (evalEntryCfg qOf wordOf c₃✝) All goals completed! 🐙end WordSemanticsend BusyBeaver.WordRLEend