Documentation

CslibFrontier.Computability.BlumComplexity.Fuel

The fuel of evaln as a Blum complexity measure #

Mathlib's Nat.Partrec.Code.evaln k c n evaluates the code c on n with fuel k. It fails when the evaluation recurses too deeply or meets a number ≥ k. The fuel is monotone (Code.evaln_mono) and sufficient fuel always exists for halting computations (Code.evaln_complete). The fuel of c on n, evalnFuel c n, is the least k for which evaln k c n succeeds. It satisfies Blum's axioms [Blu67]: it is defined exactly when c halts on n, and evalnFuel c n = k is decidable because evaln is primitive recursive (Code.primrec_evaln). This gives the complexity measure fuelMeasure.

The fuel bounds both the recursion depth of the evaluation and the size of every number it inspects. In particular n < evalnFuel c n whenever it is defined (lt_of_mem_evalnFuel), so complexity classes of bounds t ≤ id are empty for this measure. The fuel is not the step count of a machine model; it is the natural cost measure of Mathlib's evaluator.

Main definitions #

Main results #

References #

The least fuel k with which Code.evaln k c n succeeds. It is defined exactly when c halts on n.

evalnFuel c n = k exactly when evaln k c n succeeds and evaln j c n fails for every j < k.

Blum's first axiom for the fuel: it is defined exactly when the code halts.

Blum's second axiom for the fuel: evalnFuel c n = k is decidable.

The fuel measure: the Blum complexity measure whose cost is the least fuel with which Code.evaln succeeds.

@[simp]

The cost of the fuel measure is evalnFuel.

The fuel exceeds the input, since evaln k c n fails unless n < k.