Skip to content

feat(hashsig): replay settled WOTS+ chains from a cache hint - #1186

Merged
dtumad merged 12 commits into
Verified-zkEVM:mainfrom
dtumad:dtumad/pr-hint-cache
Nov 22, 2026
Merged

dtumad merged 12 commits into
Verified-zkEVM:mainfrom
dtumad:dtumad/pr-hint-cache

Conversation

@dtumad

@dtumad dtumad commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

A two-step WOTS+ chain asks for the hash of x at address i, then hashes that answer at address i + 1. If one source cache contains both entries, a cache selected by its public hint can reproduce the same chain tip. The result covers arbitrary starting inputs and chain lengths.

QueryCache.exists_hint_upperBound_iff characterizes when one cache per hint extends every history with that hint. Histories must agree on each query they both answer. exists_hint_cache_for_chains applies this criterion to every successful WOTS+ chain read at once. A regression uses the actual public hash queries for two consecutive steps. A separate Boolean example shows how a shared cache can complete a read that missed in both original histories, and why conflicting stored answers rule out even successful-result replay.

The PolyFun pin and the compatibility fixes this PR used to carry are now on main through #1204, which pins PolyFun at 713d8857, a descendant of the handler theorem at 77731620. After merging main, this PR adds only the cache-hint results, their regression tests and the two umbrella imports.

Verification

7f16b0529 merges main at e9727ae07, and the pin files are now main's. On that commit, lake build --wfail HashSig VCVio HashSigTest passed. It built the new cache-hint modules, the PolyFun handler modules they import, both umbrella modules and the SLH-DSA tests that depend on them, on top of a validated build of main. Before the merge, the full ./scripts/validate.sh --lint --test --axioms run passed on 99bf3cd53, with zero sorry or nonstandard-axiom taint across 32,435 declarations.

dtumad and others added 10 commits November 18, 2026 11:00
Characterize when hidden caches with a shared hint admit a common upper bound in the native cache order. Apply the criterion to every settled WOTS+ chain and check a two-hash chain, incomparable caches, and conflicting answers.

Co-Authored-By: Codex <noreply@openai.com>
Preserve the existing VCVio instances while using the public theorem names from the target PolyFun revision. The full proof build rejects warnings from the deprecated spellings.

Co-Authored-By: Codex <noreply@openai.com>
The public criterion is stated in QueryCache vocabulary. Downstream consumers need the PolyFun theorem only while elaborating its proof.

Co-Authored-By: Codex <noreply@openai.com>
Keep the VCVio-specific names for explicit callers. The current PolyFun revision supplies the generic bind, pure and map simp rules for this exact-WP instance.

Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Port the tactic, lossless expectation rule, and regression from Verified-zkEVM#1179 commit 74ef550.

Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
(cherry picked from commit f587574)
Port the uniform-sampling rule from Verified-zkEVM#1179 commit 05df36f. The two-draw CoreVCGen regression exercises the normalized unit postcondition.

Co-Authored-By: Codex <noreply@openai.com>
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🤖 PR Summary

Mathematical Formalization

  • QueryCache.exists_hint_upperBound_iff in VCVio/OracleComp/QueryTracking/RandomOracle/CachePartial/Hint.lean characterizes when a single replay cache can extend all given caches via a hint function: such a replay exists iff any two histories with the same hint give equal answers for every query both answer.
  • exists_hint_cache_for_chains in HashSig/SLHDSA/Security/HintCache.lean applies this criterion to WOTS+ chains: if multiple source caches sharing the same hint agree on all common answers, a single replay cache per hint simultaneously preserves every settled chain across all sources.
  • chain?_eq_some_of_hint shows that a settled chain reading (chain?) from an original cache remains settled in a replay cache extending it.
  • two_hash_reads_replayed in HashSigTest/SLHDSA/HintCache.lean proves that given two cached hash entries where the second's input is the first's output, a replayed cache satisfying the same partial order yields the two-step chain result.

Examples / Tests

  • HashSigTest/SLHDSA/HintCache.lean defines a Boolean oracle spec and two incomparable histories (history false, history true). Proves:

    • adaptive_misses: each history misses one of two adaptive reads.
    • one_label_upperBound: the two histories share an upper bound.
    • adaptive_hit_of_upperBound: any common upper bound forces the adaptive read to succeed.
    • no_one_label_exact: no single cache matches both histories on all oracle programs.
    • conflict_rejects_one_label: conflicting stored values block a unanimous replay.

    No sorry or admit in this file.

Infrastructure / API Changes

  • HashSig.lean adds a public import of HashSig.SLHDSA.Security.HintCache, exposing the new security reasoning module.
  • VCVio.lean adds a public import of VCVio.OracleComp.QueryTracking.RandomOracle.CachePartial.Hint, making hint-related functionality part of the public API.
  • The root lakefile.lean and both manifests (root and Interop) pin PolyFun at commit 77731620. Compatibility changes adapt to PolyFun's current state-bind names, WriterT rules, and shared infimum lemma. These changes affect postcondition normalization in the loop, uniform-sampling and partial-computation examples.
  • Carries focused fixes and tests from VCVio feat(oracle): share deterministic query bounds and expectation folds #1179 that retain unsolved goals and accept the normalized empty exception postcondition for sampling and constant expectations.

Documentation

  • HashSig/SLHDSA/Security/HintCache.lean includes module-level documentation explaining the two-step regression (hash of x at address i, then hash of that answer at address i+1) and the consistency condition that enables cache replay.

No sorry or admit were added in any of the new files, and the axiom sweep reported zero sorry or nonstandard-axiom taint across the entire project.


Statistics

Metric Count
📝 Files Changed 5
✅ Lines Added 190
❌ Lines Removed 0

Lean Declarations

✏️ Added: 12 declaration(s)

HashSig/SLHDSA/Security/HintCache.lean (2)

  • theorem chain?_eq_some_of_hint {cache : T → PublicHash.Cache core} {hint : T → H}
  • theorem exists_hint_cache_for_chains (cache : T → PublicHash.Cache core) (hint : T → H)

HashSigTest/SLHDSA/HintCache.lean (9)

  • abbrev spec
  • def adaptive : OracleComp spec Bool
  • def history (t : Bool) : spec.QueryCache
  • theorem adaptive_hit_of_upperBound (c : spec.QueryCache) (extendsCache : ∀ t, history t ≤ c) :
  • theorem adaptive_misses (t : Bool) : simulateQ (history t).toPartialImpl adaptive = none
  • theorem conflict_rejects_one_label :
  • theorem no_one_label_exact :
  • theorem one_label_upperBound : ∃ replay : Unit → spec.QueryCache, ∀ t, history t ≤ replay ()
  • theorem two_hash_reads_replayed {p : Params} {core : CorePrimitives p} {T H : Type*}

VCVio/OracleComp/QueryTracking/RandomOracle/CachePartial/Hint.lean (1)

  • theorem exists_hint_upperBound_iff (cache : T → spec.QueryCache) (hint : T → H) :

sorry Tracking

  • No sorrys were added, removed, or affected.

📄 **Per-File Summaries**
  • HashSig.lean: In HashSig.lean, a new public import statement was added for HashSig.SLHDSA.Security.HintCache, which introduces a module dedicated to security reasoning about the hint cache mechanism in the SLH-DSA scheme. This import suggests the existence of new definitions, lemmas, or theorems related to the correctness or security properties of the hint cache, expanding the security framework of the project.
  • HashSig/SLHDSA/Security/HintCache.lean: Added new file HashSig/SLHDSA/Security/HintCache.lean which introduces two theorems about replaying WOTS+ chain readings from a cache hint. chain?_eq_some_of_hint shows that if a cache is extended by a replay function, any settled chain reading (via chain?) from the original cache remains settled in the replay cache. exists_hint_cache_for_chains proves that if multiple source caches sharing the same hint agree on all common answers, there exists a single replay cache per hint that simultaneously preserves every settled chain across all those sources. The file also includes module-level documentation explaining the two-step regression and the consistency condition.
  • HashSigTest/SLHDSA/HintCache.lean: This new file HashSigTest/SLHDSA/HintCache.lean defines a minimal Boolean-request/Boolean-response oracle spec and two incomparable histories (history false and history true) to illustrate cache-replay properties. It proves adaptive_misses (each history misses one of two adaptive reads), one_label_upperBound (the two histories share an upper bound), adaptive_hit_of_upperBound (any common upper bound forces the adaptive read to succeed), no_one_label_exact (no single cache matches both histories on all oracle programs), and conflict_rejects_one_label (conflicting stored values block a unanimous replay). It also proves two_hash_reads_replayed, a generic theorem about WOTS+ hash-chain replay: given two cached hash entries where the second’s input is the first’s output, a replayed cache satisfying the same partial order yields the two-step chain result. No sorry or admit appears.
  • VCVio.lean: Added a public import of VCVio.OracleComp.QueryTracking.RandomOracle.CachePartial.Hint, making the definitions within that module part of the public API. This change exposes a new submodule (likely providing hint-related functionality for the cache-partial oracle query tracking) to consumers of the library.
  • VCVio/OracleComp/QueryTracking/RandomOracle/CachePartial/Hint.lean: The new file Hint.lean adds the theorem exists_hint_upperBound_iff, which characterizes when there exists a single replay cache that extends all given caches according to a hint function: such a replay exists iff any two histories with the same hint return equal answers for every query they both answer. The proof uses a translation to PFunctor.Handler.Hint.exists_preservesSettled_iff to establish the equivalence between the existence of a replay : H → spec.QueryCache with ∀ t, cache t ≤ replay (hint t) and the pairwise compatibility condition on cache.

Last updated: 2026-11-21 17:53 UTC.

@dtumad
dtumad marked this pull request as ready for review November 21, 2026 00:51
dtumad added a commit to dtumad/VCVio that referenced this pull request Nov 21, 2026
Pins PolyFun at f3eb8333 in the root lakefile and both manifests. The PolyFun changes since
528b3b1 need the compatibility edits from Verified-zkEVM#1186 in the lower-expectation and relational-algebra
files and their tests. They are copied unchanged, so Verified-zkEVM#1186 rebases onto this with only its own
content left.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main now pins PolyFun at 713d8857 (Verified-zkEVM#1204), a descendant of this
branch's pin 77731620, and carries this branch's compatibility edits,
so the pin conflicts resolve to main's files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dtumad added a commit to sisyphm/VCVio that referenced this pull request Nov 21, 2026
…support workaround (Verified-zkEVM#1204)

* refactor(OracleComp): build on PolyFun's inductive return predicate for support

PolyFun's `MonadAttach` instance for `FreeM P` now uses an inductive `FreeM.CanReturn`. With it,
neither the kernel nor the elaborator evaluates a computation to compare `x ∈ support mx` with
`x ∈ support my`. The proof of Verified-zkEVM#1197 checks without the workaround from gotcha 13b, including
`simp` with `mem_support_bind_iff` on a `do` block, passing `h : x ∈ support mx` to a lemma, an
`abbrev` and `unfold`. `VCVioTest/OracleComp/SupportKernel.lean` checks those four cases.

`support (pure x) = {x}` no longer holds by `rfl` on `OracleComp`. Proofs that used a membership
in the support of `pure` as an equation now go through `eq_of_mem_support_pure` or
`mem_support_pure_iff`. Gotcha 13b describes the inductive predicate and keeps the general warning
about sets computed by recursion over a program (leanprover/lean4#16613).

The PolyFun pin is a cherry-pick of the PolyFun change onto the previous pin, for integration
testing. It must be replaced by the merged PolyFun commit before this lands.

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

* chore(deps): pin PolyFun at its support change on current main

Pins PolyFun at f3eb8333 in the root lakefile and both manifests. The PolyFun changes since
528b3b1 need the compatibility edits from Verified-zkEVM#1186 in the lower-expectation and relational-algebra
files and their tests. They are copied unchanged, so Verified-zkEVM#1186 rebases onto this with only its own
content left.

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

* docs(upstream-alignment): record PolyFun's inductive return predicate

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

* chore(deps): pin PolyFun at the merged support change

Verified-zkEVM/PolyFun#509 merged as 713d8857, whose tree is identical
to the PR head f3eb8333 that this branch was validated against. The root
lakefile and both manifests now name the merged commit.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@dtumad
dtumad added this pull request to the merge queue Nov 21, 2026
Merged via the queue into Verified-zkEVM:main with commit f8d7f8e Nov 22, 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.

1 participant