Skip to content

feat(Schemes): hash-and-MAC and hash-and-sign with named MAC/signature and collision reductions - #1163

Merged
dtumad merged 4 commits into
Verified-zkEVM:mainfrom
sisyphm:hash-and-mac
Nov 21, 2026
Merged

dtumad merged 4 commits into
Verified-zkEVM:mainfrom
sisyphm:hash-and-mac

Conversation

@sisyphm

@sisyphm sisyphm commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR adds the domain-extension constructions for MACs and signatures through a keyed
collision-resistant hash (Boneh–Shoup v0.6 §8.2, Theorem 8.1; Katz–Lindell 3rd ed. §6.3.1 and §13.3).
Each security bound is stated for a named reduction.

VCVio/Schemes/HashAndMac.lean

  • HashAndMac.scheme mac H: the key is (k, s) and tag (k, s) msg = mac.tag k (H.hash s msg).
  • macReduction: samples s and forwards each tagging query msg as H.hash s msg.
  • crReduction: samples k, runs the forger honestly and returns QueryLog.collisionCandidate.
  • strongUnforgeableAdvantage_le:
    Adv^{SUF-CMA}(scheme, A) ≤ Adv^{SUF-CMA}(mac, macReduction A) + keyedCRAdvantage H (crReduction A).
  • unforgeableAdvantage_le: the same bound for UF-CMA.

VCVio/Schemes/HashAndSign.lean

  • HashAndSign.scheme sig H: the hash key is part of the public key, as in Katz–Lindell.
  • sigReduction / strongSigReduction and crReduction / strongCRReduction.
  • unforgeableAdvantage_le (EUF-CMA) and strongUnforgeableAdvantage_le (SUF-CMA), with the same
    bound shape.

VCVio/OracleComp/QueryTracking/LoggingOracle/Relabel.lean (generic)

  • QueryImpl.translate f forwards each (M →ₒ T) query msg as the (D →ₒ T) query f msg.
  • QueryImpl.run_simulateQ_withLogging_translate: a translated run against withLogging tagFn is
    the run against withLogging (tagFn ∘ f) with its log relabelled by f
    (QueryLog.relabel). It is derived from QueryImpl.run_simulateQ_map_log, which says two
    logging handlers whose per-query logs agree up to List.map e produce runs that agree up to
    List.map e.
  • QueryLog.collisionCandidate / hasCollision, with mem_of_mem_relabel and
    mem_map_fst_of_mem_map_fst_relabel: when there is no collision, a relabelled entry at f msg
    comes from an entry at msg. This covers both the SUF (exact pair) and the UF (message only)
    freshness conditions.
  • QueryImpl.run_simulateQ_passthrough_add_liftM: a lifted ambient computation runs with an
    empty log.

Proof structure

Each security bound is proved the same way:

  1. All three experiments are rewritten as one common run (forgeryRun) followed by different
    final tests. The keyed-CR experiment needs one OracleComp.evalDist_bind_bind_swap to reorder
    the two independent key samplings.
  2. OracleComp.evalDist_bind_apply_le_add_of_support gives the union bound pointwise.

Scope choices:

  • The constructions are instantiated at ProbComp with ProbCompRuntime.probComp, like
    MacFromPRF. The CR adversary has to run the MAC/signature key generation, and
    KeyedCRAdversary lives in ProbComp.
  • The SUF-CMA statements for signatures use classical internally, because
    SignatureAlg.strongUnforgeableExperiment is defined under open scoped Classical.

No existing declaration changes. VCVio.lean gains the three imports generated by
./scripts/update-lib.sh.

Verification

  • lake build VCVio.OracleComp.QueryTracking.LoggingOracle.Relabel VCVio.Schemes.HashAndMac VCVio.Schemes.HashAndSign:
    0 errors, 0 warnings.
  • lake exe axiomsweep --check --root <module> on the three new modules (40 declarations): zero sorry and
    zero non-standard axioms.
  • ./scripts/update-lib.sh, then scripts/check-imports.sh.
  • lake lint -- --style-only.
  • lake exe runLinter --no-build <module> for each of the three modules.
  • scripts/check-expose-boundary.sh, check-extern-isolation.sh, check-interop-isolation.sh,
    check-polyfun-boundary.sh.
  • uv run --no-project --python 3.12 python scripts/check-agent-docs.py, test-agent-docs.py,
    extract-doc-fragments.py --check, check-doc-names.py, check-comment-fences.py,
    test-lint.py.

I did not run a full lake build or lake lint -- --env-only locally. CI runs both.

Checklist

  • New files carry the standard header and module docstring (CONTRIBUTING.md, Attribution
    And File Headers
    ); docstrings are intrinsic, with no change history or "renamed from" wording.
  • New files use plain public section with per-declaration @[expose] (Module Scopes), and
    the expose-boundary baseline was lowered in this PR if a file was converted.
  • ./scripts/update-lib.sh leaves the umbrella files unchanged, and
    lake exe axiomsweep --check passes: no sorry and no non-standard axiom.
    (axiomsweep --check run with --root on the three new modules (40 declarations); CI runs the whole-library sweep.)
  • No set_option linter.* false, no deprecated aliases (docs/agents/gotchas.md §18, §23),
    and no native FFI test executables on the PR path.
  • Documentation touched by the change is updated and uv run --no-project --python 3.12 python scripts/check-agent-docs.py
    passes.
  • If a simp/grind/gcongr set changed: the gate files under VCVioTest/ gained one-call
    entries, no proof gained a second tactic call outside a dated gap pair, and the before/after
    line counts of the touched proofs are listed above. (N/A: no simp set changed.)

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

🤖 PR Summary

New Constructions: Hash-and-MAC and Hash-and-Sign

This PR formalizes the hash-then-authenticate domain-extension constructions for MAC and digital signature schemes, following Boneh–Shoup §8.2 (Theorem 8.1) and Katz–Lindell 3rd ed. §6.3.1 / §13.3. The core idea is to apply a keyed collision-resistant hash function to the message first and then invoke the underlying short-message primitive on the hash output. Two new scheme modules, each with security bounds stated as advantage inequalities against named reductions, are added.

  • VCVio/Schemes/HashAndMac.lean defines HashAndMac.scheme mac H where the composed key is (k, s) and tag generation is mac.tag k (H.hash s msg). Two reductions are provided: macReduction (forwards hashed queries to the underlying MAC) and crReduction (extracts a collision candidate from the forger’s query log). Theorems strongUnforgeableAdvantage_le and unforgeableAdvantage_le bound the (S)UF‑CMA advantage of the composed scheme by the sum of the corresponding advantage of macReduction against the underlying MAC and the keyed‑collision‑resistance advantage of crReduction against the hash family.

  • VCVio/Schemes/HashAndSign.lean defines HashAndSign.scheme sig H, where the hash key is included in the public key (as in Katz–Lindell). Two families of reductions are given: sigReduction / strongSigReduction (for EUF‑CMA / SUF‑CMA forgery against the short‑message scheme) and crReduction / strongCRReduction (keyed‑collision adversary). The theorems unforgeableAdvantage_le and strongUnforgeableAdvantage_le mirror the MAC bound, and the SUF‑CMA version uses classical internally because the underlying SignatureAlg.strongUnforgeableExperiment is defined under open scoped Classical.

Proof Structure

Each security proof follows a uniform pattern:

  1. The three relevant experiments (composed-scheme, underlying-MAC/signature, and keyed‑CR) are rewritten as a single common forgeryRun computation followed by different final tests. The keyed‑CR experiment additionally needs a swap of independent key samplings via OracleComp.evalDist_bind_bind_swap.
  2. The probabilistic union bound is applied pointwise using OracleComp.evalDist_bind_apply_le_add_of_support.
  3. A collides predicate on the logged queries and forged message is used to relate the events: if a forgery succeeds but no collision occurs, the reduction to the underlying primitive succeeds; if a collision occurs, the CR adversary wins.

Generic Infrastructure: Query Relabeling and Collision Detection

The file VCVio/OracleComp/QueryTracking/LoggingOracle/Relabel.lean provides reusable machinery that underlies both reductions:

  • QueryLog.relabel f maps each entry’s message by f while preserving responses; lemmas cover its interaction with nil, append, and singleton.
  • QueryLog.collisionCandidate and hasCollision detect collisions of f within a log. Crucial lemmas mem_of_mem_relabel and mem_map_fst_of_mem_map_fst_relabel show that when no collision exists, a relabelled entry at f msg originates from an entry at msg.
  • QueryImpl.translate f is a handler that intercepts each query of type (M →ₒ T) and forwards it as a query (D →ₒ T) via f.
  • run_simulateQ_withLogging_translate proves that a translated run against a logging handler is equivalent to the original run against a handler that logs the relabelled queries.
  • run_simulateQ_map_log is a generic lemma stating that two logging handlers whose per‑query logs coincide up to List.map e produce runs that agree up to List.map e.
  • run_simulateQ_passthrough_add_liftM shows that a lifted ambient computation runs with an empty log.

These lemmas are used to relate the forger’s query log under the composed scheme to the logs produced by the reductions.

Test Coverage and Universe‑Polymorphism Canaries

  • VCVioTest/OracleComp/QueryLogRelabel.lean contains example‑based checks for relabel, collisionCandidate, and hasCollision using f n = n % 4 on ℕ. The tests document that collisionCandidate returns the earliest prior entry with same f‑image, skipping the forged message itself and ignoring entries with different images; dropping either conjunct would cause a test to fail.
  • VCVioTest/UniversePolymorphism.lean adds two example statements exercising QueryLog.relabel_singleton and QueryImpl.run_simulateQ_map_log to ensure universe‑polymorphic correctness.

Imports

VCVio.lean gains public imports for the three new modules (Relabel, HashAndMac, HashAndSign). VCVioTest.lean gains a public import for VCVioTest.OracleComp.QueryLogRelabel. No existing declarations are changed.

No sorry or admit placeholders have been introduced – axiomsweep --check passes on all new modules.


Statistics

Metric Count
📝 Files Changed 7
✅ Lines Added 755
❌ Lines Removed 0

Lean Declarations

✏️ Added: 47 declaration(s)

VCVio/OracleComp/QueryTracking/LoggingOracle/Relabel.lean (14)

  • @[expose] def collisionCandidate [DecidableEq M] [DecidableEq D] (f : M → D) (msg : M)
  • @[expose] def hasCollision [DecidableEq M] [DecidableEq D] (f : M → D) (msg : M)
  • @[expose] def relabel (f : M → D) (log : QueryLog (M →ₒ T)) : QueryLog (D →ₒ T)
  • @[expose] def translate (f : M → D) :
  • lemma mem_relabel_iff (f : M → D) (log : QueryLog (M →ₒ T)) (d : D) (τ : T) :
  • lemma relabel_append (f : M → D) (log log' : QueryLog (M →ₒ T)) :
  • lemma relabel_nil (f : M → D) : relabel f ([] : QueryLog (M →ₒ T)) = []
  • lemma relabel_singleton (f : M → D) (msg : M) (τ : T) :
  • theorem hasCollision_of_mem [DecidableEq M] [DecidableEq D] (f : M → D) (msg : M)
  • theorem mem_map_fst_of_mem_map_fst_relabel [DecidableEq M] [DecidableEq D] (f : M → D) (msg : M)
  • theorem mem_of_mem_relabel [DecidableEq M] [DecidableEq D] (f : M → D) (msg : M) (τ : T)
  • theorem run_simulateQ_map_log (e : A → B) (impl₁ : QueryImpl spec (WriterT (List A) m))
  • theorem run_simulateQ_passthrough_add_liftM {κ : Type*} {spec' : OracleSpec.{_, u} κ}
  • theorem run_simulateQ_withLogging_translate (tagFn : QueryImpl (D →ₒ T) (OracleComp spec))

VCVio/Schemes/HashAndMac.lean (10)

  • @[expose] def collides [DecidableEq M] [DecidableEq D] (H : KeyedHashFamily Kh M D)
  • @[expose] def crReduction [DecidableEq M] [DecidableEq D] (mac : MacAlg ProbComp D K T)
  • @[expose] def forgeryRun (mac : MacAlg ProbComp D K T) (H : KeyedHashFamily Kh M D)
  • @[expose] def macReduction (mac : MacAlg ProbComp D K T) (H : KeyedHashFamily Kh M D)
  • @[expose] def scheme (mac : MacAlg ProbComp D K T) (H : KeyedHashFamily Kh M D) :
  • theorem evalDist_keyedCRExperiment_crReduction [DecidableEq M] [DecidableEq D]
  • theorem evalDist_le_add_of_not_collides [DecidableEq M] [DecidableEq D]
  • theorem runWithTaggingOracle_macReduction (mac : MacAlg ProbComp D K T)
  • theorem strongUnforgeableAdvantage_le [DecidableEq M] [DecidableEq D] [DecidableEq T]
  • theorem unforgeableAdvantage_le [DecidableEq M] [DecidableEq D]

VCVio/Schemes/HashAndSign.lean (14)

  • @[expose] def collides [DecidableEq M] [DecidableEq D] (H : KeyedHashFamily Kh M D)
  • @[expose] def crReduction [DecidableEq M] [DecidableEq D] (sig : SignatureAlg ProbComp D PK SK S)
  • @[expose] def crReductionMain [DecidableEq M] [DecidableEq D]
  • @[expose] def forgeryRun (sig : SignatureAlg ProbComp D PK SK S) (H : KeyedHashFamily Kh M D)
  • @[expose] def reductionMain (H : KeyedHashFamily Kh M D)
  • @[expose] def scheme (sig : SignatureAlg ProbComp D PK SK S) (H : KeyedHashFamily Kh M D) :
  • @[expose] def sigReduction (sig : SignatureAlg ProbComp D PK SK S) (H : KeyedHashFamily Kh M D)
  • @[expose] def strongCRReduction [DecidableEq M] [DecidableEq D]
  • @[expose] def strongSigReduction (sig : SignatureAlg ProbComp D PK SK S)
  • theorem evalDist_keyedCRExperiment_crReductionMain [DecidableEq M] [DecidableEq D]
  • theorem evalDist_le_add_of_not_collides [DecidableEq M] [DecidableEq D]
  • theorem runWithSigningOracle_reductionMain (sig : SignatureAlg ProbComp D PK SK S)
  • theorem strongUnforgeableAdvantage_le [DecidableEq M] [DecidableEq D]
  • theorem unforgeableAdvantage_le [DecidableEq M] [DecidableEq D]

VCVioTest/OracleComp/QueryLogRelabel.lean (7)

  • def f (n : ℕ) : ℕ
  • example : QueryLog.collisionCandidate f 5 ([⟨2, ()⟩, ⟨1, ()⟩] : QueryLog (ℕ →ₒ Unit)) = (5, 1)
  • example : QueryLog.collisionCandidate f 5 ([⟨5, ()⟩, ⟨1, ()⟩] : QueryLog (ℕ →ₒ Unit)) = (5, 1)
  • example : QueryLog.hasCollision f 5 ([⟨2, ()⟩, ⟨1, ()⟩] : QueryLog (ℕ →ₒ Unit)) = true
  • example : QueryLog.hasCollision f 5 ([⟨2, ()⟩] : QueryLog (ℕ →ₒ Unit)) = false
  • example : QueryLog.hasCollision f 5 ([⟨5, ()⟩] : QueryLog (ℕ →ₒ Unit)) = false
  • example : QueryLog.relabel f ([⟨5, true⟩, ⟨2, false⟩] : QueryLog (ℕ →ₒ Bool)) =

VCVioTest/UniversePolymorphism.lean (2)

  • example {A B : Type uQuery} (e : A → B) (impl₁ : QueryImpl spec₁ (WriterT (List A) target))
  • example {M : Type uι₁} {D : Type uι₂} {T : Type uQuery} (f : M → D) (msg : M) (τ : T) :

sorry Tracking

  • No sorrys were added, removed, or affected.

📋 **Additional Analysis**

The diff adds new modules, tests, and re-exports that align with VCVio's contribution guidelines. No issues found with style, licensing, imports, module system, documentation, or testing practices.


📄 **Per-File Summaries**
  • VCVio.lean: In VCVio.lean, two new public imports were added: VCVio.OracleComp.QueryTracking.LoggingOracle.Relabel and VCVio.Schemes.HashAndSign, alongside a new import for VCVio.Schemes.HashAndMac. These changes expose newly formalized modules for query relabeling in logging oracles and for hash-and-MAC / hash-and-sign signature schemes, extending the project's coverage of cryptographic constructions and their verification infrastructure.
  • VCVio/OracleComp/QueryTracking/LoggingOracle/Relabel.lean: This new file Relabel.lean defines the relabel operation on query logs (relabel f log maps each entry's message via f, keeping responses) and provides lemmas about its interaction with nil, append, and singleton. It introduces collisionCandidate and hasCollision for detecting collisions of f within a log, and proves hasCollision_of_mem, mem_of_mem_relabel, and mem_map_fst_of_mem_map_fst_relabel to relate membership in the relabelled log to membership in the original log when no collision exists. The translate handler replaces each (M →ₒ T) query with a (D →ₒ T) query under f, and run_simulateQ_withLogging_translate shows that composing this with a logging handler for D →ₒ T yields the same behavior as a logging handler for M →ₒ T composed with relabel f on the log. The file also includes the reusable lemmas run_simulateQ_map_log and run_simulateQ_passthrough_add_liftM that support those proofs. No sorry or admit are present.
  • VCVio/Schemes/HashAndMac.lean: This new file VCVio/Schemes/HashAndMac.lean introduces the hash-and-MAC construction and its security proof. It defines scheme, which composes a short-message MAC (mac) with a keyed hash family (H) to produce a MAC for longer messages. Two reductions are defined: macReduction, which converts a forger against the composed scheme into a forger against the underlying MAC, and crReduction, which converts it into a collision-resistant adversary against the hash family. The file establishes a shared forgeryRun computation and a collides predicate, and proves the theorems strongUnforgeableAdvantage_le and unforgeableAdvantage_le, which bound the (S)UF-CMA advantage against the composed scheme by the sum of the advantage of macReduction against the MAC and the keyed-CR advantage of crReduction against the hash family.
  • VCVio/Schemes/HashAndSign.lean: This new file VCVio/Schemes/HashAndSign.lean introduces a formalization of the hash-and-sign construction for digital signatures. It defines the HashAndSign.scheme construction, which composes a short-message signature scheme sig with a keyed hash family H to produce a long-message signature scheme, and provides two families of reductions: sigReduction and strongSigReduction that convert a forger against the composed scheme into a forger against the short-message scheme, and crReduction and strongCRReduction that convert the same forger into a keyed-collision-resistance adversary. The file proves the main security theorems unforgeableAdvantage_le and strongUnforgeableAdvantage_le, which bound the EUF-CMA and SUF-CMA advantages against the composed scheme by the sum of the corresponding advantage of sigReduction/strongSigReduction against the short-message scheme and the keyed-CR advantage of crReduction/strongCRReduction against the hash family. Supporting lemmas include runWithSigningOracle_reductionMain (equating execution of reductionMain under the honest signing oracle to running the forger against scheme with the output relabelled), evalDist_keyedCRExperiment_crReductionMain (showing the keyed-CR experiment against crReductionMain equals the common forgeryRun followed by a collision test collides), and evalDist_le_add_of_not_collides (a generic union-bound lemma used in both security proofs). No sorry or admit appears in the diff.
  • VCVioTest.lean: The file VCVioTest.lean gains a new public import of the VCVioTest.OracleComp.QueryLogRelabel module, bringing that module's definitions into the project's public namespace alongside the existing OracleComp imports.
  • VCVioTest/OracleComp/QueryLogRelabel.lean: This new test file VCVioTest/OracleComp/QueryLogRelabel.lean adds example-based checks for QueryLog.relabel, QueryLog.collisionCandidate, and QueryLog.hasCollision from VCVio.OracleComp.QueryTracking.LoggingOracle.Relabel, using the map f n = n % 4 on ℕ so that 5 and 1 collide (same remainder 1) while 5 and 2 do not. The examples verify that relabel correctly maps logged inputs by f while preserving responses, that collisionCandidate correctly finds the earliest prior entry with the same f-image (skipping the forged message itself, and ignoring entries with different images), and that hasCollision reports true only when such a distinct prior entry exists. The module-level comment explains that dropping either conjunct of the search in collisionCandidate (e.1 ≠ msg or f e.1 = f msg) would cause a test to fail, documenting the purpose of each condition.
  • VCVioTest/UniversePolymorphism.lean: This change adds two new example statements to the VCVioTest.UniversePolymorphism module, each serving as a universe-polymorphism canary. The first example uses OracleSpec.QueryLog.relabel_singleton to verify that relabeling a singleton query log entry preserves the response in a universe-polymorphic manner. The second example uses QueryImpl.run_simulateQ_map_log to verify that applying a function e to every entry of a simulated query log commutes with the simulateQ operation, ensuring that the simulation respects relabeling even when the response universe is nonzero. The change also adds a public import of VCVio.OracleComp.QueryTracking.LoggingOracle.Relabel to make the required definitions available.

Last updated: 2026-11-21 20:44 UTC.

…e and collision reductions

`VCVio/Schemes/HashAndMac.lean` composes a short-message MAC with a
keyed hash family and proves, for both UF-CMA and SUF-CMA,

  Adv(scheme, A) ≤ Adv(mac, macReduction A) + keyedCRAdvantage(H, crReduction A).

`VCVio/Schemes/HashAndSign.lean` does the same for signatures (hash key in
the public key), for EUF-CMA and SUF-CMA, with `sigReduction` /
`strongSigReduction` and `crReduction` / `strongCRReduction`.

The shared simulation step lives in
`VCVio/OracleComp/QueryTracking/LoggingOracle/Relabel.lean`: translating
each chosen-message query by `f` before a logging handler gives the run of
the logging handler for the composite, with its log relabelled by `f`
(`QueryImpl.run_simulateQ_withLogging_translate`), plus the generic
collision extraction `QueryLog.collisionCandidate`.
dtumad and others added 2 commits November 21, 2026 13:03
…eryLog

`QueryLog` and its existing API live in `OracleSpec.QueryLog`. The
relabelling and collision helpers were declared in a root-level
`QueryLog` namespace, which made `log.relabel f` fail to resolve by dot
notation and started a parallel namespace.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The log relabelling and collision API takes messages, digests and
  responses in independent universes. The simulation laws take any index
  universe and a shared response universe, as gotcha 9 asks of public
  reusable laws. The translation needs messages and digests in the
  response universe, because `withLogging` does.
- `VCVioTest/UniversePolymorphism.lean` uses `relabel_singleton` and
  `run_simulateQ_map_log` at nonzero universes.
- `VCVioTest/OracleComp/QueryLogRelabel.lean` checks relabelling and
  collision extraction for `n % 4` on `ℕ`. Dropping either conjunct of
  the search in `collisionCandidate` breaks one of its checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dtumad

dtumad commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator

Thanks! These are VCVio's first standard-model domain-extension theorems for MACs and signatures, covering both UF and SUF for both primitives. They handle the two cases that make the strong version subtle. A new message whose digest collides with a queried one goes to the collision term. A queried message with a new tag is either a collision or a forgery against the underlying MAC or signature. The hash key is handled as in Katz–Lindell (part of the MAC key, and part of the public key for signatures), the reductions are named, and "one common run, then a pointwise union bound" keeps the proofs short.

I pushed a few commits, plus a merge of current main so CI runs against the new PolyFun pin:

  • The log helpers in Relabel.lean now live in OracleSpec.QueryLog, where QueryLog and its existing API are. The root-level QueryLog namespace kept log.relabel f from resolving by dot notation.
  • The laws in Relabel.lean are universe-polymorphic, as gotcha 9 asks of public reusable laws, with uses at nonzero universes in VCVioTest/UniversePolymorphism.lean. The scheme files stay at Type. The translation keeps messages and digests in the response universe, because withLogging needs that.
  • VCVioTest/OracleComp/QueryLogRelabel.lean checks relabelling and collision extraction on a small example. Dropping either conjunct of the search in collisionCandidate breaks one of its checks.

Approved. Follow-up suggestions, none of them blocking:

  1. QueryImpl.translate f is OracleComp.mapLens along PFunctor.Lens.sumMap (Lens.id _) (RandomOracleRouting.lens f), the same pattern as IND_CPA_swapLens in AsymmEncAlg/INDCPA/Oracle.lean. Stating the reductions and run_simulateQ_withLogging_translate through mapLens and simulateQ_mapLens would reuse that API instead of adding a parallel combinator.
  2. forgeryRun, collides, the evalDist_keyedCRExperiment_* lemmas and evalDist_le_add_of_not_collides are nearly the same in HashAndMac.lean and HashAndSign.lean. The union-bound step is generic in the run, the check and the bad event, so it could be stated once. prEvent_le_prEvent_add_of_prEvent_and_not_le (EvalDist/ProbabilityBounds.lean) may already be it.

run_simulateQ_map_log fills a real gap: it is the naturality of simulateQ for the monad morphism that maps a list log entry by entry, which belongs with PolyFun's writer morphisms. And run_simulateQ_passthrough_add_liftM is the general form of run_simulateQ_passthrough_add_withLogging_simulateQ_liftAmbientImpl in SignatureAlg/Routed.lean. Both are follow-ups on the library side, not for this PR.

@dtumad
dtumad added this pull request to the merge queue Nov 21, 2026
Merged via the queue into Verified-zkEVM:main with commit ace9ec3 Nov 21, 2026
9 checks passed
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