Imports
/- Copyright (c) 2026 Google LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. -/ module public import Cryptids.Riemann95Definition public import Cryptids.ReductionSupport.Riemann95.ControllerSchema95

Decoder and tape correctness

@[expose] public section

Recursive decoder

section

Recursive decoder prefix for the 95-state machine. This proves arbitrary repetition and arbitrary suffix behavior of the read-preserving rightward parser, not the whole machine or caller-language closure.

namespace ConjectureMachines.Riemann95.Parseropen Turingdef walkInternal (q : Fin 95) : List (Fin 2) → Option (Fin 95) | [] => some q | b :: bs => match ConjectureMachines.Riemann95.machine.transition q b with | some (w, .right, next) => if w = b then walkInternal next bs else none | _ => nonetheorem walkInternal_append (q : Fin 95) (a b : List (Fin 2)) : walkInternal q (a ++ b) = (walkInternal q a).bind (fun r => walkInternal r b) := q:Fin 95a:List (Fin 2)b:List (Fin 2)⊢ walkInternal q (a ++ b) = (walkInternal q a).bind fun r ↦ walkInternal r b induction a generalizing q with b:List (Fin 2)q:Fin 95⊢ walkInternal q ([] ++ b) = (walkInternal q []).bind fun r ↦ walkInternal r b All goals completed! 🐙 b:List (Fin 2)x:Fin 2xs:List (Fin 2)ih:∀ (q : Fin 95), walkInternal q (xs ++ b) = (walkInternal q xs).bind fun r ↦ walkInternal r bq:Fin 95⊢ walkInternal q (x :: xs ++ b) = (walkInternal q (x :: xs)).bind fun r ↦ walkInternal r b b:List (Fin 2)x:Fin 2xs:List (Fin 2)ih:∀ (q : Fin 95), walkInternal q (xs ++ b) = (walkInternal q xs).bind fun r ↦ walkInternal r bq:Fin 95⊢ (match machine.transition q x with | some (w, Dir.right, next) => if w = x then walkInternal next (xs ++ b) else none | x => none) = (match machine.transition q x with | some (w, Dir.right, next) => if w = x then walkInternal next xs else none | x => none).bind fun r ↦ walkInternal r b cases ht : ConjectureMachines.Riemann95.machine.transition q x with b:List (Fin 2)x:Fin 2xs:List (Fin 2)ih:∀ (q : Fin 95), walkInternal q (xs ++ b) = (walkInternal q xs).bind fun r ↦ walkInternal r bq:Fin 95ht:machine.transition q x = none⊢ (match none with | some (w, Dir.right, next) => if w = x then walkInternal next (xs ++ b) else none | x => none) = (match none with | some (w, Dir.right, next) => if w = x then walkInternal next xs else none | x => none).bind fun r ↦ walkInternal r b All goals completed! 🐙 b:List (Fin 2)x:Fin 2xs:List (Fin 2)ih:∀ (q : Fin 95), walkInternal q (xs ++ b) = (walkInternal q xs).bind fun r ↦ walkInternal r bq:Fin 95triple:Fin 2 × Dir × Fin 95ht:machine.transition q x = some triple⊢ (match some triple with | some (w, Dir.right, next) => if w = x then walkInternal next (xs ++ b) else none | x => none) = (match some triple with | some (w, Dir.right, next) => if w = x then walkInternal next xs else none | x => none).bind fun r ↦ walkInternal r b b:List (Fin 2)x:Fin 2xs:List (Fin 2)ih:∀ (q : Fin 95), walkInternal q (xs ++ b) = (walkInternal q xs).bind fun r ↦ walkInternal r bq:Fin 95w:Fin 2dir:Dirnext:Fin 95ht:machine.transition q x = some (w, dir, next)⊢ (match some (w, dir, next) with | some (w, Dir.right, next) => if w = x then walkInternal next (xs ++ b) else none | x => none) = (match some (w, dir, next) with | some (w, Dir.right, next) => if w = x then walkInternal next xs else none | x => none).bind fun r ↦ walkInternal r b cases dir with b:List (Fin 2)x:Fin 2xs:List (Fin 2)ih:∀ (q : Fin 95), walkInternal q (xs ++ b) = (walkInternal q xs).bind fun r ↦ walkInternal r bq:Fin 95w:Fin 2next:Fin 95ht:machine.transition q x = some (w, Dir.left, next)⊢ (match some (w, Dir.left, next) with | some (w, Dir.right, next) => if w = x then walkInternal next (xs ++ b) else none | x => none) = (match some (w, Dir.left, next) with | some (w, Dir.right, next) => if w = x then walkInternal next xs else none | x => none).bind fun r ↦ walkInternal r b All goals completed! 🐙 b:List (Fin 2)x:Fin 2xs:List (Fin 2)ih:∀ (q : Fin 95), walkInternal q (xs ++ b) = (walkInternal q xs).bind fun r ↦ walkInternal r bq:Fin 95w:Fin 2next:Fin 95ht:machine.transition q x = some (w, Dir.right, next)⊢ (match some (w, Dir.right, next) with | some (w, Dir.right, next) => if w = x then walkInternal next (xs ++ b) else none | x => none) = (match some (w, Dir.right, next) with | some (w, Dir.right, next) => if w = x then walkInternal next xs else none | x => none).bind fun r ↦ walkInternal r b b:List (Fin 2)x:Fin 2xs:List (Fin 2)ih:∀ (q : Fin 95), walkInternal q (xs ++ b) = (walkInternal q xs).bind fun r ↦ walkInternal r bq:Fin 95w:Fin 2next:Fin 95ht:machine.transition q x = some (w, Dir.right, next)h:w = x⊢ (match some (w, Dir.right, next) with | some (w, Dir.right, next) => if w = x then walkInternal next (xs ++ b) else none | x => none) = (match some (w, Dir.right, next) with | some (w, Dir.right, next) => if w = x then walkInternal next xs else none | x => none).bind fun r ↦ walkInternal r bb:List (Fin 2)x:Fin 2xs:List (Fin 2)ih:∀ (q : Fin 95), walkInternal q (xs ++ b) = (walkInternal q xs).bind fun r ↦ walkInternal r bq:Fin 95w:Fin 2next:Fin 95ht:machine.transition q x = some (w, Dir.right, next)h:¬w = x⊢ (match some (w, Dir.right, next) with | some (w, Dir.right, next) => if w = x then walkInternal next (xs ++ b) else none | x => none) = (match some (w, Dir.right, next) with | some (w, Dir.right, next) => if w = x then walkInternal next xs else none | x => none).bind fun r ↦ walkInternal r b b:List (Fin 2)x:Fin 2xs:List (Fin 2)ih:∀ (q : Fin 95), walkInternal q (xs ++ b) = (walkInternal q xs).bind fun r ↦ walkInternal r bq:Fin 95w:Fin 2next:Fin 95ht:machine.transition q x = some (w, Dir.right, next)h:w = x⊢ (match some (w, Dir.right, next) with | some (w, Dir.right, next) => if w = x then walkInternal next (xs ++ b) else none | x => none) = (match some (w, Dir.right, next) with | some (w, Dir.right, next) => if w = x then walkInternal next xs else none | x => none).bind fun r ↦ walkInternal r b All goals completed! 🐙 b:List (Fin 2)x:Fin 2xs:List (Fin 2)ih:∀ (q : Fin 95), walkInternal q (xs ++ b) = (walkInternal q xs).bind fun r ↦ walkInternal r bq:Fin 95w:Fin 2next:Fin 95ht:machine.transition q x = some (w, Dir.right, next)h:¬w = x⊢ (match some (w, Dir.right, next) with | some (w, Dir.right, next) => if w = x then walkInternal next (xs ++ b) else none | x => none) = (match some (w, Dir.right, next) with | some (w, Dir.right, next) => if w = x then walkInternal next xs else none | x => none).bind fun r ↦ walkInternal r b All goals completed! 🐙def prefixBits : List (Fin 2) := [1,1,1,1,1,0]def block : List (Fin 2) := [1,1,1,1,0]def repetitions : Nat → List (Fin 2) | 0 => [] | n + 1 => block ++ repetitions ntheorem actual_prefix : walkInternal 15 prefixBits = some 46 := ⊢ walkInternal 15 prefixBits = some 46 All goals completed! 🐙theorem actual_cycle : walkInternal 46 block = some 46 := ⊢ walkInternal 46 block = some 46 All goals completed! 🐙theorem repetitions_parse (n : Nat) (tail : List (Fin 2)) : walkInternal 46 (repetitions n ++ tail) = walkInternal 46 tail := n:ℕtail:List (Fin 2)⊢ walkInternal 46 (repetitions n ++ tail) = walkInternal 46 tail induction n with tail:List (Fin 2)⊢ walkInternal 46 (repetitions 0 ++ tail) = walkInternal 46 tail All goals completed! 🐙 tail:List (Fin 2)n:ℕih:walkInternal 46 (repetitions n ++ tail) = walkInternal 46 tail⊢ walkInternal 46 (repetitions (n + 1) ++ tail) = walkInternal 46 tail All goals completed! 🐙theorem prefix_parse (n : Nat) (tail : List (Fin 2)) : walkInternal 15 (prefixBits ++ repetitions n ++ tail) = walkInternal 46 tail := n:ℕtail:List (Fin 2)⊢ walkInternal 15 (prefixBits ++ repetitions n ++ tail) = walkInternal 46 tail All goals completed! 🐙end ConjectureMachines.Riemann95.Parserend

Tape interpretation

sectionnamespace ConjectureMachines.Riemann95.Parseropen Turing ConjectureMachinesopen ConjectureMachines.Riemann95

A successful read-preserving parser walk is its exact physical tape traversal.

theorem walkInternal_nSteps (bits : List (Fin 2)) (q q' : Fin 95) (L R : ListBlank (Fin 2)) (hwalk : walkInternal q bits = some q') : nSteps bits.length ⟨q, Tape.mk' L (ListBlank.append bits R)⟩ = some ⟨q', Tape.mk' (ListBlank.append bits.reverse L) R⟩ := bits:List (Fin 2)q:Fin 95q':Fin 95L:ListBlank (Fin 2)R:ListBlank (Fin 2)hwalk:walkInternal q bits = some q'⊢ nSteps bits.length { state := q, tape := Tape.mk' L (ListBlank.append bits R) } = some { state := q', tape := Tape.mk' (ListBlank.append bits.reverse L) R } induction bits generalizing q q' L with R:ListBlank (Fin 2)q:Fin 95q':Fin 95L:ListBlank (Fin 2)hwalk:walkInternal q [] = some q'⊢ nSteps [].length { state := q, tape := Tape.mk' L (ListBlank.append [] R) } = some { state := q', tape := Tape.mk' (ListBlank.append [].reverse L) R } R:ListBlank (Fin 2)q:Fin 95q':Fin 95L:ListBlank (Fin 2)hwalk:q = q'⊢ nSteps [].length { state := q, tape := Tape.mk' L (ListBlank.append [] R) } = some { state := q', tape := Tape.mk' (ListBlank.append [].reverse L) R } R:ListBlank (Fin 2)q:Fin 95L:ListBlank (Fin 2)⊢ nSteps [].length { state := q, tape := Tape.mk' L (ListBlank.append [] R) } = some { state := q, tape := Tape.mk' (ListBlank.append [].reverse L) R } All goals completed! 🐙 R:ListBlank (Fin 2)bit:Fin 2bits:List (Fin 2)ih:∀ (q q' : Fin 95) (L : ListBlank (Fin 2)), walkInternal q bits = some q' → nSteps bits.length { state := q, tape := Tape.mk' L (ListBlank.append bits R) } = some { state := q', tape := Tape.mk' (ListBlank.append bits.reverse L) R }q:Fin 95q':Fin 95L:ListBlank (Fin 2)hwalk:walkInternal q (bit :: bits) = some q'⊢ nSteps (bit :: bits).length { state := q, tape := Tape.mk' L (ListBlank.append (bit :: bits) R) } = some { state := q', tape := Tape.mk' (ListBlank.append (bit :: bits).reverse L) R } R:ListBlank (Fin 2)bit:Fin 2bits:List (Fin 2)ih:∀ (q q' : Fin 95) (L : ListBlank (Fin 2)), walkInternal q bits = some q' → nSteps bits.length { state := q, tape := Tape.mk' L (ListBlank.append bits R) } = some { state := q', tape := Tape.mk' (ListBlank.append bits.reverse L) R }q:Fin 95q':Fin 95L:ListBlank (Fin 2)hwalk:(match machine.transition q bit with | some (w, Dir.right, next) => if w = bit then walkInternal next bits else none | x => none) = some q'⊢ nSteps (bit :: bits).length { state := q, tape := Tape.mk' L (ListBlank.append (bit :: bits) R) } = some { state := q', tape := Tape.mk' (ListBlank.append (bit :: bits).reverse L) R } cases ht : machine.transition q bit with R:ListBlank (Fin 2)bit:Fin 2bits:List (Fin 2)ih:∀ (q q' : Fin 95) (L : ListBlank (Fin 2)), walkInternal q bits = some q' → nSteps bits.length { state := q, tape := Tape.mk' L (ListBlank.append bits R) } = some { state := q', tape := Tape.mk' (ListBlank.append bits.reverse L) R }q:Fin 95q':Fin 95L:ListBlank (Fin 2)hwalk:(match machine.transition q bit with | some (w, Dir.right, next) => if w = bit then walkInternal next bits else none | x => none) = some q'ht:machine.transition q bit = none⊢ nSteps (bit :: bits).length { state := q, tape := Tape.mk' L (ListBlank.append (bit :: bits) R) } = some { state := q', tape := Tape.mk' (ListBlank.append (bit :: bits).reverse L) R } R:ListBlank (Fin 2)bit:Fin 2bits:List (Fin 2)ih:∀ (q q' : Fin 95) (L : ListBlank (Fin 2)), walkInternal q bits = some q' → nSteps bits.length { state := q, tape := Tape.mk' L (ListBlank.append bits R) } = some { state := q', tape := Tape.mk' (ListBlank.append bits.reverse L) R }q:Fin 95q':Fin 95L:ListBlank (Fin 2)ht:machine.transition q bit = nonehwalk:none = some q'⊢ nSteps (bit :: bits).length { state := q, tape := Tape.mk' L (ListBlank.append (bit :: bits) R) } = some { state := q', tape := Tape.mk' (ListBlank.append (bit :: bits).reverse L) R }; All goals completed! 🐙 R:ListBlank (Fin 2)bit:Fin 2bits:List (Fin 2)ih:∀ (q q' : Fin 95) (L : ListBlank (Fin 2)), walkInternal q bits = some q' → nSteps bits.length { state := q, tape := Tape.mk' L (ListBlank.append bits R) } = some { state := q', tape := Tape.mk' (ListBlank.append bits.reverse L) R }q:Fin 95q':Fin 95L:ListBlank (Fin 2)hwalk:(match machine.transition q bit with | some (w, Dir.right, next) => if w = bit then walkInternal next bits else none | x => none) = some q'triple:Fin 2 × Dir × Fin 95ht:machine.transition q bit = some triple⊢ nSteps (bit :: bits).length { state := q, tape := Tape.mk' L (ListBlank.append (bit :: bits) R) } = some { state := q', tape := Tape.mk' (ListBlank.append (bit :: bits).reverse L) R } R:ListBlank (Fin 2)bit:Fin 2bits:List (Fin 2)ih:∀ (q q' : Fin 95) (L : ListBlank (Fin 2)), walkInternal q bits = some q' → nSteps bits.length { state := q, tape := Tape.mk' L (ListBlank.append bits R) } = some { state := q', tape := Tape.mk' (ListBlank.append bits.reverse L) R }q:Fin 95q':Fin 95L:ListBlank (Fin 2)hwalk:(match machine.transition q bit with | some (w, Dir.right, next) => if w = bit then walkInternal next bits else none | x => none) = some q'w:Fin 2direction:Dirnext:Fin 95ht:machine.transition q bit = some (w, direction, next)⊢ nSteps (bit :: bits).length { state := q, tape := Tape.mk' L (ListBlank.append (bit :: bits) R) } = some { state := q', tape := Tape.mk' (ListBlank.append (bit :: bits).reverse L) R } cases direction with R:ListBlank (Fin 2)bit:Fin 2bits:List (Fin 2)ih:∀ (q q' : Fin 95) (L : ListBlank (Fin 2)), walkInternal q bits = some q' → nSteps bits.length { state := q, tape := Tape.mk' L (ListBlank.append bits R) } = some { state := q', tape := Tape.mk' (ListBlank.append bits.reverse L) R }q:Fin 95q':Fin 95L:ListBlank (Fin 2)hwalk:(match machine.transition q bit with | some (w, Dir.right, next) => if w = bit then walkInternal next bits else none | x => none) = some q'w:Fin 2next:Fin 95ht:machine.transition q bit = some (w, Dir.left, next)⊢ nSteps (bit :: bits).length { state := q, tape := Tape.mk' L (ListBlank.append (bit :: bits) R) } = some { state := q', tape := Tape.mk' (ListBlank.append (bit :: bits).reverse L) R } R:ListBlank (Fin 2)bit:Fin 2bits:List (Fin 2)ih:∀ (q q' : Fin 95) (L : ListBlank (Fin 2)), walkInternal q bits = some q' → nSteps bits.length { state := q, tape := Tape.mk' L (ListBlank.append bits R) } = some { state := q', tape := Tape.mk' (ListBlank.append bits.reverse L) R }q:Fin 95q':Fin 95L:ListBlank (Fin 2)w:Fin 2next:Fin 95ht:machine.transition q bit = some (w, Dir.left, next)hwalk:none = some q'⊢ nSteps (bit :: bits).length { state := q, tape := Tape.mk' L (ListBlank.append (bit :: bits) R) } = some { state := q', tape := Tape.mk' (ListBlank.append (bit :: bits).reverse L) R }; All goals completed! 🐙 R:ListBlank (Fin 2)bit:Fin 2bits:List (Fin 2)ih:∀ (q q' : Fin 95) (L : ListBlank (Fin 2)), walkInternal q bits = some q' → nSteps bits.length { state := q, tape := Tape.mk' L (ListBlank.append bits R) } = some { state := q', tape := Tape.mk' (ListBlank.append bits.reverse L) R }q:Fin 95q':Fin 95L:ListBlank (Fin 2)hwalk:(match machine.transition q bit with | some (w, Dir.right, next) => if w = bit then walkInternal next bits else none | x => none) = some q'w:Fin 2next:Fin 95ht:machine.transition q bit = some (w, Dir.right, next)⊢ nSteps (bit :: bits).length { state := q, tape := Tape.mk' L (ListBlank.append (bit :: bits) R) } = some { state := q', tape := Tape.mk' (ListBlank.append (bit :: bits).reverse L) R } R:ListBlank (Fin 2)bit:Fin 2bits:List (Fin 2)ih:∀ (q q' : Fin 95) (L : ListBlank (Fin 2)), walkInternal q bits = some q' → nSteps bits.length { state := q, tape := Tape.mk' L (ListBlank.append bits R) } = some { state := q', tape := Tape.mk' (ListBlank.append bits.reverse L) R }q:Fin 95q':Fin 95L:ListBlank (Fin 2)hwalk:(match machine.transition q bit with | some (w, Dir.right, next) => if w = bit then walkInternal next bits else none | x => none) = some q'w:Fin 2next:Fin 95ht:machine.transition q bit = some (w, Dir.right, next)hw:w = bit⊢ nSteps (bit :: bits).length { state := q, tape := Tape.mk' L (ListBlank.append (bit :: bits) R) } = some { state := q', tape := Tape.mk' (ListBlank.append (bit :: bits).reverse L) R }R:ListBlank (Fin 2)bit:Fin 2bits:List (Fin 2)ih:∀ (q q' : Fin 95) (L : ListBlank (Fin 2)), walkInternal q bits = some q' → nSteps bits.length { state := q, tape := Tape.mk' L (ListBlank.append bits R) } = some { state := q', tape := Tape.mk' (ListBlank.append bits.reverse L) R }q:Fin 95q':Fin 95L:ListBlank (Fin 2)hwalk:(match machine.transition q bit with | some (w, Dir.right, next) => if w = bit then walkInternal next bits else none | x => none) = some q'w:Fin 2next:Fin 95ht:machine.transition q bit = some (w, Dir.right, next)hw:¬w = bit⊢ nSteps (bit :: bits).length { state := q, tape := Tape.mk' L (ListBlank.append (bit :: bits) R) } = some { state := q', tape := Tape.mk' (ListBlank.append (bit :: bits).reverse L) R } R:ListBlank (Fin 2)bit:Fin 2bits:List (Fin 2)ih:∀ (q q' : Fin 95) (L : ListBlank (Fin 2)), walkInternal q bits = some q' → nSteps bits.length { state := q, tape := Tape.mk' L (ListBlank.append bits R) } = some { state := q', tape := Tape.mk' (ListBlank.append bits.reverse L) R }q:Fin 95q':Fin 95L:ListBlank (Fin 2)hwalk:(match machine.transition q bit with | some (w, Dir.right, next) => if w = bit then walkInternal next bits else none | x => none) = some q'w:Fin 2next:Fin 95ht:machine.transition q bit = some (w, Dir.right, next)hw:w = bit⊢ nSteps (bit :: bits).length { state := q, tape := Tape.mk' L (ListBlank.append (bit :: bits) R) } = some { state := q', tape := Tape.mk' (ListBlank.append (bit :: bits).reverse L) R } R:ListBlank (Fin 2)bit:Fin 2bits:List (Fin 2)ih:∀ (q q' : Fin 95) (L : ListBlank (Fin 2)), walkInternal q bits = some q' → nSteps bits.length { state := q, tape := Tape.mk' L (ListBlank.append bits R) } = some { state := q', tape := Tape.mk' (ListBlank.append bits.reverse L) R }q:Fin 95q':Fin 95L:ListBlank (Fin 2)hwalk:(match machine.transition q bit with | some (w, Dir.right, next) => if w = bit then walkInternal next bits else none | x => none) = some q'next:Fin 95ht:machine.transition q bit = some (bit, Dir.right, next)⊢ nSteps (bit :: bits).length { state := q, tape := Tape.mk' L (ListBlank.append (bit :: bits) R) } = some { state := q', tape := Tape.mk' (ListBlank.append (bit :: bits).reverse L) R } R:ListBlank (Fin 2)bit:Fin 2bits:List (Fin 2)ih:∀ (q q' : Fin 95) (L : ListBlank (Fin 2)), walkInternal q bits = some q' → nSteps bits.length { state := q, tape := Tape.mk' L (ListBlank.append bits R) } = some { state := q', tape := Tape.mk' (ListBlank.append bits.reverse L) R }q:Fin 95q':Fin 95L:ListBlank (Fin 2)next:Fin 95ht:machine.transition q bit = some (bit, Dir.right, next)hwalk:walkInternal next bits = some q'⊢ nSteps (bit :: bits).length { state := q, tape := Tape.mk' L (ListBlank.append (bit :: bits) R) } = some { state := q', tape := Tape.mk' (ListBlank.append (bit :: bits).reverse L) R } R:ListBlank (Fin 2)bit:Fin 2bits:List (Fin 2)ih:∀ (q q' : Fin 95) (L : ListBlank (Fin 2)), walkInternal q bits = some q' → nSteps bits.length { state := q, tape := Tape.mk' L (ListBlank.append bits R) } = some { state := q', tape := Tape.mk' (ListBlank.append bits.reverse L) R }q:Fin 95q':Fin 95L:ListBlank (Fin 2)next:Fin 95ht:machine.transition q bit = some (bit, Dir.right, next)hwalk:walkInternal next bits = some q'hstep:step machine { state := q, tape := Tape.mk' L (ListBlank.cons bit (ListBlank.append bits R)) } = some { state := next, tape := Tape.mk' (ListBlank.cons bit L) (ListBlank.append bits R) }⊢ nSteps (bit :: bits).length { state := q, tape := Tape.mk' L (ListBlank.append (bit :: bits) R) } = some { state := q', tape := Tape.mk' (ListBlank.append (bit :: bits).reverse L) R } R:ListBlank (Fin 2)bit:Fin 2bits:List (Fin 2)ih:∀ (q q' : Fin 95) (L : ListBlank (Fin 2)), walkInternal q bits = some q' → nSteps bits.length { state := q, tape := Tape.mk' L (ListBlank.append bits R) } = some { state := q', tape := Tape.mk' (ListBlank.append bits.reverse L) R }q:Fin 95q':Fin 95L:ListBlank (Fin 2)next:Fin 95ht:machine.transition q bit = some (bit, Dir.right, next)hwalk:walkInternal next bits = some q'hstep:step machine { state := q, tape := Tape.mk' L (ListBlank.cons bit (ListBlank.append bits R)) } = some { state := next, tape := Tape.mk' (ListBlank.cons bit L) (ListBlank.append bits R) }⊢ nSteps bits.length { state := next, tape := Tape.mk' (ListBlank.cons bit L) (ListBlank.append bits R) } = some { state := q', tape := Tape.mk' (ListBlank.append (bit :: bits).reverse L) R } All goals completed! 🐙 R:ListBlank (Fin 2)bit:Fin 2bits:List (Fin 2)ih:∀ (q q' : Fin 95) (L : ListBlank (Fin 2)), walkInternal q bits = some q' → nSteps bits.length { state := q, tape := Tape.mk' L (ListBlank.append bits R) } = some { state := q', tape := Tape.mk' (ListBlank.append bits.reverse L) R }q:Fin 95q':Fin 95L:ListBlank (Fin 2)hwalk:(match machine.transition q bit with | some (w, Dir.right, next) => if w = bit then walkInternal next bits else none | x => none) = some q'w:Fin 2next:Fin 95ht:machine.transition q bit = some (w, Dir.right, next)hw:¬w = bit⊢ nSteps (bit :: bits).length { state := q, tape := Tape.mk' L (ListBlank.append (bit :: bits) R) } = some { state := q', tape := Tape.mk' (ListBlank.append (bit :: bits).reverse L) R } R:ListBlank (Fin 2)bit:Fin 2bits:List (Fin 2)ih:∀ (q q' : Fin 95) (L : ListBlank (Fin 2)), walkInternal q bits = some q' → nSteps bits.length { state := q, tape := Tape.mk' L (ListBlank.append bits R) } = some { state := q', tape := Tape.mk' (ListBlank.append bits.reverse L) R }q:Fin 95q':Fin 95L:ListBlank (Fin 2)w:Fin 2next:Fin 95ht:machine.transition q bit = some (w, Dir.right, next)hw:¬w = bithwalk:none = some q'⊢ nSteps (bit :: bits).length { state := q, tape := Tape.mk' L (ListBlank.append (bit :: bits) R) } = some { state := q', tape := Tape.mk' (ListBlank.append (bit :: bits).reverse L) R }; All goals completed! 🐙end ConjectureMachines.Riemann95.Parserend

Decoder correctness

sectionnamespace ConjectureMachines.Riemann95.Parseropen Turing ConjectureMachinesopen ConjectureMachines.Riemann95theorem repetitions_snoc (d : Nat) : repetitions (d + 1) = repetitions d ++ block := d:ℕ⊢ repetitions (d + 1) = repetitions d ++ block induction d with ⊢ repetitions (0 + 1) = repetitions 0 ++ block All goals completed! 🐙 d:ℕih:repetitions (d + 1) = repetitions d ++ block⊢ repetitions (d + 1 + 1) = repetitions (d + 1) ++ block d:ℕih:repetitions (d + 1) = repetitions d ++ block⊢ block ++ repetitions (d + 1) = block ++ repetitions d ++ block All goals completed! 🐙theorem callerPrefix_eq (d : Nat) : Schema.callerPrefix d = prefixBits ++ repetitions d := d:ℕ⊢ Schema.callerPrefix d = prefixBits ++ repetitions d induction d with ⊢ Schema.callerPrefix 0 = prefixBits ++ repetitions 0 All goals completed! 🐙 d:ℕih:Schema.callerPrefix d = prefixBits ++ repetitions d⊢ Schema.callerPrefix (d + 1) = prefixBits ++ repetitions (d + 1) d:ℕih:Schema.callerPrefix d = prefixBits ++ repetitions d⊢ prefixBits ++ repetitions d ++ [1, 1, 1, 1, 0] = prefixBits ++ repetitions d ++ block All goals completed! 🐙def localTerminal (s : Fin 22) : Fin 95 := (walkInternal 46 (Schema.localWalkSuffix s)).getD 0def outsideTerminal (s : Fin 97) : Fin 95 := (walkInternal 15 (Schema.outsideWalk s)).getD 0theorem localTerminal_walk : ∀ s : Fin 22, walkInternal 46 (Schema.localWalkSuffix s) = some (localTerminal s) := ⊢ ∀ (s : Fin 22), walkInternal 46 (Schema.localWalkSuffix s) = some (localTerminal s) All goals completed! 🐙theorem outsideTerminal_walk : ∀ s : Fin 97, walkInternal 15 (Schema.outsideWalk s) = some (outsideTerminal s) := ⊢ ∀ (s : Fin 97), walkInternal 15 (Schema.outsideWalk s) = some (outsideTerminal s) All goals completed! 🐙

Every local suffix follows the exact physical decoder at every recursion depth.

theorem localWalk_parse (d : Nat) (s : Fin 22) : walkInternal 15 (Schema.localWalk d s) = some (localTerminal s) := d:ℕs:Fin 22⊢ walkInternal 15 (Schema.localWalk d s) = some (localTerminal s) d:ℕs:Fin 22⊢ walkInternal 46 (Schema.localWalkSuffix s) = some (localTerminal s) All goals completed! 🐙

Entry inspects the mandatory zero after the regular prefix and reaches native DECj.

theorem entryWalk_parse (d : Nat) : walkInternal 15 (Schema.callerPrefix d ++ [0]) = some 58 := d:ℕ⊢ walkInternal 15 (Schema.callerPrefix d ++ [0]) = some 58 d:ℕ⊢ walkInternal 46 [0] = some 58 All goals completed! 🐙end ConjectureMachines.Riemann95.Parserend