Synthesizing bounded logspace computations #
logspace combines the existing plain fun_prop calculus with bounded answer-vector
construction. A local hypothesis ∀ a, r a ≤ k selects the constant bound in
ComputableInLogSpace.mapToBits_range_of_le, also for a count taken at a prepared argument such
as r p.1; the count and indexed callback still need their own certificates with the exact
input and output encodings. In particular, this rule does not claim arbitrary polynomially long
answer vectors are logspace computable.
logspace [f, g] first unfolds f and then g in the goal, as unfold f g does, so a name
that does not occur at its turn is an error. Every form then runs the preparation shared with
polytime, ppt and space (Cslib.Tactic.prepareCertificateGoal): it inlines literal lets
in the goal and local encoding lets, and adds the certificates stored in local structures as
local facts.
Named program_certificate proofs are tried before their implementations unfold. Local routine
certificates use recomputing logspace composition, including calls
on prepared tuple arguments. Search stays in ComputableInLogSpace: it never converts a goal
to polynomial time or to a tidy predicate. Importing this module adds no fun_prop transition.
When the search fails, its error ends with a note naming the certificates and bounds to supply.
Main definitions #
logspace: close a plain logspace goal using local bounds, routine certificates and composition.
Curried callbacks let unification determine the indexed program from a map body. This kernel declaration is public because runtime tactic application uses ordinary imports.
Prove a plain logspace certificate using composition and supplied constant bounds.
logspace [f, g] first unfolds f and then g in the goal, as unfold f g does; a name that
does not occur at its turn is an error. Before searching, every form also inlines literal lets
in the goal, replaces local encoding lets by their values and adds the certificates stored in
fields of local structures as local facts, as polytime does.