Skip to content

feat(fri): bound extractor charges by the initial domain size - #1614

Draft
alexanderlhicks wants to merge 1 commit into
mainfrom
feat/fri-domain-envelope
Draft

alexanderlhicks wants to merge 1 commit into
mainfrom
feat/fri-domain-envelope

Conversation

@alexanderlhicks

Copy link
Copy Markdown
Collaborator

Summary

Bound the existing schedule-specific FRI extractor profile by an explicit polynomial for each resource kind. Each polynomial depends only on the initial domain cardinality N = 2 ^ n. Its degree is at most four.

Formalized statements

  • Fri.Spec.Extractor.extractorProfileBound_le_domainEnvelope bounds each coordinate of the existing profile by evaluating its polynomial at N. It uses the reduction's domain condition 2 ^ (∑ j, (s j).val) * d.val ≤ 2 ^ n, where s is the folding schedule and d is the terminal degree bound.
  • Fri.Spec.knowledgeSoundnessWithResources_extract_domainEnvelope applies that inequality to the existing knowledge-soundness certificate. It retains the same extractor, measured program, soundness error, and hypotheses, and uses the domain-size budget.

Both results derive from ArkLib's existing measured FRI development.

Admissions and axioms

The PR adds and closes zero admissions. The compile-time tests check the axiom output for both headline theorems.

'Fri.Spec.Extractor.extractorProfileBound_le_domainEnvelope' depends on axioms:
[propext, Classical.choice, Quot.sound]
'Fri.Spec.knowledgeSoundnessWithResources_extract_domainEnvelope' depends on axioms:
[propext, Classical.choice, Quot.sound]

Validation

  • ./scripts/validate.sh --axioms passed at 4e592aa3a on the tracked dependency pins. The sweep checked 23,368 declarations across 1,291 modules and found zero sorryAx or nonstandard axiom dependencies.
  • The FRI tests check a closed form for retained-word reads and a degree bound for every kind. They also check the exact degrees for multiplication (four) and retained-word reads (two).

Known gaps

The budget counts one unit in the corresponding coordinate for each declared instruction. View preparation, handler work beyond the declared prices, and local computation outside those instructions lie outside the budget. The polynomials are in the domain cardinality N. Bounds in log N, cryptographic polynomial time, and bit runtime require separate arguments.

Related work

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.

Give each instruction kind an explicit polynomial in the initial
domain cardinality. Use positive folding exponents to bound sums of
block-size powers. Under the existing domain condition, these
polynomials dominate the schedule-specific extraction profile.

Lift the FRI knowledge-soundness certificate to the polynomial budget
and check the degree bounds and proof dependencies. Document which
operations are charged and the separate obligations for runtime.

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

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🤖 PR Summary

Mathematical Formalization

  • DomainCost.lean defines piecewise polynomial bounding functions (interpolationEnvelope, blockEnvelope, positionDomainEnvelope, initializationDomainEnvelope, prefixEnvelope) for each FRI extractor resource kind and proves that the extractor's operation profile (extractorProfileBound) is pointwise bounded by the polynomial extractorDomainEnvelope evaluated at the initial domain cardinality N = 2 ^ n, under the condition 2 ^ (∑ j, (s j).val) * d.val ≤ 2 ^ n (where s is the folding schedule and d is the terminal degree bound). The main theorem is extractorProfileBound_le_domainEnvelope. An auxiliary lemma extractorDomainEnvelope_eq rewrites the envelope.

  • MeasuredKnowledgeSoundness.lean adds the theorem knowledgeSoundnessWithResources_extract_domainEnvelope, which combines the existing knowledge-soundness certificate (knowledgeSoundnessWithResources_extract) with the new profile bound via a monotonicity lemma (OracleVerifier.knowledgeSoundnessWithResources.mono). It thus provides a domain-size-based cost envelope for the same extractor, measuered program, soundness error, and hypotheses.

Infrastructure / CI

  • ArkLib.lean now public imports ArkLib.ProofSystem.Fri.Spec.Extraction.DomainCost, making the module and its theorems available to all downstream consumers of ArkLib.
  • The ArkLibTest/ProofSystem/Fri/Extraction.lean test file verifies:
    • The exact symbolic form of extractorDomainEnvelope N (.inr .wordRead) as 2*N^2 + N by simp.
    • That the natDegree of extractorDomainPolynomial is ≤4 for all resource kinds, exactly 4 for .inl .mul, and exactly 2 for .inr .wordRead.
    • Axiom dependency #guard_msgs blocks for the two headline theorems, confirming they depend only on [propext, Classical.choice, Quot.sound].

Documentation

  • docs/design/03a-extractor-efficiency.md expands the discussion of the cost vector, clarifying that view construction, handler work beyond each instruction's price, and local computation are not covered. It explicitly introduces the theorem extractorProfileBound_le_domainEnvelope as the core bound.
  • docs/kb/audits/fri-soundness.md updates the run-time analysis table to cite knowledgeSoundnessWithResources_extract_domainEnvelope, explains that the budget is either the schedule-specific profile or its polynomial bound at N, and clarifies that the size variable is the domain cardinality (not its logarithm).
  • docs/wiki/repo-map.md adds a note describing Spec/Extraction/DomainCost.lean as bounding the charge of each instruction kind by a polynomial in the initial domain size.

Known Gaps (No sorries added)

The PR adds and closes zero sorry or admit placeholders. The budgets count one unit per declared instruction; view preparation, handler work beyond declared prices, and local computation outside those instructions lie outside the budget. The polynomials are in N (domain cardinality), not its logarithm; bounds in log N, cryptographic polynomial time, and bit runtime require separate arguments. This is documented in the PR body and reflected in the design document.

Refactoring

None. All changes are additive: new module, new theorem, expanded imports, additional test examples, and documentation updates.


Statistics

Metric Count
📝 Files Changed 7
✅ Lines Added 358
❌ Lines Removed 12

Lean Declarations

✏️ Added: 22 declaration(s)

ArkLib/ProofSystem/Fri/Spec/Extraction/DomainCost.lean (17)

  • noncomputable def extractorDomainEnvelope (N : ℕ) (kind : CostKind) : ℕ
  • noncomputable def extractorDomainPolynomial : CostKind → Polynomial ℕ
  • private def blockEnvelope (m : ℕ) : Cost
  • private def initializationDomainEnvelope (N : ℕ) : Cost
  • private def interpolationEnvelope (m : ℕ) : ArithmeticCost
  • private def positionDomainEnvelope (N : ℕ) (kind : CostKind) : ℕ
  • private def prefixEnvelope (n : ℕ) (kind : CostKind) : ℕ
  • private theorem evaluationProfileBound_mono {m N : ℕ} (h : m ≤ N)
  • private theorem extractorDomainEnvelope_eq (N : ℕ) (kind : CostKind) :
  • private theorem initializationBound_le_domainEnvelope {n k : ℕ} (s : Fin (k + 1) → ℕ+)
  • private theorem interpolationProfileBound_le_envelope {m N : ℕ} (hm : 0 < m) (hN : m ≤ N)
  • private theorem positionProfileBound_le_domainEnvelope {n k : ℕ} (s : Fin (k + 1) → ℕ+)
  • private theorem roundProfileBound_le_blockEnvelope {k n d : ℕ} (s : Fin (k + 1) → ℕ+)
  • private theorem rounds_le {n k : ℕ} (s : Fin (k + 1) → ℕ+)
  • private theorem sum_blockEnvelope_le {k n : ℕ} (s : Fin (k + 1) → ℕ+)
  • private theorem sum_blockPow_le {k n : ℕ} (s : Fin (k + 1) → ℕ+)
  • theorem extractorProfileBound_le_domainEnvelope {n k : ℕ} (s : Fin (k + 1) → ℕ+) (d : ℕ+)

ArkLib/ProofSystem/Fri/Spec/MeasuredKnowledgeSoundness.lean (1)

  • theorem knowledgeSoundnessWithResources_extract_domainEnvelope

ArkLibTest/ProofSystem/Fri/Extraction.lean (4)

  • example (N : ℕ) : extractorDomainEnvelope N (.inr .wordRead) = 2 * N ^ 2 + N
  • example (kind : CostKind) : (extractorDomainPolynomial kind).natDegree ≤ 4
  • example : (extractorDomainPolynomial (.inl .mul)).natDegree = 4
  • example : (extractorDomainPolynomial (.inr .wordRead)).natDegree = 2

sorry Tracking

  • No sorrys were added, removed, or affected.

📄 **Per-File Summaries**
  • ArkLib.lean: The file now public imports ArkLib.ProofSystem.Fri.Spec.Extraction.DomainCost, making a previously non‑exported module available to all downstream consumers of ArkLib. No other definitions, theorems, or signatures were changed.
  • ArkLib/ProofSystem/Fri/Spec/Extraction/DomainCost.lean: This new file introduces a collection of domain-size-based cost envelopes for the FRI extractor. It defines piecewise polynomial bounding functions (interpolationEnvelope, blockEnvelope, positionDomainEnvelope, initializationDomainEnvelope, prefixEnvelope) for each resource kind and proves, via a chain of lemmas (sum_blockPow_le, rounds_le, interpolationProfileBound_le_envelope, evaluationProfileBound_mono, roundProfileBound_le_blockEnvelope, sum_blockEnvelope_le, positionProfileBound_le_domainEnvelope, initializationBound_le_domainEnvelope), that the extractor's operation profile (extractorProfileBound) is pointwise bounded by the polynomial extractorDomainEnvelope evaluated at the initial domain cardinality. The main result is the theorem extractorProfileBound_le_domainEnvelope, which establishes the bound for any folding schedule s and terminal degree bound d satisfying 2 ^ (∑ j, (s j).val) * d.val ≤ 2 ^ n, using the auxiliary lemma extractorDomainEnvelope_eq to rewrite the envelope.
  • ArkLib/ProofSystem/Fri/Spec/MeasuredKnowledgeSoundness.lean: Adds a new theorem knowledgeSoundnessWithResources_extract_domainEnvelope to the FRI specification module. It states the same knowledge-soundness relation as the existing knowledgeSoundnessWithResources_extract, but instead of using the general extractor-cost profile, it uses a cost envelope computed from the initial domain size (2 ^ n). The proof is a monotonicity application (OracleVerifier.knowledgeSoundnessWithResources.mono) that combines the earlier theorem with a new profile-bound lemma Extractor.extractorProfileBound_le_domainEnvelope. A corresponding public import for ArkLib.ProofSystem.Fri.Spec.Extraction.DomainCost was added to pull in the necessary domain-cost definitions.
  • ArkLibTest/ProofSystem/Fri/Extraction.lean: The diff adds an import of Mathlib.Tactic.ComputeDegree, two #guard_msgs blocks printing the axiom dependencies of extractorProfileBound_le_domainEnvelope and knowledgeSoundnessWithResources_extract_domainEnvelope, and four example statements: one showing that extractorDomainEnvelope N (.inr .wordRead) = 2*N^2 + N by simp, and three establishing that the natDegree of extractorDomainPolynomial is ≤4 for all kind, exactly 4 for .inl .mul, and exactly 2 for .inr .wordRead.
  • docs/design/03a-extractor-efficiency.md: The diff expands the discussion of the extractorProfileBound cost vector. The new text explicitly states that this vector also accounts for metadata ticks and coefficient/cache reads. It introduces the theorem extractorProfileBound_le_domainEnvelope in ArkLib/ProofSystem/Fri/Spec/Extraction/DomainCost.lean, which, under the condition D ≤ N, bounds each coordinate of the profile vector by a polynomial in N. The document is also updated to clarify that view construction, handler work beyond each instruction's price, and local computation are not covered by the budget, and it directs readers to the accounting boundary and the FRI audit for the full scope.
  • docs/kb/audits/fri-soundness.md: The diff updates the run-time analysis subsection of docs/kb/audits/fri-soundness.md. It expands the table entry for Fri.Spec.knowledgeSoundnessWithResources_extract to also cite Fri.Spec.knowledgeSoundnessWithResources_extract_domainEnvelope and to clarify that the budget is either the schedule-specific profile or its polynomial bound at the initial domain size, with explicit sentences about excluded costs. It replaces a high-level description of envelope polynomials with a concrete reference to the extractorProfileBound_le_domainEnvelope theorem from DomainCost.lean and states that the size variable in the domain polynomial is the domain cardinality (not its logarithm) and that the bounds count declared instruction charges. The wording about cryptographic polynomial-time bounds and the description of compiled fixtures are preserved and slightly reorganized.
  • docs/wiki/repo-map.md: The documentation for docs/wiki/repo-map.md now includes a note that Spec/Extraction/DomainCost.lean bounds the charge of each instruction kind by a polynomial in the initial domain size, clarifying the cost model used in resource proofs.

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

@github-actions

Copy link
Copy Markdown
Contributor

Build Timing Report

  • PR head: 4e592aa
  • Message: feat(fri): bound extractor charges by the initial domain size
  • Ref: feat/fri-domain-envelope
  • Measured checkout: 080b1b6 (workflow head 4e592aa).
  • Build cache: restored the main build of 0044e03; Lake rebuilt only modules whose source or imports differ from it.
  • Runner: ubuntu24 20261122.23.1, X64, 4 cores.
  • Dependency cache: exact hit (Linux-lean-deps-7cdeca2242e3c1c9ff5bf24c261822ab1eae8bd7acde6058fa912cc571ac96a0); manifest 2ab5d2751a2a.
  • 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 27.33 83.86 ok
Native build 2.72 3.94 ok
Validation wrapper 55.33 59.99 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 4 modules (1 without an earlier time). The 3 with an earlier time took 6s here against 6s when main last built them (+0s (+1.8%)).

Estimated clean-build compile time, summed over all 1643 modules: 5335s before, 5346s after (+11s (+0.2%)).

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 4 slowest of 4 rebuilt modules.

Current (s) Earlier (s) Delta (s) Path
11 - - ArkLib/ProofSystem/Fri/Spec/Extraction/DomainCost.lean
2.2 1.9 +0.3 ArkLib/ProofSystem/Fri/Spec/MeasuredKnowledgeSoundness.lean
1.9 2.4 -0.5 ArkLibTest/ProofSystem/Fri/Extraction.lean
1.5 1.2 +0.3 ArkLib.lean

@alexanderlhicks
alexanderlhicks marked this pull request as draft November 27, 2026 02:05
@alexanderlhicks

Copy link
Copy Markdown
Collaborator Author

Marked as draft whilst I make some efficiency improvements on the CompPoly side.

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