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.ReductionSupport.Riemann95.RootNative95 public import Cryptids.ReductionSupport.Riemann95.Return95 public import Cryptids.ReductionSupport.Riemann95.ControlStep95 public import Cryptids.ReductionSupport.Riemann95.StrictExit95 public import Cryptids.ReductionSupport.Riemann95.PrecreditTrace95

Physical execution and width

@[expose] public section

Instruction traces

sectionnamespace ConjectureMachines.Riemann95.Traceopen Riemann120.Layer2 Schema Controlattribute [local irreducible] Control.instruction Control.effect Control.walked Control.localEffects Control.outsideEffects Control.outsideInstrs Control.localInstrprivate theorem list_getD_append_left {α : Type*} : ∀ (l₁ l₂ : List α) (d : α) (i : ℕ), i < l₁.length → (l₁ ++ l₂).getD i d = l₁.getD i d | [], _, _, _, hi => absurd hi (Nat.not_lt_zero _) | _ :: _, _, _, 0, _ => rfl | _ :: xs, l₂, d, n + 1, hi => list_getD_append_left xs l₂ d n (Nat.lt_of_succ_lt_succ hi)theorem physical_arithmetic_step (c : ControlWord) (regs extra : List Nat) (hlen : regs.length = 5) (P : Nat) (hP : (walked c).length + 3 ≤ P) (next : RhRegCfg) (hnext : applyInstr (rawInstr c) regs = some next) (r : Fin 5) (inc : Bool) (he : effect c = if inc then .inc r else .decnz r) : ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' next.stack (next.regs ++ extra')) ∧ (next.stack = [] → P + 1 ≤ P') := c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pnext:RhRegCfghnext:applyInstr (rawInstr c) regs = some nextr:Fin 5inc:Boolhe:effect c = if inc = true then Effect.inc r else Effect.decnz r⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' next.stack (next.regs ++ extra')) ∧ (next.stack = [] → P + 1 ≤ P') c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pnext:RhRegCfghnext:applyInstr (rawInstr c) regs = some nextr:Fin 5inc:Boolhe:effect c = if inc = true then Effect.inc r else Effect.decnz rhr:↑r < regs.length⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' next.stack (next.regs ++ extra')) ∧ (next.stack = [] → P + 1 ≤ P') c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pnext:RhRegCfghnext:applyInstr (rawInstr c) regs = some nextr:Fin 5inc:Boolhe:effect c = if inc = true then Effect.inc r else Effect.decnz rhr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).length⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' next.stack (next.regs ++ extra')) ∧ (next.stack = [] → P + 1 ≤ P') c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pnext:RhRegCfghnext:applyInstr (rawInstr c) regs = some nextr:Fin 5inc:Boolhe:effect c = if inc = true then Effect.inc r else Effect.decnz rhr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1hsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad (if inc = true then 0 else if (regs ++ extra).getD (↑r) 0 = 0 then 1 else 0) (walked c) (P - List.length (walked c))) (popBreakRev (↑(if inc = true then 0 else if (regs ++ extra).getD (↑r) 0 = 0 then 1 else 0)) (List.reverse (walked c))).reverse (if inc = true then (regs ++ extra).set (↑r) ((regs ++ extra).getD (↑r) 0 + 1) else if (regs ++ extra).getD (↑r) 0 = 0 then regs ++ extra else (regs ++ extra).set (↑r) ((regs ++ extra).getD (↑r) 0 - 1) ++ [0]))⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' next.stack (next.regs ++ extra')) ∧ (next.stack = [] → P + 1 ≤ P') c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pnext:RhRegCfghnext:applyInstr (rawInstr c) regs = some nextr:Fin 5inc:Boolhe:effect c = if inc = true then Effect.inc r else Effect.decnz rhr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1hsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad (if inc = true then 0 else if regs.getD (↑r) 0 = 0 then 1 else 0) (walked c) (P - List.length (walked c))) (popBreakRev (↑(if inc = true then 0 else if regs.getD (↑r) 0 = 0 then 1 else 0)) (List.reverse (walked c))).reverse (if inc = true then (regs ++ extra).set (↑r) (regs.getD (↑r) 0 + 1) else if regs.getD (↑r) 0 = 0 then regs ++ extra else (regs ++ extra).set (↑r) (regs.getD (↑r) 0 - 1) ++ [0]))⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' next.stack (next.regs ++ extra')) ∧ (next.stack = [] → P + 1 ≤ P') c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pnext:RhRegCfghnext:applyInstr (rawInstr c) regs = some nextr:Fin 5inc:Boolhe:effect c = if inc = true then Effect.inc r else Effect.decnz rhr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1hsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad (if inc = true then 0 else if regs.getD (↑r) 0 = 0 then 1 else 0) (walked c) (P - List.length (walked c))) (popBreakRev (↑(if inc = true then 0 else if regs.getD (↑r) 0 = 0 then 1 else 0)) (List.reverse (walked c))).reverse (if inc = true then (regs ++ extra).set (↑r) (regs.getD (↑r) 0 + 1) else if regs.getD (↑r) 0 = 0 then regs ++ extra else (regs ++ extra).set (↑r) (regs.getD (↑r) 0 - 1) ++ [0]))strict:∀ (k : Fin 2), ↑k ≤ List.count 0 (walked c) → (popBreakRev (↑k) (List.reverse (walked c))).reverse = [] → P + 1 ≤ Physical.exactPad k (walked c) (P - List.length (walked c))⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' next.stack (next.regs ++ extra')) ∧ (next.stack = [] → P + 1 ≤ P') cases inc with c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pnext:RhRegCfghnext:applyInstr (rawInstr c) regs = some nextr:Fin 5hr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1strict:∀ (k : Fin 2), ↑k ≤ List.count 0 (walked c) → (popBreakRev (↑k) (List.reverse (walked c))).reverse = [] → P + 1 ≤ Physical.exactPad k (walked c) (P - List.length (walked c))he:effect c = if true = true then Effect.inc r else Effect.decnz rhsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad (if true = true then 0 else if regs.getD (↑r) 0 = 0 then 1 else 0) (walked c) (P - List.length (walked c))) (popBreakRev (↑(if true = true then 0 else if regs.getD (↑r) 0 = 0 then 1 else 0)) (List.reverse (walked c))).reverse (if true = true then (regs ++ extra).set (↑r) (regs.getD (↑r) 0 + 1) else if regs.getD (↑r) 0 = 0 then regs ++ extra else (regs ++ extra).set (↑r) (regs.getD (↑r) 0 - 1) ++ [0]))⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' next.stack (next.regs ++ extra')) ∧ (next.stack = [] → P + 1 ≤ P') c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pnext:RhRegCfghnext:applyInstr (rawInstr c) regs = some nextr:Fin 5hr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1strict:∀ (k : Fin 2), ↑k ≤ List.count 0 (walked c) → (popBreakRev (↑k) (List.reverse (walked c))).reverse = [] → P + 1 ≤ Physical.exactPad k (walked c) (P - List.length (walked c))he:effect c = Effect.inc rhsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad 0 (walked c) (P - List.length (walked c))) (popBreakRev (↑0) (List.reverse (walked c))).reverse ((regs ++ extra).set (↑r) (regs.getD (↑r) 0 + 1)))⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' next.stack (next.regs ++ extra')) ∧ (next.stack = [] → P + 1 ≤ P') c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pnext:RhRegCfgr:Fin 5hr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1strict:∀ (k : Fin 2), ↑k ≤ List.count 0 (walked c) → (popBreakRev (↑k) (List.reverse (walked c))).reverse = [] → P + 1 ≤ Physical.exactPad k (walked c) (P - List.length (walked c))he:effect c = Effect.inc rhsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad 0 (walked c) (P - List.length (walked c))) (popBreakRev (↑0) (List.reverse (walked c))).reverse ((regs ++ extra).set (↑r) (regs.getD (↑r) 0 + 1)))hnext:{ stack := (popBreakRev 0 (List.reverse (walked c))).reverse, regs := regs.set (↑r) (regs.getD (↑r) 0 + 1) } = next⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' next.stack (next.regs ++ extra')) ∧ (next.stack = [] → P + 1 ≤ P') c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pr:Fin 5hr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1strict:∀ (k : Fin 2), ↑k ≤ List.count 0 (walked c) → (popBreakRev (↑k) (List.reverse (walked c))).reverse = [] → P + 1 ≤ Physical.exactPad k (walked c) (P - List.length (walked c))he:effect c = Effect.inc rhsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad 0 (walked c) (P - List.length (walked c))) (popBreakRev (↑0) (List.reverse (walked c))).reverse ((regs ++ extra).set (↑r) (regs.getD (↑r) 0 + 1)))⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' { stack := (popBreakRev 0 (List.reverse (walked c))).reverse, regs := regs.set (↑r) (regs.getD (↑r) 0 + 1) }.stack ({ stack := (popBreakRev 0 (List.reverse (walked c))).reverse, regs := regs.set (↑r) (regs.getD (↑r) 0 + 1) }.regs ++ extra')) ∧ ({ stack := (popBreakRev 0 (List.reverse (walked c))).reverse, regs := regs.set (↑r) (regs.getD (↑r) 0 + 1) }.stack = [] → P + 1 ≤ P') c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pr:Fin 5hr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1strict:∀ (k : Fin 2), ↑k ≤ List.count 0 (walked c) → (popBreakRev (↑k) (List.reverse (walked c))).reverse = [] → P + 1 ≤ Physical.exactPad k (walked c) (P - List.length (walked c))he:effect c = Effect.inc rhsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad 0 (walked c) (P - List.length (walked c))) (popBreakRev (↑0) (List.reverse (walked c))).reverse ((regs ++ extra).set (↑r) (regs.getD (↑r) 0 + 1)))hge:List.length (walked c) + (P - List.length (walked c)) ≤ Physical.exactPad 0 (walked c) (P - List.length (walked c))⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' { stack := (popBreakRev 0 (List.reverse (walked c))).reverse, regs := regs.set (↑r) (regs.getD (↑r) 0 + 1) }.stack ({ stack := (popBreakRev 0 (List.reverse (walked c))).reverse, regs := regs.set (↑r) (regs.getD (↑r) 0 + 1) }.regs ++ extra')) ∧ ({ stack := (popBreakRev 0 (List.reverse (walked c))).reverse, regs := regs.set (↑r) (regs.getD (↑r) 0 + 1) }.stack = [] → P + 1 ≤ P') refine ⟨_,c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pr:Fin 5hr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1strict:∀ (k : Fin 2), ↑k ≤ List.count 0 (walked c) → (popBreakRev (↑k) (List.reverse (walked c))).reverse = [] → P + 1 ≤ Physical.exactPad k (walked c) (P - List.length (walked c))he:effect c = Effect.inc rhsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad 0 (walked c) (P - List.length (walked c))) (popBreakRev (↑0) (List.reverse (walked c))).reverse ((regs ++ extra).set (↑r) (regs.getD (↑r) 0 + 1)))hge:List.length (walked c) + (P - List.length (walked c)) ≤ Physical.exactPad 0 (walked c) (P - List.length (walked c))⊢ Physical.exactPad 0 (walked c) (P - List.length (walked c)) ≥ P All goals completed! 🐙,n,hn,extra,?_,strict 0 (c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pr:Fin 5hr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1strict:∀ (k : Fin 2), ↑k ≤ List.count 0 (walked c) → (popBreakRev (↑k) (List.reverse (walked c))).reverse = [] → P + 1 ≤ Physical.exactPad k (walked c) (P - List.length (walked c))he:effect c = Effect.inc rhsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad 0 (walked c) (P - List.length (walked c))) (popBreakRev (↑0) (List.reverse (walked c))).reverse ((regs ++ extra).set (↑r) (regs.getD (↑r) 0 + 1)))hge:List.length (walked c) + (P - List.length (walked c)) ≤ Physical.exactPad 0 (walked c) (P - List.length (walked c))⊢ ↑0 ≤ List.count 0 (walked c) All goals completed! 🐙)⟩ All goals completed! 🐙 c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pnext:RhRegCfghnext:applyInstr (rawInstr c) regs = some nextr:Fin 5hr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1strict:∀ (k : Fin 2), ↑k ≤ List.count 0 (walked c) → (popBreakRev (↑k) (List.reverse (walked c))).reverse = [] → P + 1 ≤ Physical.exactPad k (walked c) (P - List.length (walked c))he:effect c = if false = true then Effect.inc r else Effect.decnz rhsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad (if false = true then 0 else if regs.getD (↑r) 0 = 0 then 1 else 0) (walked c) (P - List.length (walked c))) (popBreakRev (↑(if false = true then 0 else if regs.getD (↑r) 0 = 0 then 1 else 0)) (List.reverse (walked c))).reverse (if false = true then (regs ++ extra).set (↑r) (regs.getD (↑r) 0 + 1) else if regs.getD (↑r) 0 = 0 then regs ++ extra else (regs ++ extra).set (↑r) (regs.getD (↑r) 0 - 1) ++ [0]))⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' next.stack (next.regs ++ extra')) ∧ (next.stack = [] → P + 1 ≤ P') c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pnext:RhRegCfghnext:applyInstr (rawInstr c) regs = some nextr:Fin 5hr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1strict:∀ (k : Fin 2), ↑k ≤ List.count 0 (walked c) → (popBreakRev (↑k) (List.reverse (walked c))).reverse = [] → P + 1 ≤ Physical.exactPad k (walked c) (P - List.length (walked c))he:effect c = Effect.decnz rhsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad (if regs.getD (↑r) 0 = 0 then 1 else 0) (walked c) (P - List.length (walked c))) (popBreakRev (↑(if regs.getD (↑r) 0 = 0 then 1 else 0)) (List.reverse (walked c))).reverse (if regs.getD (↑r) 0 = 0 then regs ++ extra else (regs ++ extra).set (↑r) (regs.getD (↑r) 0 - 1) ++ [0]))⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' next.stack (next.regs ++ extra')) ∧ (next.stack = [] → P + 1 ≤ P') c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pnext:RhRegCfgr:Fin 5hr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1strict:∀ (k : Fin 2), ↑k ≤ List.count 0 (walked c) → (popBreakRev (↑k) (List.reverse (walked c))).reverse = [] → P + 1 ≤ Physical.exactPad k (walked c) (P - List.length (walked c))he:effect c = Effect.decnz rhsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad (if regs.getD (↑r) 0 = 0 then 1 else 0) (walked c) (P - List.length (walked c))) (popBreakRev (↑(if regs.getD (↑r) 0 = 0 then 1 else 0)) (List.reverse (walked c))).reverse (if regs.getD (↑r) 0 = 0 then regs ++ extra else (regs ++ extra).set (↑r) (regs.getD (↑r) 0 - 1) ++ [0]))hnext:(if regs.getD (↑r) 0 = 0 then some { stack := (popBreakRev 1 (List.reverse (walked c))).reverse, regs := regs } else some { stack := (popBreakRev 0 (List.reverse (walked c))).reverse, regs := regs.set (↑r) (regs.getD (↑r) 0 - 1) }) = some next⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' next.stack (next.regs ++ extra')) ∧ (next.stack = [] → P + 1 ≤ P') c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pnext:RhRegCfgr:Fin 5hr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1strict:∀ (k : Fin 2), ↑k ≤ List.count 0 (walked c) → (popBreakRev (↑k) (List.reverse (walked c))).reverse = [] → P + 1 ≤ Physical.exactPad k (walked c) (P - List.length (walked c))he:effect c = Effect.decnz rhsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad (if regs.getD (↑r) 0 = 0 then 1 else 0) (walked c) (P - List.length (walked c))) (popBreakRev (↑(if regs.getD (↑r) 0 = 0 then 1 else 0)) (List.reverse (walked c))).reverse (if regs.getD (↑r) 0 = 0 then regs ++ extra else (regs ++ extra).set (↑r) (regs.getD (↑r) 0 - 1) ++ [0]))hnext:(if regs.getD (↑r) 0 = 0 then some { stack := (popBreakRev 1 (List.reverse (walked c))).reverse, regs := regs } else some { stack := (popBreakRev 0 (List.reverse (walked c))).reverse, regs := regs.set (↑r) (regs.getD (↑r) 0 - 1) }) = some nexthz:regs.getD (↑r) 0 = 0⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' next.stack (next.regs ++ extra')) ∧ (next.stack = [] → P + 1 ≤ P')c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pnext:RhRegCfgr:Fin 5hr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1strict:∀ (k : Fin 2), ↑k ≤ List.count 0 (walked c) → (popBreakRev (↑k) (List.reverse (walked c))).reverse = [] → P + 1 ≤ Physical.exactPad k (walked c) (P - List.length (walked c))he:effect c = Effect.decnz rhsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad (if regs.getD (↑r) 0 = 0 then 1 else 0) (walked c) (P - List.length (walked c))) (popBreakRev (↑(if regs.getD (↑r) 0 = 0 then 1 else 0)) (List.reverse (walked c))).reverse (if regs.getD (↑r) 0 = 0 then regs ++ extra else (regs ++ extra).set (↑r) (regs.getD (↑r) 0 - 1) ++ [0]))hnext:(if regs.getD (↑r) 0 = 0 then some { stack := (popBreakRev 1 (List.reverse (walked c))).reverse, regs := regs } else some { stack := (popBreakRev 0 (List.reverse (walked c))).reverse, regs := regs.set (↑r) (regs.getD (↑r) 0 - 1) }) = some nexthz:¬regs.getD (↑r) 0 = 0⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' next.stack (next.regs ++ extra')) ∧ (next.stack = [] → P + 1 ≤ P') c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pnext:RhRegCfgr:Fin 5hr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1strict:∀ (k : Fin 2), ↑k ≤ List.count 0 (walked c) → (popBreakRev (↑k) (List.reverse (walked c))).reverse = [] → P + 1 ≤ Physical.exactPad k (walked c) (P - List.length (walked c))he:effect c = Effect.decnz rhsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad (if regs.getD (↑r) 0 = 0 then 1 else 0) (walked c) (P - List.length (walked c))) (popBreakRev (↑(if regs.getD (↑r) 0 = 0 then 1 else 0)) (List.reverse (walked c))).reverse (if regs.getD (↑r) 0 = 0 then regs ++ extra else (regs ++ extra).set (↑r) (regs.getD (↑r) 0 - 1) ++ [0]))hnext:(if regs.getD (↑r) 0 = 0 then some { stack := (popBreakRev 1 (List.reverse (walked c))).reverse, regs := regs } else some { stack := (popBreakRev 0 (List.reverse (walked c))).reverse, regs := regs.set (↑r) (regs.getD (↑r) 0 - 1) }) = some nexthz:regs.getD (↑r) 0 = 0⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' next.stack (next.regs ++ extra')) ∧ (next.stack = [] → P + 1 ≤ P') c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pnext:RhRegCfgr:Fin 5hr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1strict:∀ (k : Fin 2), ↑k ≤ List.count 0 (walked c) → (popBreakRev (↑k) (List.reverse (walked c))).reverse = [] → P + 1 ≤ Physical.exactPad k (walked c) (P - List.length (walked c))he:effect c = Effect.decnz rhz:regs.getD (↑r) 0 = 0hnext:{ stack := (popBreakRev 1 (List.reverse (walked c))).reverse, regs := regs } = nexthsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad 1 (walked c) (P - List.length (walked c))) (popBreakRev (↑1) (List.reverse (walked c))).reverse (regs ++ extra))⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' next.stack (next.regs ++ extra')) ∧ (next.stack = [] → P + 1 ≤ P') c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pr:Fin 5hr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1strict:∀ (k : Fin 2), ↑k ≤ List.count 0 (walked c) → (popBreakRev (↑k) (List.reverse (walked c))).reverse = [] → P + 1 ≤ Physical.exactPad k (walked c) (P - List.length (walked c))he:effect c = Effect.decnz rhz:regs.getD (↑r) 0 = 0hsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad 1 (walked c) (P - List.length (walked c))) (popBreakRev (↑1) (List.reverse (walked c))).reverse (regs ++ extra))⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' { stack := (popBreakRev 1 (List.reverse (walked c))).reverse, regs := regs }.stack ({ stack := (popBreakRev 1 (List.reverse (walked c))).reverse, regs := regs }.regs ++ extra')) ∧ ({ stack := (popBreakRev 1 (List.reverse (walked c))).reverse, regs := regs }.stack = [] → P + 1 ≤ P') c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pr:Fin 5hr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1strict:∀ (k : Fin 2), ↑k ≤ List.count 0 (walked c) → (popBreakRev (↑k) (List.reverse (walked c))).reverse = [] → P + 1 ≤ Physical.exactPad k (walked c) (P - List.length (walked c))he:effect c = Effect.decnz rhz:regs.getD (↑r) 0 = 0hsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad 1 (walked c) (P - List.length (walked c))) (popBreakRev (↑1) (List.reverse (walked c))).reverse (regs ++ extra))hge:List.length (walked c) + (P - List.length (walked c)) ≤ Physical.exactPad 1 (walked c) (P - List.length (walked c))⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' { stack := (popBreakRev 1 (List.reverse (walked c))).reverse, regs := regs }.stack ({ stack := (popBreakRev 1 (List.reverse (walked c))).reverse, regs := regs }.regs ++ extra')) ∧ ({ stack := (popBreakRev 1 (List.reverse (walked c))).reverse, regs := regs }.stack = [] → P + 1 ≤ P') refine ⟨_,c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pr:Fin 5hr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1strict:∀ (k : Fin 2), ↑k ≤ List.count 0 (walked c) → (popBreakRev (↑k) (List.reverse (walked c))).reverse = [] → P + 1 ≤ Physical.exactPad k (walked c) (P - List.length (walked c))he:effect c = Effect.decnz rhz:regs.getD (↑r) 0 = 0hsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad 1 (walked c) (P - List.length (walked c))) (popBreakRev (↑1) (List.reverse (walked c))).reverse (regs ++ extra))hge:List.length (walked c) + (P - List.length (walked c)) ≤ Physical.exactPad 1 (walked c) (P - List.length (walked c))⊢ Physical.exactPad 1 (walked c) (P - List.length (walked c)) ≥ P All goals completed! 🐙,n,hn,extra,hsteps,strict 1 ?_⟩ All goals completed! 🐙 c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pnext:RhRegCfgr:Fin 5hr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1strict:∀ (k : Fin 2), ↑k ≤ List.count 0 (walked c) → (popBreakRev (↑k) (List.reverse (walked c))).reverse = [] → P + 1 ≤ Physical.exactPad k (walked c) (P - List.length (walked c))he:effect c = Effect.decnz rhsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad (if regs.getD (↑r) 0 = 0 then 1 else 0) (walked c) (P - List.length (walked c))) (popBreakRev (↑(if regs.getD (↑r) 0 = 0 then 1 else 0)) (List.reverse (walked c))).reverse (if regs.getD (↑r) 0 = 0 then regs ++ extra else (regs ++ extra).set (↑r) (regs.getD (↑r) 0 - 1) ++ [0]))hnext:(if regs.getD (↑r) 0 = 0 then some { stack := (popBreakRev 1 (List.reverse (walked c))).reverse, regs := regs } else some { stack := (popBreakRev 0 (List.reverse (walked c))).reverse, regs := regs.set (↑r) (regs.getD (↑r) 0 - 1) }) = some nexthz:¬regs.getD (↑r) 0 = 0⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' next.stack (next.regs ++ extra')) ∧ (next.stack = [] → P + 1 ≤ P') c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pnext:RhRegCfgr:Fin 5hr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1strict:∀ (k : Fin 2), ↑k ≤ List.count 0 (walked c) → (popBreakRev (↑k) (List.reverse (walked c))).reverse = [] → P + 1 ≤ Physical.exactPad k (walked c) (P - List.length (walked c))he:effect c = Effect.decnz rhz:¬regs.getD (↑r) 0 = 0hnext:{ stack := (popBreakRev 0 (List.reverse (walked c))).reverse, regs := regs.set (↑r) (regs.getD (↑r) 0 - 1) } = nexthsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad 0 (walked c) (P - List.length (walked c))) (popBreakRev (↑0) (List.reverse (walked c))).reverse ((regs ++ extra).set (↑r) (regs.getD (↑r) 0 - 1) ++ [0]))⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' next.stack (next.regs ++ extra')) ∧ (next.stack = [] → P + 1 ≤ P') c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pr:Fin 5hr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1strict:∀ (k : Fin 2), ↑k ≤ List.count 0 (walked c) → (popBreakRev (↑k) (List.reverse (walked c))).reverse = [] → P + 1 ≤ Physical.exactPad k (walked c) (P - List.length (walked c))he:effect c = Effect.decnz rhz:¬regs.getD (↑r) 0 = 0hsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad 0 (walked c) (P - List.length (walked c))) (popBreakRev (↑0) (List.reverse (walked c))).reverse ((regs ++ extra).set (↑r) (regs.getD (↑r) 0 - 1) ++ [0]))⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' { stack := (popBreakRev 0 (List.reverse (walked c))).reverse, regs := regs.set (↑r) (regs.getD (↑r) 0 - 1) }.stack ({ stack := (popBreakRev 0 (List.reverse (walked c))).reverse, regs := regs.set (↑r) (regs.getD (↑r) 0 - 1) }.regs ++ extra')) ∧ ({ stack := (popBreakRev 0 (List.reverse (walked c))).reverse, regs := regs.set (↑r) (regs.getD (↑r) 0 - 1) }.stack = [] → P + 1 ≤ P') c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pr:Fin 5hr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1strict:∀ (k : Fin 2), ↑k ≤ List.count 0 (walked c) → (popBreakRev (↑k) (List.reverse (walked c))).reverse = [] → P + 1 ≤ Physical.exactPad k (walked c) (P - List.length (walked c))he:effect c = Effect.decnz rhz:¬regs.getD (↑r) 0 = 0hsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad 0 (walked c) (P - List.length (walked c))) (popBreakRev (↑0) (List.reverse (walked c))).reverse ((regs ++ extra).set (↑r) (regs.getD (↑r) 0 - 1) ++ [0]))hge:List.length (walked c) + (P - List.length (walked c)) ≤ Physical.exactPad 0 (walked c) (P - List.length (walked c))⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg P' { stack := (popBreakRev 0 (List.reverse (walked c))).reverse, regs := regs.set (↑r) (regs.getD (↑r) 0 - 1) }.stack ({ stack := (popBreakRev 0 (List.reverse (walked c))).reverse, regs := regs.set (↑r) (regs.getD (↑r) 0 - 1) }.regs ++ extra')) ∧ ({ stack := (popBreakRev 0 (List.reverse (walked c))).reverse, regs := regs.set (↑r) (regs.getD (↑r) 0 - 1) }.stack = [] → P + 1 ≤ P') refine ⟨_,c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pr:Fin 5hr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1strict:∀ (k : Fin 2), ↑k ≤ List.count 0 (walked c) → (popBreakRev (↑k) (List.reverse (walked c))).reverse = [] → P + 1 ≤ Physical.exactPad k (walked c) (P - List.length (walked c))he:effect c = Effect.decnz rhz:¬regs.getD (↑r) 0 = 0hsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad 0 (walked c) (P - List.length (walked c))) (popBreakRev (↑0) (List.reverse (walked c))).reverse ((regs ++ extra).set (↑r) (regs.getD (↑r) 0 - 1) ++ [0]))hge:List.length (walked c) + (P - List.length (walked c)) ≤ Physical.exactPad 0 (walked c) (P - List.length (walked c))⊢ Physical.exactPad 0 (walked c) (P - List.length (walked c)) ≥ P All goals completed! 🐙,n,hn,extra ++ [0],?_,strict 0 (c:ControlWordregs:List ℕextra:List ℕhlen:regs.length = 5P:ℕhP:List.length (walked c) + 3 ≤ Pr:Fin 5hr:↑r < regs.lengthhrbank:↑r < (regs ++ extra).lengthn:ℕhn:n ≥ 1strict:∀ (k : Fin 2), ↑k ≤ List.count 0 (walked c) → (popBreakRev (↑k) (List.reverse (walked c))).reverse = [] → P + 1 ≤ Physical.exactPad k (walked c) (P - List.length (walked c))he:effect c = Effect.decnz rhz:¬regs.getD (↑r) 0 = 0hsteps:nSteps n (Physical.rootCfg P (word c) (regs ++ extra)) = some (Physical.rootCfg (Physical.exactPad 0 (walked c) (P - List.length (walked c))) (popBreakRev (↑0) (List.reverse (walked c))).reverse ((regs ++ extra).set (↑r) (regs.getD (↑r) 0 - 1) ++ [0]))hge:List.length (walked c) + (P - List.length (walked c)) ≤ Physical.exactPad 0 (walked c) (P - List.length (walked c))⊢ ↑0 ≤ List.count 0 (walked c) All goals completed! 🐙)⟩ All goals completed! 🐙theorem physical_step (a b : Control.Cfg) (hlen : a.regs.length = 5) (P : Nat) (hP : (walked a.control).length + 3 ≤ P) (hs : Control.step a = some b) (extra : List Nat) : ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) := a:Control.Cfgb:Control.Cfghlen:a.regs.length = 5P:ℕhP:List.length (walked a.control) + 3 ≤ Phs:Control.step a = some bextra:List ℕ⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) a:Control.Cfgb:Control.Cfghlen:a.regs.length = 5P:ℕhP:List.length (walked a.control) + 3 ≤ Phs:Control.step a = some bextra:List ℕhnext:applyInstr (rawInstr a.control) a.regs = some { stack := word b.control, regs := b.regs }⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) cases he : effect a.control with a:Control.Cfgb:Control.Cfghlen:a.regs.length = 5P:ℕhP:List.length (walked a.control) + 3 ≤ Phs:Control.step a = some bextra:List ℕhnext:applyInstr (rawInstr a.control) a.regs = some { stack := word b.control, regs := b.regs }he:effect a.control = Effect.halt⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) a:Control.Cfgb:Control.Cfghlen:a.regs.length = 5P:ℕhP:List.length (walked a.control) + 3 ≤ Phs:Control.step a = some bextra:List ℕhe:effect a.control = Effect.halthnext:none = some { stack := word b.control, regs := b.regs }⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')); All goals completed! 🐙 a:Control.Cfgb:Control.Cfghlen:a.regs.length = 5P:ℕhP:List.length (walked a.control) + 3 ≤ Phs:Control.step a = some bextra:List ℕhnext:applyInstr (rawInstr a.control) a.regs = some { stack := word b.control, regs := b.regs }r:Fin 5he:effect a.control = Effect.inc r⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) a:Control.Cfgb:Control.Cfghlen:a.regs.length = 5P:ℕhP:List.length (walked a.control) + 3 ≤ Phs:Control.step a = some bextra:List ℕhnext:applyInstr (rawInstr a.control) a.regs = some { stack := word b.control, regs := b.regs }r:Fin 5he:effect a.control = Effect.inc rP':ℕhge:P' ≥ Pn:ℕhn:n ≥ 1tail:List ℕht:nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' { stack := word b.control, regs := b.regs }.stack ({ stack := word b.control, regs := b.regs }.regs ++ tail))right✝:{ stack := word b.control, regs := b.regs }.stack = [] → P + 1 ≤ P'⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) All goals completed! 🐙 a:Control.Cfgb:Control.Cfghlen:a.regs.length = 5P:ℕhP:List.length (walked a.control) + 3 ≤ Phs:Control.step a = some bextra:List ℕhnext:applyInstr (rawInstr a.control) a.regs = some { stack := word b.control, regs := b.regs }r:Fin 5he:effect a.control = Effect.decnz r⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) a:Control.Cfgb:Control.Cfghlen:a.regs.length = 5P:ℕhP:List.length (walked a.control) + 3 ≤ Phs:Control.step a = some bextra:List ℕhnext:applyInstr (rawInstr a.control) a.regs = some { stack := word b.control, regs := b.regs }r:Fin 5he:effect a.control = Effect.decnz rP':ℕhge:P' ≥ Pn:ℕhn:n ≥ 1tail:List ℕht:nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' { stack := word b.control, regs := b.regs }.stack ({ stack := word b.control, regs := b.regs }.regs ++ tail))right✝:{ stack := word b.control, regs := b.regs }.stack = [] → P + 1 ≤ P'⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) All goals completed! 🐙 a:Control.Cfgb:Control.Cfghlen:a.regs.length = 5P:ℕhP:List.length (walked a.control) + 3 ≤ Phs:Control.step a = some bextra:List ℕhnext:applyInstr (rawInstr a.control) a.regs = some { stack := word b.control, regs := b.regs }cont:Boolk:ℕhe:effect a.control = Effect.jump cont k⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) a:Control.Cfgb:Control.Cfghlen:a.regs.length = 5P:ℕhP:List.length (walked a.control) + 3 ≤ Phs:Control.step a = some bextra:List ℕhnext:applyInstr (rawInstr a.control) a.regs = some { stack := word b.control, regs := b.regs }cont:Boolk:ℕhe:effect a.control = Effect.jump cont khj:rawInstr a.control = RhInstr.jump (returned cont k (walked a.control))⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) a:Control.Cfgb:Control.Cfghlen:a.regs.length = 5P:ℕhP:List.length (walked a.control) + 3 ≤ Phs:Control.step a = some bextra:List ℕcont:Boolk:ℕhnext:applyInstr (RhInstr.jump (returned cont k (walked a.control))) a.regs = some { stack := word b.control, regs := b.regs }he:effect a.control = Effect.jump cont khj:rawInstr a.control = RhInstr.jump (returned cont k (walked a.control))⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) a:Control.Cfgb:Control.Cfghlen:a.regs.length = 5P:ℕhP:List.length (walked a.control) + 3 ≤ Phs:Control.step a = some bextra:List ℕcont:Boolk:ℕhe:effect a.control = Effect.jump cont khj:rawInstr a.control = RhInstr.jump (returned cont k (walked a.control))hnext:{ stack := returned cont k (walked a.control), regs := a.regs } = { stack := word b.control, regs := b.regs }⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) a:Control.Cfgb:Control.Cfghlen:a.regs.length = 5P:ℕhP:List.length (walked a.control) + 3 ≤ Phs:Control.step a = some bextra:List ℕcont:Boolk:ℕhe:effect a.control = Effect.jump cont khj:rawInstr a.control = RhInstr.jump (returned cont k (walked a.control))hnext:{ stack := returned cont k (walked a.control), regs := a.regs } = { stack := word b.control, regs := b.regs }n:ℕhn:n ≥ 1ht:nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P (returned cont k (walked a.control)) (a.regs ++ extra))⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) a:Control.Cfgb:Control.Cfghlen:a.regs.length = 5P:ℕhP:List.length (walked a.control) + 3 ≤ Phs:Control.step a = some bextra:List ℕcont:Boolk:ℕhe:effect a.control = Effect.jump cont khj:rawInstr a.control = RhInstr.jump (returned cont k (walked a.control))hnext:{ stack := returned cont k (walked a.control), regs := a.regs } = { stack := word b.control, regs := b.regs }n:ℕhn:n ≥ 1ht:nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P (returned cont k (walked a.control)) (a.regs ++ extra))hw:returned cont k (walked a.control) = word b.control⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) a:Control.Cfgb:Control.Cfghlen:a.regs.length = 5P:ℕhP:List.length (walked a.control) + 3 ≤ Phs:Control.step a = some bextra:List ℕcont:Boolk:ℕhe:effect a.control = Effect.jump cont khj:rawInstr a.control = RhInstr.jump (returned cont k (walked a.control))hnext:{ stack := returned cont k (walked a.control), regs := a.regs } = { stack := word b.control, regs := b.regs }n:ℕhn:n ≥ 1ht:nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P (returned cont k (walked a.control)) (a.regs ++ extra))hw:returned cont k (walked a.control) = word b.controlhr:a.regs = b.regs⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) a:Control.Cfgb:Control.Cfghlen:a.regs.length = 5P:ℕhP:List.length (walked a.control) + 3 ≤ Phs:Control.step a = some bextra:List ℕcont:Boolk:ℕhe:effect a.control = Effect.jump cont khj:rawInstr a.control = RhInstr.jump (returned cont k (walked a.control))hnext:{ stack := returned cont k (walked a.control), regs := a.regs } = { stack := word b.control, regs := b.regs }n:ℕhn:n ≥ 1ht:nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P (returned cont k (walked a.control)) (a.regs ++ extra))hw:returned cont k (walked a.control) = word b.controlhr:a.regs = b.regs⊢ nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P (word b.control) (b.regs ++ extra)) a:Control.Cfgb:Control.Cfghlen:a.regs.length = 5P:ℕhP:List.length (walked a.control) + 3 ≤ Phs:Control.step a = some bextra:List ℕcont:Boolk:ℕhe:effect a.control = Effect.jump cont khj:rawInstr a.control = RhInstr.jump (returned cont k (walked a.control))hnext:{ stack := returned cont k (walked a.control), regs := a.regs } = { stack := word b.control, regs := b.regs }n:ℕhn:n ≥ 1ht:nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P (returned cont k (walked a.control)) (a.regs ++ extra))hw:returned cont k (walked a.control) = word b.controlhr:a.regs = b.regs⊢ nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P (returned cont k (walked a.control)) (a.regs ++ extra)) All goals completed! 🐙end ConjectureMachines.Riemann95.Traceend

Lifting traces

sectionnamespace ConjectureMachines.Riemann95.Traceopen Riemann120.Layer2 Schema Controltheorem bounded_trace_regs_length {B : Nat} {a b : Control.Cfg} (ht : Relation.TransGen (BoundedEdge B) a b) (hlen : a.regs.length = 5) : b.regs.length = 5 := B:ℕa:Control.Cfgb:Control.Cfght:Relation.TransGen (BoundedEdge B) a bhlen:a.regs.length = 5⊢ b.regs.length = 5 induction ht with B:ℕa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5b✝:Control.Cfghe:BoundedEdge B a b✝⊢ b✝.regs.length = 5 All goals completed! 🐙 B:ℕa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5b✝:Control.Cfgc✝:Control.Cfght:Relation.TransGen (BoundedEdge B) a b✝he:BoundedEdge B b✝ c✝ih:b✝.regs.length = 5⊢ c✝.regs.length = 5 All goals completed! 🐙theorem bounded_rtrace_regs_length {B : Nat} {a b : Control.Cfg} (ht : Relation.ReflTransGen (BoundedEdge B) a b) (hlen : a.regs.length = 5) : b.regs.length = 5 := B:ℕa:Control.Cfgb:Control.Cfght:Relation.ReflTransGen (BoundedEdge B) a bhlen:a.regs.length = 5⊢ b.regs.length = 5 induction ht with B:ℕa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5⊢ a.regs.length = 5 All goals completed! 🐙 B:ℕa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5b✝:Control.Cfgc✝:Control.Cfght:Relation.ReflTransGen (BoundedEdge B) a b✝he:BoundedEdge B b✝ c✝ih:b✝.regs.length = 5⊢ c✝.regs.length = 5 All goals completed! 🐙theorem bounded_trace_lift (B P : Nat) (hP : B ≤ P) (a b : Control.Cfg) (hlen : a.regs.length = 5) (ht : Relation.TransGen (BoundedEdge B) a b) (extra : List Nat) : ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) := B:ℕP:ℕhP:B ≤ Pa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5ht:Relation.TransGen (BoundedEdge B) a bextra:List ℕ⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) induction ht generalizing P extra with B:ℕa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5b✝:Control.Cfghe:BoundedEdge B a b✝P:ℕhP:B ≤ Pextra:List ℕ⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b✝.control) (b✝.regs ++ extra')) All goals completed! 🐙 B:ℕa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5c:Control.Cfgd:Control.Cfght:Relation.TransGen (BoundedEdge B) a che:BoundedEdge B c dih:∀ (P : ℕ), B ≤ P → ∀ (extra : List ℕ), ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word c.control) (c.regs ++ extra'))P:ℕhP:B ≤ Pextra:List ℕ⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word d.control) (d.regs ++ extra')) B:ℕa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5c:Control.Cfgd:Control.Cfght:Relation.TransGen (BoundedEdge B) a che:BoundedEdge B c dih:∀ (P : ℕ), B ≤ P → ∀ (extra : List ℕ), ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word c.control) (c.regs ++ extra'))P:ℕhP:B ≤ Pextra:List ℕQ:ℕhQ:Q ≥ Pn:ℕhn:n ≥ 1tail:List ℕhrun:nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg Q (word c.control) (c.regs ++ tail))⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word d.control) (d.regs ++ extra')) B:ℕa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5c:Control.Cfgd:Control.Cfght:Relation.TransGen (BoundedEdge B) a che:BoundedEdge B c dih:∀ (P : ℕ), B ≤ P → ∀ (extra : List ℕ), ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word c.control) (c.regs ++ extra'))P:ℕhP:B ≤ Pextra:List ℕQ:ℕhQ:Q ≥ Pn:ℕhn:n ≥ 1tail:List ℕhrun:nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg Q (word c.control) (c.regs ++ tail))hc:c.regs.length = 5⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word d.control) (d.regs ++ extra')) B:ℕa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5c:Control.Cfgd:Control.Cfght:Relation.TransGen (BoundedEdge B) a che:BoundedEdge B c dih:∀ (P : ℕ), B ≤ P → ∀ (extra : List ℕ), ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word c.control) (c.regs ++ extra'))P:ℕhP:B ≤ Pextra:List ℕQ:ℕhQ:Q ≥ Pn:ℕhn:n ≥ 1tail:List ℕhrun:nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg Q (word c.control) (c.regs ++ tail))hc:c.regs.length = 5Q':ℕhQ':Q' ≥ Qs:ℕhs:s ≥ 1tail':List ℕhnext:nSteps s (Physical.rootCfg Q (word c.control) (c.regs ++ tail)) = some (Physical.rootCfg Q' (word d.control) (d.regs ++ tail'))⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word d.control) (d.regs ++ extra')) refine ⟨Q',le_trans hQ hQ',n+s,B:ℕa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5c:Control.Cfgd:Control.Cfght:Relation.TransGen (BoundedEdge B) a che:BoundedEdge B c dih:∀ (P : ℕ), B ≤ P → ∀ (extra : List ℕ), ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word c.control) (c.regs ++ extra'))P:ℕhP:B ≤ Pextra:List ℕQ:ℕhQ:Q ≥ Pn:ℕhn:n ≥ 1tail:List ℕhrun:nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg Q (word c.control) (c.regs ++ tail))hc:c.regs.length = 5Q':ℕhQ':Q' ≥ Qs:ℕhs:s ≥ 1tail':List ℕhnext:nSteps s (Physical.rootCfg Q (word c.control) (c.regs ++ tail)) = some (Physical.rootCfg Q' (word d.control) (d.regs ++ tail'))⊢ n + s ≥ 1 All goals completed! 🐙,tail',?_⟩ B:ℕa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5c:Control.Cfgd:Control.Cfght:Relation.TransGen (BoundedEdge B) a che:BoundedEdge B c dih:∀ (P : ℕ), B ≤ P → ∀ (extra : List ℕ), ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word c.control) (c.regs ++ extra'))P:ℕhP:B ≤ Pextra:List ℕQ:ℕhQ:Q ≥ Pn:ℕhn:n ≥ 1tail:List ℕhrun:nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg Q (word c.control) (c.regs ++ tail))hc:c.regs.length = 5Q':ℕhQ':Q' ≥ Qs:ℕhs:s ≥ 1tail':List ℕhnext:nSteps s (Physical.rootCfg Q (word c.control) (c.regs ++ tail)) = some (Physical.rootCfg Q' (word d.control) (d.regs ++ tail'))⊢ (some (Physical.rootCfg Q (word c.control) (c.regs ++ tail))).bind (nSteps s) = some (Physical.rootCfg Q' (word d.control) (d.regs ++ tail')) All goals completed! 🐙theorem bounded_rtrace_lift (B P : Nat) (hP : B ≤ P) (a b : Control.Cfg) (hlen : a.regs.length = 5) (ht : Relation.ReflTransGen (BoundedEdge B) a b) (extra : List Nat) : ∃ P' ≥ P, ∃ n : Nat, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) := B:ℕP:ℕhP:B ≤ Pa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5ht:Relation.ReflTransGen (BoundedEdge B) a bextra:List ℕ⊢ ∃ P' ≥ P, ∃ n extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) B:ℕP:ℕhP:B ≤ Pa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5ht:Relation.ReflTransGen (BoundedEdge B) a bextra:List ℕheq:b = a⊢ ∃ P' ≥ P, ∃ n extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra'))B:ℕP:ℕhP:B ≤ Pa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5ht✝:Relation.ReflTransGen (BoundedEdge B) a bextra:List ℕht:Relation.TransGen (BoundedEdge B) a b⊢ ∃ P' ≥ P, ∃ n extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) B:ℕP:ℕhP:B ≤ Pa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5ht:Relation.ReflTransGen (BoundedEdge B) a bextra:List ℕheq:b = a⊢ ∃ P' ≥ P, ∃ n extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) B:ℕP:ℕhP:B ≤ Pa:Control.Cfghlen:a.regs.length = 5extra:List ℕht:Relation.ReflTransGen (BoundedEdge B) a a⊢ ∃ P' ≥ P, ∃ n extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word a.control) (a.regs ++ extra')) All goals completed! 🐙 B:ℕP:ℕhP:B ≤ Pa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5ht✝:Relation.ReflTransGen (BoundedEdge B) a bextra:List ℕht:Relation.TransGen (BoundedEdge B) a b⊢ ∃ P' ≥ P, ∃ n extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) B:ℕP:ℕhP:B ≤ Pa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5ht✝:Relation.ReflTransGen (BoundedEdge B) a bextra:List ℕht:Relation.TransGen (BoundedEdge B) a bP':ℕhP':P' ≥ Pn:ℕleft✝:n ≥ 1extra':List ℕhrun:nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra'))⊢ ∃ P' ≥ P, ∃ n extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) All goals completed! 🐙theorem strict_exit_lift (B P : Nat) (hP : B ≤ P) (a b : Control.Cfg) (hlen : a.regs.length = 5) (hb : word b.control = []) (ht : StrictExitTrace B a b) (extra : List Nat) : ∃ P' ≥ P+1, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) := B:ℕP:ℕhP:B ≤ Pa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5hb:word b.control = []ht:StrictExitTrace B a bextra:List ℕ⊢ ∃ P' ≥ P + 1, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) B:ℕP:ℕhP:B ≤ Pa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5hb:word b.control = []extra:List ℕmid:Control.Cfghprefix:Relation.ReflTransGen (BoundedEdge B) a midhedge:BoundedEdge B mid bheffect:effect mid.control = Effect.decnz 2left✝:mid.regs.getD 2 0 = 0right✝:mid.regs = b.regs⊢ ∃ P' ≥ P + 1, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) B:ℕP:ℕhP:B ≤ Pa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5hb:word b.control = []extra:List ℕmid:Control.Cfghprefix:Relation.ReflTransGen (BoundedEdge B) a midhedge:BoundedEdge B mid bheffect:effect mid.control = Effect.decnz 2left✝:mid.regs.getD 2 0 = 0right✝:mid.regs = b.regshmidlen:mid.regs.length = 5⊢ ∃ P' ≥ P + 1, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) B:ℕP:ℕhP:B ≤ Pa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5hb:word b.control = []extra:List ℕmid:Control.Cfghprefix:Relation.ReflTransGen (BoundedEdge B) a midhedge:BoundedEdge B mid bheffect:effect mid.control = Effect.decnz 2left✝:mid.regs.getD 2 0 = 0right✝:mid.regs = b.regshmidlen:mid.regs.length = 5Q:ℕhQ:Q ≥ Pn:ℕtail:List ℕhrun:nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg Q (word mid.control) (mid.regs ++ tail))⊢ ∃ P' ≥ P + 1, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) B:ℕP:ℕhP:B ≤ Pa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5hb:word b.control = []extra:List ℕmid:Control.Cfghprefix:Relation.ReflTransGen (BoundedEdge B) a midhedge:BoundedEdge B mid bheffect:effect mid.control = Effect.decnz 2left✝:mid.regs.getD 2 0 = 0right✝:mid.regs = b.regshmidlen:mid.regs.length = 5Q:ℕhQ:Q ≥ Pn:ℕtail:List ℕhrun:nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg Q (word mid.control) (mid.regs ++ tail))hnext:applyInstr (rawInstr mid.control) mid.regs = some { stack := word b.control, regs := b.regs }⊢ ∃ P' ≥ P + 1, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) B:ℕP:ℕhP:B ≤ Pa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5hb:word b.control = []extra:List ℕmid:Control.Cfghprefix:Relation.ReflTransGen (BoundedEdge B) a midhedge:BoundedEdge B mid bheffect:effect mid.control = Effect.decnz 2left✝¹:mid.regs.getD 2 0 = 0right✝:mid.regs = b.regshmidlen:mid.regs.length = 5Q:ℕhQ:Q ≥ Pn:ℕtail:List ℕhrun:nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg Q (word mid.control) (mid.regs ++ tail))hnext:applyInstr (rawInstr mid.control) mid.regs = some { stack := word b.control, regs := b.regs }Q':ℕleft✝:Q' ≥ Qs:ℕhs:s ≥ 1tail':List ℕhfinal:nSteps s (Physical.rootCfg Q (word mid.control) (mid.regs ++ tail)) = some (Physical.rootCfg Q' { stack := word b.control, regs := b.regs }.stack ({ stack := word b.control, regs := b.regs }.regs ++ tail'))hgrow:{ stack := word b.control, regs := b.regs }.stack = [] → Q + 1 ≤ Q'⊢ ∃ P' ≥ P + 1, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) B:ℕP:ℕhP:B ≤ Pa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5hb:word b.control = []extra:List ℕmid:Control.Cfghprefix:Relation.ReflTransGen (BoundedEdge B) a midhedge:BoundedEdge B mid bheffect:effect mid.control = Effect.decnz 2left✝¹:mid.regs.getD 2 0 = 0right✝:mid.regs = b.regshmidlen:mid.regs.length = 5Q:ℕhQ:Q ≥ Pn:ℕtail:List ℕhrun:nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg Q (word mid.control) (mid.regs ++ tail))hnext:applyInstr (rawInstr mid.control) mid.regs = some { stack := word b.control, regs := b.regs }Q':ℕleft✝:Q' ≥ Qs:ℕhs:s ≥ 1tail':List ℕhfinal:nSteps s (Physical.rootCfg Q (word mid.control) (mid.regs ++ tail)) = some (Physical.rootCfg Q' { stack := word b.control, regs := b.regs }.stack ({ stack := word b.control, regs := b.regs }.regs ++ tail'))hgrow:{ stack := word b.control, regs := b.regs }.stack = [] → Q + 1 ≤ Q'hstrict:Q + 1 ≤ Q'⊢ ∃ P' ≥ P + 1, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg P' (word b.control) (b.regs ++ extra')) refine ⟨Q',B:ℕP:ℕhP:B ≤ Pa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5hb:word b.control = []extra:List ℕmid:Control.Cfghprefix:Relation.ReflTransGen (BoundedEdge B) a midhedge:BoundedEdge B mid bheffect:effect mid.control = Effect.decnz 2left✝¹:mid.regs.getD 2 0 = 0right✝:mid.regs = b.regshmidlen:mid.regs.length = 5Q:ℕhQ:Q ≥ Pn:ℕtail:List ℕhrun:nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg Q (word mid.control) (mid.regs ++ tail))hnext:applyInstr (rawInstr mid.control) mid.regs = some { stack := word b.control, regs := b.regs }Q':ℕleft✝:Q' ≥ Qs:ℕhs:s ≥ 1tail':List ℕhfinal:nSteps s (Physical.rootCfg Q (word mid.control) (mid.regs ++ tail)) = some (Physical.rootCfg Q' { stack := word b.control, regs := b.regs }.stack ({ stack := word b.control, regs := b.regs }.regs ++ tail'))hgrow:{ stack := word b.control, regs := b.regs }.stack = [] → Q + 1 ≤ Q'hstrict:Q + 1 ≤ Q'⊢ Q' ≥ P + 1 All goals completed! 🐙,n+s,B:ℕP:ℕhP:B ≤ Pa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5hb:word b.control = []extra:List ℕmid:Control.Cfghprefix:Relation.ReflTransGen (BoundedEdge B) a midhedge:BoundedEdge B mid bheffect:effect mid.control = Effect.decnz 2left✝¹:mid.regs.getD 2 0 = 0right✝:mid.regs = b.regshmidlen:mid.regs.length = 5Q:ℕhQ:Q ≥ Pn:ℕtail:List ℕhrun:nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg Q (word mid.control) (mid.regs ++ tail))hnext:applyInstr (rawInstr mid.control) mid.regs = some { stack := word b.control, regs := b.regs }Q':ℕleft✝:Q' ≥ Qs:ℕhs:s ≥ 1tail':List ℕhfinal:nSteps s (Physical.rootCfg Q (word mid.control) (mid.regs ++ tail)) = some (Physical.rootCfg Q' { stack := word b.control, regs := b.regs }.stack ({ stack := word b.control, regs := b.regs }.regs ++ tail'))hgrow:{ stack := word b.control, regs := b.regs }.stack = [] → Q + 1 ≤ Q'hstrict:Q + 1 ≤ Q'⊢ n + s ≥ 1 All goals completed! 🐙,tail',?_⟩ B:ℕP:ℕhP:B ≤ Pa:Control.Cfgb:Control.Cfghlen:a.regs.length = 5hb:word b.control = []extra:List ℕmid:Control.Cfghprefix:Relation.ReflTransGen (BoundedEdge B) a midhedge:BoundedEdge B mid bheffect:effect mid.control = Effect.decnz 2left✝¹:mid.regs.getD 2 0 = 0right✝:mid.regs = b.regshmidlen:mid.regs.length = 5Q:ℕhQ:Q ≥ Pn:ℕtail:List ℕhrun:nSteps n (Physical.rootCfg P (word a.control) (a.regs ++ extra)) = some (Physical.rootCfg Q (word mid.control) (mid.regs ++ tail))hnext:applyInstr (rawInstr mid.control) mid.regs = some { stack := word b.control, regs := b.regs }Q':ℕleft✝:Q' ≥ Qs:ℕhs:s ≥ 1tail':List ℕhfinal:nSteps s (Physical.rootCfg Q (word mid.control) (mid.regs ++ tail)) = some (Physical.rootCfg Q' { stack := word b.control, regs := b.regs }.stack ({ stack := word b.control, regs := b.regs }.regs ++ tail'))hgrow:{ stack := word b.control, regs := b.regs }.stack = [] → Q + 1 ≤ Q'hstrict:Q + 1 ≤ Q'⊢ (some (Physical.rootCfg Q (word mid.control) (mid.regs ++ tail))).bind (nSteps s) = some (Physical.rootCfg Q' (word b.control) (b.regs ++ tail')) All goals completed! 🐙end ConjectureMachines.Riemann95.Traceend

Width execution

sectionnamespace ConjectureMachines.Riemann95.Traceopen Riemann120.Layer2 Schema Controltheorem physical_precredit_width (P x j f : Nat) (extra : List Nat) (hP : widthBudget j ≤ P) : ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P [1,1,1,1] ([0,0,f,x,j] ++ extra)) = some (Physical.rootCfg P' (if Algorithm.residual j f = 0 then [] else word (.outside finalHaltId)) ([0,0,Algorithm.residual j f-1,x+j,0] ++ extra')) := P:ℕx:ℕj:ℕf:ℕextra:List ℕhP:widthBudget j ≤ P⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P [1, 1, 1, 1] ([0, 0, f, x, j] ++ extra)) = some (Physical.rootCfg P' (if Algorithm.residual j f = 0 then [] else word (ControlWord.outside finalHaltId)) ([0, 0, Algorithm.residual j f - 1, x + j, 0] ++ extra')) P:ℕx:ℕj:ℕf:ℕextra:List ℕhP:widthBudget j ≤ Ph:∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word { control := ControlWord.outside widthCallId, regs := [0, 0, f, x, j] }.control) ({ control := ControlWord.outside widthCallId, regs := [0, 0, f, x, j] }.regs ++ extra)) = some (Physical.rootCfg P' (word { control := if Algorithm.residual j f = 0 then ControlWord.outside 0 else ControlWord.outside finalHaltId, regs := [0, 0, Algorithm.residual j f - 1, x + j, 0] }.control) ({ control := if Algorithm.residual j f = 0 then ControlWord.outside 0 else ControlWord.outside finalHaltId, regs := [0, 0, Algorithm.residual j f - 1, x + j, 0] }.regs ++ extra'))⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P [1, 1, 1, 1] ([0, 0, f, x, j] ++ extra)) = some (Physical.rootCfg P' (if Algorithm.residual j f = 0 then [] else word (ControlWord.outside finalHaltId)) ([0, 0, Algorithm.residual j f - 1, x + j, 0] ++ extra')) P:ℕx:ℕj:ℕf:ℕextra:List ℕhP:widthBudget j ≤ Ph:∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P [1, 1, 1, 1] ({ control := ControlWord.outside widthCallId, regs := [0, 0, f, x, j] }.regs ++ extra)) = some (Physical.rootCfg P' (word { control := if Algorithm.residual j f = 0 then ControlWord.outside 0 else ControlWord.outside finalHaltId, regs := [0, 0, Algorithm.residual j f - 1, x + j, 0] }.control) ({ control := if Algorithm.residual j f = 0 then ControlWord.outside 0 else ControlWord.outside finalHaltId, regs := [0, 0, Algorithm.residual j f - 1, x + j, 0] }.regs ++ extra'))⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P [1, 1, 1, 1] ([0, 0, f, x, j] ++ extra)) = some (Physical.rootCfg P' (if Algorithm.residual j f = 0 then [] else word (ControlWord.outside finalHaltId)) ([0, 0, Algorithm.residual j f - 1, x + j, 0] ++ extra')) P:ℕx:ℕj:ℕf:ℕextra:List ℕhP:widthBudget j ≤ Ph:∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P [1, 1, 1, 1] ({ control := ControlWord.outside widthCallId, regs := [0, 0, f, x, j] }.regs ++ extra)) = some (Physical.rootCfg P' (word { control := if Algorithm.residual j f = 0 then ControlWord.outside 0 else ControlWord.outside finalHaltId, regs := [0, 0, Algorithm.residual j f - 1, x + j, 0] }.control) ({ control := if Algorithm.residual j f = 0 then ControlWord.outside 0 else ControlWord.outside finalHaltId, regs := [0, 0, Algorithm.residual j f - 1, x + j, 0] }.regs ++ extra'))hz:Algorithm.residual j f = 0⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P [1, 1, 1, 1] ([0, 0, f, x, j] ++ extra)) = some (Physical.rootCfg P' (if Algorithm.residual j f = 0 then [] else word (ControlWord.outside finalHaltId)) ([0, 0, Algorithm.residual j f - 1, x + j, 0] ++ extra'))P:ℕx:ℕj:ℕf:ℕextra:List ℕhP:widthBudget j ≤ Ph:∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P [1, 1, 1, 1] ({ control := ControlWord.outside widthCallId, regs := [0, 0, f, x, j] }.regs ++ extra)) = some (Physical.rootCfg P' (word { control := if Algorithm.residual j f = 0 then ControlWord.outside 0 else ControlWord.outside finalHaltId, regs := [0, 0, Algorithm.residual j f - 1, x + j, 0] }.control) ({ control := if Algorithm.residual j f = 0 then ControlWord.outside 0 else ControlWord.outside finalHaltId, regs := [0, 0, Algorithm.residual j f - 1, x + j, 0] }.regs ++ extra'))hz:¬Algorithm.residual j f = 0⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P [1, 1, 1, 1] ([0, 0, f, x, j] ++ extra)) = some (Physical.rootCfg P' (if Algorithm.residual j f = 0 then [] else word (ControlWord.outside finalHaltId)) ([0, 0, Algorithm.residual j f - 1, x + j, 0] ++ extra')) P:ℕx:ℕj:ℕf:ℕextra:List ℕhP:widthBudget j ≤ Ph:∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P [1, 1, 1, 1] ({ control := ControlWord.outside widthCallId, regs := [0, 0, f, x, j] }.regs ++ extra)) = some (Physical.rootCfg P' (word { control := if Algorithm.residual j f = 0 then ControlWord.outside 0 else ControlWord.outside finalHaltId, regs := [0, 0, Algorithm.residual j f - 1, x + j, 0] }.control) ({ control := if Algorithm.residual j f = 0 then ControlWord.outside 0 else ControlWord.outside finalHaltId, regs := [0, 0, Algorithm.residual j f - 1, x + j, 0] }.regs ++ extra'))hz:Algorithm.residual j f = 0⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P [1, 1, 1, 1] ([0, 0, f, x, j] ++ extra)) = some (Physical.rootCfg P' (if Algorithm.residual j f = 0 then [] else word (ControlWord.outside finalHaltId)) ([0, 0, Algorithm.residual j f - 1, x + j, 0] ++ extra')) All goals completed! 🐙 P:ℕx:ℕj:ℕf:ℕextra:List ℕhP:widthBudget j ≤ Ph:∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P [1, 1, 1, 1] ({ control := ControlWord.outside widthCallId, regs := [0, 0, f, x, j] }.regs ++ extra)) = some (Physical.rootCfg P' (word { control := if Algorithm.residual j f = 0 then ControlWord.outside 0 else ControlWord.outside finalHaltId, regs := [0, 0, Algorithm.residual j f - 1, x + j, 0] }.control) ({ control := if Algorithm.residual j f = 0 then ControlWord.outside 0 else ControlWord.outside finalHaltId, regs := [0, 0, Algorithm.residual j f - 1, x + j, 0] }.regs ++ extra'))hz:¬Algorithm.residual j f = 0⊢ ∃ P' ≥ P, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P [1, 1, 1, 1] ([0, 0, f, x, j] ++ extra)) = some (Physical.rootCfg P' (if Algorithm.residual j f = 0 then [] else word (ControlWord.outside finalHaltId)) ([0, 0, Algorithm.residual j f - 1, x + j, 0] ++ extra')) All goals completed! 🐙theorem physical_precredit_width_zero (P x j f : Nat) (extra : List Nat) (hP : widthBudget j ≤ P) (hr : Algorithm.residual j f = 0) : ∃ P' ≥ P+1, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P [1,1,1,1] ([0,0,f,x,j] ++ extra)) = some (Physical.rootCfg P' [] ([0,0,0,x+j,0] ++ extra')) := P:ℕx:ℕj:ℕf:ℕextra:List ℕhP:widthBudget j ≤ Phr:Algorithm.residual j f = 0⊢ ∃ P' ≥ P + 1, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P [1, 1, 1, 1] ([0, 0, f, x, j] ++ extra)) = some (Physical.rootCfg P' [] ([0, 0, 0, x + j, 0] ++ extra')) P:ℕx:ℕj:ℕf:ℕextra:List ℕhP:widthBudget j ≤ Phr:Algorithm.residual j f = 0h:∃ P' ≥ P + 1, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P (word { control := ControlWord.outside widthCallId, regs := [0, 0, f, x, j] }.control) ({ control := ControlWord.outside widthCallId, regs := [0, 0, f, x, j] }.regs ++ extra)) = some (Physical.rootCfg P' (word { control := ControlWord.outside 0, regs := [0, 0, 0, x + j, 0] }.control) ({ control := ControlWord.outside 0, regs := [0, 0, 0, x + j, 0] }.regs ++ extra'))⊢ ∃ P' ≥ P + 1, ∃ n ≥ 1, ∃ extra', nSteps n (Physical.rootCfg P [1, 1, 1, 1] ([0, 0, f, x, j] ++ extra)) = some (Physical.rootCfg P' [] ([0, 0, 0, x + j, 0] ++ extra')) All goals completed! 🐙end ConjectureMachines.Riemann95.Traceend