AFTD Auto-Formalizing Theoretical Domains

Cslib.URM.HaltsWithResult.toHalts

theoremverifiedformalizationimported Lean

If a program halts with a result, it halts.

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open Cslib Cslib.URM in
variable (p : Program) in
variable {p : Program} in
theorem Cslib.URM.HaltsWithResult.toHalts {inputs : List ℕ} {result : ℕ}
    (h : p ↓ inputs ≫ result) : p ↓ inputs
Formalizes
CSLib, `Cslib.URM.HaltsWithResult.toHalts`
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.
Verified
08 Oct 2026
Axioms
propext
Built on 11

Lean source view module on GitHub

set_option quotPrecheck false
open Cslib Cslib.URM
local notation:50 p " ↓ " inputs:51 => Halts p inputs
local notation:50 p " ↑ " inputs:51 => Diverges p inputs
local notation:50 p " ↓ " inputs:51 " ≫ " result:51 => HaltsWithResult p inputs result

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open Cslib Cslib.URM in
variable (p : Program) in
variable {p : Program} in
/-- If a program halts with a result, it halts. -/
theorem Cslib.URM.HaltsWithResult.toHalts {inputs : List ℕ} {result : ℕ}
    (h : p ↓ inputs ≫ result) : p ↓ inputs :=
  let ⟨s, hsteps, hhalted, _⟩ := h
  ⟨s, hsteps, hhalted⟩
See it in the graphDiscuss this resultChallenge it