Cslib.URM.Steps.preserves_register
theoremverifiedformalizationimported Lean
Multi-step execution preserves registers not written by any executed instruction.
Statement
set_option autoImplicit true in set_option relaxedAutoImplicit true in variable (p : Program) in variable {p : Program} in theorem Cslib.URM.Steps.preserves_register {s s' : State} {r : ℕ} (hsteps : Steps p s s') (hr : ∀ instr, instr ∈ p → instr.writesTo ≠ some r) : s'.regs.read r = s.regs.read r
- Formalizes
- CSLib, `Cslib.URM.Steps.preserves_register`
- Lean proof
- By Jesse Alama, from github.com/leanprover/cslib at
3951377e5a3f(Copyright (c) 2026 Jesse Alama. All rights reserved, Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.33.0.Cslib.URM.Steps.preserves_register← Cslib.URM.Steps.preserves_register (Cslib/Computability/URM/Execution.lean:144): verbatim
- Verified
- 08 Oct 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 11
- Cslib.URM.State.instDecidableIsHaltedCslib.URM.State.instDecidableIsHalted
- Cslib.URM.InstrURM instructions. -
Z n: Set register n to zero -S n: Increment register n by one -T m n: Transfer (copy) the contents of register… - Cslib.URM.StepsMulti-step execution: the reflexive-transitive closure of
Step. - Cslib.URM.Instr.writesToThe register written to by an instruction, if any.
- Cslib.URM.State.instInhabitedCslib.URM.State.instInhabited
- Cslib.URM.Step.preserves_registerA single step preserves registers not written to by the current instruction. This is a fundamental property of URM execution: each…
- Cslib.URM.Regs.readRead the contents of register n.
- Cslib.URM.State.instReprCslib.URM.State.instRepr
- Cslib.URM.StepSingle-step execution relation for URMs. Each constructor corresponds to one of the four instruction types: -
zero: ExecuteZ n(set… - Cslib.URM.StateMachine state: program counter (0-indexed) and register contents.
- Cslib.URM.ProgramA URM program is a list of instructions.
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
set_option autoImplicit true inset_option relaxedAutoImplicit true invariable (p : Program) invariable {p : Program} in/-- Multi-step execution preserves registers not written by any executed instruction. -/theorem Cslib.URM.Steps.preserves_register {s s' : State} {r : ℕ} (hsteps : Steps p s s') (hr : ∀ instr, instr ∈ p → instr.writesTo ≠ some r) : s'.regs.read r = s.regs.read r := by induction hsteps using Relation.ReflTransGen.head_induction_on with | refl => rfl | head hstep => grind [Step.preserves_register hstep (r := r)]