Lazy Random Oracle Equals Eager Full-Table Sampling #
For an oracle specification D →ₒ R with a single constant range R, running an
OracleComp (D →ₒ R) α under the lazy random oracle (OracleSpec.randomOracle,
i.e. uniformSampleImpl.withCaching) has the same output distribution as the eager
strategy: sample a full answer table f : D → R uniformly, then evaluate the
computation deterministically against f via evalWithAnswerFn.
The lazy oracle samples a fresh uniform value on first query and caches it for
consistency, so caching only ever affects repeated queries. Since every fresh
table entry is uniform and independent, lazily sampling on demand is
distributionally identical to pre-sampling the whole table. The marginalization
lemma evalDist_uniformSample_bind_update is the workhorse: it absorbs each
fresh on-demand uniform draw into the pre-sampled table.
Main results #
evalDist_simulateQ_randomOracle_run'_eq_tableExtending: the generalized, cache-parametrized form, the induction vehicle.evalDist_simulateQ_randomOracle_run'_empty_eq_uniformTable: the empty-cache corollary — the lazy-vs-eager equivalence proper.
The total answer table obtained by overlaying a QueryCache on top of a full function table:
cached entries take priority, uncached coordinates fall through to g.
Instances For
Overlaying c.cacheQuery t u on g is the t-update of overlaying c on g.
When t is uncached, updating the overlaid table at t equals overlaying the cache on the
updated full table.
Marginalization, post-composed. For any continuation ψ : (D → R) → α, drawing a fresh
uniform u, then a full uniform table g, and evaluating ψ on Function.update g t u has the
same distribution as evaluating ψ on a directly drawn uniform table.
Lazy random oracle equals eager full-table sampling — cache-parametrized form.
Running oa under the lazy random oracle starting from cache c yields the same output
distribution as: sample a full table g : D → R uniformly, then evaluate oa deterministically
against the table that overlays c on g.
This is the induction vehicle: the cache c is generalized so the query/bind step can recurse
through cacheQuery.
Overlaying the empty cache leaves a full table unchanged.
Lazy random oracle equals eager full-table sampling.
Running an OracleComp (D →ₒ R) α under the lazy random oracle from the empty cache yields the
same output distribution as: sample a full answer table g : D → R uniformly, then evaluate the
computation deterministically against g.
This is the empty-cache specialization of
evalDist_simulateQ_randomOracle_run'_eq_tableExtending: the classic lazy-vs-eager-sampling
equivalence. Lazy caching only affects repeated queries, and since each fresh table entry is
uniform and independent, sampling on demand matches pre-sampling the whole table.