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 #
@[instance_reducible]
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.
Instances For
@[instance_reducible]
instance Cslib.URM.Instr.instDecidableJumpsBoundedBy (len : ℕ) (instr : Instr) :
Decidable (JumpsBoundedBy len instr)
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.
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.