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.PrecreditTrace95@[expose] public sectionnamespace ConjectureMachines.Riemann95.Controlopen Schemaopen ConjectureMachines.Riemann120 (quarterClock)A final zero DECf edge, separated from its possibly empty bounded prefix.
def StrictExitTrace (B : Nat) (a b : Cfg) : Prop :=
∃ mid, Relation.ReflTransGen (BoundedEdge B) a mid ∧ BoundedEdge B mid b ∧
effect mid.control = .decnz 2 ∧ mid.regs.getD 2 0 = 0 ∧ mid.regs = b.regstheorem strictExit_prepend (B : Nat) (a b c : Cfg)
(hab : Relation.ReflTransGen (BoundedEdge B) a b)
(hbc : StrictExitTrace B b c) : StrictExitTrace B a c := B:ℕa:Cfgb:Cfgc:Cfghab:Relation.ReflTransGen (BoundedEdge B) a bhbc:StrictExitTrace B b c⊢ StrictExitTrace B a c
B:ℕa:Cfgb:Cfgc:Cfghab:Relation.ReflTransGen (BoundedEdge B) a bmid:Cfghm:Relation.ReflTransGen (BoundedEdge B) b midhe:BoundedEdge B mid chf:effect mid.control = Effect.decnz 2hz:mid.regs.getD 2 0 = 0hr:mid.regs = c.regs⊢ StrictExitTrace B a c
All goals completed! 🐙theorem strict_test_zero (B x : Nat) (hB : 19 ≤ B) :
StrictExitTrace B ⟨.outside finalTestId,[0,0,0,x,0]⟩ ⟨.outside 0,[0,0,0,x,0]⟩ := B:ℕx:ℕhB:19 ≤ B⊢ StrictExitTrace B { control := ControlWord.outside finalTestId, regs := [0, 0, 0, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
B:ℕx:ℕhB:19 ≤ B⊢ BoundedEdge B { control := ControlWord.outside finalTestId, regs := [0, 0, 0, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }B:ℕx:ℕhB:19 ≤ B⊢ effect { control := ControlWord.outside finalTestId, regs := [0, 0, 0, x, 0] }.control = Effect.decnz 2B:ℕx:ℕhB:19 ≤ B⊢ { control := ControlWord.outside finalTestId, regs := [0, 0, 0, x, 0] }.regs.getD 2 0 = 0
B:ℕx:ℕhB:19 ≤ B⊢ BoundedEdge B { control := ControlWord.outside finalTestId, regs := [0, 0, 0, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] } exact ⟨B:ℕx:ℕhB:19 ≤ B⊢ step { control := ControlWord.outside finalTestId, regs := [0, 0, 0, x, 0] } =
some { control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] } All goals completed! 🐙,le_trans (outside_frontier_bound _) hB⟩
B:ℕx:ℕhB:19 ≤ B⊢ effect { control := ControlWord.outside finalTestId, regs := [0, 0, 0, x, 0] }.control = Effect.decnz 2 All goals completed! 🐙
B:ℕx:ℕhB:19 ≤ B⊢ { control := ControlWord.outside finalTestId, regs := [0, 0, 0, x, 0] }.regs.getD 2 0 = 0 All goals completed! 🐙theorem strict_unwind0_zero (B x : Nat) (hB : 18 ≤ B) :
StrictExitTrace B ⟨unwind 0,[0,0,0,x,0]⟩ ⟨.outside 0,[0,0,0,x,0]⟩ := B:ℕx:ℕhB:18 ≤ B⊢ StrictExitTrace B { control := unwind 0, regs := [0, 0, 0, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
B:ℕx:ℕhB:18 ≤ B⊢ BoundedEdge B { control := unwind 0, regs := [0, 0, 0, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }B:ℕx:ℕhB:18 ≤ B⊢ effect { control := unwind 0, regs := [0, 0, 0, x, 0] }.control = Effect.decnz 2B:ℕx:ℕhB:18 ≤ B⊢ { control := unwind 0, regs := [0, 0, 0, x, 0] }.regs.getD 2 0 = 0
B:ℕx:ℕhB:18 ≤ B⊢ BoundedEdge B { control := unwind 0, regs := [0, 0, 0, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] } exact bounded_unwind_edge B 0 0 x hB _ (B:ℕx:ℕhB:18 ≤ B⊢ step { control := unwind 0, regs := [0, 0, 0, x, 0] } =
some { control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] } All goals completed! 🐙)
B:ℕx:ℕhB:18 ≤ B⊢ effect { control := unwind 0, regs := [0, 0, 0, x, 0] }.control = Effect.decnz 2 All goals completed! 🐙
B:ℕx:ℕhB:18 ≤ B⊢ { control := unwind 0, regs := [0, 0, 0, x, 0] }.regs.getD 2 0 = 0 All goals completed! 🐙theorem strict_unwind_zero (B d x f : Nat) (hB : 5 * d + 18 ≤ B)
(hO : 19 ≤ B) (hf : f ≤ d + 1) :
StrictExitTrace B ⟨unwind d,[0,0,f,x,0]⟩ ⟨.outside 0,[0,0,0,x,0]⟩ := B:ℕd:ℕx:ℕf:ℕhB:5 * d + 18 ≤ BhO:19 ≤ Bhf:f ≤ d + 1⊢ StrictExitTrace B { control := unwind d, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
induction d using Nat.strong_induction_on generalizing f with
B:ℕx:ℕhO:19 ≤ Bd:ℕih:∀ m < d,
∀ (f : ℕ),
5 * m + 18 ≤ B →
f ≤ m + 1 →
StrictExitTrace B { control := unwind m, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }f:ℕhB:5 * d + 18 ≤ Bhf:f ≤ d + 1⊢ StrictExitTrace B { control := unwind d, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
cases d with
B:ℕx:ℕhO:19 ≤ Bf:ℕih:∀ m < 0,
∀ (f : ℕ),
5 * m + 18 ≤ B →
f ≤ m + 1 →
StrictExitTrace B { control := unwind m, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }hB:5 * 0 + 18 ≤ Bhf:f ≤ 0 + 1⊢ StrictExitTrace B { control := unwind 0, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
cases f with
B:ℕx:ℕhO:19 ≤ Bih:∀ m < 0,
∀ (f : ℕ),
5 * m + 18 ≤ B →
f ≤ m + 1 →
StrictExitTrace B { control := unwind m, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }hB:5 * 0 + 18 ≤ Bhf:0 ≤ 0 + 1⊢ StrictExitTrace B { control := unwind 0, regs := [0, 0, 0, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] } All goals completed! 🐙
B:ℕx:ℕhO:19 ≤ Bih:∀ m < 0,
∀ (f : ℕ),
5 * m + 18 ≤ B →
f ≤ m + 1 →
StrictExitTrace B { control := unwind m, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }hB:5 * 0 + 18 ≤ Bf:ℕhf:f + 1 ≤ 0 + 1⊢ StrictExitTrace B { control := unwind 0, regs := [0, 0, f + 1, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
h.zero.succ B:ℕx:ℕhO:19 ≤ Bih:∀ m < 0,
∀ (f : ℕ),
5 * m + 18 ≤ B →
f ≤ m + 1 →
StrictExitTrace B { control := unwind m, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }hB:5 * 0 + 18 ≤ Bf:ℕhf:f + 1 ≤ 0 + 1hz:f = 0⊢ StrictExitTrace B { control := unwind 0, regs := [0, 0, f + 1, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
subst f h.zero.succ B:ℕx:ℕhO:19 ≤ Bih:∀ m < 0,
∀ (f : ℕ),
5 * m + 18 ≤ B →
f ≤ m + 1 →
StrictExitTrace B { control := unwind m, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }hB:5 * 0 + 18 ≤ Bhf:0 + 1 ≤ 0 + 1⊢ StrictExitTrace B { control := unwind 0, regs := [0, 0, 0 + 1, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
apply strictExit_prepend B _ ⟨.outside finalTestId,[0,0,0,x,0]⟩ _
(Relation.ReflTransGen.single ?_) (strict_test_zero B x hO) B:ℕx:ℕhO:19 ≤ Bih:∀ m < 0,
∀ (f : ℕ),
5 * m + 18 ≤ B →
f ≤ m + 1 →
StrictExitTrace B { control := unwind m, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }hB:5 * 0 + 18 ≤ Bhf:0 + 1 ≤ 0 + 1⊢ BoundedEdge B { control := unwind 0, regs := [0, 0, 0 + 1, x, 0] }
{ control := ControlWord.outside finalTestId, regs := [0, 0, 0, x, 0] }
exact bounded_unwind_edge B 0 1 x hB _ (by B:ℕx:ℕhO:19 ≤ Bih:∀ m < 0,
∀ (f : ℕ),
5 * m + 18 ≤ B →
f ≤ m + 1 →
StrictExitTrace B { control := unwind m, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }hB:5 * 0 + 18 ≤ Bhf:0 + 1 ≤ 0 + 1⊢ step { control := unwind 0, regs := [0, 0, 1, x, 0] } =
some { control := ControlWord.outside finalTestId, regs := [0, 0, 0, x, 0] } simpa using unwind0_step 1 x All goals completed! 🐙)
| succ d => h.succ B:ℕx:ℕhO:19 ≤ Bf:ℕd:ℕih:∀ m < d + 1,
∀ (f : ℕ),
5 * m + 18 ≤ B →
f ≤ m + 1 →
StrictExitTrace B { control := unwind m, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }hB:5 * (d + 1) + 18 ≤ Bhf:f ≤ d + 1 + 1⊢ StrictExitTrace B { control := unwind (d + 1), regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
cases f with
| zero => h.succ.zero B:ℕx:ℕhO:19 ≤ Bd:ℕih:∀ m < d + 1,
∀ (f : ℕ),
5 * m + 18 ≤ B →
f ≤ m + 1 →
StrictExitTrace B { control := unwind m, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }hB:5 * (d + 1) + 18 ≤ Bhf:0 ≤ d + 1 + 1⊢ StrictExitTrace B { control := unwind (d + 1), regs := [0, 0, 0, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
cases d with
| zero => h.succ.zero.zero B:ℕx:ℕhO:19 ≤ Bih:∀ m < 0 + 1,
∀ (f : ℕ),
5 * m + 18 ≤ B →
f ≤ m + 1 →
StrictExitTrace B { control := unwind m, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }hB:5 * (0 + 1) + 18 ≤ Bhf:0 ≤ 0 + 1 + 1⊢ StrictExitTrace B { control := unwind (0 + 1), regs := [0, 0, 0, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
apply strictExit_prepend B _ ⟨.outside finalTestId,[0,0,0,x,0]⟩ _
(Relation.ReflTransGen.single ?_) (strict_test_zero B x hO) B:ℕx:ℕhO:19 ≤ Bih:∀ m < 0 + 1,
∀ (f : ℕ),
5 * m + 18 ≤ B →
f ≤ m + 1 →
StrictExitTrace B { control := unwind m, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }hB:5 * (0 + 1) + 18 ≤ Bhf:0 ≤ 0 + 1 + 1⊢ BoundedEdge B { control := unwind (0 + 1), regs := [0, 0, 0, x, 0] }
{ control := ControlWord.outside finalTestId, regs := [0, 0, 0, x, 0] }
exact bounded_unwind_edge B 1 0 x hB _ (unwind1_zero_step x) All goals completed! 🐙
| succ d => h.succ.zero.succ B:ℕx:ℕhO:19 ≤ Bd:ℕih:∀ m < d + 1 + 1,
∀ (f : ℕ),
5 * m + 18 ≤ B →
f ≤ m + 1 →
StrictExitTrace B { control := unwind m, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }hB:5 * (d + 1 + 1) + 18 ≤ Bhf:0 ≤ d + 1 + 1 + 1⊢ StrictExitTrace B { control := unwind (d + 1 + 1), regs := [0, 0, 0, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
apply strictExit_prepend B _ ⟨unwind d,[0,0,0,x,0]⟩ _
(Relation.ReflTransGen.single ?_) (ih d (by B:ℕx:ℕhO:19 ≤ Bd:ℕih:∀ m < d + 1 + 1,
∀ (f : ℕ),
5 * m + 18 ≤ B →
f ≤ m + 1 →
StrictExitTrace B { control := unwind m, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }hB:5 * (d + 1 + 1) + 18 ≤ Bhf:0 ≤ d + 1 + 1 + 1⊢ d < d + 1 + 1 omega All goals completed! 🐙) 0 (by B:ℕx:ℕhO:19 ≤ Bd:ℕih:∀ m < d + 1 + 1,
∀ (f : ℕ),
5 * m + 18 ≤ B →
f ≤ m + 1 →
StrictExitTrace B { control := unwind m, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }hB:5 * (d + 1 + 1) + 18 ≤ Bhf:0 ≤ d + 1 + 1 + 1⊢ 5 * d + 18 ≤ B omega All goals completed! 🐙) (by B:ℕx:ℕhO:19 ≤ Bd:ℕih:∀ m < d + 1 + 1,
∀ (f : ℕ),
5 * m + 18 ≤ B →
f ≤ m + 1 →
StrictExitTrace B { control := unwind m, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }hB:5 * (d + 1 + 1) + 18 ≤ Bhf:0 ≤ d + 1 + 1 + 1⊢ 0 ≤ d + 1 omega All goals completed! 🐙))
exact bounded_unwind_edge B (d+2) 0 x hB _ (unwind_succ_succ_zero_step d x) All goals completed! 🐙
| succ f => h.succ.succ B:ℕx:ℕhO:19 ≤ Bd:ℕih:∀ m < d + 1,
∀ (f : ℕ),
5 * m + 18 ≤ B →
f ≤ m + 1 →
StrictExitTrace B { control := unwind m, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }hB:5 * (d + 1) + 18 ≤ Bf:ℕhf:f + 1 ≤ d + 1 + 1⊢ StrictExitTrace B { control := unwind (d + 1), regs := [0, 0, f + 1, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
apply strictExit_prepend B _ ⟨unwind d,[0,0,f,x,0]⟩ _
(Relation.ReflTransGen.single ?_) (ih d (by B:ℕx:ℕhO:19 ≤ Bd:ℕih:∀ m < d + 1,
∀ (f : ℕ),
5 * m + 18 ≤ B →
f ≤ m + 1 →
StrictExitTrace B { control := unwind m, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }hB:5 * (d + 1) + 18 ≤ Bf:ℕhf:f + 1 ≤ d + 1 + 1⊢ d < d + 1 omega All goals completed! 🐙) f (by B:ℕx:ℕhO:19 ≤ Bd:ℕih:∀ m < d + 1,
∀ (f : ℕ),
5 * m + 18 ≤ B →
f ≤ m + 1 →
StrictExitTrace B { control := unwind m, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }hB:5 * (d + 1) + 18 ≤ Bf:ℕhf:f + 1 ≤ d + 1 + 1⊢ 5 * d + 18 ≤ B omega All goals completed! 🐙) (by B:ℕx:ℕhO:19 ≤ Bd:ℕih:∀ m < d + 1,
∀ (f : ℕ),
5 * m + 18 ≤ B →
f ≤ m + 1 →
StrictExitTrace B { control := unwind m, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }hB:5 * (d + 1) + 18 ≤ Bf:ℕhf:f + 1 ≤ d + 1 + 1⊢ f ≤ d + 1 omega All goals completed! 🐙))
exact bounded_unwind_edge B (d+1) (f+1) x hB _ (unwind_succ_positive_step d f x) All goals completed! 🐙theorem strict_finish_zero (J q f x : Nat) (hq : q ≤ quarterClock J) (hf : f ≤ q) :
StrictExitTrace (widthBudget J) ⟨.entry q,[0,0,f,x,0]⟩ ⟨.outside 0,[0,0,0,x,0]⟩ := by J:ℕq:ℕf:ℕx:ℕhq:q ≤ quarterClock Jhf:f ≤ q⊢ StrictExitTrace (widthBudget J) { control := ControlWord.entry q, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
have hO : 19 ≤ widthBudget J := by
unfold widthBudget J:ℕq:ℕf:ℕx:ℕhq:q ≤ quarterClock Jhf:f ≤ q⊢ 19 ≤ max 16 (10 + 5 * quarterClock J) + 5
have h := le_max_left 16 (10 + 5 * quarterClock J) J:ℕq:ℕf:ℕx:ℕhq:q ≤ quarterClock Jhf:f ≤ qh:16 ≤ max 16 (10 + 5 * quarterClock J)⊢ 19 ≤ max 16 (10 + 5 * quarterClock J) + 5
omega J:ℕq:ℕf:ℕx:ℕhq:q ≤ quarterClock Jhf:f ≤ qhO:19 ≤ widthBudget J⊢ StrictExitTrace (widthBudget J) { control := ControlWord.entry q, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
have hmax := le_max_right 16 (10 + 5 * quarterClock J) J:ℕq:ℕf:ℕx:ℕhq:q ≤ quarterClock Jhf:f ≤ qhO:19 ≤ widthBudget Jhmax:10 + 5 * quarterClock J ≤ max 16 (10 + 5 * quarterClock J)⊢ StrictExitTrace (widthBudget J) { control := ControlWord.entry q, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
cases q with
| zero => zero J:ℕf:ℕx:ℕhO:19 ≤ widthBudget Jhmax:10 + 5 * quarterClock J ≤ max 16 (10 + 5 * quarterClock J)hq:0 ≤ quarterClock Jhf:f ≤ 0⊢ StrictExitTrace (widthBudget J) { control := ControlWord.entry 0, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
have hz : f = 0 := by J:ℕq:ℕf:ℕx:ℕhq:q ≤ quarterClock Jhf:f ≤ q⊢ StrictExitTrace (widthBudget J) { control := ControlWord.entry q, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] } omega zero J:ℕf:ℕx:ℕhO:19 ≤ widthBudget Jhmax:10 + 5 * quarterClock J ≤ max 16 (10 + 5 * quarterClock J)hq:0 ≤ quarterClock Jhf:f ≤ 0hz:f = 0⊢ StrictExitTrace (widthBudget J) { control := ControlWord.entry 0, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
subst f zero J:ℕx:ℕhO:19 ≤ widthBudget Jhmax:10 + 5 * quarterClock J ≤ max 16 (10 + 5 * quarterClock J)hq:0 ≤ quarterClock Jhf:0 ≤ 0⊢ StrictExitTrace (widthBudget J) { control := ControlWord.entry 0, regs := [0, 0, 0, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
apply strictExit_prepend (widthBudget J) _ ⟨.outside finalTestId,[0,0,0,x,0]⟩ _
(Relation.ReflTransGen.single ?_) (strict_test_zero _ x hO) J:ℕx:ℕhO:19 ≤ widthBudget Jhmax:10 + 5 * quarterClock J ≤ max 16 (10 + 5 * quarterClock J)hq:0 ≤ quarterClock Jhf:0 ≤ 0⊢ BoundedEdge (widthBudget J) { control := ControlWord.entry 0, regs := [0, 0, 0, x, 0] }
{ control := ControlWord.outside finalTestId, regs := [0, 0, 0, x, 0] }
refine ⟨?_,?_⟩ refine_1 J:ℕx:ℕhO:19 ≤ widthBudget Jhmax:10 + 5 * quarterClock J ≤ max 16 (10 + 5 * quarterClock J)hq:0 ≤ quarterClock Jhf:0 ≤ 0⊢ step { control := ControlWord.entry 0, regs := [0, 0, 0, x, 0] } =
some { control := ControlWord.outside finalTestId, regs := [0, 0, 0, x, 0] }refine_2 J:ℕx:ℕhO:19 ≤ widthBudget Jhmax:10 + 5 * quarterClock J ≤ max 16 (10 + 5 * quarterClock J)hq:0 ≤ quarterClock Jhf:0 ≤ 0⊢ List.length (walked { control := ControlWord.entry 0, regs := [0, 0, 0, x, 0] }.control) + 3 ≤ widthBudget J
· refine_1 J:ℕx:ℕhO:19 ≤ widthBudget Jhmax:10 + 5 * quarterClock J ≤ max 16 (10 + 5 * quarterClock J)hq:0 ≤ quarterClock Jhf:0 ≤ 0⊢ step { control := ControlWord.entry 0, regs := [0, 0, 0, x, 0] } =
some { control := ControlWord.outside finalTestId, regs := [0, 0, 0, x, 0] } simp [step,entry_zero] All goals completed! 🐙
· refine_2 J:ℕx:ℕhO:19 ≤ widthBudget Jhmax:10 + 5 * quarterClock J ≤ max 16 (10 + 5 * quarterClock J)hq:0 ≤ quarterClock Jhf:0 ≤ 0⊢ List.length (walked { control := ControlWord.entry 0, regs := [0, 0, 0, x, 0] }.control) + 3 ≤ widthBudget J rw [entry_frontier_length refine_2 J:ℕx:ℕhO:19 ≤ widthBudget Jhmax:10 + 5 * quarterClock J ≤ max 16 (10 + 5 * quarterClock J)hq:0 ≤ quarterClock Jhf:0 ≤ 0⊢ 5 * 0 + 10 ≤ widthBudget J] refine_2 J:ℕx:ℕhO:19 ≤ widthBudget Jhmax:10 + 5 * quarterClock J ≤ max 16 (10 + 5 * quarterClock J)hq:0 ≤ quarterClock Jhf:0 ≤ 0⊢ 5 * 0 + 10 ≤ widthBudget J
omega All goals completed! 🐙
| succ d => succ J:ℕf:ℕx:ℕhO:19 ≤ widthBudget Jhmax:10 + 5 * quarterClock J ≤ max 16 (10 + 5 * quarterClock J)d:ℕhq:d + 1 ≤ quarterClock Jhf:f ≤ d + 1⊢ StrictExitTrace (widthBudget J) { control := ControlWord.entry (d + 1), regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
have hB : 5 * d + 18 ≤ widthBudget J := by J:ℕq:ℕf:ℕx:ℕhq:q ≤ quarterClock Jhf:f ≤ q⊢ StrictExitTrace (widthBudget J) { control := ControlWord.entry q, regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] } unfold widthBudget J:ℕf:ℕx:ℕhO:19 ≤ widthBudget Jhmax:10 + 5 * quarterClock J ≤ max 16 (10 + 5 * quarterClock J)d:ℕhq:d + 1 ≤ quarterClock Jhf:f ≤ d + 1⊢ 5 * d + 18 ≤ max 16 (10 + 5 * quarterClock J) + 5; omega succ J:ℕf:ℕx:ℕhO:19 ≤ widthBudget Jhmax:10 + 5 * quarterClock J ≤ max 16 (10 + 5 * quarterClock J)d:ℕhq:d + 1 ≤ quarterClock Jhf:f ≤ d + 1hB:5 * d + 18 ≤ widthBudget J⊢ StrictExitTrace (widthBudget J) { control := ControlWord.entry (d + 1), regs := [0, 0, f, x, 0] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
apply strictExit_prepend (widthBudget J) _ ⟨unwind d,[0,0,f,x,0]⟩ _
(Relation.ReflTransGen.single ?_) (strict_unwind_zero _ d x f hB hO hf) J:ℕf:ℕx:ℕhO:19 ≤ widthBudget Jhmax:10 + 5 * quarterClock J ≤ max 16 (10 + 5 * quarterClock J)d:ℕhq:d + 1 ≤ quarterClock Jhf:f ≤ d + 1hB:5 * d + 18 ≤ widthBudget J⊢ BoundedEdge (widthBudget J) { control := ControlWord.entry (d + 1), regs := [0, 0, f, x, 0] }
{ control := unwind d, regs := [0, 0, f, x, 0] }
refine ⟨?_,?_⟩ refine_1 J:ℕf:ℕx:ℕhO:19 ≤ widthBudget Jhmax:10 + 5 * quarterClock J ≤ max 16 (10 + 5 * quarterClock J)d:ℕhq:d + 1 ≤ quarterClock Jhf:f ≤ d + 1hB:5 * d + 18 ≤ widthBudget J⊢ step { control := ControlWord.entry (d + 1), regs := [0, 0, f, x, 0] } =
some { control := unwind d, regs := [0, 0, f, x, 0] }refine_2 J:ℕf:ℕx:ℕhO:19 ≤ widthBudget Jhmax:10 + 5 * quarterClock J ≤ max 16 (10 + 5 * quarterClock J)d:ℕhq:d + 1 ≤ quarterClock Jhf:f ≤ d + 1hB:5 * d + 18 ≤ widthBudget J⊢ List.length (walked { control := ControlWord.entry (d + 1), regs := [0, 0, f, x, 0] }.control) + 3 ≤ widthBudget J
· refine_1 J:ℕf:ℕx:ℕhO:19 ≤ widthBudget Jhmax:10 + 5 * quarterClock J ≤ max 16 (10 + 5 * quarterClock J)d:ℕhq:d + 1 ≤ quarterClock Jhf:f ≤ d + 1hB:5 * d + 18 ≤ widthBudget J⊢ step { control := ControlWord.entry (d + 1), regs := [0, 0, f, x, 0] } =
some { control := unwind d, regs := [0, 0, f, x, 0] } simp [step,entry_succ] All goals completed! 🐙
· refine_2 J:ℕf:ℕx:ℕhO:19 ≤ widthBudget Jhmax:10 + 5 * quarterClock J ≤ max 16 (10 + 5 * quarterClock J)d:ℕhq:d + 1 ≤ quarterClock Jhf:f ≤ d + 1hB:5 * d + 18 ≤ widthBudget J⊢ List.length (walked { control := ControlWord.entry (d + 1), regs := [0, 0, f, x, 0] }.control) + 3 ≤ widthBudget J rw [entry_frontier_length refine_2 J:ℕf:ℕx:ℕhO:19 ≤ widthBudget Jhmax:10 + 5 * quarterClock J ≤ max 16 (10 + 5 * quarterClock J)d:ℕhq:d + 1 ≤ quarterClock Jhf:f ≤ d + 1hB:5 * d + 18 ≤ widthBudget J⊢ 5 * (d + 1) + 10 ≤ widthBudget J] refine_2 J:ℕf:ℕx:ℕhO:19 ≤ widthBudget Jhmax:10 + 5 * quarterClock J ≤ max 16 (10 + 5 * quarterClock J)d:ℕhq:d + 1 ≤ quarterClock Jhf:f ≤ d + 1hB:5 * d + 18 ≤ widthBudget J⊢ 5 * (d + 1) + 10 ≤ widthBudget J
unfold widthBudget refine_2 J:ℕf:ℕx:ℕhO:19 ≤ widthBudget Jhmax:10 + 5 * quarterClock J ≤ max 16 (10 + 5 * quarterClock J)d:ℕhq:d + 1 ≤ quarterClock Jhf:f ≤ d + 1hB:5 * d + 18 ≤ widthBudget J⊢ 5 * (d + 1) + 10 ≤ max 16 (10 + 5 * quarterClock J) + 5
omega All goals completed! 🐙theorem strict_width_zero (x j f : Nat) (hr : Algorithm.residual j f = 0) :
StrictExitTrace (widthBudget j) ⟨.entry 0,[0,0,f,x,j]⟩ ⟨.outside 0,[0,0,0,x,0]⟩ := by x:ℕj:ℕf:ℕhr:Algorithm.residual j f = 0⊢ StrictExitTrace (widthBudget j) { control := ControlWord.entry 0, regs := [0, 0, f, x, j] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
have hf : f/2^quarterClock j ≤ quarterClock j := by
rw [Algorithm.residual_eq x:ℕj:ℕf:ℕhr:f / 2 ^ quarterClock j - quarterClock j = 0⊢ f / 2 ^ quarterClock j ≤ quarterClock j] at hr x:ℕj:ℕf:ℕhr:f / 2 ^ quarterClock j - quarterClock j = 0⊢ f / 2 ^ quarterClock j ≤ quarterClock j
omega x:ℕj:ℕf:ℕhr:Algorithm.residual j f = 0hf:f / 2 ^ quarterClock j ≤ quarterClock j⊢ StrictExitTrace (widthBudget j) { control := ControlWord.entry 0, regs := [0, 0, f, x, j] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
have hd := bounded_descent j 0 x j f (by x:ℕj:ℕf:ℕhr:Algorithm.residual j f = 0hf:f / 2 ^ quarterClock j ≤ quarterClock j⊢ 0 + quarterClock j ≤ quarterClock j omega All goals completed! 🐙) x:ℕj:ℕf:ℕhr:Algorithm.residual j f = 0hf:f / 2 ^ quarterClock j ≤ quarterClock jhd:Relation.ReflTransGen (BoundedEdge (widthBudget j)) { control := ControlWord.entry 0, regs := [0, 0, f, x, j] }
{ control := ControlWord.entry (0 + quarterClock j), regs := [0, 0, f / 2 ^ quarterClock j, x, 0] }⊢ StrictExitTrace (widthBudget j) { control := ControlWord.entry 0, regs := [0, 0, f, x, j] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
simp only [Nat.zero_add] at hd x:ℕj:ℕf:ℕhr:Algorithm.residual j f = 0hf:f / 2 ^ quarterClock j ≤ quarterClock jhd:Relation.ReflTransGen (BoundedEdge (widthBudget j)) { control := ControlWord.entry 0, regs := [0, 0, f, x, j] }
{ control := ControlWord.entry (quarterClock j), regs := [0, 0, f / 2 ^ quarterClock j, x, 0] }⊢ StrictExitTrace (widthBudget j) { control := ControlWord.entry 0, regs := [0, 0, f, x, j] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x, 0] }
exact strictExit_prepend _ _ _ _ hd
(strict_finish_zero j (quarterClock j) (f/2^quarterClock j) x (by x:ℕj:ℕf:ℕhr:Algorithm.residual j f = 0hf:f / 2 ^ quarterClock j ≤ quarterClock jhd:Relation.ReflTransGen (BoundedEdge (widthBudget j)) { control := ControlWord.entry 0, regs := [0, 0, f, x, j] }
{ control := ControlWord.entry (quarterClock j), regs := [0, 0, f / 2 ^ quarterClock j, x, 0] }⊢ quarterClock j ≤ quarterClock j omega All goals completed! 🐙) hf)theorem strict_precredit_width_zero (x j f : Nat) (hr : Algorithm.residual j f = 0) :
StrictExitTrace (widthBudget j) ⟨.outside widthCallId,[0,0,f,x,j]⟩
⟨.outside 0,[0,0,0,x+j,0]⟩ := by x:ℕj:ℕf:ℕhr:Algorithm.residual j f = 0⊢ StrictExitTrace (widthBudget j) { control := ControlWord.outside widthCallId, regs := [0, 0, f, x, j] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x + j, 0] }
have hbudget : 19 ≤ widthBudget j := by
unfold widthBudget x:ℕj:ℕf:ℕhr:Algorithm.residual j f = 0⊢ 19 ≤ max 16 (10 + 5 * quarterClock j) + 5
have h := le_max_left 16 (10 + 5 * quarterClock j) x:ℕj:ℕf:ℕhr:Algorithm.residual j f = 0h:16 ≤ max 16 (10 + 5 * quarterClock j)⊢ 19 ≤ max 16 (10 + 5 * quarterClock j) + 5
omega x:ℕj:ℕf:ℕhr:Algorithm.residual j f = 0hbudget:19 ≤ widthBudget j⊢ StrictExitTrace (widthBudget j) { control := ControlWord.outside widthCallId, regs := [0, 0, f, x, j] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x + j, 0] }
have hp : Relation.TransGen (BoundedEdge (widthBudget j))
⟨.outside widthCallId,[0,0,f,x,j]⟩ ⟨.entry 0,[0,0,f,x+j,j]⟩ :=
Relation.TransGen.mono (r := BoundedEdge 19) (p := BoundedEdge (widthBudget j))
(fun _ _ h => ⟨h.1,le_trans h.2 hbudget⟩) _ _ (bounded_precredit x j f) x:ℕj:ℕf:ℕhr:Algorithm.residual j f = 0hbudget:19 ≤ widthBudget jhp:Relation.TransGen (BoundedEdge (widthBudget j)) { control := ControlWord.outside widthCallId, regs := [0, 0, f, x, j] }
{ control := ControlWord.entry 0, regs := [0, 0, f, x + j, j] }⊢ StrictExitTrace (widthBudget j) { control := ControlWord.outside widthCallId, regs := [0, 0, f, x, j] }
{ control := ControlWord.outside 0, regs := [0, 0, 0, x + j, 0] }
exact strictExit_prepend _ _ _ _ hp.to_reflTransGen (strict_width_zero (x+j) j f hr) All goals completed! 🐙end ConjectureMachines.Riemann95.Control