Repository navigation
Conversation
… unqueried cache entries `OracleComp.runLog ans oa` is the query log of the run of `oa` answered by the fixed answer function `ans`, with its bind, query, map, simulation and agreement laws, in the new `QueryTracking/RunLog.lean`. `tableQueryLog` is `runLog` against its table. `IsQueryBoundP.simulateQ_of_step_le` multiplies a predicate-targeted bound by the per-query cost of a handler; `IsQueryBoundP.simulateQ_of_step` and `IsQueryBoundP.simulateQ_of_step_le_total` follow from it. Query logging keeps predicate-targeted bounds and query predicates, and `AllQueriesSatisfy.map_run_simulateQ_eq_of_query_map_eq` restricts the state-projection law to the queries a program may make. From it, a cached run, and a run in the random oracle model, of a program that never queries outside `P` returns the same results from caches agreeing on `P`. `simulateQ_pure_eq_evalWithAnswerFn` answers queries with `pure` of fixed answers in any lawful monad, and replaces the `X →ₒ Y` case in `VectorCommitment`. `ProbabilityBounds` gains a list union bound, an implication bound, an `absDiff` split along a third event and a simp lemma for a two-step null event. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🤖 PR SummaryFailed to generate AI summary. Please check the per-file summaries and statistics below. Statistics
Lean Declarations ✏️ Removed: 3 declaration(s)
✏️ Added: 76 declaration(s)
📄 **Per-File Summaries**
Last updated: 2026-11-21 20:24 UTC. |
Adds the run-and-log API for programs answered by a fixed answer function, with the query-bound,
cache and probability lemmas that reason about such runs.
Runs with fixed answers (
VCVio/OracleComp/QueryTracking/RunLog.lean, new).runLog ans oalists the queries of
evalWithAnswerFn ans oa, oldest first, with their answers:evalWithAnswerFn_withQueryLog: answeringoa.withQueryLogwithansgives the run and itslog;
runLog_pure,runLog_bind,runLog_query,runLog_query_bind,runLog_map,runLog_withQueryLog,runLog_simulateQ,mem_runLog_simulateQ;(
evalWithAnswerFn_eq_of_forall_mem_runLog,runLog_eq_of_forall_mem_runLog), and a run onlymakes queries the program may make (
forall_mem_runLog_of_allQueriesSatisfy,runLog_eq_of_allQueriesSatisfy);length_filterMap_runLog_le: a program making at mostnqueries satisfyingplogs at mostnof them.tableQueryLog(RandomOracle/FreshQuery.lean) is nowrunLogagainst the table; its lemmaskeep their names and statements and are one-line consequences of the general ones.
Handlers and query bounds.
IsQueryBoundP.simulateQ_of_step_le(QueryBound/Simulation.lean): a handler using at mostcostqueries satisfyingqper query satisfyingp, and none otherwise, turns a boundninto
n * cost. It is the stateless form ofIsQueryBoundP.simulateQ_run_of_step_le;IsQueryBoundP.simulateQ_of_step(cost = 1) andIsQueryBoundP.simulateQ_of_step_le_total(
palways true) are now derived from it.AllQueriesSatisfy.map_run_simulateQ_eq_of_query_map_eq: the state-projection lawmap_run_simulateQ_eq_of_query_map_eq, needing the step law only at the queries the program maymake.
QueryBound/Basic.lean:isQueryBoundP_bind_le,allQueriesSatisfy_map_iffandevalWithAnswerFn_eq_of_allQueriesSatisfy.IsTotalQueryBound.isQueryBoundPandisQueryBoundP_true_iffmove here fromQueryBound/Simulation.lean, unchanged, so that thederivation above can use them.
LoggingOracle/Core.lean:isQueryBoundP_withQueryLog_iffandallQueriesSatisfy_withQueryLog_iff, besideisTotalQueryBound_withQueryLog_iff.simulateQ_pure_eq_evalWithAnswerFn(SimSemantics/SimulateQ.lean): answering every querywith
pure (f t)in a lawful monad ispure (evalWithAnswerFn f oa). It replaces theX →ₒ Ycase inVectorCommitment, whose one caller now uses it.Unqueried cache entries. A program whose queries all satisfy
Preturns the same results fromtwo caches that agree on
P, as an equality of programs: for any cached handler(
QueryImpl.fst_map_run_simulateQ_withCaching_eq_of_allQueriesSatisfy, through the step lemmaQueryImpl.map_withCaching_run_ofFn_ite) and in the random oracle model(
OracleSpec.fst_map_run_simulateQ_romImpl_eq_of_allQueriesSatisfy).Probability (
EvalDist/ProbabilityBounds.lean, for any lawful measure semantics):prEvent_le_prEvent_add_prEvent_of_imp,absDiff_prEvent_le_absDiff_prEvent_and_not_add,prEvent_exists_list_le(the list form ofprEvent_exists_finset_le), and the simp lemmaprEvent_bind_bind_false.docs/agents/query-tracking.mddescribes the run-log API and the cache lemmas.Tests.
VCVioTest/OracleComp/QueryTracking/RunLog.leancomputes logs of concrete programsand checks each bound against a case that attains it or needs its hypothesis: answers differing at
a queried point change the run; the log shows that a program and a simulation through a doubling
handler exceed the next smaller query bound; a sure event is not bounded by two null ones; the
absDiffbound is attained; and a run that reads the differing cache entry, in a cached handlerand in the random oracle model, returns different results.
Validation.
./scripts/validate.sh --lint --test --axiomspasses at71c4042d9: the six prooflibraries build with no warnings, the umbrella, boundary, style, documentation and environment-lint
checks pass with the lint baseline unchanged,
lake testpasses, and the axiom sweep reports zerodebt. The native FFI tests (
--ffi) were not run.