Skip to content
Imports
@[expose] public sectionnamespace ConjectureMachines.Riemann95.TypedPrewidthopen Schemaopen ConjectureMachines.Riemann120.Layer2 (RhRegCfg)attribute [local irreducible] ReferenceProgram.word ReferenceProgram.decoded
ReferenceProgram.instruction ReferenceLogical.word ReferenceLogical.decoded
ReferenceLogical.instruction ReferencePreStep95def ctl89 (s : Fin 89) : Fin 97 := s.castLE (s:Fin 89⊢ 89 ≤ 97 All goals completed! 🐙)def ref89 (s : Fin 89) : Fin 121 := s.castLE (s:Fin 89⊢ 89 ≤ 121 All goals completed! 🐙)def ctl85 (s : Fin 85) : Fin 97 := ⟨s.val+3,s:Fin 85⊢ ↑s + 3 < 97 All goals completed! 🐙⟩def ref85 (s : Fin 85) : Fin 121 := ⟨s.val+3,s:Fin 85⊢ ↑s + 3 < 121 All goals completed! 🐙⟩theorem words_match : ∀ s : Fin 89,
outsideWord (ctl89 s) = ReferenceProgram.word (ref89 s) := ⊢ ∀ (s : Fin 89), outsideWord (ctl89 s) = ReferenceProgram.word (ref89 s) All goals completed! 🐙theorem instructions_match : ∀ s : Fin 85,
Control.rawInstr (.outside (ctl85 s)) = swapInstr (ReferenceProgram.decoded (ref85 s)) := ⊢ ∀ (s : Fin 85), Control.rawInstr (ControlWord.outside (ctl85 s)) = swapInstr (ReferenceProgram.decoded (ref85 s))
All goals completed! 🐙theorem word88_unique : ∀ s : Fin 89,
ReferenceProgram.word (ref89 s) = ReferenceProgram.word 88 → s.val = 88 := ⊢ ∀ (s : Fin 89), ReferenceProgram.word (ref89 s) = ReferenceProgram.word 88 → ↑s = 88
All goals completed! 🐙theorem word88_match : word (.outside 88) = ReferenceProgram.word 88 := ⊢ word (ControlWord.outside 88) = ReferenceProgram.word 88 All goals completed! 🐙theorem word3_match : word (.outside 3) = ReferenceProgram.word 3 := ⊢ word (ControlWord.outside 3) = ReferenceProgram.word 3 All goals completed! 🐙def InPrewidth : ControlWord → Prop
| .outside i => 3 ≤ i.val ∧ i.val < 89
| _ => Falseinstance (c : ControlWord) : Decidable (InPrewidth c) := c:ControlWord⊢ Decidable (InPrewidth c)
id✝:Fin 97⊢ Decidable (InPrewidth (ControlWord.outside id✝))depth✝:ℕ⊢ Decidable (InPrewidth (ControlWord.entry depth✝))depth✝:ℕid✝:Fin 22⊢ Decidable (InPrewidth (ControlWord.local depth✝ id✝)) id✝:Fin 97⊢ Decidable (InPrewidth (ControlWord.outside id✝))depth✝:ℕ⊢ Decidable (InPrewidth (ControlWord.entry depth✝))depth✝:ℕid✝:Fin 22⊢ Decidable (InPrewidth (ControlWord.local depth✝ id✝)) depth✝:ℕid✝:Fin 22⊢ Decidable False id✝:Fin 97⊢ Decidable (3 ≤ ↑id✝ ∧ ↑id✝ < 89)depth✝:ℕ⊢ Decidable Falsedepth✝:ℕid✝:Fin 22⊢ Decidable False All goals completed! 🐙def nextControls : Control.Instr → List ControlWord
| .halt => []
| .jump n | .inc _ n => [n]
| .decnz _ p z => [p,z]theorem targets_match : ∀ s : Fin 85,
(nextControls (Control.instruction (.outside (ctl85 s)))).all
(fun c => decide (InPrewidth c)) = true := ⊢ ∀ (s : Fin 85),
((nextControls (Control.instruction (ControlWord.outside (ctl85 s)))).all fun c ↦ decide (InPrewidth c)) = true All goals completed! 🐙def encodeCfg (c : Control.Cfg) : RhRegCfg := ⟨word c.control,swapBank c.regs⟩def preStep (c : Control.Cfg) : Option Control.Cfg :=
if c.control = .outside 88 then none else Control.step ctheorem word_range (i : Fin 97) (hi : i.val < 89) :
word (.outside i) = ReferenceProgram.word (ref89 ⟨i.val,hi⟩) := i:Fin 97hi:↑i < 89⊢ word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, hi⟩)
i:Fin 97hi:↑i < 89h:outsideWord (ctl89 ⟨↑i, hi⟩) = ReferenceProgram.word (ref89 ⟨↑i, hi⟩)⊢ word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, hi⟩)
i:Fin 97hi:↑i < 89h:outsideWord (ctl89 ⟨↑i, hi⟩) = ReferenceProgram.word (ref89 ⟨↑i, hi⟩)he:ctl89 ⟨↑i, hi⟩ = i⊢ word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, hi⟩)
simpa only [he,word] using hAll goals completed! 🐙theorem instruction_range (i : Fin 97) (hlo : 3 ≤ i.val) (hi : i.val < 88) :
Control.rawInstr (.outside i) =
swapInstr (ReferenceProgram.decoded (ref85 ⟨i.val-3,byi:Fin 97hlo:3 ≤ ↑ihi:↑i < 88⊢ ↑i - 3 < 85 omegaAll goals completed! 🐙⟩)) := byi:Fin 97hlo:3 ≤ ↑ihi:↑i < 88⊢ Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))
let j : Fin 85 := ⟨i.val-3,byi:Fin 97hlo:3 ≤ ↑ihi:↑i < 88⊢ ↑i - 3 < 85 omegaAll goals completed! 🐙⟩i:Fin 97hlo:3 ≤ ↑ihi:↑i < 88j:Fin 85 := ⟨↑i - 3, ⋯⟩⊢ Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))
have he : ctl85 j = i := by apply Fin.exti:Fin 97hlo:3 ≤ ↑ihi:↑i < 88j:Fin 85 := ⟨↑i - 3, ⋯⟩⊢ ↑(ctl85 j) = ↑i; dsimp [ctl85,j]i:Fin 97hlo:3 ≤ ↑ihi:↑i < 88j:Fin 85 := ⟨↑i - 3, ⋯⟩⊢ ↑i - 3 + 3 = ↑i; omegai:Fin 97hlo:3 ≤ ↑ihi:↑i < 88j:Fin 85 := ⟨↑i - 3, ⋯⟩he:ctl85 j = i⊢ Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))
simpa only [he] using instructions_match jAll goals completed! 🐙theorem step_control_mem (c next : Control.Cfg) (h : Control.step c = some next) :
next.control ∈ nextControls (Control.instruction c.control) := byc:Control.Cfgnext:Control.Cfgh:Control.step c = some next⊢ next.control ∈ nextControls (Control.instruction c.control)
unfold Control.step at hc:Control.Cfgnext:Control.Cfgh:(match Control.instruction c.control with
| Control.Instr.halt => none
| Control.Instr.jump n => some { control := n, regs := c.regs }
| Control.Instr.inc r n => some { control := n, regs := c.regs.set (↑r) (c.regs.getD (↑r) 0 + 1) }
| Control.Instr.decnz r p z =>
if (c.regs.getD (↑r) 0 == 0) = true then some { control := z, regs := c.regs }
else some { control := p, regs := c.regs.set (↑r) (c.regs.getD (↑r) 0 - 1) }) =
some next⊢ next.control ∈ nextControls (Control.instruction c.control)
cases hi : Control.instruction c.control with
| halt =>haltc:Control.Cfgnext:Control.Cfgh:(match Control.instruction c.control with
| Control.Instr.halt => none
| Control.Instr.jump n => some { control := n, regs := c.regs }
| Control.Instr.inc r n => some { control := n, regs := c.regs.set (↑r) (c.regs.getD (↑r) 0 + 1) }
| Control.Instr.decnz r p z =>
if (c.regs.getD (↑r) 0 == 0) = true then some { control := z, regs := c.regs }
else some { control := p, regs := c.regs.set (↑r) (c.regs.getD (↑r) 0 - 1) }) =
some nexthi:Control.instruction c.control = Control.Instr.halt⊢ next.control ∈ nextControls Control.Instr.halt simp only [hi] at hhaltc:Control.Cfgnext:Control.Cfghi:Control.instruction c.control = Control.Instr.halth:none = some next⊢ next.control ∈ nextControls Control.Instr.halt; cases hAll goals completed! 🐙
| jump n =>jumpc:Control.Cfgnext:Control.Cfgh:(match Control.instruction c.control with
| Control.Instr.halt => none
| Control.Instr.jump n => some { control := n, regs := c.regs }
| Control.Instr.inc r n => some { control := n, regs := c.regs.set (↑r) (c.regs.getD (↑r) 0 + 1) }
| Control.Instr.decnz r p z =>
if (c.regs.getD (↑r) 0 == 0) = true then some { control := z, regs := c.regs }
else some { control := p, regs := c.regs.set (↑r) (c.regs.getD (↑r) 0 - 1) }) =
some nextn:ControlWordhi:Control.instruction c.control = Control.Instr.jump n⊢ next.control ∈ nextControls (Control.Instr.jump n) simp only [hi] at hjumpc:Control.Cfgnext:Control.Cfgn:ControlWordhi:Control.instruction c.control = Control.Instr.jump nh:some { control := n, regs := c.regs } = some next⊢ next.control ∈ nextControls (Control.Instr.jump n); cases hjump.reflc:Control.Cfgn:ControlWordhi:Control.instruction c.control = Control.Instr.jump n⊢ { control := n, regs := c.regs }.control ∈ nextControls (Control.Instr.jump n); simp [nextControls]All goals completed! 🐙
| inc r n =>incc:Control.Cfgnext:Control.Cfgh:(match Control.instruction c.control with
| Control.Instr.halt => none
| Control.Instr.jump n => some { control := n, regs := c.regs }
| Control.Instr.inc r n => some { control := n, regs := c.regs.set (↑r) (c.regs.getD (↑r) 0 + 1) }
| Control.Instr.decnz r p z =>
if (c.regs.getD (↑r) 0 == 0) = true then some { control := z, regs := c.regs }
else some { control := p, regs := c.regs.set (↑r) (c.regs.getD (↑r) 0 - 1) }) =
some nextr:Fin 5n:ControlWordhi:Control.instruction c.control = Control.Instr.inc r n⊢ next.control ∈ nextControls (Control.Instr.inc r n) simp only [hi] at hincc:Control.Cfgnext:Control.Cfgr:Fin 5n:ControlWordhi:Control.instruction c.control = Control.Instr.inc r nh:some { control := n, regs := c.regs.set (↑r) (c.regs.getD (↑r) 0 + 1) } = some next⊢ next.control ∈ nextControls (Control.Instr.inc r n); cases hinc.reflc:Control.Cfgr:Fin 5n:ControlWordhi:Control.instruction c.control = Control.Instr.inc r n⊢ { control := n, regs := c.regs.set (↑r) (c.regs.getD (↑r) 0 + 1) }.control ∈ nextControls (Control.Instr.inc r n); simp [nextControls]All goals completed! 🐙
| decnz r p z =>decnzc:Control.Cfgnext:Control.Cfgh:(match Control.instruction c.control with
| Control.Instr.halt => none
| Control.Instr.jump n => some { control := n, regs := c.regs }
| Control.Instr.inc r n => some { control := n, regs := c.regs.set (↑r) (c.regs.getD (↑r) 0 + 1) }
| Control.Instr.decnz r p z =>
if (c.regs.getD (↑r) 0 == 0) = true then some { control := z, regs := c.regs }
else some { control := p, regs := c.regs.set (↑r) (c.regs.getD (↑r) 0 - 1) }) =
some nextr:Fin 5p:ControlWordz:ControlWordhi:Control.instruction c.control = Control.Instr.decnz r p z⊢ next.control ∈ nextControls (Control.Instr.decnz r p z)
simp only [hi] at hdecnzc:Control.Cfgnext:Control.Cfgr:Fin 5p:ControlWordz:ControlWordhi:Control.instruction c.control = Control.Instr.decnz r p zh:(if (c.regs.getD (↑r) 0 == 0) = true then some { control := z, regs := c.regs }
else some { control := p, regs := c.regs.set (↑r) (c.regs.getD (↑r) 0 - 1) }) =
some next⊢ next.control ∈ nextControls (Control.Instr.decnz r p z)
split at hdecnz.isTruec:Control.Cfgnext:Control.Cfgr:Fin 5p:ControlWordz:ControlWordhi:Control.instruction c.control = Control.Instr.decnz r p zh✝:(c.regs.getD (↑r) 0 == 0) = trueh:some { control := z, regs := c.regs } = some next⊢ next.control ∈ nextControls (Control.Instr.decnz r p z)decnz.isFalsec:Control.Cfgnext:Control.Cfgr:Fin 5p:ControlWordz:ControlWordhi:Control.instruction c.control = Control.Instr.decnz r p zh✝:¬(c.regs.getD (↑r) 0 == 0) = trueh:some { control := p, regs := c.regs.set (↑r) (c.regs.getD (↑r) 0 - 1) } = some next⊢ next.control ∈ nextControls (Control.Instr.decnz r p z) <;>decnz.isTruec:Control.Cfgnext:Control.Cfgr:Fin 5p:ControlWordz:ControlWordhi:Control.instruction c.control = Control.Instr.decnz r p zh✝:(c.regs.getD (↑r) 0 == 0) = trueh:some { control := z, regs := c.regs } = some next⊢ next.control ∈ nextControls (Control.Instr.decnz r p z)decnz.isFalsec:Control.Cfgnext:Control.Cfgr:Fin 5p:ControlWordz:ControlWordhi:Control.instruction c.control = Control.Instr.decnz r p zh✝:¬(c.regs.getD (↑r) 0 == 0) = trueh:some { control := p, regs := c.regs.set (↑r) (c.regs.getD (↑r) 0 - 1) } = some next⊢ next.control ∈ nextControls (Control.Instr.decnz r p z) cases hdecnz.isFalse.reflc:Control.Cfgr:Fin 5p:ControlWordz:ControlWordhi:Control.instruction c.control = Control.Instr.decnz r p zh✝:¬(c.regs.getD (↑r) 0 == 0) = true⊢ { control := p, regs := c.regs.set (↑r) (c.regs.getD (↑r) 0 - 1) }.control ∈ nextControls (Control.Instr.decnz r p z) <;>decnz.isTrue.reflc:Control.Cfgr:Fin 5p:ControlWordz:ControlWordhi:Control.instruction c.control = Control.Instr.decnz r p zh✝:(c.regs.getD (↑r) 0 == 0) = true⊢ { control := z, regs := c.regs }.control ∈ nextControls (Control.Instr.decnz r p z)decnz.isFalse.reflc:Control.Cfgr:Fin 5p:ControlWordz:ControlWordhi:Control.instruction c.control = Control.Instr.decnz r p zh✝:¬(c.regs.getD (↑r) 0 == 0) = true⊢ { control := p, regs := c.regs.set (↑r) (c.regs.getD (↑r) 0 - 1) }.control ∈ nextControls (Control.Instr.decnz r p z) simp [nextControls]All goals completed! 🐙theorem preStep_closed (c next : Control.Cfg) (hc : InPrewidth c.control)
(h : preStep c = some next) : InPrewidth next.control := byc:Control.Cfgnext:Control.Cfghc:InPrewidth c.controlh:preStep c = some next⊢ InPrewidth next.control
cases hctrl : c.control with
| entry d =>entryc:Control.Cfgnext:Control.Cfghc:InPrewidth c.controlh:preStep c = some nextd:ℕhctrl:c.control = ControlWord.entry d⊢ InPrewidth next.control simp only [hctrl,InPrewidth] at hcAll goals completed! 🐙
| local d s =>localc:Control.Cfgnext:Control.Cfghc:InPrewidth c.controlh:preStep c = some nextd:ℕs:Fin 22hctrl:c.control = ControlWord.local d s⊢ InPrewidth next.control simp only [hctrl,InPrewidth] at hcAll goals completed! 🐙
| outside i =>outsidec:Control.Cfgnext:Control.Cfghc:InPrewidth c.controlh:preStep c = some nexti:Fin 97hctrl:c.control = ControlWord.outside i⊢ InPrewidth next.control
rw [hctrloutsidec:Control.Cfgnext:Control.Cfgh:preStep c = some nexti:Fin 97hc:InPrewidth (ControlWord.outside i)hctrl:c.control = ControlWord.outside i⊢ InPrewidth next.control] at hcoutsidec:Control.Cfgnext:Control.Cfgh:preStep c = some nexti:Fin 97hc:InPrewidth (ControlWord.outside i)hctrl:c.control = ControlWord.outside i⊢ InPrewidth next.control
change 3 ≤ i.val ∧ i.val < 89 at hcoutsidec:Control.Cfgnext:Control.Cfgh:preStep c = some nexti:Fin 97hctrl:c.control = ControlWord.outside ihc:3 ≤ ↑i ∧ ↑i < 89⊢ InPrewidth next.control
have hcut : c.control ≠ .outside 88 := by
intro hec:Control.Cfgnext:Control.Cfgh:preStep c = some nexti:Fin 97hctrl:c.control = ControlWord.outside ihc:3 ≤ ↑i ∧ ↑i < 89he:c.control = ControlWord.outside 88⊢ False
simp only [preStep,he,ite_true] at hc:Control.Cfgnext:Control.Cfgi:Fin 97hctrl:c.control = ControlWord.outside ihc:3 ≤ ↑i ∧ ↑i < 89he:c.control = ControlWord.outside 88h:none = some next⊢ False
cases houtsidec:Control.Cfgnext:Control.Cfgh:preStep c = some nexti:Fin 97hctrl:c.control = ControlWord.outside ihc:3 ≤ ↑i ∧ ↑i < 89hcut:c.control ≠ ControlWord.outside 88⊢ InPrewidth next.control
have hi : i.val ≠ 88 := by
intro hvc:Control.Cfgnext:Control.Cfgh:preStep c = some nexti:Fin 97hctrl:c.control = ControlWord.outside ihc:3 ≤ ↑i ∧ ↑i < 89hcut:c.control ≠ ControlWord.outside 88hv:↑i = 88⊢ False
apply hcutc:Control.Cfgnext:Control.Cfgh:preStep c = some nexti:Fin 97hctrl:c.control = ControlWord.outside ihc:3 ≤ ↑i ∧ ↑i < 89hcut:c.control ≠ ControlWord.outside 88hv:↑i = 88⊢ c.control = ControlWord.outside 88
rw [hctrlc:Control.Cfgnext:Control.Cfgh:preStep c = some nexti:Fin 97hctrl:c.control = ControlWord.outside ihc:3 ≤ ↑i ∧ ↑i < 89hcut:c.control ≠ ControlWord.outside 88hv:↑i = 88⊢ ControlWord.outside i = ControlWord.outside 88]c:Control.Cfgnext:Control.Cfgh:preStep c = some nexti:Fin 97hctrl:c.control = ControlWord.outside ihc:3 ≤ ↑i ∧ ↑i < 89hcut:c.control ≠ ControlWord.outside 88hv:↑i = 88⊢ ControlWord.outside i = ControlWord.outside 88
congr 1c:Control.Cfgnext:Control.Cfgh:preStep c = some nexti:Fin 97hctrl:c.control = ControlWord.outside ihc:3 ≤ ↑i ∧ ↑i < 89hcut:c.control ≠ ControlWord.outside 88hv:↑i = 88⊢ i = 88
exact Fin.ext hvoutsidec:Control.Cfgnext:Control.Cfgh:preStep c = some nexti:Fin 97hctrl:c.control = ControlWord.outside ihc:3 ≤ ↑i ∧ ↑i < 89hcut:c.control ≠ ControlWord.outside 88hi:↑i ≠ 88⊢ InPrewidth next.control
have hi88 : i.val < 88 := by omegaoutsidec:Control.Cfgnext:Control.Cfgh:preStep c = some nexti:Fin 97hctrl:c.control = ControlWord.outside ihc:3 ≤ ↑i ∧ ↑i < 89hcut:c.control ≠ ControlWord.outside 88hi:↑i ≠ 88hi88:↑i < 88⊢ InPrewidth next.control
let j : Fin 85 := ⟨i.val-3,byc:Control.Cfgnext:Control.Cfgh:preStep c = some nexti:Fin 97hctrl:c.control = ControlWord.outside ihc:3 ≤ ↑i ∧ ↑i < 89hcut:c.control ≠ ControlWord.outside 88hi:↑i ≠ 88hi88:↑i < 88⊢ ↑i - 3 < 85 omegaAll goals completed! 🐙⟩outsidec:Control.Cfgnext:Control.Cfgh:preStep c = some nexti:Fin 97hctrl:c.control = ControlWord.outside ihc:3 ≤ ↑i ∧ ↑i < 89hcut:c.control ≠ ControlWord.outside 88hi:↑i ≠ 88hi88:↑i < 88j:Fin 85 := ⟨↑i - 3, ⋯⟩⊢ InPrewidth next.control
have hj : ctl85 j = i := by apply Fin.extc:Control.Cfgnext:Control.Cfgh:preStep c = some nexti:Fin 97hctrl:c.control = ControlWord.outside ihc:3 ≤ ↑i ∧ ↑i < 89hcut:c.control ≠ ControlWord.outside 88hi:↑i ≠ 88hi88:↑i < 88j:Fin 85 := ⟨↑i - 3, ⋯⟩⊢ ↑(ctl85 j) = ↑i; dsimp [ctl85,j]c:Control.Cfgnext:Control.Cfgh:preStep c = some nexti:Fin 97hctrl:c.control = ControlWord.outside ihc:3 ≤ ↑i ∧ ↑i < 89hcut:c.control ≠ ControlWord.outside 88hi:↑i ≠ 88hi88:↑i < 88j:Fin 85 := ⟨↑i - 3, ⋯⟩⊢ ↑i - 3 + 3 = ↑i; omegaoutsidec:Control.Cfgnext:Control.Cfgh:preStep c = some nexti:Fin 97hctrl:c.control = ControlWord.outside ihc:3 ≤ ↑i ∧ ↑i < 89hcut:c.control ≠ ControlWord.outside 88hi:↑i ≠ 88hi88:↑i < 88j:Fin 85 := ⟨↑i - 3, ⋯⟩hj:ctl85 j = i⊢ InPrewidth next.control
have hs : Control.step c = some next := by
simpa only [preStep,ite_eq_right hcut] using houtsidec:Control.Cfgnext:Control.Cfgh:preStep c = some nexti:Fin 97hctrl:c.control = ControlWord.outside ihc:3 ≤ ↑i ∧ ↑i < 89hcut:c.control ≠ ControlWord.outside 88hi:↑i ≠ 88hi88:↑i < 88j:Fin 85 := ⟨↑i - 3, ⋯⟩hj:ctl85 j = ihs:Control.step c = some next⊢ InPrewidth next.control
have hm := step_control_mem c next hsoutsidec:Control.Cfgnext:Control.Cfgh:preStep c = some nexti:Fin 97hctrl:c.control = ControlWord.outside ihc:3 ≤ ↑i ∧ ↑i < 89hcut:c.control ≠ ControlWord.outside 88hi:↑i ≠ 88hi88:↑i < 88j:Fin 85 := ⟨↑i - 3, ⋯⟩hj:ctl85 j = ihs:Control.step c = some nexthm:next.control ∈ nextControls (Control.instruction c.control)⊢ InPrewidth next.control
rw [hctrl,outsidec:Control.Cfgnext:Control.Cfgh:preStep c = some nexti:Fin 97hctrl:c.control = ControlWord.outside ihc:3 ≤ ↑i ∧ ↑i < 89hcut:c.control ≠ ControlWord.outside 88hi:↑i ≠ 88hi88:↑i < 88j:Fin 85 := ⟨↑i - 3, ⋯⟩hj:ctl85 j = ihs:Control.step c = some nexthm:next.control ∈ nextControls (Control.instruction (ControlWord.outside i))⊢ InPrewidth next.control←hjoutsidec:Control.Cfgnext:Control.Cfgh:preStep c = some nexti:Fin 97hctrl:c.control = ControlWord.outside ihc:3 ≤ ↑i ∧ ↑i < 89hcut:c.control ≠ ControlWord.outside 88hi:↑i ≠ 88hi88:↑i < 88j:Fin 85 := ⟨↑i - 3, ⋯⟩hj:ctl85 j = ihs:Control.step c = some nexthm:next.control ∈ nextControls (Control.instruction (ControlWord.outside (ctl85 j)))⊢ InPrewidth next.control] at hmoutsidec:Control.Cfgnext:Control.Cfgh:preStep c = some nexti:Fin 97hctrl:c.control = ControlWord.outside ihc:3 ≤ ↑i ∧ ↑i < 89hcut:c.control ≠ ControlWord.outside 88hi:↑i ≠ 88hi88:↑i < 88j:Fin 85 := ⟨↑i - 3, ⋯⟩hj:ctl85 j = ihs:Control.step c = some nexthm:next.control ∈ nextControls (Control.instruction (ControlWord.outside (ctl85 j)))⊢ InPrewidth next.control
exact of_decide_eq_true ((List.all_eq_true.mp (targets_match j)) _ hm)All goals completed! 🐙theorem preStep_encode (c : Control.Cfg) (hc : InPrewidth c.control)
(hlen : c.regs.length = 5) :
(preStep c).map encodeCfg = ReferencePreStep95 (encodeCfg c) := byc:Control.Cfghc:InPrewidth c.controlhlen:c.regs.length = 5⊢ Option.map encodeCfg (preStep c) = ReferencePreStep95 (encodeCfg c)
rcases c with ⟨control,regs⟩control:ControlWordregs:List ℕhc:InPrewidth { control := control, regs := regs }.controlhlen:{ control := control, regs := regs }.regs.length = 5⊢ Option.map encodeCfg (preStep { control := control, regs := regs }) =
ReferencePreStep95 (encodeCfg { control := control, regs := regs })
cases control with
| entry d =>entryregs:List ℕd:ℕhc:InPrewidth { control := ControlWord.entry d, regs := regs }.controlhlen:{ control := ControlWord.entry d, regs := regs }.regs.length = 5⊢ Option.map encodeCfg (preStep { control := ControlWord.entry d, regs := regs }) =
ReferencePreStep95 (encodeCfg { control := ControlWord.entry d, regs := regs }) cases hcAll goals completed! 🐙
| local d s =>localregs:List ℕd:ℕs:Fin 22hc:InPrewidth { control := ControlWord.local d s, regs := regs }.controlhlen:{ control := ControlWord.local d s, regs := regs }.regs.length = 5⊢ Option.map encodeCfg (preStep { control := ControlWord.local d s, regs := regs }) =
ReferencePreStep95 (encodeCfg { control := ControlWord.local d s, regs := regs }) cases hcAll goals completed! 🐙
| outside i =>outsideregs:List ℕi:Fin 97hc:InPrewidth { control := ControlWord.outside i, regs := regs }.controlhlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5⊢ Option.map encodeCfg (preStep { control := ControlWord.outside i, regs := regs }) =
ReferencePreStep95 (encodeCfg { control := ControlWord.outside i, regs := regs })
change 3 ≤ i.val ∧ i.val < 89 at hcoutsideregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89⊢ Option.map encodeCfg (preStep { control := ControlWord.outside i, regs := regs }) =
ReferencePreStep95 (encodeCfg { control := ControlWord.outside i, regs := regs })
by_cases hi : i.val = 88posregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:↑i = 88⊢ Option.map encodeCfg (preStep { control := ControlWord.outside i, regs := regs }) =
ReferencePreStep95 (encodeCfg { control := ControlWord.outside i, regs := regs })negregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88⊢ Option.map encodeCfg (preStep { control := ControlWord.outside i, regs := regs }) =
ReferencePreStep95 (encodeCfg { control := ControlWord.outside i, regs := regs })
·posregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:↑i = 88⊢ Option.map encodeCfg (preStep { control := ControlWord.outside i, regs := regs }) =
ReferencePreStep95 (encodeCfg { control := ControlWord.outside i, regs := regs }) have he : i = (88 : Fin 97) := Fin.ext hiposregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:↑i = 88he:i = 88⊢ Option.map encodeCfg (preStep { control := ControlWord.outside i, regs := regs }) =
ReferencePreStep95 (encodeCfg { control := ControlWord.outside i, regs := regs })
subst iposregs:List ℕhlen:{ control := ControlWord.outside 88, regs := regs }.regs.length = 5hc:3 ≤ ↑88 ∧ ↑88 < 89hi:↑88 = 88⊢ Option.map encodeCfg (preStep { control := ControlWord.outside 88, regs := regs }) =
ReferencePreStep95 (encodeCfg { control := ControlWord.outside 88, regs := regs })
simp [preStep,ReferencePreStep95,encodeCfg,word88_match]All goals completed! 🐙
·negregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88⊢ Option.map encodeCfg (preStep { control := ControlWord.outside i, regs := regs }) =
ReferencePreStep95 (encodeCfg { control := ControlWord.outside i, regs := regs }) have hi88 : i.val < 88 := byc:Control.Cfghc:InPrewidth c.controlhlen:c.regs.length = 5⊢ Option.map encodeCfg (preStep c) = ReferencePreStep95 (encodeCfg c) omeganegregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88⊢ Option.map encodeCfg (preStep { control := ControlWord.outside i, regs := regs }) =
ReferencePreStep95 (encodeCfg { control := ControlWord.outside i, regs := regs })
have hword := word_range i hc.2negregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)⊢ Option.map encodeCfg (preStep { control := ControlWord.outside i, regs := regs }) =
ReferencePreStep95 (encodeCfg { control := ControlWord.outside i, regs := regs })
have hword_ne : word (.outside i) ≠ ReferenceProgram.word 88 := byc:Control.Cfghc:InPrewidth c.controlhlen:c.regs.length = 5⊢ Option.map encodeCfg (preStep c) = ReferencePreStep95 (encodeCfg c)
intro heregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)he:word (ControlWord.outside i) = ReferenceProgram.word 88⊢ False
rw [hwordregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)he:ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩) = ReferenceProgram.word 88⊢ False] at heregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)he:ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩) = ReferenceProgram.word 88⊢ False
exact hi (word88_unique ⟨i.val,hc.2⟩ he)negregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88⊢ Option.map encodeCfg (preStep { control := ControlWord.outside i, regs := regs }) =
ReferencePreStep95 (encodeCfg { control := ControlWord.outside i, regs := regs })
have hctrl_ne : (ControlWord.outside i) ≠ .outside 88 := byc:Control.Cfghc:InPrewidth c.controlhlen:c.regs.length = 5⊢ Option.map encodeCfg (preStep c) = ReferencePreStep95 (encodeCfg c)
intro heregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88he:ControlWord.outside i = ControlWord.outside 88⊢ False
exact hi (congrArg Fin.val (ControlWord.outside.inj he))negregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88⊢ Option.map encodeCfg (preStep { control := ControlWord.outside i, regs := regs }) =
ReferencePreStep95 (encodeCfg { control := ControlWord.outside i, regs := regs })
have hinstr := instruction_range i hc.1 hi88negregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))⊢ Option.map encodeCfg (preStep { control := ControlWord.outside i, regs := regs }) =
ReferencePreStep95 (encodeCfg { control := ControlWord.outside i, regs := regs })
have href_index : ref89 ⟨i.val,hc.2⟩ = ref85 ⟨i.val-3,byregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))⊢ ↑i - 3 < 85 omegaAll goals completed! 🐙⟩ := byc:Control.Cfghc:InPrewidth c.controlhlen:c.regs.length = 5⊢ Option.map encodeCfg (preStep c) = ReferencePreStep95 (encodeCfg c)
apply Fin.extregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))⊢ ↑(ref89 ⟨↑i, ⋯⟩) = ↑(ref85 ⟨↑i - 3, ⋯⟩)
dsimp [ref89,ref85]regs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))⊢ ↑i = ↑i - 3 + 3
omeganegregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩⊢ Option.map encodeCfg (preStep { control := ControlWord.outside i, regs := regs }) =
ReferencePreStep95 (encodeCfg { control := ControlWord.outside i, regs := regs })
have hbase : (Control.step ⟨.outside i,regs⟩).map encodeCfg =
ReferenceProgram.step (encodeCfg ⟨.outside i,regs⟩) := byc:Control.Cfghc:InPrewidth c.controlhlen:c.regs.length = 5⊢ Option.map encodeCfg (preStep c) = ReferencePreStep95 (encodeCfg c)
have hmap : (Control.step ⟨.outside i,regs⟩).map encodeCfg =
((Control.step ⟨.outside i,regs⟩).map Control.encodeCfg).map swapCfg := byc:Control.Cfghc:InPrewidth c.controlhlen:c.regs.length = 5⊢ Option.map encodeCfg (preStep c) = ReferencePreStep95 (encodeCfg c)
rw [Option.map_mapregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩⊢ Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
Option.map (swapCfg ∘ Control.encodeCfg) (Control.step { control := ControlWord.outside i, regs := regs })]regs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩⊢ Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
Option.map (swapCfg ∘ Control.encodeCfg) (Control.step { control := ControlWord.outside i, regs := regs })
rflregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hmap:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
Option.map swapCfg (Option.map Control.encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }))⊢ Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
ReferenceProgram.step (encodeCfg { control := ControlWord.outside i, regs := regs })
rw [hmap,regs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hmap:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
Option.map swapCfg (Option.map Control.encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }))⊢ Option.map swapCfg (Option.map Control.encodeCfg (Control.step { control := ControlWord.outside i, regs := regs })) =
ReferenceProgram.step (encodeCfg { control := ControlWord.outside i, regs := regs })Control.step_encode,regs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hmap:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
Option.map swapCfg (Option.map Control.encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }))⊢ Option.map swapCfg
(Control.applyInstr (Control.rawInstr { control := ControlWord.outside i, regs := regs }.control)
{ control := ControlWord.outside i, regs := regs }.regs) =
ReferenceProgram.step (encodeCfg { control := ControlWord.outside i, regs := regs })hinstr,regs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hmap:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
Option.map swapCfg (Option.map Control.encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }))⊢ Option.map swapCfg
(Control.applyInstr (swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩)))
{ control := ControlWord.outside i, regs := regs }.regs) =
ReferenceProgram.step (encodeCfg { control := ControlWord.outside i, regs := regs })apply_swapInstr _ _ hlenregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hmap:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
Option.map swapCfg (Option.map Control.encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }))⊢ Control.applyInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))
(swapBank { control := ControlWord.outside i, regs := regs }.regs) =
ReferenceProgram.step (encodeCfg { control := ControlWord.outside i, regs := regs })]regs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hmap:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
Option.map swapCfg (Option.map Control.encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }))⊢ Control.applyInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))
(swapBank { control := ControlWord.outside i, regs := regs }.regs) =
ReferenceProgram.step (encodeCfg { control := ControlWord.outside i, regs := regs })
change Control.applyInstr (ReferenceProgram.decoded (ref85 ⟨i.val-3,byregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hmap:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
Option.map swapCfg (Option.map Control.encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }))⊢ ↑i - 3 < 85 omegaAll goals completed! 🐙⟩))
(swapBank regs) = ReferenceProgram.step ⟨word (.outside i),swapBank regs⟩
rw [hword,regs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hmap:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
Option.map swapCfg (Option.map Control.encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }))⊢ Control.applyInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩)) (swapBank regs) =
ReferenceProgram.step { stack := ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩), regs := swapBank regs }href_indexregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hmap:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
Option.map swapCfg (Option.map Control.encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }))⊢ Control.applyInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩)) (swapBank regs) =
ReferenceProgram.step { stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }]regs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hmap:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
Option.map swapCfg (Option.map Control.encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }))⊢ Control.applyInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩)) (swapBank regs) =
ReferenceProgram.step { stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }
unfold ReferenceProgram.stepregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hmap:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
Option.map swapCfg (Option.map Control.encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }))⊢ Control.applyInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩)) (swapBank regs) =
match
ReferenceProgram.instruction
{ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.stack with
| Riemann120.Layer2.RhInstr.halt => none
| Riemann120.Layer2.RhInstr.jump target =>
some { stack := target, regs := { stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs }
| Riemann120.Layer2.RhInstr.inc r target =>
some
{ stack := target,
regs :=
{ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.set r
({ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.getD r 0 + 1) }
| Riemann120.Layer2.RhInstr.decnz r positive zero =>
if ({ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.getD r 0 == 0) = true then
some { stack := zero, regs := { stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs }
else
some
{ stack := positive,
regs :=
{ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.set r
({ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.getD r 0 - 1) }
rw [ReferenceProgram.instruction_wordregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hmap:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
Option.map swapCfg (Option.map Control.encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }))⊢ Control.applyInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩)) (swapBank regs) =
match ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩) with
| Riemann120.Layer2.RhInstr.halt => none
| Riemann120.Layer2.RhInstr.jump target =>
some { stack := target, regs := { stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs }
| Riemann120.Layer2.RhInstr.inc r target =>
some
{ stack := target,
regs :=
{ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.set r
({ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.getD r 0 + 1) }
| Riemann120.Layer2.RhInstr.decnz r positive zero =>
if ({ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.getD r 0 == 0) = true then
some { stack := zero, regs := { stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs }
else
some
{ stack := positive,
regs :=
{ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.set r
({ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.getD r 0 - 1) }]regs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hmap:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
Option.map swapCfg (Option.map Control.encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }))⊢ Control.applyInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩)) (swapBank regs) =
match ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩) with
| Riemann120.Layer2.RhInstr.halt => none
| Riemann120.Layer2.RhInstr.jump target =>
some { stack := target, regs := { stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs }
| Riemann120.Layer2.RhInstr.inc r target =>
some
{ stack := target,
regs :=
{ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.set r
({ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.getD r 0 + 1) }
| Riemann120.Layer2.RhInstr.decnz r positive zero =>
if ({ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.getD r 0 == 0) = true then
some { stack := zero, regs := { stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs }
else
some
{ stack := positive,
regs :=
{ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.set r
({ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.getD r 0 - 1) }
cases ReferenceProgram.decoded (ref85 ⟨i.val-3,byregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hmap:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
Option.map swapCfg (Option.map Control.encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }))⊢ ↑i - 3 < 85 omegaAll goals completed! 🐙⟩) <;>haltregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hmap:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
Option.map swapCfg (Option.map Control.encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }))⊢ Control.applyInstr Riemann120.Layer2.RhInstr.halt (swapBank regs) =
match Riemann120.Layer2.RhInstr.halt with
| Riemann120.Layer2.RhInstr.halt => none
| Riemann120.Layer2.RhInstr.jump target =>
some { stack := target, regs := { stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs }
| Riemann120.Layer2.RhInstr.inc r target =>
some
{ stack := target,
regs :=
{ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.set r
({ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.getD r 0 + 1) }
| Riemann120.Layer2.RhInstr.decnz r positive zero =>
if ({ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.getD r 0 == 0) = true then
some { stack := zero, regs := { stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs }
else
some
{ stack := positive,
regs :=
{ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.set r
({ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.getD r 0 - 1) }jumpregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hmap:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
Option.map swapCfg (Option.map Control.encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }))stack'✝:List (Fin 2)⊢ Control.applyInstr (Riemann120.Layer2.RhInstr.jump stack'✝) (swapBank regs) =
match Riemann120.Layer2.RhInstr.jump stack'✝ with
| Riemann120.Layer2.RhInstr.halt => none
| Riemann120.Layer2.RhInstr.jump target =>
some { stack := target, regs := { stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs }
| Riemann120.Layer2.RhInstr.inc r target =>
some
{ stack := target,
regs :=
{ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.set r
({ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.getD r 0 + 1) }
| Riemann120.Layer2.RhInstr.decnz r positive zero =>
if ({ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.getD r 0 == 0) = true then
some { stack := zero, regs := { stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs }
else
some
{ stack := positive,
regs :=
{ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.set r
({ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.getD r 0 - 1) }incregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hmap:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
Option.map swapCfg (Option.map Control.encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }))r✝:ℕstack_succ✝:List (Fin 2)⊢ Control.applyInstr (Riemann120.Layer2.RhInstr.inc r✝ stack_succ✝) (swapBank regs) =
match Riemann120.Layer2.RhInstr.inc r✝ stack_succ✝ with
| Riemann120.Layer2.RhInstr.halt => none
| Riemann120.Layer2.RhInstr.jump target =>
some { stack := target, regs := { stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs }
| Riemann120.Layer2.RhInstr.inc r target =>
some
{ stack := target,
regs :=
{ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.set r
({ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.getD r 0 + 1) }
| Riemann120.Layer2.RhInstr.decnz r positive zero =>
if ({ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.getD r 0 == 0) = true then
some { stack := zero, regs := { stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs }
else
some
{ stack := positive,
regs :=
{ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.set r
({ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.getD r 0 - 1) }decnzregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hmap:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
Option.map swapCfg (Option.map Control.encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }))r✝:ℕstack_succ✝:List (Fin 2)stack_fail✝:List (Fin 2)⊢ Control.applyInstr (Riemann120.Layer2.RhInstr.decnz r✝ stack_succ✝ stack_fail✝) (swapBank regs) =
match Riemann120.Layer2.RhInstr.decnz r✝ stack_succ✝ stack_fail✝ with
| Riemann120.Layer2.RhInstr.halt => none
| Riemann120.Layer2.RhInstr.jump target =>
some { stack := target, regs := { stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs }
| Riemann120.Layer2.RhInstr.inc r target =>
some
{ stack := target,
regs :=
{ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.set r
({ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.getD r 0 + 1) }
| Riemann120.Layer2.RhInstr.decnz r positive zero =>
if ({ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.getD r 0 == 0) = true then
some { stack := zero, regs := { stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs }
else
some
{ stack := positive,
regs :=
{ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.set r
({ stack := ReferenceProgram.word (ref85 ⟨↑i - 3, ⋯⟩), regs := swapBank regs }.regs.getD r 0 - 1) } rflnegregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hbase:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
ReferenceProgram.step (encodeCfg { control := ControlWord.outside i, regs := regs })⊢ Option.map encodeCfg (preStep { control := ControlWord.outside i, regs := regs }) =
ReferencePreStep95 (encodeCfg { control := ControlWord.outside i, regs := regs })
have hpre : preStep ⟨.outside i,regs⟩ = Control.step ⟨.outside i,regs⟩ := byc:Control.Cfghc:InPrewidth c.controlhlen:c.regs.length = 5⊢ Option.map encodeCfg (preStep c) = ReferencePreStep95 (encodeCfg c)
unfold preStepregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hbase:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
ReferenceProgram.step (encodeCfg { control := ControlWord.outside i, regs := regs })⊢ (if { control := ControlWord.outside i, regs := regs }.control = ControlWord.outside 88 then none
else Control.step { control := ControlWord.outside i, regs := regs }) =
Control.step { control := ControlWord.outside i, regs := regs }
exact ite_eq_right hctrl_nenegregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hbase:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
ReferenceProgram.step (encodeCfg { control := ControlWord.outside i, regs := regs })hpre:preStep { control := ControlWord.outside i, regs := regs } =
Control.step { control := ControlWord.outside i, regs := regs }⊢ Option.map encodeCfg (preStep { control := ControlWord.outside i, regs := regs }) =
ReferencePreStep95 (encodeCfg { control := ControlWord.outside i, regs := regs })
have href : ReferencePreStep95 (encodeCfg ⟨.outside i,regs⟩) =
ReferenceProgram.step (encodeCfg ⟨.outside i,regs⟩) := byc:Control.Cfghc:InPrewidth c.controlhlen:c.regs.length = 5⊢ Option.map encodeCfg (preStep c) = ReferencePreStep95 (encodeCfg c)
unfold ReferencePreStep95regs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hbase:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
ReferenceProgram.step (encodeCfg { control := ControlWord.outside i, regs := regs })hpre:preStep { control := ControlWord.outside i, regs := regs } =
Control.step { control := ControlWord.outside i, regs := regs }⊢ (if (encodeCfg { control := ControlWord.outside i, regs := regs }).stack = ReferenceProgram.word 88 then none
else ReferenceProgram.step (encodeCfg { control := ControlWord.outside i, regs := regs })) =
ReferenceProgram.step (encodeCfg { control := ControlWord.outside i, regs := regs })
exact ite_eq_right hword_nenegregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hbase:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
ReferenceProgram.step (encodeCfg { control := ControlWord.outside i, regs := regs })hpre:preStep { control := ControlWord.outside i, regs := regs } =
Control.step { control := ControlWord.outside i, regs := regs }href:ReferencePreStep95 (encodeCfg { control := ControlWord.outside i, regs := regs }) =
ReferenceProgram.step (encodeCfg { control := ControlWord.outside i, regs := regs })⊢ Option.map encodeCfg (preStep { control := ControlWord.outside i, regs := regs }) =
ReferencePreStep95 (encodeCfg { control := ControlWord.outside i, regs := regs })
rw [hpre,negregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hbase:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
ReferenceProgram.step (encodeCfg { control := ControlWord.outside i, regs := regs })hpre:preStep { control := ControlWord.outside i, regs := regs } =
Control.step { control := ControlWord.outside i, regs := regs }href:ReferencePreStep95 (encodeCfg { control := ControlWord.outside i, regs := regs }) =
ReferenceProgram.step (encodeCfg { control := ControlWord.outside i, regs := regs })⊢ Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
ReferencePreStep95 (encodeCfg { control := ControlWord.outside i, regs := regs })hrefnegregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hbase:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
ReferenceProgram.step (encodeCfg { control := ControlWord.outside i, regs := regs })hpre:preStep { control := ControlWord.outside i, regs := regs } =
Control.step { control := ControlWord.outside i, regs := regs }href:ReferencePreStep95 (encodeCfg { control := ControlWord.outside i, regs := regs }) =
ReferenceProgram.step (encodeCfg { control := ControlWord.outside i, regs := regs })⊢ Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
ReferenceProgram.step (encodeCfg { control := ControlWord.outside i, regs := regs })]negregs:List ℕi:Fin 97hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hi:¬↑i = 88hi88:↑i < 88hword:word (ControlWord.outside i) = ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩)hword_ne:word (ControlWord.outside i) ≠ ReferenceProgram.word 88hctrl_ne:ControlWord.outside i ≠ ControlWord.outside 88hinstr:Control.rawInstr (ControlWord.outside i) = swapInstr (ReferenceProgram.decoded (ref85 ⟨↑i - 3, ⋯⟩))href_index:ref89 ⟨↑i, ⋯⟩ = ref85 ⟨↑i - 3, ⋯⟩hbase:Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
ReferenceProgram.step (encodeCfg { control := ControlWord.outside i, regs := regs })hpre:preStep { control := ControlWord.outside i, regs := regs } =
Control.step { control := ControlWord.outside i, regs := regs }href:ReferencePreStep95 (encodeCfg { control := ControlWord.outside i, regs := regs }) =
ReferenceProgram.step (encodeCfg { control := ControlWord.outside i, regs := regs })⊢ Option.map encodeCfg (Control.step { control := ControlWord.outside i, regs := regs }) =
ReferenceProgram.step (encodeCfg { control := ControlWord.outside i, regs := regs })
exact hbaseAll goals completed! 🐙theorem edge_transport (c : Control.Cfg) (next : RhRegCfg) (hc : InPrewidth c.control)
(hlen : c.regs.length = 5) (h : ReferencePreStep95 (encodeCfg c) = some next) :
∃ target : Control.Cfg, Control.BoundedEdge 19 c target ∧ encodeCfg target = next ∧
InPrewidth target.control ∧ target.regs.length = 5 := byc:Control.Cfgnext:RhRegCfghc:InPrewidth c.controlhlen:c.regs.length = 5h:ReferencePreStep95 (encodeCfg c) = some next⊢ ∃ target, Control.BoundedEdge 19 c target ∧ encodeCfg target = next ∧ InPrewidth target.control ∧ target.regs.length = 5
have hm := (preStep_encode c hc hlen).trans hc:Control.Cfgnext:RhRegCfghc:InPrewidth c.controlhlen:c.regs.length = 5h:ReferencePreStep95 (encodeCfg c) = some nexthm:Option.map encodeCfg (preStep c) = some next⊢ ∃ target, Control.BoundedEdge 19 c target ∧ encodeCfg target = next ∧ InPrewidth target.control ∧ target.regs.length = 5
cases hs : preStep c with
| none =>nonec:Control.Cfgnext:RhRegCfghc:InPrewidth c.controlhlen:c.regs.length = 5h:ReferencePreStep95 (encodeCfg c) = some nexthm:Option.map encodeCfg (preStep c) = some nexths:preStep c = none⊢ ∃ target, Control.BoundedEdge 19 c target ∧ encodeCfg target = next ∧ InPrewidth target.control ∧ target.regs.length = 5 simp only [hs,Option.map_none] at hmnonec:Control.Cfgnext:RhRegCfghc:InPrewidth c.controlhlen:c.regs.length = 5h:ReferencePreStep95 (encodeCfg c) = some nexths:preStep c = nonehm:none = some next⊢ ∃ target, Control.BoundedEdge 19 c target ∧ encodeCfg target = next ∧ InPrewidth target.control ∧ target.regs.length = 5; cases hmAll goals completed! 🐙
| some target =>somec:Control.Cfgnext:RhRegCfghc:InPrewidth c.controlhlen:c.regs.length = 5h:ReferencePreStep95 (encodeCfg c) = some nexthm:Option.map encodeCfg (preStep c) = some nexttarget:Control.Cfghs:preStep c = some target⊢ ∃ target, Control.BoundedEdge 19 c target ∧ encodeCfg target = next ∧ InPrewidth target.control ∧ target.regs.length = 5
have he : encodeCfg target = next := by
simpa only [hs,Option.map_some,Option.some.injEq] using hmsomec:Control.Cfgnext:RhRegCfghc:InPrewidth c.controlhlen:c.regs.length = 5h:ReferencePreStep95 (encodeCfg c) = some nexthm:Option.map encodeCfg (preStep c) = some nexttarget:Control.Cfghs:preStep c = some targethe:encodeCfg target = next⊢ ∃ target, Control.BoundedEdge 19 c target ∧ encodeCfg target = next ∧ InPrewidth target.control ∧ target.regs.length = 5
have ht := preStep_closed c target hc hssomec:Control.Cfgnext:RhRegCfghc:InPrewidth c.controlhlen:c.regs.length = 5h:ReferencePreStep95 (encodeCfg c) = some nexthm:Option.map encodeCfg (preStep c) = some nexttarget:Control.Cfghs:preStep c = some targethe:encodeCfg target = nextht:InPrewidth target.control⊢ ∃ target, Control.BoundedEdge 19 c target ∧ encodeCfg target = next ∧ InPrewidth target.control ∧ target.regs.length = 5
have hstep : Control.step c = some target := by
unfold preStep at hsc:Control.Cfgnext:RhRegCfghc:InPrewidth c.controlhlen:c.regs.length = 5h:ReferencePreStep95 (encodeCfg c) = some nexthm:Option.map encodeCfg (preStep c) = some nexttarget:Control.Cfghs:(if c.control = ControlWord.outside 88 then none else Control.step c) = some targethe:encodeCfg target = nextht:InPrewidth target.control⊢ Control.step c = some target
split at hsisTruec:Control.Cfgnext:RhRegCfghc:InPrewidth c.controlhlen:c.regs.length = 5h:ReferencePreStep95 (encodeCfg c) = some nexthm:Option.map encodeCfg (preStep c) = some nexttarget:Control.Cfghe:encodeCfg target = nextht:InPrewidth target.controlh✝:c.control = ControlWord.outside 88hs:none = some target⊢ Control.step c = some targetisFalsec:Control.Cfgnext:RhRegCfghc:InPrewidth c.controlhlen:c.regs.length = 5h:ReferencePreStep95 (encodeCfg c) = some nexthm:Option.map encodeCfg (preStep c) = some nexttarget:Control.Cfghe:encodeCfg target = nextht:InPrewidth target.controlh✝:¬c.control = ControlWord.outside 88hs:Control.step c = some target⊢ Control.step c = some target
·isTruec:Control.Cfgnext:RhRegCfghc:InPrewidth c.controlhlen:c.regs.length = 5h:ReferencePreStep95 (encodeCfg c) = some nexthm:Option.map encodeCfg (preStep c) = some nexttarget:Control.Cfghe:encodeCfg target = nextht:InPrewidth target.controlh✝:c.control = ControlWord.outside 88hs:none = some target⊢ Control.step c = some target cases hsAll goals completed! 🐙
·isFalsec:Control.Cfgnext:RhRegCfghc:InPrewidth c.controlhlen:c.regs.length = 5h:ReferencePreStep95 (encodeCfg c) = some nexthm:Option.map encodeCfg (preStep c) = some nexttarget:Control.Cfghe:encodeCfg target = nextht:InPrewidth target.controlh✝:¬c.control = ControlWord.outside 88hs:Control.step c = some target⊢ Control.step c = some target exact hssomec:Control.Cfgnext:RhRegCfghc:InPrewidth c.controlhlen:c.regs.length = 5h:ReferencePreStep95 (encodeCfg c) = some nexthm:Option.map encodeCfg (preStep c) = some nexttarget:Control.Cfghs:preStep c = some targethe:encodeCfg target = nextht:InPrewidth target.controlhstep:Control.step c = some target⊢ ∃ target, Control.BoundedEdge 19 c target ∧ encodeCfg target = next ∧ InPrewidth target.control ∧ target.regs.length = 5
have hbound : (Control.walked c.control).length + 3 ≤ 19 := by
cases hctrl : c.control with
| entry d =>entryc:Control.Cfgnext:RhRegCfghc:InPrewidth c.controlhlen:c.regs.length = 5h:ReferencePreStep95 (encodeCfg c) = some nexthm:Option.map encodeCfg (preStep c) = some nexttarget:Control.Cfghs:preStep c = some targethe:encodeCfg target = nextht:InPrewidth target.controlhstep:Control.step c = some targetd:ℕhctrl:c.control = ControlWord.entry d⊢ List.length (Control.walked (ControlWord.entry d)) + 3 ≤ 19 simp only [hctrl,InPrewidth] at hcAll goals completed! 🐙
| local d s =>localc:Control.Cfgnext:RhRegCfghc:InPrewidth c.controlhlen:c.regs.length = 5h:ReferencePreStep95 (encodeCfg c) = some nexthm:Option.map encodeCfg (preStep c) = some nexttarget:Control.Cfghs:preStep c = some targethe:encodeCfg target = nextht:InPrewidth target.controlhstep:Control.step c = some targetd:ℕs:Fin 22hctrl:c.control = ControlWord.local d s⊢ List.length (Control.walked (ControlWord.local d s)) + 3 ≤ 19 simp only [hctrl,InPrewidth] at hcAll goals completed! 🐙
| outside i =>outsidec:Control.Cfgnext:RhRegCfghc:InPrewidth c.controlhlen:c.regs.length = 5h:ReferencePreStep95 (encodeCfg c) = some nexthm:Option.map encodeCfg (preStep c) = some nexttarget:Control.Cfghs:preStep c = some targethe:encodeCfg target = nextht:InPrewidth target.controlhstep:Control.step c = some targeti:Fin 97hctrl:c.control = ControlWord.outside i⊢ List.length (Control.walked (ControlWord.outside i)) + 3 ≤ 19
have hl := outsideWalk_length ioutsidec:Control.Cfgnext:RhRegCfghc:InPrewidth c.controlhlen:c.regs.length = 5h:ReferencePreStep95 (encodeCfg c) = some nexthm:Option.map encodeCfg (preStep c) = some nexttarget:Control.Cfghs:preStep c = some targethe:encodeCfg target = nextht:InPrewidth target.controlhstep:Control.step c = some targeti:Fin 97hctrl:c.control = ControlWord.outside ihl:List.length (outsideWalk i) ≤ 16⊢ List.length (Control.walked (ControlWord.outside i)) + 3 ≤ 19
change (outsideWalk i).length + 3 ≤ 19outsidec:Control.Cfgnext:RhRegCfghc:InPrewidth c.controlhlen:c.regs.length = 5h:ReferencePreStep95 (encodeCfg c) = some nexthm:Option.map encodeCfg (preStep c) = some nexttarget:Control.Cfghs:preStep c = some targethe:encodeCfg target = nextht:InPrewidth target.controlhstep:Control.step c = some targeti:Fin 97hctrl:c.control = ControlWord.outside ihl:List.length (outsideWalk i) ≤ 16⊢ List.length (outsideWalk i) + 3 ≤ 19
omegasomec:Control.Cfgnext:RhRegCfghc:InPrewidth c.controlhlen:c.regs.length = 5h:ReferencePreStep95 (encodeCfg c) = some nexthm:Option.map encodeCfg (preStep c) = some nexttarget:Control.Cfghs:preStep c = some targethe:encodeCfg target = nextht:InPrewidth target.controlhstep:Control.step c = some targethbound:List.length (Control.walked c.control) + 3 ≤ 19⊢ ∃ target, Control.BoundedEdge 19 c target ∧ encodeCfg target = next ∧ InPrewidth target.control ∧ target.regs.length = 5
exact ⟨target,⟨hstep,hbound⟩,he,ht,(Control.step_regs_length c target hstep).trans hlen⟩All goals completed! 🐙theorem trace_transport {a b : RhRegCfg}
(h : StateTransition.Reaches₁ ReferencePreStep95 a b)
(c : Control.Cfg) (he : encodeCfg c = a) (hc : InPrewidth c.control)
(hlen : c.regs.length = 5) :
∃ target : Control.Cfg, Relation.TransGen (Control.BoundedEdge 19) c target ∧
encodeCfg target = b ∧ InPrewidth target.control ∧ target.regs.length = 5 := bya:RhRegCfgb:RhRegCfgh:StateTransition.Reaches₁ ReferencePreStep95 a bc:Control.Cfghe:encodeCfg c = ahc:InPrewidth c.controlhlen:c.regs.length = 5⊢ ∃ target,
Relation.TransGen (Control.BoundedEdge 19) c target ∧
encodeCfg target = b ∧ InPrewidth target.control ∧ target.regs.length = 5
induction h generalizing c with
| @single b hs =>singlea:RhRegCfgb✝:RhRegCfgb:RhRegCfghs:b ∈ ReferencePreStep95 ac:Control.Cfghe:encodeCfg c = ahc:InPrewidth c.controlhlen:c.regs.length = 5⊢ ∃ target,
Relation.TransGen (Control.BoundedEdge 19) c target ∧
encodeCfg target = b ∧ InPrewidth target.control ∧ target.regs.length = 5
have hs' : ReferencePreStep95 a = some b := bya:RhRegCfgb:RhRegCfgh:StateTransition.Reaches₁ ReferencePreStep95 a bc:Control.Cfghe:encodeCfg c = ahc:InPrewidth c.controlhlen:c.regs.length = 5⊢ ∃ target,
Relation.TransGen (Control.BoundedEdge 19) c target ∧
encodeCfg target = b ∧ InPrewidth target.control ∧ target.regs.length = 5 simpa only [Option.mem_def] using hssinglea:RhRegCfgb✝:RhRegCfgb:RhRegCfghs:b ∈ ReferencePreStep95 ac:Control.Cfghe:encodeCfg c = ahc:InPrewidth c.controlhlen:c.regs.length = 5hs':ReferencePreStep95 a = some b⊢ ∃ target,
Relation.TransGen (Control.BoundedEdge 19) c target ∧
encodeCfg target = b ∧ InPrewidth target.control ∧ target.regs.length = 5
rw [←hesinglea:RhRegCfgb✝:RhRegCfgb:RhRegCfghs:b ∈ ReferencePreStep95 ac:Control.Cfghe:encodeCfg c = ahc:InPrewidth c.controlhlen:c.regs.length = 5hs':ReferencePreStep95 (encodeCfg c) = some b⊢ ∃ target,
Relation.TransGen (Control.BoundedEdge 19) c target ∧
encodeCfg target = b ∧ InPrewidth target.control ∧ target.regs.length = 5] at hs'singlea:RhRegCfgb✝:RhRegCfgb:RhRegCfghs:b ∈ ReferencePreStep95 ac:Control.Cfghe:encodeCfg c = ahc:InPrewidth c.controlhlen:c.regs.length = 5hs':ReferencePreStep95 (encodeCfg c) = some b⊢ ∃ target,
Relation.TransGen (Control.BoundedEdge 19) c target ∧
encodeCfg target = b ∧ InPrewidth target.control ∧ target.regs.length = 5
obtain ⟨target,ht,he',hc',hl'⟩ := edge_transport c b hc hlen hs'singlea:RhRegCfgb✝:RhRegCfgb:RhRegCfghs:b ∈ ReferencePreStep95 ac:Control.Cfghe:encodeCfg c = ahc:InPrewidth c.controlhlen:c.regs.length = 5hs':ReferencePreStep95 (encodeCfg c) = some btarget:Control.Cfght:Control.BoundedEdge 19 c targethe':encodeCfg target = bhc':InPrewidth target.controlhl':target.regs.length = 5⊢ ∃ target,
Relation.TransGen (Control.BoundedEdge 19) c target ∧
encodeCfg target = b ∧ InPrewidth target.control ∧ target.regs.length = 5
exact ⟨target,Relation.TransGen.single ht,he',hc',hl'⟩All goals completed! 🐙
| @tail b d h hs ih =>taila:RhRegCfgb✝:RhRegCfgb:RhRegCfgd:RhRegCfgh:Relation.TransGen (fun a b ↦ b ∈ ReferencePreStep95 a) a bhs:d ∈ ReferencePreStep95 bih:∀ (c : Control.Cfg),
encodeCfg c = a →
InPrewidth c.control →
c.regs.length = 5 →
∃ target,
Relation.TransGen (Control.BoundedEdge 19) c target ∧
encodeCfg target = b ∧ InPrewidth target.control ∧ target.regs.length = 5c:Control.Cfghe:encodeCfg c = ahc:InPrewidth c.controlhlen:c.regs.length = 5⊢ ∃ target,
Relation.TransGen (Control.BoundedEdge 19) c target ∧
encodeCfg target = d ∧ InPrewidth target.control ∧ target.regs.length = 5
obtain ⟨mid,ht,hem,hcm,hlm⟩ := ih c he hc hlentaila:RhRegCfgb✝:RhRegCfgb:RhRegCfgd:RhRegCfgh:Relation.TransGen (fun a b ↦ b ∈ ReferencePreStep95 a) a bhs:d ∈ ReferencePreStep95 bih:∀ (c : Control.Cfg),
encodeCfg c = a →
InPrewidth c.control →
c.regs.length = 5 →
∃ target,
Relation.TransGen (Control.BoundedEdge 19) c target ∧
encodeCfg target = b ∧ InPrewidth target.control ∧ target.regs.length = 5c:Control.Cfghe:encodeCfg c = ahc:InPrewidth c.controlhlen:c.regs.length = 5mid:Control.Cfght:Relation.TransGen (Control.BoundedEdge 19) c midhem:encodeCfg mid = bhcm:InPrewidth mid.controlhlm:mid.regs.length = 5⊢ ∃ target,
Relation.TransGen (Control.BoundedEdge 19) c target ∧
encodeCfg target = d ∧ InPrewidth target.control ∧ target.regs.length = 5
have hs' : ReferencePreStep95 b = some d := bya:RhRegCfgb:RhRegCfgh:StateTransition.Reaches₁ ReferencePreStep95 a bc:Control.Cfghe:encodeCfg c = ahc:InPrewidth c.controlhlen:c.regs.length = 5⊢ ∃ target,
Relation.TransGen (Control.BoundedEdge 19) c target ∧
encodeCfg target = b ∧ InPrewidth target.control ∧ target.regs.length = 5 simpa only [Option.mem_def] using hstaila:RhRegCfgb✝:RhRegCfgb:RhRegCfgd:RhRegCfgh:Relation.TransGen (fun a b ↦ b ∈ ReferencePreStep95 a) a bhs:d ∈ ReferencePreStep95 bih:∀ (c : Control.Cfg),
encodeCfg c = a →
InPrewidth c.control →
c.regs.length = 5 →
∃ target,
Relation.TransGen (Control.BoundedEdge 19) c target ∧
encodeCfg target = b ∧ InPrewidth target.control ∧ target.regs.length = 5c:Control.Cfghe:encodeCfg c = ahc:InPrewidth c.controlhlen:c.regs.length = 5mid:Control.Cfght:Relation.TransGen (Control.BoundedEdge 19) c midhem:encodeCfg mid = bhcm:InPrewidth mid.controlhlm:mid.regs.length = 5hs':ReferencePreStep95 b = some d⊢ ∃ target,
Relation.TransGen (Control.BoundedEdge 19) c target ∧
encodeCfg target = d ∧ InPrewidth target.control ∧ target.regs.length = 5
rw [←hemtaila:RhRegCfgb✝:RhRegCfgb:RhRegCfgd:RhRegCfgh:Relation.TransGen (fun a b ↦ b ∈ ReferencePreStep95 a) a bhs:d ∈ ReferencePreStep95 bih:∀ (c : Control.Cfg),
encodeCfg c = a →
InPrewidth c.control →
c.regs.length = 5 →
∃ target,
Relation.TransGen (Control.BoundedEdge 19) c target ∧
encodeCfg target = b ∧ InPrewidth target.control ∧ target.regs.length = 5c:Control.Cfghe:encodeCfg c = ahc:InPrewidth c.controlhlen:c.regs.length = 5mid:Control.Cfght:Relation.TransGen (Control.BoundedEdge 19) c midhem:encodeCfg mid = bhcm:InPrewidth mid.controlhlm:mid.regs.length = 5hs':ReferencePreStep95 (encodeCfg mid) = some d⊢ ∃ target,
Relation.TransGen (Control.BoundedEdge 19) c target ∧
encodeCfg target = d ∧ InPrewidth target.control ∧ target.regs.length = 5] at hs'taila:RhRegCfgb✝:RhRegCfgb:RhRegCfgd:RhRegCfgh:Relation.TransGen (fun a b ↦ b ∈ ReferencePreStep95 a) a bhs:d ∈ ReferencePreStep95 bih:∀ (c : Control.Cfg),
encodeCfg c = a →
InPrewidth c.control →
c.regs.length = 5 →
∃ target,
Relation.TransGen (Control.BoundedEdge 19) c target ∧
encodeCfg target = b ∧ InPrewidth target.control ∧ target.regs.length = 5c:Control.Cfghe:encodeCfg c = ahc:InPrewidth c.controlhlen:c.regs.length = 5mid:Control.Cfght:Relation.TransGen (Control.BoundedEdge 19) c midhem:encodeCfg mid = bhcm:InPrewidth mid.controlhlm:mid.regs.length = 5hs':ReferencePreStep95 (encodeCfg mid) = some d⊢ ∃ target,
Relation.TransGen (Control.BoundedEdge 19) c target ∧
encodeCfg target = d ∧ InPrewidth target.control ∧ target.regs.length = 5
obtain ⟨target,hlast,he',hc',hl'⟩ := edge_transport mid d hcm hlm hs'taila:RhRegCfgb✝:RhRegCfgb:RhRegCfgd:RhRegCfgh:Relation.TransGen (fun a b ↦ b ∈ ReferencePreStep95 a) a bhs:d ∈ ReferencePreStep95 bih:∀ (c : Control.Cfg),
encodeCfg c = a →
InPrewidth c.control →
c.regs.length = 5 →
∃ target,
Relation.TransGen (Control.BoundedEdge 19) c target ∧
encodeCfg target = b ∧ InPrewidth target.control ∧ target.regs.length = 5c:Control.Cfghe:encodeCfg c = ahc:InPrewidth c.controlhlen:c.regs.length = 5mid:Control.Cfght:Relation.TransGen (Control.BoundedEdge 19) c midhem:encodeCfg mid = bhcm:InPrewidth mid.controlhlm:mid.regs.length = 5hs':ReferencePreStep95 (encodeCfg mid) = some dtarget:Control.Cfghlast:Control.BoundedEdge 19 mid targethe':encodeCfg target = dhc':InPrewidth target.controlhl':target.regs.length = 5⊢ ∃ target,
Relation.TransGen (Control.BoundedEdge 19) c target ∧
encodeCfg target = d ∧ InPrewidth target.control ∧ target.regs.length = 5
exact ⟨target,ht.tail hlast,he',hc',hl'⟩All goals completed! 🐙theorem post_prewidth (M : Nat) :
Relation.TransGen (Control.BoundedEdge 19)
(⟨.outside 3,[0,0,M,0,0]⟩ : Control.Cfg)
⟨.outside 88,[0,0,Riemann120.shuniaDeficit (M+2),0,M+1]⟩ := byM:ℕ⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }
let start : Control.Cfg := ⟨.outside 3,[0,0,M,0,0]⟩M:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }
have hstart : encodeCfg start = ⟨ReferenceProgram.word 3,[0,0,M,0,0]⟩ := by
change (⟨word (.outside 3),[0,0,M,0,0]⟩ : RhRegCfg) = _M:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }⊢ { stack := word (ControlWord.outside 3), regs := [0, 0, M, 0, 0] } =
{ stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }
rw [word3_matchM:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }⊢ { stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] } =
{ stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }]M:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }hstart:encodeCfg start = { stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }
have hscope : InPrewidth start.control := by change 3 ≤ (3 : Nat) ∧ 3 < 89M:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }hstart:encodeCfg start = { stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }⊢ 3 ≤ 3 ∧ 3 < 89; decideM:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }hstart:encodeCfg start = { stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }hscope:InPrewidth start.control⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }
obtain ⟨target,ht,he,hc,hlen⟩ := trace_transport (post_reference_trace M) start hstart hscope rflM:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }hstart:encodeCfg start = { stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }hscope:InPrewidth start.controltarget:Control.Cfght:Relation.TransGen (Control.BoundedEdge 19) start targethe:encodeCfg target = { stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }hc:InPrewidth target.controlhlen:target.regs.length = 5⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }
rcases target with ⟨control,regs⟩M:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }hstart:encodeCfg start = { stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }hscope:InPrewidth start.controlcontrol:ControlWordregs:List ℕht:Relation.TransGen (Control.BoundedEdge 19) start { control := control, regs := regs }he:encodeCfg { control := control, regs := regs } =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }hc:InPrewidth { control := control, regs := regs }.controlhlen:{ control := control, regs := regs }.regs.length = 5⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }
cases control with
| entry d =>entryM:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }hstart:encodeCfg start = { stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }hscope:InPrewidth start.controlregs:List ℕd:ℕht:Relation.TransGen (Control.BoundedEdge 19) start { control := ControlWord.entry d, regs := regs }he:encodeCfg { control := ControlWord.entry d, regs := regs } =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }hc:InPrewidth { control := ControlWord.entry d, regs := regs }.controlhlen:{ control := ControlWord.entry d, regs := regs }.regs.length = 5⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] } cases hcAll goals completed! 🐙
| local d s =>localM:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }hstart:encodeCfg start = { stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }hscope:InPrewidth start.controlregs:List ℕd:ℕs:Fin 22ht:Relation.TransGen (Control.BoundedEdge 19) start { control := ControlWord.local d s, regs := regs }he:encodeCfg { control := ControlWord.local d s, regs := regs } =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }hc:InPrewidth { control := ControlWord.local d s, regs := regs }.controlhlen:{ control := ControlWord.local d s, regs := regs }.regs.length = 5⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] } cases hcAll goals completed! 🐙
| outside i =>outsideM:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }hstart:encodeCfg start = { stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }hscope:InPrewidth start.controlregs:List ℕi:Fin 97ht:Relation.TransGen (Control.BoundedEdge 19) start { control := ControlWord.outside i, regs := regs }he:encodeCfg { control := ControlWord.outside i, regs := regs } =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }hc:InPrewidth { control := ControlWord.outside i, regs := regs }.controlhlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }
change 3 ≤ i.val ∧ i.val < 89 at hcoutsideM:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }hstart:encodeCfg start = { stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }hscope:InPrewidth start.controlregs:List ℕi:Fin 97ht:Relation.TransGen (Control.BoundedEdge 19) start { control := ControlWord.outside i, regs := regs }he:encodeCfg { control := ControlWord.outside i, regs := regs } =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }
have hstack := congrArg RhRegCfg.stack heoutsideM:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }hstart:encodeCfg start = { stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }hscope:InPrewidth start.controlregs:List ℕi:Fin 97ht:Relation.TransGen (Control.BoundedEdge 19) start { control := ControlWord.outside i, regs := regs }he:encodeCfg { control := ControlWord.outside i, regs := regs } =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hstack:(encodeCfg { control := ControlWord.outside i, regs := regs }).stack =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }.stack⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }
have hregs := congrArg RhRegCfg.regs heoutsideM:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }hstart:encodeCfg start = { stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }hscope:InPrewidth start.controlregs:List ℕi:Fin 97ht:Relation.TransGen (Control.BoundedEdge 19) start { control := ControlWord.outside i, regs := regs }he:encodeCfg { control := ControlWord.outside i, regs := regs } =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hstack:(encodeCfg { control := ControlWord.outside i, regs := regs }).stack =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }.stackhregs:(encodeCfg { control := ControlWord.outside i, regs := regs }).regs =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }.regs⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }
change word (.outside i) = ReferenceProgram.word 88 at hstackoutsideM:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }hstart:encodeCfg start = { stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }hscope:InPrewidth start.controlregs:List ℕi:Fin 97ht:Relation.TransGen (Control.BoundedEdge 19) start { control := ControlWord.outside i, regs := regs }he:encodeCfg { control := ControlWord.outside i, regs := regs } =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hregs:(encodeCfg { control := ControlWord.outside i, regs := regs }).regs =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }.regshstack:word (ControlWord.outside i) = ReferenceProgram.word 88⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }
rw [word_range i hc.2outsideM:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }hstart:encodeCfg start = { stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }hscope:InPrewidth start.controlregs:List ℕi:Fin 97ht:Relation.TransGen (Control.BoundedEdge 19) start { control := ControlWord.outside i, regs := regs }he:encodeCfg { control := ControlWord.outside i, regs := regs } =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hregs:(encodeCfg { control := ControlWord.outside i, regs := regs }).regs =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }.regshstack:ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩) = ReferenceProgram.word 88⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }] at hstackoutsideM:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }hstart:encodeCfg start = { stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }hscope:InPrewidth start.controlregs:List ℕi:Fin 97ht:Relation.TransGen (Control.BoundedEdge 19) start { control := ControlWord.outside i, regs := regs }he:encodeCfg { control := ControlWord.outside i, regs := regs } =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hregs:(encodeCfg { control := ControlWord.outside i, regs := regs }).regs =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }.regshstack:ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩) = ReferenceProgram.word 88⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }
have hi := word88_unique ⟨i.val,hc.2⟩ hstackoutsideM:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }hstart:encodeCfg start = { stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }hscope:InPrewidth start.controlregs:List ℕi:Fin 97ht:Relation.TransGen (Control.BoundedEdge 19) start { control := ControlWord.outside i, regs := regs }he:encodeCfg { control := ControlWord.outside i, regs := regs } =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hregs:(encodeCfg { control := ControlWord.outside i, regs := regs }).regs =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }.regshstack:ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩) = ReferenceProgram.word 88hi:↑⟨↑i, ⋯⟩ = 88⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }
have hi' : i = (88 : Fin 97) := Fin.ext hioutsideM:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }hstart:encodeCfg start = { stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }hscope:InPrewidth start.controlregs:List ℕi:Fin 97ht:Relation.TransGen (Control.BoundedEdge 19) start { control := ControlWord.outside i, regs := regs }he:encodeCfg { control := ControlWord.outside i, regs := regs } =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }hlen:{ control := ControlWord.outside i, regs := regs }.regs.length = 5hc:3 ≤ ↑i ∧ ↑i < 89hregs:(encodeCfg { control := ControlWord.outside i, regs := regs }).regs =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }.regshstack:ReferenceProgram.word (ref89 ⟨↑i, ⋯⟩) = ReferenceProgram.word 88hi:↑⟨↑i, ⋯⟩ = 88hi':i = 88⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }
subst ioutsideM:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }hstart:encodeCfg start = { stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }hscope:InPrewidth start.controlregs:List ℕht:Relation.TransGen (Control.BoundedEdge 19) start { control := ControlWord.outside 88, regs := regs }he:encodeCfg { control := ControlWord.outside 88, regs := regs } =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }hlen:{ control := ControlWord.outside 88, regs := regs }.regs.length = 5hc:3 ≤ ↑88 ∧ ↑88 < 89hregs:(encodeCfg { control := ControlWord.outside 88, regs := regs }).regs =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }.regshstack:ReferenceProgram.word (ref89 ⟨↑88, ⋯⟩) = ReferenceProgram.word 88hi:↑⟨↑88, ⋯⟩ = 88⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }
change swapBank regs = [0,0,Riemann120.shuniaDeficit (M+2),0,M+1] at hregsoutsideM:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }hstart:encodeCfg start = { stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }hscope:InPrewidth start.controlregs:List ℕht:Relation.TransGen (Control.BoundedEdge 19) start { control := ControlWord.outside 88, regs := regs }he:encodeCfg { control := ControlWord.outside 88, regs := regs } =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }hlen:{ control := ControlWord.outside 88, regs := regs }.regs.length = 5hc:3 ≤ ↑88 ∧ ↑88 < 89hstack:ReferenceProgram.word (ref89 ⟨↑88, ⋯⟩) = ReferenceProgram.word 88hi:↑⟨↑88, ⋯⟩ = 88hregs:swapBank regs = [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1]⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }
have hr := congrArg swapBank hregsoutsideM:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }hstart:encodeCfg start = { stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }hscope:InPrewidth start.controlregs:List ℕht:Relation.TransGen (Control.BoundedEdge 19) start { control := ControlWord.outside 88, regs := regs }he:encodeCfg { control := ControlWord.outside 88, regs := regs } =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }hlen:{ control := ControlWord.outside 88, regs := regs }.regs.length = 5hc:3 ≤ ↑88 ∧ ↑88 < 89hstack:ReferenceProgram.word (ref89 ⟨↑88, ⋯⟩) = ReferenceProgram.word 88hi:↑⟨↑88, ⋯⟩ = 88hregs:swapBank regs = [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1]hr:swapBank (swapBank regs) = swapBank [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1]⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }
rw [swapBank_twice regs hlenoutsideM:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }hstart:encodeCfg start = { stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }hscope:InPrewidth start.controlregs:List ℕht:Relation.TransGen (Control.BoundedEdge 19) start { control := ControlWord.outside 88, regs := regs }he:encodeCfg { control := ControlWord.outside 88, regs := regs } =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }hlen:{ control := ControlWord.outside 88, regs := regs }.regs.length = 5hc:3 ≤ ↑88 ∧ ↑88 < 89hstack:ReferenceProgram.word (ref89 ⟨↑88, ⋯⟩) = ReferenceProgram.word 88hi:↑⟨↑88, ⋯⟩ = 88hregs:swapBank regs = [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1]hr:regs = swapBank [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1]⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }] at hroutsideM:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }hstart:encodeCfg start = { stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }hscope:InPrewidth start.controlregs:List ℕht:Relation.TransGen (Control.BoundedEdge 19) start { control := ControlWord.outside 88, regs := regs }he:encodeCfg { control := ControlWord.outside 88, regs := regs } =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }hlen:{ control := ControlWord.outside 88, regs := regs }.regs.length = 5hc:3 ≤ ↑88 ∧ ↑88 < 89hstack:ReferenceProgram.word (ref89 ⟨↑88, ⋯⟩) = ReferenceProgram.word 88hi:↑⟨↑88, ⋯⟩ = 88hregs:swapBank regs = [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1]hr:regs = swapBank [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1]⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }
change regs = [0,0,Riemann120.shuniaDeficit (M+2),0,M+1] at hroutsideM:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }hstart:encodeCfg start = { stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }hscope:InPrewidth start.controlregs:List ℕht:Relation.TransGen (Control.BoundedEdge 19) start { control := ControlWord.outside 88, regs := regs }he:encodeCfg { control := ControlWord.outside 88, regs := regs } =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }hlen:{ control := ControlWord.outside 88, regs := regs }.regs.length = 5hc:3 ≤ ↑88 ∧ ↑88 < 89hstack:ReferenceProgram.word (ref89 ⟨↑88, ⋯⟩) = ReferenceProgram.word 88hi:↑⟨↑88, ⋯⟩ = 88hregs:swapBank regs = [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1]hr:regs = [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1]⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }
subst regsoutsideM:ℕstart:Control.Cfg := { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }hstart:encodeCfg start = { stack := ReferenceProgram.word 3, regs := [0, 0, M, 0, 0] }hscope:InPrewidth start.controlhc:3 ≤ ↑88 ∧ ↑88 < 89hstack:ReferenceProgram.word (ref89 ⟨↑88, ⋯⟩) = ReferenceProgram.word 88hi:↑⟨↑88, ⋯⟩ = 88ht:Relation.TransGen (Control.BoundedEdge 19) start
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }he:encodeCfg { control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] } =
{ stack := ReferenceProgram.word 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }hlen:{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }.regs.length = 5hregs:swapBank [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] = [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1]⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }
exact htAll goals completed! 🐙theorem stage_prewidth (M : Nat) :
Relation.TransGen (Control.BoundedEdge 19)
(⟨.outside 0,[0,0,0,M,0]⟩ : Control.Cfg)
⟨.outside 88,[0,0,Riemann120.shuniaDeficit (M+2),0,M+1]⟩ := byM:ℕ⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 0, regs := [0, 0, 0, M, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }
have hi := initializer M 0M:ℕhi:Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 0, regs := [0, 0, 0, M, 0] }
{ control := ControlWord.outside 3, regs := [0, 0, 0 + M, 0, 0] }⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 0, regs := [0, 0, 0, M, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }
simp only [Nat.zero_add] at hiM:ℕhi:Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 0, regs := [0, 0, 0, M, 0] }
{ control := ControlWord.outside 3, regs := [0, 0, M, 0, 0] }⊢ Relation.TransGen (Control.BoundedEdge 19) { control := ControlWord.outside 0, regs := [0, 0, 0, M, 0] }
{ control := ControlWord.outside 88, regs := [0, 0, Riemann120.shuniaDeficit (M + 2), 0, M + 1] }
exact hi.trans (post_prewidth M)All goals completed! 🐙end ConjectureMachines.Riemann95.TypedPrewidth