Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Efficient s-m-n, description size: ∣s(p,d)∣=∣p∣+size(d)+35|s(p,d)| = |p| + \mathrm{size}(d) + 35∣s(p,d)∣=∣p∣+size(d)+35

Proved
MIPRE.Cost.hardcode_size

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

cost-modelmipre-formalizationsmn-theoremsuccinct-descriptions

Programs of the ambient cost model occur as data through their tree serialization enc(p)\mathrm{enc}(p)enc(p) (Prog.toData): each constructor becomes a cons\mathtt{cons}cons node whose head is a unary tag kˉ\bar kkˉ (the list of kkk copies of nil\mathtt{nil}nil, a tree of size 2k+12k+12k+1) and whose tail holds the fields. The size of a program is ∣p∣:=size(enc(p))|p| := \mathrm{size}(\mathrm{enc}(p))∣p∣:=size(enc(p)) (esize), where size\mathrm{size}size counts the nodes of a binary tree, and s(p,d)=let cons(const d,var 0) in ps(p,d) = \mathtt{let}\ \mathtt{cons}(\mathtt{const}\ d, \mathtt{var}\ 0)\ \mathtt{in}\ ps(p,d)=let cons(const d,var 0) in p (hardcode p d) is the s-m-n map, the program running ppp on the pair of the literal ddd and its input.

Statement. For every program ppp and datum ddd,

∣s(p,d)∣  =  ∣p∣+size(d)+35.|s(p, d)| \;=\; |p| + \mathrm{size}(d) + 35 .∣s(p,d)∣=∣p∣+size(d)+35.

This is the description-size clause of the efficient s-m-n theorem (blueprint lem:smn, [MNY, Lemma 2.2]): hardcoding grows a description additively. The recursive compression argument relies on it to keep the self-referential description that it hands to the compressor within the size slack of the succinctness definition at the next level, and the compressibility criterion computes the size of its hardcoded search program with this equation.

Formalization Note: The statement is an exact equality, specific to the serialization: toData (hardcode p d) is cons(4ˉ,cons(cons(2ˉ,cons(cons(6ˉ,d),cons(nil,nil))),enc(p)))\mathtt{cons}(\bar 4, \mathtt{cons}(\mathtt{cons}(\bar 2, \mathtt{cons}(\mathtt{cons}(\bar 6, d), \mathtt{cons}(\mathtt{nil},\mathtt{nil}))), \mathrm{enc}(p)))cons(4ˉ,cons(cons(2ˉ,cons(cons(6ˉ,d),cons(nil,nil))),enc(p))) with tags 444 (let_), 222 (cons), 666 (const), and cons(nil,nil)=enc(var 0)\mathtt{cons}(\mathtt{nil},\mathtt{nil}) = \mathrm{enc}(\mathtt{var}\ 0)cons(nil,nil)=enc(var 0); the 353535 is the node count of this fixed scaffolding. [MNY] states only a polynomial bound on the size of s(e,x)s(e,x)s(e,x).

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 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_Toolkit

open MIPRE
open MIPRE.Cost
open Polynomial
Formal statement
theorem MIPRE.Cost.hardcode_size (p : Prog) (d : Data) :
    esize (hardcode p d) = esize p + d.size + 35 := by sorry
Source
https://github.com/vidick/MIPRE-formalization/blob/70cbf1c52e3d5e1dff1162fdf952c9a9f4bd99ed/MIPRE/Foundations/Cost/Toolkit.lean#L94-L99; blueprint lem:smn, https://vidick.github.io/MIPRE-formalization/blueprint/; [MNY] A. Marks, S. S. Nezhadi, H. Yuen, The recursive compression method for proving undecidability results, manuscript, Lemma 2.2

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