Computability under a semantic promise #
An effective presentation is sometimes most naturally described by a raw, computably encoded type of programs together with a semantic validity promise. For example, a raw partial-recursive program is a valid decider when it halts on every input. Validity need not itself be decidable: the algorithm is required to halt only when its code satisfies the promise.
ComputableOnPromise valid eval says that eval is one uniform partial-recursive
evaluator and is total on every valid code. DecidesOnPromise additionally says
that its Boolean result decides a relation on the promised inputs.
ComputablePredOnPromise valid p existentially packages such an evaluator for a
unary predicate.
These predicates deliberately retain the raw Primcodable code type. Replacing it
by the subtype {c // valid c} would incorrectly require a computable encoding of a
generally undecidable semantic property.
A uniform partial-recursive evaluator which is guaranteed to return on every
input whenever its raw code satisfies valid. No effectiveness assumption is
made about the semantic promise itself.
Equations
- ComputableOnPromise valid eval = (Partrec₂ eval ∧ ∀ (c : Code), valid c → ∀ (x : Input), (eval c x).Dom)
Instances For
A uniform partial-recursive Boolean evaluator which, on valid codes, always
returns and returns true exactly when relation c x holds.
Equations
- DecidesOnPromise valid eval relation = (ComputableOnPromise valid eval ∧ ∀ (c : Code), valid c → ∀ (x : Input), relation c x ↔ true ∈ eval c x)
Instances For
A predicate is computable on the promised inputs when one partial-recursive
Boolean evaluator is total and correct at every input satisfying valid.
Unlike ComputablePred, the evaluator may diverge away from the promise. This is
essential for semantic promises such as "this program halts on every word": the raw
program syntax is effectively encoded even though validity itself is undecidable.
Equations
Instances For
An ordinary computable predicate is computable under any promise.
If every input satisfies the promise, promise computability is ordinary
ComputablePred computability.
With the trivial promise, ComputablePredOnPromise is exactly
ComputablePred.
Acceptance by a partial-recursive Boolean evaluator is recursively enumerable:
run the evaluator, return when it says true, and diverge when it says false.
The totality component available from a promise decider.
The correctness component available from a promise decider.