Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Hardcoding into the bit-query program gives a succinct description of the output of a fast program

Proved
MIPRE.Cost.isSuccinctDesc_hardcode

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

mipre-formalizationrecursive-compressionsmn-theoremsuccinct-descriptionsuniversal-machine

We work in the ambient cost model: data are binary trees with size\mathrm{size}size the number of nodes, programs (Prog) form a first-order language with de Bruijn variables, ρ⊢p⇓tr\rho \vdash p \Downarrow^{t} rρ⊢p⇓tr (Eval ρ p r t) means that ppp evaluated in the environment ρ\rhoρ halts with result rrr at cost ttt, and a program runs on vvv to rrr at cost ttt when [v]⊢p⇓tr[v] \vdash p \Downarrow^t r[v]⊢p⇓tr (Prog.Runs). A type with a size-aware encoding (SizedEncoding) has an encoding enc\mathrm{enc}enc and sizes ∥a∥=size(enc(a))\|a\| = \mathrm{size}(\mathrm{enc}(a))∥a∥=size(enc(a)); pairs are encoded by enc(a,b)=cons(enc(a),enc(b))\mathrm{enc}(a,b) = \mathrm{cons}(\mathrm{enc}(a), \mathrm{enc}(b))enc(a,b)=cons(enc(a),enc(b)), natural numbers in binary, with ∣m∣|m|∣m∣ the bit length of mmm, and bit strings as lists of bits.

Succinct descriptions (blueprint def:succinct, after [MNY, Definition 2.4]). A program ccc with parameter n∈Nn \in \mathbb{N}n∈N is a succinct description of x∈{0,1}∗x \in \{0,1\}^*x∈{0,1}∗, written IsSuccinctDesc(c,n,x)\mathrm{IsSuccinctDesc}(c, n, x)IsSuccinctDesc(c,n,x), if

  1. ccc is closed (WellScoped 1: it reads only its input, variable 000);
  2. ∣x∣≤2n|x| \le 2^n∣x∣≤2n;
  3. for every m∈Nm \in \mathbb{N}m∈N, ccc runs on enc(m)\mathrm{enc}(m)enc(m) to ans(x,m)\mathrm{ans}(x, m)ans(x,m) at some cost at most (n+1)(∣m∣+1)2(n+1)(|m|+1)^2(n+1)(∣m∣+1)2, where ans(x,m)\mathrm{ans}(x, m)ans(x,m) is enc(xm)\mathrm{enc}(x_m)enc(xm​) if m<∣x∣m < |x|m<∣x∣ and the unary numeral 2‾\underline 22​ otherwise (bitQueryAnswer).

The s-m-n map (hardcode). For a program ppp and a datum ddd, hardcode(p,d)=let cons(const d,var 0) in p\mathrm{hardcode}(p, d) = \mathtt{let}\ \mathrm{cons}(\mathtt{const}\ d, \mathtt{var}\ 0)\ \mathtt{in}\ phardcode(p,d)=let cons(const d,var 0) in p is the program that, on an input xxx, runs ppp on the pair cons(d,x)\mathrm{cons}(d, x)cons(d,x).

The bit-query program. Let UUU be a universal machine (UniversalMachine): a closed program uuu with an overhead polynomial pUp_UpU​ such that a run of ccc on vvv at cost ttt yields a run of uuu on cons(enc(c),v)\mathrm{cons}(\mathrm{enc}(c), v)cons(enc(c),v) with the same result at cost at most pU(∥c∥+size(v)+t)p_U(\|c\| + \mathrm{size}(v) + t)pU​(∥c∥+size(v)+t), and uuu halts only when the simulated program does. The bit-query program βu\beta_uβu​ (bitQueryProg u) on the encoding of (((c′,e),n′),m)(((c', e), n'), m)(((c′,e),n′),m) simulates c′c'c′ on (e,n′)(e, n')(e,n′) through uuu and returns the mmm-th bit of the output (or the marker). Its cost is governed by the polynomial (bitQueryBound U) BU(s)=pU(s+1)+(s+1)(s+534)+2s+29B_U(s) = p_U(s+1) + (s+1)(s+534) + 2s + 29BU​(s)=pU​(s+1)+(s+1)(s+534)+2s+29.

Theorem. Let UUU be a universal machine, α\alphaα a type with a size-aware encoding, c′c'c′ and eee programs, n′:αn' : \alphan′:α, n∈Nn \in \mathbb{N}n∈N, y∈{0,1}∗y \in \{0,1\}^*y∈{0,1}∗ and t∈Nt \in \mathbb{N}t∈N. Assume

  1. [enc(e,n′)]⊢c′⇓tenc(y)[\mathrm{enc}(e, n')] \vdash c' \Downarrow^{t} \mathrm{enc}(y)[enc(e,n′)]⊢c′⇓tenc(y): the program c′c'c′ runs on the input (e,n′)(e, n')(e,n′) to the string yyy at cost ttt;
  2. t≤2nt \le 2^nt≤2n;
  3. the budget condition
BU(∥c′∥+∥e∥+∥n′∥+t)+(∥c′∥+∥e∥+1+∥n′∥+1)+4  ≤  n+1,B_U\bigl(\|c'\| + \|e\| + \|n'\| + t\bigr) + \bigl(\|c'\| + \|e\| + 1 + \|n'\| + 1\bigr) + 4 \;\le\; n + 1,BU​(∥c′∥+∥e∥+∥n′∥+t)+(∥c′∥+∥e∥+1+∥n′∥+1)+4≤n+1,

in which ∥c′∥+∥e∥+1+∥n′∥+1=size(enc((c′,e),n′))\|c'\| + \|e\| + 1 + \|n'\| + 1 = \mathrm{size}(\mathrm{enc}((c', e), n'))∥c′∥+∥e∥+1+∥n′∥+1=size(enc((c′,e),n′)) is the size of the datum to be hardcoded.

Then

IsSuccinctDesc(hardcode(βu, enc((c′,e),n′)), n, y):\mathrm{IsSuccinctDesc}\bigl(\mathrm{hardcode}(\beta_u,\ \mathrm{enc}((c', e), n')),\ n,\ y\bigr):IsSuccinctDesc(hardcode(βu​, enc((c′,e),n′)), n, y):

the bit-query program with ((c′,e),n′)((c', e), n')((c′,e),n′) hardcoded is a succinct description of yyy with parameter nnn.

This is the step of the recursive compression argument ([MNY, Lemma 5.1], blueprint lem:recursive-compression; likewise for the compressibility criterion lem:compressible-criterion) that manufactures, inside the self-referential decider, a genuine succinct description of the string computed at the next recursion level — the output yyy of the fixed-point program c′c'c′ on (e,n′)(e, n')(e,n′) — so that the guarantees of the compression procedure, which hold only on genuine descriptions, apply to it. There, n′n'n′ is the next level (2n+12n+12n+1, or a pair of levels), the bound t≤2nt \le 2^nt≤2n comes from the polynomial time bound of the decider, which is at most n+1≤2nn + 1 \le 2^nn+1≤2n above a threshold, and the budget condition is discharged by the threshold lemma exists_threshold: for n≥2K+1+∥e∥n \ge 2^{K + 1 + \|e\|}n≥2K+1+∥e∥, with KKK depending on the overhead polynomial, every polynomial in ∥e∥+∣n∣\|e\| + |n|∥e∥+∣n∣ is at most n+1n + 1n+1.

Formalization Note IsSuccinctDesc differs from [MNY, Definition 2.4] in its time bound: (n+1)(∣m∣+1)2(n+1)(|m|+1)^2(n+1)(∣m∣+1)2 instead of nnn, since in a model that charges for reading its input a bound independent of ∣m∣|m|∣m∣ is vacuous for ∣m∣>n|m| > n∣m∣>n (module docstring of MIPRE.Foundations.Compression). The hardcoded parameter n′:αn' : \alphan′:α is independent of the description's parameter n∈Nn \in \mathbb{N}n∈N, and α\alphaα may be any encodable type. The description's cost on a query mmm is, by hardcode_time, the cost of βu\beta_uβu​ on the pair plus size(enc((c′,e),n′))+size(enc(m))+3\mathrm{size}(\mathrm{enc}((c',e),n')) + \mathrm{size}(\mathrm{enc}(m)) + 3size(enc((c′,e),n′))+size(enc(m))+3, and size(enc(m))≤4∣m∣+1\mathrm{size}(\mathrm{enc}(m)) \le 4|m| + 1size(enc(m))≤4∣m∣+1; the summand +4+4+4 of the budget condition is what absorbs this overhead after multiplication by (∣m∣+1)2(|m|+1)^2(∣m∣+1)2. The length clause follows from ∣y∣≤size(enc(y))≤t≤2n|y| \le \mathrm{size}(\mathrm{enc}(y)) \le t \le 2^n∣y∣≤size(enc(y))≤t≤2n, since a run of cost ttt has a result of size at most ttt.

Preamble
import Mathlib.Algebra.Polynomial.Eval.Defs
import Mathlib.Data.List.Basic
import Mathlib.Data.Nat.Bits
import Mathlib.Data.Nat.Notation
import Mathlib.Data.Nat.Size
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

open MIPRE
open MIPRE.Cost
open Polynomial
Formal statement
theorem MIPRE.Cost.isSuccinctDesc_hardcode (U : UniversalMachine) {α : Type*} [SizedEncoding α]
    (c' e : Prog) (n' : α) (n : ℕ) (y : BitStr)
    {t : ℕ} (hrun : c'.Runs (encode (e, n')) (encode y) t) (hlen : t ≤ 2 ^ n)
    (hbudget : (bitQueryBound U).eval (esize c' + esize e + esize n' + t) +
      (esize c' + esize e + 1 + esize n' + 1) + 4 ≤ n + 1) :
    IsSuccinctDesc (hardcode (Prog.bitQueryProg U.univ) (encode ((c', e), n'))) n y := by sorry
Source
https://github.com/vidick/MIPRE-formalization/blob/70cbf1c52e3d5e1dff1162fdf952c9a9f4bd99ed/MIPRE/Foundations/Cost/Succinct.lean#L159-L187; internal lemma of the formalization of blueprint def:succinct, used in lem:recursive-compression, https://vidick.github.io/MIPRE-formalization/blueprint/; [MNY] A. Marks, S. S. Nezhadi, H. Yuen, The recursive compression method for proving undecidability results, manuscript, Definition 2.4 and Lemma 5.1

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