Compilation of Search Procedures to TM0 #
This file proves the key compilation theorem: if a language can be expressed
as { w | ∃ a : α, test a w = true } for a Primcodable witness type α
and a Computable₂ test function, then the language is TM-recognizable
by a TM0 machine.
Main results #
search_is_partrec— the µ-search is Partreccode_to_tm0— Code → TM0 evaluationsearch_halts_tm0— the search is TM0-recognizable (with an internalFintypetape alphabet)is_TM_of_searchable— searchable languages are internally TM-recognizable
Architecture note #
This file compiles computable witness search to the internal Partrec-chain
TM0 alphabet. The final alphabet/encoding bridge to is_TM is supplied by
CodeToTMDirect.lean.
Fintype instances for Partrec types #
Equations
- One or more equations did not get rendered due to their size.
Search Step Function #
The "step" function of the search: enumerate the n-th witness and test it.
Equations
- searchStep test w n = match Encodable.decode n with | some a => test a w | none => false
Instances For
Sub-problem 1: Computable₂ test → Code (PROVED) #
Sub-problem 1 (PROVED): The µ-search over a computable test is Partrec.
Sub-problem 2: Code → TM0 (PROVED) #
Sub-problem 2 (PROVED): Partrec Code → TM0 evaluation.
Core Compilation Theorem (PROVED) #
The core compilation theorem.
The enumerate-and-test search pattern is implementable by a TM0 machine
over the Partrec chain's internal Fintype alphabet ChainΓ. The TM0
halts on enc w if and only if there exists a witness a such that
test a w = true.
This theorem captures the full mathematical content: computable search
procedures yield TM-recognizable languages. The tape alphabet is the
chain's internal alphabet rather than Option T; converting to Option T
requires alphabet simulation (see tm0_alphabet_simulation below).
Main Compilation Theorem #
Main Compilation Theorem: If we can search over
a Primcodable domain with a Computable₂ test, the resulting language
is TM-recognizable (with an internal Fintype tape alphabet).
This is the is_TM-style result (without Fintype on states).
For the full is_TM result (with Option T tape alphabet), see
Strengthened versions with Fintype states #
Strengthened code_to_tm0 with Fintype states.
Strengthened search_halts_tm0 with Fintype states.
Strengthened is_TM_of_searchable with Fintype states.