The bridge to Mathlib's computability layer #
Umbrella file for the passage from problems – isomorphism-closed properties
of finite structures – to sets of naturals, on which ComputablePred and
REPred are defined. The layer is generic: it is built once for the whole
catalog, and a problem needs nothing of its own to be read through it beyond a
list of the symbols of its vocabulary.
The layer, in four steps #
DescriptiveComplexity.Computability.Realize– satisfaction of a first-order formula is decidable on a finite structure with decidable relations. Small, self-contained, and the first formal justification of the claim, elsewhere by inspection, that first-order interpretations are effective.DescriptiveComplexity.Computability.FinStruct– a finite structure over a finitely presented relational vocabulary, as data: a universeFin (n + 1)and a list of Boolean tables. This is thePrimcodabletype, and the universe is nonempty and linearly ordered by construction – which is what an ordered reduction would need, with no order to encode.DescriptiveComplexity.Computability.Vocabpresents the vocabularies, and in particular closes the presentations underLanguage.sum.DescriptiveComplexity.Computability.Eval– for each fixed formula, the evaluation of that formula on a concrete structure is primitive recursive. Everything else is an application of this.DescriptiveComplexity.Computability.REPred–RE ⊆ REPred: a problem definable in∃SO[new]denotes a recursively enumerable set of concrete instances. The∃SO[new]certificate – a number of invented values and an assignment of the relation variables – is a finite object, so it is searched for; the first-order kernel is checked on it by (3). No machine model is involved anywhere.DescriptiveComplexity.Computability.Catalogreads this at the two problems the machine bridge is about (DescriptiveComplexity.halt_rePred,DescriptiveComplexity.finsat_rePred).DescriptiveComplexity.Computability.Reduction– first-order reductions are computable, so¬ComputablePredtransfers backwards along≤ᶠᵒ,≤ᶠᵒ[≤]and≤ʳᶠᵒ[≤](DescriptiveComplexity.not_computablePred_of_relOrderedReductionand its two corollaries). Three things have to be computed: the order (free – the universe of a concrete instance is alreadyFin (n + 1)), the renumbering forced by a definable target domain, and the tags of a defining formula, which are known only at run time.DescriptiveComplexity.Computability.CodeHalt– undecidability. The known-undecidable set is Mathlib's halting problem, and it is carried into the catalog by making the code the instance: aNat.Partrec.Codeis drawn as its syntax tree (DescriptiveComplexity.codeStruct), which is a plain tree flattening and so primitive recursive, and the problemDescriptiveComplexity.CODEHALTasks whether the drawn code halts on0. WhenceDescriptiveComplexity.not_computablePred_codehalt: the library's first problem proved undecidable outright. WithDescriptiveComplexity.codehalt_mem_REit givesDescriptiveComplexity.not_computablePred_of_RE_hard– every RE-hard problem is undecidable, since hardness here is cofinal and reductions are computable – and henceDescriptiveComplexity.finsat_not_computable, Trakhtenbrot's theorem.DescriptiveComplexity.Computability.CodeHaltComplete– the converse inclusion, and with it the identityRE = REPred. A semi-decidable problem reduces toCODEHALT(DescriptiveComplexity.Problems.CodeHalt.Hardness): the reduction draws the instance as the program that runs a semi-decision procedure on it, and the procedure is obtained from Mathlib (Nat.Partrec.Code.exists_code) rather than built, which is what avoids the evaluator with addressed storage the machine route would need. WhenceDescriptiveComplexity.mem_RE_iff_rePred– RE is exactly the recursively enumerable properties of finite structures – andDescriptiveComplexity.codehalt_RE_complete, andDescriptiveComplexity.RE_ne_coRE, by Post's theorem applied to the undecidability of (6).DescriptiveComplexity.Computability.PcpComplete– the machine bridge's harvest.DescriptiveComplexity.orderedReduction_halt(DescriptiveComplexity.Problems.Machine.HaltHard) is the same statement as (7) at the machine model, and the computation-history dominoesDescriptiveComplexity.halt_ordered_fo_reduction_pcpcarry hardness on: the halting problem and Post's correspondence problem are RE-complete (DescriptiveComplexity.halt_RE_complete,DescriptiveComplexity.pcp_RE_complete) and undecidable (DescriptiveComplexity.halt_not_computable,DescriptiveComplexity.pcp_not_computable).