Imports
/-
Copyright (c) 2026 Google LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
-/
module
public import BusyBeaver.Basic
public import BusyBeaver.Bridge
Shared Wily Coyote Reduction Engine (BusyBeaver/BB33/WilyCoyote.lean)
Shared stacked Collatz-like acceleration (State, WilyMode, wilyPass, start, encode,
next, pat_W, ps) and generic closure proof (StepSpec) for the two 3-state, 3-symbol
Wily Coyote holdout machines (Holdouts #531 and #532):
1RB2LA1LA_2LA0RA2RC_---0LC2RA (Holdout #531)
1RB2LA1LA_2LA0RA2RC_---1RB2RA (Holdout #532)
The two machines agree on 7 of the 8 defined transitions and differ only on (C, 1) (0LC vs.
1RB). Along every pass from W(w) = 0^\infty\,\mathrm{A}{>}\,0\,\overline{w}\,0^\infty, state
C is only entered in mode .s1 ((l <+ [2]) {{C}}> r), where symbol 2 is immediately to the
left of the tape head; consequently C1 -> 0LC -> C2 -> 2RA -> A0 -> 1RB (3 raw steps) and
C1 -> 1RB (1 raw step) both satisfy the same ReachesPlus step enter_s1_true.
@[expose] public sectionnamespace BusyBeaver.WilyCoyoteopen ThreeState Turing
Level B: Stacked Collatz-like Acceleration (State, start, encode, next)
Canonical left-bounce configuration family
W(w) = 0^\infty\,\mathrm{A}{>}\,0\,\overline{w}\,0^\infty.
inductive State where
| W (w : List Bool)
deriving DecidableEq, ReprCarry/pass modes of Racheline's left-to-right sweep transducer for Wily Coyote.
inductive WilyMode where
| s0
| s1
| s2
| s3
deriving DecidableEq, Repr
Left-to-right pass transducer across a boolean cell word (false = symbol 2,
true = symbol 1); returns none when mode .s1 reaches the blank boundary (C0 -> ---).
def wilyPass : WilyMode → List Bool → Option (List Bool)
| .s0, [] => some [false]
| .s0, false :: xs => List.cons true <$> wilyPass .s1 xs
| .s0, true :: xs => List.cons false <$> wilyPass .s2 xs
| .s1, [] => none
| .s1, false :: xs => List.cons true <$> wilyPass .s3 xs
| .s1, true :: xs => List.cons false <$> wilyPass .s0 xs
| .s2, [] => some [true, true, false, false]
| .s2, false :: xs => List.cons false <$> wilyPass .s2 xs
| .s2, true :: xs => List.cons true <$> wilyPass .s1 xs
| .s3, [] => some [false, false]
| .s3, b :: xs => some ((!b) :: xs)
Initial accelerated state W([\mathtt{false}, \mathtt{false}]), reached from init [] in 3
steps.
def start : State := .W [false, false]
Decode an accelerated State into its concrete Turing machine configuration.
@[simp]
def encode : State → Cfg (Fin 3) (Fin 3)
| .W w =>
Cfg.headRight A default
(ListBlank.cons 0 (ListBlank.append (w.map fun b => if b then 1 else 2) default))
One full sweep of the accelerated Wily Coyote transducer (none indicates halting).
def next : State → Option State
| .W w => (fun w' => .W (false :: w')) <$> wilyPass .s0 w
Level A: Closed StackPatternSet (pat_W, ps)
Stack pattern for W(w) = 0^\infty\,\mathrm{A}{>}\,0\,\overline{w}\,0^\infty.
def pat_W : StackPattern (Fin 3) (Fin 3) :=
{ left := []
head := some A
right := [.sym 0, .word [[2], [1]] 0] }
Full StackPatternSet for the Wily Coyote holdout pair.
def ps : StackPatternSet (Fin 3) (Fin 3) :=
[(pat_W, .true)]
Parametric Pass Simulation (StepSpec)
Map a boolean word w into tape cells (true ↦ 1, false ↦ 2).
def encCells (w : List Bool) : List (Fin 3) :=
w.map fun b => if b then 1 else 2
Intermediate tape configuration at mode m with left half-tape l and right half-tape r.
def modeCfg : WilyMode → ListBlank (Fin 3) → ListBlank (Fin 3) → Cfg (Fin 3) (Fin 3)
| .s0, l, r => l {{B}}> r
| .s1, l, r => (l <+ [2]) {{C}}> r
| .s2, l, r => (l <+ [0]) {{A}}> r
| .s3, l, r => l {{A}}> r
Left half-tape upon returning in state <A from mode m.
def exitLeft : WilyMode → ListBlank (Fin 3) → ListBlank (Fin 3)
| .s0, l => l
| .s1, l => l <+ [2]
| .s2, l => l <+ [1]
| .s3, l => lBundle of concrete multi-step obligations shared by both Wily Coyote machines.
structure StepSpec (M : Machine (Fin 3) (Fin 3)) : Prop where
Blank tape reaches encode start in at least one step.
init_reaches : ReachesPlus M (init []) (encode start)
Left-boundary bounce entering mode .s0.
enter_pass (w : List Bool) :
(encode (.W w)) [M]⊢⁺ (modeCfg .s0 (default <+ [1]) (encCells w +> default))
Left-boundary completion returning to encode (.W (false :: out)).
exit_pass (out : List Bool) :
((default <+ [1]) <{{A}} (encCells out +> default)) [M]⊢⁺ (encode (.W (false :: out)))
Leftward <A sweep across symbol 1 (flips 1 ↦ 2).
pop_A_false (l r : ListBlank (Fin 3)) :
((l <+ [1]) <{{A}} r) [M]⊢⁺ (l <{{A}} (([2] : List (Fin 3)) +> r))
Leftward <A sweep across symbol 2 (flips 2 ↦ 1).
pop_A_true (l r : ListBlank (Fin 3)) :
((l <+ [2]) <{{A}} r) [M]⊢⁺ (l <{{A}} (([1] : List (Fin 3)) +> r))
Right boundary in mode .s0.
bound_s0 (l : ListBlank (Fin 3)) :
(modeCfg .s0 l default) [M]⊢⁺ (exitLeft .s0 l <{{A}} (encCells [false] +> default))
Right boundary in mode .s1 halts immediately (C0 -> ---).
bound_s1_halt (l : ListBlank (Fin 3)) :
(step M (modeCfg .s1 l default)).isNone
Right boundary in mode .s2.
bound_s2 (l : ListBlank (Fin 3)) :
(modeCfg .s2 l default) [M]⊢⁺
(exitLeft .s2 l <{{A}} (encCells [true, true, false, false] +> default))
Right boundary in mode .s3 on [].
bound_s3_nil (l : ListBlank (Fin 3)) :
(modeCfg .s3 l default) [M]⊢⁺
(exitLeft .s3 l <{{A}} (encCells [false, false] +> default))
Early exit in mode .s3 on b :: xs.
bound_s3_cons (b : Bool) (l : ListBlank (Fin 3)) (xs : List Bool) :
(modeCfg .s3 l (encCells (b :: xs) +> default)) [M]⊢⁺
(exitLeft .s3 l <{{A}} (encCells ((!b) :: xs) +> default))
Mode .s0 reading 2 (false).
enter_s0_false (l r : ListBlank (Fin 3)) :
(modeCfg .s0 l (([2] : List (Fin 3)) +> r)) [M]⊢⁺ (modeCfg .s1 l r)
Mode .s0 reading 1 (true).
enter_s0_true (l r : ListBlank (Fin 3)) :
(modeCfg .s0 l (([1] : List (Fin 3)) +> r)) [M]⊢⁺ (modeCfg .s2 l r)
Mode .s1 reading 2 (false).
enter_s1_false (l r : ListBlank (Fin 3)) :
(modeCfg .s1 l (([2] : List (Fin 3)) +> r)) [M]⊢⁺ (modeCfg .s3 ((l <+ [2]) <+ [2]) r)
Mode .s1 reading 1 (true): takes 3 raw steps on ---0LC2RA and 1 on ---1RB2RA.
enter_s1_true (l r : ListBlank (Fin 3)) :
(modeCfg .s1 l (([1] : List (Fin 3)) +> r)) [M]⊢⁺ (modeCfg .s0 ((l <+ [2]) <+ [1]) r)
Mode .s2 reading 2 (false).
enter_s2_false (l r : ListBlank (Fin 3)) :
(modeCfg .s2 l (([2] : List (Fin 3)) +> r)) [M]⊢⁺ (modeCfg .s2 (l <+ [1]) r)
Mode .s2 reading 1 (true).
enter_s2_true (l r : ListBlank (Fin 3)) :
(modeCfg .s2 l (([1] : List (Fin 3)) +> r)) [M]⊢⁺ (modeCfg .s1 (l <+ [1]) r)
Discharge all 16 concrete step obligations of StepSpec for a Wily Coyote machine.
macro "prove_wily_step_spec" : tactic =>
`(tactic| (
refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩
· dsimp only [start, encode]; bb_steps
· intro w; dsimp only [encode, modeCfg, encCells]; bb_steps
· intro out; dsimp only [encode, encCells]; bb_steps
· intro l r; bb_steps
· intro l r; bb_steps
· intro l; dsimp only [modeCfg, exitLeft, encCells]; bb_steps
· intro l; dsimp only [modeCfg]; bb_halt
· intro l; dsimp only [modeCfg, exitLeft, encCells]; bb_steps
· intro l; dsimp only [modeCfg, exitLeft, encCells]; bb_steps
· intro b l xs
cases b <;>
(dsimp only [modeCfg, exitLeft, encCells, List.map, Bool.not_false, Bool.not_true]
bb_steps)
· intro l r; dsimp only [modeCfg]; bb_steps
· intro l r; dsimp only [modeCfg]; bb_steps
· intro l r; dsimp only [modeCfg]; bb_steps
· intro l r; dsimp only [modeCfg]; bb_steps
· intro l r; dsimp only [modeCfg]; bb_steps
· intro l r; dsimp only [modeCfg]; bb_steps))private theorem wilyPass_reachesPlus {M : Machine (Fin 3) (Fin 3)} (hs : StepSpec M)
(m : WilyMode) (l : ListBlank (Fin 3)) (w out : List Bool)
(h : wilyPass m w = some out) :
(modeCfg m l (encCells w +> default)) [M]⊢⁺
(exitLeft m l <{{A}} (encCells out +> default)) := M:Machine (Fin 3) (Fin 3)hs:StepSpec Mm:WilyModel:ListBlank (Fin 3)w:List Boolout:List Boolh:wilyPass m w = some out⊢ modeCfg m l (encCells w +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> default
induction w generalizing m l out with
M:Machine (Fin 3) (Fin 3)hs:StepSpec Mm:WilyModel:ListBlank (Fin 3)out:List Boolh:wilyPass m [] = some out⊢ modeCfg m l (encCells [] +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> default
cases m with
M:Machine (Fin 3) (Fin 3)hs:StepSpec Ml:ListBlank (Fin 3)out:List Boolh:wilyPass WilyMode.s0 [] = some out⊢ modeCfg WilyMode.s0 l (encCells [] +> default) [M]⊢⁺ exitLeft WilyMode.s0 l <{{A}} encCells out +> default
M:Machine (Fin 3) (Fin 3)hs:StepSpec Ml:ListBlank (Fin 3)out:List Boolh':[false] = out⊢ modeCfg WilyMode.s0 l (encCells [] +> default) [M]⊢⁺ exitLeft WilyMode.s0 l <{{A}} encCells out +> default
M:Machine (Fin 3) (Fin 3)hs:StepSpec Ml:ListBlank (Fin 3)⊢ modeCfg WilyMode.s0 l (encCells [] +> default) [M]⊢⁺ exitLeft WilyMode.s0 l <{{A}} encCells [false] +> default
All goals completed! 🐙
M:Machine (Fin 3) (Fin 3)hs:StepSpec Ml:ListBlank (Fin 3)out:List Boolh:wilyPass WilyMode.s1 [] = some out⊢ modeCfg WilyMode.s1 l (encCells [] +> default) [M]⊢⁺ exitLeft WilyMode.s1 l <{{A}} encCells out +> default All goals completed! 🐙
M:Machine (Fin 3) (Fin 3)hs:StepSpec Ml:ListBlank (Fin 3)out:List Boolh:wilyPass WilyMode.s2 [] = some out⊢ modeCfg WilyMode.s2 l (encCells [] +> default) [M]⊢⁺ exitLeft WilyMode.s2 l <{{A}} encCells out +> default
M:Machine (Fin 3) (Fin 3)hs:StepSpec Ml:ListBlank (Fin 3)out:List Boolh':[true, true, false, false] = out⊢ modeCfg WilyMode.s2 l (encCells [] +> default) [M]⊢⁺ exitLeft WilyMode.s2 l <{{A}} encCells out +> default
M:Machine (Fin 3) (Fin 3)hs:StepSpec Ml:ListBlank (Fin 3)⊢ modeCfg WilyMode.s2 l (encCells [] +> default) [M]⊢⁺
exitLeft WilyMode.s2 l <{{A}} encCells [true, true, false, false] +> default
All goals completed! 🐙
M:Machine (Fin 3) (Fin 3)hs:StepSpec Ml:ListBlank (Fin 3)out:List Boolh:wilyPass WilyMode.s3 [] = some out⊢ modeCfg WilyMode.s3 l (encCells [] +> default) [M]⊢⁺ exitLeft WilyMode.s3 l <{{A}} encCells out +> default
M:Machine (Fin 3) (Fin 3)hs:StepSpec Ml:ListBlank (Fin 3)out:List Boolh':[false, false] = out⊢ modeCfg WilyMode.s3 l (encCells [] +> default) [M]⊢⁺ exitLeft WilyMode.s3 l <{{A}} encCells out +> default
M:Machine (Fin 3) (Fin 3)hs:StepSpec Ml:ListBlank (Fin 3)⊢ modeCfg WilyMode.s3 l (encCells [] +> default) [M]⊢⁺ exitLeft WilyMode.s3 l <{{A}} encCells [false, false] +> default
All goals completed! 🐙
M:Machine (Fin 3) (Fin 3)hs:StepSpec Mb:Boolxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultm:WilyModel:ListBlank (Fin 3)out:List Boolh:wilyPass m (b :: xs) = some out⊢ modeCfg m l (encCells (b :: xs) +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> default
cases m with
M:Machine (Fin 3) (Fin 3)hs:StepSpec Mb:Boolxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:wilyPass WilyMode.s0 (b :: xs) = some out⊢ modeCfg WilyMode.s0 l (encCells (b :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s0 l <{{A}} encCells out +> default
cases b with
M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:wilyPass WilyMode.s0 (false :: xs) = some out⊢ modeCfg WilyMode.s0 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s0 l <{{A}} encCells out +> default
M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons true <$> wilyPass WilyMode.s1 xs = some out⊢ modeCfg WilyMode.s0 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s0 l <{{A}} encCells out +> default
cases hp : wilyPass .s1 xs with
M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons true <$> wilyPass WilyMode.s1 xs = some outhp:wilyPass WilyMode.s1 xs = none⊢ modeCfg WilyMode.s0 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s0 l <{{A}} encCells out +> default cons.s0.false.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons true <$> none = some outhp:wilyPass WilyMode.s1 xs = none⊢ modeCfg WilyMode.s0 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s0 l <{{A}} encCells out +> default; cases h All goals completed! 🐙
| some ys => cons.s0.false.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons true <$> wilyPass WilyMode.s1 xs = some outys:List Boolhp:wilyPass WilyMode.s1 xs = some ys⊢ modeCfg WilyMode.s0 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s0 l <{{A}} encCells out +> default
rw [hp cons.s0.false.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolys:List Boolh:List.cons true <$> some ys = some outhp:wilyPass WilyMode.s1 xs = some ys⊢ modeCfg WilyMode.s0 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s0 l <{{A}} encCells out +> default] at h cons.s0.false.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolys:List Boolh:List.cons true <$> some ys = some outhp:wilyPass WilyMode.s1 xs = some ys⊢ modeCfg WilyMode.s0 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s0 l <{{A}} encCells out +> default
injection h with h' cons.s0.false.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolys:List Boolhp:wilyPass WilyMode.s1 xs = some ysh':true :: ys = out⊢ modeCfg WilyMode.s0 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s0 l <{{A}} encCells out +> default
subst h' cons.s0.false.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)ys:List Boolhp:wilyPass WilyMode.s1 xs = some ys⊢ modeCfg WilyMode.s0 l (encCells (false :: xs) +> default) [M]⊢⁺
exitLeft WilyMode.s0 l <{{A}} encCells (true :: ys) +> default
exact ((hs.enter_s0_false l _).trans (ih .s1 l ys hp)).trans (hs.pop_A_true l _) All goals completed! 🐙
| true => cons.s0.true M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:wilyPass WilyMode.s0 (true :: xs) = some out⊢ modeCfg WilyMode.s0 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s0 l <{{A}} encCells out +> default
dsimp only [wilyPass] at h cons.s0.true M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons false <$> wilyPass WilyMode.s2 xs = some out⊢ modeCfg WilyMode.s0 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s0 l <{{A}} encCells out +> default
cases hp : wilyPass .s2 xs with
| none => cons.s0.true.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons false <$> wilyPass WilyMode.s2 xs = some outhp:wilyPass WilyMode.s2 xs = none⊢ modeCfg WilyMode.s0 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s0 l <{{A}} encCells out +> default rw [hp cons.s0.true.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons false <$> none = some outhp:wilyPass WilyMode.s2 xs = none⊢ modeCfg WilyMode.s0 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s0 l <{{A}} encCells out +> default] at h cons.s0.true.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons false <$> none = some outhp:wilyPass WilyMode.s2 xs = none⊢ modeCfg WilyMode.s0 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s0 l <{{A}} encCells out +> default; cases h All goals completed! 🐙
| some ys => cons.s0.true.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons false <$> wilyPass WilyMode.s2 xs = some outys:List Boolhp:wilyPass WilyMode.s2 xs = some ys⊢ modeCfg WilyMode.s0 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s0 l <{{A}} encCells out +> default
rw [hp cons.s0.true.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolys:List Boolh:List.cons false <$> some ys = some outhp:wilyPass WilyMode.s2 xs = some ys⊢ modeCfg WilyMode.s0 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s0 l <{{A}} encCells out +> default] at h cons.s0.true.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolys:List Boolh:List.cons false <$> some ys = some outhp:wilyPass WilyMode.s2 xs = some ys⊢ modeCfg WilyMode.s0 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s0 l <{{A}} encCells out +> default
injection h with h' cons.s0.true.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolys:List Boolhp:wilyPass WilyMode.s2 xs = some ysh':false :: ys = out⊢ modeCfg WilyMode.s0 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s0 l <{{A}} encCells out +> default
subst h' cons.s0.true.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)ys:List Boolhp:wilyPass WilyMode.s2 xs = some ys⊢ modeCfg WilyMode.s0 l (encCells (true :: xs) +> default) [M]⊢⁺
exitLeft WilyMode.s0 l <{{A}} encCells (false :: ys) +> default
exact ((hs.enter_s0_true l _).trans (ih .s2 l ys hp)).trans (hs.pop_A_false l _) All goals completed! 🐙
| s1 => cons.s1 M:Machine (Fin 3) (Fin 3)hs:StepSpec Mb:Boolxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:wilyPass WilyMode.s1 (b :: xs) = some out⊢ modeCfg WilyMode.s1 l (encCells (b :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s1 l <{{A}} encCells out +> default
cases b with
| false => cons.s1.false M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:wilyPass WilyMode.s1 (false :: xs) = some out⊢ modeCfg WilyMode.s1 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s1 l <{{A}} encCells out +> default
dsimp only [wilyPass] at h cons.s1.false M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons true <$> wilyPass WilyMode.s3 xs = some out⊢ modeCfg WilyMode.s1 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s1 l <{{A}} encCells out +> default
cases hp : wilyPass .s3 xs with
| none => cons.s1.false.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons true <$> wilyPass WilyMode.s3 xs = some outhp:wilyPass WilyMode.s3 xs = none⊢ modeCfg WilyMode.s1 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s1 l <{{A}} encCells out +> default rw [hp cons.s1.false.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons true <$> none = some outhp:wilyPass WilyMode.s3 xs = none⊢ modeCfg WilyMode.s1 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s1 l <{{A}} encCells out +> default] at h cons.s1.false.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons true <$> none = some outhp:wilyPass WilyMode.s3 xs = none⊢ modeCfg WilyMode.s1 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s1 l <{{A}} encCells out +> default; cases h All goals completed! 🐙
| some ys => cons.s1.false.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons true <$> wilyPass WilyMode.s3 xs = some outys:List Boolhp:wilyPass WilyMode.s3 xs = some ys⊢ modeCfg WilyMode.s1 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s1 l <{{A}} encCells out +> default
rw [hp cons.s1.false.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolys:List Boolh:List.cons true <$> some ys = some outhp:wilyPass WilyMode.s3 xs = some ys⊢ modeCfg WilyMode.s1 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s1 l <{{A}} encCells out +> default] at h cons.s1.false.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolys:List Boolh:List.cons true <$> some ys = some outhp:wilyPass WilyMode.s3 xs = some ys⊢ modeCfg WilyMode.s1 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s1 l <{{A}} encCells out +> default
injection h with h' cons.s1.false.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolys:List Boolhp:wilyPass WilyMode.s3 xs = some ysh':true :: ys = out⊢ modeCfg WilyMode.s1 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s1 l <{{A}} encCells out +> default
subst h' cons.s1.false.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)ys:List Boolhp:wilyPass WilyMode.s3 xs = some ys⊢ modeCfg WilyMode.s1 l (encCells (false :: xs) +> default) [M]⊢⁺
exitLeft WilyMode.s1 l <{{A}} encCells (true :: ys) +> default
exact ((hs.enter_s1_false l _).trans
(ih .s3 ((l <+ [2]) <+ [2]) ys hp)).trans (hs.pop_A_true (l <+ [2]) _) All goals completed! 🐙
| true => cons.s1.true M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:wilyPass WilyMode.s1 (true :: xs) = some out⊢ modeCfg WilyMode.s1 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s1 l <{{A}} encCells out +> default
dsimp only [wilyPass] at h cons.s1.true M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons false <$> wilyPass WilyMode.s0 xs = some out⊢ modeCfg WilyMode.s1 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s1 l <{{A}} encCells out +> default
cases hp : wilyPass .s0 xs with
| none => cons.s1.true.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons false <$> wilyPass WilyMode.s0 xs = some outhp:wilyPass WilyMode.s0 xs = none⊢ modeCfg WilyMode.s1 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s1 l <{{A}} encCells out +> default rw [hp cons.s1.true.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons false <$> none = some outhp:wilyPass WilyMode.s0 xs = none⊢ modeCfg WilyMode.s1 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s1 l <{{A}} encCells out +> default] at h cons.s1.true.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons false <$> none = some outhp:wilyPass WilyMode.s0 xs = none⊢ modeCfg WilyMode.s1 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s1 l <{{A}} encCells out +> default; cases h All goals completed! 🐙
| some ys => cons.s1.true.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons false <$> wilyPass WilyMode.s0 xs = some outys:List Boolhp:wilyPass WilyMode.s0 xs = some ys⊢ modeCfg WilyMode.s1 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s1 l <{{A}} encCells out +> default
rw [hp cons.s1.true.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolys:List Boolh:List.cons false <$> some ys = some outhp:wilyPass WilyMode.s0 xs = some ys⊢ modeCfg WilyMode.s1 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s1 l <{{A}} encCells out +> default] at h cons.s1.true.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolys:List Boolh:List.cons false <$> some ys = some outhp:wilyPass WilyMode.s0 xs = some ys⊢ modeCfg WilyMode.s1 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s1 l <{{A}} encCells out +> default
injection h with h' cons.s1.true.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolys:List Boolhp:wilyPass WilyMode.s0 xs = some ysh':false :: ys = out⊢ modeCfg WilyMode.s1 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s1 l <{{A}} encCells out +> default
subst h' cons.s1.true.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)ys:List Boolhp:wilyPass WilyMode.s0 xs = some ys⊢ modeCfg WilyMode.s1 l (encCells (true :: xs) +> default) [M]⊢⁺
exitLeft WilyMode.s1 l <{{A}} encCells (false :: ys) +> default
exact ((hs.enter_s1_true l _).trans
(ih .s0 ((l <+ [2]) <+ [1]) ys hp)).trans (hs.pop_A_false (l <+ [2]) _) All goals completed! 🐙
| s2 => cons.s2 M:Machine (Fin 3) (Fin 3)hs:StepSpec Mb:Boolxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:wilyPass WilyMode.s2 (b :: xs) = some out⊢ modeCfg WilyMode.s2 l (encCells (b :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s2 l <{{A}} encCells out +> default
cases b with
| false => cons.s2.false M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:wilyPass WilyMode.s2 (false :: xs) = some out⊢ modeCfg WilyMode.s2 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s2 l <{{A}} encCells out +> default
dsimp only [wilyPass] at h cons.s2.false M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons false <$> wilyPass WilyMode.s2 xs = some out⊢ modeCfg WilyMode.s2 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s2 l <{{A}} encCells out +> default
cases hp : wilyPass .s2 xs with
| none => cons.s2.false.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons false <$> wilyPass WilyMode.s2 xs = some outhp:wilyPass WilyMode.s2 xs = none⊢ modeCfg WilyMode.s2 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s2 l <{{A}} encCells out +> default rw [hp cons.s2.false.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons false <$> none = some outhp:wilyPass WilyMode.s2 xs = none⊢ modeCfg WilyMode.s2 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s2 l <{{A}} encCells out +> default] at h cons.s2.false.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons false <$> none = some outhp:wilyPass WilyMode.s2 xs = none⊢ modeCfg WilyMode.s2 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s2 l <{{A}} encCells out +> default; cases h All goals completed! 🐙
| some ys => cons.s2.false.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons false <$> wilyPass WilyMode.s2 xs = some outys:List Boolhp:wilyPass WilyMode.s2 xs = some ys⊢ modeCfg WilyMode.s2 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s2 l <{{A}} encCells out +> default
rw [hp cons.s2.false.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolys:List Boolh:List.cons false <$> some ys = some outhp:wilyPass WilyMode.s2 xs = some ys⊢ modeCfg WilyMode.s2 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s2 l <{{A}} encCells out +> default] at h cons.s2.false.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolys:List Boolh:List.cons false <$> some ys = some outhp:wilyPass WilyMode.s2 xs = some ys⊢ modeCfg WilyMode.s2 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s2 l <{{A}} encCells out +> default
injection h with h' cons.s2.false.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolys:List Boolhp:wilyPass WilyMode.s2 xs = some ysh':false :: ys = out⊢ modeCfg WilyMode.s2 l (encCells (false :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s2 l <{{A}} encCells out +> default
subst h' cons.s2.false.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)ys:List Boolhp:wilyPass WilyMode.s2 xs = some ys⊢ modeCfg WilyMode.s2 l (encCells (false :: xs) +> default) [M]⊢⁺
exitLeft WilyMode.s2 l <{{A}} encCells (false :: ys) +> default
exact ((hs.enter_s2_false l _).trans
(ih .s2 (l <+ [1]) ys hp)).trans (hs.pop_A_false (l <+ [1]) _) All goals completed! 🐙
| true => cons.s2.true M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:wilyPass WilyMode.s2 (true :: xs) = some out⊢ modeCfg WilyMode.s2 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s2 l <{{A}} encCells out +> default
dsimp only [wilyPass] at h cons.s2.true M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons true <$> wilyPass WilyMode.s1 xs = some out⊢ modeCfg WilyMode.s2 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s2 l <{{A}} encCells out +> default
cases hp : wilyPass .s1 xs with
| none => cons.s2.true.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons true <$> wilyPass WilyMode.s1 xs = some outhp:wilyPass WilyMode.s1 xs = none⊢ modeCfg WilyMode.s2 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s2 l <{{A}} encCells out +> default rw [hp cons.s2.true.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons true <$> none = some outhp:wilyPass WilyMode.s1 xs = none⊢ modeCfg WilyMode.s2 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s2 l <{{A}} encCells out +> default] at h cons.s2.true.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons true <$> none = some outhp:wilyPass WilyMode.s1 xs = none⊢ modeCfg WilyMode.s2 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s2 l <{{A}} encCells out +> default; cases h All goals completed! 🐙
| some ys => cons.s2.true.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:List.cons true <$> wilyPass WilyMode.s1 xs = some outys:List Boolhp:wilyPass WilyMode.s1 xs = some ys⊢ modeCfg WilyMode.s2 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s2 l <{{A}} encCells out +> default
rw [hp cons.s2.true.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolys:List Boolh:List.cons true <$> some ys = some outhp:wilyPass WilyMode.s1 xs = some ys⊢ modeCfg WilyMode.s2 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s2 l <{{A}} encCells out +> default] at h cons.s2.true.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolys:List Boolh:List.cons true <$> some ys = some outhp:wilyPass WilyMode.s1 xs = some ys⊢ modeCfg WilyMode.s2 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s2 l <{{A}} encCells out +> default
injection h with h' cons.s2.true.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolys:List Boolhp:wilyPass WilyMode.s1 xs = some ysh':true :: ys = out⊢ modeCfg WilyMode.s2 l (encCells (true :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s2 l <{{A}} encCells out +> default
subst h' cons.s2.true.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)ys:List Boolhp:wilyPass WilyMode.s1 xs = some ys⊢ modeCfg WilyMode.s2 l (encCells (true :: xs) +> default) [M]⊢⁺
exitLeft WilyMode.s2 l <{{A}} encCells (true :: ys) +> default
exact ((hs.enter_s2_true l _).trans
(ih .s1 (l <+ [1]) ys hp)).trans (hs.pop_A_true (l <+ [1]) _) All goals completed! 🐙
| s3 => cons.s3 M:Machine (Fin 3) (Fin 3)hs:StepSpec Mb:Boolxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:wilyPass WilyMode.s3 (b :: xs) = some out⊢ modeCfg WilyMode.s3 l (encCells (b :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s3 l <{{A}} encCells out +> default
dsimp only [wilyPass] at h cons.s3 M:Machine (Fin 3) (Fin 3)hs:StepSpec Mb:Boolxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh:some ((!b) :: xs) = some out⊢ modeCfg WilyMode.s3 l (encCells (b :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s3 l <{{A}} encCells out +> default
injection h with h' cons.s3 M:Machine (Fin 3) (Fin 3)hs:StepSpec Mb:Boolxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)out:List Boolh':(!b) :: xs = out⊢ modeCfg WilyMode.s3 l (encCells (b :: xs) +> default) [M]⊢⁺ exitLeft WilyMode.s3 l <{{A}} encCells out +> default
subst h' cons.s3 M:Machine (Fin 3) (Fin 3)hs:StepSpec Mb:Boolxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)) (out : List Bool),
wilyPass m xs = some out → modeCfg m l (encCells xs +> default) [M]⊢⁺ exitLeft m l <{{A}} encCells out +> defaultl:ListBlank (Fin 3)⊢ modeCfg WilyMode.s3 l (encCells (b :: xs) +> default) [M]⊢⁺
exitLeft WilyMode.s3 l <{{A}} encCells ((!b) :: xs) +> default
exact hs.bound_s3_cons b l xs All goals completed! 🐙private theorem wilyPass_halts {M : Machine (Fin 3) (Fin 3)} (hs : StepSpec M)
(m : WilyMode) (l : ListBlank (Fin 3)) (w : List Bool)
(h : wilyPass m w = none) :
∃ cfg', ((modeCfg m l (encCells w +> default)) [M]⊢* cfg') ∧
(step M cfg').isNone := by M:Machine (Fin 3) (Fin 3)hs:StepSpec Mm:WilyModel:ListBlank (Fin 3)w:List Boolh:wilyPass m w = none⊢ ∃ cfg', (modeCfg m l (encCells w +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
induction w generalizing m l with
| nil => nil M:Machine (Fin 3) (Fin 3)hs:StepSpec Mm:WilyModel:ListBlank (Fin 3)h:wilyPass m [] = none⊢ ∃ cfg', (modeCfg m l (encCells [] +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
cases m with
| s0 => nil.s0 M:Machine (Fin 3) (Fin 3)hs:StepSpec Ml:ListBlank (Fin 3)h:wilyPass WilyMode.s0 [] = none⊢ ∃ cfg', (modeCfg WilyMode.s0 l (encCells [] +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true cases h All goals completed! 🐙
| s1 => nil.s1 M:Machine (Fin 3) (Fin 3)hs:StepSpec Ml:ListBlank (Fin 3)h:wilyPass WilyMode.s1 [] = none⊢ ∃ cfg', (modeCfg WilyMode.s1 l (encCells [] +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true exact ⟨modeCfg .s1 l default, ReachesStar.refl _ _, hs.bound_s1_halt l⟩ All goals completed! 🐙
| s2 => nil.s2 M:Machine (Fin 3) (Fin 3)hs:StepSpec Ml:ListBlank (Fin 3)h:wilyPass WilyMode.s2 [] = none⊢ ∃ cfg', (modeCfg WilyMode.s2 l (encCells [] +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true cases h All goals completed! 🐙
| s3 => nil.s3 M:Machine (Fin 3) (Fin 3)hs:StepSpec Ml:ListBlank (Fin 3)h:wilyPass WilyMode.s3 [] = none⊢ ∃ cfg', (modeCfg WilyMode.s3 l (encCells [] +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true cases h All goals completed! 🐙
| cons b xs ih => cons M:Machine (Fin 3) (Fin 3)hs:StepSpec Mb:Boolxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truem:WilyModel:ListBlank (Fin 3)h:wilyPass m (b :: xs) = none⊢ ∃ cfg', (modeCfg m l (encCells (b :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
cases m with
| s0 => cons.s0 M:Machine (Fin 3) (Fin 3)hs:StepSpec Mb:Boolxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:wilyPass WilyMode.s0 (b :: xs) = none⊢ ∃ cfg', (modeCfg WilyMode.s0 l (encCells (b :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
cases b with
| false => cons.s0.false M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:wilyPass WilyMode.s0 (false :: xs) = none⊢ ∃ cfg', (modeCfg WilyMode.s0 l (encCells (false :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
dsimp only [wilyPass] at h cons.s0.false M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:List.cons true <$> wilyPass WilyMode.s1 xs = none⊢ ∃ cfg', (modeCfg WilyMode.s0 l (encCells (false :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
cases hp : wilyPass .s1 xs with
| some ys => cons.s0.false.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:List.cons true <$> wilyPass WilyMode.s1 xs = noneys:List Boolhp:wilyPass WilyMode.s1 xs = some ys⊢ ∃ cfg', (modeCfg WilyMode.s0 l (encCells (false :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true rw [hp cons.s0.false.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)ys:List Boolh:List.cons true <$> some ys = nonehp:wilyPass WilyMode.s1 xs = some ys⊢ ∃ cfg', (modeCfg WilyMode.s0 l (encCells (false :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true] at h cons.s0.false.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)ys:List Boolh:List.cons true <$> some ys = nonehp:wilyPass WilyMode.s1 xs = some ys⊢ ∃ cfg', (modeCfg WilyMode.s0 l (encCells (false :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true; cases h All goals completed! 🐙
| none => cons.s0.false.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:List.cons true <$> wilyPass WilyMode.s1 xs = nonehp:wilyPass WilyMode.s1 xs = none⊢ ∃ cfg', (modeCfg WilyMode.s0 l (encCells (false :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
obtain ⟨cfg', hreach, hnone⟩ := ih .s1 l hp cons.s0.false.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:List.cons true <$> wilyPass WilyMode.s1 xs = nonehp:wilyPass WilyMode.s1 xs = nonecfg':Cfg (Fin 3) (Fin 3)hreach:modeCfg WilyMode.s1 l (encCells xs +> default) [M]⊢* cfg'hnone:(step M cfg').isNone = true⊢ ∃ cfg', (modeCfg WilyMode.s0 l (encCells (false :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
exact ⟨cfg', (hs.enter_s0_false l _).to_star.trans hreach, hnone⟩ All goals completed! 🐙
| true => cons.s0.true M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:wilyPass WilyMode.s0 (true :: xs) = none⊢ ∃ cfg', (modeCfg WilyMode.s0 l (encCells (true :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
dsimp only [wilyPass] at h cons.s0.true M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:List.cons false <$> wilyPass WilyMode.s2 xs = none⊢ ∃ cfg', (modeCfg WilyMode.s0 l (encCells (true :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
cases hp : wilyPass .s2 xs with
| some ys => cons.s0.true.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:List.cons false <$> wilyPass WilyMode.s2 xs = noneys:List Boolhp:wilyPass WilyMode.s2 xs = some ys⊢ ∃ cfg', (modeCfg WilyMode.s0 l (encCells (true :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true rw [hp cons.s0.true.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)ys:List Boolh:List.cons false <$> some ys = nonehp:wilyPass WilyMode.s2 xs = some ys⊢ ∃ cfg', (modeCfg WilyMode.s0 l (encCells (true :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true] at h cons.s0.true.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)ys:List Boolh:List.cons false <$> some ys = nonehp:wilyPass WilyMode.s2 xs = some ys⊢ ∃ cfg', (modeCfg WilyMode.s0 l (encCells (true :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true; cases h All goals completed! 🐙
| none => cons.s0.true.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:List.cons false <$> wilyPass WilyMode.s2 xs = nonehp:wilyPass WilyMode.s2 xs = none⊢ ∃ cfg', (modeCfg WilyMode.s0 l (encCells (true :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
obtain ⟨cfg', hreach, hnone⟩ := ih .s2 l hp cons.s0.true.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:List.cons false <$> wilyPass WilyMode.s2 xs = nonehp:wilyPass WilyMode.s2 xs = nonecfg':Cfg (Fin 3) (Fin 3)hreach:modeCfg WilyMode.s2 l (encCells xs +> default) [M]⊢* cfg'hnone:(step M cfg').isNone = true⊢ ∃ cfg', (modeCfg WilyMode.s0 l (encCells (true :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
exact ⟨cfg', (hs.enter_s0_true l _).to_star.trans hreach, hnone⟩ All goals completed! 🐙
| s1 => cons.s1 M:Machine (Fin 3) (Fin 3)hs:StepSpec Mb:Boolxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:wilyPass WilyMode.s1 (b :: xs) = none⊢ ∃ cfg', (modeCfg WilyMode.s1 l (encCells (b :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
cases b with
| false => cons.s1.false M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:wilyPass WilyMode.s1 (false :: xs) = none⊢ ∃ cfg', (modeCfg WilyMode.s1 l (encCells (false :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
dsimp only [wilyPass] at h cons.s1.false M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:List.cons true <$> wilyPass WilyMode.s3 xs = none⊢ ∃ cfg', (modeCfg WilyMode.s1 l (encCells (false :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
cases hp : wilyPass .s3 xs with
| some ys => cons.s1.false.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:List.cons true <$> wilyPass WilyMode.s3 xs = noneys:List Boolhp:wilyPass WilyMode.s3 xs = some ys⊢ ∃ cfg', (modeCfg WilyMode.s1 l (encCells (false :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true rw [hp cons.s1.false.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)ys:List Boolh:List.cons true <$> some ys = nonehp:wilyPass WilyMode.s3 xs = some ys⊢ ∃ cfg', (modeCfg WilyMode.s1 l (encCells (false :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true] at h cons.s1.false.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)ys:List Boolh:List.cons true <$> some ys = nonehp:wilyPass WilyMode.s3 xs = some ys⊢ ∃ cfg', (modeCfg WilyMode.s1 l (encCells (false :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true; cases h All goals completed! 🐙
| none => cons.s1.false.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:List.cons true <$> wilyPass WilyMode.s3 xs = nonehp:wilyPass WilyMode.s3 xs = none⊢ ∃ cfg', (modeCfg WilyMode.s1 l (encCells (false :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
obtain ⟨cfg', hreach, hnone⟩ := ih .s3 ((l <+ [2]) <+ [2]) hp cons.s1.false.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:List.cons true <$> wilyPass WilyMode.s3 xs = nonehp:wilyPass WilyMode.s3 xs = nonecfg':Cfg (Fin 3) (Fin 3)hreach:modeCfg WilyMode.s3 ([2] +> [2] +> l) (encCells xs +> default) [M]⊢* cfg'hnone:(step M cfg').isNone = true⊢ ∃ cfg', (modeCfg WilyMode.s1 l (encCells (false :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
exact ⟨cfg', (hs.enter_s1_false l _).to_star.trans hreach, hnone⟩ All goals completed! 🐙
| true => cons.s1.true M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:wilyPass WilyMode.s1 (true :: xs) = none⊢ ∃ cfg', (modeCfg WilyMode.s1 l (encCells (true :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
dsimp only [wilyPass] at h cons.s1.true M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:List.cons false <$> wilyPass WilyMode.s0 xs = none⊢ ∃ cfg', (modeCfg WilyMode.s1 l (encCells (true :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
cases hp : wilyPass .s0 xs with
| some ys => cons.s1.true.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:List.cons false <$> wilyPass WilyMode.s0 xs = noneys:List Boolhp:wilyPass WilyMode.s0 xs = some ys⊢ ∃ cfg', (modeCfg WilyMode.s1 l (encCells (true :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true rw [hp cons.s1.true.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)ys:List Boolh:List.cons false <$> some ys = nonehp:wilyPass WilyMode.s0 xs = some ys⊢ ∃ cfg', (modeCfg WilyMode.s1 l (encCells (true :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true] at h cons.s1.true.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)ys:List Boolh:List.cons false <$> some ys = nonehp:wilyPass WilyMode.s0 xs = some ys⊢ ∃ cfg', (modeCfg WilyMode.s1 l (encCells (true :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true; cases h All goals completed! 🐙
| none => cons.s1.true.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:List.cons false <$> wilyPass WilyMode.s0 xs = nonehp:wilyPass WilyMode.s0 xs = none⊢ ∃ cfg', (modeCfg WilyMode.s1 l (encCells (true :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
obtain ⟨cfg', hreach, hnone⟩ := ih .s0 ((l <+ [2]) <+ [1]) hp cons.s1.true.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:List.cons false <$> wilyPass WilyMode.s0 xs = nonehp:wilyPass WilyMode.s0 xs = nonecfg':Cfg (Fin 3) (Fin 3)hreach:modeCfg WilyMode.s0 ([1] +> [2] +> l) (encCells xs +> default) [M]⊢* cfg'hnone:(step M cfg').isNone = true⊢ ∃ cfg', (modeCfg WilyMode.s1 l (encCells (true :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
exact ⟨cfg', (hs.enter_s1_true l _).to_star.trans hreach, hnone⟩ All goals completed! 🐙
| s2 => cons.s2 M:Machine (Fin 3) (Fin 3)hs:StepSpec Mb:Boolxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:wilyPass WilyMode.s2 (b :: xs) = none⊢ ∃ cfg', (modeCfg WilyMode.s2 l (encCells (b :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
cases b with
| false => cons.s2.false M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:wilyPass WilyMode.s2 (false :: xs) = none⊢ ∃ cfg', (modeCfg WilyMode.s2 l (encCells (false :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
dsimp only [wilyPass] at h cons.s2.false M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:List.cons false <$> wilyPass WilyMode.s2 xs = none⊢ ∃ cfg', (modeCfg WilyMode.s2 l (encCells (false :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
cases hp : wilyPass .s2 xs with
| some ys => cons.s2.false.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:List.cons false <$> wilyPass WilyMode.s2 xs = noneys:List Boolhp:wilyPass WilyMode.s2 xs = some ys⊢ ∃ cfg', (modeCfg WilyMode.s2 l (encCells (false :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true rw [hp cons.s2.false.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)ys:List Boolh:List.cons false <$> some ys = nonehp:wilyPass WilyMode.s2 xs = some ys⊢ ∃ cfg', (modeCfg WilyMode.s2 l (encCells (false :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true] at h cons.s2.false.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)ys:List Boolh:List.cons false <$> some ys = nonehp:wilyPass WilyMode.s2 xs = some ys⊢ ∃ cfg', (modeCfg WilyMode.s2 l (encCells (false :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true; cases h All goals completed! 🐙
| none => cons.s2.false.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:List.cons false <$> wilyPass WilyMode.s2 xs = nonehp:wilyPass WilyMode.s2 xs = none⊢ ∃ cfg', (modeCfg WilyMode.s2 l (encCells (false :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
obtain ⟨cfg', hreach, hnone⟩ := ih .s2 (l <+ [1]) hp cons.s2.false.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:List.cons false <$> wilyPass WilyMode.s2 xs = nonehp:wilyPass WilyMode.s2 xs = nonecfg':Cfg (Fin 3) (Fin 3)hreach:modeCfg WilyMode.s2 ([1] +> l) (encCells xs +> default) [M]⊢* cfg'hnone:(step M cfg').isNone = true⊢ ∃ cfg', (modeCfg WilyMode.s2 l (encCells (false :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
exact ⟨cfg', (hs.enter_s2_false l _).to_star.trans hreach, hnone⟩ All goals completed! 🐙
| true => cons.s2.true M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:wilyPass WilyMode.s2 (true :: xs) = none⊢ ∃ cfg', (modeCfg WilyMode.s2 l (encCells (true :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
dsimp only [wilyPass] at h cons.s2.true M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:List.cons true <$> wilyPass WilyMode.s1 xs = none⊢ ∃ cfg', (modeCfg WilyMode.s2 l (encCells (true :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
cases hp : wilyPass .s1 xs with
| some ys => cons.s2.true.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:List.cons true <$> wilyPass WilyMode.s1 xs = noneys:List Boolhp:wilyPass WilyMode.s1 xs = some ys⊢ ∃ cfg', (modeCfg WilyMode.s2 l (encCells (true :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true rw [hp cons.s2.true.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)ys:List Boolh:List.cons true <$> some ys = nonehp:wilyPass WilyMode.s1 xs = some ys⊢ ∃ cfg', (modeCfg WilyMode.s2 l (encCells (true :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true] at h cons.s2.true.some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)ys:List Boolh:List.cons true <$> some ys = nonehp:wilyPass WilyMode.s1 xs = some ys⊢ ∃ cfg', (modeCfg WilyMode.s2 l (encCells (true :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true; cases h All goals completed! 🐙
| none => cons.s2.true.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:List.cons true <$> wilyPass WilyMode.s1 xs = nonehp:wilyPass WilyMode.s1 xs = none⊢ ∃ cfg', (modeCfg WilyMode.s2 l (encCells (true :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
obtain ⟨cfg', hreach, hnone⟩ := ih .s1 (l <+ [1]) hp cons.s2.true.none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:List.cons true <$> wilyPass WilyMode.s1 xs = nonehp:wilyPass WilyMode.s1 xs = nonecfg':Cfg (Fin 3) (Fin 3)hreach:modeCfg WilyMode.s1 ([1] +> l) (encCells xs +> default) [M]⊢* cfg'hnone:(step M cfg').isNone = true⊢ ∃ cfg', (modeCfg WilyMode.s2 l (encCells (true :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true
exact ⟨cfg', (hs.enter_s2_true l _).to_star.trans hreach, hnone⟩ All goals completed! 🐙
| s3 => cons.s3 M:Machine (Fin 3) (Fin 3)hs:StepSpec Mb:Boolxs:List Boolih:∀ (m : WilyMode) (l : ListBlank (Fin 3)),
wilyPass m xs = none → ∃ cfg', (modeCfg m l (encCells xs +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = truel:ListBlank (Fin 3)h:wilyPass WilyMode.s3 (b :: xs) = none⊢ ∃ cfg', (modeCfg WilyMode.s3 l (encCells (b :: xs) +> default) [M]⊢* cfg') ∧ (step M cfg').isNone = true cases h All goals completed! 🐙private theorem step_state_plus {M : Machine (Fin 3) (Fin 3)} (hs : StepSpec M) (s : State) :
match next s with
| some s' => ReachesPlus M (encode s) (encode s')
| none => ∃ cfg', ReachesPlus M (encode s) cfg' ∧ (step M cfg').isNone := by M:Machine (Fin 3) (Fin 3)hs:StepSpec Ms:State⊢ match next s with
| some s' => encode s [M]⊢⁺ encode s'
| none => ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = true
rcases s with ⟨w⟩ M:Machine (Fin 3) (Fin 3)hs:StepSpec Mw:List Bool⊢ match next (State.W w) with
| some s' => encode (State.W w) [M]⊢⁺ encode s'
| none => ∃ cfg', (encode (State.W w) [M]⊢⁺ cfg') ∧ (step M cfg').isNone = true
dsimp only [next] M:Machine (Fin 3) (Fin 3)hs:StepSpec Mw:List Bool⊢ match (fun w' ↦ State.W (false :: w')) <$> wilyPass WilyMode.s0 w with
| some s' => encode (State.W w) [M]⊢⁺ encode s'
| none => ∃ cfg', (encode (State.W w) [M]⊢⁺ cfg') ∧ (step M cfg').isNone = true
cases hp : wilyPass .s0 w with
| some out => some M:Machine (Fin 3) (Fin 3)hs:StepSpec Mw:List Boolout:List Boolhp:wilyPass WilyMode.s0 w = some out⊢ match (fun w' ↦ State.W (false :: w')) <$> some out with
| some s' => encode (State.W w) [M]⊢⁺ encode s'
| none => ∃ cfg', (encode (State.W w) [M]⊢⁺ cfg') ∧ (step M cfg').isNone = true
exact ((hs.enter_pass w).trans (wilyPass_reachesPlus hs .s0 (default <+ [1]) w out hp)).trans
(hs.exit_pass out) All goals completed! 🐙
| none => none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mw:List Boolhp:wilyPass WilyMode.s0 w = none⊢ match (fun w' ↦ State.W (false :: w')) <$> none with
| some s' => encode (State.W w) [M]⊢⁺ encode s'
| none => ∃ cfg', (encode (State.W w) [M]⊢⁺ cfg') ∧ (step M cfg').isNone = true
obtain ⟨cfg', hreach, hnone⟩ := wilyPass_halts hs .s0 (default <+ [1]) w hp none M:Machine (Fin 3) (Fin 3)hs:StepSpec Mw:List Boolhp:wilyPass WilyMode.s0 w = nonecfg':Cfg (Fin 3) (Fin 3)hreach:modeCfg WilyMode.s0 ([1] +> default) (encCells w +> default) [M]⊢* cfg'hnone:(step M cfg').isNone = true⊢ match (fun w' ↦ State.W (false :: w')) <$> none with
| some s' => encode (State.W w) [M]⊢⁺ encode s'
| none => ∃ cfg', (encode (State.W w) [M]⊢⁺ cfg') ∧ (step M cfg').isNone = true
exact ⟨cfg', (hs.enter_pass w).trans_star hreach, hnone⟩ All goals completed! 🐙
Any machine M satisfying StepSpec M has IsValidAcceleration M start encode next.
theorem StepSpec.is_valid_acceleration {M : Machine (Fin 3) (Fin 3)} (hs : StepSpec M) :
IsValidAcceleration M start encode next := by M:Machine (Fin 3) (Fin 3)hs:StepSpec M⊢ IsValidAcceleration M start encode next
refine IsValidAcceleration.of_step hs.init_reaches.to_star (fun s => ?_) M:Machine (Fin 3) (Fin 3)hs:StepSpec Ms:State⊢ match next s with
| some s' => encode s [M]⊢⁺ encode s'
| none => ∃ cfg', (encode s [M]⊢* cfg') ∧ (step M cfg').isNone = true
have hstep := step_state_plus hs s M:Machine (Fin 3) (Fin 3)hs:StepSpec Ms:Statehstep:match next s with
| some s' => encode s [M]⊢⁺ encode s'
| none => ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = true⊢ match next s with
| some s' => encode s [M]⊢⁺ encode s'
| none => ∃ cfg', (encode s [M]⊢* cfg') ∧ (step M cfg').isNone = true
rcases hnext : next s with _ | s' none M:Machine (Fin 3) (Fin 3)hs:StepSpec Ms:Statehstep:match next s with
| some s' => encode s [M]⊢⁺ encode s'
| none => ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = truehnext:next s = none⊢ match none with
| some s' => encode s [M]⊢⁺ encode s'
| none => ∃ cfg', (encode s [M]⊢* cfg') ∧ (step M cfg').isNone = truesome M:Machine (Fin 3) (Fin 3)hs:StepSpec Ms:Statehstep:match next s with
| some s' => encode s [M]⊢⁺ encode s'
| none => ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = trues':Statehnext:next s = some s'⊢ match some s' with
| some s' => encode s [M]⊢⁺ encode s'
| none => ∃ cfg', (encode s [M]⊢* cfg') ∧ (step M cfg').isNone = true
· none M:Machine (Fin 3) (Fin 3)hs:StepSpec Ms:Statehstep:match next s with
| some s' => encode s [M]⊢⁺ encode s'
| none => ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = truehnext:next s = none⊢ match none with
| some s' => encode s [M]⊢⁺ encode s'
| none => ∃ cfg', (encode s [M]⊢* cfg') ∧ (step M cfg').isNone = true rw [hnext none M:Machine (Fin 3) (Fin 3)hs:StepSpec Ms:Statehstep:match none with
| some s' => encode s [M]⊢⁺ encode s'
| none => ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = truehnext:next s = none⊢ match none with
| some s' => encode s [M]⊢⁺ encode s'
| none => ∃ cfg', (encode s [M]⊢* cfg') ∧ (step M cfg').isNone = true] at hstep none M:Machine (Fin 3) (Fin 3)hs:StepSpec Ms:Statehstep:match none with
| some s' => encode s [M]⊢⁺ encode s'
| none => ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = truehnext:next s = none⊢ match none with
| some s' => encode s [M]⊢⁺ encode s'
| none => ∃ cfg', (encode s [M]⊢* cfg') ∧ (step M cfg').isNone = true
obtain ⟨cfg', hplus, hnone⟩ := hstep none M:Machine (Fin 3) (Fin 3)hs:StepSpec Ms:Statehnext:next s = nonecfg':Cfg (Fin 3) (Fin 3)hplus:encode s [M]⊢⁺ cfg'hnone:(step M cfg').isNone = true⊢ match none with
| some s' => encode s [M]⊢⁺ encode s'
| none => ∃ cfg', (encode s [M]⊢* cfg') ∧ (step M cfg').isNone = true
exact ⟨cfg', hplus.to_star, hnone⟩ All goals completed! 🐙
· some M:Machine (Fin 3) (Fin 3)hs:StepSpec Ms:Statehstep:match next s with
| some s' => encode s [M]⊢⁺ encode s'
| none => ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = trues':Statehnext:next s = some s'⊢ match some s' with
| some s' => encode s [M]⊢⁺ encode s'
| none => ∃ cfg', (encode s [M]⊢* cfg') ∧ (step M cfg').isNone = true rw [hnext some M:Machine (Fin 3) (Fin 3)hs:StepSpec Ms:States':Statehstep:match some s' with
| some s' => encode s [M]⊢⁺ encode s'
| none => ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = truehnext:next s = some s'⊢ match some s' with
| some s' => encode s [M]⊢⁺ encode s'
| none => ∃ cfg', (encode s [M]⊢* cfg') ∧ (step M cfg').isNone = true] at hstep some M:Machine (Fin 3) (Fin 3)hs:StepSpec Ms:States':Statehstep:match some s' with
| some s' => encode s [M]⊢⁺ encode s'
| none => ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = truehnext:next s = some s'⊢ match some s' with
| some s' => encode s [M]⊢⁺ encode s'
| none => ∃ cfg', (encode s [M]⊢* cfg') ∧ (step M cfg').isNone = true
exact hstep All goals completed! 🐙private theorem evalStackPattern_pat_W (vars : ℕ → ℕ) (stks : ℕ → List ℕ) :
evalStackPattern pat_W vars stks =
Cfg.headRight A default (ListBlank.cons 0 (evalStackExpr [.word [[2], [1]] 0] vars stks)) :=
rflprivate theorem mem_encode (s : State) : IsInStackPatternSet ps (encode s) := by s:State⊢ IsInStackPatternSet ps (encode s)
rcases s with ⟨w⟩ w:List Bool⊢ IsInStackPatternSet ps (encode (State.W w))
obtain ⟨vars, stks, h_expr⟩ :=
(exists_evalStackExpr_single_word_iff (2 : Fin 3) (1 : Fin 3)
(ListBlank.append (w.map fun b => if b then 1 else 2) default)).mpr ⟨w, rfl⟩ w:List Boolvars:ℕ → ℕstks:ℕ → List ℕh_expr:List.map (fun b ↦ if b = true then 1 else 2) w +> default = evalStackExpr [StackSeg.word [[2], [1]] 0] vars stks⊢ IsInStackPatternSet ps (encode (State.W w))
refine ⟨(pat_W, .true), List.Mem.head _, vars, stks, ?_, trivial⟩ w:List Boolvars:ℕ → ℕstks:ℕ → List ℕh_expr:List.map (fun b ↦ if b = true then 1 else 2) w +> default = evalStackExpr [StackSeg.word [[2], [1]] 0] vars stks⊢ encode (State.W w) = evalStackPattern (pat_W, VarCond.true).1 vars stks
rw [evalStackPattern_pat_W, w:List Boolvars:ℕ → ℕstks:ℕ → List ℕh_expr:List.map (fun b ↦ if b = true then 1 else 2) w +> default = evalStackExpr [StackSeg.word [[2], [1]] 0] vars stks⊢ encode (State.W w) = Cfg.headRight A default (0 >> evalStackExpr [StackSeg.word [[2], [1]] 0] vars stks) ← h_expr w:List Boolvars:ℕ → ℕstks:ℕ → List ℕh_expr:List.map (fun b ↦ if b = true then 1 else 2) w +> default = evalStackExpr [StackSeg.word [[2], [1]] 0] vars stks⊢ encode (State.W w) = Cfg.headRight A default (0 >> List.map (fun b ↦ if b = true then 1 else 2) w +> default)] w:List Boolvars:ℕ → ℕstks:ℕ → List ℕh_expr:List.map (fun b ↦ if b = true then 1 else 2) w +> default = evalStackExpr [StackSeg.word [[2], [1]] 0] vars stks⊢ encode (State.W w) = Cfg.headRight A default (0 >> List.map (fun b ↦ if b = true then 1 else 2) w +> default)
rfl All goals completed! 🐙private theorem encode_of_mem (cfg : Cfg (Fin 3) (Fin 3))
(h : IsInStackPatternSet ps cfg) : ∃ s : State, cfg = encode s := by cfg:Cfg (Fin 3) (Fin 3)h:IsInStackPatternSet ps cfg⊢ ∃ s, cfg = encode s
rcases h with ⟨entry, hentry, vars, stks, rfl, _⟩ entry:StackPattern (Fin 3) (Fin 3) × VarCondhentry:entry ∈ psvars:ℕ → ℕstks:ℕ → List ℕright✝:evalVarCond entry.2 vars⊢ ∃ s, evalStackPattern entry.1 vars stks = encode s
rcases List.mem_singleton.mp hentry with rfl vars:ℕ → ℕstks:ℕ → List ℕhentry:(pat_W, VarCond.true) ∈ psright✝:evalVarCond (pat_W, VarCond.true).2 vars⊢ ∃ s, evalStackPattern (pat_W, VarCond.true).1 vars stks = encode s
obtain ⟨w, hw⟩ :=
(exists_evalStackExpr_single_word_iff (2 : Fin 3) (1 : Fin 3)
(evalStackExpr [.word [[2], [1]] 0] vars stks)).mp ⟨vars, stks, rfl⟩ vars:ℕ → ℕstks:ℕ → List ℕhentry:(pat_W, VarCond.true) ∈ psright✝:evalVarCond (pat_W, VarCond.true).2 varsw:List Boolhw:evalStackExpr [StackSeg.word [[2], [1]] 0] vars stks = List.map (fun b ↦ if b = true then 1 else 2) w +> default⊢ ∃ s, evalStackPattern (pat_W, VarCond.true).1 vars stks = encode s
refine ⟨.W w, ?_⟩ vars:ℕ → ℕstks:ℕ → List ℕhentry:(pat_W, VarCond.true) ∈ psright✝:evalVarCond (pat_W, VarCond.true).2 varsw:List Boolhw:evalStackExpr [StackSeg.word [[2], [1]] 0] vars stks = List.map (fun b ↦ if b = true then 1 else 2) w +> default⊢ evalStackPattern (pat_W, VarCond.true).1 vars stks = encode (State.W w)
rw [evalStackPattern_pat_W, vars:ℕ → ℕstks:ℕ → List ℕhentry:(pat_W, VarCond.true) ∈ psright✝:evalVarCond (pat_W, VarCond.true).2 varsw:List Boolhw:evalStackExpr [StackSeg.word [[2], [1]] 0] vars stks = List.map (fun b ↦ if b = true then 1 else 2) w +> default⊢ Cfg.headRight A default (0 >> evalStackExpr [StackSeg.word [[2], [1]] 0] vars stks) = encode (State.W w) hw vars:ℕ → ℕstks:ℕ → List ℕhentry:(pat_W, VarCond.true) ∈ psright✝:evalVarCond (pat_W, VarCond.true).2 varsw:List Boolhw:evalStackExpr [StackSeg.word [[2], [1]] 0] vars stks = List.map (fun b ↦ if b = true then 1 else 2) w +> default⊢ Cfg.headRight A default (0 >> List.map (fun b ↦ if b = true then 1 else 2) w +> default) = encode (State.W w)] vars:ℕ → ℕstks:ℕ → List ℕhentry:(pat_W, VarCond.true) ∈ psright✝:evalVarCond (pat_W, VarCond.true).2 varsw:List Boolhw:evalStackExpr [StackSeg.word [[2], [1]] 0] vars stks = List.map (fun b ↦ if b = true then 1 else 2) w +> default⊢ Cfg.headRight A default (0 >> List.map (fun b ↦ if b = true then 1 else 2) w +> default) = encode (State.W w)
rfl All goals completed! 🐙
Any machine M satisfying StepSpec M has IsClosedStackPatternSet M ps.
theorem StepSpec.is_closed_stack_pattern_set {M : Machine (Fin 3) (Fin 3)} (hs : StepSpec M) :
IsClosedStackPatternSet M ps := by M:Machine (Fin 3) (Fin 3)hs:StepSpec M⊢ IsClosedStackPatternSet M ps
refine hs.is_valid_acceleration.isClosedStackPatternSet mem_encode encode_of_mem
(fun s hnext => ?_) M:Machine (Fin 3) (Fin 3)hs:StepSpec Ms:Statehnext:next s = none⊢ ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = true
have hstep := step_state_plus hs s M:Machine (Fin 3) (Fin 3)hs:StepSpec Ms:Statehnext:next s = nonehstep:match next s with
| some s' => encode s [M]⊢⁺ encode s'
| none => ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = true⊢ ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = true
rw [hnext M:Machine (Fin 3) (Fin 3)hs:StepSpec Ms:Statehnext:next s = nonehstep:match none with
| some s' => encode s [M]⊢⁺ encode s'
| none => ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = true⊢ ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = true] at hstep M:Machine (Fin 3) (Fin 3)hs:StepSpec Ms:Statehnext:next s = nonehstep:match none with
| some s' => encode s [M]⊢⁺ encode s'
| none => ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = true⊢ ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = true
exact hstep All goals completed! 🐙end BusyBeaver.WilyCoyote