URM Basic Lemmas #
This file contains basic lemmas and helper operations for URM types.
Main definitions #
Instr.IsJump: predicate for jump instructionsInstr.JumpsBoundedBy: checks if jump targets are boundedInstr.capJump: caps jump targets to a given length
Main results #
Regs.write_read_self,Regs.write_read_of_ne: register read/write lemmasState.isHalted_iff,State.ext: state lemmasJumpsBoundedBy.mono: bounded jumps are monotonic in the boundJumpsBoundedBy.shiftJumps: shifting preserves bounded jumpsProgram.mem_maxRegister: instruction maxRegister bounded by program maxRegister
Register Lemmas #
State Lemmas #
@[simp]
Instruction Lemmas #
Jump Instructions #
@[implicit_reducible]
Equations
- One or more equations did not get rendered due to their size.
@[simp]
J instruction is a jump.
shiftJumps is identity for non-jumping instructions.
Bounded Jump Targets #
An instruction's jump target is bounded by a given length. Non-jump instructions trivially satisfy this.
Equations
- Cslib.URM.Instr.JumpsBoundedBy len (Cslib.URM.Instr.J a a_1 a_2) = (a_2 ≤ len)
- Cslib.URM.Instr.JumpsBoundedBy len x✝ = True
Instances For
@[implicit_reducible]
instance
Cslib.URM.Instr.instDecidableJumpsBoundedBy
(len : ℕ)
(instr : Instr)
:
Decidable (JumpsBoundedBy len instr)
Equations
- One or more equations did not get rendered due to their size.
theorem
Cslib.URM.Instr.jumpsBoundedBy_of_nonJump
{instr : Instr}
(h : ¬instr.IsJump)
(len : ℕ)
:
JumpsBoundedBy len instr
Non-jumping instructions have bounded jumps for any length.
theorem
Cslib.URM.Instr.JumpsBoundedBy.mono
{instr : Instr}
{len1 len2 : ℕ}
(h : JumpsBoundedBy len1 instr)
(hle : len1 ≤ len2)
:
JumpsBoundedBy len2 instr
JumpsBoundedBy is monotonic: if bounded for len1, then bounded for any len2 ≥ len1.
theorem
Cslib.URM.Instr.JumpsBoundedBy.shiftJumps
{instr : Instr}
{len offset : ℕ}
(h : JumpsBoundedBy len instr)
:
JumpsBoundedBy (offset + len) (Instr.shiftJumps offset instr)
shiftJumps preserves bounded jumps with adjusted bound.
Jump Target Capping #
Cap a jump target to be at most len. Non-jump instructions are unchanged.
Equations
- Cslib.URM.Instr.capJump len (Cslib.URM.Instr.Z n) = Cslib.URM.Instr.Z n
- Cslib.URM.Instr.capJump len (Cslib.URM.Instr.S n) = Cslib.URM.Instr.S n
- Cslib.URM.Instr.capJump len (Cslib.URM.Instr.T m n) = Cslib.URM.Instr.T m n
- Cslib.URM.Instr.capJump len (Cslib.URM.Instr.J m n q) = Cslib.URM.Instr.J m n (min q len)
Instances For
theorem
Cslib.URM.Instr.JumpsBoundedBy.capJump
(len : ℕ)
(instr : Instr)
:
JumpsBoundedBy len (Instr.capJump len instr)
capJump always produces an instruction with bounded jump.
Any instruction in a program has maxRegister at most the program's maxRegister.