Synthesizing polynomial-time proofs #
polytime proves f ∈ FP, UnaryFn f, and FPPred p by composing existing
machine-based closure theorems. It handles pairing, reversal, concatenation,
slicing, bit access, unary arithmetic, comparisons, conditionals, and encoded
bounded ranges. Local certificates support calls to supplied algorithms.
Use polytime [program] to unfold a named program before proof search.
Register reusable closure rules and algorithm certificates with @[polytime].
Number-valued certificates should use UnaryFn; local certificates written as
membership of a unary encoding in FP are normalized automatically.
Iteration requires a certified step, an efficient unary count, and a constant
bound on the number of bits added per step. More general loops can use
iterate_mem_FP explicitly, with polytime discharging its efficiency premises
and the caller proving the state-size invariant.
This adapts Samuel Schlesinger's Aesop rule-set and local-certificate approach
from the CSLib crypto branch to Complexitylib's own FP predicates:
https://github.com/SamuelSchlesinger/cslib/blob/b9f4e0dd39cd88231322b4225b2bf7ba6bc7e8a3/Cslib/Tactic/PolyTime.lean
The rules construct ordinary Lean proofs. Unknown algorithms need certificates;
neither arbitrary Lean computation nor unrestricted iteration gets unit cost.
The underlying Aesop rule set is ComplexityPolyTime.
A unary loop count and constant step growth suffice for polynomial iteration.
Prove polynomial-time membership from registered closure rules and local certificates.
Equations
- Complexity.Tactic.PolyTime.tacticPolytime = Lean.ParserDescr.node `Complexity.Tactic.PolyTime.tacticPolytime 1024 (Lean.ParserDescr.nonReservedSymbol "polytime" false)
Instances For
Prove polynomial-time membership from registered closure rules and local certificates.
Equations
- One or more equations did not get rendered due to their size.