Skip to content

feat(oracle): account for cached searches and graph collisions - #1205

Draft
alexanderlhicks wants to merge 85 commits into
proof/oracle-warm-scanfrom
prototype/leanxmss-accounted-graph
Draft

alexanderlhicks wants to merge 85 commits into
proof/oracle-warm-scanfrom
prototype/leanxmss-accounted-graph

Conversation

@alexanderlhicks

@alexanderlhicks alexanderlhicks commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

A hash-based signature proof often observes several events on one random oracle. A message search may stop early or revisit an address. A verifier may open a tree node whose children have yet to be sampled. Bounding each event against the entire query budget would spend the same calls several times.

The lemmas here keep the random-oracle cache and the charges from the same execution. They bound the first and second moments of adaptive trials, relate a verifier's children to a stored graph node, and preserve a stopped caller's state through optional replies. The cache-replay relation also preserves the final cache, so a caller can use it before another adaptive query.
The public query equation lets a downstream verifier identify which graph query it makes using an ordinary import.

For example, take a known input whose stored answer is true. A program may replace a read of that input by true before running any continuation. From an empty cache even a sampler that always returns true leaves a visible difference: only the queried program adds the entry. The test in VCVioTest/CacheReplay.lean checks both cases.

Stacked on #1202. The adaptive-trial result is also available for separate review in #1203. EthLib #3704 uses these results to prove the original 127-bit strong unforgeability statement for the keyed leanXMSS signer. All address formats, signer behavior and the final forgery theorem live downstream. The signing-view work in #1009 carries a 127-bit theorem from the deterministic SHAKE-128s byte game to its bit-vector transcription.
Its joint budget charges one unit per signing attempt.
EthLib’s leanXMSS budget counts the hash calls within signing and key generation.

The presampling theorem in #1009 preserves a later caller’s return value in distribution.
Here cache replay also preserves which answers that caller can read from the final cache.

A local integration of #1009 at 6a59713a and this branch at b30616ba required merging two import lists, VCVio.lean and VCVioTest.lean.
Keeping the imports from both branches gave tree e6a766c837317f2a7ef1d79f92a06ff29a4d247a.
On that tree, lake --rehash --wfail build VCVio HashSig VCVioTest passed all 11,185 jobs.
A downstream file imported both library roots and checked the SHAKE-128s byte and bit-vector theorems alongside the public graph-query equation.

At b30616ba, lake build --wfail VCVio VCVioTest completed all 10,424 jobs on Lean 4.36.0. Codex prepared this draft with AI assistance.

Codex (AI) and others added 30 commits November 20, 2026 18:29
…me-integration-RyirXhom/VCVOrdered into prototype/leanxmss-accounted-graph
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

🤖 PR Summary

ℹ️ Some sections were omitted to fit GitHub's comment size limit.

⚠️ PR title does not follow conventional commit format type[(scope)]: subject. Got: proof(oracle): account for cached searches and graph collisions

Overview

This pull request formalizes a large collection of theorems and definitions related to random-oracle caching, graph collision bounds, and cost accounting for hash-based signature schemes. It extends the VCVio library with new modules covering adaptive query counting, cached searches and partnerships, joint potential and eager subgraphs, marked replies, paired-value representations, expected potential and hit bounds, weighted-capped mechanisms, simulation semantics and compositionality (including replay equivalence, hidden seeds, public replay, undisclosed properties, and touch-read operations), as well as refactoring the public API via additional public import statements. The PR also adds a suite of test files in VCVioTest covering the new functionality.

The PR body (provided) explains the motivation: bounding events against a query budget in hash-based signature proofs where the random oracle may be cached, and treating graph collisions. It mentions that this draft groups dependencies used by EthLib's leanXMSS prototype, that the adaptive-trial result is separately reviewed in #1203, and that the signing-view work in #1009 carries a 127‑bit theorem. The per‑file summaries, however, state that the PR body is empty; we note this discrepancy but rely on the actual PR body and the code changes.

All proofs are complete: no sorry or admit appear in any changed file.


Mathematical Formalization

Query Counting and Oracle Moments

  • AdaptiveMoment: Introduces noncomputable price and balance functions, and martingale theorems step_balance and run_balance. run_reserve proves that the expected reserve equals price times expected trials taken.
  • BernoulliMoment: Defines reserve = α*n + β*(v/p - n)^2 and proves step, initial, nonneg, and covers (a Young‑type bound).
  • FirstMoment: Defines avg abbreviation; proves avg_scale, step_mean, and expected_successes using QueryImpl.run_compensated.
  • FreshTrials: Defines observe for counting cache misses, with forget (projection recovers original simulation) and countsTrials (each counted miss is a Bernoulli trial with success probability p).
  • ObserveTrials: Defines update and observe with quota q; proves counts_observe satisfying the CountsTrials property.

Cached Searches and Partnerships

  • Selection (AcceptedScan/Selection.lean): select_le_of_probe_accepted and select_eq_of_probe_accepted analyze how caching an accepted word affects selection probability (non‑target addresses: ≤; same address: =).
  • Occupied (Occupied.lean): cachedSelection predicate; cachedSelection_le_of_accepted shows caching an accepted word cannot decrease occupied‑selection probability.
  • OccupiedMass (OccupiedMass.lean): Defines validRows, freshMean, cachedMass, forcedMass. Theorems cachedMass_eq_answer, cachedMass_le_after_accept, mean_cachedMass, mean_cachedMass_outside, and weighted_mass_drift.
  • Partners (Partners.lean): Defines Partner property on cache entries, with mono, newly_matches, unique_old, and selection_gain (probability equality for partnered row after fresh probe).
  • PartnerDrift (PartnerDrift.lean): partnered_mass_drift (inside list) and partnered_mass_drift_outside bound expected partnered mass increase with volume and ε terms.
  • PartnerProbe (PartnerProbe.lean): old_selection_gain_le bounds selection probability of target after caching a fresh word at an older address.
  • PartnerSet (PartnerSet.lean): sum_selected and selection_gain_set_le (total mass bounded by ε times original selection mass).
  • NewPartner (NewPartner.lean): at_probe_iff (necessary and sufficient condition for a cache entry to be a partner) and new_selection_gain (probabilistic identity).
  • StoppedPartner (StoppedPartner.lean): Four theorems: stopped_cache, stopped_fresh_rate, stopped_partner_cases, stopped_partner_le.
  • Compensation (Compensation.lean): compensate and compensate_sum inequalities for partnered selection under injective encoding and rate bounds.
  • CyclicMass (CyclicMass.lean): orbit, occupied, selectedIn, score; main result cyclic_selection_mass_le.
  • ForeignKey (ForeignKey.lean): unchanged_at_other_key (cache miss at a different key leaves cachedMass and partneredMass unchanged).
  • Probe (Probe.lean): prEvent_eq_average_cacheQuery and average_growing_event.
  • AcceptedScan (AcceptedScan.lean): Added selection_congr theorem.

Graph Collision Bounds and Cost Accounting

  • Subgraph (JointPotential/Subgraph.lean): Defines Subgraph structure and project; isCharged lifts charging certificates from subgraph to containing graph.
  • EagerSubgraph (EagerSubgraph.lean and Run.lean): Framed, liftQuery, Preserves property; Exact property and run_eq_of_exact.
  • MarkedReplies (MarkedReplies.lean): occupiedAt, hasMatch; isPotentialStep_hasMatch and prEvent_hasMatch_and_count.
  • Cost (MarkedReplies/Cost.lean): publicCost, counted implementation, paid_step, paid_le_count, prEvent_hit_and_count.
  • Registration (MarkedReplies/Registration.lean): Targets module with Register, update, impl; public_run, erase_run, forget_run, charged, prEvent_hit_and_paid.
  • PairedValue (multiple files): Introduces paired‑cache representation to modularly split a full cache into two half caches. Key theorems: run_pair_macro_evalDist_eq_full_joint, world_step, evalDist_world_run_joint (PairedValue.lean); run_joint (Derivations.lean); full_step, caller_step_cost, metered_footprint (GraphCost.lean); deferred_public_readback, deferred_full_readback, etc. (GraphReadback.lean); internal_frame, mixed_footprint, mixed_present (Mixed.lean); capped_footprint, capped_present (MixedCap.lean); ordinary_run, ordinary_fresh, etc. (Ordinary.lean); PresentTogether invariant (Presence.lean); potential_le_physical and prEvent_hit_afterSetup_and_cost (ProjectedHits.lean).
  • ExpectedPotential (ExpectedPotential.lean): Charging scheme with potential Φ and credit; expected_credit_of_increments, IsPotentialStep.expected_credit, prEvent_le_expected_of_credit, IsPotentialStep.prEvent_le_expected.
  • ExpectedHit (ExpectedHit.lean): prEvent_le_expected for persistent flag in query‑tracking run.
  • ExpectedGraph (ExpectedGraph.lean): IsCharged.prEvent_deferredFillDraw_le_expected.
  • WeightedCap (WeightedCap.lean): capCompOpt mechanism; evalDist_capCompOpt, prEvent_run_capCompOpt_some_le, etc.
  • WeightedCap/Domination (Domination.lean): prEvent_cap_le_cap_of_preserves.
  • WeightedCap/Handler (Handler.lean): guard handler; run_guard, run_guard_free.
  • WeightedCap/Resource (Resource.lean): resource_le for capped runs.
  • WriterCost/StateT (StateT.lean): resource_le_runAdd.

Simulation Semantics and Compositionality

  • StateT/Compensated (Compensated.lean): run_compensated lifts a per‑query compensated inequality to whole adaptive runs.
  • StateT/RestrictedProjection (RestrictedProjection.lean): AllQueriesSatisfy.evalDist_map_run for distributional equality under a state projection.
  • OptionT/Answer (Answer.lean): Spec, program, simulate_program, run_compensated for optional‑answer (early stop) setting.
  • CachePartial/ReplayEq (ReplayEq.lean): Resolves property and ReplayEq relation with composition lemmas (pure, bind, bind_known).
  • HiddenSeed (Reindex.lean, Residual.lean, Unit.lean): Bijection‑based reindexing, residual caching, and paid inlining of Unit queries; reindex_ideal, run, paidUnit_intertwines, etc.
  • PublicReplay (PublicReplay.lean): merged_public_reply, deferred_public_replay, publicRequests.
  • Undisclosed (Undisclosed.lean): AvoidsDirectRead, stays_undisclosed, conflict_of_deferred_public_query, conflict_of_merged_before_ready, prEvent_cold_cell_eq_le, prEvent_endFill_guesses_le.
  • TouchRead/Children (Children.lean): Six theorems on reading and touching ordered child cells; simulateQ_eagerImpl_touchCells, eagerImpl_point_run_of_childVals, etc.
  • TouchRead/Unary (Unary.lean): Four theorems on unary nodes, e.g., simulateQ_eagerImpl_unary_edge, cell_eq_of_mem_support_read_touch.
  • Relabel/Match (Match.lean): merge_pt_of_childVals_ne and NodeKeys.childVals_of_match.
  • DisclosureTrace (DisclosureTrace.lean): stays_undisclosed_on_log.
  • QueryLog (QueryLog.lean): Added mem_of_lookup?_eq_some.

Refactoring and API Expansion

  • VCVio.lean: Adds numerous public import statements for submodules of CountingOracle, AcceptedScan, HiddenSeed, JointPotential, MarkedReplies, PairedValue, WeightedCap, and various SimSemantics modules, as well as for DisclosureTrace, ExpectedGraph, ExpectedHit, ExpectedPotential, PublicReplay, Undisclosed, Relabel.Match, TouchRead.Children, and TouchRead.Unary. These expand the public API surface without introducing new definitions or proofs.
  • VCVioTest.lean: Adds 27 new public import lines re‑exporting the corresponding test modules (e.g., AdaptiveTrialCount, CacheReplay, CompensatedState, ExpectedMarkedHit, FreshTrialMean, OptionalAnswer, PairedDerivations, PartnerCompensation, StoppedPartner, UnaryEdges, Undisclosed, WeightedCap, etc.). Purely additive.

Testing

  • VCVioTest/: New test files covering cached/graph‑aware oracle computations, adaptive query patterns, compensated‑state invariants, weighted‑cap mechanisms, and random‑oracle subgraph/mixed/partner/scanner properties. The PR body specifically mentions the test in CacheReplay.lean that checks both cases of a known input whose stored answer is true when using a sampler that always returns true.

Completeness

All proofs are complete: no sorry or admit appear in any of the changed files (as explicitly stated in each per‑file summary).

Discrepancy Note

The per‑file summaries for VCVio.lean and VCVioTest.lean claim that the PR body is empty. However, the PR body as provided in the user data contains a descriptive paragraph (stacked on #1202, adaptive‑trial result in #1203, EthLib’s leanXMSS context, etc.). This overview incorporates both sources; the code changes are as described above.


Statistics

Metric Count
📝 Files Changed 87
✅ Lines Added 7834
❌ Lines Removed 1

Lean Declarations

✏️ Added: 446 declaration(s)

VCVio/OracleComp/QueryTracking/CountingOracle/AdaptiveMoment.lean (10)

  • @[expose] def CountsTrials (so : QueryImpl spec (StateT σ ProbComp)) (trials successes : σ → ℕ)
  • @[expose] noncomputable def balance (p α β : ℝ) (q v n : ℕ) : ℝ
  • @[expose] noncomputable def price (p α β : ℝ) : ℝ
  • private theorem balance_nonneg {p α β : ℝ} (hp : 0 < p) (hp1 : p ≤ 1)
  • private theorem mean_two {γ : Type} (m : ProbComp γ) (f : γ → ℝ≥0∞) (hit : γ → Prop)
  • private theorem price_nonneg {p α β : ℝ} (hp : 0 < p) (hp1 : p ≤ 1)
  • theorem CountsTrials.trials_le {so : QueryImpl spec (StateT σ ProbComp)} {trials successes : σ → ℕ}
  • theorem run_balance (so : QueryImpl spec (StateT σ ProbComp)) (trials successes : σ → ℕ)
  • theorem run_reserve (so : QueryImpl spec (StateT σ ProbComp)) (trials successes : σ → ℕ)
  • theorem step_balance {p α β : ℝ} (hp : 0 < p) (hp1 : p ≤ 1) (ha : 0 ≤ α) (hb : 0 ≤ β)

VCVio/OracleComp/QueryTracking/CountingOracle/BernoulliMoment.lean (5)

  • @[simp] theorem initial (p α β : ℝ) : reserve p α β 0 0 = 0
  • noncomputable def reserve (p α β v n : ℝ) : ℝ
  • theorem covers {p v c n q scale invScale : ℝ} (hp : 0 < p) (hp1 : p ≤ 1)
  • theorem nonneg {p α β v n : ℝ} (ha : 0 ≤ α) (hb : 0 ≤ β) (hn : 0 ≤ n) :
  • theorem step {p : ℝ} (hp : p ≠ 0) (α β v n : ℝ) :

VCVio/OracleComp/QueryTracking/CountingOracle/FirstMoment.lean (4)

  • private noncomputable abbrev avg {α : Type} (m : ProbComp α) (f : α → ℝ≥0∞)
  • private theorem avg_scale {α : Type} (m : ProbComp α) (p : ℝ≥0∞) (f : α → ℝ≥0∞) :
  • private theorem step_mean {so : QueryImpl spec (StateT σ ProbComp)} {n v : σ → Nat}
  • theorem expected_successes {so : QueryImpl spec (StateT σ ProbComp)} {n v : σ → Nat}

VCVio/OracleComp/QueryTracking/CountingOracle/FreshTrials.lean (4)

  • @[expose] def observe (q : ℕ) (accepted : Finset Y) (eligible : A → (A →ₒ Y).QueryCache → Bool) :
  • abbrev State (A Y : Type)
  • theorem countsTrials (q : ℕ) (accepted : Finset Y) (eligible : A → (A →ₒ Y).QueryCache → Bool)
  • theorem forget {γ : Type} (q : ℕ) (accepted : Finset Y) (eligible : A → (A →ₒ Y).QueryCache → Bool)

VCVio/OracleComp/QueryTracking/CountingOracle/ObserveTrials.lean (3)

  • @[expose] def observe (so : QueryImpl spec (StateT σ ProbComp)) (q : ℕ)
  • @[expose] def update (q : ℕ) (eligible : ι → σ → Bool) (accept : ∀ t, spec.Range t → Bool)
  • theorem counts_observe (so : QueryImpl spec (StateT σ ProbComp)) (q : ℕ)

VCVio/OracleComp/QueryTracking/QueryLog.lean (1)

  • theorem mem_of_lookup?_eq_some (log : QueryLog spec) (t : spec.Domain) (v : spec.Range t)

VCVio/OracleComp/QueryTracking/RandomOracle/AcceptedScan.lean (1)

  • theorem selection_congr (accepted : Finset Y) (encode : X → A) (xs : List X)

VCVio/OracleComp/QueryTracking/RandomOracle/AcceptedScan/Compensation.lean (3)

  • private theorem mean_sum {ι : Type} (family : Finset ι) (f : ι → Y → ℝ≥0∞) :
  • theorem compensate (key : A → K) (decode : Y → Option D) (accepted : Finset Y)
  • theorem compensate_sum {ι : Type} (family : Finset ι) (key : A → K) (decode : Y → Option D)

VCVio/OracleComp/QueryTracking/RandomOracle/AcceptedScan/CyclicMass.lean (8)

  • @[expose] def orbit (step : Equiv.Perm X) (n : Nat) (x : X) : List X
  • @[expose] noncomputable def occupied (encode : X → A) (cache : (A →ₒ Y).QueryCache) : Finset X
  • private def selectedIn (s : Finset X) (answer : Option (X × Y)) : Prop
  • private noncomputable def score (accepted : Finset Y) (encode : X → A)
  • private theorem score_cons (accepted : Finset Y) (encode : X → A) (cache : (A →ₒ Y).QueryCache)
  • private theorem score_le_one (accepted : Finset Y) (encode : X → A)
  • theorem cyclic_selection_mass_le (accepted : Finset Y) (encode : X → A)
  • theorem orbit_succ (step : Equiv.Perm X) (n : Nat) (x : X) :

VCVio/OracleComp/QueryTracking/RandomOracle/AcceptedScan/ForeignKey.lean (1)

  • theorem unchanged_at_other_key (key : A → K) (decode : Y → Option D) (accepted : Finset Y)

VCVio/OracleComp/QueryTracking/RandomOracle/AcceptedScan/NewPartner.lean (2)

  • theorem at_probe_iff (c : (ι →ₒ Y).QueryCache) (a : ι) (v : Y) :
  • theorem new_selection_gain (accepted : Finset Y) (encode : X → ι) (xs : List X)

VCVio/OracleComp/QueryTracking/RandomOracle/AcceptedScan/Occupied.lean (2)

  • @[expose] def cachedSelection (accepted : Finset Y) (encode : X → A) (c : QueryCache (A →ₒ Y)) :
  • theorem cachedSelection_le_of_accepted (accepted : Finset Y) (encode : X → A) (xs : List X)

VCVio/OracleComp/QueryTracking/RandomOracle/AcceptedScan/OccupiedMass.lean (14)

  • noncomputable def cachedMass (accepted : Finset Y) (encode : X → A) (xs : List X)
  • noncomputable def forcedMass (accepted : Finset Y) (encode : X → A) (xs : List X)
  • noncomputable def freshMean (f : Y → ℝ≥0∞) : ℝ≥0∞
  • noncomputable def validRows (accepted : Finset Y) (encode : X → A)
  • private theorem cachedMass_eq_answer (accepted : Finset Y) (encode : X → A) (xs : List X)
  • private theorem mean_indicator (accepted : Finset Y) (b : ℝ≥0∞) :
  • private theorem mean_mul (b : ℝ≥0∞) (f : Y → ℝ≥0∞) :
  • private theorem valid_before (accepted : Finset Y) (encode : X → A) (c : (A →ₒ Y).QueryCache)
  • private theorem valid_probe (accepted : Finset Y) (encode : X → A) (inj : Function.Injective encode)
  • theorem cachedMass_le_after_accept (accepted : Finset Y) (encode : X → A) (xs : List X)
  • theorem freshMean_add (f g : Y → ℝ≥0∞) :
  • theorem mean_cachedMass (accepted : Finset Y) (encode : X → A) (inj : Function.Injective encode)
  • theorem mean_cachedMass_outside (accepted : Finset Y) (encode : X → A) (xs : List X)
  • theorem weighted_mass_drift (accepted : Finset Y) (encode : X → A) (xs : List X)

VCVio/OracleComp/QueryTracking/RandomOracle/AcceptedScan/PartnerDrift.lean (8)

  • def StoredDigest (key : A → K) (decode : Y → Option D) (c : (A →ₒ Y).QueryCache)
  • noncomputable def partneredMass (key : A → K) (decode : Y → Option D) (accepted : Finset Y)
  • noncomputable def priorPairRate (key : A → K) (decode : Y → Option D)
  • private theorem paired_gain (key : A → K) (decode : Y → Option D) (accepted : Finset Y)
  • theorem partnered_mass_drift (key : A → K) (decode : Y → Option D) (accepted : Finset Y)
  • theorem partnered_mass_drift_outside (key : A → K) (decode : Y → Option D) (accepted : Finset Y)
  • theorem priorPairRate_le (key : A → K) (decode : Y → Option D) (c : (A →ₒ Y).QueryCache)
  • theorem storedDigest_rate_le (key : A → K) (decode : Y → Option D) (c : (A →ₒ Y).QueryCache)

VCVio/OracleComp/QueryTracking/RandomOracle/AcceptedScan/PartnerProbe.lean (1)

  • theorem old_selection_gain_le (accepted : Finset Y) (encode : X → ι) (xs : List X)

VCVio/OracleComp/QueryTracking/RandomOracle/AcceptedScan/PartnerSet.lean (2)

  • private theorem sum_selected (run : ProbComp (Option X × σ)) (s : Finset X) :
  • theorem selection_gain_set_le (accepted : Finset Y) (encode : X → ι) (xs : List X)

VCVio/OracleComp/QueryTracking/RandomOracle/AcceptedScan/Partners.lean (5)

  • @[expose] def Partner (cache : (ι →ₒ Y).QueryCache) (a : ι) : Prop
  • theorem mono {c c' : (ι →ₒ Y).QueryCache} (le : c ≤ c') {a : ι}
  • theorem newly_matches {c : (ι →ₒ Y).QueryCache} {x a : ι} (ne : a ≠ x) (v : Y)
  • theorem selection_gain (oa : OracleComp (ι →ₒ Y) (Option ι)) (c : (ι →ₒ Y).QueryCache) (x : ι)
  • theorem unique_old {c : (ι →ₒ Y).QueryCache} {x a b : ι} (v : Y) (ha : a ≠ x) (hb : b ≠ x)

VCVio/OracleComp/QueryTracking/RandomOracle/AcceptedScan/Probe.lean (2)

  • theorem average_growing_event {α : Type} (oa : OracleComp spec α)
  • theorem prEvent_eq_average_cacheQuery {α : Type} (oa : OracleComp spec α)

VCVio/OracleComp/QueryTracking/RandomOracle/AcceptedScan/Selection.lean (2)

  • theorem select_eq_of_probe_accepted (accepted : Finset Y) (encode : X → A) (xs : List X)
  • theorem select_le_of_probe_accepted (accepted : Finset Y) (encode : X → A) (xs : List X)

VCVio/OracleComp/QueryTracking/RandomOracle/AcceptedScan/StoppedPartner.lean (4)

  • theorem stopped_cache (accepted : Finset Y) (encode : X → A) (xs : List X)
  • theorem stopped_fresh_rate (accepted : Finset Y) (encode : X → A) (xs : List X)
  • theorem stopped_partner_cases (key : A → K) (decode : Y → Option D) (accepted : Finset Y)
  • theorem stopped_partner_le (key : A → K) (decode : Y → Option D) (accepted : Finset Y)

VCVio/OracleComp/QueryTracking/RandomOracle/CachePartial/ReplayEq.lean (11)

  • @[expose] def ReplayEq (cache : QueryCache spec) (left right : OracleComp spec α) : Prop
  • @[expose] def Resolves (cache : QueryCache spec) (program : OracleComp spec α)
  • protected theorem pure (a : α) : ReplayEq cache (Pure.pure a) (Pure.pure a)
  • protected theorem refl (cache : QueryCache spec) (p : OracleComp spec α) : ReplayEq cache p p
  • theorem bind {p q : OracleComp spec α} (h : ReplayEq cache p q) (f g : α → OracleComp spec β)
  • theorem bind_known {p : OracleComp spec α} {a : α} (h : Resolves cache p a)
  • theorem eval {p : OracleComp spec α} {x} (h : Resolves cache p x) (f : QueryImpl spec Id)
  • theorem map {p : OracleComp spec α} {x} (h : Resolves cache p x) (f : α → β) :
  • theorem mono {p : OracleComp spec α} {x} (h : Resolves cache p x) {c : QueryCache spec}
  • theorem of_bind {p : OracleComp spec α} {k : α → OracleComp spec β} {y}
  • theorem pure_inv {x y : α} (h : Resolves cache (Pure.pure x) y) : x = y

VCVio/OracleComp/QueryTracking/RandomOracle/DisclosureTrace.lean (1)

  • theorem stays_undisclosed_on_log (oa : OracleComp (pub.withLabels X K R) α)

VCVio/OracleComp/QueryTracking/RandomOracle/ExpectedGraph.lean (1)

  • theorem IsCharged.prEvent_deferredFillDraw_le_expected (h : G.IsCharged P Φ)

VCVio/OracleComp/QueryTracking/RandomOracle/ExpectedHit.lean (2)

  • @[expose] def update (mark : spec.Domain → σ → Bool)
  • theorem prEvent_le_expected (so : QueryImpl spec (StateT σ ProbComp)) (paid : σ → Nat)

VCVio/OracleComp/QueryTracking/RandomOracle/ExpectedPotential.lean (7)

  • private theorem lower_mean {γ : Type} (m : ProbComp γ) (f : γ → ℝ≥0∞) (k : ℝ≥0∞)
  • private theorem mean_credit {γ : Type} (m : ProbComp γ) (f : γ → ℝ≥0∞) (p : γ → Prop)
  • private theorem run_lower (so : QueryImpl spec (StateT σ ProbComp)) (f : σ → ℝ≥0∞)
  • theorem IsPotentialStep.expected_credit {so : QueryImpl spec (StateT σ ProbComp)}
  • theorem IsPotentialStep.prEvent_le_expected {so : QueryImpl spec (StateT σ ProbComp)}
  • theorem expected_credit_of_increments (so : QueryImpl spec (StateT σ ProbComp))
  • theorem prEvent_le_expected_of_credit {γ : Type} (m : ProbComp γ) (P : γ → Prop)

VCVio/OracleComp/QueryTracking/RandomOracle/HiddenSeed/Reindex.lean (6)

  • @[expose] def reindexQueries : QueryImpl (pub.withDerivations X R)
  • @[expose] def reindexState (s : SplitCache pub X R) : SplitCache pub Y R
  • @[simp] theorem reindexState_apply (s : SplitCache pub X R) (x : X) :
  • private theorem reindex_store [DecidableEq X] [DecidableEq Y]
  • theorem reindexState_symm (s : SplitCache pub X R) :
  • theorem reindex_ideal {α : Type} (body : OracleComp (pub.withDerivations X R) α)

VCVio/OracleComp/QueryTracking/RandomOracle/HiddenSeed/Residual.lean (7)

  • @[expose] def baseState (s : Source pub aux X Z R) : SplitCache pub X R
  • @[expose] def localState (s : Source pub aux X Z R) : Local aux Z R
  • @[expose] noncomputable def handler : QueryImpl ((pub + aux).withDerivations (X ⊕ Z) R)
  • abbrev Local (Z R : Type)
  • abbrev Source (X Z R : Type)
  • private theorem step (t : ((pub + aux).withDerivations (X ⊕ Z) R).Domain)
  • theorem run {α : Type} (body : OracleComp ((pub + aux).withDerivations (X ⊕ Z) R) α)

VCVio/OracleComp/QueryTracking/RandomOracle/HiddenSeed/Unit.lean (15)

  • @[expose] def paidInlineUnitDerivations (r : R) :
  • @[expose] def paidUnitReadback (r : R) (cache : (pub + UnitTick).QueryCache) :
  • @[expose] def unitCache (r : R) : (Unit →ₒ R).QueryCache
  • @[simp] theorem empty_cacheQuery_unit (r : R) :
  • @[simp] theorem paidInlineUnitDerivations_derive (r : R) (u : Unit) :
  • @[simp] theorem paidInlineUnitDerivations_public (r : R) (t : ι) :
  • @[simp] theorem paidInlineUnitDerivations_uniform (r : R) (n : Nat) :
  • @[simp] theorem paidUnitReadback_addEquiv (r : R) (raw : pub.QueryCache)
  • @[simp] theorem unitCache_apply (r : R) (u : Unit) : unitCache r u = some r
  • abbrev UnitTick
  • private theorem paidUnit_intertwines (r : R) :
  • private theorem paidUnit_tick_step (r : R) (raw : pub.QueryCache)
  • theorem idealImpl_run_presample_first_derive {X α : Type} [DecidableEq X]
  • theorem map_run_paidInlineUnitDerivations (r : R)
  • theorem map_run_simulateQ_paidInlineUnitDerivations {α : Type}

VCVio/OracleComp/QueryTracking/RandomOracle/JointPotential/EagerSubgraph.lean (8)

  • @[expose] def Preserves {α : Type} (p : OracleComp (pub.withLabels X K R) α) : Prop
  • @[expose] noncomputable def liftQuery :
  • private theorem draw_selected (c : X ⊕ K) (s : RelabelState pub X' K' R) {z}
  • theorem preserves_bind {α β : Type} {p : OracleComp (pub.withLabels X K R) α}
  • theorem preserves_map {α β : Type} (g : α → β) {p : OracleComp (pub.withLabels X K R) α}
  • theorem preserves_public {I : Type} {A : CanonicalGraph (I →ₒ R) X K R}
  • theorem preserves_pure {α : Type} (a : α) : f.Preserves (pure a)
  • theorem preserves_readCell (c : X ⊕ K) : f.Preserves (readCell (some c))

VCVio/OracleComp/QueryTracking/RandomOracle/JointPotential/EagerSubgraph/Run.lean (15)

  • @[expose] def Exact {α : Type} (p : OracleComp (pub.withLabels X K R) α) : Prop
  • @[expose] noncomputable def extend (s : RelabelState pub X' K' R) (t : RelabelState pub X K R) :
  • private theorem exact_draw (c : X ⊕ K) (s : RelabelState pub X' K' R) :
  • private theorem extend_extend (s : RelabelState pub X' K' R) (u t : RelabelState pub X K R) :
  • theorem exact_bind {α β : Type} {p : OracleComp (pub.withLabels X K R) α}
  • theorem exact_map {α β : Type} (g : α → β) {p : OracleComp (pub.withLabels X K R) α}
  • theorem exact_public {I : Type} {A : CanonicalGraph (I →ₒ R) X K R}
  • theorem exact_pure {α : Type} (a : α) : f.Exact (pure a)
  • theorem exact_readCell (c : X ⊕ K) : f.Exact (readCell (some c))
  • theorem exact_touchCell (c : X ⊕ K) : f.Exact (touchCell (some c))

…and 296 more not listed.


sorry Tracking

  • No sorrys were added, removed, or affected.

📋 **Additional Analysis**

No findings.


Last updated: 2026-11-21 04:03 UTC.

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Build Timing Report

  • Source: 29396cc
  • Message: Merge b30616b into 23f4451
  • Ref: prototype/leanxmss-accounted-graph
  • Build cache: restored the build of 7c167e8; Lake rebuilt only modules whose source or imports differ from it.
  • Commands: library build lake build ToMathlib VCVio LatticeCrypto Extern HashSig Examples; smoke test lake env lean VCVioTest/Smoke.lean.
Measurement Wall (s) CPU work (s) Status
Library build 40.20 133.90 ok
Smoke test 3.89 2.14 ok

CPU work is user + sys. Wall time depends on which modules this run had to rebuild, so compare it across runs only together with the module section below.

Rebuilt Modules

Rebuilt 102 modules (83 without an earlier time). The 19 with an earlier time took 70s here against 60s when last built (+9s (+15.4%)).

Estimated clean-build compile time, summed over all 1779 modules: 4366s before, 4556s after (+190s (+4.3%)).

Per-module times are wall-clock under whatever parallel load the run had, so treat small differences as noise; a large change on one module is the signal.

Showing 20 slowest of 102 rebuilt modules.

Current (s) Earlier (s) Delta (s) Path
12 10 +2 VCVioTest/ProbabilityTactics.lean
9.9 8.1 +1.8 VCVio/OracleComp/QueryTracking/QueryLog.lean
7.5 6.6 +0.9 VCVioTest/LongChainPrograms.lean
5.7 - - VCVio/OracleComp/QueryTracking/RandomOracle/AcceptedScan.lean
4.5 - - VCVioTest/RandomOraclePairedValue.lean
4.2 - - VCVio/OracleComp/QueryTracking/RandomOracle/HiddenSeed/Residual.lean
4.1 3.4 +0.7 VCVioTest/EvalDist/MeasureGate.lean
4.0 - - VCVio/OracleComp/SimSemantics/StateT/Compensated.lean
3.8 - - VCVio/OracleComp/QueryTracking/CountingOracle/BernoulliMoment.lean
3.3 2.8 +0.5 VCVioTest/MonadProbability.lean
3.2 - - VCVioTest/RandomOracleResidualTables.lean
3.1 - - VCVioTest/RandomOracleAcceptedScan.lean
3.0 3.3 -0.3 VCVioTest/GrindFailFast.lean
2.9 - - VCVio/OracleComp/QueryTracking/RandomOracle/PairedValue/Derivations.lean
2.9 - - VCVio/OracleComp/QueryTracking/RandomOracle/AcceptedScan/StoppedPartner.lean
2.7 - - VCVio/OracleComp/QueryTracking/RandomOracle/HiddenSeed/Unit.lean
2.7 2.3 +0.4 VCVioTest/RandomOracleJointPotential.lean
2.6 - - VCVio/OracleComp/QueryTracking/RandomOracle/AcceptedScan/CyclicMass.lean
2.6 2.3 +0.3 VCVioTest/EvalDist/DiscreteTVDist.lean
2.6 - - VCVioTest/RandomOracleMixedQueries.lean

@alexanderlhicks alexanderlhicks changed the title proof(oracle): account for cached searches and graph collisions feat(oracle): account for cached searches and graph collisions Nov 21, 2026
@dtumad

dtumad commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator

A note for when this is ready for review, so the connection isn't lost: the accounting for cached searches overlaps two PolyFun pieces tracked in Verified-zkEVM/PolyFun#387, the amortized transfer through caching handlers (Path.exists_run_liftM_amortized) and the meter-placement law for a memoizing cache in Verified-zkEVM/PolyFun#499 (forwarded calls are charged the client trace's fresh charge, and their number is the growth of the cache). The adaptive-trial moments relate to the expected charge (Verified-zkEVM/PolyFun#445, Verified-zkEVM/PolyFun#486). It would be good to check which of these lemmas can be stated through them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants