Compressibility criterion against Mathlib's halting problem: a computable reduction on partial recursive codes
ProvedMIPRE.Cost.compressibility_criterion_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 with distinguished strings and ; let be a closed program with halting on if and only if ; 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 compressibility criterion. Then there is a computable such that
This is Lin's compressibility criterion repackaged against the halting problem in the ambient formalization's own form (blueprint lem:halting-form): a Mathlib-computable reduction on codes of partial recursive functions, halting being halting of the code on input . It is the seam at which the development meets Mathlib's computability, in the abstract form of the main theorem's halting reduction ( and standing for normal-form-verifier games having a perfect PCC strategy, respectively value at most ); the formalization's headline halting reduction is proved through the gap-compression instantiation of the per-level criterion.
Formalization Note. The statement is MIPRE.Cost.compressibility_criterion_halting, with the hypotheses of compressibility_criterion (hS an equivalence, Compr : PolyTimeFun ((Prog × ℕ) × ℕ) BitStr) and the conclusion ∃ g : Nat.Partrec.Code → BitStr, Computable g ∧ ∀ pc, ((pc.eval 0).Dom → g pc ∈ A) ∧ (¬(pc.eval 0).Dom → g pc ∈ B). Only the interface changes: the reduction of compressibility_criterion is composed with the compiler exists_compile from codes to programs of the cost model, computable on descriptions and preserving halting on the empty input; the compiler carries no time bound, so the conclusion is Computable rather than polynomial-time. The departures from the paper recorded for the compression lemmas (the succinctness bound , the next level , the explicit threshold , the start level carried as data) apply unchanged.
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.compressibility_criterion_halting
(A B : Set BitStr)
(yYes : BitStr) (hyes : yYes ∈ A) (yNo : BitStr) (hno : yNo ∈ B)
(S : Prog) (hSws : S.WellScoped 1) (hS : ∀ x : BitStr, Halts S (encode x) ↔ x ∉ B)
(Compr : PolyTimeFun ((Prog × ℕ) × ℕ) BitStr)
(hCompr : ∀ (c : Prog) (m : ℕ) (x : BitStr) (n : ℕ),
IsSuccinctDesc c m x →
(x ∈ A → Compr ((c, m), n) ∈ A) ∧ (x ∈ B → Compr ((c, m), n) ∈ B)) :
∃ g : Nat.Partrec.Code → BitStr, Computable g ∧
∀ pc : Nat.Partrec.Code,
((pc.eval 0).Dom → g pc ∈ A) ∧
(¬(pc.eval 0).Dom → g pc ∈ B) := by sorry