Recursive compression against Mathlib's halting problem: a computable reduction on partial recursive codes
ProvedMIPRE.Cost.recursive_compression_haltingThroughout, computation is in the ambient cost model of the formalization: programs (Prog) form a small first-order language on binary-tree data (Data), counts the nodes of a value, a bit string , a natural number (in binary) or a pair is a value through a size-faithful encoding , and a program is its own tree encoding, of size . The timed semantics charges one unit per evaluation rule plus the size of every value read, so a run of cost has output of size at most . A polynomial-time computable function (PolyTimeFun α β) is a function together with a closed program computing it on encodings and an explicit polynomial bounding the cost in the size of the encoded input. " halts on the empty input" means that the program , run on the value nil, halts (Halts e nil). The pair of a program and a parameter is a succinct description of (IsSuccinctDesc c m x) when is closed, , and for every the program on the binary input answers the bit query, returning the -th bit of if and the marker otherwise, within cost , where denotes the binary length of . Mathlib's Nat.Partrec.Code is a Gödel numbering of the partial recursive functions: a code denotes the partial function , and says that halts on the input ; is Mathlib's computability of total functions between primcodable types (here codes and bit strings List Bool).
Let , let with a distinguished and for all , and let be a polynomial-time computable compression procedure on claimed succinct descriptions with target parameter such that whenever genuinely describes : and — the hypotheses of the recursive compression lemma. Then there is a computable such that
This is the recursive compression lemma repackaged against the halting problem in the ambient formalization's own form (blueprint lem:halting-form): the reduction is presented as a Mathlib-computable map on codes of partial recursive functions, halting being halting of the code on input , rather than on programs of the cost model. It is the seam at which the development meets Mathlib's computability, in the abstract form of the entanglement route of the main theorem ( and standing for normal-form-verifier games and the entanglement requirement); the formalization's headline halting reduction is proved through the value-form route instead.
Formalization Note. The statement is MIPRE.Cost.recursive_compression_halting, with the same hypotheses as recursive_compression and the conclusion ∃ g : Nat.Partrec.Code → BitStr, Computable g ∧ ∀ pc, ((pc.eval 0).Dom → g pc ∈ A) ∧ (¬(pc.eval 0).Dom → f (g pc) = ⊤). Only the interface changes: the reduction of recursive_compression is composed with a compiler from codes to programs of the cost model (exists_compile) that is computable on descriptions and preserves halting on the empty input; the compiler carries no time bound, so the conclusion is Computable, not polynomial-time. The departures from the paper recorded for recursive_compression (the succinctness bound , the next level , the explicit threshold ) apply unchanged, as does the fact that the finiteness hypothesis on over is not used.
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 Polynomial
theorem MIPRE.Cost.recursive_compression_halting
(f : BitStr → ℕ∞) (A : Set BitStr)
(y₀ : BitStr) (hy₀ : y₀ ∈ A)
(hA : ∀ x ∈ A, f x < ⊤)
(Compr : PolyTimeFun ((Prog × ℕ) × ℕ) BitStr)
(hCompr : ∀ (c : Prog) (m : ℕ) (x : BitStr) (n : ℕ),
IsSuccinctDesc c m x →
(max (f x) (n : ℕ∞) ≤ f (Compr ((c, m), n))) ∧
(x ∈ A → Compr ((c, m), n) ∈ A)) :
∃ g : Nat.Partrec.Code → BitStr, Computable g ∧
∀ pc : Nat.Partrec.Code,
((pc.eval 0).Dom → g pc ∈ A) ∧
(¬(pc.eval 0).Dom → f (g pc) = ⊤) := by sorry