Cslib.URM.Computes
defimported Lean
A program p computes a partial function f : (Fin n → ℕ) → Part ℕ if for any input, eval p inputs = f inputs as partial values. This captures both: - The program halts iff the function is defined on that input - When both are defined, the program's output equals the function's value Note: Inputs are provided in registers 0, 1, ..., n-1 and output is read from register 0.
Statement
set_option autoImplicit true in set_option relaxedAutoImplicit true in def Cslib.URM.Computes (n : ℕ) (p : Program) (f : (Fin n → ℕ) → Part ℕ) : Prop
- Defined in
- CSLib, `Cslib.URM.Computes`
- 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.Computes← Cslib.URM.Computes (Cslib/Computability/URM/Computable.lean:35): verbatim
- Verified
- 08 Oct 2026
- Axioms
- none listed
- Built on 6
- Cslib.URM.State.instDecidableIsHaltedCslib.URM.State.instDecidableIsHalted
- Cslib.URM.evalEvaluation as a partial function using
Part. Defined when the program halts, returning the value in register 0. - Cslib.URM.State.instInhabitedCslib.URM.State.instInhabited
- Cslib.URM.instSetoidProgramSetoid instance for programs, enabling the ≈ notation.
- Cslib.URM.State.instReprCslib.URM.State.instRepr
- Cslib.URM.ProgramA URM program is a list of instructions.
- Used by 1
- Cslib.URM.ComputableA partial function
f : (Fin n → ℕ) → Part ℕis URM-computable if there exists a URM program that computes it.
- Cslib.URM.ComputableA partial function
Lean source view module on GitHub
set_option autoImplicit true in set_option relaxedAutoImplicit true in /-- A program `p` computes a partial function `f : (Fin n → ℕ) → Part ℕ` if for any input, `eval p inputs = f inputs` as partial values. This captures both: - The program halts iff the function is defined on that input - When both are defined, the program's output equals the function's value Note: Inputs are provided in registers 0, 1, ..., n-1 and output is read from register 0. -/ def Cslib.URM.Computes (n : ℕ) (p : Program) (f : (Fin n → ℕ) → Part ℕ) : Prop := ∀ inputs : Fin n → ℕ, eval p (List.ofFn inputs) = f inputs