Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

A halting run of the hardcoded search program yields the start-level string and a halting run of the semidecider

Proved
MIPRE.Cost.Prog.searchProg_halts_of

by thomasvidick · Oct 12, 2026 · Mathlib 0df444a (Lean v4.33.1)

computabilitymipre-formalizationrecursive-compressionuniversal-machine

We work in the ambient cost model (programs Prog on binary-tree data, timed semantics, Prog.Runs p x r t; Halts p x: some run of ppp on xxx exists). A universal machine UUU is a closed program U.univU.\mathrm{univ}U.univ that simulates any program ccc on any vvv with the same halting behavior and result (UniversalMachine.time_le and UniversalMachine.halts_of).

The compressibility criterion (Lin's criterion, blueprint lem:compressible-criterion-nested) adds a search branch to the self-referential decider of the recursive compression argument: at each level the decider tests, under a budget, whether a semidecision procedure SSS accepts the string at the start level mmm of the recursion. The program tested is the search program with its data hardcoded. For a universal program univ\mathrm{univ}univ and a program SSS, searchProg(univ,S)\mathrm{searchProg}(\mathrm{univ}, S)searchProg(univ,S) expects the pair of d=encode(((c′,(e,(m,m))),m))d = \mathrm{encode}(((c', (e, (m, m))), m))d=encode(((c′,(e,(m,m))),m)) and an (ignored) input: it runs univ\mathrm{univ}univ on the first component of ddd, i.e. simulates c′c'c′ on the encoded triple (e,(m,m))(e, (m, m))(e,(m,m)) to obtain a value xxx (the string at the start level), and then runs SSS on the pair cons(x,encode(m))\texttt{cons}(x, \mathrm{encode}(m))cons(x,encode(m)). The s-m-n map hardcode(p,d)=let_ (cons (const d) (var 0)) p\mathrm{hardcode}(p, d) = \texttt{let\_}\,(\texttt{cons}\,(\texttt{const}\,d)\,(\texttt{var}\,0))\ phardcode(p,d)=let_(cons(constd)(var0)) p fixes ddd, so that hardcode(searchProg(univ,S),d)\mathrm{hardcode}(\mathrm{searchProg}(\mathrm{univ}, S), d)hardcode(searchProg(univ,S),d) is a program to be run on the empty input nil.

Let UUU be a universal machine, SSS a closed program (well-scoped in one variable), c′,ec', ec′,e programs, m∈Nm \in \mathbb{N}m∈N, rrr data and TTT a cost, and suppose that hardcode(searchProg(U.univ,S),encode(((c′,(e,(m,m))),m)))\mathrm{hardcode}(\mathrm{searchProg}(U.\mathrm{univ}, S), \mathrm{encode}(((c', (e, (m,m))), m)))hardcode(searchProg(U.univ,S),encode(((c′,(e,(m,m))),m))) on the input nil halts with rrr at cost TTT. Then

∃ x ∃ tx,c′ on encode((e,(m,m))) halts with x at cost tx∧S halts on cons(x,encode(m)).\exists\, x\ \exists\, t_x,\qquad c' \text{ on } \mathrm{encode}((e,(m,m))) \text{ halts with } x \text{ at cost } t_x\quad\wedge\quad S \text{ halts on } \texttt{cons}(x, \mathrm{encode}(m)).∃x ∃tx​,c′ on encode((e,(m,m))) halts with x at cost tx​∧S halts on cons(x,encode(m)).

This is the backward direction of the correctness of the search branch of the compressibility criterion's decider: if the search fires (the hardcoded search program halts within the budget), then the self-referential program c′c'c′ does produce a string xxx at the start level and the semidecision procedure SSS accepts (x,m)(x, m)(x,m). In compressibility_criterion_nested this is combined with the determinism of evaluation (the xxx produced is the decider's own output at the start level) and with the specification of SSS to conclude that the start string lies outside B1(m)B_1(m)B1​(m).

Formalization Note. The statement is MIPRE.Cost.Prog.searchProg_halts_of; the conclusion names the cost txt_xtx​ of the run of c′c'c′ but only the existence of a run of SSS (Halts S (cons x (encode m))). Its proof is an inversion of the big-step derivation of the hardcoded program, which is possible because the semantics is deterministic and each syntactic form of program has exactly one applicable rule (two for elim, distinguished by the inspected value).

Preamble
import Mathlib.Algebra.Polynomial.Eval.Defs
import Mathlib.Algebra.Polynomial.Eval.Degree
import Mathlib.Computability.Halting
import Mathlib.Computability.Partrec
import Mathlib.Computability.PartrecCode
import Mathlib.Computability.Primrec.List
import Mathlib.Computability.TuringMachine.Config
import Mathlib.Data.ENat.Lattice
import Mathlib.Data.List.Basic
import Mathlib.Data.Nat.Bits
import Mathlib.Data.Nat.Notation
import Mathlib.Data.Nat.Size
import Mathlib.Logic.Denumerable
import Mathlib.Logic.Function.Iterate
import Mathlib.Tactic.Linarith
import Mathlib.Tactic.Ring
import Definitions.Def_MIPRE_Foundations_Cost_Basic
import Definitions.Def_MIPRE_Foundations_Cost_Encoding
import Definitions.Def_MIPRE_Foundations_Cost_PolyTime
import Definitions.Def_MIPRE_Foundations_Cost_Closure
import Definitions.Def_MIPRE_Foundations_Cost_Loops
import Definitions.Def_MIPRE_Foundations_Cost_Unary
import Definitions.Def_MIPRE_Foundations_Cost_Numeric
import Definitions.Def_MIPRE_Foundations_Cost_BitQuery
import Definitions.Def_MIPRE_Foundations_Cost_Toolkit
import Definitions.Def_MIPRE_Foundations_Cost_Succinct
import Definitions.Def_MIPRE_Foundations_Cost_Clocked
import Definitions.Def_MIPRE_Foundations_Cost_Threshold
import Definitions.Def_MIPRE_Foundations_Cost_Machine
import Definitions.Def_MIPRE_Foundations_Cost_Codable
import Definitions.Def_MIPRE_Foundations_Cost_MachineData
import Definitions.Def_MIPRE_Foundations_Cost_Interpreter
import Definitions.Def_MIPRE_Foundations_Cost_MachineBound
import Definitions.Def_MIPRE_Foundations_Cost_Universal
import Definitions.Def_MIPRE_Foundations_Cost_Kleene
import Definitions.Def_MIPRE_Foundations_Cost_Partrec
import Definitions.Def_MIPRE_Foundations_Cost_FromPartrec
import Definitions.Def_MIPRE_Foundations_Compression

open MIPRE
open MIPRE.Cost
open MIPRE.Cost.Prog
open Polynomial
Formal statement
theorem MIPRE.Cost.Prog.searchProg_halts_of (U : UniversalMachine) {S : Prog} (hS : S.WellScoped 1)
    {c' e : Prog} {m : ℕ} {r : Data} {T : ℕ}
    (h : (hardcode (searchProg U.univ S) (encode ((c', (e, (m, m))), m))).Runs .nil r T) :
    ∃ x tx, c'.Runs (encode (e, (m, m))) x tx ∧ Halts S (.cons x (encode m)) := by sorry
Source
https://github.com/vidick/MIPRE-formalization/blob/70cbf1c52e3d5e1dff1162fdf952c9a9f4bd99ed/MIPRE/Foundations/Compression.lean#L372-L403; internal lemma of the formalization of blueprint lem:compressible-criterion-nested (the search branch of Lin's compressibility criterion, lem:compressible-criterion)

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me