Synthesizing polynomial-time certificates #
Adapted from the cslib crypto branch: named certificates are tried before their implementations
are unfolded. fun_prop handles composition; Aesop chooses loop rules and uses local growth
contracts. Plain and internal tidy goals use separate rules, with fixed machines and polynomial
bounds across all encoded inputs. Plain search applies plain statements directly; it does not
lower a goal or restate its hypotheses tidily. Unknown algorithms still require certificates.
On ordinary failure, polytime includes one failed compositional attempt when the backend has
reported one. This is a search hint, not a claim that the subterm is uncomputable. Resource-limit
and interrupt exceptions are unchanged.
Plain search excludes rules that would start search in the internal tidy calculus. Whether an imported rule is excluded is decided once per file and shared by later calls (#1155); rules of the current module are classified by each call.
Goal preparation, shared with ppt, runs before the search. polytime [f, g] unfolds the hinted
definitions in the goal and inlines the lets they expose. Every form replaces local encoding
lets (let E := encPair encUnary encBits) by their values in the goal and the hypotheses, and
adds the certificates stored in fields of local structures (a scheme's S.decrypt_polyTime, an
admissibility hypothesis's h.guess, a conjunction's components) as local facts.
Main definitions #
polytime: prove a polynomial-time certificate using thePolyTimeAesop rule set.Cslib.Tactic.PolyTime.Internal.prepareGoal: the goal preparation shared withppt.
References #
Adapted from Cslib/Tactic/PolyTime.lean on the cslib crypto branch at
5ff69ca93402e7c947208dc56396d6d86203ccd8; deterministic search consumes the canonical
plain calculus.
Prepend a computed bit with both intermediate raw encodings fixed for the tactic.
Append computed framed lists with their element encoding fixed for the tactic.
Prepend a computed element to a framed list with its element encoding fixed.
Retain Aesop's local application alternatives and priority, excluding only rules which would
start raw search from a plain goal. Adapted from Aesop.BuiltinRules.applyHyps (Jannis Limperg).
Instances For
Reuse global classification answers across one invocation, and those of imported declarations across the file. Rule tables, certificate lookup, matching and local evidence are not projected or cached by this wrapper.
Instances For
Apply the deterministic boundary using the current tables and scoped classification memo. Explicit raw construction entries and all named-certificate metadata retain their old policy.
Instances For
Collect one backend hint without rerunning search, reporting it as a failure of the tactic
tacticName. Each invocation, including a nested one, has its own reference; withEnv restores
the caller's environment even on resource exceptions. The ordinary catch does not intercept
Lean's resource-limit or interrupt exceptions.
Instances For
Shared compositional backend with a fresh alias-aware raw-premise boundary. The standard assumption discharger and ordinary transition depth are retained; callers keep their step limit. Consumers can reuse the same boundary for nested plain deterministic goals.
Instances For
Expose a negated guard to loop rules when compositional proof search needs their help.
Fix a raw bit list's encoding and expose the two growth cases before proof search.
Fix a framed list's encoding before proof search infers the element encoding.
Fix a raw bit list's encoding and expose the two growth cases before proof search.
Fix a framed list's encoding before proof search infers the element encoding.
The plain iteration rule retains the same constant additive growth contract.
Prepare a certificate goal: unfold the hinted definitions in the goal and inline the lets
they expose, unfold local encoding lets, and expose certificates stored in fields of local
structures.
Instances For
Prove a polynomial-time certificate from known routines and controlled loop rules.
polytime [f, g] first unfolds the definitions f and g in the goal. Before searching, every
form also replaces local encoding lets (let E := encPair encUnary encBits) by their values
and adds the certificates stored in fields of local structures, such as S.encrypt_ppt for a
scheme S or h.guess for an admissibility hypothesis h, as local facts.
Instances For
Elaborate polytime: prepare the goal, then search with the PolyTime Aesop rule set.