Memoized oracle computations #
An association-list cache in front of a strict oracle PPT computation is strict oracle PPT. On a cache hit the stored value is returned and the computation does not run, so it makes no external call; on a miss it runs once and its result is stored. The certificate charges comparing complete key encodings, the lookup and writing the returned cache.
The closed rule Cslib.Probability.IsPPTOn.memoize may run and discard its sampler on a hit. An
oracle computation cannot be run speculatively: a stateful external oracle observes every call.
Main results #
Cslib.ProbOracleComp.mem_support_memoize: a possible result of a cached call is a hit or a possible result of the computation, stored at the front of the cache.Cslib.ProbOracleComp.memoize_call_size_le: a cached call preserves a value-size invariant and adds at most one encoded entry, for every external oracle.Cslib.Probability.IsOraclePPTOn.memoize: certify a memoized oracle computation byfun_prop.
References #
Adapts Computability/Probabilistic/Memoize.lean on the cslib crypto branch at
5ff69ca93402e7c947208dc56396d6d86203ccd8 to oracle computations.
A possible result of a cached call is either a hit, leaving the cache unchanged, or a possible result of the computation, stored at the front of the cache.
A cached call preserves a bound on the encoded values of all entries, returns a value within that bound and adds at most one encoded entry, for every possible result under every external oracle. The growth charges the complete key and value and both layers of framing.
Cache a strict oracle PPT computation's results in an ordinary list. On a hit the computation
does not run and makes no external call; on a miss it runs once. Comparing complete key
encodings, the lookup and the complete returned cache are charged. Repeated keys use their first
cached occurrence. The inhabitant of Value is never returned.