Imports
/- Copyright (c) 2026 Google LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. -/ module public import BusyBeaver.Basic public import BusyBeaver.Calculi.Counter import Mathlib.Data.List.Basic import Mathlib.Data.Nat.Basic import Mathlib.Tactic.Linarith import Mathlib.Tactic.Ring
@[expose] public sectionopen Mathlib Relation Nat Turing BusyBeavernamespace BusyBeaver.WordRunStackvariable {Γ : Type*} [Inhabited Γ]theorem append_assoc_blank (u v : List Γ) (lb : ListBlank Γ) : (u ++ v) +> lb = u +> (v +> lb) := Γ:Type u_1inst✝:Inhabited Γu:List Γv:List Γlb:ListBlank Γ⊢ (u ++ v) +> lb = u +> v +> lb induction u with Γ:Type u_1inst✝:Inhabited Γv:List Γlb:ListBlank Γ⊢ ([] ++ v) +> lb = [] +> v +> lb All goals completed! 🐙 Γ:Type u_1inst✝:Inhabited Γv:List Γlb:ListBlank Γx:Γxs:List Γih:(xs ++ v) +> lb = xs +> v +> lb⊢ (x :: xs ++ v) +> lb = (x :: xs) +> v +> lb All goals completed! 🐙theorem nth_cons_zero (x : Γ) (t : ListBlank Γ) : (x >> t).nth 0 = x := Γ:Type u_1inst✝:Inhabited Γx:Γt:ListBlank Γ⊢ (x >> t).nth 0 = x All goals completed! 🐙theorem nth_cons_succ (x : Γ) (t : ListBlank Γ) (i : ℕ) : (x >> t).nth (i + 1) = t.nth i := Γ:Type u_1inst✝:Inhabited Γx:Γt:ListBlank Γi:ℕ⊢ (x >> t).nth (i + 1) = t.nth i All goals completed! 🐙theorem nth_cons_one (x : Γ) (t : ListBlank Γ) : (x >> t).nth 1 = t.nth 0 := nth_cons_succ x t 0theorem nth_cons_two (x : Γ) (t : ListBlank Γ) : (x >> t).nth 2 = t.nth 1 := nth_cons_succ x t 1theorem nth_cons_three (x : Γ) (t : ListBlank Γ) : (x >> t).nth 3 = t.nth 2 := nth_cons_succ x t 2theorem nth_cons_four (x : Γ) (t : ListBlank Γ) : (x >> t).nth 4 = t.nth 3 := nth_cons_succ x t 3theorem nth_default : ∀ i : ℕ, (default : ListBlank Γ).nth i = default Γ:Type u_1inst✝:Inhabited Γ⊢ default.nth 0 = default Γ:Type u_1inst✝:Inhabited Γ⊢ default.nth 0 = default Γ:Type u_1inst✝:Inhabited Γ⊢ default.head = default All goals completed! 🐙 Γ:Type u_1inst✝:Inhabited Γi:ℕ⊢ default.nth (i + 1) = default Γ:Type u_1inst✝:Inhabited Γi:ℕ⊢ default.nth (i + 1) = default Γ:Type u_1inst✝:Inhabited Γi:ℕ⊢ default.tail.nth i = default Γ:Type u_1inst✝:Inhabited Γi:ℕhtail:default.tail = default⊢ default.tail.nth i = default Γ:Type u_1inst✝:Inhabited Γi:ℕhtail:default.tail = default⊢ default.nth i = default All goals completed! 🐙

Extracts the first n symbols of a ListBlank Γ.

def takeBlank {Γ : Type*} [Inhabited Γ] : ℕ → ListBlank Γ → List Γ | 0, _ => [] | n + 1, lb => lb.head :: takeBlank n lb.tailtheorem takeBlank_length : ∀ (n : ℕ) (lb : ListBlank Γ), (takeBlank n lb).length = n | 0, _ => rfl Γ:Type u_1inst✝:Inhabited Γn:ℕlb:ListBlank Γ⊢ (takeBlank (n + 1) lb).length = n + 1 Γ:Type u_1inst✝:Inhabited Γn:ℕlb:ListBlank Γ⊢ (takeBlank (n + 1) lb).length = n + 1 All goals completed! 🐙theorem nth_takeBlank_append_of_lt : ∀ (n : ℕ) (lb : ListBlank Γ) (v : List Γ) (t : ListBlank Γ) (i : ℕ), i < n → ((takeBlank n lb ++ v) +> t).nth i = lb.nth i | 0, _, _, _, _, h => nomatch h Γ:Type u_1inst✝:Inhabited Γn:ℕlb:ListBlank Γv:List Γt:ListBlank Γx✝:0 < n + 1⊢ ((takeBlank (n + 1) lb ++ v) +> t).nth 0 = lb.nth 0 Γ:Type u_1inst✝:Inhabited Γn:ℕlb:ListBlank Γv:List Γt:ListBlank Γx✝:0 < n + 1⊢ ((takeBlank (n + 1) lb ++ v) +> t).nth 0 = lb.nth 0 Γ:Type u_1inst✝:Inhabited Γn:ℕlb:ListBlank Γv:List Γt:ListBlank Γx✝:0 < n + 1⊢ (lb.head >> (takeBlank n lb.tail ++ v) +> t).nth 0 = lb.nth 0 All goals completed! 🐙 Γ:Type u_1inst✝:Inhabited Γn:ℕlb:ListBlank Γv:List Γt:ListBlank Γi:ℕh:i + 1 < n + 1⊢ ((takeBlank (n + 1) lb ++ v) +> t).nth (i + 1) = lb.nth (i + 1) Γ:Type u_1inst✝:Inhabited Γn:ℕlb:ListBlank Γv:List Γt:ListBlank Γi:ℕh:i + 1 < n + 1⊢ ((takeBlank (n + 1) lb ++ v) +> t).nth (i + 1) = lb.nth (i + 1) Γ:Type u_1inst✝:Inhabited Γn:ℕlb:ListBlank Γv:List Γt:ListBlank Γi:ℕh:i + 1 < n + 1⊢ (lb.head >> (takeBlank n lb.tail ++ v) +> t).nth (i + 1) = lb.nth (i + 1) Γ:Type u_1inst✝:Inhabited Γn:ℕlb:ListBlank Γv:List Γt:ListBlank Γi:ℕh:i + 1 < n + 1⊢ ((takeBlank n lb.tail ++ v) +> t).nth i = lb.tail.nth i All goals completed! 🐙theorem nth_takeBlank_append_add : ∀ (n : ℕ) (lb : ListBlank Γ) (v : List Γ) (t : ListBlank Γ) (j : ℕ), ((takeBlank n lb ++ v) +> t).nth (n + j) = (v +> t).nth j Γ:Type u_1inst✝:Inhabited Γx✝³:ListBlank Γx✝²:List Γx✝¹:ListBlank Γx✝:ℕ⊢ ((takeBlank 0 x✝³ ++ x✝²) +> x✝¹).nth (0 + x✝) = (x✝² +> x✝¹).nth x✝ Γ:Type u_1inst✝:Inhabited Γx✝³:ListBlank Γx✝²:List Γx✝¹:ListBlank Γx✝:ℕ⊢ ((takeBlank 0 x✝³ ++ x✝²) +> x✝¹).nth (0 + x✝) = (x✝² +> x✝¹).nth x✝ All goals completed! 🐙 Γ:Type u_1inst✝:Inhabited Γn:ℕlb:ListBlank Γv:List Γt:ListBlank Γj:ℕ⊢ ((takeBlank (n + 1) lb ++ v) +> t).nth (n + 1 + j) = (v +> t).nth j Γ:Type u_1inst✝:Inhabited Γn:ℕlb:ListBlank Γv:List Γt:ListBlank Γj:ℕ⊢ ((takeBlank (n + 1) lb ++ v) +> t).nth (n + 1 + j) = (v +> t).nth j Γ:Type u_1inst✝:Inhabited Γn:ℕlb:ListBlank Γv:List Γt:ListBlank Γj:ℕ⊢ (lb.head >> (takeBlank n lb.tail ++ v) +> t).nth (n + 1 + j) = (v +> t).nth j Γ:Type u_1inst✝:Inhabited Γn:ℕlb:ListBlank Γv:List Γt:ListBlank Γj:ℕ⊢ ((takeBlank n lb.tail ++ v) +> t).nth (n + j) = (v +> t).nth j All goals completed! 🐙theorem nth_append_of_lt : ∀ (v : List Γ) (t : ListBlank Γ) (j : ℕ), j < v.length → (v +> t).nth j = v.getD j default | [], _, _, h => nomatch h Γ:Type u_1inst✝:Inhabited Γx:Γv:List Γt:ListBlank Γx✝:0 < (x :: v).length⊢ ((x :: v) +> t).nth 0 = (x :: v).getD 0 default Γ:Type u_1inst✝:Inhabited Γx:Γv:List Γt:ListBlank Γx✝:0 < (x :: v).length⊢ ((x :: v) +> t).nth 0 = (x :: v).getD 0 default Γ:Type u_1inst✝:Inhabited Γx:Γv:List Γt:ListBlank Γx✝:0 < (x :: v).length⊢ (x >> v +> t).nth 0 = x All goals completed! 🐙 Γ:Type u_1inst✝:Inhabited Γx:Γv:List Γt:ListBlank Γj:ℕh:j + 1 < (x :: v).length⊢ ((x :: v) +> t).nth (j + 1) = (x :: v).getD (j + 1) default Γ:Type u_1inst✝:Inhabited Γx:Γv:List Γt:ListBlank Γj:ℕh:j + 1 < (x :: v).length⊢ ((x :: v) +> t).nth (j + 1) = (x :: v).getD (j + 1) default Γ:Type u_1inst✝:Inhabited Γx:Γv:List Γt:ListBlank Γj:ℕh:j + 1 < (x :: v).length⊢ (x >> v +> t).nth (j + 1) = v.getD j default Γ:Type u_1inst✝:Inhabited Γx:Γv:List Γt:ListBlank Γj:ℕh:j + 1 < (x :: v).length⊢ (v +> t).nth j = v.getD j default All goals completed! 🐙def NoFactor (pat : List Γ) (t : ListBlank Γ) : Prop := ∀ i : ℕ, ¬ ∀ j : ℕ, j < pat.length → t.nth (i + j) = pat.getD j defaulttheorem noFactor_default (pat : List Γ) (j : ℕ) (hj : j < pat.length) (hne : pat.getD j default ≠ default) : NoFactor pat (default : ListBlank Γ) := Γ:Type u_1inst✝:Inhabited Γpat:List Γj:ℕhj:j < pat.lengthhne:pat.getD j default ≠ default⊢ NoFactor pat default Γ:Type u_1inst✝:Inhabited Γpat:List Γj:ℕhj:j < pat.lengthhne:pat.getD j default ≠ defaulti:ℕh:∀ j < pat.length, default.nth (i + j) = pat.getD j default⊢ False All goals completed! 🐙theorem noFactor_cons_of_nth_ne (pat : List Γ) (x : Γ) (t : ListBlank Γ) (ht : NoFactor pat t) (j : ℕ) (hj : j < pat.length) (hne : (x >> t).nth j ≠ pat.getD j default) : NoFactor pat (x >> t) := Γ:Type u_1inst✝:Inhabited Γpat:List Γx:Γt:ListBlank Γht:NoFactor pat tj:ℕhj:j < pat.lengthhne:(x >> t).nth j ≠ pat.getD j default⊢ NoFactor pat (x >> t) Γ:Type u_1inst✝:Inhabited Γpat:List Γx:Γt:ListBlank Γht:NoFactor pat tj:ℕhj:j < pat.lengthhne:(x >> t).nth j ≠ pat.getD j defaulti:ℕh:∀ j < pat.length, (x >> t).nth (i + j) = pat.getD j default⊢ False cases i with Γ:Type u_1inst✝:Inhabited Γpat:List Γx:Γt:ListBlank Γht:NoFactor pat tj:ℕhj:j < pat.lengthhne:(x >> t).nth j ≠ pat.getD j defaulth:∀ j < pat.length, (x >> t).nth (0 + j) = pat.getD j default⊢ False exact hne (Γ:Type u_1inst✝:Inhabited Γpat:List Γx:Γt:ListBlank Γht:NoFactor pat tj:ℕhj:j < pat.lengthhne:(x >> t).nth j ≠ pat.getD j defaulth:∀ j < pat.length, (x >> t).nth (0 + j) = pat.getD j default⊢ (x >> t).nth j = pat.getD j default All goals completed! 🐙) Γ:Type u_1inst✝:Inhabited Γpat:List Γx:Γt:ListBlank Γht:NoFactor pat tj:ℕhj:j < pat.lengthhne:(x >> t).nth j ≠ pat.getD j defaulti:ℕh:∀ j < pat.length, (x >> t).nth (i + 1 + j) = pat.getD j default⊢ False Γ:Type u_1inst✝:Inhabited Γpat:List Γx:Γt:ListBlank Γht:NoFactor pat tj:ℕhj:j < pat.lengthhne:(x >> t).nth j ≠ pat.getD j defaulti:ℕh:∀ j < pat.length, (x >> t).nth (i + 1 + j) = pat.getD j default⊢ ∀ j < pat.length, t.nth (i + j) = pat.getD j default Γ:Type u_1inst✝:Inhabited Γpat:List Γx:Γt:ListBlank Γht:NoFactor pat tj:ℕhj:j < pat.lengthhne:(x >> t).nth j ≠ pat.getD j defaulti:ℕh:∀ j < pat.length, (x >> t).nth (i + 1 + j) = pat.getD j defaultj':ℕhj':j' < pat.length⊢ t.nth (i + j') = pat.getD j' default Γ:Type u_1inst✝:Inhabited Γpat:List Γx:Γt:ListBlank Γht:NoFactor pat tj:ℕhj:j < pat.lengthhne:(x >> t).nth j ≠ pat.getD j defaulti:ℕh:∀ j < pat.length, (x >> t).nth (i + 1 + j) = pat.getD j defaultj':ℕhj':j' < pat.lengththis:(x >> t).nth (i + 1 + j') = pat.getD j' default⊢ t.nth (i + j') = pat.getD j' default All goals completed! 🐙theorem isNowhereDenseFamily_of_noFactor {S : Type*} (Valid : S → Prop) (enc : S → ListBlank Γ) (pat : List Γ) (hforb : ∀ s, Valid s → NoFactor pat (enc s)) : IsNowhereDenseFamily Valid enc := Γ:Type u_1inst✝:Inhabited ΓS:Type u_2Valid:S → Propenc:S → ListBlank Γpat:List Γhforb:∀ (s : S), Valid s → NoFactor pat (enc s)⊢ IsNowhereDenseFamily Valid enc Γ:Type u_1inst✝:Inhabited ΓS:Type u_2Valid:S → Propenc:S → ListBlank Γpat:List Γhforb:∀ (s : S), Valid s → NoFactor pat (enc s)s:Shs:Valid sn:ℕ⊢ ∃ bad, (∀ i < n, bad.nth i = (enc s).nth i) ∧ ∀ (s' : S), Valid s' → enc s' ≠ bad Γ:Type u_1inst✝:Inhabited ΓS:Type u_2Valid:S → Propenc:S → ListBlank Γpat:List Γhforb:∀ (s : S), Valid s → NoFactor pat (enc s)s:Shs:Valid sn:ℕ⊢ ∀ i < n, ((takeBlank n (enc s) ++ pat) +> default).nth i = (enc s).nth iΓ:Type u_1inst✝:Inhabited ΓS:Type u_2Valid:S → Propenc:S → ListBlank Γpat:List Γhforb:∀ (s : S), Valid s → NoFactor pat (enc s)s:Shs:Valid sn:ℕ⊢ ∀ (s' : S), Valid s' → enc s' ≠ (takeBlank n (enc s) ++ pat) +> default Γ:Type u_1inst✝:Inhabited ΓS:Type u_2Valid:S → Propenc:S → ListBlank Γpat:List Γhforb:∀ (s : S), Valid s → NoFactor pat (enc s)s:Shs:Valid sn:ℕ⊢ ∀ i < n, ((takeBlank n (enc s) ++ pat) +> default).nth i = (enc s).nth i Γ:Type u_1inst✝:Inhabited ΓS:Type u_2Valid:S → Propenc:S → ListBlank Γpat:List Γhforb:∀ (s : S), Valid s → NoFactor pat (enc s)s:Shs:Valid sn:ℕi:ℕhi:i < n⊢ ((takeBlank n (enc s) ++ pat) +> default).nth i = (enc s).nth i All goals completed! 🐙 Γ:Type u_1inst✝:Inhabited ΓS:Type u_2Valid:S → Propenc:S → ListBlank Γpat:List Γhforb:∀ (s : S), Valid s → NoFactor pat (enc s)s:Shs:Valid sn:ℕ⊢ ∀ (s' : S), Valid s' → enc s' ≠ (takeBlank n (enc s) ++ pat) +> default Γ:Type u_1inst✝:Inhabited ΓS:Type u_2Valid:S → Propenc:S → ListBlank Γpat:List Γhforb:∀ (s : S), Valid s → NoFactor pat (enc s)s:Shs:Valid sn:ℕs':Shs':Valid s'heq:enc s' = (takeBlank n (enc s) ++ pat) +> default⊢ False Γ:Type u_1inst✝:Inhabited ΓS:Type u_2Valid:S → Propenc:S → ListBlank Γpat:List Γhforb:∀ (s : S), Valid s → NoFactor pat (enc s)s:Shs:Valid sn:ℕs':Shs':Valid s'heq:enc s' = (takeBlank n (enc s) ++ pat) +> default⊢ ∀ j < pat.length, (enc s').nth (n + j) = pat.getD j default Γ:Type u_1inst✝:Inhabited ΓS:Type u_2Valid:S → Propenc:S → ListBlank Γpat:List Γhforb:∀ (s : S), Valid s → NoFactor pat (enc s)s:Shs:Valid sn:ℕs':Shs':Valid s'heq:enc s' = (takeBlank n (enc s) ++ pat) +> defaultj:ℕhj:j < pat.length⊢ (enc s').nth (n + j) = pat.getD j default All goals completed! 🐙theorem isNowhereDenseHalf_of_noFactor {S : Type*} (Valid : S → Prop) (segs : S → List (SegRegionKind Γ)) (pat : List Γ) (hforb : ∀ s, Valid s → NoFactor pat (evalSegmentedHalf (segs s))) : IsNowhereDenseHalf Valid segs := isNowhereDenseFamily_of_noFactor Valid (fun s => evalSegmentedHalf (segs s)) pat hforb

Word-List Encoders & SegModeSpec Helpers (PairStackSeg)

Encodes a list of tokens xs : List α onto tail : ListBlank Γ via word map w.

def encWordsTail {Γ α : Type*} [Inhabited Γ] (w : α → List Γ) (tail : ListBlank Γ) : List α → ListBlank Γ | [] => tail | x :: xs => w x +> encWordsTail w tail xs

Encodes a list of tokens xs : List α onto the blank half-tape default.

def encWords {Γ α : Type*} [Inhabited Γ] (w : α → List Γ) (xs : List α) : ListBlank Γ := encWordsTail w default xs@[simp] theorem encWordsTail_nil {Γ α : Type*} [Inhabited Γ] (w : α → List Γ) (tail : ListBlank Γ) : encWordsTail w tail [] = tail := rfl@[simp] theorem encWordsTail_cons {Γ α : Type*} [Inhabited Γ] (w : α → List Γ) (tail : ListBlank Γ) (x : α) (xs : List α) : encWordsTail w tail (x :: xs) = w x +> encWordsTail w tail xs := rfl@[simp] theorem encWords_nil {Γ α : Type*} [Inhabited Γ] (w : α → List Γ) : encWords w [] = default := rfl@[simp] theorem encWords_cons {Γ α : Type*} [Inhabited Γ] (w : α → List Γ) (x : α) (xs : List α) : encWords w (x :: xs) = w x +> encWords w xs := rfl

Bridge from evalSegRegion (.finWord (xs.map w)) +> tail to encWordsTail w tail xs.

theorem evalSegRegion_finWord_map {Γ α : Type*} [Inhabited Γ] (w : α → List Γ) : ∀ (xs : List α) (tail : ListBlank Γ), evalSegRegion (.finWord (xs.map w)) +> tail = encWordsTail w tail xs Γ:Type u_2α:Type u_3inst✝:Inhabited Γw:α → List Γtail:ListBlank Γ⊢ evalSegRegion (SegRegionKind.finWord (List.map w [])) +> tail = encWordsTail w tail [] Γ:Type u_2α:Type u_3inst✝:Inhabited Γw:α → List Γtail:ListBlank Γ⊢ evalSegRegion (SegRegionKind.finWord (List.map w [])) +> tail = encWordsTail w tail [] All goals completed! 🐙 Γ:Type u_2α:Type u_3inst✝:Inhabited Γw:α → List Γx:αxs:List αtail:ListBlank Γ⊢ evalSegRegion (SegRegionKind.finWord (List.map w (x :: xs))) +> tail = encWordsTail w tail (x :: xs) Γ:Type u_2α:Type u_3inst✝:Inhabited Γw:α → List Γx:αxs:List αtail:ListBlank Γ⊢ evalSegRegion (SegRegionKind.finWord (List.map w (x :: xs))) +> tail = encWordsTail w tail (x :: xs) Γ:Type u_2α:Type u_3inst✝:Inhabited Γw:α → List Γx:αxs:List αtail:ListBlank Γ⊢ (w x ++ evalSegRegion (SegRegionKind.finWord (List.map w xs))) +> tail = w x +> encWordsTail w tail xs All goals completed! 🐙

Bridge from evalSegmentedHalf [.finWord (xs.map w)] to encWords w xs.

theorem evalSegmentedHalf_finWord_map {Γ α : Type*} [Inhabited Γ] (w : α → List Γ) (xs : List α) : evalSegmentedHalf [.finWord (xs.map w)] = encWords w xs := Γ:Type u_2α:Type u_3inst✝:Inhabited Γw:α → List Γxs:List α⊢ evalSegmentedHalf [SegRegionKind.finWord (List.map w xs)] = encWords w xs Γ:Type u_2α:Type u_3inst✝:Inhabited Γw:α → List Γxs:List α⊢ evalSegRegion (SegRegionKind.finWord (List.map w xs)) +> default = encWordsTail w default xs All goals completed! 🐙

Bridge from evalSegmentedHalf [.finWord (xs.map w), .gadget base] to encWordsTail.

theorem evalSegmentedHalf_finWord_gadget {Γ α : Type*} [Inhabited Γ] (w : α → List Γ) (base : List Γ) (xs : List α) : evalSegmentedHalf [.finWord (xs.map w), .gadget base] = encWordsTail w (base +> default) xs := Γ:Type u_2α:Type u_3inst✝:Inhabited Γw:α → List Γbase:List Γxs:List α⊢ evalSegmentedHalf [SegRegionKind.finWord (List.map w xs), SegRegionKind.gadget base] = encWordsTail w (base +> default) xs Γ:Type u_2α:Type u_3inst✝:Inhabited Γw:α → List Γbase:List Γxs:List α⊢ evalSegRegion (SegRegionKind.finWord (List.map w xs)) +> base +> default = encWordsTail w (base +> default) xs All goals completed! 🐙

Head orientation for a segmented mode descriptor.

inductive SegHeadDir | left | right deriving DecidableEq

Table entry describing the TM state, head orientation, and left/right HalfTapeViews for a segmented mode m : Mode.

structure SegModeSpec (Γ Λ : Type*) where q : Λ dir : SegHeadDir vL : HalfTapeView Γ := .id [] vR : HalfTapeView Γ := .id []

SegStepOut M ValidSeg evalCfg c: from c, machine M advances in ⊢⁺ either to evalCfg s' for some valid s' (ValidSeg s'), or to a halting configuration.

def SegStepOut {Γ Λ SegState : Type*} [Inhabited Γ] [Inhabited Λ] (M : Machine Γ Λ) (ValidSeg : SegState → Prop) (evalCfg : SegState → Cfg Γ Λ) (c : Cfg Γ Λ) : Prop := ∃ cfg', (c [M]⊢⁺ cfg') ∧ ((∃ s', ValidSeg s' ∧ cfg' = evalCfg s') ∨ (BusyBeaver.step M cfg').isNone)

Close SegStepOut by stepping in ⊢⁺ to evalCfg s' for a valid state s'.

theorem SegStepOut.step {Γ Λ SegState : Type*} [Inhabited Γ] [Inhabited Λ] {M : Machine Γ Λ} {ValidSeg : SegState → Prop} {evalCfg : SegState → Cfg Γ Λ} {c : Cfg Γ Λ} {s' : SegState} (hs' : ValidSeg s') (h : c [M]⊢⁺ evalCfg s') : SegStepOut M ValidSeg evalCfg c := ⟨evalCfg s', h, Or.inl ⟨s', hs', rfl⟩⟩

Close SegStepOut by stepping in ⊢⁺ to a halting configuration cfg_h.

theorem SegStepOut.halt {Γ Λ SegState : Type*} [Inhabited Γ] [Inhabited Λ] {M : Machine Γ Λ} {ValidSeg : SegState → Prop} {evalCfg : SegState → Cfg Γ Λ} {c cfg_h : Cfg Γ Λ} (h : c [M]⊢⁺ cfg_h) (hhalt : (BusyBeaver.step M cfg_h).isNone) : SegStepOut M ValidSeg evalCfg c := ⟨cfg_h, h, Or.inr hhalt⟩

Transport IsNowhereDenseFamily along a pointwise description of evaluated segments.

theorem isNowhereDenseHalf_of_family {S : Type*} {Valid : S → Prop} {segs : S → List (SegRegionKind Γ)} {enc : S → ListBlank Γ} (heq : ∀ s, evalSegmentedHalf (segs s) = enc s) (h : IsNowhereDenseFamily Valid enc) : IsNowhereDenseHalf Valid segs := Γ:Type u_1inst✝:Inhabited ΓS:Type u_2Valid:S → Propsegs:S → List (SegRegionKind Γ)enc:S → ListBlank Γheq:∀ (s : S), evalSegmentedHalf (segs s) = enc sh:IsNowhereDenseFamily Valid enc⊢ IsNowhereDenseHalf Valid segs Γ:Type u_1inst✝:Inhabited ΓS:Type u_2Valid:S → Propsegs:S → List (SegRegionKind Γ)enc:S → ListBlank Γheq:∀ (s : S), evalSegmentedHalf (segs s) = enc sh:IsNowhereDenseFamily Valid enc⊢ IsNowhereDenseFamily Valid fun s ↦ evalSegmentedHalf (segs s) Γ:Type u_1inst✝:Inhabited ΓS:Type u_2Valid:S → Propsegs:S → List (SegRegionKind Γ)enc:S → ListBlank Γheq:∀ (s : S), evalSegmentedHalf (segs s) = enc sh:IsNowhereDenseFamily Valid enc⊢ IsNowhereDenseFamily Valid enc All goals completed! 🐙

Decidable n-step window checker from (ls +> l) {{q}}> (rs +> r) to (ls' +> l) {{q'}}> (rs' +> r).

def checkHeadRight {Γ Λ : Type*} [DecidableEq Γ] [DecidableEq Λ] [Inhabited Γ] [Inhabited Λ] (bL bR : Bool) (M : Machine Γ Λ) (n : ℕ) (q : Λ) (ls rs : List Γ) (q' : Λ) (ls' rs' : List Γ) : Bool := match rs with | [] => if !bR then false else match rs' with | a' :: rs₀' => Counter.multiStepWindow bL true M n ⟨q, default, ls, []⟩ == some ⟨q', a', ls', rs₀'⟩ | [] => Counter.multiStepWindow bL true M n ⟨q, default, ls, []⟩ == some ⟨q', default, ls', []⟩ | a :: rs₀ => match rs' with | a' :: rs₀' => Counter.multiStepWindow bL bR M n ⟨q, a, ls, rs₀⟩ == some ⟨q', a', ls', rs₀'⟩ | [] => if bR then Counter.multiStepWindow bL true M n ⟨q, a, ls, rs₀⟩ == some ⟨q', default, ls', []⟩ else match n with | 0 => false | m + 1 => match Counter.multiStepWindow bL false M m ⟨q, a, ls, rs₀⟩ with | some ⟨q₀, x, ls₀, []⟩ => match M q₀ x with | some (some q₁, Stmt.write w Dir.right) => (q₁ == q') && (Counter.pushWindow bL w ls₀ == ls') | _ => false | _ => falseprivate theorem evalWindow_eq_headRight_cons {Γ Λ : Type*} [Inhabited Γ] [Inhabited Λ] (l r : ListBlank Γ) (q : Λ) (a : Γ) (ls rs₀ : List Γ) : Counter.evalWindow l r ⟨q, a, ls, rs₀⟩ = (ls +> l) {{q}}> ((a :: rs₀) +> r) := Γ:Type u_2Λ:Type u_3inst✝¹:Inhabited Γinst✝:Inhabited Λl:ListBlank Γr:ListBlank Γq:Λa:Γls:List Γrs₀:List Γ⊢ Counter.evalWindow l r { q := q, cur := a, l := ls, r := rs₀ } = (ls +> l) {{q}}> (a :: rs₀) +> r All goals completed! 🐙private theorem evalWindow_eq_headRight_nil {Γ Λ : Type*} [Inhabited Γ] [Inhabited Λ] (l : ListBlank Γ) (q : Λ) (ls : List Γ) : Counter.evalWindow l default ⟨q, default, ls, []⟩ = (ls +> l) {{q}}> ([] +> default) := Γ:Type u_2Λ:Type u_3inst✝¹:Inhabited Γinst✝:Inhabited Λl:ListBlank Γq:Λls:List Γ⊢ Counter.evalWindow l default { q := q, cur := default, l := ls, r := [] } = (ls +> l) {{q}}> [] +> default Γ:Type u_2Λ:Type u_3inst✝¹:Inhabited Γinst✝:Inhabited Λl:ListBlank Γq:Λls:List Γhd:default.head = default⊢ Counter.evalWindow l default { q := q, cur := default, l := ls, r := [] } = (ls +> l) {{q}}> [] +> default Γ:Type u_2Λ:Type u_3inst✝¹:Inhabited Γinst✝:Inhabited Λl:ListBlank Γq:Λls:List Γhd:default.head = defaulttl:default.tail = default⊢ Counter.evalWindow l default { q := q, cur := default, l := ls, r := [] } = (ls +> l) {{q}}> [] +> default All goals completed! 🐙

Soundness of checkHeadRight.

theorem checkHeadRight_sound {Γ Λ : Type*} [DecidableEq Γ] [DecidableEq Λ] [Inhabited Γ] [Inhabited Λ] {bL bR : Bool} {M : Machine Γ Λ} (n : ℕ) (q : Λ) (ls rs : List Γ) (q' : Λ) (ls' rs' : List Γ) (l r : ListBlank Γ) (hL : bL = true → l = default) (hR : bR = true → r = default) (h : checkHeadRight bL bR M n q ls rs q' ls' rs' = true) : ((ls +> l) {{q}}> (rs +> r)) [M]⊢^{n} ((ls' +> l) {{q'}}> (rs' +> r)) := Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γrs:List Γq':Λls':List Γrs':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulth:checkHeadRight bL bR M n q ls rs q' ls' rs' = true⊢ ((ls +> l) {{q}}> rs +> r) [M]⊢^{n} (ls' +> l) {{q'}}> rs' +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γrs:List Γq':Λls':List Γrs':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulth:(match rs with | [] => if (!bR) = true then false else match rs' with | a' :: rs₀' => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := default, l := ls', r := [] } | a :: rs₀ => match rs' with | a' :: rs₀' => Counter.multiStepWindow bL bR M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => if bR = true then Counter.multiStepWindow bL true M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := default, l := ls', r := [] } else match n with | 0 => false | m.succ => match Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } with | some { q := q₀, cur := x, l := ls₀, r := [] } => match M q₀ x with | some (some q₁, { symbol := w, dir := Dir.right }) => q₁ == q' && Counter.pushWindow bL w ls₀ == ls' | x => false | x => false) = true⊢ ((ls +> l) {{q}}> rs +> r) [M]⊢^{n} (ls' +> l) {{q'}}> rs' +> r cases rs with Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γrs':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulth:(match [] with | [] => if (!bR) = true then false else match rs' with | a' :: rs₀' => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := default, l := ls', r := [] } | a :: rs₀ => match rs' with | a' :: rs₀' => Counter.multiStepWindow bL bR M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => if bR = true then Counter.multiStepWindow bL true M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := default, l := ls', r := [] } else match n with | 0 => false | m.succ => match Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } with | some { q := q₀, cur := x, l := ls₀, r := [] } => match M q₀ x with | some (some q₁, { symbol := w, dir := Dir.right }) => q₁ == q' && Counter.pushWindow bL w ls₀ == ls' | x => false | x => false) = true⊢ ((ls +> l) {{q}}> [] +> r) [M]⊢^{n} (ls' +> l) {{q'}}> rs' +> r cases hbR : bR with Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γrs':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulth:(match [] with | [] => if (!bR) = true then false else match rs' with | a' :: rs₀' => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := default, l := ls', r := [] } | a :: rs₀ => match rs' with | a' :: rs₀' => Counter.multiStepWindow bL bR M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => if bR = true then Counter.multiStepWindow bL true M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := default, l := ls', r := [] } else match n with | 0 => false | m.succ => match Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } with | some { q := q₀, cur := x, l := ls₀, r := [] } => match M q₀ x with | some (some q₁, { symbol := w, dir := Dir.right }) => q₁ == q' && Counter.pushWindow bL w ls₀ == ls' | x => false | x => false) = truehbR:bR = false⊢ ((ls +> l) {{q}}> [] +> r) [M]⊢^{n} (ls' +> l) {{q'}}> rs' +> r All goals completed! 🐙 Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γrs':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulth:(match [] with | [] => if (!bR) = true then false else match rs' with | a' :: rs₀' => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := default, l := ls', r := [] } | a :: rs₀ => match rs' with | a' :: rs₀' => Counter.multiStepWindow bL bR M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => if bR = true then Counter.multiStepWindow bL true M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := default, l := ls', r := [] } else match n with | 0 => false | m.succ => match Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } with | some { q := q₀, cur := x, l := ls₀, r := [] } => match M q₀ x with | some (some q₁, { symbol := w, dir := Dir.right }) => q₁ == q' && Counter.pushWindow bL w ls₀ == ls' | x => false | x => false) = truehbR:bR = true⊢ ((ls +> l) {{q}}> [] +> r) [M]⊢^{n} (ls' +> l) {{q'}}> rs' +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γrs':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulthbR:bR = trueh:(match rs' with | a' :: rs₀' => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := default, l := ls', r := [] }) = true⊢ ((ls +> l) {{q}}> [] +> r) [M]⊢^{n} (ls' +> l) {{q'}}> rs' +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γrs':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulthbR:bR = trueh:(match rs' with | a' :: rs₀' => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := default, l := ls', r := [] }) = truehr_def:r = default⊢ ((ls +> l) {{q}}> [] +> r) [M]⊢^{n} (ls' +> l) {{q'}}> rs' +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γrs':List Γl:ListBlank ΓhL:bL = true → l = defaulthbR:bR = trueh:(match rs' with | a' :: rs₀' => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := default, l := ls', r := [] }) = truehR:bR = true → default = default⊢ ((ls +> l) {{q}}> [] +> default) [M]⊢^{n} (ls' +> l) {{q'}}> rs' +> default cases rs' with Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γl:ListBlank ΓhL:bL = true → l = defaulthbR:bR = truehR:bR = true → default = defaulta':Γrs₀':List Γh:(match a' :: rs₀' with | a' :: rs₀' => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := default, l := ls', r := [] }) = true⊢ ((ls +> l) {{q}}> [] +> default) [M]⊢^{n} (ls' +> l) {{q'}}> (a' :: rs₀') +> default Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γl:ListBlank ΓhL:bL = true → l = defaulthbR:bR = truehR:bR = true → default = defaulta':Γrs₀':List Γh:(match a' :: rs₀' with | a' :: rs₀' => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := default, l := ls', r := [] }) = truehms:Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } = some { q := q', cur := a', l := ls', r := rs₀' }⊢ ((ls +> l) {{q}}> [] +> default) [M]⊢^{n} (ls' +> l) {{q'}}> (a' :: rs₀') +> default Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γl:ListBlank ΓhL:bL = true → l = defaulthbR:bR = truehR:bR = true → default = defaulta':Γrs₀':List Γh:(match a' :: rs₀' with | a' :: rs₀' => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := default, l := ls', r := [] }) = truehms:Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } = some { q := q', cur := a', l := ls', r := rs₀' }hsnd:Counter.evalWindow l default { q := q, cur := default, l := ls, r := [] } [M]⊢^{n} Counter.evalWindow l default { q := q', cur := a', l := ls', r := rs₀' }⊢ ((ls +> l) {{q}}> [] +> default) [M]⊢^{n} (ls' +> l) {{q'}}> (a' :: rs₀') +> default All goals completed! 🐙 Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γl:ListBlank ΓhL:bL = true → l = defaulthbR:bR = truehR:bR = true → default = defaulth:(match [] with | a' :: rs₀' => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := default, l := ls', r := [] }) = true⊢ ((ls +> l) {{q}}> [] +> default) [M]⊢^{n} (ls' +> l) {{q'}}> [] +> default Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γl:ListBlank ΓhL:bL = true → l = defaulthbR:bR = truehR:bR = true → default = defaulth:(match [] with | a' :: rs₀' => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := default, l := ls', r := [] }) = truehms:Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } = some { q := q', cur := default, l := ls', r := [] }⊢ ((ls +> l) {{q}}> [] +> default) [M]⊢^{n} (ls' +> l) {{q'}}> [] +> default Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γl:ListBlank ΓhL:bL = true → l = defaulthbR:bR = truehR:bR = true → default = defaulth:(match [] with | a' :: rs₀' => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := default, l := ls', r := [] }) = truehms:Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } = some { q := q', cur := default, l := ls', r := [] }hsnd:Counter.evalWindow l default { q := q, cur := default, l := ls, r := [] } [M]⊢^{n} Counter.evalWindow l default { q := q', cur := default, l := ls', r := [] }⊢ ((ls +> l) {{q}}> [] +> default) [M]⊢^{n} (ls' +> l) {{q'}}> [] +> default All goals completed! 🐙 Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γrs':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List Γh:(match a :: rs₀ with | [] => if (!bR) = true then false else match rs' with | a' :: rs₀' => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := default, l := ls', r := [] } | a :: rs₀ => match rs' with | a' :: rs₀' => Counter.multiStepWindow bL bR M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => if bR = true then Counter.multiStepWindow bL true M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := default, l := ls', r := [] } else match n with | 0 => false | m.succ => match Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } with | some { q := q₀, cur := x, l := ls₀, r := [] } => match M q₀ x with | some (some q₁, { symbol := w, dir := Dir.right }) => q₁ == q' && Counter.pushWindow bL w ls₀ == ls' | x => false | x => false) = true⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{n} (ls' +> l) {{q'}}> rs' +> r cases rs' with Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List Γa':Γrs₀':List Γh:(match a :: rs₀ with | [] => if (!bR) = true then false else match a' :: rs₀' with | a' :: rs₀' => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := default, l := ls', r := [] } | a :: rs₀ => match a' :: rs₀' with | a' :: rs₀' => Counter.multiStepWindow bL bR M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => if bR = true then Counter.multiStepWindow bL true M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := default, l := ls', r := [] } else match n with | 0 => false | m.succ => match Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } with | some { q := q₀, cur := x, l := ls₀, r := [] } => match M q₀ x with | some (some q₁, { symbol := w, dir := Dir.right }) => q₁ == q' && Counter.pushWindow bL w ls₀ == ls' | x => false | x => false) = true⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{n} (ls' +> l) {{q'}}> (a' :: rs₀') +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List Γa':Γrs₀':List Γh:(match a :: rs₀ with | [] => if (!bR) = true then false else match a' :: rs₀' with | a' :: rs₀' => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := default, l := ls', r := [] } | a :: rs₀ => match a' :: rs₀' with | a' :: rs₀' => Counter.multiStepWindow bL bR M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => if bR = true then Counter.multiStepWindow bL true M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := default, l := ls', r := [] } else match n with | 0 => false | m.succ => match Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } with | some { q := q₀, cur := x, l := ls₀, r := [] } => match M q₀ x with | some (some q₁, { symbol := w, dir := Dir.right }) => q₁ == q' && Counter.pushWindow bL w ls₀ == ls' | x => false | x => false) = truehms:Counter.multiStepWindow bL bR M n { q := q, cur := a, l := ls, r := rs₀ } = some { q := q', cur := a', l := ls', r := rs₀' }⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{n} (ls' +> l) {{q'}}> (a' :: rs₀') +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List Γa':Γrs₀':List Γh:(match a :: rs₀ with | [] => if (!bR) = true then false else match a' :: rs₀' with | a' :: rs₀' => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := default, l := ls', r := [] } | a :: rs₀ => match a' :: rs₀' with | a' :: rs₀' => Counter.multiStepWindow bL bR M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => if bR = true then Counter.multiStepWindow bL true M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := default, l := ls', r := [] } else match n with | 0 => false | m.succ => match Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } with | some { q := q₀, cur := x, l := ls₀, r := [] } => match M q₀ x with | some (some q₁, { symbol := w, dir := Dir.right }) => q₁ == q' && Counter.pushWindow bL w ls₀ == ls' | x => false | x => false) = truehms:Counter.multiStepWindow bL bR M n { q := q, cur := a, l := ls, r := rs₀ } = some { q := q', cur := a', l := ls', r := rs₀' }hsnd:Counter.evalWindow l r { q := q, cur := a, l := ls, r := rs₀ } [M]⊢^{n} Counter.evalWindow l r { q := q', cur := a', l := ls', r := rs₀' }⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{n} (ls' +> l) {{q'}}> (a' :: rs₀') +> r All goals completed! 🐙 Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List Γh:(match a :: rs₀ with | [] => if (!bR) = true then false else match [] with | a' :: rs₀' => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := default, l := ls', r := [] } | a :: rs₀ => match [] with | a' :: rs₀' => Counter.multiStepWindow bL bR M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => if bR = true then Counter.multiStepWindow bL true M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := default, l := ls', r := [] } else match n with | 0 => false | m.succ => match Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } with | some { q := q₀, cur := x, l := ls₀, r := [] } => match M q₀ x with | some (some q₁, { symbol := w, dir := Dir.right }) => q₁ == q' && Counter.pushWindow bL w ls₀ == ls' | x => false | x => false) = true⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{n} (ls' +> l) {{q'}}> [] +> r cases hbR : bR with Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List Γh:(match a :: rs₀ with | [] => if (!bR) = true then false else match [] with | a' :: rs₀' => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := default, l := ls', r := [] } | a :: rs₀ => match [] with | a' :: rs₀' => Counter.multiStepWindow bL bR M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => if bR = true then Counter.multiStepWindow bL true M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := default, l := ls', r := [] } else match n with | 0 => false | m.succ => match Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } with | some { q := q₀, cur := x, l := ls₀, r := [] } => match M q₀ x with | some (some q₁, { symbol := w, dir := Dir.right }) => q₁ == q' && Counter.pushWindow bL w ls₀ == ls' | x => false | x => false) = truehbR:bR = true⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{n} (ls' +> l) {{q'}}> [] +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List ΓhbR:bR = trueh:(Counter.multiStepWindow bL true M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := default, l := ls', r := [] }) = true⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{n} (ls' +> l) {{q'}}> [] +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List ΓhbR:bR = trueh:(Counter.multiStepWindow bL true M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := default, l := ls', r := [] }) = truehr_def:r = default⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{n} (ls' +> l) {{q'}}> [] +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γl:ListBlank ΓhL:bL = true → l = defaulta:Γrs₀:List ΓhbR:bR = trueh:(Counter.multiStepWindow bL true M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := default, l := ls', r := [] }) = truehR:bR = true → default = default⊢ ((ls +> l) {{q}}> (a :: rs₀) +> default) [M]⊢^{n} (ls' +> l) {{q'}}> [] +> default Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γl:ListBlank ΓhL:bL = true → l = defaulta:Γrs₀:List ΓhbR:bR = trueh:(Counter.multiStepWindow bL true M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := default, l := ls', r := [] }) = truehR:bR = true → default = defaulthms:Counter.multiStepWindow bL true M n { q := q, cur := a, l := ls, r := rs₀ } = some { q := q', cur := default, l := ls', r := [] }⊢ ((ls +> l) {{q}}> (a :: rs₀) +> default) [M]⊢^{n} (ls' +> l) {{q'}}> [] +> default Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γl:ListBlank ΓhL:bL = true → l = defaulta:Γrs₀:List ΓhbR:bR = trueh:(Counter.multiStepWindow bL true M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := default, l := ls', r := [] }) = truehR:bR = true → default = defaulthms:Counter.multiStepWindow bL true M n { q := q, cur := a, l := ls, r := rs₀ } = some { q := q', cur := default, l := ls', r := [] }hsnd:Counter.evalWindow l default { q := q, cur := a, l := ls, r := rs₀ } [M]⊢^{n} Counter.evalWindow l default { q := q', cur := default, l := ls', r := [] }⊢ ((ls +> l) {{q}}> (a :: rs₀) +> default) [M]⊢^{n} (ls' +> l) {{q'}}> [] +> default All goals completed! 🐙 Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List Γh:(match a :: rs₀ with | [] => if (!bR) = true then false else match [] with | a' :: rs₀' => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => Counter.multiStepWindow bL true M n { q := q, cur := default, l := ls, r := [] } == some { q := q', cur := default, l := ls', r := [] } | a :: rs₀ => match [] with | a' :: rs₀' => Counter.multiStepWindow bL bR M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := a', l := ls', r := rs₀' } | [] => if bR = true then Counter.multiStepWindow bL true M n { q := q, cur := a, l := ls, r := rs₀ } == some { q := q', cur := default, l := ls', r := [] } else match n with | 0 => false | m.succ => match Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } with | some { q := q₀, cur := x, l := ls₀, r := [] } => match M q₀ x with | some (some q₁, { symbol := w, dir := Dir.right }) => q₁ == q' && Counter.pushWindow bL w ls₀ == ls' | x => false | x => false) = truehbR:bR = false⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{n} (ls' +> l) {{q'}}> [] +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λn:ℕq:Λls:List Γq':Λls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List ΓhbR:bR = falseh:(match n with | 0 => false | m.succ => match Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } with | some { q := q₀, cur := x, l := ls₀, r := [] } => match M q₀ x with | some (some q₁, { symbol := w, dir := Dir.right }) => q₁ == q' && Counter.pushWindow bL w ls₀ == ls' | x => false | x => false) = true⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{n} (ls' +> l) {{q'}}> [] +> r cases n with Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λq:Λls:List Γq':Λls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List ΓhbR:bR = falseh:(match 0 with | 0 => false | m.succ => match Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } with | some { q := q₀, cur := x, l := ls₀, r := [] } => match M q₀ x with | some (some q₁, { symbol := w, dir := Dir.right }) => q₁ == q' && Counter.pushWindow bL w ls₀ == ls' | x => false | x => false) = true⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{0} (ls' +> l) {{q'}}> [] +> r All goals completed! 🐙 Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λq:Λls:List Γq':Λls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List ΓhbR:bR = falsem:ℕh:(match m + 1 with | 0 => false | m.succ => match Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } with | some { q := q₀, cur := x, l := ls₀, r := [] } => match M q₀ x with | some (some q₁, { symbol := w, dir := Dir.right }) => q₁ == q' && Counter.pushWindow bL w ls₀ == ls' | x => false | x => false) = true⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{m + 1} (ls' +> l) {{q'}}> [] +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λq:Λls:List Γq':Λls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List ΓhbR:bR = falsem:ℕh:(match Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } with | some { q := q₀, cur := x, l := ls₀, r := [] } => match M q₀ x with | some (some q₁, { symbol := w, dir := Dir.right }) => q₁ == q' && Counter.pushWindow bL w ls₀ == ls' | x => false | x => false) = true⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{m + 1} (ls' +> l) {{q'}}> [] +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λq:Λls:List Γq':Λls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List ΓhbR:bR = falsem:ℕx✝¹:Option (Counter.CCfg Γ Λ)q₀✝:Λx✝:Γls₀✝:List Γheq✝:Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } = some { q := q₀✝, cur := x✝, l := ls₀✝, r := [] }h:(match M q₀✝ x✝ with | some (some q₁, { symbol := w, dir := Dir.right }) => q₁ == q' && Counter.pushWindow bL w ls₀✝ == ls' | x => false) = true⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{m + 1} (ls' +> l) {{q'}}> [] +> rΓ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λq:Λls:List Γq':Λls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List ΓhbR:bR = falsem:ℕx✝¹:Option (Counter.CCfg Γ Λ)x✝:∀ (q₀ : Λ) (x : Γ) (ls₀ : List Γ), Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } = some { q := q₀, cur := x, l := ls₀, r := [] } → Falseh:false = true⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{m + 1} (ls' +> l) {{q'}}> [] +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λq:Λls:List Γq':Λls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List ΓhbR:bR = falsem:ℕx✝¹:Option (Counter.CCfg Γ Λ)q₀✝:Λx✝:Γls₀✝:List Γheq✝:Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } = some { q := q₀✝, cur := x✝, l := ls₀✝, r := [] }h:(match M q₀✝ x✝ with | some (some q₁, { symbol := w, dir := Dir.right }) => q₁ == q' && Counter.pushWindow bL w ls₀✝ == ls' | x => false) = true⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{m + 1} (ls' +> l) {{q'}}> [] +> r next val q₀ x ls₀ hms Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λq:Λls:List Γq':Λls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List ΓhbR:bR = falsem:ℕval:Option (Counter.CCfg Γ Λ)q₀:Λx:Γls₀:List Γhms:Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } = some { q := q₀✝, cur := x✝, l := ls₀✝, r := [] }h:(match M q₀✝ x✝ with | some (some q₁, { symbol := w, dir := Dir.right }) => q₁ == q' && Counter.pushWindow bL w ls₀✝ == ls' | x => false) = true⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{m + 1} (ls' +> l) {{q'}}> [] +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λq:Λls:List Γq':Λls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List ΓhbR:bR = falsem:ℕval:Option (Counter.CCfg Γ Λ)q₀:Λx:Γls₀:List Γhms:Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } = some { q := q₀✝, cur := x✝, l := ls₀✝, r := [] }x✝:Option (Option Λ × Stmt Γ)q₁✝:Λw✝:Γheq✝:M q₀ x = some (some q₁✝, { symbol := w✝, dir := Dir.right })h:(q₁✝ == q' && Counter.pushWindow bL w✝ ls₀ == ls') = true⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{m + 1} (ls' +> l) {{q'}}> [] +> rΓ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λq:Λls:List Γq':Λls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List ΓhbR:bR = falsem:ℕval:Option (Counter.CCfg Γ Λ)q₀:Λx:Γls₀:List Γhms:Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } = some { q := q₀✝, cur := x✝, l := ls₀✝, r := [] }x✝¹:Option (Option Λ × Stmt Γ)x✝:∀ (q₁ : Λ) (w : Γ), M q₀ x = some (some q₁, { symbol := w, dir := Dir.right }) → Falseh:false = true⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{m + 1} (ls' +> l) {{q'}}> [] +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λq:Λls:List Γq':Λls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List ΓhbR:bR = falsem:ℕval:Option (Counter.CCfg Γ Λ)q₀:Λx:Γls₀:List Γhms:Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } = some { q := q₀✝, cur := x✝, l := ls₀✝, r := [] }x✝:Option (Option Λ × Stmt Γ)q₁✝:Λw✝:Γheq✝:M q₀ x = some (some q₁✝, { symbol := w✝, dir := Dir.right })h:(q₁✝ == q' && Counter.pushWindow bL w✝ ls₀ == ls') = true⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{m + 1} (ls' +> l) {{q'}}> [] +> r next htm q_opt stmt Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λq:Λls:List Γq':Λls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List ΓhbR:bR = falsem:ℕval:Option (Counter.CCfg Γ Λ)q₀:Λx:Γls₀:List Γhms:Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } = some { q := q₀✝, cur := x✝, l := ls₀✝, r := [] }x✝:Option (Option Λ × Stmt Γ)htm:Λq_opt:Γstmt:M q₀ x = some (some q₁✝, { symbol := w✝, dir := Dir.right })h:(q₁✝ == q' && Counter.pushWindow bL w✝ ls₀ == ls') = true⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{m + 1} (ls' +> l) {{q'}}> [] +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λq:Λls:List Γq':Λls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List ΓhbR:bR = falsem:ℕval:Option (Counter.CCfg Γ Λ)q₀:Λx:Γls₀:List Γhms:Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } = some { q := q₀✝, cur := x✝, l := ls₀✝, r := [] }x✝:Option (Option Λ × Stmt Γ)htm:Λq_opt:Γstmt:M q₀ x = some (some q₁✝, { symbol := w✝, dir := Dir.right })h:htm = q' ∧ Counter.pushWindow bL q_opt ls₀ = ls'⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{m + 1} (ls' +> l) {{q'}}> [] +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λq:Λls:List Γls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List ΓhbR:bR = falsem:ℕval:Option (Counter.CCfg Γ Λ)q₀:Λx:Γls₀:List Γhms:Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } = some { q := q₀✝, cur := x✝, l := ls₀✝, r := [] }x✝:Option (Option Λ × Stmt Γ)htm:Λq_opt:Γstmt:M q₀ x = some (some q₁✝, { symbol := w✝, dir := Dir.right })hpush:Counter.pushWindow bL q_opt ls₀ = ls'⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{m + 1} (ls' +> l) {{htm}}> [] +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λq:Λls:List Γls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List ΓhbR:bR = falsem:ℕval:Option (Counter.CCfg Γ Λ)q₀:Λx:Γls₀:List Γhms:Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } = some { q := q₀✝, cur := x✝, l := ls₀✝, r := [] }x✝:Option (Option Λ × Stmt Γ)htm:Λq_opt:Γstmt:M q₀ x = some (some q₁✝, { symbol := w✝, dir := Dir.right })hpush:Counter.pushWindow bL q_opt ls₀ = ls'hsnd:Counter.evalWindow l r { q := q, cur := a, l := ls, r := rs₀ } [M]⊢^{m} Counter.evalWindow l r { q := q₀, cur := x, l := ls₀, r := [] }⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{m + 1} (ls' +> l) {{htm}}> [] +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λq:Λls:List Γls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List ΓhbR:bR = falsem:ℕval:Option (Counter.CCfg Γ Λ)q₀:Λx:Γls₀:List Γhms:Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } = some { q := q₀✝, cur := x✝, l := ls₀✝, r := [] }x✝:Option (Option Λ × Stmt Γ)htm:Λq_opt:Γstmt:M q₀ x = some (some q₁✝, { symbol := w✝, dir := Dir.right })hpush:Counter.pushWindow bL q_opt ls₀ = ls'hsnd:((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{m} (ls₀ +> l) {{q₀}}> [x] +> r⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{m + 1} (ls' +> l) {{htm}}> [] +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λq:Λls:List Γls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List ΓhbR:bR = falsem:ℕval:Option (Counter.CCfg Γ Λ)q₀:Λx:Γls₀:List Γhms:Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } = some { q := q₀✝, cur := x✝, l := ls₀✝, r := [] }x✝:Option (Option Λ × Stmt Γ)htm:Λq_opt:Γstmt:M q₀ x = some (some q₁✝, { symbol := w✝, dir := Dir.right })hpush:Counter.pushWindow bL q_opt ls₀ = ls'hsnd:((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{m} (ls₀ +> l) {{q₀}}> [x] +> rhstep1:((ls₀ +> l) {{q₀}}> [x] +> r) [M]⊢ (ls' +> l) {{htm}}> [] +> r⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{m + 1} (ls' +> l) {{htm}}> [] +> r All goals completed! 🐙 Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λq:Λls:List Γq':Λls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List ΓhbR:bR = falsem:ℕval:Option (Counter.CCfg Γ Λ)q₀:Λx:Γls₀:List Γhms:Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } = some { q := q₀✝, cur := x✝, l := ls₀✝, r := [] }x✝¹:Option (Option Λ × Stmt Γ)x✝:∀ (q₁ : Λ) (w : Γ), M q₀ x = some (some q₁, { symbol := w, dir := Dir.right }) → Falseh:false = true⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{m + 1} (ls' +> l) {{q'}}> [] +> r All goals completed! 🐙 Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛbL:BoolbR:BoolM:Machine Γ Λq:Λls:List Γq':Λls':List Γl:ListBlank Γr:ListBlank ΓhL:bL = true → l = defaulthR:bR = true → r = defaulta:Γrs₀:List ΓhbR:bR = falsem:ℕx✝¹:Option (Counter.CCfg Γ Λ)x✝:∀ (q₀ : Λ) (x : Γ) (ls₀ : List Γ), Counter.multiStepWindow bL false M m { q := q, cur := a, l := ls, r := rs₀ } = some { q := q₀, cur := x, l := ls₀, r := [] } → Falseh:false = true⊢ ((ls +> l) {{q}}> (a :: rs₀) +> r) [M]⊢^{m + 1} (ls' +> l) {{q'}}> [] +> r All goals completed! 🐙

Inductive rightward word-run transducer walk.

theorem walkWordRight {Γ Λ : Type*} [DecidableEq Γ] [DecidableEq Λ] [Inhabited Γ] [Inhabited Λ] {M : Machine Γ Λ} (s : ℕ) (q : Λ) (pL u pR v : List Γ) (hbody : checkHeadRight false false M s q pL (pR ++ v) q (pL ++ u) pR = true) : ∀ (k : ℕ) (l r : ListBlank Γ), ((pL +> l) {{q}}> (pR +> ((v ^ k) +> r))) [M]⊢^{s * k} ((pL +> ((u ^ k) +> l)) {{q}}> (pR +> r)) Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λs:ℕq:ΛpL:List Γu:List ΓpR:List Γv:List Γhbody:checkHeadRight false false M s q pL (pR ++ v) q (pL ++ u) pR = truel:ListBlank Γr:ListBlank Γ⊢ ((pL +> l) {{q}}> pR +> v ^ 0 +> r) [M]⊢^{s * 0} (pL +> u ^ 0 +> l) {{q}}> pR +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λs:ℕq:ΛpL:List Γu:List ΓpR:List Γv:List Γhbody:checkHeadRight false false M s q pL (pR ++ v) q (pL ++ u) pR = truel:ListBlank Γr:ListBlank Γ⊢ ((pL +> l) {{q}}> pR +> v ^ 0 +> r) [M]⊢^{s * 0} (pL +> u ^ 0 +> l) {{q}}> pR +> r All goals completed! 🐙 Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λs:ℕq:ΛpL:List Γu:List ΓpR:List Γv:List Γhbody:checkHeadRight false false M s q pL (pR ++ v) q (pL ++ u) pR = truek:ℕl:ListBlank Γr:ListBlank Γ⊢ ((pL +> l) {{q}}> pR +> v ^ (k + 1) +> r) [M]⊢^{s * (k + 1)} (pL +> u ^ (k + 1) +> l) {{q}}> pR +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λs:ℕq:ΛpL:List Γu:List ΓpR:List Γv:List Γhbody:checkHeadRight false false M s q pL (pR ++ v) q (pL ++ u) pR = truek:ℕl:ListBlank Γr:ListBlank Γ⊢ ((pL +> l) {{q}}> pR +> v ^ (k + 1) +> r) [M]⊢^{s * (k + 1)} (pL +> u ^ (k + 1) +> l) {{q}}> pR +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λs:ℕq:ΛpL:List Γu:List ΓpR:List Γv:List Γhbody:checkHeadRight false false M s q pL (pR ++ v) q (pL ++ u) pR = truek:ℕl:ListBlank Γr:ListBlank Γ⊢ ((pL +> l) {{q}}> (pR ++ v) +> v ^ k +> r) [M]⊢^{s * (k + 1)} (pL +> u ^ (k + 1) +> l) {{q}}> pR +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λs:ℕq:ΛpL:List Γu:List ΓpR:List Γv:List Γhbody:checkHeadRight false false M s q pL (pR ++ v) q (pL ++ u) pR = truek:ℕl:ListBlank Γr:ListBlank Γh1:((pL +> l) {{q}}> (pR ++ v) +> v ^ k +> r) [M]⊢^{s} ((pL ++ u) +> l) {{q}}> pR +> v ^ k +> r⊢ ((pL +> l) {{q}}> (pR ++ v) +> v ^ k +> r) [M]⊢^{s * (k + 1)} (pL +> u ^ (k + 1) +> l) {{q}}> pR +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λs:ℕq:ΛpL:List Γu:List ΓpR:List Γv:List Γhbody:checkHeadRight false false M s q pL (pR ++ v) q (pL ++ u) pR = truek:ℕl:ListBlank Γr:ListBlank Γh1:((pL +> l) {{q}}> (pR ++ v) +> v ^ k +> r) [M]⊢^{s} (pL +> u +> l) {{q}}> pR +> v ^ k +> r⊢ ((pL +> l) {{q}}> (pR ++ v) +> v ^ k +> r) [M]⊢^{s * (k + 1)} (pL +> u ^ (k + 1) +> l) {{q}}> pR +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λs:ℕq:ΛpL:List Γu:List ΓpR:List Γv:List Γhbody:checkHeadRight false false M s q pL (pR ++ v) q (pL ++ u) pR = truek:ℕl:ListBlank Γr:ListBlank Γh1:((pL +> l) {{q}}> (pR ++ v) +> v ^ k +> r) [M]⊢^{s} (pL +> u +> l) {{q}}> pR +> v ^ k +> rh2:((pL +> u +> l) {{q}}> pR +> v ^ k +> r) [M]⊢^{s * k} (pL +> u ^ k +> u +> l) {{q}}> pR +> r⊢ ((pL +> l) {{q}}> (pR ++ v) +> v ^ k +> r) [M]⊢^{s * (k + 1)} (pL +> u ^ (k + 1) +> l) {{q}}> pR +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λs:ℕq:ΛpL:List Γu:List ΓpR:List Γv:List Γhbody:checkHeadRight false false M s q pL (pR ++ v) q (pL ++ u) pR = truek:ℕl:ListBlank Γr:ListBlank Γh1:((pL +> l) {{q}}> (pR ++ v) +> v ^ k +> r) [M]⊢^{s} (pL +> u +> l) {{q}}> pR +> v ^ k +> rh2:((pL +> u +> l) {{q}}> pR +> v ^ k +> r) [M]⊢^{s * k} (pL +> u ^ (k + 1) +> l) {{q}}> pR +> r⊢ ((pL +> l) {{q}}> (pR ++ v) +> v ^ k +> r) [M]⊢^{s * (k + 1)} (pL +> u ^ (k + 1) +> l) {{q}}> pR +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λs:ℕq:ΛpL:List Γu:List ΓpR:List Γv:List Γhbody:checkHeadRight false false M s q pL (pR ++ v) q (pL ++ u) pR = truek:ℕl:ListBlank Γr:ListBlank Γh1:((pL +> l) {{q}}> (pR ++ v) +> v ^ k +> r) [M]⊢^{s} (pL +> u +> l) {{q}}> pR +> v ^ k +> rh2:((pL +> u +> l) {{q}}> pR +> v ^ k +> r) [M]⊢^{s * k} (pL +> u ^ (k + 1) +> l) {{q}}> pR +> r⊢ ((pL +> l) {{q}}> (pR ++ v) +> v ^ k +> r) [M]⊢^{s + s * k} (pL +> u ^ (k + 1) +> l) {{q}}> pR +> r All goals completed! 🐙

Inductive leftward word-run transducer walk.

theorem walkWordLeft {Γ Λ : Type*} [DecidableEq Γ] [DecidableEq Λ] [Inhabited Γ] [Inhabited Λ] {M : Machine Γ Λ} (s : ℕ) (q : Λ) (pL u pR v : List Γ) (hbody : checkHeadRight false false M s q (pL ++ u) pR q pL (pR ++ v) = true) : ∀ (k : ℕ) (l r : ListBlank Γ), ((pL +> ((u ^ k) +> l)) {{q}}> (pR +> r)) [M]⊢^{s * k} ((pL +> l) {{q}}> (pR +> ((v ^ k) +> r))) Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λs:ℕq:ΛpL:List Γu:List ΓpR:List Γv:List Γhbody:checkHeadRight false false M s q (pL ++ u) pR q pL (pR ++ v) = truel:ListBlank Γr:ListBlank Γ⊢ ((pL +> u ^ 0 +> l) {{q}}> pR +> r) [M]⊢^{s * 0} (pL +> l) {{q}}> pR +> v ^ 0 +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λs:ℕq:ΛpL:List Γu:List ΓpR:List Γv:List Γhbody:checkHeadRight false false M s q (pL ++ u) pR q pL (pR ++ v) = truel:ListBlank Γr:ListBlank Γ⊢ ((pL +> u ^ 0 +> l) {{q}}> pR +> r) [M]⊢^{s * 0} (pL +> l) {{q}}> pR +> v ^ 0 +> r All goals completed! 🐙 Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λs:ℕq:ΛpL:List Γu:List ΓpR:List Γv:List Γhbody:checkHeadRight false false M s q (pL ++ u) pR q pL (pR ++ v) = truek:ℕl:ListBlank Γr:ListBlank Γ⊢ ((pL +> u ^ (k + 1) +> l) {{q}}> pR +> r) [M]⊢^{s * (k + 1)} (pL +> l) {{q}}> pR +> v ^ (k + 1) +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λs:ℕq:ΛpL:List Γu:List ΓpR:List Γv:List Γhbody:checkHeadRight false false M s q (pL ++ u) pR q pL (pR ++ v) = truek:ℕl:ListBlank Γr:ListBlank Γ⊢ ((pL +> u ^ (k + 1) +> l) {{q}}> pR +> r) [M]⊢^{s * (k + 1)} (pL +> l) {{q}}> pR +> v ^ (k + 1) +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λs:ℕq:ΛpL:List Γu:List ΓpR:List Γv:List Γhbody:checkHeadRight false false M s q (pL ++ u) pR q pL (pR ++ v) = truek:ℕl:ListBlank Γr:ListBlank Γ⊢ (((pL ++ u) +> u ^ k +> l) {{q}}> pR +> r) [M]⊢^{s * (k + 1)} (pL +> l) {{q}}> pR +> v ^ (k + 1) +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λs:ℕq:ΛpL:List Γu:List ΓpR:List Γv:List Γhbody:checkHeadRight false false M s q (pL ++ u) pR q pL (pR ++ v) = truek:ℕl:ListBlank Γr:ListBlank Γh1:(((pL ++ u) +> u ^ k +> l) {{q}}> pR +> r) [M]⊢^{s} (pL +> u ^ k +> l) {{q}}> (pR ++ v) +> r⊢ (((pL ++ u) +> u ^ k +> l) {{q}}> pR +> r) [M]⊢^{s * (k + 1)} (pL +> l) {{q}}> pR +> v ^ (k + 1) +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λs:ℕq:ΛpL:List Γu:List ΓpR:List Γv:List Γhbody:checkHeadRight false false M s q (pL ++ u) pR q pL (pR ++ v) = truek:ℕl:ListBlank Γr:ListBlank Γh1:(((pL ++ u) +> u ^ k +> l) {{q}}> pR +> r) [M]⊢^{s} (pL +> u ^ k +> l) {{q}}> pR +> v +> r⊢ (((pL ++ u) +> u ^ k +> l) {{q}}> pR +> r) [M]⊢^{s * (k + 1)} (pL +> l) {{q}}> pR +> v ^ (k + 1) +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λs:ℕq:ΛpL:List Γu:List ΓpR:List Γv:List Γhbody:checkHeadRight false false M s q (pL ++ u) pR q pL (pR ++ v) = truek:ℕl:ListBlank Γr:ListBlank Γh1:(((pL ++ u) +> u ^ k +> l) {{q}}> pR +> r) [M]⊢^{s} (pL +> u ^ k +> l) {{q}}> pR +> v +> rh2:((pL +> u ^ k +> l) {{q}}> pR +> v +> r) [M]⊢^{s * k} (pL +> l) {{q}}> pR +> v ^ k +> v +> r⊢ (((pL ++ u) +> u ^ k +> l) {{q}}> pR +> r) [M]⊢^{s * (k + 1)} (pL +> l) {{q}}> pR +> v ^ (k + 1) +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λs:ℕq:ΛpL:List Γu:List ΓpR:List Γv:List Γhbody:checkHeadRight false false M s q (pL ++ u) pR q pL (pR ++ v) = truek:ℕl:ListBlank Γr:ListBlank Γh1:(((pL ++ u) +> u ^ k +> l) {{q}}> pR +> r) [M]⊢^{s} (pL +> u ^ k +> l) {{q}}> pR +> v +> rh2:((pL +> u ^ k +> l) {{q}}> pR +> v +> r) [M]⊢^{s * k} (pL +> l) {{q}}> pR +> v ^ (k + 1) +> r⊢ (((pL ++ u) +> u ^ k +> l) {{q}}> pR +> r) [M]⊢^{s * (k + 1)} (pL +> l) {{q}}> pR +> v ^ (k + 1) +> r Γ:Type u_2Λ:Type u_3inst✝³:DecidableEq Γinst✝²:DecidableEq Λinst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λs:ℕq:ΛpL:List Γu:List ΓpR:List Γv:List Γhbody:checkHeadRight false false M s q (pL ++ u) pR q pL (pR ++ v) = truek:ℕl:ListBlank Γr:ListBlank Γh1:(((pL ++ u) +> u ^ k +> l) {{q}}> pR +> r) [M]⊢^{s} (pL +> u ^ k +> l) {{q}}> pR +> v +> rh2:((pL +> u ^ k +> l) {{q}}> pR +> v +> r) [M]⊢^{s * k} (pL +> l) {{q}}> pR +> v ^ (k + 1) +> r⊢ (((pL ++ u) +> u ^ k +> l) {{q}}> pR +> r) [M]⊢^{s + s * k} (pL +> l) {{q}}> pR +> v ^ (k + 1) +> r All goals completed! 🐙end BusyBeaver.WordRunStack