Documentation

CslibFrontier.Computability.Machines.Turing.MultiTape.Complexity.InSpace.FindCode

First matching binary candidate in native space #

The search retains the predicate's context, one binary candidate, a binary remaining count and an optional answer. The native loop stops at the first match or when the range is exhausted. Space is linear in the encoded context, lower bound and count, including the test's workspace.

Main results #

theorem Turing.MultiTapeTM.ComputableInSpace.findCode {C : Type} {encC : C ↪ List Bool} {test : C × ℕ → Bool} (ht : ComputableInSpace test (encPair encC encNat) encBool fun (p : C × ℕ) => ((encPair encC encNat) p).length) :
ComputableInSpace (fun (p : C × ℕ × ℕ) => Cslib.findCode (fun (m : ℕ) => test (p.1, m)) p.2.1 p.2.2) (encPair encC (encPair encNat encNat)) (encOption encNat) fun (p : C × ℕ × ℕ) => ((encPair encC (encPair encNat encNat)) p).length

Search for the first passing binary candidate, stopping on that match or exhaustion. The cursor and answer are bounded by the end of the range, and the remaining count only decreases.