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 Geb.Prototypes.Computability.BitTree.Elias.MachineRead public import Geb.Prototypes.Computability.BitTree.Elias.MachineCounter
set_option doc.verso true

Head bounds for the simple decoder phases

Tree tags, unary header bits, and already completed or rejected scans take only one or two transitions per input bit. Their direct configuration equations give bounds for every prefix.

Tags

Elias delta code, Turing machine, space bound

@[expose] public sectionnamespace Geb.BitTree.Elias.Machineopen Turing MultiTapeTM

One transition between bounded configurations stays bounded at both possible prefixes.

theorem configs_one_headBound {input : List (Fin 3)} (cfg next : Cfg 4 (Fin 3) Control input) (width : ) (hs : machine.step cfg = next) (hcfg : HeadBound width cfg) (hnext : HeadBound width next) (t : ) (ht : t 1) : HeadBound width (machine.configs cfg t) := input:List (Fin 3)cfg:Cfg 4 (Fin 3) Control inputnext:Cfg 4 (Fin 3) Control inputwidth:hs:step cfg = nexthcfg:HeadBound width cfghnext:HeadBound width nextt:ht:t 1HeadBound width (configs cfg t) input:List (Fin 3)cfg:Cfg 4 (Fin 3) Control inputnext:Cfg 4 (Fin 3) Control inputwidth:hs:step cfg = nexthcfg:HeadBound width cfghnext:HeadBound width nextt:ht:t 1 t 0, HeadBound width (configs (step cfg) t) input:List (Fin 3)cfg:Cfg 4 (Fin 3) Control inputnext:Cfg 4 (Fin 3) Control inputwidth:hs:step cfg = nexthcfg:HeadBound width cfghnext:HeadBound width nextt:ht:t 1r:hr:r 0HeadBound width (configs (step cfg) r) input:List (Fin 3)cfg:Cfg 4 (Fin 3) Control inputnext:Cfg 4 (Fin 3) Control inputwidth:hs:step cfg = nexthcfg:HeadBound width cfghnext:HeadBound width nextt:ht:t 1r:hr:r 0he:r = 0HeadBound width (configs (step cfg) r) input:List (Fin 3)cfg:Cfg 4 (Fin 3) Control inputnext:Cfg 4 (Fin 3) Control inputwidth:hs:step cfg = nexthcfg:HeadBound width cfghnext:HeadBound width nextt:ht:t 1hr:0 0HeadBound width (configs (step cfg) 0) input:List (Fin 3)cfg:Cfg 4 (Fin 3) Control inputnext:Cfg 4 (Fin 3) Control inputwidth:hs:step cfg = nexthcfg:HeadBound width cfghnext:HeadBound width nextt:ht:t 1hr:0 0HeadBound width next All goals completed! 🐙

A tree tag uses at most one additional pending position or payload-field cell.

theorem configs_tree_headBound (input : List (Fin 3)) (pos : Fin (input.length + 2)) (pending : ) (bs cs : List Bool) (b : Bool) (width : ) (hp : pending + 1 width) (hb : bs.length + 2 width) (hc : cs.length + 2 width) (hin : (scanCfg input pos stTree pending 0 bs cs).inputSymbol = some (boolEmb b)) (t : ) (ht : t 1) : HeadBound width (machine.configs (scanCfg input pos stTree pending 0 bs cs) t) := input:List (Fin 3)pos:Fin (input.length + 2)pending:bs:List Boolcs:List Boolb:Boolwidth:hp:pending + 1 widthhb:bs.length + 2 widthhc:cs.length + 2 widthhin:(scanCfg input pos stTree pending 0 bs cs).inputSymbol = some (boolEmb b)t:ht:t 1HeadBound width (configs (scanCfg input pos stTree pending 0 bs cs) t) apply configs_one_headBound _ _ width (step_tree input pos pending 0 bs cs b hin) (scanCfg_headBound _ _ _ _ _ _ _ _ (input:List (Fin 3)pos:Fin (input.length + 2)pending:bs:List Boolcs:List Boolb:Boolwidth:hp:pending + 1 widthhb:bs.length + 2 widthhc:cs.length + 2 widthhin:(scanCfg input pos stTree pending 0 bs cs).inputSymbol = some (boolEmb b)t:ht:t 1pending width All goals completed! 🐙) (input:List (Fin 3)pos:Fin (input.length + 2)pending:bs:List Boolcs:List Boolb:Boolwidth:hp:pending + 1 widthhb:bs.length + 2 widthhc:cs.length + 2 widthhin:(scanCfg input pos stTree pending 0 bs cs).inputSymbol = some (boolEmb b)t:ht:t 10 width All goals completed! 🐙) (input:List (Fin 3)pos:Fin (input.length + 2)pending:bs:List Boolcs:List Boolb:Boolwidth:hp:pending + 1 widthhb:bs.length + 2 widthhc:cs.length + 2 widthhin:(scanCfg input pos stTree pending 0 bs cs).inputSymbol = some (boolEmb b)t:ht:t 1bs.length + 1 width All goals completed! 🐙) (input:List (Fin 3)pos:Fin (input.length + 2)pending:bs:List Boolcs:List Boolb:Boolwidth:hp:pending + 1 widthhb:bs.length + 2 widthhc:cs.length + 2 widthhin:(scanCfg input pos stTree pending 0 bs cs).inputSymbol = some (boolEmb b)t:ht:t 1cs.length + 1 width All goals completed! 🐙)) ?_ t ht input:List (Fin 3)pos:Fin (input.length + 2)pending:bs:List Boolcs:List Boolwidth:hp:pending + 1 widthhb:bs.length + 2 widthhc:cs.length + 2 widtht:ht:t 1hin:(scanCfg input pos stTree pending 0 bs cs).inputSymbol = some (boolEmb false)HeadBound width (if false = true then scanCfg input (moveInputPos pos 1) stTree (pending + 1) 0 bs cs else scanCfg input (moveInputPos pos 1) stZeros pending 0 bs (true :: cs))input:List (Fin 3)pos:Fin (input.length + 2)pending:bs:List Boolcs:List Boolwidth:hp:pending + 1 widthhb:bs.length + 2 widthhc:cs.length + 2 widtht:ht:t 1hin:(scanCfg input pos stTree pending 0 bs cs).inputSymbol = some (boolEmb true)HeadBound width (if true = true then scanCfg input (moveInputPos pos 1) stTree (pending + 1) 0 bs cs else scanCfg input (moveInputPos pos 1) stZeros pending 0 bs (true :: cs)) input:List (Fin 3)pos:Fin (input.length + 2)pending:bs:List Boolcs:List Boolwidth:hp:pending + 1 widthhb:bs.length + 2 widthhc:cs.length + 2 widtht:ht:t 1hin:(scanCfg input pos stTree pending 0 bs cs).inputSymbol = some (boolEmb false)HeadBound width (if false = true then scanCfg input (moveInputPos pos 1) stTree (pending + 1) 0 bs cs else scanCfg input (moveInputPos pos 1) stZeros pending 0 bs (true :: cs)) exact scanCfg_headBound _ _ _ _ _ _ _ _ (input:List (Fin 3)pos:Fin (input.length + 2)pending:bs:List Boolcs:List Boolwidth:hp:pending + 1 widthhb:bs.length + 2 widthhc:cs.length + 2 widtht:ht:t 1hin:(scanCfg input pos stTree pending 0 bs cs).inputSymbol = some (boolEmb false)pending width All goals completed! 🐙) (input:List (Fin 3)pos:Fin (input.length + 2)pending:bs:List Boolcs:List Boolwidth:hp:pending + 1 widthhb:bs.length + 2 widthhc:cs.length + 2 widtht:ht:t 1hin:(scanCfg input pos stTree pending 0 bs cs).inputSymbol = some (boolEmb false)0 width All goals completed! 🐙) (input:List (Fin 3)pos:Fin (input.length + 2)pending:bs:List Boolcs:List Boolwidth:hp:pending + 1 widthhb:bs.length + 2 widthhc:cs.length + 2 widtht:ht:t 1hin:(scanCfg input pos stTree pending 0 bs cs).inputSymbol = some (boolEmb false)bs.length + 1 width All goals completed! 🐙) (input:List (Fin 3)pos:Fin (input.length + 2)pending:bs:List Boolcs:List Boolwidth:hp:pending + 1 widthhb:bs.length + 2 widthhc:cs.length + 2 widtht:ht:t 1hin:(scanCfg input pos stTree pending 0 bs cs).inputSymbol = some (boolEmb false)(true :: cs).length + 1 width All goals completed! 🐙) input:List (Fin 3)pos:Fin (input.length + 2)pending:bs:List Boolcs:List Boolwidth:hp:pending + 1 widthhb:bs.length + 2 widthhc:cs.length + 2 widtht:ht:t 1hin:(scanCfg input pos stTree pending 0 bs cs).inputSymbol = some (boolEmb true)HeadBound width (if true = true then scanCfg input (moveInputPos pos 1) stTree (pending + 1) 0 bs cs else scanCfg input (moveInputPos pos 1) stZeros pending 0 bs (true :: cs)) exact scanCfg_headBound _ _ _ _ _ _ _ _ hp (input:List (Fin 3)pos:Fin (input.length + 2)pending:bs:List Boolcs:List Boolwidth:hp:pending + 1 widthhb:bs.length + 2 widthhc:cs.length + 2 widtht:ht:t 1hin:(scanCfg input pos stTree pending 0 bs cs).inputSymbol = some (boolEmb true)0 width All goals completed! 🐙) (input:List (Fin 3)pos:Fin (input.length + 2)pending:bs:List Boolcs:List Boolwidth:hp:pending + 1 widthhb:bs.length + 2 widthhc:cs.length + 2 widtht:ht:t 1hin:(scanCfg input pos stTree pending 0 bs cs).inputSymbol = some (boolEmb true)bs.length + 1 width All goals completed! 🐙) (input:List (Fin 3)pos:Fin (input.length + 2)pending:bs:List Boolcs:List Boolwidth:hp:pending + 1 widthhb:bs.length + 2 widthhc:cs.length + 2 widtht:ht:t 1hin:(scanCfg input pos stTree pending 0 bs cs).inputSymbol = some (boolEmb true)cs.length + 1 width All goals completed! 🐙)

A unary header zero uses one additional unary counter position.

theorem configs_zeros_false_headBound (input : List (Fin 3)) (pos : Fin (input.length + 2)) (pending zeros : ) (bs cs : List Bool) (width : ) (hp : pending width) (hz : zeros + 1 width) (hb : bs.length + 1 width) (hc : cs.length + 1 width) (hin : (scanCfg input pos stZeros pending zeros bs cs).inputSymbol = some (boolEmb false)) (t : ) (ht : t 1) : HeadBound width (machine.configs (scanCfg input pos stZeros pending zeros bs cs) t) := input:List (Fin 3)pos:Fin (input.length + 2)pending:zeros:bs:List Boolcs:List Boolwidth:hp:pending widthhz:zeros + 1 widthhb:bs.length + 1 widthhc:cs.length + 1 widthhin:(scanCfg input pos stZeros pending zeros bs cs).inputSymbol = some (boolEmb false)t:ht:t 1HeadBound width (configs (scanCfg input pos stZeros pending zeros bs cs) t) apply configs_one_headBound _ _ width (step_zeros input pos pending zeros bs cs false hin) (scanCfg_headBound _ _ _ _ _ _ _ _ hp (input:List (Fin 3)pos:Fin (input.length + 2)pending:zeros:bs:List Boolcs:List Boolwidth:hp:pending widthhz:zeros + 1 widthhb:bs.length + 1 widthhc:cs.length + 1 widthhin:(scanCfg input pos stZeros pending zeros bs cs).inputSymbol = some (boolEmb false)t:ht:t 1zeros width All goals completed! 🐙) hb hc) ?_ t ht All goals completed! 🐙

A nonempty unary header ends by initializing the width field and testing its unary count.

theorem configs_zeros_true_headBound (input : List (Fin 3)) (pos : Fin (input.length + 2)) (pending zeros width : ) (hz : 0 < zeros) (hpw : pending width) (hzw : zeros width) (hw : 2 width) (hin : (scanCfg input pos stZeros pending zeros [] [true]).inputSymbol = some (boolEmb true)) (t : ) (ht : t 2) : HeadBound width (machine.configs (scanCfg input pos stZeros pending zeros [] [true]) t) := input:List (Fin 3)pos:Fin (input.length + 2)pending:zeros:width:hz:0 < zeroshpw:pending widthhzw:zeros widthhw:2 widthhin:(scanCfg input pos stZeros pending zeros [] [true]).inputSymbol = some (boolEmb true)t:ht:t 2HeadBound width (configs (scanCfg input pos stZeros pending zeros [] [true]) t) input:List (Fin 3)pos:Fin (input.length + 2)pending:zeros:width:hz:0 < zeroshpw:pending widthhzw:zeros widthhw:2 widthhin:(scanCfg input pos stZeros pending zeros [] [true]).inputSymbol = some (boolEmb true)t:ht:t 2hs:step (scanCfg input pos stZeros pending zeros [] [true]) = if true = true then scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true] else scanCfg input (moveInputPos pos 1) stZeros pending (zeros + 1) [] [true]HeadBound width (configs (scanCfg input pos stZeros pending zeros [] [true]) t) input:List (Fin 3)pos:Fin (input.length + 2)pending:zeros:width:hz:0 < zeroshpw:pending widthhzw:zeros widthhw:2 widthhin:(scanCfg input pos stZeros pending zeros [] [true]).inputSymbol = some (boolEmb true)t:ht:t 2hs:step (scanCfg input pos stZeros pending zeros [] [true]) = scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]HeadBound width (configs (scanCfg input pos stZeros pending zeros [] [true]) t) input:List (Fin 3)pos:Fin (input.length + 2)pending:zeros:width:hz:0 < zeroshpw:pending widthhzw:zeros widthhw:2 widthhin:(scanCfg input pos stZeros pending zeros [] [true]).inputSymbol = some (boolEmb true)t:ht:t 2hs:step (scanCfg input pos stZeros pending zeros [] [true]) = scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]hc:step (scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]) = scanCfg input (moveInputPos pos 1) (if zeros = 0 then stDecrement false else stSizeBit) pending zeros [true] [true]HeadBound width (configs (scanCfg input pos stZeros pending zeros [] [true]) t) input:List (Fin 3)pos:Fin (input.length + 2)pending:zeros:width:hz:0 < zeroshpw:pending widthhzw:zeros widthhw:2 widthhin:(scanCfg input pos stZeros pending zeros [] [true]).inputSymbol = some (boolEmb true)t:ht:t 2hs:step (scanCfg input pos stZeros pending zeros [] [true]) = scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]hc:step (scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]) = scanCfg input (moveInputPos pos 1) stSizeBit pending zeros [true] [true]HeadBound width (configs (scanCfg input pos stZeros pending zeros [] [true]) t) apply headBound_succ _ 1 width (scanCfg_headBound _ _ _ _ _ _ _ _ hpw hzw (input:List (Fin 3)pos:Fin (input.length + 2)pending:zeros:width:hz:0 < zeroshpw:pending widthhzw:zeros widthhw:2 widthhin:(scanCfg input pos stZeros pending zeros [] [true]).inputSymbol = some (boolEmb true)t:ht:t 2hs:step (scanCfg input pos stZeros pending zeros [] [true]) = scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]hc:step (scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]) = scanCfg input (moveInputPos pos 1) stSizeBit pending zeros [true] [true][].length + 1 width input:List (Fin 3)pos:Fin (input.length + 2)pending:zeros:width:hz:0 < zeroshpw:pending widthhzw:zeros widthhw:2 widthhin:(scanCfg input pos stZeros pending zeros [] [true]).inputSymbol = some (boolEmb true)t:ht:t 2hs:step (scanCfg input pos stZeros pending zeros [] [true]) = scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]hc:step (scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]) = scanCfg input (moveInputPos pos 1) stSizeBit pending zeros [true] [true]1 width; All goals completed! 🐙) (input:List (Fin 3)pos:Fin (input.length + 2)pending:zeros:width:hz:0 < zeroshpw:pending widthhzw:zeros widthhw:2 widthhin:(scanCfg input pos stZeros pending zeros [] [true]).inputSymbol = some (boolEmb true)t:ht:t 2hs:step (scanCfg input pos stZeros pending zeros [] [true]) = scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]hc:step (scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]) = scanCfg input (moveInputPos pos 1) stSizeBit pending zeros [true] [true][true].length + 1 width All goals completed! 🐙)) ?_ t ht input:List (Fin 3)pos:Fin (input.length + 2)pending:zeros:width:hz:0 < zeroshpw:pending widthhzw:zeros widthhw:2 widthhin:(scanCfg input pos stZeros pending zeros [] [true]).inputSymbol = some (boolEmb true)t:ht:t 2hs:step (scanCfg input pos stZeros pending zeros [] [true]) = scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]hc:step (scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]) = scanCfg input (moveInputPos pos 1) stSizeBit pending zeros [true] [true] t 1, HeadBound width (configs (scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]) t) input:List (Fin 3)pos:Fin (input.length + 2)pending:zeros:width:hz:0 < zeroshpw:pending widthhzw:zeros widthhw:2 widthhin:(scanCfg input pos stZeros pending zeros [] [true]).inputSymbol = some (boolEmb true)t:ht:t 2hs:step (scanCfg input pos stZeros pending zeros [] [true]) = scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]hc:step (scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]) = scanCfg input (moveInputPos pos 1) stSizeBit pending zeros [true] [true]r:hr:r 1HeadBound width (configs (scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]) r) apply configs_one_headBound _ _ width hc (scanCfg_headBound _ _ _ _ _ _ _ _ hpw hzw (input:List (Fin 3)pos:Fin (input.length + 2)pending:zeros:width:hz:0 < zeroshpw:pending widthhzw:zeros widthhw:2 widthhin:(scanCfg input pos stZeros pending zeros [] [true]).inputSymbol = some (boolEmb true)t:ht:t 2hs:step (scanCfg input pos stZeros pending zeros [] [true]) = scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]hc:step (scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]) = scanCfg input (moveInputPos pos 1) stSizeBit pending zeros [true] [true]r:hr:r 1[true].length + 1 width All goals completed! 🐙) (input:List (Fin 3)pos:Fin (input.length + 2)pending:zeros:width:hz:0 < zeroshpw:pending widthhzw:zeros widthhw:2 widthhin:(scanCfg input pos stZeros pending zeros [] [true]).inputSymbol = some (boolEmb true)t:ht:t 2hs:step (scanCfg input pos stZeros pending zeros [] [true]) = scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]hc:step (scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]) = scanCfg input (moveInputPos pos 1) stSizeBit pending zeros [true] [true]r:hr:r 1[true].length + 1 width All goals completed! 🐙)) (scanCfg_headBound _ _ _ _ _ _ _ _ hpw hzw (input:List (Fin 3)pos:Fin (input.length + 2)pending:zeros:width:hz:0 < zeroshpw:pending widthhzw:zeros widthhw:2 widthhin:(scanCfg input pos stZeros pending zeros [] [true]).inputSymbol = some (boolEmb true)t:ht:t 2hs:step (scanCfg input pos stZeros pending zeros [] [true]) = scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]hc:step (scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]) = scanCfg input (moveInputPos pos 1) stSizeBit pending zeros [true] [true]r:hr:r 1[true].length + 1 width All goals completed! 🐙) (input:List (Fin 3)pos:Fin (input.length + 2)pending:zeros:width:hz:0 < zeroshpw:pending widthhzw:zeros widthhw:2 widthhin:(scanCfg input pos stZeros pending zeros [] [true]).inputSymbol = some (boolEmb true)t:ht:t 2hs:step (scanCfg input pos stZeros pending zeros [] [true]) = scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]hc:step (scanCfg input (moveInputPos pos 1) stSizeCheck pending zeros [true] [true]) = scanCfg input (moveInputPos pos 1) stSizeBit pending zeros [true] [true]r:hr:r 1[true].length + 1 width All goals completed! 🐙)) r hr

Bits after completion or rejection leave all work-tape head positions unchanged.

theorem configs_terminal_headBound {input : List (Fin 3)} (cfg : Cfg 4 (Fin 3) Control input) (q : Control) (b : Bool) (width : ) (hq : cfg.state = some q) (htm : q = stDone q = stDead) (hin : cfg.inputSymbol = some (boolEmb b)) (hcfg : HeadBound width cfg) (t : ) (ht : t 1) : HeadBound width (machine.configs cfg t) := input:List (Fin 3)cfg:Cfg 4 (Fin 3) Control inputq:Controlb:Boolwidth:hq:cfg.state = some qhtm:q = stDone q = stDeadhin:cfg.inputSymbol = some (boolEmb b)hcfg:HeadBound width cfgt:ht:t 1HeadBound width (configs cfg t) input:List (Fin 3)cfg:Cfg 4 (Fin 3) Control inputq:Controlb:Boolwidth:hq:cfg.state = some qhtm:q = stDone q = stDeadhin:cfg.inputSymbol = some (boolEmb b)hcfg:HeadBound width cfgt:ht:t 1HeadBound width (step cfg) input:List (Fin 3)cfg:Cfg 4 (Fin 3) Control inputq:Controlb:Boolwidth:hq:cfg.state = some qhtm:q = stDone q = stDeadhin:cfg.inputSymbol = some (boolEmb b)hcfg:HeadBound width cfgt:ht:t 1i:Fin 40 (step cfg).workTapePos i (step cfg).workTapePos i width input:List (Fin 3)cfg:Cfg 4 (Fin 3) Control inputq:Controlb:Boolwidth:hq:cfg.state = some qhtm:q = stDone q = stDeadhin:cfg.inputSymbol = some (boolEmb b)hcfg:HeadBound width cfgt:ht:t 1i:Fin 4hread:q = stTree q = stZeros q = stSizeBit q = stLengthBit q = stPayloadBit q = stDone q = stDead0 (step cfg).workTapePos i (step cfg).workTapePos i width input:List (Fin 3)cfg:Cfg 4 (Fin 3) Control inputq:Controlb:Boolwidth:hq:cfg.state = some qhtm:q = stDone q = stDeadhin:cfg.inputSymbol = some (boolEmb b)hcfg:HeadBound width cfgt:ht:t 1i:Fin 4hread:q = stTree q = stZeros q = stSizeBit q = stLengthBit q = stPayloadBit q = stDone q = stDead0 { state := (read q (boolEmb b)).q', inputPos := moveInputPos cfg.inputPos 1, workTapes := fun i match (motive := Option (Option (Fin 3)) Option (Fin 3)) ((read q (boolEmb b)).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 + ((read q (boolEmb b)).workActions i).2 }.workTapePos i { state := (read q (boolEmb b)).q', inputPos := moveInputPos cfg.inputPos 1, workTapes := fun i match (motive := Option (Option (Fin 3)) Option (Fin 3)) ((read q (boolEmb b)).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 + ((read q (boolEmb b)).workActions i).2 }.workTapePos i width input:List (Fin 3)cfg:Cfg 4 (Fin 3) Control inputb:Boolwidth:hin:cfg.inputSymbol = some (boolEmb b)hcfg:HeadBound width cfgt:ht:t 1i:Fin 4hq:cfg.state = some stDonehread:stDone = stTree stDone = stZeros stDone = stSizeBit stDone = stLengthBit stDone = stPayloadBit stDone = stDone stDone = stDead0 { state := (read stDone (boolEmb b)).q', inputPos := moveInputPos cfg.inputPos 1, workTapes := fun i match (motive := Option (Option (Fin 3)) Option (Fin 3)) ((read stDone (boolEmb b)).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 + ((read stDone (boolEmb b)).workActions i).2 }.workTapePos i { state := (read stDone (boolEmb b)).q', inputPos := moveInputPos cfg.inputPos 1, workTapes := fun i match (motive := Option (Option (Fin 3)) Option (Fin 3)) ((read stDone (boolEmb b)).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 + ((read stDone (boolEmb b)).workActions i).2 }.workTapePos i widthinput:List (Fin 3)cfg:Cfg 4 (Fin 3) Control inputb:Boolwidth:hin:cfg.inputSymbol = some (boolEmb b)hcfg:HeadBound width cfgt:ht:t 1i:Fin 4hq:cfg.state = some stDeadhread:stDead = stTree stDead = stZeros stDead = stSizeBit stDead = stLengthBit stDead = stPayloadBit stDead = stDone stDead = stDead0 { state := (read stDead (boolEmb b)).q', inputPos := moveInputPos cfg.inputPos 1, workTapes := fun i match (motive := Option (Option (Fin 3)) Option (Fin 3)) ((read stDead (boolEmb b)).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 + ((read stDead (boolEmb b)).workActions i).2 }.workTapePos i { state := (read stDead (boolEmb b)).q', inputPos := moveInputPos cfg.inputPos 1, workTapes := fun i match (motive := Option (Option (Fin 3)) Option (Fin 3)) ((read stDead (boolEmb b)).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 + ((read stDead (boolEmb b)).workActions i).2 }.workTapePos i width input:List (Fin 3)cfg:Cfg 4 (Fin 3) Control inputb:Boolwidth:hin:cfg.inputSymbol = some (boolEmb b)hcfg:HeadBound width cfgt:ht:t 1i:Fin 4hq:cfg.state = some stDonehread:stDone = stTree stDone = stZeros stDone = stSizeBit stDone = stLengthBit stDone = stPayloadBit stDone = stDone stDone = stDead0 { state := (read stDone (boolEmb b)).q', inputPos := moveInputPos cfg.inputPos 1, workTapes := fun i match (motive := Option (Option (Fin 3)) Option (Fin 3)) ((read stDone (boolEmb b)).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 + ((read stDone (boolEmb b)).workActions i).2 }.workTapePos i { state := (read stDone (boolEmb b)).q', inputPos := moveInputPos cfg.inputPos 1, workTapes := fun i match (motive := Option (Option (Fin 3)) Option (Fin 3)) ((read stDone (boolEmb b)).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 + ((read stDone (boolEmb b)).workActions i).2 }.workTapePos i widthinput:List (Fin 3)cfg:Cfg 4 (Fin 3) Control inputb:Boolwidth:hin:cfg.inputSymbol = some (boolEmb b)hcfg:HeadBound width cfgt:ht:t 1i:Fin 4hq:cfg.state = some stDeadhread:stDead = stTree stDead = stZeros stDead = stSizeBit stDead = stLengthBit stDead = stPayloadBit stDead = stDone stDead = stDead0 { state := (read stDead (boolEmb b)).q', inputPos := moveInputPos cfg.inputPos 1, workTapes := fun i match (motive := Option (Option (Fin 3)) Option (Fin 3)) ((read stDead (boolEmb b)).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 + ((read stDead (boolEmb b)).workActions i).2 }.workTapePos i { state := (read stDead (boolEmb b)).q', inputPos := moveInputPos cfg.inputPos 1, workTapes := fun i match (motive := Option (Option (Fin 3)) Option (Fin 3)) ((read stDead (boolEmb b)).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 + ((read stDead (boolEmb b)).workActions i).2 }.workTapePos i width All goals completed! 🐙
end Geb.BitTree.Elias.Machine