Skip to content
Imports
@[ expose ] public section namespace ConjectureMachines.Riemann95.ReferenceLogical open Turing StateTransition ConjectureMachines.Riemann120 open ConjectureMachines.Riemann120.Layer2 abbrev Word := List ( Fin 2 ) inductive ControlInstr where
| halt
| jump ( next : Fin 121 )
| inc ( reg : Nat ) ( next : Fin 121 )
| decnz ( reg : Nat ) ( positive zero : Fin 121 )
deriving Inhabited , DecidableEq , Repr inductive Role where
| plain
| firstSwap ( reg : Nat )
| secondSwap ( reg : Nat )
| halfDec
deriving Inhabited , DecidableEq , Repr structure Row where
word : Word
oldWord : Word
instr : ControlInstr
role : Role
deriving Inhabited , DecidableEq , Repr def rows : Array Row := #[
⟨ [ ] , [ ] , .decnz 0 1 3 , .plain ⟩ ,
⟨ [ 0 , 1 ] , [ 0 , 1 ] , .inc 3 2 , .plain ⟩ ,
⟨ [ 0 , 1 , 1 ] , [ 0 , 1 , 1 ] , .jump 0 , .plain ⟩ ,
⟨ [ 1 ] , [ 1 ] , .inc 1 4 , .plain ⟩ ,
⟨ [ 1 , 0 , 0 , 1 ] , [ 1 , 0 , 0 , 1 ] , .decnz 1 5 7 , .plain ⟩ ,
⟨ [ 1 , 0 , 0 , 1 , 0 , 0 , 1 ] , [ 1 , 0 , 0 , 1 , 0 , 0 , 1 ] , .inc 4 6 , .plain ⟩ ,
⟨ [ 1 , 0 , 0 , 1 , 0 , 0 , 1 , 1 ] , [ 1 , 0 , 0 , 1 , 0 , 0 , 1 , 1 ] , .jump 4 , .plain ⟩ ,
⟨ [ 1 , 0 , 0 , 1 , 0 , 1 ] , [ 1 , 0 , 0 , 1 , 0 , 1 ] , .decnz 2 8 10 , .plain ⟩ ,
⟨ [ 1 , 0 , 0 , 1 , 0 , 1 , 0 , 1 ] , [ 1 , 0 , 0 , 1 , 0 , 1 , 0 , 1 ] , .inc 0 9 , .plain ⟩ ,
⟨ [ 1 , 0 , 0 , 1 , 0 , 1 , 0 , 1 , 1 ] , [ 1 , 0 , 0 , 1 , 0 , 1 , 0 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, 1 , 1 ] , [ 1 , 1 , 1 , 1 , 1 , 0 , 1 , 1 ] , .jump 88 , .plain ⟩ ,
⟨ [ 1 , 1 , 1 , 1 , 1 ] , [ 1 , 1 , 1 , 1 , 1 , 1 ] , .decnz 3 120 0 , .plain ⟩ ,
⟨ [ 1 , 1 , 1 , 1 , 1 , 1 ] , [ 1 , 1 , 1 , 1 , 1 , 1 , 1 ] , .halt , .plain ⟩
] def row ( s : Fin 121 ) : Row := rows . getD s . val default def word ( s : Fin 121 ) : Word := ( row s ) . word def oldWord ( s : Fin 121 ) : Word := ( row s ) . oldWord def rowInstr ( s : Fin 121 ) : ControlInstr := ( row s ) . instr def role ( s : Fin 121 ) : Role := ( row s ) . role def toInstr ( target : Fin 121 → Word ) : ControlInstr → RhInstr
| .halt => .halt
| .jump n => .jump ( target n )
| .inc r n => .inc r ( target n )
| .decnz r p z => .decnz r ( target p ) ( target z ) def decoded ( s : Fin 121 ) : RhInstr := toInstr word ( rowInstr s ) def instruction ( bits : Word ) : RhInstr :=
match ( List.finRange 121 ) . find? ( fun s => word s == bits ) with
| some s => decoded s
| none => .halt def step ( c : RhRegCfg ) : Option RhRegCfg :=
match instruction c . stack with
| .halt => none
| .jump target => some ⟨ target , c . regs ⟩
| .inc r target => some ⟨ target , c . regs . set r ( c . regs . getD r 0 + 1 ) ⟩
| .decnz r positive zero =>
if c . regs . getD r 0 == 0 then some ⟨ zero , c . regs ⟩
else some ⟨ positive , c . regs . set r ( c . regs . getD r 0 - 1 ) ⟩ def ordinary ( s : Fin 121 ) : Prop :=
match role s with
| .secondSwap _ => False
| _ => True instance ( s : Fin 121 ) : Decidable ( ordinary s ) := by s : Fin 121 ⊢ Decidable ( ordinary s )
unfold ordinary s : Fin 121 ⊢ Decidable
(match role s with
| Role.secondSwap reg => False
| x => True )
split h_1 s : Fin 121 x✝ : Role reg✝ : ℕ heq✝ : role s = Role.secondSwap reg✝ ⊢ Decidable False h_2 s : Fin 121 x✝¹ : Role x✝ : ∀ ( reg : ℕ ), role s = Role.secondSwap reg → False ⊢ Decidable True <;> h_1 s : Fin 121 x✝ : Role reg✝ : ℕ heq✝ : role s = Role.secondSwap reg✝ ⊢ Decidable False h_2 s : Fin 121 x✝¹ : Role x✝ : ∀ ( reg : ℕ ), role s = Role.secondSwap reg → False ⊢ Decidable True infer_instance All goals completed! 🐙 def ordinaryTargets : ControlInstr → Prop
| .halt => True
| .jump n | .inc _ n => ordinary n
| .decnz _ p z => ordinary p ∧ ordinary z instance ( i : ControlInstr ) : Decidable ( ordinaryTargets i ) := by i : ControlInstr ⊢ Decidable ( ordinaryTargets i )
cases i halt ⊢ Decidable ( ordinaryTargets ControlInstr.halt ) jump next✝ : Fin 121 ⊢ Decidable ( ordinaryTargets ( ControlInstr.jump next✝ ) ) inc reg✝ : ℕ next✝ : Fin 121 ⊢ Decidable ( ordinaryTargets ( ControlInstr.inc reg✝ next✝ ) ) decnz reg✝ : ℕ positive✝ : Fin 121 zero✝ : Fin 121 ⊢ Decidable ( ordinaryTargets ( ControlInstr.decnz reg✝ positive✝ zero✝ ) ) <;> halt ⊢ Decidable ( ordinaryTargets ControlInstr.halt ) jump next✝ : Fin 121 ⊢ Decidable ( ordinaryTargets ( ControlInstr.jump next✝ ) ) inc reg✝ : ℕ next✝ : Fin 121 ⊢ Decidable ( ordinaryTargets ( ControlInstr.inc reg✝ next✝ ) ) decnz reg✝ : ℕ positive✝ : Fin 121 zero✝ : Fin 121 ⊢ Decidable ( ordinaryTargets ( ControlInstr.decnz reg✝ positive✝ zero✝ ) ) dsimp [ ordinaryTargets ] decnz reg✝ : ℕ positive✝ : Fin 121 zero✝ : Fin 121 ⊢ Decidable ( ordinary positive✝ ∧ ordinary zero✝ ) <;> halt ⊢ Decidable True jump next✝ : Fin 121 ⊢ Decidable ( ordinary next✝ ) inc reg✝ : ℕ next✝ : Fin 121 ⊢ Decidable ( ordinary next✝ ) decnz reg✝ : ℕ positive✝ : Fin 121 zero✝ : Fin 121 ⊢ Decidable ( ordinary positive✝ ∧ ordinary zero✝ ) infer_instance All goals completed! 🐙 def halfJump : Word := [ 1 , 1 , 1 , 1 , 0 , 1 , 0 , 1 , 1 , 1 , 0 , 1 , 1 ] def halfLoop : Word := [ 1 , 1 , 1 , 1 , 0 , 1 , 0 , 1 , 1 , 1 ] def Spec ( s : Fin 121 ) : Prop :=
match role s with
| .plain =>
evalStackOf true ( oldWord s ) = toInstr oldWord ( rowInstr s ) ∧
ordinaryTargets ( rowInstr s )
| .firstSwap r =>
match rowInstr s with
| .inc r' n => r' = r ∧ role n = .secondSwap r ∧
evalStackOf true ( oldWord s ) = .inc 4 ( oldWord n ) ∧ ( r = 2 ∨ r = 3 )
| _ => False
| .secondSwap r =>
match rowInstr s with
| .inc r' n => r' = 4 ∧ ordinary n ∧
evalStackOf true ( oldWord s ) = .inc r ( oldWord n ) ∧ ( r = 2 ∨ r = 3 )
| _ => False
| .halfDec =>
match rowInstr s with
| .decnz r p z => r = 3 ∧ ordinary p ∧ ordinary z ∧
evalStackOf true ( oldWord s ) = .decnz 3 ( oldWord p ) halfJump ∧
evalStackOf true halfJump = .jump halfLoop ∧
evalStackOf true halfLoop = .decnz 3 ( oldWord s ) ( oldWord z )
| _ => False instance ( s : Fin 121 ) : Decidable ( Spec s ) := by s : Fin 121 ⊢ Decidable ( Spec s )
unfold Spec s : Fin 121 ⊢ Decidable
(match role s with
| Role.plain => evalStackOf true ( oldWord s ) = toInstr oldWord ( rowInstr s ) ∧ ordinaryTargets ( rowInstr s )
| Role.firstSwap r =>
match rowInstr s with
| ControlInstr.inc r' n =>
r' = r ∧ role n = Role.secondSwap r ∧ evalStackOf true ( oldWord s ) = RhInstr.inc 4 ( oldWord n ) ∧ ( r = 2 ∨ r = 3 )
| x => False
| Role.secondSwap r =>
match rowInstr s with
| ControlInstr.inc r' n =>
r' = 4 ∧ ordinary n ∧ evalStackOf true ( oldWord s ) = RhInstr.inc r ( oldWord n ) ∧ ( r = 2 ∨ r = 3 )
| x => False
| Role.halfDec =>
match rowInstr s with
| ControlInstr.decnz r p z =>
r = 3 ∧
ordinary p ∧
ordinary z ∧
evalStackOf true ( oldWord s ) = RhInstr.decnz 3 ( oldWord p ) halfJump ∧
evalStackOf true halfJump = RhInstr.jump halfLoop ∧
evalStackOf true halfLoop = RhInstr.decnz 3 ( oldWord s ) ( oldWord z )
| x => False )
split h_1 s : Fin 121 x✝ : Role heq✝ : role s = Role.plain ⊢ Decidable ( evalStackOf true ( oldWord s ) = toInstr oldWord ( rowInstr s ) ∧ ordinaryTargets ( rowInstr s ) ) h_2 s : Fin 121 x✝ : Role a✝ : ℕ heq✝ : role s = Role.firstSwap a✝ ⊢ Decidable
(match rowInstr s with
| ControlInstr.inc r' n =>
r' = a✝ ∧ role n = Role.secondSwap a✝ ∧ evalStackOf true ( oldWord s ) = RhInstr.inc 4 ( oldWord n ) ∧ ( a✝ = 2 ∨ a✝ = 3 )
| x => False ) h_3 s : Fin 121 x✝ : Role a✝ : ℕ heq✝ : role s = Role.secondSwap a✝ ⊢ Decidable
(match rowInstr s with
| ControlInstr.inc r' n =>
r' = 4 ∧ ordinary n ∧ evalStackOf true ( oldWord s ) = RhInstr.inc a✝ ( oldWord n ) ∧ ( a✝ = 2 ∨ a✝ = 3 )
| x => False ) h_4 s : Fin 121 x✝ : Role heq✝ : role s = Role.halfDec ⊢ Decidable
(match rowInstr s with
| ControlInstr.decnz r p z =>
r = 3 ∧
ordinary p ∧
ordinary z ∧
evalStackOf true ( oldWord s ) = RhInstr.decnz 3 ( oldWord p ) halfJump ∧
evalStackOf true halfJump = RhInstr.jump halfLoop ∧
evalStackOf true halfLoop = RhInstr.decnz 3 ( oldWord s ) ( oldWord z )
| x => False )
· h_1 s : Fin 121 x✝ : Role heq✝ : role s = Role.plain ⊢ Decidable ( evalStackOf true ( oldWord s ) = toInstr oldWord ( rowInstr s ) ∧ ordinaryTargets ( rowInstr s ) ) infer_instance All goals completed! 🐙
· h_2 s : Fin 121 x✝ : Role a✝ : ℕ heq✝ : role s = Role.firstSwap a✝ ⊢ Decidable
(match rowInstr s with
| ControlInstr.inc r' n =>
r' = a✝ ∧ role n = Role.secondSwap a✝ ∧ evalStackOf true ( oldWord s ) = RhInstr.inc 4 ( oldWord n ) ∧ ( a✝ = 2 ∨ a✝ = 3 )
| x => False ) split h_1 s : Fin 121 x✝¹ : Role a✝ : ℕ heq✝¹ : role s = Role.firstSwap a✝ x✝ : ControlInstr r'✝ : ℕ n✝ : Fin 121 heq✝ : rowInstr s = ControlInstr.inc r'✝ n✝ ⊢ Decidable
( r'✝ = a✝ ∧
role n✝ = Role.secondSwap a✝ ∧ evalStackOf true ( oldWord s ) = RhInstr.inc 4 ( oldWord n✝ ) ∧ ( a✝ = 2 ∨ a✝ = 3 ) ) h_2 s : Fin 121 x✝² : Role a✝ : ℕ heq✝ : role s = Role.firstSwap a✝ x✝¹ : ControlInstr x✝ : ∀ ( r' : ℕ ) ( n : Fin 121 ), rowInstr s = ControlInstr.inc r' n → False ⊢ Decidable False <;> h_1 s : Fin 121 x✝¹ : Role a✝ : ℕ heq✝¹ : role s = Role.firstSwap a✝ x✝ : ControlInstr r'✝ : ℕ n✝ : Fin 121 heq✝ : rowInstr s = ControlInstr.inc r'✝ n✝ ⊢ Decidable
( r'✝ = a✝ ∧
role n✝ = Role.secondSwap a✝ ∧ evalStackOf true ( oldWord s ) = RhInstr.inc 4 ( oldWord n✝ ) ∧ ( a✝ = 2 ∨ a✝ = 3 ) ) h_2 s : Fin 121 x✝² : Role a✝ : ℕ heq✝ : role s = Role.firstSwap a✝ x✝¹ : ControlInstr x✝ : ∀ ( r' : ℕ ) ( n : Fin 121 ), rowInstr s = ControlInstr.inc r' n → False ⊢ Decidable False infer_instance All goals completed! 🐙
· h_3 s : Fin 121 x✝ : Role a✝ : ℕ heq✝ : role s = Role.secondSwap a✝ ⊢ Decidable
(match rowInstr s with
| ControlInstr.inc r' n =>
r' = 4 ∧ ordinary n ∧ evalStackOf true ( oldWord s ) = RhInstr.inc a✝ ( oldWord n ) ∧ ( a✝ = 2 ∨ a✝ = 3 )
| x => False ) split h_1 s : Fin 121 x✝¹ : Role a✝ : ℕ heq✝¹ : role s = Role.secondSwap a✝ x✝ : ControlInstr r'✝ : ℕ n✝ : Fin 121 heq✝ : rowInstr s = ControlInstr.inc r'✝ n✝ ⊢ Decidable ( r'✝ = 4 ∧ ordinary n✝ ∧ evalStackOf true ( oldWord s ) = RhInstr.inc a✝ ( oldWord n✝ ) ∧ ( a✝ = 2 ∨ a✝ = 3 ) ) h_2 s : Fin 121 x✝² : Role a✝ : ℕ heq✝ : role s = Role.secondSwap a✝ x✝¹ : ControlInstr x✝ : ∀ ( r' : ℕ ) ( n : Fin 121 ), rowInstr s = ControlInstr.inc r' n → False ⊢ Decidable False <;> h_1 s : Fin 121 x✝¹ : Role a✝ : ℕ heq✝¹ : role s = Role.secondSwap a✝ x✝ : ControlInstr r'✝ : ℕ n✝ : Fin 121 heq✝ : rowInstr s = ControlInstr.inc r'✝ n✝ ⊢ Decidable ( r'✝ = 4 ∧ ordinary n✝ ∧ evalStackOf true ( oldWord s ) = RhInstr.inc a✝ ( oldWord n✝ ) ∧ ( a✝ = 2 ∨ a✝ = 3 ) ) h_2 s : Fin 121 x✝² : Role a✝ : ℕ heq✝ : role s = Role.secondSwap a✝ x✝¹ : ControlInstr x✝ : ∀ ( r' : ℕ ) ( n : Fin 121 ), rowInstr s = ControlInstr.inc r' n → False ⊢ Decidable False infer_instance All goals completed! 🐙
· h_4 s : Fin 121 x✝ : Role heq✝ : role s = Role.halfDec ⊢ Decidable
(match rowInstr s with
| ControlInstr.decnz r p z =>
r = 3 ∧
ordinary p ∧
ordinary z ∧
evalStackOf true ( oldWord s ) = RhInstr.decnz 3 ( oldWord p ) halfJump ∧
evalStackOf true halfJump = RhInstr.jump halfLoop ∧
evalStackOf true halfLoop = RhInstr.decnz 3 ( oldWord s ) ( oldWord z )
| x => False ) split h_1 s : Fin 121 x✝¹ : Role heq✝¹ : role s = Role.halfDec x✝ : ControlInstr r✝ : ℕ p✝ : Fin 121 z✝ : Fin 121 heq✝ : rowInstr s = ControlInstr.decnz r✝ p✝ z✝ ⊢ Decidable
( r✝ = 3 ∧
ordinary p✝ ∧
ordinary z✝ ∧
evalStackOf true ( oldWord s ) = RhInstr.decnz 3 ( oldWord p✝ ) halfJump ∧
evalStackOf true halfJump = RhInstr.jump halfLoop ∧
evalStackOf true halfLoop = RhInstr.decnz 3 ( oldWord s ) ( oldWord z✝ ) ) h_2 s : Fin 121 x✝² : Role heq✝ : role s = Role.halfDec x✝¹ : ControlInstr x✝ : ∀ ( r : ℕ ) ( p z : Fin 121 ), rowInstr s = ControlInstr.decnz r p z → False ⊢ Decidable False <;> h_1 s : Fin 121 x✝¹ : Role heq✝¹ : role s = Role.halfDec x✝ : ControlInstr r✝ : ℕ p✝ : Fin 121 z✝ : Fin 121 heq✝ : rowInstr s = ControlInstr.decnz r✝ p✝ z✝ ⊢ Decidable
( r✝ = 3 ∧
ordinary p✝ ∧
ordinary z✝ ∧
evalStackOf true ( oldWord s ) = RhInstr.decnz 3 ( oldWord p✝ ) halfJump ∧
evalStackOf true halfJump = RhInstr.jump halfLoop ∧
evalStackOf true halfLoop = RhInstr.decnz 3 ( oldWord s ) ( oldWord z✝ ) ) h_2 s : Fin 121 x✝² : Role heq✝ : role s = Role.halfDec x✝¹ : ControlInstr x✝ : ∀ ( r : ℕ ) ( p z : Fin 121 ), rowInstr s = ControlInstr.decnz r p z → False ⊢ Decidable False infer_instance All goals completed! 🐙 theorem instruction_word : ∀ s : Fin 121 , instruction ( word s ) = decoded s := by ⊢ ∀ ( s : Fin 121 ), instruction ( word s ) = decoded s decide + kernel All goals completed! 🐙 theorem specs : ∀ s : Fin 121 , Spec s := by ⊢ ∀ ( s : Fin 121 ), Spec s decide + kernel All goals completed! 🐙 end ConjectureMachines.Riemann95.ReferenceLogical