Skip to content

chore(deps): bump VCVio and PolyFun to structure-based handlers - #1604

Draft
dtumad wants to merge 2 commits into
Verified-zkEVM:mainfrom
dtumad:dtumad/handler-structure
Draft

dtumad wants to merge 2 commits into
Verified-zkEVM:mainfrom
dtumad:dtumad/handler-structure

Conversation

@dtumad

@dtumad dtumad commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Moves ArkLib onto VCVio and PolyFun versions in which a handler (QueryImpl, PFunctor.Handler) is a one-field structure instead of a reducible function type. It is a consumer test of the two parent PRs, VCVio Verified-zkEVM/VCVio#1241 and PolyFun Verified-zkEVM/PolyFun#534. The pins are to commits on a fork, so this PR cannot merge as it stands.

  • Commit 1 pins VCVio main with its PolyFun pin moved to PolyFun main (a fork commit), without the handler change. Two files needed fixing: the X^ notation became y^, and the public-coin sampler follows PolyFun's pure replay.
  • Commit 2 pins the handler structures and adapts ArkLib. Handler definitions use where toFun … or ⟨fun q => …⟩, equalities of handlers use ext, and 24 library handlers (2 with -isSimp) and one test handler are tagged @[simps] so that proofs use their equations. Challenge draws (combineDraw, prefixDraw, suffixDraw, transportDraw, sampler) stay raw functions and are wrapped with ⟨…⟩ where a handler is expected.

The second commit changes 69 library files, 55 test files and the four runtime executables in scripts/. Of 539 diff hunks, 514 are mechanical: 216 build a handler with where toFun, 243 wrap a function or draw as ⟨…⟩, 28 replace funext with ext, and 27 add @[simps], name an _apply lemma or use toHandler. The other 25 are type ascriptions, named arguments where higher-order unification no longer sees through the coercion, and one proof about oracle interfaces that needed one more congr 1. No erw, option or suppression is added. None of the roughly 270 change, show and rfl steps across handlers that looked at risk broke.

Porting ArkLib found one gap in VCVio's change, now fixed there: QueryImpl.liftTarget_self had lost the simp attribute that PolyFun's Handler.liftTarget_self gives. A local timing of 1164 of the 1277 modules, one run each, gave 0.976× of the first commit; CI's timing is the better measure.

Formalized statements

None added. Statements change only in how handlers are written: a raw lambda or draw becomes ⟨…⟩. Two spell it differently: projectedInput_eq equates handlers instead of functions, and OracleVerifier.prefixDraw_ofNodesView_cast transports a handler. In commit 1, replay_publicCoinSampler and replay_publicCoinOracleSampler conclude = PUnit.unit because PolyFun's replay no longer returns a monadic value; the content that replay runs no draw is now part of its type.

Admissions and axioms

No sorry is added or closed, and axiomsweep --check passes.

Validation

Based on 4c9a2bd3b, which already pins a newer VCVio (#1596); the first commit moves that pin to the fork.

  • At the head (3587c0da2), ./scripts/validate.sh --axioms passed: build, lake test, both warning budgets, the native-probability retirement sweep, lint-style and its plugin tests, the toy-problem, Hachi, sum-check and FRI-extractor runtime executables, umbrella imports, docs integrity, the PR-script tests, the knowledge-base lint, and axiomsweep --check.
  • The rebase onto main needed only the same field rewrite in the reworked KZG files (feat(KZG)!: KZG over a generic field with computable reductions to t-SDH and ARSDH #1593).
  • At the first commit (0c70dea5d), lake build ArkLib ArkLibTest completes without warnings.
  • With VCVio.Lint.HandlerApply imported, queryImplApply and handlerApply report nothing on ArkLib at the head.

Breaking changes

Code that defines a handler as a function must build the structure: where toFun q := … or ⟨fun q => …⟩. Code that uses a handler as a function is unchanged.

Known gaps

  • The pins are to fork commits. The design documents that record the pinned revisions are left at the current ones.
  • replay_publicCoinSampler and replay_publicCoinOracleSampler hold by rfl after commit 1 and could be removed.
  • Draws remain raw functions. Making them handlers is a possible follow-up; it would overlap with the PRs below.
  • ArkLib does not run environment linters in CI and does not import VCVio's umbrella, so queryImplApply is not enforced here. With VCVio.Lint.HandlerApply imported, both linters report nothing.

Related work

Stacked on VCVio Verified-zkEVM/VCVio#1241 and PolyFun Verified-zkEVM/PolyFun#534. Open PRs that touch the same interaction, oracle-bundle and challenge-draw code: #1578, #1582, #1583, #1590, #1591, #1592.

Checklist

  • I searched the open pull requests and issues for overlapping work.
  • I did the applicable statement checks in CONTRIBUTING.md, "Statement Correctness".
  • The description matches the code and the evidence.
  • The pull request contains no working files from a tool session.

@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🤖 PR Summary

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

This is a consumer test for PRs #1241 (VCVio) and #534 (PolyFun), which change QueryImpl and PFunctor.Handler from reducible function types to one-field structures. ArkLib is adapted to the new API by replacing bare lambdas with explicit structure syntax (where toFun … or ⟨…⟩). The changes are overwhelmingly mechanical (514 of 539 hunks), with the remainder being type ascriptions, named arguments, and a single proof adjustment. No sorry or admit are introduced. The PR is based on fork commits and cannot be merged as-is.


Statistics

Metric Count
📝 Files Changed 133
✅ Lines Added 875
❌ Lines Removed 713

Lean Declarations

✏️ Affected: 75 declaration(s) (line number changed)
  • def pullAnswer (f : OracleBundle.Lens R S) (answer : QueryImpl S.spec Id) : in ArkLib/Interaction/Oracle/BundleOps.lean moved from L88 to L88
  • theorem replay_publicCoinOracleSampler {m : Type u → Type u} in ArkLib/Interaction/Reduction.lean moved from L412 to L408
  • theorem replay_publicCoinSampler {m : Type u → Type u} in ArkLib/Interaction/Reduction.lean moved from L399 to L401
  • private def emptyChallengeImpl : QueryImpl ([]ₒ + [pSpec₁.Challenge]ₒ) ProbComp where in ArkLib/OracleReduction/Composition/Sequential/Append/NoAmbient.lean moved from L31 to L32
  • private def counter : QueryImpl spec (StateT ℕ ProbComp) where in ArkLibTest/Commitments/Functional/Games.lean moved from L30 to L30
  • private def sampleLast : QueryImpl unifSpec Id where in ArkLibTest/Data/MvPolynomial/PrimeFingerprintProbability.lean moved from L74 to L74
  • private def sampleZero : QueryImpl unifSpec Id where in ArkLibTest/Data/MvPolynomial/PrimeFingerprintProbability.lean moved from L76 to L77
  • def labelHandler : QueryImpl labels (StateM (List Nat)) where in ArkLibTest/Interaction/Composition.lean moved from L158 to L160
  • def noQueries : QueryImpl []ₒ Id where in ArkLibTest/Interaction/Legacy/Prover.lean moved from L36 to L36
  • def noQueries : QueryImpl (ambient + challengeSpec oracleSig combined) Id where in ArkLibTest/Interaction/Oracle/DependentRouting.lean moved from L133 to L133
  • def logger : in ArkLibTest/Interaction/Oracle/HeterogeneousAppend.lean moved from L149 to L149
  • def bitChallenges : QueryImpl (challengeSpec oracleSig bitCombined) Id where in ArkLibTest/Interaction/Oracle/HiddenBitFixture.lean moved from L108 to L108
  • def answerAll : QueryImpl ambient (ExceptT Nat (StateM (List Nat))) where in ArkLibTest/Interaction/Oracle/HiddenSendRun.lean moved from L156 to L158
  • def logger (bit : Bool) : in ArkLibTest/Interaction/Oracle/HiddenSendRun.lean moved from L70 to L70
  • def answerPrefix : QueryImpl prefixBundle.spec Id where in ArkLibTest/Interaction/Oracle/LoggedExecution.lean moved from L749 to L757
  • def appendChallenges : QueryImpl (challengeSpec oracleSig pair) Id where in ArkLibTest/Interaction/Oracle/LoggedExecution.lean moved from L692 to L699
  • def decisionHandler : QueryImpl ambient (ExceptT Nat (StateM (List Nat))) where in ArkLibTest/Interaction/Oracle/LoggedExecution.lean moved from L196 to L198
  • def fixedDraw : QueryImpl (challengeSpec oracleSig fixedMessage) Id where in ArkLibTest/Interaction/Oracle/LoggedExecution.lean moved from L1027 to L1036
  • def liftedDraw : QueryImpl (challengeSpec oracleSig liftedNode) Id where in ArkLibTest/Interaction/Oracle/LoggedExecution.lean moved from L1200 to L1211
  • def mixedChallenges : QueryImpl (challengeSpec oracleSig mixed) Id where in ArkLibTest/Interaction/Oracle/LoggedExecution.lean moved from L495 to L500
  • def pairChallenges : QueryImpl (challengeSpec oracleSig pairSend) Id where in ArkLibTest/Interaction/Oracle/LoggedExecution.lean moved from L115 to L116
  • def totalHandler : QueryImpl ambient (ExceptT Nat (StateM (List Nat))) where in ArkLibTest/Interaction/Oracle/LoggedExecution.lean moved from L244 to L247
  • def twiceChallenges : QueryImpl (challengeSpec oracleSig sendTwice) Id where in ArkLibTest/Interaction/Oracle/LoggedExecution.lean moved from L386 to L390
  • def twoOracleDraw : QueryImpl (challengeSpec oracleSig twoOracles) Id where in ArkLibTest/Interaction/Oracle/LoggedExecution.lean moved from L1067 to L1077
  • def logger : QueryImpl (ambient + challengeSpec oracleSig pairSend) (StateM (List Nat)) where in ArkLibTest/Interaction/Oracle/OutputClosing.lean moved from L49 to L49
  • def tagLogger : QueryImpl ambient (StateM (List Nat)) where in ArkLibTest/Interaction/Oracle/PassiveExecution.lean moved from L397 to L399
  • def tagHandler : QueryImpl (ambient + challengeSpec oracleSig combined) Id where in ArkLibTest/Interaction/Oracle/RoutedAccess.lean moved from L194 to L194
  • def traceHandler : QueryImpl (ambient + challengeSpec oracleSig combined) (StateM (List Nat)) where in ArkLibTest/Interaction/Oracle/Routing.lean moved from L159 to L161
  • def logger : QueryImpl ambient (StateM (List Nat)) where in ArkLibTest/Interaction/Oracle/StageChain.lean moved from L161 to L161
  • example : (publicCoinSampler plainSig coin failingDraw).replay ⟨true, ⟨⟩⟩ = PUnit.unit in ArkLibTest/Interaction/Plain.lean moved from L54 to L54
  • def draw : QueryImpl (challengeSpec plainSig coin) ProbComp where in ArkLibTest/Interaction/Security.lean moved from L169 to L172
  • def logHandler : QueryImpl (service + challengeSpec plainSig zero) (StateM (List Nat)) where in ArkLibTest/Interaction/Security.lean moved from L108 to L108
  • def oracleHandler : QueryImpl (OracleSpec.emptySpec + challengeSpec oracleSig tree) Id where in ArkLibTest/Interaction/Security.lean moved from L144 to L146
  • def payloadHandler : QueryImpl (counter + challengeSpec plainSig payloadMsg) Id where in ArkLibTest/Interaction/Security.lean moved from L559 to L564
  • def stateImpl : QueryImpl service (StateT Nat ProbComp) where in ArkLibTest/Interaction/Security.lean moved from L127 to L128
  • def tick : QueryImpl counter (StateT Nat ProbComp) where in ArkLibTest/Interaction/Security.lean moved from L243 to L247
  • def drawTwo : QueryImpl (challengeSpec plainSig twoChallenges) ProbComp where in ArkLibTest/Interaction/Security/Implications.lean moved from L270 to L270
  • def handler : QueryImpl ambient (OptionT ProbComp) where in ArkLibTest/Interaction/Security/Implications.lean moved from L656 to L659
  • def noChallenges : QueryImpl (challengeSpec plainSig protocol) ProbComp where in ArkLibTest/Interaction/Security/Implications.lean moved from L677 to L681
  • def optionalAmbient : QueryImpl counter (OptionT ProbComp) where in ArkLibTest/Interaction/Security/Implications.lean moved from L531 to L533
  • def uniformBit : QueryImpl ambient ProbComp where in ArkLibTest/Interaction/Security/Implications.lean moved from L417 to L418
  • def challengeDraw : QueryImpl (challengeSpec plainSig challengeProtocol) ProbComp where in ArkLibTest/Interaction/Security/KnowledgeComposition.lean moved from L766 to L769
  • def counterHandler : QueryImpl counterSpec (StateT Nat ProbComp) where in ArkLibTest/Interaction/Security/KnowledgeComposition.lean moved from L830 to L834
  • def firstDraw : QueryImpl (challengeSpec oracleSig firstProtocol) ProbComp where in ArkLibTest/Interaction/Security/KnowledgeComposition.lean moved from L187 to L188
  • def impl : QueryImpl OracleSpec.emptySpec (StateT Unit ProbComp) where in ArkLibTest/Interaction/Security/KnowledgeComposition.lean moved from L252 to L254
  • def indexedDraw : QueryImpl (challengeSpec plainSig indexedProtocol) ProbComp where in ArkLibTest/Interaction/Security/KnowledgeComposition.lean moved from L711 to L714
  • def largeCounterHandler : QueryImpl counterSpec (StateT Nat (OracleComp largeSpec)) where in ArkLibTest/Interaction/Security/KnowledgeComposition.lean moved from L873 to L878
  • def selectedAnswers (c : Bool) : QueryImpl ([]ₒ + challengeSpec oracleSig selectedProtocol) Id where in ArkLibTest/Interaction/Security/StateRestoration.lean moved from L752 to L752
  • def selectedDraw : QueryImpl (challengeSpec oracleSig selectedProtocol) ProbComp where in ArkLibTest/Interaction/Security/StateRestoration.lean moved from L988 to L989
  • def ambientTrue : QueryImpl smallAmbient (StateT Unit ProbComp) where in ArkLibTest/Interaction/UniverseCanary.lean moved from L304 to L306
  • def handler : QueryImpl (smallAmbient + challengeSpec oracleSig oracleDone) Id where in ArkLibTest/Interaction/UniverseCanary.lean moved from L148 to L148
  • def noChallenges : QueryImpl (challengeSpec oracleSig oracleDone) ProbComp where in ArkLibTest/Interaction/UniverseCanary.lean moved from L307 to L310
  • def noPlainChallenges : QueryImpl (challengeSpec plainSig done) ProbComp where in ArkLibTest/Interaction/UniverseCanary.lean moved from L344 to L349
  • def nodeHandler : QueryImpl (smallAmbient + challengeSpec oracleSig typeQueryProtocol) Id where in ArkLibTest/Interaction/UniverseCanary.lean moved from L287 to L288
  • def plainAmbientTrue : QueryImpl smallAmbient (StateT Unit ProbComp) where in ArkLibTest/Interaction/UniverseCanary.lean moved from L341 to L345
  • def counterImpl : QueryImpl counterSpec (StateT ℕ ProbComp) where in ArkLibTest/OracleReduction/Composition/Sequential/OrdinaryComposition.lean moved from L211 to L211
  • def impl : QueryImpl spec (StateT Bool ProbComp) where in ArkLibTest/OracleReduction/Composition/Sequential/SharedStateCounterexample.lean moved from L37 to L38
  • def pureImpl : QueryImpl oracleSpec (StateT Unit ProbComp) where in ArkLibTest/OracleReduction/Composition/Sequential/SimulatedFactorization.lean moved from L37 to L37
  • def defaultTable : QueryImpl (srChallengeOracle Unit spec) Id where in ArkLibTest/OracleReduction/FiatShamirCompleteness.lean moved from L51 to L52
  • def impl : QueryImpl []ₒ (StateT Unit ProbComp) where in ArkLibTest/OracleReduction/FiatShamirCompleteness.lean moved from L48 to L48
  • def impl : QueryImpl oracle (StateT Bool ProbComp) where in ArkLibTest/OracleReduction/GuardedBridges.lean moved from L26 to L26
  • def impl : QueryImpl oracle (StateT Unit ProbComp) where in ArkLibTest/OracleReduction/GuardedLiftContext.lean moved from L33 to L33
  • def impl : QueryImpl oracle (StateT Unit ProbComp) where in ArkLibTest/OracleReduction/LiftContextRoundByRound.lean moved from L29 to L29
  • private def noQueries : QueryImpl []ₒ Id where in ArkLibTest/ProofSystem/Plonk/Assembly.lean moved from L60 to L60
  • private def noQueries : QueryImpl []ₒ Id where in ArkLibTest/ProofSystem/Plonk/GrandProduct.lean moved from L48 to L48
  • private def sampleZero : QueryImpl unifSpec Id where in ArkLibTest/ProofSystem/Spartan/Batching.lean moved from L127 to L127
  • def emptyImpl : QueryImpl []ₒ (StateT Unit ProbComp) where in ArkLibTest/ProofSystem/Spartan/Sumcheck.lean moved from L136 to L136
  • def emptyImpl : QueryImpl emptySpec (StateT Unit ProbComp) where in ArkLibTest/ProofSystem/Spartan/WitnessAttachment.lean moved from L99 to L99
  • def answerThree : QueryImpl (ambient + challengeSpec oracleSig (round K 1)) Id where in ArkLibTest/ProofSystem/Sumcheck/Composition.lean moved from L92 to L92
  • def record : QueryImpl Q (StateM (List ℕ)) where in ArkLibTest/ProofSystem/Sumcheck/Effects.lean moved from L301 to L301
  • def record : QueryImpl Q (StateM (List ℕ)) where in ArkLibTest/ProofSystem/Sumcheck/Routing.lean moved from L444 to L444
  • def fixedAt (r : F) : QueryImpl (challengeSpec oracleSig (protocol F 2 1)) ProbComp where in ArkLibTest/ProofSystem/Sumcheck/Soundness.lean moved from L307 to L307
  • def fieldOpLog : QueryImpl (ArithmeticSpec R) (StateM (List (FieldOp R))) where in ArkLibTest/ToCompPoly/Univariate/Arithmetic.lean moved from L54 to L54
  • def unifIdImpl : QueryImpl unifSpec Id where in scripts/HachiRuntime.lean moved from L327 to L327
  • def record : QueryImpl events (StateM (List Entry)) where in scripts/SumcheckRuntime.lean moved from L60 to L60

sorry Tracking

  • No sorrys were added, removed, or affected.

Lean Quality Signals

  • ⚠️ #eval debug command left in code — 4 occurrence(s): ArkLibTest/Interaction/Security/StateRestoration.lean L213, ArkLibTest/Interaction/Security/StateRestoration.lean L218, ArkLibTest/Interaction/Security/StateRestoration.lean L808, ArkLibTest/Interaction/Security/StateRestoration.lean L812

📋 **Additional Analysis**

This pull request performs a systematic migration from fun q => ... lambda-style definitions to ⟨fun q => ...⟩ constructor-style definitions for QueryImpl, OracleInterface.toOC.impl, OracleMap.impl, and other structure fields. It also updates proofs and function call sites to use the new syntax. Additionally, it updates dependency URLs to point to a fork (dtumad) and modifies some theorems (e.g., replay_publicCoinSampler) to reflect changes in the underlying libraries. The changes are consistent with the project's aim to adopt explicit structure syntax, likely to improve compile times or align with a library refactor.


Last updated: 2026-11-26 02:23 UTC.

Pin VCVio to the branch that tracks PolyFun main. The removed `X^` notation becomes `y^`, and the
public-coin sampler follows PolyFun's pure replay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dtumad
dtumad force-pushed the dtumad/handler-structure branch from ba2bd47 to 27bf6a2 Compare November 26, 2026 02:05
Pin VCVio and PolyFun to the commits in which `QueryImpl` and `PFunctor.Handler` are one-field
structures. Handlers are built with `where toFun …` or `⟨fun q => …⟩`, equalities of handlers use
`ext`, and handlers that proofs use by their equation are tagged `@[simps]`. Challenge draws stay
raw functions and are wrapped where a handler is expected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dtumad
dtumad force-pushed the dtumad/handler-structure branch from 27bf6a2 to 3587c0d Compare November 26, 2026 02:22
@github-actions

Copy link
Copy Markdown
Contributor

Build Timing Report

  • PR head: 3587c0d
  • Message: chore(deps): bump VCVio and PolyFun to structure-based handlers
  • Ref: dtumad/handler-structure
  • Measured checkout: 7266901 (workflow head 3587c0d).
  • Build cache: restored the main build of 4c9a2bd; Lake rebuilt only modules whose source or imports differ from it.
  • Runner: ubuntu24 20261116.133.1, X64, 4 cores.
  • Dependency cache: fallback restore (Linux-lean-deps-7cdeca2242e3c1c9ff5bf24c261822ab1eae8bd7acde6058fa912cc571ac96a0); manifest d15c5aaaea32.
  • Measured on the pinned ubuntu-24.04 runner with /usr/bin/time -p.
  • Commands: library build lake build; native build lake build toyproblem-runtime hachi-runtime sumcheck-runtime fri-extractor-runtime lint-style; validation wrapper ./scripts/validate.sh.
  • The rows run in order against one tree, so native build and validation wrapper both measure an already-built library: validation wrapper is the cost of the gate itself, not of a cold ./scripts/validate.sh. CI passes it no flags, so --docs, --site and --axioms contribute nothing.
Measurement Wall (s) CPU work (s) Status
Library build 592.10 2285.97 ok
Native build 19.24 58.75 ok
Validation wrapper 281.97 968.68 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 787 modules (0 without an earlier time). The 787 with an earlier time took 2853s here against 3143s when main last built them (-290s (-9.2%)).

Estimated clean-build compile time, summed over all 1621 modules: 5923s before, 5634s after (-290s (-4.9%)).

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 787 rebuilt modules.

Current (s) Earlier (s) Delta (s) Path
50 49 +1 ArkLibTest/Interaction/Oracle/PassiveExecution.lean
44 48 -4 ArkLibTest/Interaction/Oracle/HiddenSendRun.lean
35 34 +1 ArkLibTest/Interaction/Oracle/StageChain.lean
32 35 -3 ArkLibTest/Interaction/Oracle/LoggedExecution.lean
26 25 +1 ArkLibTest/Interaction/Security/StateRestorationBudget.lean
15 16 -1 ArkLib/ToCompPoly/Univariate/ArithmeticInterpolationBound.lean
14 12 +2 ArkLib/ProofSystem/Spartan/Security.lean
13 12 +1 ArkLibTest/Interaction/Oracle/QueryCost.lean
12 16 -4 ArkLib/Data/CodingTheory/ProximityGenerator/MDSGenerator.lean
12 13 -1 ArkLib/Data/CodingTheory/ReedSolomon/MutualCorrelatedAgreement/FirstOrder/Branchwise.lean
12 11 +1 ArkLibTest/Interaction/Security/StateRestoration.lean
12 9.2 +3 ArkLibTest/Interaction/Oracle/RoutedAccess.lean
11 10 +1 ArkLib/Interaction/StageChain.lean
11 11 +0 ArkLib/Data/CodingTheory/ProximityGap/Folding/ListDecodability.lean
11 13 -2 ArkLibTest/Interaction/Security/KnowledgeComposition.lean
10 15 -5 ArkLib/ProofSystem/Sumcheck/IntervalCompleteness.lean
10 13 -3 ArkLib/Data/CodingTheory/ProximityGap/Folding.lean
10 10 +0 ArkLibTest/Data/CodingTheory/ReedSolomon/MutualCorrelatedAgreement/TaylorChart.lean
9.9 9.5 +0.4 ArkLib/Data/CodingTheory/ListDecodability/Bounds/KKH26.lean
9.9 9.5 +0.4 ArkLibTest/Data/CodingTheory/ReedSolomon/MutualCorrelatedAgreement/FirstOrder.lean

This branch has not been deployed

No deployments
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