Imports
/-
Copyright (c) 2026 Terence Rokop. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Terence Rokop
-/
module
public import Cslib.Computability.Machines.Turing.MultiTape.Deterministic
public import Geb.Prototypes.Computability.TreeScanner.MachineThe tree scanner's transition, resolved
treeScanner.tr resolved at each configuration the machine reaches, one
statement per case of its transition table, together with the
input-symbol projections those resolutions consume and the emission facts
they yield.
Turing.MultiTapeTM.step and Turing.MultiTapeTM.outputSymbol apply
tm.tr q cfg.inputSymbol cfg.workTapeSymbols to identical arguments, so
one resolution per case serves both a step lemma and the matching
no-emission lemma, and the input symbol is resolved once rather than
twice.
Main statements
step_of_state — a step from a known state, in the form that names
tr.
seekCfg_inputSymbol, seekCfg_inputSymbol_end,
sweepCfg_inputSymbol_succ, sweepCfg_inputSymbol_zero — the input
symbol at each configuration.
tr_seek_mid, tr_seek_exit, tr_plant, tr_live_leaf,
tr_live_node_deep, tr_live_node_shallow, tr_live_end_accept,
tr_live_end_reject, tr_dead_mid, tr_dead_end — the transition
resolved at each case.
outputSymbol_seekCfg, outputSymbol_plantCfg,
outputSymbol_sweepCfg_succ — the configurations that emit nothing.
seekCfg_step, configs_seek — the seek phase: one step against the
closed form, and the configuration and the output at every step up to
the input's length.
seekCfg_exit, plantCfg_step — the two phase boundaries: the seek's
exit step, which writes the first marker, and the planting step, which
writes the second and enters the sweep.
sweepCfg_step, configs_sweep — the sweep phase: one step against the
closed form, matching the machine's state and work head to the scan's
liveness and pending count one bit at a time, and the configuration and
the output at every step down to the input's left end.
sweepCfg_zero_halts, outputSymbol_sweepCfg_zero — the emitting step at
the input's left end: the machine halts, and the symbol it emits is
RankedAlphabet.Binary.binRanked.validBool at the input.
halts_at, outputString_eq — the three phases composed: the machine
halts after 2 * w.length + 3 steps having emitted that one symbol.
Implementation notes
The module is admitted to GebMeta.classicalAllowedModules. Its subject
is the machine's behaviour under Turing.MultiTapeTM.step,
Turing.MultiTapeTM.configs and Turing.MultiTapeTM.outputString, and
its statements read the input through
Turing.MultiTapeTM.Cfg.inputSymbol; each of those depends on
Classical.choice through Cslib's Cfg.inputSymbol and
inputSymbolInner, so nothing here can be stated choice-free.
treeScanner's transition is an ite chain on state equality against
named definitions wrapping a match on Option (Fin 2). Unfolded the
chain presents as if ⟨3, _⟩ = ⟨0, _⟩ then …, which no simp set
resolves and rfl does, so each resolution rewrites its arguments to
literals and closes by rfl. Where a case reads the work symbol, an
equation collapsing the work tape to a constant function comes first:
rewriting by sweepCfg_workTapeSymbols_eq alone leaves an ite on an
opaque depth inside the argument of tr, and the transition does not
reduce.
A resolution lemma takes no liveness hypothesis. tr receives the state
as an explicit argument, so the resolution cannot consult liveness; the
state is supplied by the caller from sweepCfg_state_live or
sweepCfg_state_dead.
The sections group by kind up to the emission facts — InputSymbol,
Transition, OutputSymbol — and by phase thereafter — Seek, Plant,
Sweep, Emission.
Tags
Turing machine, transition, tree, preorder encoding
@[expose] public sectionnamespace Geb.TreeScanneropen Turing MultiTapeTM RankedAlphabet.Binary
A machine's step from a known state, in the form that names tr.
theorem step_of_state {k : ℕ} {Symbol State : Type} {input : List Symbol}
(tm : MultiTapeTM k Symbol State) (cfg : Cfg k Symbol State input)
(q : State) (hq : cfg.state = some q) :
tm.step cfg =
{ state := (tm.tr q cfg.inputSymbol cfg.workTapeSymbols).q'
inputPos := moveInputPos cfg.inputPos
(tm.tr q cfg.inputSymbol cfg.workTapeSymbols).inputMove
workTapes := fun i ↦
match ((tm.tr q cfg.inputSymbol cfg.workTapeSymbols).workActions i).1 with
| none => cfg.workTapes i
| some s => Function.update (cfg.workTapes i) (cfg.workTapePos i) s
workTapePos := fun i ↦ cfg.workTapePos i +
((tm.tr q cfg.inputSymbol cfg.workTapeSymbols).workActions i).2 } := k:ℕSymbol:TypeState:Typeinput:List Symboltm:MultiTapeTM k Symbol Statecfg:Cfg k Symbol State inputq:Statehq:cfg.state = some q⊢ step cfg =
{ state := (tm.tr q cfg.inputSymbol cfg.workTapeSymbols).q',
inputPos := moveInputPos cfg.inputPos (tm.tr q cfg.inputSymbol cfg.workTapeSymbols).inputMove,
workTapes := fun i ↦
match (motive := Option (Option Symbol) → ℤ → Option Symbol)
((tm.tr q cfg.inputSymbol cfg.workTapeSymbols).workActions i).1 with
| none => cfg.workTapes i
| some s => Function.update (cfg.workTapes i) (cfg.workTapePos i) s,
workTapePos := fun i ↦ cfg.workTapePos i + ↑((tm.tr q cfg.inputSymbol cfg.workTapeSymbols).workActions i).2 }
k:ℕSymbol:TypeState:Typeinput:List Symboltm:MultiTapeTM k Symbol Statecfg:Cfg k Symbol State inputq:Statehq:cfg.state = some q⊢ (match cfg.state with
| none => cfg
| some q =>
match tm.tr q cfg.inputSymbol cfg.workTapeSymbols with
| { inputMove := inputMove, workActions := workActions, outS := outS, q' := q' } =>
{ state := q', inputPos := moveInputPos cfg.inputPos inputMove,
workTapes := fun i ↦
match (motive := Option (Option Symbol) → ℤ → Option Symbol) (workActions i).1 with
| none => cfg.workTapes i
| some s => Function.update (cfg.workTapes i) (cfg.workTapePos i) s,
workTapePos := fun i ↦ cfg.workTapePos i + ↑(workActions i).2 }) =
{ state := (tm.tr q cfg.inputSymbol cfg.workTapeSymbols).q',
inputPos := moveInputPos cfg.inputPos (tm.tr q cfg.inputSymbol cfg.workTapeSymbols).inputMove,
workTapes := fun i ↦
match (motive := Option (Option Symbol) → ℤ → Option Symbol)
((tm.tr q cfg.inputSymbol cfg.workTapeSymbols).workActions i).1 with
| none => cfg.workTapes i
| some s => Function.update (cfg.workTapes i) (cfg.workTapePos i) s,
workTapePos := fun i ↦ cfg.workTapePos i + ↑((tm.tr q cfg.inputSymbol cfg.workTapeSymbols).workActions i).2 }
k:ℕSymbol:TypeState:Typeinput:List Symboltm:MultiTapeTM k Symbol Statecfg:Cfg k Symbol State inputq:Statehq:cfg.state = some q⊢ (match some q with
| none => cfg
| some q =>
match tm.tr q cfg.inputSymbol cfg.workTapeSymbols with
| { inputMove := inputMove, workActions := workActions, outS := outS, q' := q' } =>
{ state := q', inputPos := moveInputPos cfg.inputPos inputMove,
workTapes := fun i ↦
match (motive := Option (Option Symbol) → ℤ → Option Symbol) (workActions i).1 with
| none => cfg.workTapes i
| some s => Function.update (cfg.workTapes i) (cfg.workTapePos i) s,
workTapePos := fun i ↦ cfg.workTapePos i + ↑(workActions i).2 }) =
{ state := (tm.tr q cfg.inputSymbol cfg.workTapeSymbols).q',
inputPos := moveInputPos cfg.inputPos (tm.tr q cfg.inputSymbol cfg.workTapeSymbols).inputMove,
workTapes := fun i ↦
match (motive := Option (Option Symbol) → ℤ → Option Symbol)
((tm.tr q cfg.inputSymbol cfg.workTapeSymbols).workActions i).1 with
| none => cfg.workTapes i
| some s => Function.update (cfg.workTapes i) (cfg.workTapePos i) s,
workTapePos := fun i ↦ cfg.workTapePos i + ↑((tm.tr q cfg.inputSymbol cfg.workTapeSymbols).workActions i).2 }
rfl All goals completed! 🐙section InputSymbolShort of the input's right end the seek configuration reads the bit at its own index.
theorem seekCfg_inputSymbol (w : List Bool) (t : ℕ) (h : t < w.length) :
(seekCfg w t (Nat.le_of_lt h)).inputSymbol = some (boolEmb w[t]) := by w:List Boolt:ℕh:t < w.length⊢ (seekCfg w t ⋯).inputSymbol = some (boolEmb w[t])
have hi := inputSymbolInner (cfg := seekCfg w t (Nat.le_of_lt h)) t
(by w:List Boolt:ℕh:t < w.length⊢ ↑(seekCfg w t ⋯).inputPos = 1 + t rw [seekCfg_inputPos_val w:List Boolt:ℕh:t < w.length⊢ t + 1 = 1 + t] w:List Boolt:ℕh:t < w.length⊢ t + 1 = 1 + t; omega All goals completed! 🐙) (by w:List Boolt:ℕh:t < w.length⊢ t < (List.map (⇑boolEmb) w).length rw [List.length_map w:List Boolt:ℕh:t < w.length⊢ t < w.length] w:List Boolt:ℕh:t < w.length⊢ t < w.length; exact h All goals completed! 🐙) w:List Boolt:ℕh:t < w.lengthhi:(seekCfg w t ⋯).inputSymbol = some (List.map (⇑boolEmb) w)[t]⊢ (seekCfg w t ⋯).inputSymbol = some (boolEmb w[t])
rw [hi, w:List Boolt:ℕh:t < w.lengthhi:(seekCfg w t ⋯).inputSymbol = some (List.map (⇑boolEmb) w)[t]⊢ some (List.map (⇑boolEmb) w)[t] = some (boolEmb w[t]) List.getElem_map w:List Boolt:ℕh:t < w.lengthhi:(seekCfg w t ⋯).inputSymbol = some (List.map (⇑boolEmb) w)[t]⊢ some (boolEmb w[t]) = some (boolEmb w[t])] All goals completed! 🐙
At the input's right end the seek configuration reads blank. This takes
Turing.MultiTapeTM.Cfg.inputSymbol's second guard, an equality at ℕ.
theorem seekCfg_inputSymbol_end (w : List Bool) :
(seekCfg w w.length (Nat.le_refl _)).inputSymbol = none := by w:List Bool⊢ (seekCfg w w.length ⋯).inputSymbol = none
have hend : ((seekCfg w w.length (Nat.le_refl _)).inputPos : ℕ) =
(w.map boolEmb).length + 1 := by
rw [seekCfg_inputPos_val, w:List Bool⊢ w.length + 1 = (List.map (⇑boolEmb) w).length + 1 List.length_map w:List Bool⊢ w.length + 1 = w.length + 1] w:List Boolhend:↑(seekCfg w w.length ⋯).inputPos = (List.map (⇑boolEmb) w).length + 1⊢ (seekCfg w w.length ⋯).inputSymbol = none
unfold Cfg.inputSymbol w:List Boolhend:↑(seekCfg w w.length ⋯).inputPos = (List.map (⇑boolEmb) w).length + 1⊢ (if h₁ : (seekCfg w w.length ⋯).inputPos = 0 then none
else
if h₂ : ↑(seekCfg w w.length ⋯).inputPos = (List.map (⇑boolEmb) w).length + 1 then none
else some (List.map (⇑boolEmb) w)[↑(seekCfg w w.length ⋯).inputPos - 1]) =
none
split_ifs pos w:List Boolhend:↑(seekCfg w w.length ⋯).inputPos = (List.map (⇑boolEmb) w).length + 1h✝:(seekCfg w w.length ⋯).inputPos = 0⊢ none = noneneg w:List Boolhend:↑(seekCfg w w.length ⋯).inputPos = (List.map (⇑boolEmb) w).length + 1h✝:¬(seekCfg w w.length ⋯).inputPos = 0⊢ none = none <;> pos w:List Boolhend:↑(seekCfg w w.length ⋯).inputPos = (List.map (⇑boolEmb) w).length + 1h✝:(seekCfg w w.length ⋯).inputPos = 0⊢ none = noneneg w:List Boolhend:↑(seekCfg w w.length ⋯).inputPos = (List.map (⇑boolEmb) w).length + 1h✝:¬(seekCfg w w.length ⋯).inputPos = 0⊢ none = none rfl All goals completed! 🐙At a positive index the sweep configuration reads the bit one cell to the left of its index.
theorem sweepCfg_inputSymbol_succ (w : List Bool) (k : ℕ) (h : k + 1 ≤ w.length) :
(sweepCfg w (k + 1) h).inputSymbol = some (boolEmb w[k]) := by w:List Boolk:ℕh:k + 1 ≤ w.length⊢ (sweepCfg w (k + 1) h).inputSymbol = some (boolEmb w[k])
have hi := inputSymbolInner (cfg := sweepCfg w (k + 1) h) k
(by w:List Boolk:ℕh:k + 1 ≤ w.length⊢ ↑(sweepCfg w (k + 1) h).inputPos = 1 + k rw [sweepCfg_inputPos_val w:List Boolk:ℕh:k + 1 ≤ w.length⊢ k + 1 = 1 + k] w:List Boolk:ℕh:k + 1 ≤ w.length⊢ k + 1 = 1 + k; omega All goals completed! 🐙) (by w:List Boolk:ℕh:k + 1 ≤ w.length⊢ k < (List.map (⇑boolEmb) w).length rw [List.length_map w:List Boolk:ℕh:k + 1 ≤ w.length⊢ k < w.length] w:List Boolk:ℕh:k + 1 ≤ w.length⊢ k < w.length; omega All goals completed! 🐙) w:List Boolk:ℕh:k + 1 ≤ w.lengthhi:(sweepCfg w (k + 1) h).inputSymbol = some (List.map (⇑boolEmb) w)[k]⊢ (sweepCfg w (k + 1) h).inputSymbol = some (boolEmb w[k])
rw [hi, w:List Boolk:ℕh:k + 1 ≤ w.lengthhi:(sweepCfg w (k + 1) h).inputSymbol = some (List.map (⇑boolEmb) w)[k]⊢ some (List.map (⇑boolEmb) w)[k] = some (boolEmb w[k]) List.getElem_map w:List Boolk:ℕh:k + 1 ≤ w.lengthhi:(sweepCfg w (k + 1) h).inputSymbol = some (List.map (⇑boolEmb) w)[k]⊢ some (boolEmb w[k]) = some (boolEmb w[k])] All goals completed! 🐙
At the input's left end the sweep configuration reads blank. This takes
Turing.MultiTapeTM.Cfg.inputSymbol's first guard, an equality at
Fin (n + 2).
theorem sweepCfg_inputSymbol_zero (w : List Bool) :
(sweepCfg w 0 (Nat.zero_le _)).inputSymbol = none := by w:List Bool⊢ (sweepCfg w 0 ⋯).inputSymbol = none
unfold Cfg.inputSymbol w:List Bool⊢ (if h₁ : (sweepCfg w 0 ⋯).inputPos = 0 then none
else
if h₂ : ↑(sweepCfg w 0 ⋯).inputPos = (List.map (⇑boolEmb) w).length + 1 then none
else some (List.map (⇑boolEmb) w)[↑(sweepCfg w 0 ⋯).inputPos - 1]) =
none
split_ifs with h₁ h₂ pos w:List Boolh₁:(sweepCfg w 0 ⋯).inputPos = 0⊢ none = nonepos w:List Boolh₁:¬(sweepCfg w 0 ⋯).inputPos = 0h₂:↑(sweepCfg w 0 ⋯).inputPos = (List.map (⇑boolEmb) w).length + 1⊢ none = noneneg w:List Boolh₁:¬(sweepCfg w 0 ⋯).inputPos = 0h₂:¬↑(sweepCfg w 0 ⋯).inputPos = (List.map (⇑boolEmb) w).length + 1⊢ False
· pos w:List Boolh₁:(sweepCfg w 0 ⋯).inputPos = 0⊢ none = none rfl All goals completed! 🐙
· pos w:List Boolh₁:¬(sweepCfg w 0 ⋯).inputPos = 0h₂:↑(sweepCfg w 0 ⋯).inputPos = (List.map (⇑boolEmb) w).length + 1⊢ none = none rfl All goals completed! 🐙
· neg w:List Boolh₁:¬(sweepCfg w 0 ⋯).inputPos = 0h₂:¬↑(sweepCfg w 0 ⋯).inputPos = (List.map (⇑boolEmb) w).length + 1⊢ False exact absurd (Fin.ext rfl) h₁ All goals completed! 🐙end InputSymbolsection TransitionShort of the input's right end the seek step advances the input head.
theorem tr_seek_mid (w : List Bool) (t : ℕ) (h : t < w.length) :
treeScanner.tr stSeek (seekCfg w t (Nat.le_of_lt h)).inputSymbol
(seekCfg w t (Nat.le_of_lt h)).workTapeSymbols =
{ inputMove := 1, workActions := fun _ ↦ (none, 0),
outS := none, q' := some stSeek } := by w:List Boolt:ℕh:t < w.length⊢ treeScanner.tr stSeek (seekCfg w t ⋯).inputSymbol (seekCfg w t ⋯).workTapeSymbols =
{ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }
rw [seekCfg_inputSymbol w t h w:List Boolt:ℕh:t < w.length⊢ treeScanner.tr stSeek (some (boolEmb w[t])) (seekCfg w t ⋯).workTapeSymbols =
{ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }] w:List Boolt:ℕh:t < w.length⊢ treeScanner.tr stSeek (some (boolEmb w[t])) (seekCfg w t ⋯).workTapeSymbols =
{ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }
rfl All goals completed! 🐙At the input's right end the seek step writes the first marker and enters the planting state.
theorem tr_seek_exit (w : List Bool) :
treeScanner.tr stSeek (seekCfg w w.length (Nat.le_refl _)).inputSymbol
(seekCfg w w.length (Nat.le_refl _)).workTapeSymbols =
{ inputMove := -1, workActions := fun _ ↦ (some (some 0), 1),
outS := none, q' := some stPlant } := by w:List Bool⊢ treeScanner.tr stSeek (seekCfg w w.length ⋯).inputSymbol (seekCfg w w.length ⋯).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }
rw [seekCfg_inputSymbol_end w:List Bool⊢ treeScanner.tr stSeek none (seekCfg w w.length ⋯).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }] w:List Bool⊢ treeScanner.tr stSeek none (seekCfg w w.length ⋯).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }
rfl All goals completed! 🐙
The planting step writes the second marker at cell 1, returns the work
head to cell 0 and enters the live state. It is uniform in the input
symbol: its row of the transition table is a catch-all in the input
column.
theorem tr_plant (w : List Bool) :
treeScanner.tr stPlant (plantCfg w).inputSymbol (plantCfg w).workTapeSymbols =
{ inputMove := 0, workActions := fun _ ↦ (some (some 1), -1),
outS := none, q' := some stLive } := rflA live sweep over a leaf bit raises the pending count by one, moving the work head right.
theorem tr_live_leaf (w : List Bool) (k : ℕ) (h : k + 1 ≤ w.length)
(hbit : w[k] = false) :
treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol
(sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun _ ↦ (none, 1),
outS := none, q' := some stLive } := by w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = false⊢ treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }
rw [sweepCfg_inputSymbol_succ, w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = false⊢ treeScanner.tr stLive (some (boolEmb w[k])) (sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive } hbit w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = false⊢ treeScanner.tr stLive (some (boolEmb false)) (sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }] w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = false⊢ treeScanner.tr stLive (some (boolEmb false)) (sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }
rfl All goals completed! 🐙A live sweep over a node bit with at least two pending consumes two and pushes one, so it stays live and lowers the pending count by one, moving the work head left.
theorem tr_live_node_deep (w : List Bool) (k : ℕ) (h : k + 1 ≤ w.length)
(hbit : w[k] = true) (hd : 2 ≤ depth (w.drop (k + 1))) :
treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol
(sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun _ ↦ (none, -1),
outS := none, q' := some stLive } := by w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)⊢ treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }
have hw : (sweepCfg w (k + 1) h).workTapeSymbols = fun _ ↦ (none : Option (Fin 2)) := by
rw [sweepCfg_workTapeSymbols_eq w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)⊢ (fun x ↦ if depth (List.drop (k + 1) w) = 0 then some 0 else if depth (List.drop (k + 1) w) = 1 then some 1 else none) =
fun x ↦ none] w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)⊢ (fun x ↦ if depth (List.drop (k + 1) w) = 0 then some 0 else if depth (List.drop (k + 1) w) = 1 then some 1 else none) =
fun x ↦ none
funext i w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)i:Fin 1⊢ (if depth (List.drop (k + 1) w) = 0 then some 0 else if depth (List.drop (k + 1) w) = 1 then some 1 else none) = none
split_ifs pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)i:Fin 1h✝:depth (List.drop (k + 1) w) = 0⊢ Falsepos w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)i:Fin 1h✝¹:¬depth (List.drop (k + 1) w) = 0h✝:depth (List.drop (k + 1) w) = 1⊢ Falseneg w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)i:Fin 1h✝¹:¬depth (List.drop (k + 1) w) = 0h✝:¬depth (List.drop (k + 1) w) = 1⊢ none = none <;> pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)i:Fin 1h✝:depth (List.drop (k + 1) w) = 0⊢ Falsepos w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)i:Fin 1h✝¹:¬depth (List.drop (k + 1) w) = 0h✝:depth (List.drop (k + 1) w) = 1⊢ Falseneg w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)i:Fin 1h✝¹:¬depth (List.drop (k + 1) w) = 0h✝:¬depth (List.drop (k + 1) w) = 1⊢ none = none first | rfl All goals completed! 🐙 | omega w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hw:(sweepCfg w (k + 1) h).workTapeSymbols = fun x ↦ none⊢ treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }
rw [sweepCfg_inputSymbol_succ, w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hw:(sweepCfg w (k + 1) h).workTapeSymbols = fun x ↦ none⊢ treeScanner.tr stLive (some (boolEmb w[k])) (sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive } hbit, w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hw:(sweepCfg w (k + 1) h).workTapeSymbols = fun x ↦ none⊢ treeScanner.tr stLive (some (boolEmb true)) (sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive } hw w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hw:(sweepCfg w (k + 1) h).workTapeSymbols = fun x ↦ none⊢ (treeScanner.tr stLive (some (boolEmb true)) fun x ↦ none) =
{ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }] w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hw:(sweepCfg w (k + 1) h).workTapeSymbols = fun x ↦ none⊢ (treeScanner.tr stLive (some (boolEmb true)) fun x ↦ none) =
{ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }
rfl All goals completed! 🐙A live sweep over a node bit with fewer than two pending has met a node with too few subterms to its right, and dies.
theorem tr_live_node_shallow (w : List Bool) (k : ℕ) (h : k + 1 ≤ w.length)
(hbit : w[k] = true) (hd : depth (w.drop (k + 1)) < 2) :
treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol
(sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun _ ↦ (none, 0),
outS := none, q' := some stDead } := by w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2⊢ treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }
rw [sweepCfg_inputSymbol_succ, w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2⊢ treeScanner.tr stLive (some (boolEmb w[k])) (sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead } hbit w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2⊢ treeScanner.tr stLive (some (boolEmb true)) (sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }] w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2⊢ treeScanner.tr stLive (some (boolEmb true)) (sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }
by_cases hd0 : depth (w.drop (k + 1)) = 0 pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2hd0:depth (List.drop (k + 1) w) = 0⊢ treeScanner.tr stLive (some (boolEmb true)) (sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2hd0:¬depth (List.drop (k + 1) w) = 0⊢ treeScanner.tr stLive (some (boolEmb true)) (sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }
· pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2hd0:depth (List.drop (k + 1) w) = 0⊢ treeScanner.tr stLive (some (boolEmb true)) (sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead } have hw : (sweepCfg w (k + 1) h).workTapeSymbols = fun _ ↦ (some 0 : Option (Fin 2)) := by w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2⊢ treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }
rw [sweepCfg_workTapeSymbols_eq w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2hd0:depth (List.drop (k + 1) w) = 0⊢ (fun x ↦ if depth (List.drop (k + 1) w) = 0 then some 0 else if depth (List.drop (k + 1) w) = 1 then some 1 else none) =
fun x ↦ some 0] w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2hd0:depth (List.drop (k + 1) w) = 0⊢ (fun x ↦ if depth (List.drop (k + 1) w) = 0 then some 0 else if depth (List.drop (k + 1) w) = 1 then some 1 else none) =
fun x ↦ some 0
funext i w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2hd0:depth (List.drop (k + 1) w) = 0i:Fin 1⊢ (if depth (List.drop (k + 1) w) = 0 then some 0 else if depth (List.drop (k + 1) w) = 1 then some 1 else none) = some 0
split_ifs w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2hd0:depth (List.drop (k + 1) w) = 0i:Fin 1⊢ some 0 = some 0
rfl pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2hd0:depth (List.drop (k + 1) w) = 0hw:(sweepCfg w (k + 1) h).workTapeSymbols = fun x ↦ some 0⊢ treeScanner.tr stLive (some (boolEmb true)) (sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }
rw [hw pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2hd0:depth (List.drop (k + 1) w) = 0hw:(sweepCfg w (k + 1) h).workTapeSymbols = fun x ↦ some 0⊢ (treeScanner.tr stLive (some (boolEmb true)) fun x ↦ some 0) =
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }] pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2hd0:depth (List.drop (k + 1) w) = 0hw:(sweepCfg w (k + 1) h).workTapeSymbols = fun x ↦ some 0⊢ (treeScanner.tr stLive (some (boolEmb true)) fun x ↦ some 0) =
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }
rfl All goals completed! 🐙
· neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2hd0:¬depth (List.drop (k + 1) w) = 0⊢ treeScanner.tr stLive (some (boolEmb true)) (sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead } have hw : (sweepCfg w (k + 1) h).workTapeSymbols = fun _ ↦ (some 1 : Option (Fin 2)) := by w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2⊢ treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }
rw [sweepCfg_workTapeSymbols_eq w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2hd0:¬depth (List.drop (k + 1) w) = 0⊢ (fun x ↦ if depth (List.drop (k + 1) w) = 0 then some 0 else if depth (List.drop (k + 1) w) = 1 then some 1 else none) =
fun x ↦ some 1] w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2hd0:¬depth (List.drop (k + 1) w) = 0⊢ (fun x ↦ if depth (List.drop (k + 1) w) = 0 then some 0 else if depth (List.drop (k + 1) w) = 1 then some 1 else none) =
fun x ↦ some 1
funext i w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2hd0:¬depth (List.drop (k + 1) w) = 0i:Fin 1⊢ (if depth (List.drop (k + 1) w) = 0 then some 0 else if depth (List.drop (k + 1) w) = 1 then some 1 else none) = some 1
split_ifs pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2hd0:¬depth (List.drop (k + 1) w) = 0i:Fin 1h✝:depth (List.drop (k + 1) w) = 1⊢ some 1 = some 1neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2hd0:¬depth (List.drop (k + 1) w) = 0i:Fin 1h✝:¬depth (List.drop (k + 1) w) = 1⊢ False <;> pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2hd0:¬depth (List.drop (k + 1) w) = 0i:Fin 1h✝:depth (List.drop (k + 1) w) = 1⊢ some 1 = some 1neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2hd0:¬depth (List.drop (k + 1) w) = 0i:Fin 1h✝:¬depth (List.drop (k + 1) w) = 1⊢ False first | rfl neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2hd0:¬depth (List.drop (k + 1) w) = 0i:Fin 1h✝:¬depth (List.drop (k + 1) w) = 1⊢ False | omega neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2hd0:¬depth (List.drop (k + 1) w) = 0hw:(sweepCfg w (k + 1) h).workTapeSymbols = fun x ↦ some 1⊢ treeScanner.tr stLive (some (boolEmb true)) (sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }
rw [hw neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2hd0:¬depth (List.drop (k + 1) w) = 0hw:(sweepCfg w (k + 1) h).workTapeSymbols = fun x ↦ some 1⊢ (treeScanner.tr stLive (some (boolEmb true)) fun x ↦ some 1) =
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }] neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhbit:w[k] = truehd:depth (List.drop (k + 1) w) < 2hd0:¬depth (List.drop (k + 1) w) = 0hw:(sweepCfg w (k + 1) h).workTapeSymbols = fun x ↦ some 1⊢ (treeScanner.tr stLive (some (boolEmb true)) fun x ↦ some 1) =
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }
rfl All goals completed! 🐙A live sweep at the input's left end with exactly one pending emits acceptance and halts.
theorem tr_live_end_accept (w : List Bool) (hd : depth w = 1) :
treeScanner.tr stLive (sweepCfg w 0 (Nat.zero_le _)).inputSymbol
(sweepCfg w 0 (Nat.zero_le _)).workTapeSymbols =
{ inputMove := 0, workActions := fun _ ↦ (none, 0),
outS := some 1, q' := none } := by w:List Boolhd:depth w = 1⊢ treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols =
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 1, q' := none }
have hw : (sweepCfg w 0 (Nat.zero_le _)).workTapeSymbols =
fun _ ↦ (some 1 : Option (Fin 2)) := by
rw [sweepCfg_workTapeSymbols_eq, w:List Boolhd:depth w = 1⊢ (fun x ↦ if depth (List.drop 0 w) = 0 then some 0 else if depth (List.drop 0 w) = 1 then some 1 else none) = fun x ↦
some 1 List.drop_zero w:List Boolhd:depth w = 1⊢ (fun x ↦ if depth w = 0 then some 0 else if depth w = 1 then some 1 else none) = fun x ↦ some 1] w:List Boolhd:depth w = 1⊢ (fun x ↦ if depth w = 0 then some 0 else if depth w = 1 then some 1 else none) = fun x ↦ some 1
funext i w:List Boolhd:depth w = 1i:Fin 1⊢ (if depth w = 0 then some 0 else if depth w = 1 then some 1 else none) = some 1
split_ifs pos w:List Boolhd:depth w = 1i:Fin 1h✝:depth w = 0⊢ some 0 = some 1neg w:List Boolhd:depth w = 1i:Fin 1h✝:¬depth w = 0⊢ some 1 = some 1 <;> pos w:List Boolhd:depth w = 1i:Fin 1h✝:depth w = 0⊢ some 0 = some 1neg w:List Boolhd:depth w = 1i:Fin 1h✝:¬depth w = 0⊢ some 1 = some 1 first | rfl All goals completed! 🐙 | omega w:List Boolhd:depth w = 1hw:(sweepCfg w 0 ⋯).workTapeSymbols = fun x ↦ some 1⊢ treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols =
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 1, q' := none }
rw [sweepCfg_inputSymbol_zero, w:List Boolhd:depth w = 1hw:(sweepCfg w 0 ⋯).workTapeSymbols = fun x ↦ some 1⊢ treeScanner.tr stLive none (sweepCfg w 0 ⋯).workTapeSymbols =
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 1, q' := none } hw w:List Boolhd:depth w = 1hw:(sweepCfg w 0 ⋯).workTapeSymbols = fun x ↦ some 1⊢ (treeScanner.tr stLive none fun x ↦ some 1) =
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 1, q' := none }] w:List Boolhd:depth w = 1hw:(sweepCfg w 0 ⋯).workTapeSymbols = fun x ↦ some 1⊢ (treeScanner.tr stLive none fun x ↦ some 1) =
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 1, q' := none }
rfl All goals completed! 🐙A live sweep at the input's left end with a pending count other than one emits rejection and halts.
theorem tr_live_end_reject (w : List Bool) (hd : depth w ≠ 1) :
treeScanner.tr stLive (sweepCfg w 0 (Nat.zero_le _)).inputSymbol
(sweepCfg w 0 (Nat.zero_le _)).workTapeSymbols =
{ inputMove := 0, workActions := fun _ ↦ (none, 0),
outS := some 0, q' := none } := by w:List Boolhd:depth w ≠ 1⊢ treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols =
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }
rw [sweepCfg_inputSymbol_zero w:List Boolhd:depth w ≠ 1⊢ treeScanner.tr stLive none (sweepCfg w 0 ⋯).workTapeSymbols =
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }] w:List Boolhd:depth w ≠ 1⊢ treeScanner.tr stLive none (sweepCfg w 0 ⋯).workTapeSymbols =
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }
by_cases hd0 : depth w = 0 pos w:List Boolhd:depth w ≠ 1hd0:depth w = 0⊢ treeScanner.tr stLive none (sweepCfg w 0 ⋯).workTapeSymbols =
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }neg w:List Boolhd:depth w ≠ 1hd0:¬depth w = 0⊢ treeScanner.tr stLive none (sweepCfg w 0 ⋯).workTapeSymbols =
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }
· pos w:List Boolhd:depth w ≠ 1hd0:depth w = 0⊢ treeScanner.tr stLive none (sweepCfg w 0 ⋯).workTapeSymbols =
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none } have hw : (sweepCfg w 0 (Nat.zero_le _)).workTapeSymbols =
fun _ ↦ (some 0 : Option (Fin 2)) := by w:List Boolhd:depth w ≠ 1⊢ treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols =
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }
rw [sweepCfg_workTapeSymbols_eq, w:List Boolhd:depth w ≠ 1hd0:depth w = 0⊢ (fun x ↦ if depth (List.drop 0 w) = 0 then some 0 else if depth (List.drop 0 w) = 1 then some 1 else none) = fun x ↦
some 0 List.drop_zero w:List Boolhd:depth w ≠ 1hd0:depth w = 0⊢ (fun x ↦ if depth w = 0 then some 0 else if depth w = 1 then some 1 else none) = fun x ↦ some 0] w:List Boolhd:depth w ≠ 1hd0:depth w = 0⊢ (fun x ↦ if depth w = 0 then some 0 else if depth w = 1 then some 1 else none) = fun x ↦ some 0
funext i w:List Boolhd:depth w ≠ 1hd0:depth w = 0i:Fin 1⊢ (if depth w = 0 then some 0 else if depth w = 1 then some 1 else none) = some 0
split_ifs w:List Boolhd:depth w ≠ 1hd0:depth w = 0i:Fin 1⊢ some 0 = some 0
rfl pos w:List Boolhd:depth w ≠ 1hd0:depth w = 0hw:(sweepCfg w 0 ⋯).workTapeSymbols = fun x ↦ some 0⊢ treeScanner.tr stLive none (sweepCfg w 0 ⋯).workTapeSymbols =
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }
rw [hw pos w:List Boolhd:depth w ≠ 1hd0:depth w = 0hw:(sweepCfg w 0 ⋯).workTapeSymbols = fun x ↦ some 0⊢ (treeScanner.tr stLive none fun x ↦ some 0) =
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }] pos w:List Boolhd:depth w ≠ 1hd0:depth w = 0hw:(sweepCfg w 0 ⋯).workTapeSymbols = fun x ↦ some 0⊢ (treeScanner.tr stLive none fun x ↦ some 0) =
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }
rfl All goals completed! 🐙
· neg w:List Boolhd:depth w ≠ 1hd0:¬depth w = 0⊢ treeScanner.tr stLive none (sweepCfg w 0 ⋯).workTapeSymbols =
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none } have hw : (sweepCfg w 0 (Nat.zero_le _)).workTapeSymbols =
fun _ ↦ (none : Option (Fin 2)) := by w:List Boolhd:depth w ≠ 1⊢ treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols =
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }
rw [sweepCfg_workTapeSymbols_eq, w:List Boolhd:depth w ≠ 1hd0:¬depth w = 0⊢ (fun x ↦ if depth (List.drop 0 w) = 0 then some 0 else if depth (List.drop 0 w) = 1 then some 1 else none) = fun x ↦
none List.drop_zero w:List Boolhd:depth w ≠ 1hd0:¬depth w = 0⊢ (fun x ↦ if depth w = 0 then some 0 else if depth w = 1 then some 1 else none) = fun x ↦ none] w:List Boolhd:depth w ≠ 1hd0:¬depth w = 0⊢ (fun x ↦ if depth w = 0 then some 0 else if depth w = 1 then some 1 else none) = fun x ↦ none
funext i w:List Boolhd:depth w ≠ 1hd0:¬depth w = 0i:Fin 1⊢ (if depth w = 0 then some 0 else if depth w = 1 then some 1 else none) = none
split_ifs w:List Boolhd:depth w ≠ 1hd0:¬depth w = 0i:Fin 1⊢ none = none
rfl neg w:List Boolhd:depth w ≠ 1hd0:¬depth w = 0hw:(sweepCfg w 0 ⋯).workTapeSymbols = fun x ↦ none⊢ treeScanner.tr stLive none (sweepCfg w 0 ⋯).workTapeSymbols =
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }
rw [hw neg w:List Boolhd:depth w ≠ 1hd0:¬depth w = 0hw:(sweepCfg w 0 ⋯).workTapeSymbols = fun x ↦ none⊢ (treeScanner.tr stLive none fun x ↦ none) =
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }] neg w:List Boolhd:depth w ≠ 1hd0:¬depth w = 0hw:(sweepCfg w 0 ⋯).workTapeSymbols = fun x ↦ none⊢ (treeScanner.tr stLive none fun x ↦ none) =
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }
rfl All goals completed! 🐙A dead sweep short of the input's left end walks on unchanged.
theorem tr_dead_mid (w : List Bool) (k : ℕ) (h : k + 1 ≤ w.length) :
treeScanner.tr stDead (sweepCfg w (k + 1) h).inputSymbol
(sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun _ ↦ (none, 0),
outS := none, q' := some stDead } := by w:List Boolk:ℕh:k + 1 ≤ w.length⊢ treeScanner.tr stDead (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }
rw [sweepCfg_inputSymbol_succ w:List Boolk:ℕh:k + 1 ≤ w.length⊢ treeScanner.tr stDead (some (boolEmb w[k])) (sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }] w:List Boolk:ℕh:k + 1 ≤ w.length⊢ treeScanner.tr stDead (some (boolEmb w[k])) (sweepCfg w (k + 1) h).workTapeSymbols =
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }
rfl All goals completed! 🐙A dead sweep at the input's left end emits rejection and halts.
theorem tr_dead_end (w : List Bool) :
treeScanner.tr stDead (sweepCfg w 0 (Nat.zero_le _)).inputSymbol
(sweepCfg w 0 (Nat.zero_le _)).workTapeSymbols =
{ inputMove := 0, workActions := fun _ ↦ (none, 0),
outS := some 0, q' := none } := by w:List Bool⊢ treeScanner.tr stDead (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols =
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }
rw [sweepCfg_inputSymbol_zero w:List Bool⊢ treeScanner.tr stDead none (sweepCfg w 0 ⋯).workTapeSymbols =
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }] w:List Bool⊢ treeScanner.tr stDead none (sweepCfg w 0 ⋯).workTapeSymbols =
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }
rfl All goals completed! 🐙end Transitionsection OutputSymbolThe seek phase emits nothing, at its exit step as at every other.
theorem outputSymbol_seekCfg (w : List Bool) (t : ℕ) (h : t ≤ w.length) :
treeScanner.outputSymbol (seekCfg w t h) = none := by w:List Boolt:ℕh:t ≤ w.length⊢ outputSymbol (seekCfg w t h) = none
unfold outputSymbol w:List Boolt:ℕh:t ≤ w.length⊢ (match (seekCfg w t h).state with
| none => none
| some q => (treeScanner.tr q (seekCfg w t h).inputSymbol (seekCfg w t h).workTapeSymbols).outS) =
none
simp only [seekCfg_state] w:List Boolt:ℕh:t ≤ w.length⊢ (treeScanner.tr stSeek (seekCfg w t h).inputSymbol (seekCfg w t h).workTapeSymbols).outS = none
by_cases ht : t = w.length pos w:List Boolt:ℕh:t ≤ w.lengthht:t = w.length⊢ (treeScanner.tr stSeek (seekCfg w t h).inputSymbol (seekCfg w t h).workTapeSymbols).outS = noneneg w:List Boolt:ℕh:t ≤ w.lengthht:¬t = w.length⊢ (treeScanner.tr stSeek (seekCfg w t h).inputSymbol (seekCfg w t h).workTapeSymbols).outS = none
· pos w:List Boolt:ℕh:t ≤ w.lengthht:t = w.length⊢ (treeScanner.tr stSeek (seekCfg w t h).inputSymbol (seekCfg w t h).workTapeSymbols).outS = none subst ht pos w:List Boolh:w.length ≤ w.length⊢ (treeScanner.tr stSeek (seekCfg w w.length h).inputSymbol (seekCfg w w.length h).workTapeSymbols).outS = none
rw [tr_seek_exit pos w:List Boolh:w.length ≤ w.length⊢ { inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.outS = none] All goals completed! 🐙
· neg w:List Boolt:ℕh:t ≤ w.lengthht:¬t = w.length⊢ (treeScanner.tr stSeek (seekCfg w t h).inputSymbol (seekCfg w t h).workTapeSymbols).outS = none rw [tr_seek_mid w t (by w:List Boolt:ℕh:t ≤ w.lengthht:¬t = w.length⊢ t < w.length omega All goals completed! 🐙)] All goals completed! 🐙The planting step emits nothing.
theorem outputSymbol_plantCfg (w : List Bool) :
treeScanner.outputSymbol (plantCfg w) = none := by w:List Bool⊢ outputSymbol (plantCfg w) = none
unfold outputSymbol w:List Bool⊢ (match (plantCfg w).state with
| none => none
| some q => (treeScanner.tr q (plantCfg w).inputSymbol (plantCfg w).workTapeSymbols).outS) =
none
simp only [plantCfg_state] w:List Bool⊢ (treeScanner.tr stPlant (plantCfg w).inputSymbol (plantCfg w).workTapeSymbols).outS = none
rw [tr_plant w:List Bool⊢ { inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.outS = none] All goals completed! 🐙The sweep emits nothing short of the input's left end, live or dead.
theorem outputSymbol_sweepCfg_succ (w : List Bool) (k : ℕ) (h : k + 1 ≤ w.length) :
treeScanner.outputSymbol (sweepCfg w (k + 1) h) = none := by w:List Boolk:ℕh:k + 1 ≤ w.length⊢ outputSymbol (sweepCfg w (k + 1) h) = none
unfold outputSymbol w:List Boolk:ℕh:k + 1 ≤ w.length⊢ (match (sweepCfg w (k + 1) h).state with
| none => none
| some q => (treeScanner.tr q (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).outS) =
none
by_cases hok : ok (w.drop (k + 1)) = true pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhok:ok (List.drop (k + 1) w) = true⊢ (match (sweepCfg w (k + 1) h).state with
| none => none
| some q => (treeScanner.tr q (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).outS) =
noneneg w:List Boolk:ℕh:k + 1 ≤ w.lengthhok:¬ok (List.drop (k + 1) w) = true⊢ (match (sweepCfg w (k + 1) h).state with
| none => none
| some q => (treeScanner.tr q (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).outS) =
none
· pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhok:ok (List.drop (k + 1) w) = true⊢ (match (sweepCfg w (k + 1) h).state with
| none => none
| some q => (treeScanner.tr q (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).outS) =
none simp only [sweepCfg_state_live w (k + 1) h hok] pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhok:ok (List.drop (k + 1) w) = true⊢ (treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).outS = none
cases hbit : w[k] with
| false => pos.false w:List Boolk:ℕh:k + 1 ≤ w.lengthhok:ok (List.drop (k + 1) w) = truehbit:w[k] = false⊢ (treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).outS = none rw [tr_live_leaf w k h hbit pos.false w:List Boolk:ℕh:k + 1 ≤ w.lengthhok:ok (List.drop (k + 1) w) = truehbit:w[k] = false⊢ { inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.outS = none] All goals completed! 🐙
| true => pos.true w:List Boolk:ℕh:k + 1 ≤ w.lengthhok:ok (List.drop (k + 1) w) = truehbit:w[k] = true⊢ (treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).outS = none
by_cases hd : 2 ≤ depth (w.drop (k + 1)) pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhok:ok (List.drop (k + 1) w) = truehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)⊢ (treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).outS = noneneg w:List Boolk:ℕh:k + 1 ≤ w.lengthhok:ok (List.drop (k + 1) w) = truehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)⊢ (treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).outS = none
· pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhok:ok (List.drop (k + 1) w) = truehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)⊢ (treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).outS = none rw [tr_live_node_deep w k h hbit hd pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhok:ok (List.drop (k + 1) w) = truehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)⊢ { inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.outS = none] All goals completed! 🐙
· neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhok:ok (List.drop (k + 1) w) = truehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)⊢ (treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).outS = none rw [tr_live_node_shallow w k h hbit (by w:List Boolk:ℕh:k + 1 ≤ w.lengthhok:ok (List.drop (k + 1) w) = truehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)⊢ depth (List.drop (k + 1) w) < 2 omega All goals completed! 🐙)] All goals completed! 🐙
· neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhok:¬ok (List.drop (k + 1) w) = true⊢ (match (sweepCfg w (k + 1) h).state with
| none => none
| some q => (treeScanner.tr q (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).outS) =
none rw [Bool.not_eq_true neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhok:ok (List.drop (k + 1) w) = false⊢ (match (sweepCfg w (k + 1) h).state with
| none => none
| some q => (treeScanner.tr q (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).outS) =
none] at hok neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhok:ok (List.drop (k + 1) w) = false⊢ (match (sweepCfg w (k + 1) h).state with
| none => none
| some q => (treeScanner.tr q (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).outS) =
none
simp only [sweepCfg_state_dead w (k + 1) h hok] neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhok:ok (List.drop (k + 1) w) = false⊢ (treeScanner.tr stDead (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).outS = none
rw [tr_dead_mid w k h neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhok:ok (List.drop (k + 1) w) = false⊢ { inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.outS = none] All goals completed! 🐙end OutputSymbolsection SeekShort of the input's right end one seek step advances the input head by one cell and leaves the blank work tape and its head untouched.
theorem seekCfg_step (w : List Bool) (t : ℕ) (h : t + 1 ≤ w.length) :
treeScanner.step (seekCfg w t (by w:List Boolt:ℕh:t + 1 ≤ w.length⊢ t ≤ w.length omega All goals completed! 🐙)) = seekCfg w (t + 1) h := by w:List Boolt:ℕh:t + 1 ≤ w.length⊢ step (seekCfg w t ⋯) = seekCfg w (t + 1) h
have hpos : moveInputPos (seekCfg w t (Nat.le_of_lt h)).inputPos SignType.pos =
(seekCfg w (t + 1) h).inputPos := by
rw [moveInputPos_pos_of_ne_right _
(by w:List Boolt:ℕh:t + 1 ≤ w.length⊢ ↑(seekCfg w t ⋯).inputPos ≠ (List.map (⇑boolEmb) w).length + 1 rw [seekCfg_inputPos_val, w:List Boolt:ℕh:t + 1 ≤ w.length⊢ t + 1 ≠ (List.map (⇑boolEmb) w).length + 1 List.length_map w:List Boolt:ℕh:t + 1 ≤ w.length⊢ t + 1 ≠ w.length + 1] w:List Boolt:ℕh:t + 1 ≤ w.length⊢ t + 1 ≠ w.length + 1; omega All goals completed! 🐙)] w:List Boolt:ℕh:t + 1 ≤ w.length⊢ ⟨↑(seekCfg w t ⋯).inputPos + 1, ⋯⟩ = (seekCfg w (t + 1) h).inputPos
exact Fin.ext rfl w:List Boolt:ℕh:t + 1 ≤ w.lengthhpos:moveInputPos (seekCfg w t ⋯).inputPos SignType.pos = (seekCfg w (t + 1) h).inputPos⊢ step (seekCfg w t ⋯) = seekCfg w (t + 1) h
rw [step_of_state _ _ stSeek (seekCfg_state w t (Nat.le_of_lt h)), w:List Boolt:ℕh:t + 1 ≤ w.lengthhpos:moveInputPos (seekCfg w t ⋯).inputPos SignType.pos = (seekCfg w (t + 1) h).inputPos⊢ { state := (treeScanner.tr stSeek (seekCfg w t ⋯).inputSymbol (seekCfg w t ⋯).workTapeSymbols).q',
inputPos :=
moveInputPos (seekCfg w t ⋯).inputPos
(treeScanner.tr stSeek (seekCfg w t ⋯).inputSymbol (seekCfg w t ⋯).workTapeSymbols).inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
((treeScanner.tr stSeek (seekCfg w t ⋯).inputSymbol (seekCfg w t ⋯).workTapeSymbols).workActions i).1 with
| none => (seekCfg w t ⋯).workTapes i
| some s => Function.update ((seekCfg w t ⋯).workTapes i) ((seekCfg w t ⋯).workTapePos i) s,
workTapePos := fun i ↦
(seekCfg w t ⋯).workTapePos i +
↑((treeScanner.tr stSeek (seekCfg w t ⋯).inputSymbol (seekCfg w t ⋯).workTapeSymbols).workActions i).2 } =
seekCfg w (t + 1) h tr_seek_mid w t h w:List Boolt:ℕh:t + 1 ≤ w.lengthhpos:moveInputPos (seekCfg w t ⋯).inputPos SignType.pos = (seekCfg w (t + 1) h).inputPos⊢ { state := { inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.q',
inputPos :=
moveInputPos (seekCfg w t ⋯).inputPos
{ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.workActions i).1 with
| none => (seekCfg w t ⋯).workTapes i
| some s => Function.update ((seekCfg w t ⋯).workTapes i) ((seekCfg w t ⋯).workTapePos i) s,
workTapePos := fun i ↦
(seekCfg w t ⋯).workTapePos i +
↑({ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.workActions i).2 } =
seekCfg w (t + 1) h] w:List Boolt:ℕh:t + 1 ≤ w.lengthhpos:moveInputPos (seekCfg w t ⋯).inputPos SignType.pos = (seekCfg w (t + 1) h).inputPos⊢ { state := { inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.q',
inputPos :=
moveInputPos (seekCfg w t ⋯).inputPos
{ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.workActions i).1 with
| none => (seekCfg w t ⋯).workTapes i
| some s => Function.update ((seekCfg w t ⋯).workTapes i) ((seekCfg w t ⋯).workTapePos i) s,
workTapePos := fun i ↦
(seekCfg w t ⋯).workTapePos i +
↑({ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.workActions i).2 } =
seekCfg w (t + 1) h
refine Cfg.ext ?_ ?_ ?_ ?_ refine_1 w:List Boolt:ℕh:t + 1 ≤ w.lengthhpos:moveInputPos (seekCfg w t ⋯).inputPos SignType.pos = (seekCfg w (t + 1) h).inputPos⊢ { state := { inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.q',
inputPos :=
moveInputPos (seekCfg w t ⋯).inputPos
{ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.workActions i).1 with
| none => (seekCfg w t ⋯).workTapes i
| some s => Function.update ((seekCfg w t ⋯).workTapes i) ((seekCfg w t ⋯).workTapePos i) s,
workTapePos := fun i ↦
(seekCfg w t ⋯).workTapePos i +
↑({ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.workActions
i).2 }.state =
(seekCfg w (t + 1) h).staterefine_2 w:List Boolt:ℕh:t + 1 ≤ w.lengthhpos:moveInputPos (seekCfg w t ⋯).inputPos SignType.pos = (seekCfg w (t + 1) h).inputPos⊢ { state := { inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.q',
inputPos :=
moveInputPos (seekCfg w t ⋯).inputPos
{ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.workActions i).1 with
| none => (seekCfg w t ⋯).workTapes i
| some s => Function.update ((seekCfg w t ⋯).workTapes i) ((seekCfg w t ⋯).workTapePos i) s,
workTapePos := fun i ↦
(seekCfg w t ⋯).workTapePos i +
↑({ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.workActions
i).2 }.inputPos =
(seekCfg w (t + 1) h).inputPosrefine_3 w:List Boolt:ℕh:t + 1 ≤ w.lengthhpos:moveInputPos (seekCfg w t ⋯).inputPos SignType.pos = (seekCfg w (t + 1) h).inputPos⊢ { state := { inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.q',
inputPos :=
moveInputPos (seekCfg w t ⋯).inputPos
{ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.workActions i).1 with
| none => (seekCfg w t ⋯).workTapes i
| some s => Function.update ((seekCfg w t ⋯).workTapes i) ((seekCfg w t ⋯).workTapePos i) s,
workTapePos := fun i ↦
(seekCfg w t ⋯).workTapePos i +
↑({ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.workActions
i).2 }.workTapes =
(seekCfg w (t + 1) h).workTapesrefine_4 w:List Boolt:ℕh:t + 1 ≤ w.lengthhpos:moveInputPos (seekCfg w t ⋯).inputPos SignType.pos = (seekCfg w (t + 1) h).inputPos⊢ { state := { inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.q',
inputPos :=
moveInputPos (seekCfg w t ⋯).inputPos
{ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.workActions i).1 with
| none => (seekCfg w t ⋯).workTapes i
| some s => Function.update ((seekCfg w t ⋯).workTapes i) ((seekCfg w t ⋯).workTapePos i) s,
workTapePos := fun i ↦
(seekCfg w t ⋯).workTapePos i +
↑({ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.workActions
i).2 }.workTapePos =
(seekCfg w (t + 1) h).workTapePos <;> refine_1 w:List Boolt:ℕh:t + 1 ≤ w.lengthhpos:moveInputPos (seekCfg w t ⋯).inputPos SignType.pos = (seekCfg w (t + 1) h).inputPos⊢ { state := { inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.q',
inputPos :=
moveInputPos (seekCfg w t ⋯).inputPos
{ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.workActions i).1 with
| none => (seekCfg w t ⋯).workTapes i
| some s => Function.update ((seekCfg w t ⋯).workTapes i) ((seekCfg w t ⋯).workTapePos i) s,
workTapePos := fun i ↦
(seekCfg w t ⋯).workTapePos i +
↑({ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.workActions
i).2 }.state =
(seekCfg w (t + 1) h).staterefine_2 w:List Boolt:ℕh:t + 1 ≤ w.lengthhpos:moveInputPos (seekCfg w t ⋯).inputPos SignType.pos = (seekCfg w (t + 1) h).inputPos⊢ { state := { inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.q',
inputPos :=
moveInputPos (seekCfg w t ⋯).inputPos
{ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.workActions i).1 with
| none => (seekCfg w t ⋯).workTapes i
| some s => Function.update ((seekCfg w t ⋯).workTapes i) ((seekCfg w t ⋯).workTapePos i) s,
workTapePos := fun i ↦
(seekCfg w t ⋯).workTapePos i +
↑({ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.workActions
i).2 }.inputPos =
(seekCfg w (t + 1) h).inputPosrefine_3 w:List Boolt:ℕh:t + 1 ≤ w.lengthhpos:moveInputPos (seekCfg w t ⋯).inputPos SignType.pos = (seekCfg w (t + 1) h).inputPos⊢ { state := { inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.q',
inputPos :=
moveInputPos (seekCfg w t ⋯).inputPos
{ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.workActions i).1 with
| none => (seekCfg w t ⋯).workTapes i
| some s => Function.update ((seekCfg w t ⋯).workTapes i) ((seekCfg w t ⋯).workTapePos i) s,
workTapePos := fun i ↦
(seekCfg w t ⋯).workTapePos i +
↑({ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.workActions
i).2 }.workTapes =
(seekCfg w (t + 1) h).workTapesrefine_4 w:List Boolt:ℕh:t + 1 ≤ w.lengthhpos:moveInputPos (seekCfg w t ⋯).inputPos SignType.pos = (seekCfg w (t + 1) h).inputPos⊢ { state := { inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.q',
inputPos :=
moveInputPos (seekCfg w t ⋯).inputPos
{ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.workActions i).1 with
| none => (seekCfg w t ⋯).workTapes i
| some s => Function.update ((seekCfg w t ⋯).workTapes i) ((seekCfg w t ⋯).workTapePos i) s,
workTapePos := fun i ↦
(seekCfg w t ⋯).workTapePos i +
↑({ inputMove := 1, workActions := fun x ↦ (none, 0), outS := none, q' := some stSeek }.workActions
i).2 }.workTapePos =
(seekCfg w (t + 1) h).workTapePos dsimp only refine_4 w:List Boolt:ℕh:t + 1 ≤ w.lengthhpos:moveInputPos (seekCfg w t ⋯).inputPos SignType.pos = (seekCfg w (t + 1) h).inputPos⊢ (fun i ↦ (seekCfg w t ⋯).workTapePos i + ↑0) = (seekCfg w (t + 1) h).workTapePos
· refine_1 w:List Boolt:ℕh:t + 1 ≤ w.lengthhpos:moveInputPos (seekCfg w t ⋯).inputPos SignType.pos = (seekCfg w (t + 1) h).inputPos⊢ some stSeek = (seekCfg w (t + 1) h).state rfl All goals completed! 🐙
· refine_2 w:List Boolt:ℕh:t + 1 ≤ w.lengthhpos:moveInputPos (seekCfg w t ⋯).inputPos SignType.pos = (seekCfg w (t + 1) h).inputPos⊢ moveInputPos (seekCfg w t ⋯).inputPos 1 = (seekCfg w (t + 1) h).inputPos exact hpos All goals completed! 🐙
· refine_3 w:List Boolt:ℕh:t + 1 ≤ w.lengthhpos:moveInputPos (seekCfg w t ⋯).inputPos SignType.pos = (seekCfg w (t + 1) h).inputPos⊢ (fun i ↦ (seekCfg w t ⋯).workTapes i) = (seekCfg w (t + 1) h).workTapes funext i refine_3 w:List Boolt:ℕh:t + 1 ≤ w.lengthhpos:moveInputPos (seekCfg w t ⋯).inputPos SignType.pos = (seekCfg w (t + 1) h).inputPosi:Fin 1⊢ (seekCfg w t ⋯).workTapes i = (seekCfg w (t + 1) h).workTapes i
rfl All goals completed! 🐙
· refine_4 w:List Boolt:ℕh:t + 1 ≤ w.lengthhpos:moveInputPos (seekCfg w t ⋯).inputPos SignType.pos = (seekCfg w (t + 1) h).inputPos⊢ (fun i ↦ (seekCfg w t ⋯).workTapePos i + ↑0) = (seekCfg w (t + 1) h).workTapePos funext i refine_4 w:List Boolt:ℕh:t + 1 ≤ w.lengthhpos:moveInputPos (seekCfg w t ⋯).inputPos SignType.pos = (seekCfg w (t + 1) h).inputPosi:Fin 1⊢ (seekCfg w t ⋯).workTapePos i + ↑0 = (seekCfg w (t + 1) h).workTapePos i
rfl All goals completed! 🐙
The seek phase's configuration and output at every step up to the
input's length: the closed form of seekCfg, and nothing emitted. Both
conjuncts run in one recursion, the output obligation being what the
composition across the phase boundary needs alongside the configuration.
theorem configs_seek (w : List Bool) :
∀ t, ∀ h : t ≤ w.length,
treeScanner.configs (treeScanner.initCfg (w.map boolEmb)) t = seekCfg w t h ∧
treeScanner.outputString (treeScanner.initCfg (w.map boolEmb)) t = [] := by w:List Bool⊢ ∀ (t : ℕ) (h : t ≤ w.length),
configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t h ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []
refine Nat.rec ?_ ?_ refine_1 w:List Bool⊢ ∀ (h : Nat.zero ≤ w.length),
configs (initCfg (List.map (⇑boolEmb) w)) Nat.zero = seekCfg w Nat.zero h ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) Nat.zero = []refine_2 w:List Bool⊢ ∀ (n : ℕ),
(∀ (h : n ≤ w.length),
configs (initCfg (List.map (⇑boolEmb) w)) n = seekCfg w n h ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) n = []) →
∀ (h : n.succ ≤ w.length),
configs (initCfg (List.map (⇑boolEmb) w)) n.succ = seekCfg w n.succ h ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) n.succ = []
· refine_1 w:List Bool⊢ ∀ (h : Nat.zero ≤ w.length),
configs (initCfg (List.map (⇑boolEmb) w)) Nat.zero = seekCfg w Nat.zero h ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) Nat.zero = [] intro _ refine_1 w:List Boolh✝:Nat.zero ≤ w.length⊢ configs (initCfg (List.map (⇑boolEmb) w)) Nat.zero = seekCfg w Nat.zero h✝ ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) Nat.zero = []
refine ⟨?_, rfl⟩ refine_1 w:List Boolh✝:Nat.zero ≤ w.length⊢ configs (initCfg (List.map (⇑boolEmb) w)) Nat.zero = seekCfg w Nat.zero h✝
rw [configs_zero, refine_1 w:List Boolh✝:Nat.zero ≤ w.length⊢ initCfg (List.map (⇑boolEmb) w) = seekCfg w Nat.zero h✝ seekCfg_zero refine_1 w:List Boolh✝:Nat.zero ≤ w.length⊢ initCfg (List.map (⇑boolEmb) w) = initCfg (List.map (⇑boolEmb) w)] All goals completed! 🐙
· refine_2 w:List Bool⊢ ∀ (n : ℕ),
(∀ (h : n ≤ w.length),
configs (initCfg (List.map (⇑boolEmb) w)) n = seekCfg w n h ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) n = []) →
∀ (h : n.succ ≤ w.length),
configs (initCfg (List.map (⇑boolEmb) w)) n.succ = seekCfg w n.succ h ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) n.succ = [] intro t ih h refine_2 w:List Boolt:ℕih:∀ (h : t ≤ w.length),
configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t h ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []h:t.succ ≤ w.length⊢ configs (initCfg (List.map (⇑boolEmb) w)) t.succ = seekCfg w t.succ h ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t.succ = []
obtain ⟨hc, ho⟩ := ih (by w:List Boolt:ℕih:∀ (h : t ≤ w.length),
configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t h ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []h:t.succ ≤ w.length⊢ t ≤ w.length omega All goals completed! 🐙) refine_2 w:List Boolt:ℕih:∀ (h : t ≤ w.length),
configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t h ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []h:t.succ ≤ w.lengthhc:configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t ⋯ho:treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []⊢ configs (initCfg (List.map (⇑boolEmb) w)) t.succ = seekCfg w t.succ h ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t.succ = []
refine ⟨?_, ?_⟩ refine_2.refine_1 w:List Boolt:ℕih:∀ (h : t ≤ w.length),
configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t h ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []h:t.succ ≤ w.lengthhc:configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t ⋯ho:treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []⊢ configs (initCfg (List.map (⇑boolEmb) w)) t.succ = seekCfg w t.succ hrefine_2.refine_2 w:List Boolt:ℕih:∀ (h : t ≤ w.length),
configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t h ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []h:t.succ ≤ w.lengthhc:configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t ⋯ho:treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []⊢ treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t.succ = []
· refine_2.refine_1 w:List Boolt:ℕih:∀ (h : t ≤ w.length),
configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t h ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []h:t.succ ≤ w.lengthhc:configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t ⋯ho:treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []⊢ configs (initCfg (List.map (⇑boolEmb) w)) t.succ = seekCfg w t.succ h rw [configs_succ_eq_step', refine_2.refine_1 w:List Boolt:ℕih:∀ (h : t ≤ w.length),
configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t h ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []h:t.succ ≤ w.lengthhc:configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t ⋯ho:treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []⊢ step (configs (initCfg (List.map (⇑boolEmb) w)) t) = seekCfg w t.succ h hc refine_2.refine_1 w:List Boolt:ℕih:∀ (h : t ≤ w.length),
configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t h ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []h:t.succ ≤ w.lengthhc:configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t ⋯ho:treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []⊢ step (seekCfg w t ⋯) = seekCfg w t.succ h] refine_2.refine_1 w:List Boolt:ℕih:∀ (h : t ≤ w.length),
configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t h ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []h:t.succ ≤ w.lengthhc:configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t ⋯ho:treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []⊢ step (seekCfg w t ⋯) = seekCfg w t.succ h
exact seekCfg_step w t h All goals completed! 🐙
· refine_2.refine_2 w:List Boolt:ℕih:∀ (h : t ≤ w.length),
configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t h ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []h:t.succ ≤ w.lengthhc:configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t ⋯ho:treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []⊢ treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t.succ = [] rw [outputString_succ, refine_2.refine_2 w:List Boolt:ℕih:∀ (h : t ≤ w.length),
configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t h ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []h:t.succ ≤ w.lengthhc:configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t ⋯ho:treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []⊢ treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t ++
(outputSymbol (configs (initCfg (List.map (⇑boolEmb) w)) t)).toList =
[] ho, refine_2.refine_2 w:List Boolt:ℕih:∀ (h : t ≤ w.length),
configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t h ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []h:t.succ ≤ w.lengthhc:configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t ⋯ho:treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []⊢ [] ++ (outputSymbol (configs (initCfg (List.map (⇑boolEmb) w)) t)).toList = [] hc, refine_2.refine_2 w:List Boolt:ℕih:∀ (h : t ≤ w.length),
configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t h ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []h:t.succ ≤ w.lengthhc:configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t ⋯ho:treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []⊢ [] ++ (outputSymbol (seekCfg w t ⋯)).toList = [] outputSymbol_seekCfg refine_2.refine_2 w:List Boolt:ℕih:∀ (h : t ≤ w.length),
configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t h ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []h:t.succ ≤ w.lengthhc:configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t ⋯ho:treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []⊢ [] ++ none.toList = []] refine_2.refine_2 w:List Boolt:ℕih:∀ (h : t ≤ w.length),
configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t h ∧
treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []h:t.succ ≤ w.lengthhc:configs (initCfg (List.map (⇑boolEmb) w)) t = seekCfg w t ⋯ho:treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) t = []⊢ [] ++ none.toList = []
rfl All goals completed! 🐙
At the input's right end the seek step writes the first marker at cell
0, moves the work head right to cell 1 and the input head left.
theorem seekCfg_exit (w : List Bool) :
treeScanner.step (seekCfg w w.length (Nat.le_refl _)) = plantCfg w := by w:List Bool⊢ step (seekCfg w w.length ⋯) = plantCfg w
have hpos : moveInputPos (seekCfg w w.length (Nat.le_refl _)).inputPos SignType.neg =
(plantCfg w).inputPos := by
rw [moveInputPos_neg_of_ne_left _
(by w:List Bool⊢ (seekCfg w w.length ⋯).inputPos ≠ 0 simp only [Ne, Fin.ext_iff, seekCfg_inputPos_val, Fin.val_zero] w:List Bool⊢ ¬w.length + 1 = 0; omega All goals completed! 🐙)] w:List Bool⊢ ⟨↑(seekCfg w w.length ⋯).inputPos - 1, ⋯⟩ = (plantCfg w).inputPos
exact Fin.ext (by w:List Bool⊢ ↑⟨↑(seekCfg w w.length ⋯).inputPos - 1, ⋯⟩ = ↑(plantCfg w).inputPos simp only [seekCfg_inputPos_val, plantCfg_inputPos_val] w:List Bool⊢ w.length + 1 - 1 = w.length; omega All goals completed! 🐙) w:List Boolhpos:moveInputPos (seekCfg w w.length ⋯).inputPos SignType.neg = (plantCfg w).inputPos⊢ step (seekCfg w w.length ⋯) = plantCfg w
rw [step_of_state _ _ stSeek (seekCfg_state w w.length (Nat.le_refl _)), w:List Boolhpos:moveInputPos (seekCfg w w.length ⋯).inputPos SignType.neg = (plantCfg w).inputPos⊢ { state := (treeScanner.tr stSeek (seekCfg w w.length ⋯).inputSymbol (seekCfg w w.length ⋯).workTapeSymbols).q',
inputPos :=
moveInputPos (seekCfg w w.length ⋯).inputPos
(treeScanner.tr stSeek (seekCfg w w.length ⋯).inputSymbol (seekCfg w w.length ⋯).workTapeSymbols).inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
((treeScanner.tr stSeek (seekCfg w w.length ⋯).inputSymbol (seekCfg w w.length ⋯).workTapeSymbols).workActions
i).1 with
| none => (seekCfg w w.length ⋯).workTapes i
| some s => Function.update ((seekCfg w w.length ⋯).workTapes i) ((seekCfg w w.length ⋯).workTapePos i) s,
workTapePos := fun i ↦
(seekCfg w w.length ⋯).workTapePos i +
↑((treeScanner.tr stSeek (seekCfg w w.length ⋯).inputSymbol (seekCfg w w.length ⋯).workTapeSymbols).workActions
i).2 } =
plantCfg w tr_seek_exit w:List Boolhpos:moveInputPos (seekCfg w w.length ⋯).inputPos SignType.neg = (plantCfg w).inputPos⊢ { state := { inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.q',
inputPos :=
moveInputPos (seekCfg w w.length ⋯).inputPos
{ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.workActions
i).1 with
| none => (seekCfg w w.length ⋯).workTapes i
| some s => Function.update ((seekCfg w w.length ⋯).workTapes i) ((seekCfg w w.length ⋯).workTapePos i) s,
workTapePos := fun i ↦
(seekCfg w w.length ⋯).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.workActions
i).2 } =
plantCfg w] w:List Boolhpos:moveInputPos (seekCfg w w.length ⋯).inputPos SignType.neg = (plantCfg w).inputPos⊢ { state := { inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.q',
inputPos :=
moveInputPos (seekCfg w w.length ⋯).inputPos
{ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.workActions
i).1 with
| none => (seekCfg w w.length ⋯).workTapes i
| some s => Function.update ((seekCfg w w.length ⋯).workTapes i) ((seekCfg w w.length ⋯).workTapePos i) s,
workTapePos := fun i ↦
(seekCfg w w.length ⋯).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.workActions
i).2 } =
plantCfg w
refine Cfg.ext ?_ ?_ ?_ ?_ refine_1 w:List Boolhpos:moveInputPos (seekCfg w w.length ⋯).inputPos SignType.neg = (plantCfg w).inputPos⊢ { state := { inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.q',
inputPos :=
moveInputPos (seekCfg w w.length ⋯).inputPos
{ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.workActions
i).1 with
| none => (seekCfg w w.length ⋯).workTapes i
| some s => Function.update ((seekCfg w w.length ⋯).workTapes i) ((seekCfg w w.length ⋯).workTapePos i) s,
workTapePos := fun i ↦
(seekCfg w w.length ⋯).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.workActions
i).2 }.state =
(plantCfg w).staterefine_2 w:List Boolhpos:moveInputPos (seekCfg w w.length ⋯).inputPos SignType.neg = (plantCfg w).inputPos⊢ { state := { inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.q',
inputPos :=
moveInputPos (seekCfg w w.length ⋯).inputPos
{ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.workActions
i).1 with
| none => (seekCfg w w.length ⋯).workTapes i
| some s => Function.update ((seekCfg w w.length ⋯).workTapes i) ((seekCfg w w.length ⋯).workTapePos i) s,
workTapePos := fun i ↦
(seekCfg w w.length ⋯).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.workActions
i).2 }.inputPos =
(plantCfg w).inputPosrefine_3 w:List Boolhpos:moveInputPos (seekCfg w w.length ⋯).inputPos SignType.neg = (plantCfg w).inputPos⊢ { state := { inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.q',
inputPos :=
moveInputPos (seekCfg w w.length ⋯).inputPos
{ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.workActions
i).1 with
| none => (seekCfg w w.length ⋯).workTapes i
| some s => Function.update ((seekCfg w w.length ⋯).workTapes i) ((seekCfg w w.length ⋯).workTapePos i) s,
workTapePos := fun i ↦
(seekCfg w w.length ⋯).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.workActions
i).2 }.workTapes =
(plantCfg w).workTapesrefine_4 w:List Boolhpos:moveInputPos (seekCfg w w.length ⋯).inputPos SignType.neg = (plantCfg w).inputPos⊢ { state := { inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.q',
inputPos :=
moveInputPos (seekCfg w w.length ⋯).inputPos
{ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.workActions
i).1 with
| none => (seekCfg w w.length ⋯).workTapes i
| some s => Function.update ((seekCfg w w.length ⋯).workTapes i) ((seekCfg w w.length ⋯).workTapePos i) s,
workTapePos := fun i ↦
(seekCfg w w.length ⋯).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.workActions
i).2 }.workTapePos =
(plantCfg w).workTapePos <;> refine_1 w:List Boolhpos:moveInputPos (seekCfg w w.length ⋯).inputPos SignType.neg = (plantCfg w).inputPos⊢ { state := { inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.q',
inputPos :=
moveInputPos (seekCfg w w.length ⋯).inputPos
{ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.workActions
i).1 with
| none => (seekCfg w w.length ⋯).workTapes i
| some s => Function.update ((seekCfg w w.length ⋯).workTapes i) ((seekCfg w w.length ⋯).workTapePos i) s,
workTapePos := fun i ↦
(seekCfg w w.length ⋯).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.workActions
i).2 }.state =
(plantCfg w).staterefine_2 w:List Boolhpos:moveInputPos (seekCfg w w.length ⋯).inputPos SignType.neg = (plantCfg w).inputPos⊢ { state := { inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.q',
inputPos :=
moveInputPos (seekCfg w w.length ⋯).inputPos
{ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.workActions
i).1 with
| none => (seekCfg w w.length ⋯).workTapes i
| some s => Function.update ((seekCfg w w.length ⋯).workTapes i) ((seekCfg w w.length ⋯).workTapePos i) s,
workTapePos := fun i ↦
(seekCfg w w.length ⋯).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.workActions
i).2 }.inputPos =
(plantCfg w).inputPosrefine_3 w:List Boolhpos:moveInputPos (seekCfg w w.length ⋯).inputPos SignType.neg = (plantCfg w).inputPos⊢ { state := { inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.q',
inputPos :=
moveInputPos (seekCfg w w.length ⋯).inputPos
{ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.workActions
i).1 with
| none => (seekCfg w w.length ⋯).workTapes i
| some s => Function.update ((seekCfg w w.length ⋯).workTapes i) ((seekCfg w w.length ⋯).workTapePos i) s,
workTapePos := fun i ↦
(seekCfg w w.length ⋯).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.workActions
i).2 }.workTapes =
(plantCfg w).workTapesrefine_4 w:List Boolhpos:moveInputPos (seekCfg w w.length ⋯).inputPos SignType.neg = (plantCfg w).inputPos⊢ { state := { inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.q',
inputPos :=
moveInputPos (seekCfg w w.length ⋯).inputPos
{ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.workActions
i).1 with
| none => (seekCfg w w.length ⋯).workTapes i
| some s => Function.update ((seekCfg w w.length ⋯).workTapes i) ((seekCfg w w.length ⋯).workTapePos i) s,
workTapePos := fun i ↦
(seekCfg w w.length ⋯).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (some (some 0), 1), outS := none, q' := some stPlant }.workActions
i).2 }.workTapePos =
(plantCfg w).workTapePos dsimp only refine_4 w:List Boolhpos:moveInputPos (seekCfg w w.length ⋯).inputPos SignType.neg = (plantCfg w).inputPos⊢ (fun i ↦ (seekCfg w w.length ⋯).workTapePos i + ↑1) = (plantCfg w).workTapePos
· refine_1 w:List Boolhpos:moveInputPos (seekCfg w w.length ⋯).inputPos SignType.neg = (plantCfg w).inputPos⊢ some stPlant = (plantCfg w).state rfl All goals completed! 🐙
· refine_2 w:List Boolhpos:moveInputPos (seekCfg w w.length ⋯).inputPos SignType.neg = (plantCfg w).inputPos⊢ moveInputPos (seekCfg w w.length ⋯).inputPos (-1) = (plantCfg w).inputPos exact hpos All goals completed! 🐙
· refine_3 w:List Boolhpos:moveInputPos (seekCfg w w.length ⋯).inputPos SignType.neg = (plantCfg w).inputPos⊢ (fun i ↦ Function.update ((seekCfg w w.length ⋯).workTapes i) ((seekCfg w w.length ⋯).workTapePos i) (some 0)) =
(plantCfg w).workTapes funext i z refine_3 w:List Boolhpos:moveInputPos (seekCfg w w.length ⋯).inputPos SignType.neg = (plantCfg w).inputPosi:Fin 1z:ℤ⊢ Function.update ((seekCfg w w.length ⋯).workTapes i) ((seekCfg w w.length ⋯).workTapePos i) (some 0) z =
(plantCfg w).workTapes i z
rw [seekCfg_workTapePos, refine_3 w:List Boolhpos:moveInputPos (seekCfg w w.length ⋯).inputPos SignType.neg = (plantCfg w).inputPosi:Fin 1z:ℤ⊢ Function.update ((seekCfg w w.length ⋯).workTapes i) 0 (some 0) z = (plantCfg w).workTapes i z Function.update_apply, refine_3 w:List Boolhpos:moveInputPos (seekCfg w w.length ⋯).inputPos SignType.neg = (plantCfg w).inputPosi:Fin 1z:ℤ⊢ (if z = 0 then some 0 else (seekCfg w w.length ⋯).workTapes i z) = (plantCfg w).workTapes i z seekCfg_workTapes, refine_3 w:List Boolhpos:moveInputPos (seekCfg w w.length ⋯).inputPos SignType.neg = (plantCfg w).inputPosi:Fin 1z:ℤ⊢ (if z = 0 then some 0 else none) = (plantCfg w).workTapes i z plantCfg_workTapes refine_3 w:List Boolhpos:moveInputPos (seekCfg w w.length ⋯).inputPos SignType.neg = (plantCfg w).inputPosi:Fin 1z:ℤ⊢ (if z = 0 then some 0 else none) = if z = 0 then some 0 else none] All goals completed! 🐙
· refine_4 w:List Boolhpos:moveInputPos (seekCfg w w.length ⋯).inputPos SignType.neg = (plantCfg w).inputPos⊢ (fun i ↦ (seekCfg w w.length ⋯).workTapePos i + ↑1) = (plantCfg w).workTapePos funext i refine_4 w:List Boolhpos:moveInputPos (seekCfg w w.length ⋯).inputPos SignType.neg = (plantCfg w).inputPosi:Fin 1⊢ (seekCfg w w.length ⋯).workTapePos i + ↑1 = (plantCfg w).workTapePos i
rfl All goals completed! 🐙end Seeksection Plant
The planting step writes the second marker at cell 1 and returns the
work head to cell 0, leaving the input head where it stands.
theorem plantCfg_step (w : List Bool) :
treeScanner.step (plantCfg w) = sweepCfg w w.length (Nat.le_refl _) := by w:List Bool⊢ step (plantCfg w) = sweepCfg w w.length ⋯
have hdepth : depth ([] : List Bool) = 0 := rfl w:List Boolhdepth:depth [] = 0⊢ step (plantCfg w) = sweepCfg w w.length ⋯
rw [step_of_state _ _ stPlant (plantCfg_state w), w:List Boolhdepth:depth [] = 0⊢ { state := (treeScanner.tr stPlant (plantCfg w).inputSymbol (plantCfg w).workTapeSymbols).q',
inputPos :=
moveInputPos (plantCfg w).inputPos
(treeScanner.tr stPlant (plantCfg w).inputSymbol (plantCfg w).workTapeSymbols).inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
((treeScanner.tr stPlant (plantCfg w).inputSymbol (plantCfg w).workTapeSymbols).workActions i).1 with
| none => (plantCfg w).workTapes i
| some s => Function.update ((plantCfg w).workTapes i) ((plantCfg w).workTapePos i) s,
workTapePos := fun i ↦
(plantCfg w).workTapePos i +
↑((treeScanner.tr stPlant (plantCfg w).inputSymbol (plantCfg w).workTapeSymbols).workActions i).2 } =
sweepCfg w w.length ⋯ tr_plant w:List Boolhdepth:depth [] = 0⊢ { state := { inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (plantCfg w).inputPos
{ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.workActions
i).1 with
| none => (plantCfg w).workTapes i
| some s => Function.update ((plantCfg w).workTapes i) ((plantCfg w).workTapePos i) s,
workTapePos := fun i ↦
(plantCfg w).workTapePos i +
↑({ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.workActions
i).2 } =
sweepCfg w w.length ⋯] w:List Boolhdepth:depth [] = 0⊢ { state := { inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (plantCfg w).inputPos
{ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.workActions
i).1 with
| none => (plantCfg w).workTapes i
| some s => Function.update ((plantCfg w).workTapes i) ((plantCfg w).workTapePos i) s,
workTapePos := fun i ↦
(plantCfg w).workTapePos i +
↑({ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.workActions
i).2 } =
sweepCfg w w.length ⋯
refine Cfg.ext ?_ ?_ ?_ ?_ refine_1 w:List Boolhdepth:depth [] = 0⊢ { state := { inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (plantCfg w).inputPos
{ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.workActions
i).1 with
| none => (plantCfg w).workTapes i
| some s => Function.update ((plantCfg w).workTapes i) ((plantCfg w).workTapePos i) s,
workTapePos := fun i ↦
(plantCfg w).workTapePos i +
↑({ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.workActions
i).2 }.state =
(sweepCfg w w.length ⋯).staterefine_2 w:List Boolhdepth:depth [] = 0⊢ { state := { inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (plantCfg w).inputPos
{ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.workActions
i).1 with
| none => (plantCfg w).workTapes i
| some s => Function.update ((plantCfg w).workTapes i) ((plantCfg w).workTapePos i) s,
workTapePos := fun i ↦
(plantCfg w).workTapePos i +
↑({ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.workActions
i).2 }.inputPos =
(sweepCfg w w.length ⋯).inputPosrefine_3 w:List Boolhdepth:depth [] = 0⊢ { state := { inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (plantCfg w).inputPos
{ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.workActions
i).1 with
| none => (plantCfg w).workTapes i
| some s => Function.update ((plantCfg w).workTapes i) ((plantCfg w).workTapePos i) s,
workTapePos := fun i ↦
(plantCfg w).workTapePos i +
↑({ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.workActions
i).2 }.workTapes =
(sweepCfg w w.length ⋯).workTapesrefine_4 w:List Boolhdepth:depth [] = 0⊢ { state := { inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (plantCfg w).inputPos
{ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.workActions
i).1 with
| none => (plantCfg w).workTapes i
| some s => Function.update ((plantCfg w).workTapes i) ((plantCfg w).workTapePos i) s,
workTapePos := fun i ↦
(plantCfg w).workTapePos i +
↑({ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.workActions
i).2 }.workTapePos =
(sweepCfg w w.length ⋯).workTapePos <;> refine_1 w:List Boolhdepth:depth [] = 0⊢ { state := { inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (plantCfg w).inputPos
{ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.workActions
i).1 with
| none => (plantCfg w).workTapes i
| some s => Function.update ((plantCfg w).workTapes i) ((plantCfg w).workTapePos i) s,
workTapePos := fun i ↦
(plantCfg w).workTapePos i +
↑({ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.workActions
i).2 }.state =
(sweepCfg w w.length ⋯).staterefine_2 w:List Boolhdepth:depth [] = 0⊢ { state := { inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (plantCfg w).inputPos
{ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.workActions
i).1 with
| none => (plantCfg w).workTapes i
| some s => Function.update ((plantCfg w).workTapes i) ((plantCfg w).workTapePos i) s,
workTapePos := fun i ↦
(plantCfg w).workTapePos i +
↑({ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.workActions
i).2 }.inputPos =
(sweepCfg w w.length ⋯).inputPosrefine_3 w:List Boolhdepth:depth [] = 0⊢ { state := { inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (plantCfg w).inputPos
{ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.workActions
i).1 with
| none => (plantCfg w).workTapes i
| some s => Function.update ((plantCfg w).workTapes i) ((plantCfg w).workTapePos i) s,
workTapePos := fun i ↦
(plantCfg w).workTapePos i +
↑({ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.workActions
i).2 }.workTapes =
(sweepCfg w w.length ⋯).workTapesrefine_4 w:List Boolhdepth:depth [] = 0⊢ { state := { inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (plantCfg w).inputPos
{ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.workActions
i).1 with
| none => (plantCfg w).workTapes i
| some s => Function.update ((plantCfg w).workTapes i) ((plantCfg w).workTapePos i) s,
workTapePos := fun i ↦
(plantCfg w).workTapePos i +
↑({ inputMove := 0, workActions := fun x ↦ (some (some 1), -1), outS := none, q' := some stLive }.workActions
i).2 }.workTapePos =
(sweepCfg w w.length ⋯).workTapePos dsimp only refine_4 w:List Boolhdepth:depth [] = 0⊢ (fun i ↦ (plantCfg w).workTapePos i + ↑(-1)) = (sweepCfg w w.length ⋯).workTapePos
· refine_1 w:List Boolhdepth:depth [] = 0⊢ some stLive = (sweepCfg w w.length ⋯).state rw [sweepCfg_state, refine_1 w:List Boolhdepth:depth [] = 0⊢ some stLive = if ok (List.drop w.length w) = true then some stLive else some stDead List.drop_length refine_1 w:List Boolhdepth:depth [] = 0⊢ some stLive = if ok [] = true then some stLive else some stDead] refine_1 w:List Boolhdepth:depth [] = 0⊢ some stLive = if ok [] = true then some stLive else some stDead
rfl All goals completed! 🐙
· refine_2 w:List Boolhdepth:depth [] = 0⊢ moveInputPos (plantCfg w).inputPos 0 = (sweepCfg w w.length ⋯).inputPos exact moveInputPos_zero _ All goals completed! 🐙
· refine_3 w:List Boolhdepth:depth [] = 0⊢ (fun i ↦ Function.update ((plantCfg w).workTapes i) ((plantCfg w).workTapePos i) (some 1)) =
(sweepCfg w w.length ⋯).workTapes funext i z refine_3 w:List Boolhdepth:depth [] = 0i:Fin 1z:ℤ⊢ Function.update ((plantCfg w).workTapes i) ((plantCfg w).workTapePos i) (some 1) z =
(sweepCfg w w.length ⋯).workTapes i z
rw [plantCfg_workTapePos, refine_3 w:List Boolhdepth:depth [] = 0i:Fin 1z:ℤ⊢ Function.update ((plantCfg w).workTapes i) 1 (some 1) z = (sweepCfg w w.length ⋯).workTapes i z Function.update_apply, refine_3 w:List Boolhdepth:depth [] = 0i:Fin 1z:ℤ⊢ (if z = 1 then some 1 else (plantCfg w).workTapes i z) = (sweepCfg w w.length ⋯).workTapes i z plantCfg_workTapes, refine_3 w:List Boolhdepth:depth [] = 0i:Fin 1z:ℤ⊢ (if z = 1 then some 1 else if z = 0 then some 0 else none) = (sweepCfg w w.length ⋯).workTapes i z sweepCfg_workTapes refine_3 w:List Boolhdepth:depth [] = 0i:Fin 1z:ℤ⊢ (if z = 1 then some 1 else if z = 0 then some 0 else none) = if z = 0 then some 0 else if z = 1 then some 1 else none] refine_3 w:List Boolhdepth:depth [] = 0i:Fin 1z:ℤ⊢ (if z = 1 then some 1 else if z = 0 then some 0 else none) = if z = 0 then some 0 else if z = 1 then some 1 else none
split_ifs pos w:List Boolhdepth:depth [] = 0i:Fin 1z:ℤh✝¹:z = 1h✝:z = 0⊢ some 1 = some 0neg w:List Boolhdepth:depth [] = 0i:Fin 1z:ℤh✝¹:z = 1h✝:¬z = 0⊢ some 1 = some 1pos w:List Boolhdepth:depth [] = 0i:Fin 1z:ℤh✝¹:¬z = 1h✝:z = 0⊢ some 0 = some 0neg w:List Boolhdepth:depth [] = 0i:Fin 1z:ℤh✝¹:¬z = 1h✝:¬z = 0⊢ none = none <;> pos w:List Boolhdepth:depth [] = 0i:Fin 1z:ℤh✝¹:z = 1h✝:z = 0⊢ some 1 = some 0neg w:List Boolhdepth:depth [] = 0i:Fin 1z:ℤh✝¹:z = 1h✝:¬z = 0⊢ some 1 = some 1pos w:List Boolhdepth:depth [] = 0i:Fin 1z:ℤh✝¹:¬z = 1h✝:z = 0⊢ some 0 = some 0neg w:List Boolhdepth:depth [] = 0i:Fin 1z:ℤh✝¹:¬z = 1h✝:¬z = 0⊢ none = none first | rfl All goals completed! 🐙 | omega All goals completed! 🐙
· refine_4 w:List Boolhdepth:depth [] = 0⊢ (fun i ↦ (plantCfg w).workTapePos i + ↑(-1)) = (sweepCfg w w.length ⋯).workTapePos funext i refine_4 w:List Boolhdepth:depth [] = 0i:Fin 1⊢ (plantCfg w).workTapePos i + ↑(-1) = (sweepCfg w w.length ⋯).workTapePos i
rw [sweepCfg_workTapePos, refine_4 w:List Boolhdepth:depth [] = 0i:Fin 1⊢ (plantCfg w).workTapePos i + ↑(-1) = ↑(depth (List.drop w.length w)) List.drop_length, refine_4 w:List Boolhdepth:depth [] = 0i:Fin 1⊢ (plantCfg w).workTapePos i + ↑(-1) = ↑(depth []) plantCfg_workTapePos, refine_4 w:List Boolhdepth:depth [] = 0i:Fin 1⊢ 1 + ↑(-1) = ↑(depth []) hdepth, refine_4 w:List Boolhdepth:depth [] = 0i:Fin 1⊢ 1 + ↑(-1) = ↑0
SignType.coe_neg_one refine_4 w:List Boolhdepth:depth [] = 0i:Fin 1⊢ 1 + -1 = ↑0] refine_4 w:List Boolhdepth:depth [] = 0i:Fin 1⊢ 1 + -1 = ↑0
omega All goals completed! 🐙end Plantsection SweepOne sweep step consumes the bit to the input head's left: the state stays live exactly where the scan extended by that bit stays live, and the work head carries the extended scan's pending count.
theorem sweepCfg_step (w : List Bool) (k : ℕ) (h : k + 1 ≤ w.length) :
treeScanner.step (sweepCfg w (k + 1) h) = sweepCfg w k (by w:List Boolk:ℕh:k + 1 ≤ w.length⊢ k ≤ w.length omega All goals completed! 🐙) := by w:List Boolk:ℕh:k + 1 ≤ w.length⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯
have hdrop : w.drop k = w[k] :: w.drop (k + 1) := List.drop_eq_getElem_cons (by w:List Boolk:ℕh:k + 1 ≤ w.length⊢ k < w.length omega All goals completed! 🐙) w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) w⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯
have hpos : moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg =
(sweepCfg w k (by w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) w⊢ k ≤ w.length omega All goals completed! 🐙 : k ≤ w.length)).inputPos := by
rw [moveInputPos_neg_of_ne_left _
(by w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) w⊢ (sweepCfg w (k + 1) h).inputPos ≠ 0 simp only [Ne, Fin.ext_iff, sweepCfg_inputPos_val, Fin.val_zero] w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) w⊢ ¬k + 1 = 0; omega All goals completed! 🐙)] w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) w⊢ ⟨↑(sweepCfg w (k + 1) h).inputPos - 1, ⋯⟩ = (sweepCfg w k ⋯).inputPos
exact Fin.ext (by w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) w⊢ ↑⟨↑(sweepCfg w (k + 1) h).inputPos - 1, ⋯⟩ = ↑(sweepCfg w k ⋯).inputPos simp only [sweepCfg_inputPos_val] w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) w⊢ k + 1 - 1 = k; omega All goals completed! 🐙) w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPos⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯
by_cases hok : ok (w.drop (k + 1)) = true pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = true⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:¬ok (List.drop (k + 1) w) = true⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯
· pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = true⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯ have hst := sweepCfg_state_live w (k + 1) h hok pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLive⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯
cases hbit : w[k] with
| false => pos.false w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = false⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯
have hokk : ok (w.drop k) = true := by
rw [hdrop, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = false⊢ ok (w[k] :: List.drop (k + 1) w) = true hbit, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = false⊢ ok (false :: List.drop (k + 1) w) = true ok_cons_false w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = false⊢ ok (List.drop (k + 1) w) = true] w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = false⊢ ok (List.drop (k + 1) w) = true
exact hok pos.false w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = true⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯
have hdk : depth (w.drop k) = depth (w.drop (k + 1)) + 1 := by
rw [hdrop, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = true⊢ depth (w[k] :: List.drop (k + 1) w) = depth (List.drop (k + 1) w) + 1 hbit, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = true⊢ depth (false :: List.drop (k + 1) w) = depth (List.drop (k + 1) w) + 1 depth_cons_false_of_ok _ hok w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = true⊢ depth (List.drop (k + 1) w) + 1 = depth (List.drop (k + 1) w) + 1] pos.false w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯
rw [step_of_state _ _ stLive hst, pos.false w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1⊢ { state := (treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
(treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
((treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).workActions
i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑((treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).workActions
i).2 } =
sweepCfg w k ⋯ tr_live_leaf w k h hbit pos.false w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.workActions i).2 } =
sweepCfg w k ⋯] pos.false w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.workActions i).2 } =
sweepCfg w k ⋯
refine Cfg.ext ?_ ?_ ?_ ?_ pos.false.refine_1 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.workActions
i).2 }.state =
(sweepCfg w k ⋯).statepos.false.refine_2 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.workActions
i).2 }.inputPos =
(sweepCfg w k ⋯).inputPospos.false.refine_3 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.workActions
i).2 }.workTapes =
(sweepCfg w k ⋯).workTapespos.false.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.workActions
i).2 }.workTapePos =
(sweepCfg w k ⋯).workTapePos <;> pos.false.refine_1 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.workActions
i).2 }.state =
(sweepCfg w k ⋯).statepos.false.refine_2 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.workActions
i).2 }.inputPos =
(sweepCfg w k ⋯).inputPospos.false.refine_3 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.workActions
i).2 }.workTapes =
(sweepCfg w k ⋯).workTapespos.false.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 1), outS := none, q' := some stLive }.workActions
i).2 }.workTapePos =
(sweepCfg w k ⋯).workTapePos dsimp only pos.false.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1⊢ (fun i ↦ (sweepCfg w (k + 1) h).workTapePos i + ↑1) = (sweepCfg w k ⋯).workTapePos
· pos.false.refine_1 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1⊢ some stLive = (sweepCfg w k ⋯).state rw [sweepCfg_state, pos.false.refine_1 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1⊢ some stLive = if ok (List.drop k w) = true then some stLive else some stDead ite_eq_left hokk pos.false.refine_1 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1⊢ some stLive = some stLive] All goals completed! 🐙
· pos.false.refine_2 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1⊢ moveInputPos (sweepCfg w (k + 1) h).inputPos (-1) = (sweepCfg w k ⋯).inputPos exact hpos All goals completed! 🐙
· pos.false.refine_3 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1⊢ (fun i ↦ (sweepCfg w (k + 1) h).workTapes i) = (sweepCfg w k ⋯).workTapes funext i pos.false.refine_3 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1i:Fin 1⊢ (sweepCfg w (k + 1) h).workTapes i = (sweepCfg w k ⋯).workTapes i
rfl All goals completed! 🐙
· pos.false.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1⊢ (fun i ↦ (sweepCfg w (k + 1) h).workTapePos i + ↑1) = (sweepCfg w k ⋯).workTapePos funext i pos.false.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1i:Fin 1⊢ (sweepCfg w (k + 1) h).workTapePos i + ↑1 = (sweepCfg w k ⋯).workTapePos i
rw [sweepCfg_workTapePos, pos.false.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1i:Fin 1⊢ ↑(depth (List.drop (k + 1) w)) + ↑1 = (sweepCfg w k ⋯).workTapePos i sweepCfg_workTapePos, pos.false.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1i:Fin 1⊢ ↑(depth (List.drop (k + 1) w)) + ↑1 = ↑(depth (List.drop k w)) hdk, pos.false.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1i:Fin 1⊢ ↑(depth (List.drop (k + 1) w)) + ↑1 = ↑(depth (List.drop (k + 1) w) + 1) SignType.coe_one pos.false.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1i:Fin 1⊢ ↑(depth (List.drop (k + 1) w)) + 1 = ↑(depth (List.drop (k + 1) w) + 1)] pos.false.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = falsehokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) + 1i:Fin 1⊢ ↑(depth (List.drop (k + 1) w)) + 1 = ↑(depth (List.drop (k + 1) w) + 1)
omega All goals completed! 🐙
| true => pos.true w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = true⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯
by_cases hd : 2 ≤ depth (w.drop (k + 1)) pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯
· pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯ have hokk : ok (w.drop k) = true := by
rw [hdrop, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)⊢ ok (w[k] :: List.drop (k + 1) w) = true hbit, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)⊢ ok (true :: List.drop (k + 1) w) = true ok_cons_true, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)⊢ (ok (List.drop (k + 1) w) && decide (2 ≤ depth (List.drop (k + 1) w))) = true hok, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)⊢ (true && decide (2 ≤ depth (List.drop (k + 1) w))) = true decide_eq_true hd w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)⊢ (true && true) = true] w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)⊢ (true && true) = true
rfl pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = true⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯
have hdk : depth (w.drop k) = depth (w.drop (k + 1)) - 1 := by
rw [hdrop, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = true⊢ depth (w[k] :: List.drop (k + 1) w) = depth (List.drop (k + 1) w) - 1 hbit w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = true⊢ depth (true :: List.drop (k + 1) w) = depth (List.drop (k + 1) w) - 1] w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = true⊢ depth (true :: List.drop (k + 1) w) = depth (List.drop (k + 1) w) - 1
exact depth_cons_true_of_ok_of_two_le_depth _ hok hd pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯
rw [step_of_state _ _ stLive hst, pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1⊢ { state := (treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
(treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
((treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).workActions
i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑((treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).workActions
i).2 } =
sweepCfg w k ⋯ tr_live_node_deep w k h hbit hd pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.workActions i).2 } =
sweepCfg w k ⋯] pos w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.workActions i).2 } =
sweepCfg w k ⋯
refine Cfg.ext ?_ ?_ ?_ ?_ pos.refine_1 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.workActions
i).2 }.state =
(sweepCfg w k ⋯).statepos.refine_2 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.workActions
i).2 }.inputPos =
(sweepCfg w k ⋯).inputPospos.refine_3 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.workActions
i).2 }.workTapes =
(sweepCfg w k ⋯).workTapespos.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.workActions
i).2 }.workTapePos =
(sweepCfg w k ⋯).workTapePos <;> pos.refine_1 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.workActions
i).2 }.state =
(sweepCfg w k ⋯).statepos.refine_2 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.workActions
i).2 }.inputPos =
(sweepCfg w k ⋯).inputPospos.refine_3 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.workActions
i).2 }.workTapes =
(sweepCfg w k ⋯).workTapespos.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, -1), outS := none, q' := some stLive }.workActions
i).2 }.workTapePos =
(sweepCfg w k ⋯).workTapePos dsimp only pos.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1⊢ (fun i ↦ (sweepCfg w (k + 1) h).workTapePos i + ↑(-1)) = (sweepCfg w k ⋯).workTapePos
· pos.refine_1 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1⊢ some stLive = (sweepCfg w k ⋯).state rw [sweepCfg_state, pos.refine_1 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1⊢ some stLive = if ok (List.drop k w) = true then some stLive else some stDead ite_eq_left hokk pos.refine_1 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1⊢ some stLive = some stLive] All goals completed! 🐙
· pos.refine_2 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1⊢ moveInputPos (sweepCfg w (k + 1) h).inputPos (-1) = (sweepCfg w k ⋯).inputPos exact hpos All goals completed! 🐙
· pos.refine_3 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1⊢ (fun i ↦ (sweepCfg w (k + 1) h).workTapes i) = (sweepCfg w k ⋯).workTapes funext i pos.refine_3 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1i:Fin 1⊢ (sweepCfg w (k + 1) h).workTapes i = (sweepCfg w k ⋯).workTapes i
rfl All goals completed! 🐙
· pos.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1⊢ (fun i ↦ (sweepCfg w (k + 1) h).workTapePos i + ↑(-1)) = (sweepCfg w k ⋯).workTapePos funext i pos.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1i:Fin 1⊢ (sweepCfg w (k + 1) h).workTapePos i + ↑(-1) = (sweepCfg w k ⋯).workTapePos i
rw [sweepCfg_workTapePos, pos.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1i:Fin 1⊢ ↑(depth (List.drop (k + 1) w)) + ↑(-1) = (sweepCfg w k ⋯).workTapePos i sweepCfg_workTapePos, pos.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1i:Fin 1⊢ ↑(depth (List.drop (k + 1) w)) + ↑(-1) = ↑(depth (List.drop k w)) hdk, pos.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1i:Fin 1⊢ ↑(depth (List.drop (k + 1) w)) + ↑(-1) = ↑(depth (List.drop (k + 1) w) - 1) SignType.coe_neg_one pos.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1i:Fin 1⊢ ↑(depth (List.drop (k + 1) w)) + -1 = ↑(depth (List.drop (k + 1) w) - 1)] pos.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:2 ≤ depth (List.drop (k + 1) w)hokk:ok (List.drop k w) = truehdk:depth (List.drop k w) = depth (List.drop (k + 1) w) - 1i:Fin 1⊢ ↑(depth (List.drop (k + 1) w)) + -1 = ↑(depth (List.drop (k + 1) w) - 1)
omega All goals completed! 🐙
· neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯ have hd2 : depth (w.drop (k + 1)) < 2 := by omega neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯
have hokk : ok (w.drop k) = false := by
rw [hdrop, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2⊢ ok (w[k] :: List.drop (k + 1) w) = false hbit, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2⊢ ok (true :: List.drop (k + 1) w) = false ok_cons_true, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2⊢ (ok (List.drop (k + 1) w) && decide (2 ≤ depth (List.drop (k + 1) w))) = false hok, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2⊢ (true && decide (2 ≤ depth (List.drop (k + 1) w))) = false decide_eq_false hd w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2⊢ (true && false) = false] w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2⊢ (true && false) = false
rfl neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = false⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯
have hdk : depth (w.drop k) = depth (w.drop (k + 1)) := by
rw [hdrop, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = false⊢ depth (w[k] :: List.drop (k + 1) w) = depth (List.drop (k + 1) w) hbit, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = false⊢ depth (true :: List.drop (k + 1) w) = depth (List.drop (k + 1) w) depth, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = false⊢ (binRanked.scanFinal (true :: List.drop (k + 1) w)).depth = depth (List.drop (k + 1) w) depth, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = false⊢ (binRanked.scanFinal (true :: List.drop (k + 1) w)).depth = (binRanked.scanFinal (List.drop (k + 1) w)).depth RankedAlphabet.scanFinal_cons, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = false⊢ (binRanked.scanStep true (binRanked.scanFinal (List.drop (k + 1) w))).depth =
(binRanked.scanFinal (List.drop (k + 1) w)).depth
scanStep_true_of_live_of_buf_nil_of_depth_lt_two _ hok
(buf_scanFinal_eq_nil _) hd2 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = false⊢ { buf := [], depth := (binRanked.scanFinal (List.drop (k + 1) w)).depth, live := false }.depth =
(binRanked.scanFinal (List.drop (k + 1) w)).depth] neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯
rw [step_of_state _ _ stLive hst, neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ { state := (treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
(treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
((treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).workActions
i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑((treeScanner.tr stLive (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).workActions
i).2 } =
sweepCfg w k ⋯ tr_live_node_shallow w k h hbit hd2 neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions i).2 } =
sweepCfg w k ⋯] neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions i).2 } =
sweepCfg w k ⋯
refine Cfg.ext ?_ ?_ ?_ ?_ neg.refine_1 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions
i).2 }.state =
(sweepCfg w k ⋯).stateneg.refine_2 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions
i).2 }.inputPos =
(sweepCfg w k ⋯).inputPosneg.refine_3 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions
i).2 }.workTapes =
(sweepCfg w k ⋯).workTapesneg.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions
i).2 }.workTapePos =
(sweepCfg w k ⋯).workTapePos <;> neg.refine_1 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions
i).2 }.state =
(sweepCfg w k ⋯).stateneg.refine_2 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions
i).2 }.inputPos =
(sweepCfg w k ⋯).inputPosneg.refine_3 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions
i).2 }.workTapes =
(sweepCfg w k ⋯).workTapesneg.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions
i).2 }.workTapePos =
(sweepCfg w k ⋯).workTapePos dsimp only neg.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ (fun i ↦ (sweepCfg w (k + 1) h).workTapePos i + ↑0) = (sweepCfg w k ⋯).workTapePos
· neg.refine_1 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ some stDead = (sweepCfg w k ⋯).state rw [sweepCfg_state, neg.refine_1 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ some stDead = if ok (List.drop k w) = true then some stLive else some stDead hokk neg.refine_1 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ some stDead = if false = true then some stLive else some stDead] neg.refine_1 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ some stDead = if false = true then some stLive else some stDead
rfl All goals completed! 🐙
· neg.refine_2 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ moveInputPos (sweepCfg w (k + 1) h).inputPos (-1) = (sweepCfg w k ⋯).inputPos exact hpos All goals completed! 🐙
· neg.refine_3 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ (fun i ↦ (sweepCfg w (k + 1) h).workTapes i) = (sweepCfg w k ⋯).workTapes funext i neg.refine_3 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)i:Fin 1⊢ (sweepCfg w (k + 1) h).workTapes i = (sweepCfg w k ⋯).workTapes i
rfl All goals completed! 🐙
· neg.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ (fun i ↦ (sweepCfg w (k + 1) h).workTapePos i + ↑0) = (sweepCfg w k ⋯).workTapePos funext i neg.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)i:Fin 1⊢ (sweepCfg w (k + 1) h).workTapePos i + ↑0 = (sweepCfg w k ⋯).workTapePos i
rw [sweepCfg_workTapePos, neg.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)i:Fin 1⊢ ↑(depth (List.drop (k + 1) w)) + ↑0 = (sweepCfg w k ⋯).workTapePos i sweepCfg_workTapePos, neg.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)i:Fin 1⊢ ↑(depth (List.drop (k + 1) w)) + ↑0 = ↑(depth (List.drop k w)) hdk, neg.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)i:Fin 1⊢ ↑(depth (List.drop (k + 1) w)) + ↑0 = ↑(depth (List.drop (k + 1) w)) SignType.coe_zero neg.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)i:Fin 1⊢ ↑(depth (List.drop (k + 1) w)) + 0 = ↑(depth (List.drop (k + 1) w))] neg.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = truehst:(sweepCfg w (k + 1) h).state = some stLivehbit:w[k] = truehd:¬2 ≤ depth (List.drop (k + 1) w)hd2:depth (List.drop (k + 1) w) < 2hokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)i:Fin 1⊢ ↑(depth (List.drop (k + 1) w)) + 0 = ↑(depth (List.drop (k + 1) w))
omega All goals completed! 🐙
· neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:¬ok (List.drop (k + 1) w) = true⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯ rw [Bool.not_eq_true neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = false⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯] at hok neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = false⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯
have hokk : ok (w.drop k) = false := by
rw [hdrop, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = false⊢ ok (w[k] :: List.drop (k + 1) w) = false ok, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = false⊢ (binRanked.scanFinal (w[k] :: List.drop (k + 1) w)).live = false RankedAlphabet.scanFinal_cons, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = false⊢ (binRanked.scanStep w[k] (binRanked.scanFinal (List.drop (k + 1) w))).live = false scanStep_of_not_live _ _ hok w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = false⊢ (binRanked.scanFinal (List.drop (k + 1) w)).live = false] w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = false⊢ (binRanked.scanFinal (List.drop (k + 1) w)).live = false
exact hok neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = false⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯
have hdk : depth (w.drop k) = depth (w.drop (k + 1)) := by
rw [hdrop, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = false⊢ depth (w[k] :: List.drop (k + 1) w) = depth (List.drop (k + 1) w) depth, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = false⊢ (binRanked.scanFinal (w[k] :: List.drop (k + 1) w)).depth = depth (List.drop (k + 1) w) depth, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = false⊢ (binRanked.scanFinal (w[k] :: List.drop (k + 1) w)).depth = (binRanked.scanFinal (List.drop (k + 1) w)).depth RankedAlphabet.scanFinal_cons, w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = false⊢ (binRanked.scanStep w[k] (binRanked.scanFinal (List.drop (k + 1) w))).depth =
(binRanked.scanFinal (List.drop (k + 1) w)).depth
scanStep_of_not_live _ _ hok w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = false⊢ (binRanked.scanFinal (List.drop (k + 1) w)).depth = (binRanked.scanFinal (List.drop (k + 1) w)).depth] neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ step (sweepCfg w (k + 1) h) = sweepCfg w k ⋯
rw [step_of_state _ _ stDead (sweepCfg_state_dead w (k + 1) h hok), neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ { state := (treeScanner.tr stDead (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
(treeScanner.tr stDead (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
((treeScanner.tr stDead (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).workActions
i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑((treeScanner.tr stDead (sweepCfg w (k + 1) h).inputSymbol (sweepCfg w (k + 1) h).workTapeSymbols).workActions
i).2 } =
sweepCfg w k ⋯ tr_dead_mid w k h neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions i).2 } =
sweepCfg w k ⋯] neg w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions i).2 } =
sweepCfg w k ⋯
refine Cfg.ext ?_ ?_ ?_ ?_ neg.refine_1 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions
i).2 }.state =
(sweepCfg w k ⋯).stateneg.refine_2 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions
i).2 }.inputPos =
(sweepCfg w k ⋯).inputPosneg.refine_3 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions
i).2 }.workTapes =
(sweepCfg w k ⋯).workTapesneg.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions
i).2 }.workTapePos =
(sweepCfg w k ⋯).workTapePos <;> neg.refine_1 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions
i).2 }.state =
(sweepCfg w k ⋯).stateneg.refine_2 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions
i).2 }.inputPos =
(sweepCfg w k ⋯).inputPosneg.refine_3 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions
i).2 }.workTapes =
(sweepCfg w k ⋯).workTapesneg.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ { state := { inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.q',
inputPos :=
moveInputPos (sweepCfg w (k + 1) h).inputPos
{ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions i).1 with
| none => (sweepCfg w (k + 1) h).workTapes i
| some s => Function.update ((sweepCfg w (k + 1) h).workTapes i) ((sweepCfg w (k + 1) h).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w (k + 1) h).workTapePos i +
↑({ inputMove := -1, workActions := fun x ↦ (none, 0), outS := none, q' := some stDead }.workActions
i).2 }.workTapePos =
(sweepCfg w k ⋯).workTapePos dsimp only neg.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ (fun i ↦ (sweepCfg w (k + 1) h).workTapePos i + ↑0) = (sweepCfg w k ⋯).workTapePos
· neg.refine_1 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ some stDead = (sweepCfg w k ⋯).state rw [sweepCfg_state, neg.refine_1 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ some stDead = if ok (List.drop k w) = true then some stLive else some stDead hokk neg.refine_1 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ some stDead = if false = true then some stLive else some stDead] neg.refine_1 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ some stDead = if false = true then some stLive else some stDead
rfl All goals completed! 🐙
· neg.refine_2 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ moveInputPos (sweepCfg w (k + 1) h).inputPos (-1) = (sweepCfg w k ⋯).inputPos exact hpos All goals completed! 🐙
· neg.refine_3 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ (fun i ↦ (sweepCfg w (k + 1) h).workTapes i) = (sweepCfg w k ⋯).workTapes funext i neg.refine_3 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)i:Fin 1⊢ (sweepCfg w (k + 1) h).workTapes i = (sweepCfg w k ⋯).workTapes i
rfl All goals completed! 🐙
· neg.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)⊢ (fun i ↦ (sweepCfg w (k + 1) h).workTapePos i + ↑0) = (sweepCfg w k ⋯).workTapePos funext i neg.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)i:Fin 1⊢ (sweepCfg w (k + 1) h).workTapePos i + ↑0 = (sweepCfg w k ⋯).workTapePos i
rw [sweepCfg_workTapePos, neg.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)i:Fin 1⊢ ↑(depth (List.drop (k + 1) w)) + ↑0 = (sweepCfg w k ⋯).workTapePos i sweepCfg_workTapePos, neg.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)i:Fin 1⊢ ↑(depth (List.drop (k + 1) w)) + ↑0 = ↑(depth (List.drop k w)) hdk, neg.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)i:Fin 1⊢ ↑(depth (List.drop (k + 1) w)) + ↑0 = ↑(depth (List.drop (k + 1) w)) SignType.coe_zero neg.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)i:Fin 1⊢ ↑(depth (List.drop (k + 1) w)) + 0 = ↑(depth (List.drop (k + 1) w))] neg.refine_4 w:List Boolk:ℕh:k + 1 ≤ w.lengthhdrop:List.drop k w = w[k] :: List.drop (k + 1) whpos:moveInputPos (sweepCfg w (k + 1) h).inputPos SignType.neg = (sweepCfg w k ⋯).inputPoshok:ok (List.drop (k + 1) w) = falsehokk:ok (List.drop k w) = falsehdk:depth (List.drop k w) = depth (List.drop (k + 1) w)i:Fin 1⊢ ↑(depth (List.drop (k + 1) w)) + 0 = ↑(depth (List.drop (k + 1) w))
omega All goals completed! 🐙
The sweep phase's configuration and output at every step down to the
input's left end: the closed form of sweepCfg, and nothing emitted. The
family descends in its index while the step count ascends, so the motive
carries the equation linking the two and nothing subtracts. Both conjuncts
run in one recursion, the output obligation being what the composition
across the phase boundary needs alongside the configuration.
theorem configs_sweep (w : List Bool) :
∀ j, ∀ k, ∀ h : k + j = w.length,
treeScanner.configs (sweepCfg w w.length (Nat.le_refl _)) j =
sweepCfg w k (by w:List Boolj:ℕk:ℕh:k + j = w.length⊢ k ≤ w.length omega All goals completed! 🐙) ∧
treeScanner.outputString (sweepCfg w w.length (Nat.le_refl _)) j = [] := by w:List Bool⊢ ∀ (j k : ℕ) (h : k + j = w.length),
configs (sweepCfg w w.length ⋯) j = sweepCfg w k ⋯ ∧ treeScanner.outputString (sweepCfg w w.length ⋯) j = []
refine Nat.rec ?_ ?_ refine_1 w:List Bool⊢ ∀ (k : ℕ) (h : k + Nat.zero = w.length),
configs (sweepCfg w w.length ⋯) Nat.zero = sweepCfg w k ⋯ ∧
treeScanner.outputString (sweepCfg w w.length ⋯) Nat.zero = []refine_2 w:List Bool⊢ ∀ (n : ℕ),
(∀ (k : ℕ) (h : k + n = w.length),
configs (sweepCfg w w.length ⋯) n = sweepCfg w k ⋯ ∧ treeScanner.outputString (sweepCfg w w.length ⋯) n = []) →
∀ (k : ℕ) (h : k + n.succ = w.length),
configs (sweepCfg w w.length ⋯) n.succ = sweepCfg w k ⋯ ∧
treeScanner.outputString (sweepCfg w w.length ⋯) n.succ = []
· refine_1 w:List Bool⊢ ∀ (k : ℕ) (h : k + Nat.zero = w.length),
configs (sweepCfg w w.length ⋯) Nat.zero = sweepCfg w k ⋯ ∧
treeScanner.outputString (sweepCfg w w.length ⋯) Nat.zero = [] intro k hk refine_1 w:List Boolk:ℕhk:k + Nat.zero = w.length⊢ configs (sweepCfg w w.length ⋯) Nat.zero = sweepCfg w k ⋯ ∧
treeScanner.outputString (sweepCfg w w.length ⋯) Nat.zero = []
have hkn : k = w.length := by w:List Bool⊢ ∀ (j k : ℕ) (h : k + j = w.length),
configs (sweepCfg w w.length ⋯) j = sweepCfg w k ⋯ ∧ treeScanner.outputString (sweepCfg w w.length ⋯) j = [] omega refine_1 w:List Boolk:ℕhk:k + Nat.zero = w.lengthhkn:k = w.length⊢ configs (sweepCfg w w.length ⋯) Nat.zero = sweepCfg w k ⋯ ∧
treeScanner.outputString (sweepCfg w w.length ⋯) Nat.zero = []
subst hkn refine_1 w:List Boolhk:w.length + Nat.zero = w.length⊢ configs (sweepCfg w w.length ⋯) Nat.zero = sweepCfg w w.length ⋯ ∧
treeScanner.outputString (sweepCfg w w.length ⋯) Nat.zero = []
exact ⟨configs_zero, rfl⟩ All goals completed! 🐙
· refine_2 w:List Bool⊢ ∀ (n : ℕ),
(∀ (k : ℕ) (h : k + n = w.length),
configs (sweepCfg w w.length ⋯) n = sweepCfg w k ⋯ ∧ treeScanner.outputString (sweepCfg w w.length ⋯) n = []) →
∀ (k : ℕ) (h : k + n.succ = w.length),
configs (sweepCfg w w.length ⋯) n.succ = sweepCfg w k ⋯ ∧
treeScanner.outputString (sweepCfg w w.length ⋯) n.succ = [] intro j ih k hk refine_2 w:List Boolj:ℕih:∀ (k : ℕ) (h : k + j = w.length),
configs (sweepCfg w w.length ⋯) j = sweepCfg w k ⋯ ∧ treeScanner.outputString (sweepCfg w w.length ⋯) j = []k:ℕhk:k + j.succ = w.length⊢ configs (sweepCfg w w.length ⋯) j.succ = sweepCfg w k ⋯ ∧ treeScanner.outputString (sweepCfg w w.length ⋯) j.succ = []
obtain ⟨hc, ho⟩ := ih (k + 1) (by w:List Boolj:ℕih:∀ (k : ℕ) (h : k + j = w.length),
configs (sweepCfg w w.length ⋯) j = sweepCfg w k ⋯ ∧ treeScanner.outputString (sweepCfg w w.length ⋯) j = []k:ℕhk:k + j.succ = w.length⊢ k + 1 + j = w.length omega All goals completed! 🐙) refine_2 w:List Boolj:ℕih:∀ (k : ℕ) (h : k + j = w.length),
configs (sweepCfg w w.length ⋯) j = sweepCfg w k ⋯ ∧ treeScanner.outputString (sweepCfg w w.length ⋯) j = []k:ℕhk:k + j.succ = w.lengthhc:configs (sweepCfg w w.length ⋯) j = sweepCfg w (k + 1) ⋯ho:treeScanner.outputString (sweepCfg w w.length ⋯) j = []⊢ configs (sweepCfg w w.length ⋯) j.succ = sweepCfg w k ⋯ ∧ treeScanner.outputString (sweepCfg w w.length ⋯) j.succ = []
refine ⟨?_, ?_⟩ refine_2.refine_1 w:List Boolj:ℕih:∀ (k : ℕ) (h : k + j = w.length),
configs (sweepCfg w w.length ⋯) j = sweepCfg w k ⋯ ∧ treeScanner.outputString (sweepCfg w w.length ⋯) j = []k:ℕhk:k + j.succ = w.lengthhc:configs (sweepCfg w w.length ⋯) j = sweepCfg w (k + 1) ⋯ho:treeScanner.outputString (sweepCfg w w.length ⋯) j = []⊢ configs (sweepCfg w w.length ⋯) j.succ = sweepCfg w k ⋯refine_2.refine_2 w:List Boolj:ℕih:∀ (k : ℕ) (h : k + j = w.length),
configs (sweepCfg w w.length ⋯) j = sweepCfg w k ⋯ ∧ treeScanner.outputString (sweepCfg w w.length ⋯) j = []k:ℕhk:k + j.succ = w.lengthhc:configs (sweepCfg w w.length ⋯) j = sweepCfg w (k + 1) ⋯ho:treeScanner.outputString (sweepCfg w w.length ⋯) j = []⊢ treeScanner.outputString (sweepCfg w w.length ⋯) j.succ = []
· refine_2.refine_1 w:List Boolj:ℕih:∀ (k : ℕ) (h : k + j = w.length),
configs (sweepCfg w w.length ⋯) j = sweepCfg w k ⋯ ∧ treeScanner.outputString (sweepCfg w w.length ⋯) j = []k:ℕhk:k + j.succ = w.lengthhc:configs (sweepCfg w w.length ⋯) j = sweepCfg w (k + 1) ⋯ho:treeScanner.outputString (sweepCfg w w.length ⋯) j = []⊢ configs (sweepCfg w w.length ⋯) j.succ = sweepCfg w k ⋯ rw [configs_succ_eq_step', refine_2.refine_1 w:List Boolj:ℕih:∀ (k : ℕ) (h : k + j = w.length),
configs (sweepCfg w w.length ⋯) j = sweepCfg w k ⋯ ∧ treeScanner.outputString (sweepCfg w w.length ⋯) j = []k:ℕhk:k + j.succ = w.lengthhc:configs (sweepCfg w w.length ⋯) j = sweepCfg w (k + 1) ⋯ho:treeScanner.outputString (sweepCfg w w.length ⋯) j = []⊢ step (configs (sweepCfg w w.length ⋯) j) = sweepCfg w k ⋯ hc refine_2.refine_1 w:List Boolj:ℕih:∀ (k : ℕ) (h : k + j = w.length),
configs (sweepCfg w w.length ⋯) j = sweepCfg w k ⋯ ∧ treeScanner.outputString (sweepCfg w w.length ⋯) j = []k:ℕhk:k + j.succ = w.lengthhc:configs (sweepCfg w w.length ⋯) j = sweepCfg w (k + 1) ⋯ho:treeScanner.outputString (sweepCfg w w.length ⋯) j = []⊢ step (sweepCfg w (k + 1) ⋯) = sweepCfg w k ⋯] refine_2.refine_1 w:List Boolj:ℕih:∀ (k : ℕ) (h : k + j = w.length),
configs (sweepCfg w w.length ⋯) j = sweepCfg w k ⋯ ∧ treeScanner.outputString (sweepCfg w w.length ⋯) j = []k:ℕhk:k + j.succ = w.lengthhc:configs (sweepCfg w w.length ⋯) j = sweepCfg w (k + 1) ⋯ho:treeScanner.outputString (sweepCfg w w.length ⋯) j = []⊢ step (sweepCfg w (k + 1) ⋯) = sweepCfg w k ⋯
exact sweepCfg_step w k (by w:List Boolj:ℕih:∀ (k : ℕ) (h : k + j = w.length),
configs (sweepCfg w w.length ⋯) j = sweepCfg w k ⋯ ∧ treeScanner.outputString (sweepCfg w w.length ⋯) j = []k:ℕhk:k + j.succ = w.lengthhc:configs (sweepCfg w w.length ⋯) j = sweepCfg w (k + 1) ⋯ho:treeScanner.outputString (sweepCfg w w.length ⋯) j = []⊢ k + 1 ≤ w.length omega All goals completed! 🐙)
· refine_2.refine_2 w:List Boolj:ℕih:∀ (k : ℕ) (h : k + j = w.length),
configs (sweepCfg w w.length ⋯) j = sweepCfg w k ⋯ ∧ treeScanner.outputString (sweepCfg w w.length ⋯) j = []k:ℕhk:k + j.succ = w.lengthhc:configs (sweepCfg w w.length ⋯) j = sweepCfg w (k + 1) ⋯ho:treeScanner.outputString (sweepCfg w w.length ⋯) j = []⊢ treeScanner.outputString (sweepCfg w w.length ⋯) j.succ = [] rw [outputString_succ, refine_2.refine_2 w:List Boolj:ℕih:∀ (k : ℕ) (h : k + j = w.length),
configs (sweepCfg w w.length ⋯) j = sweepCfg w k ⋯ ∧ treeScanner.outputString (sweepCfg w w.length ⋯) j = []k:ℕhk:k + j.succ = w.lengthhc:configs (sweepCfg w w.length ⋯) j = sweepCfg w (k + 1) ⋯ho:treeScanner.outputString (sweepCfg w w.length ⋯) j = []⊢ treeScanner.outputString (sweepCfg w w.length ⋯) j ++ (outputSymbol (configs (sweepCfg w w.length ⋯) j)).toList = [] ho, refine_2.refine_2 w:List Boolj:ℕih:∀ (k : ℕ) (h : k + j = w.length),
configs (sweepCfg w w.length ⋯) j = sweepCfg w k ⋯ ∧ treeScanner.outputString (sweepCfg w w.length ⋯) j = []k:ℕhk:k + j.succ = w.lengthhc:configs (sweepCfg w w.length ⋯) j = sweepCfg w (k + 1) ⋯ho:treeScanner.outputString (sweepCfg w w.length ⋯) j = []⊢ [] ++ (outputSymbol (configs (sweepCfg w w.length ⋯) j)).toList = [] hc, refine_2.refine_2 w:List Boolj:ℕih:∀ (k : ℕ) (h : k + j = w.length),
configs (sweepCfg w w.length ⋯) j = sweepCfg w k ⋯ ∧ treeScanner.outputString (sweepCfg w w.length ⋯) j = []k:ℕhk:k + j.succ = w.lengthhc:configs (sweepCfg w w.length ⋯) j = sweepCfg w (k + 1) ⋯ho:treeScanner.outputString (sweepCfg w w.length ⋯) j = []⊢ [] ++ (outputSymbol (sweepCfg w (k + 1) ⋯)).toList = [] outputSymbol_sweepCfg_succ w k (by w:List Boolj:ℕih:∀ (k : ℕ) (h : k + j = w.length),
configs (sweepCfg w w.length ⋯) j = sweepCfg w k ⋯ ∧ treeScanner.outputString (sweepCfg w w.length ⋯) j = []k:ℕhk:k + j.succ = w.lengthhc:configs (sweepCfg w w.length ⋯) j = sweepCfg w (k + 1) ⋯ho:treeScanner.outputString (sweepCfg w w.length ⋯) j = []⊢ k + 1 ≤ w.length omega All goals completed! 🐙)] refine_2.refine_2 w:List Boolj:ℕih:∀ (k : ℕ) (h : k + j = w.length),
configs (sweepCfg w w.length ⋯) j = sweepCfg w k ⋯ ∧ treeScanner.outputString (sweepCfg w w.length ⋯) j = []k:ℕhk:k + j.succ = w.lengthhc:configs (sweepCfg w w.length ⋯) j = sweepCfg w (k + 1) ⋯ho:treeScanner.outputString (sweepCfg w w.length ⋯) j = []⊢ [] ++ none.toList = []
rfl All goals completed! 🐙end Sweepsection EmissionAt the input's left end the machine halts, live or dead.
theorem sweepCfg_zero_halts (w : List Bool) :
(treeScanner.step (sweepCfg w 0 (Nat.zero_le _))).state = none := by w:List Bool⊢ (step (sweepCfg w 0 ⋯)).state = none
by_cases hok : ok w = true pos w:List Boolhok:ok w = true⊢ (step (sweepCfg w 0 ⋯)).state = noneneg w:List Boolhok:¬ok w = true⊢ (step (sweepCfg w 0 ⋯)).state = none
· pos w:List Boolhok:ok w = true⊢ (step (sweepCfg w 0 ⋯)).state = none rw [step_of_state _ _ stLive (sweepCfg_state_live w 0 (Nat.zero_le _) hok) pos w:List Boolhok:ok w = true⊢ { state := (treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).q',
inputPos :=
moveInputPos (sweepCfg w 0 ⋯).inputPos
(treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
((treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).workActions i).1 with
| none => (sweepCfg w 0 ⋯).workTapes i
| some s => Function.update ((sweepCfg w 0 ⋯).workTapes i) ((sweepCfg w 0 ⋯).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w 0 ⋯).workTapePos i +
↑((treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).workActions
i).2 }.state =
none] pos w:List Boolhok:ok w = true⊢ { state := (treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).q',
inputPos :=
moveInputPos (sweepCfg w 0 ⋯).inputPos
(treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
((treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).workActions i).1 with
| none => (sweepCfg w 0 ⋯).workTapes i
| some s => Function.update ((sweepCfg w 0 ⋯).workTapes i) ((sweepCfg w 0 ⋯).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w 0 ⋯).workTapePos i +
↑((treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).workActions
i).2 }.state =
none
by_cases hd : depth w = 1 pos w:List Boolhok:ok w = truehd:depth w = 1⊢ { state := (treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).q',
inputPos :=
moveInputPos (sweepCfg w 0 ⋯).inputPos
(treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
((treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).workActions i).1 with
| none => (sweepCfg w 0 ⋯).workTapes i
| some s => Function.update ((sweepCfg w 0 ⋯).workTapes i) ((sweepCfg w 0 ⋯).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w 0 ⋯).workTapePos i +
↑((treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).workActions
i).2 }.state =
noneneg w:List Boolhok:ok w = truehd:¬depth w = 1⊢ { state := (treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).q',
inputPos :=
moveInputPos (sweepCfg w 0 ⋯).inputPos
(treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
((treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).workActions i).1 with
| none => (sweepCfg w 0 ⋯).workTapes i
| some s => Function.update ((sweepCfg w 0 ⋯).workTapes i) ((sweepCfg w 0 ⋯).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w 0 ⋯).workTapePos i +
↑((treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).workActions
i).2 }.state =
none
· pos w:List Boolhok:ok w = truehd:depth w = 1⊢ { state := (treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).q',
inputPos :=
moveInputPos (sweepCfg w 0 ⋯).inputPos
(treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
((treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).workActions i).1 with
| none => (sweepCfg w 0 ⋯).workTapes i
| some s => Function.update ((sweepCfg w 0 ⋯).workTapes i) ((sweepCfg w 0 ⋯).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w 0 ⋯).workTapePos i +
↑((treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).workActions
i).2 }.state =
none rw [tr_live_end_accept w hd pos w:List Boolhok:ok w = truehd:depth w = 1⊢ { state := { inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 1, q' := none }.q',
inputPos :=
moveInputPos (sweepCfg w 0 ⋯).inputPos
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 1, q' := none }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 1, q' := none }.workActions i).1 with
| none => (sweepCfg w 0 ⋯).workTapes i
| some s => Function.update ((sweepCfg w 0 ⋯).workTapes i) ((sweepCfg w 0 ⋯).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w 0 ⋯).workTapePos i +
↑({ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 1, q' := none }.workActions i).2 }.state =
none] All goals completed! 🐙
· neg w:List Boolhok:ok w = truehd:¬depth w = 1⊢ { state := (treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).q',
inputPos :=
moveInputPos (sweepCfg w 0 ⋯).inputPos
(treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
((treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).workActions i).1 with
| none => (sweepCfg w 0 ⋯).workTapes i
| some s => Function.update ((sweepCfg w 0 ⋯).workTapes i) ((sweepCfg w 0 ⋯).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w 0 ⋯).workTapePos i +
↑((treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).workActions
i).2 }.state =
none rw [tr_live_end_reject w hd neg w:List Boolhok:ok w = truehd:¬depth w = 1⊢ { state := { inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }.q',
inputPos :=
moveInputPos (sweepCfg w 0 ⋯).inputPos
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }.workActions i).1 with
| none => (sweepCfg w 0 ⋯).workTapes i
| some s => Function.update ((sweepCfg w 0 ⋯).workTapes i) ((sweepCfg w 0 ⋯).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w 0 ⋯).workTapePos i +
↑({ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }.workActions i).2 }.state =
none] All goals completed! 🐙
· neg w:List Boolhok:¬ok w = true⊢ (step (sweepCfg w 0 ⋯)).state = none rw [Bool.not_eq_true neg w:List Boolhok:ok w = false⊢ (step (sweepCfg w 0 ⋯)).state = none] at hok neg w:List Boolhok:ok w = false⊢ (step (sweepCfg w 0 ⋯)).state = none
rw [step_of_state _ _ stDead (sweepCfg_state_dead w 0 (Nat.zero_le _) hok), neg w:List Boolhok:ok w = false⊢ { state := (treeScanner.tr stDead (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).q',
inputPos :=
moveInputPos (sweepCfg w 0 ⋯).inputPos
(treeScanner.tr stDead (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
((treeScanner.tr stDead (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).workActions i).1 with
| none => (sweepCfg w 0 ⋯).workTapes i
| some s => Function.update ((sweepCfg w 0 ⋯).workTapes i) ((sweepCfg w 0 ⋯).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w 0 ⋯).workTapePos i +
↑((treeScanner.tr stDead (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).workActions
i).2 }.state =
none tr_dead_end neg w:List Boolhok:ok w = false⊢ { state := { inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }.q',
inputPos :=
moveInputPos (sweepCfg w 0 ⋯).inputPos
{ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }.inputMove,
workTapes := fun i ↦
match (motive := Option (Option (Fin 2)) → ℤ → Option (Fin 2))
({ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }.workActions i).1 with
| none => (sweepCfg w 0 ⋯).workTapes i
| some s => Function.update ((sweepCfg w 0 ⋯).workTapes i) ((sweepCfg w 0 ⋯).workTapePos i) s,
workTapePos := fun i ↦
(sweepCfg w 0 ⋯).workTapePos i +
↑({ inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }.workActions i).2 }.state =
none] All goals completed! 🐙
The emitted symbol is the decision function's value: the machine's
end-of-input cases — dead, live with the second marker under the work head,
and live otherwise — are the cases of ok w && depth w == 1.
theorem outputSymbol_sweepCfg_zero (w : List Bool) :
treeScanner.outputSymbol (sweepCfg w 0 (Nat.zero_le _)) =
some (boolEmb (binRanked.validBool w)) := by w:List Bool⊢ outputSymbol (sweepCfg w 0 ⋯) = some (boolEmb (binRanked.validBool w))
rw [validBool_eq_ok_and_depth w:List Bool⊢ outputSymbol (sweepCfg w 0 ⋯) = some (boolEmb (ok w && depth w == 1))] w:List Bool⊢ outputSymbol (sweepCfg w 0 ⋯) = some (boolEmb (ok w && depth w == 1))
unfold outputSymbol w:List Bool⊢ (match (sweepCfg w 0 ⋯).state with
| none => none
| some q => (treeScanner.tr q (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).outS) =
some (boolEmb (ok w && depth w == 1))
by_cases hok : ok w = true pos w:List Boolhok:ok w = true⊢ (match (sweepCfg w 0 ⋯).state with
| none => none
| some q => (treeScanner.tr q (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).outS) =
some (boolEmb (ok w && depth w == 1))neg w:List Boolhok:¬ok w = true⊢ (match (sweepCfg w 0 ⋯).state with
| none => none
| some q => (treeScanner.tr q (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).outS) =
some (boolEmb (ok w && depth w == 1))
· pos w:List Boolhok:ok w = true⊢ (match (sweepCfg w 0 ⋯).state with
| none => none
| some q => (treeScanner.tr q (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).outS) =
some (boolEmb (ok w && depth w == 1)) simp only [sweepCfg_state_live w 0 (Nat.zero_le _) hok] pos w:List Boolhok:ok w = true⊢ (treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).outS =
some (boolEmb (ok w && depth w == 1))
by_cases hd : depth w = 1 pos w:List Boolhok:ok w = truehd:depth w = 1⊢ (treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).outS =
some (boolEmb (ok w && depth w == 1))neg w:List Boolhok:ok w = truehd:¬depth w = 1⊢ (treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).outS =
some (boolEmb (ok w && depth w == 1))
· pos w:List Boolhok:ok w = truehd:depth w = 1⊢ (treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).outS =
some (boolEmb (ok w && depth w == 1)) rw [tr_live_end_accept w hd, pos w:List Boolhok:ok w = truehd:depth w = 1⊢ { inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 1, q' := none }.outS =
some (boolEmb (ok w && depth w == 1)) hok, pos w:List Boolhok:ok w = truehd:depth w = 1⊢ { inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 1, q' := none }.outS =
some (boolEmb (true && depth w == 1)) hd pos w:List Boolhok:ok w = truehd:depth w = 1⊢ { inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 1, q' := none }.outS = some (boolEmb (true && 1 == 1))] pos w:List Boolhok:ok w = truehd:depth w = 1⊢ { inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 1, q' := none }.outS = some (boolEmb (true && 1 == 1))
rfl All goals completed! 🐙
· neg w:List Boolhok:ok w = truehd:¬depth w = 1⊢ (treeScanner.tr stLive (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).outS =
some (boolEmb (ok w && depth w == 1)) rw [tr_live_end_reject w hd, neg w:List Boolhok:ok w = truehd:¬depth w = 1⊢ { inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }.outS =
some (boolEmb (ok w && depth w == 1)) hok, neg w:List Boolhok:ok w = truehd:¬depth w = 1⊢ { inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }.outS =
some (boolEmb (true && depth w == 1)) beq_eq_false_iff_ne.mpr hd neg w:List Boolhok:ok w = truehd:¬depth w = 1⊢ { inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }.outS = some (boolEmb (true && false))] neg w:List Boolhok:ok w = truehd:¬depth w = 1⊢ { inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }.outS = some (boolEmb (true && false))
rfl All goals completed! 🐙
· neg w:List Boolhok:¬ok w = true⊢ (match (sweepCfg w 0 ⋯).state with
| none => none
| some q => (treeScanner.tr q (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).outS) =
some (boolEmb (ok w && depth w == 1)) rw [Bool.not_eq_true neg w:List Boolhok:ok w = false⊢ (match (sweepCfg w 0 ⋯).state with
| none => none
| some q => (treeScanner.tr q (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).outS) =
some (boolEmb (ok w && depth w == 1))] at hok neg w:List Boolhok:ok w = false⊢ (match (sweepCfg w 0 ⋯).state with
| none => none
| some q => (treeScanner.tr q (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).outS) =
some (boolEmb (ok w && depth w == 1))
simp only [sweepCfg_state_dead w 0 (Nat.zero_le _) hok] neg w:List Boolhok:ok w = false⊢ (treeScanner.tr stDead (sweepCfg w 0 ⋯).inputSymbol (sweepCfg w 0 ⋯).workTapeSymbols).outS =
some (boolEmb (ok w && depth w == 1))
rw [tr_dead_end, neg w:List Boolhok:ok w = false⊢ { inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }.outS =
some (boolEmb (ok w && depth w == 1)) hok neg w:List Boolhok:ok w = false⊢ { inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }.outS =
some (boolEmb (false && depth w == 1))] neg w:List Boolhok:ok w = false⊢ { inputMove := 0, workActions := fun x ↦ (none, 0), outS := some 0, q' := none }.outS =
some (boolEmb (false && depth w == 1))
rfl All goals completed! 🐙
The machine halts after 2 * w.length + 3 steps: w.length seek steps,
the seek's exit step, the planting step, w.length sweep steps, and the
emitting step.
theorem halts_at (w : List Bool) :
(treeScanner.configs (treeScanner.initCfg (w.map boolEmb))
(2 * w.length + 3)).state = none := by w:List Bool⊢ (configs (initCfg (List.map (⇑boolEmb) w)) (2 * w.length + 3)).state = none
rw [show 2 * w.length + 3 = w.length + 1 + 1 + w.length + 1 by w:List Bool⊢ (configs (initCfg (List.map (⇑boolEmb) w)) (2 * w.length + 3)).state = none omega All goals completed! 🐙,
configs_succ_eq_step', w:List Bool⊢ (step (configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1 + w.length))).state = none configs_add, w:List Bool⊢ (step (configs (configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1)) w.length)).state = none configs_succ_eq_step', w:List Bool⊢ (step (configs (step (configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1))) w.length)).state = none configs_succ_eq_step', w:List Bool⊢ (step (configs (step (step (configs (initCfg (List.map (⇑boolEmb) w)) w.length))) w.length)).state = none
(configs_seek w w.length (Nat.le_refl _)).1, w:List Bool⊢ (step (configs (step (step (seekCfg w w.length ⋯))) w.length)).state = none seekCfg_exit, w:List Bool⊢ (step (configs (step (plantCfg w)) w.length)).state = none plantCfg_step, w:List Bool⊢ (step (configs (sweepCfg w w.length ⋯) w.length)).state = none
(configs_sweep w w.length 0 (by w:List Bool⊢ 0 + w.length = w.length omega All goals completed! 🐙)).1] w:List Bool⊢ (step (sweepCfg w 0 ⋯)).state = none
exact sweepCfg_zero_halts w All goals completed! 🐙
Over the same 2 * w.length + 3 steps the machine emits one symbol, the
decision function's value at the input.
theorem outputString_eq (w : List Bool) :
treeScanner.outputString (treeScanner.initCfg (w.map boolEmb))
(2 * w.length + 3) =
[boolEmb (binRanked.validBool w)] := by w:List Bool⊢ treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) (2 * w.length + 3) = [boolEmb (binRanked.validBool w)]
have hcfg : treeScanner.configs (treeScanner.initCfg (w.map boolEmb)) (w.length + 1 + 1) =
sweepCfg w w.length (Nat.le_refl _) := by
rw [configs_succ_eq_step', w:List Bool⊢ step (configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1)) = sweepCfg w w.length ⋯ configs_succ_eq_step', w:List Bool⊢ step (step (configs (initCfg (List.map (⇑boolEmb) w)) w.length)) = sweepCfg w w.length ⋯
(configs_seek w w.length (Nat.le_refl _)).1, w:List Bool⊢ step (step (seekCfg w w.length ⋯)) = sweepCfg w w.length ⋯ seekCfg_exit w:List Bool⊢ step (plantCfg w) = sweepCfg w w.length ⋯] w:List Bool⊢ step (plantCfg w) = sweepCfg w w.length ⋯
exact plantCfg_step w w:List Boolhcfg:configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1) = sweepCfg w w.length ⋯⊢ treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) (2 * w.length + 3) = [boolEmb (binRanked.validBool w)]
rw [show 2 * w.length + 3 = w.length + 1 + 1 + w.length + 1 by w:List Bool⊢ treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) (2 * w.length + 3) = [boolEmb (binRanked.validBool w)] omega All goals completed! 🐙, outputString_succ, w:List Boolhcfg:configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1) = sweepCfg w w.length ⋯⊢ treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1 + w.length) ++
(outputSymbol (configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1 + w.length))).toList =
[boolEmb (binRanked.validBool w)]
outputString_add_eq_append, w:List Boolhcfg:configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1) = sweepCfg w w.length ⋯⊢ treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1) ++
treeScanner.outputString (configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1)) w.length ++
(outputSymbol (configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1 + w.length))).toList =
[boolEmb (binRanked.validBool w)] hcfg, w:List Boolhcfg:configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1) = sweepCfg w w.length ⋯⊢ treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1) ++
treeScanner.outputString (sweepCfg w w.length ⋯) w.length ++
(outputSymbol (configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1 + w.length))).toList =
[boolEmb (binRanked.validBool w)] configs_add, w:List Boolhcfg:configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1) = sweepCfg w w.length ⋯⊢ treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1) ++
treeScanner.outputString (sweepCfg w w.length ⋯) w.length ++
(outputSymbol (configs (configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1)) w.length)).toList =
[boolEmb (binRanked.validBool w)] hcfg, w:List Boolhcfg:configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1) = sweepCfg w w.length ⋯⊢ treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1) ++
treeScanner.outputString (sweepCfg w w.length ⋯) w.length ++
(outputSymbol (configs (sweepCfg w w.length ⋯) w.length)).toList =
[boolEmb (binRanked.validBool w)]
(configs_sweep w w.length 0 (by w:List Boolhcfg:configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1) = sweepCfg w w.length ⋯⊢ 0 + w.length = w.length omega All goals completed! 🐙)).2, (configs_sweep w w.length 0 (by w:List Boolhcfg:configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1) = sweepCfg w w.length ⋯⊢ 0 + w.length = w.length omega All goals completed! 🐙)).1,
outputSymbol_sweepCfg_zero, w:List Boolhcfg:configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1) = sweepCfg w w.length ⋯⊢ treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1) ++ [] ++
(some (boolEmb (binRanked.validBool w))).toList =
[boolEmb (binRanked.validBool w)] outputString_succ, w:List Boolhcfg:configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1) = sweepCfg w w.length ⋯⊢ treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) (w.length + 1) ++
(outputSymbol (configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1))).toList ++
[] ++
(some (boolEmb (binRanked.validBool w))).toList =
[boolEmb (binRanked.validBool w)] outputString_succ, w:List Boolhcfg:configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1) = sweepCfg w w.length ⋯⊢ treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) w.length ++
(outputSymbol (configs (initCfg (List.map (⇑boolEmb) w)) w.length)).toList ++
(outputSymbol (configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1))).toList ++
[] ++
(some (boolEmb (binRanked.validBool w))).toList =
[boolEmb (binRanked.validBool w)] configs_succ_eq_step', w:List Boolhcfg:configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1) = sweepCfg w w.length ⋯⊢ treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) w.length ++
(outputSymbol (configs (initCfg (List.map (⇑boolEmb) w)) w.length)).toList ++
(outputSymbol (step (configs (initCfg (List.map (⇑boolEmb) w)) w.length))).toList ++
[] ++
(some (boolEmb (binRanked.validBool w))).toList =
[boolEmb (binRanked.validBool w)]
(configs_seek w w.length (Nat.le_refl _)).1, w:List Boolhcfg:configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1) = sweepCfg w w.length ⋯⊢ treeScanner.outputString (initCfg (List.map (⇑boolEmb) w)) w.length ++ (outputSymbol (seekCfg w w.length ⋯)).toList ++
(outputSymbol (step (seekCfg w w.length ⋯))).toList ++
[] ++
(some (boolEmb (binRanked.validBool w))).toList =
[boolEmb (binRanked.validBool w)] (configs_seek w w.length (Nat.le_refl _)).2, w:List Boolhcfg:configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1) = sweepCfg w w.length ⋯⊢ [] ++ (outputSymbol (seekCfg w w.length ⋯)).toList ++ (outputSymbol (step (seekCfg w w.length ⋯))).toList ++ [] ++
(some (boolEmb (binRanked.validBool w))).toList =
[boolEmb (binRanked.validBool w)]
seekCfg_exit, w:List Boolhcfg:configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1) = sweepCfg w w.length ⋯⊢ [] ++ (outputSymbol (seekCfg w w.length ⋯)).toList ++ (outputSymbol (plantCfg w)).toList ++ [] ++
(some (boolEmb (binRanked.validBool w))).toList =
[boolEmb (binRanked.validBool w)] outputSymbol_seekCfg, w:List Boolhcfg:configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1) = sweepCfg w w.length ⋯⊢ [] ++ none.toList ++ (outputSymbol (plantCfg w)).toList ++ [] ++ (some (boolEmb (binRanked.validBool w))).toList =
[boolEmb (binRanked.validBool w)] outputSymbol_plantCfg w:List Boolhcfg:configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1) = sweepCfg w w.length ⋯⊢ [] ++ none.toList ++ none.toList ++ [] ++ (some (boolEmb (binRanked.validBool w))).toList =
[boolEmb (binRanked.validBool w)]] w:List Boolhcfg:configs (initCfg (List.map (⇑boolEmb) w)) (w.length + 1 + 1) = sweepCfg w w.length ⋯⊢ [] ++ none.toList ++ none.toList ++ [] ++ (some (boolEmb (binRanked.validBool w))).toList =
[boolEmb (binRanked.validBool w)]
rfl All goals completed! 🐙end Emissionend Geb.TreeScanner