Cslib.URM.Step.of_nonJump
theoremverifiedformalizationimported Lean
A non-jumping instruction produces a step that increments PC by 1.
Statement
set_option autoImplicit true in set_option relaxedAutoImplicit true in theorem Cslib.URM.Step.of_nonJump {p : Program} {s : State} (hlt : s.pc < p.length) (hnonjump : ¬(p[s.pc]'hlt).IsJump) : ∃ s', Step p s s' ∧ s'.pc = s.pc + 1
- Formalizes
- CSLib, `Cslib.URM.Step.of_nonJump`
- 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.Step.of_nonJump← Cslib.URM.Step.of_nonJump (Cslib/Computability/URM/StraightLine.lean:65): verbatim
- Verified
- 08 Oct 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 17
- 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.State.isHalted_iffCslib.URM.State.isHalted_iff
- Cslib.URM.Instr.IsJumpAn instruction is a jump instruction.
- Cslib.URM.Regs.writeWrite value v to register n.
- Cslib.URM.Regs.write_read_selfCslib.URM.Regs.write_read_self
- Cslib.URM.Instr.instDecidableIsJumpCslib.URM.Instr.instDecidableIsJump
- Cslib.URM.State.instInhabitedCslib.URM.State.instInhabited
- Cslib.URM.instSetoidProgramSetoid instance for programs, enabling the ≈ notation.
- Cslib.URM.Regs.write_read_of_neCslib.URM.Regs.write_read_of_ne
- Cslib.URM.Regs.readRead the contents of register n.
- Cslib.URM.Instr.instDecidableJumpsBoundedByCslib.URM.Instr.instDecidableJumpsBoundedBy
- Cslib.URM.instDecidableIsStraightLineCslib.URM.instDecidableIsStraightLine
- 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.
- Used by 2
- Cslib.URM.straight_line_halts_from_regsStraight-line programs halt from any starting registers, not just State.init. Useful for chaining: after running one program, we can run…
- Cslib.URM.straight_line_state_at_pcIn a straight-line program, we can characterize the state at any intermediate pc. This gives us the state after executing 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 in/-- A non-jumping instruction produces a step that increments PC by 1. -/theorem Cslib.URM.Step.of_nonJump {p : Program} {s : State} (hlt : s.pc < p.length) (hnonjump : ¬(p[s.pc]'hlt).IsJump) : ∃ s', Step p s s' ∧ s'.pc = s.pc + 1 := by cases hp : (p[s.pc]'hlt) with | Z n => use {pc := s.pc + 1, regs := s.regs.write n 0} grind | S n => use { pc := s.pc + 1, regs := s.regs.write n (s.regs.read n + 1) } grind | T m n => use { pc := s.pc + 1, regs := s.regs.write n (s.regs.read m) } grind | J _ _ _ => grind [Instr.IsJump]