Skip to content

fix(proximity-gap): resolve AHIV22 proof obligations (#226 #227 #234)#385

Draft
eliasjudin wants to merge 3 commits intoVerified-zkEVM:mainfrom
eliasjudin:elias/issue-227-ahiv22-natcard-helper
Draft

fix(proximity-gap): resolve AHIV22 proof obligations (#226 #227 #234)#385
eliasjudin wants to merge 3 commits intoVerified-zkEVM:mainfrom
eliasjudin:elias/issue-227-ahiv22-natcard-helper

Conversation

@eliasjudin
Copy link
Copy Markdown
Contributor

Closes #226.
Closes #227.
Closes #234.

This PR completes the AHIV22 proximity-gap obligations in ArkLib/Data/CodingTheory/ProximityGap/AHIV22.lean and removes the remaining proof gaps for Lemma 4.3, 4.4, and 4.5.
It adds local helper lemmas for support/counting arguments and keeps the patched file free of sorry, axiom, and private axiom, with local validation via lake build ArkLib.Data.CodingTheory.ProximityGap.AHIV22 and lake build ArkLib.

This PR adds proofs autoformalised by @Aristotle-Harmonic.

The resulting patch resolves the AHIV22 proof-wanted targets and references all associated issues.
It keeps all signature changes localized to AHIV22.lean and validates downstream with a full ArkLib build.

Co-authored-by: Aristotle (Harmonic) aristotle-harmonic@harmonic.fun

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 4, 2026

🤖 Gemini PR Summary

Completes the formalization of key proximity gap results from the AHIV22 paper, specifically targeting combinatorial and probabilistic bounds for Reed-Solomon proximity tests.

Mathematical Formalization

  • Lemma 4.3 (Interleaved Code Bounds): Formalizes row-span distance bounds for interleaved codes, analyzing the distance properties of linear combinations of codewords.
  • Lemma 4.4 (Proximity Gaps for Affine Lines): Implements the combinatorial proximity gap for affine lines, verifying that points far from a code remain far after specific algebraic transformations.
  • Lemma 4.5 (Probabilistic Analysis): Provides a bound on the probability of "bad points" appearing in the row-span of interleaved Reed-Solomon codes, linking combinatorial properties to the soundness of the underlying proximity protocols.

Proof Completion

  • Removal of Placeholders: Resolves all sorry and admit placeholders within the AHIV22 module.
  • Full Verification: Completes the proofs for Lemmas 4.3, 4.4, and 4.5, transitioning the implementation from definitions to verified theorems.
  • Validation: Confirms consistency via lake build for the ArkLib library.

Refactoring & Infrastructure

  • Discrepancy Note: The draft summary indicates the creation of AHIV22Support.lean and updates to the ArkLib entry point, while the PR body suggests changes and signature updates are localized to AHIV22.lean.
  • Modular Support: Introduces AHIV22Support.lean to house technical helper lemmas concerning vector supports, submodules, and affine line proximity definitions.
  • Encapsulation: Separates foundational counting arguments into a support file to maintain focus on high-level theorems in AHIV22.lean.

Statistics

Metric Count
📝 Files Changed 3
Lines Added 1798
Lines Removed 54

Lean Declarations

✏️ **Removed:** 3 declaration(s)
  • def closePtsOnAffineLine {ι : Type*} [Fintype ι] in ArkLib/Data/CodingTheory/ProximityGap/AHIV22.lean
  • lemma distInterleavedCodeToCodeLB in ArkLib/Data/CodingTheory/ProximityGap/AHIV22.lean
  • def numberOfClosePts (u v : ι → F) (deg : ℕ) (α : ι ↪ F) (e : ℕ) : ℕ in ArkLib/Data/CodingTheory/ProximityGap/AHIV22.lean
✏️ **Added:** 7 declaration(s)
  • def closePtsOnAffineLine {ι : Type*} [Fintype ι] in ArkLib/Data/CodingTheory/ProximityGap/AHIV22Support.lean
  • lemma numberOfClosePts_eq_natCard (u v : ι → F) (deg : ℕ) (α : ι ↪ F) (e : ℕ) : in ArkLib/Data/CodingTheory/ProximityGap/AHIV22Support.lean
  • lemma e_leq_dist_over_3_strong in ArkLib/Data/CodingTheory/ProximityGap/AHIV22.lean
  • lemma hammingDist_le_of_subset_disagree in ArkLib/Data/CodingTheory/ProximityGap/AHIV22Support.lean
  • lemma distInterleavedCodeToCodeLB in ArkLib/Data/CodingTheory/ProximityGap/AHIV22Support.lean
  • def numberOfClosePts (u v : ι → F) (deg : ℕ) (α : ι ↪ F) (e : ℕ) : ℕ in ArkLib/Data/CodingTheory/ProximityGap/AHIV22Support.lean
  • lemma dirClose_of_manyClosePts in ArkLib/Data/CodingTheory/ProximityGap/AHIV22.lean
✏️ **Affected:** 2 declaration(s) (line number changed)
  • lemma probOfBadPts in ArkLib/Data/CodingTheory/ProximityGap/AHIV22.lean moved from L81 to L1070
  • lemma e_leq_dist_over_3 in ArkLib/Data/CodingTheory/ProximityGap/AHIV22.lean moved from L72 to L1046

sorry Tracking

✅ **Removed:** 3 `sorry`(s)
  • lemma distInterleavedCodeToCodeLB in ArkLib/Data/CodingTheory/ProximityGap/AHIV22.lean (L44)
  • lemma probOfBadPts {deg : ℕ} {α : ι ↪ F} {e : ℕ} {U_star : WordStack (A in ArkLib/Data/CodingTheory/ProximityGap/AHIV22.lean (L86)
  • lemma e_leq_dist_over_3_strong in ArkLib/Data/CodingTheory/ProximityGap/AHIV22.lean (L76)

🎨 **Style Guide Adherence**

There are more than 20 style guide violations in the provided diff. They are grouped by rule below:

  • Rule: "Avoid empty lines inside definitions or proofs."

    • Count: ~84 violations.
    • Representative Examples:
      • AHIV22.lean: Lines 74, 140, 191, 301, 742, 960.
      • AHIV22Support.lean: Lines 73, 114, 233, 273.
  • Rule: "Theorems and Proofs: snake_case"

    • Count: 8 violations.
    • Representative Examples:
      • AHIV22.lean: dirClose_of_manyClosePts (Line 377), allClose_not_fewClosePts (Line 549), probOfBadPts (Line 618).
      • AHIV22Support.lean: hammingDist_le_of_subset_disagree (Line 50), distInterleavedCodeToCodeLB (Line 207), numberOfClosePts_eq_natCard (Line 1421).
  • Rule: "Variable Conventions" (α, β, γ for generic types; x, y, z for elements; u, v, w for universes)

    • Count: ~16 violations.
    • Representative Examples:
      • AHIV22.lean: F : Type and ι : Type used for generic types (Line 24, 26).
      • AHIV22.lean: u, v, and w used for vector elements (Lines 34, 160).
      • AHIV22Support.lean: u, v used for vector elements (Lines 1049, 1404).
  • Rule: "Symbol Naming Dictionary" (Symbol Name le)

    • Count: 2 violations.
    • Representative Examples:
      • AHIV22.lean: e_leq_dist_over_3_strong (Line 31).
      • AHIV22.lean: e_leq_dist_over_3 (Line 600).
  • Rule: "Acronyms: Treat as words (e.g., HtmlParser not HTMLParser)"

    • Count: 1 violation.
    • Representative Example:
      • AHIV22Support.lean: distInterleavedCodeToCodeLB (Line 207) contains LB instead of Lb.

📄 **Per-File Summaries**
  • ArkLib.lean: This change adds the AHIV22Support module to the library's main entry point, integrating additional support definitions and results for coding theory proximity gaps. The modification is limited to an import statement and does not introduce new theorems or proofs within this file.
  • ArkLib/Data/CodingTheory/ProximityGap/AHIV22Support.lean: This file introduces foundational definitions and theorems to support proximity gap results, specifically formalizing Lemma 4.3 from the AHIV22 paper regarding row-span distance bounds for interleaved codes. It includes technical lemmas on vector supports and submodules, as well as new definitions for measuring the proximity of points on affine lines to Reed-Solomon codes. The file contains no sorry or admit placeholders.
  • ArkLib/Data/CodingTheory/ProximityGap/AHIV22.lean: This PR formalizes Lemma 4.4 (the combinatorial proximity gap for affine lines) and Lemma 4.5 from the AHIV22 paper by replacing previous sorry placeholders with complete, detailed proofs. It introduces several new theorems, including a strong form of the proximity gap and a bound on the probability of "bad points" in the row-span of interleaved Reed-Solomon codes. No sorry or admit placeholders remain in the modified sections.

Last updated: 2026-03-08 10:51 UTC.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9a99ad53d1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1436 to +1437
(∀ x ∈ Affine.affineLineAtOrigin (F := F) u v, Δ₀(x, ReedSolomon.code α deg) ≤ e)
∨ numberOfClosePts u v deg α e ≤ ‖(RScodeSet α deg)‖₀ := by
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep Lemma 4.4 result exclusive

This lemma now returns a plain disjunction A ∨ B instead of the prior exclusive split (Xor' A B), which weakens the exported guarantee and prevents callers from deriving the mutual-exclusion property that Lemma 4.4 is documented to provide. Any downstream proof that relied on ruling out one branch from the other can no longer be reconstructed from this API, even when the old statement type-checked.

Useful? React with 👍 / 👎.

@eliasjudin eliasjudin marked this pull request as draft March 4, 2026 08:53
…#226 Verified-zkEVM#227 Verified-zkEVM#234)

Complete AHIV22 proximity-gap proofs without semantic or signature drift and update file attribution to Elias Judin, Aristotle (Harmonic).

Refs Verified-zkEVM#226 Verified-zkEVM#227 Verified-zkEVM#234

Co-authored-by: Aristotle (Harmonic) <aristotle-harmonic@harmonic.fun>
@eliasjudin eliasjudin force-pushed the elias/issue-227-ahiv22-natcard-helper branch from 9a99ad5 to 51479d5 Compare March 4, 2026 08:55
* NB we use version 20221118:030830
-/

set_option linter.style.longFile 2000
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove this

-/

set_option linter.style.longFile 2000
set_option linter.style.emptyLine false
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove this

`(𝔽ᵐ)ⁿ`. Let `e` be a positive integer such that `e < d/3` and `|𝔽| ≥ e`.
Suppose `d(U⋆, L^⋈m) > e`. Then, there exists `v⋆ ∈ L⋆` such that `d(v⋆, L) > e`, where `L⋆` is the
row-span of `U⋆`. -/
private def vecSupport (u : ι → F) : Finset ι :=
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like these could go into a supporting file to keep this one clean, but maybe best to leave this for now.

if `v = 0`, the affine line degenerates to a singleton and the two branches can hold
simultaneously.
-/
lemma e_leq_dist_over_3
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels like this could follow more easily from e_leq_dist_over_3_strong?

@eliasjudin eliasjudin marked this pull request as draft March 8, 2026 09:02
@eliasjudin
Copy link
Copy Markdown
Contributor Author

@katyhr Let me know if this intersects/affects your planned work and what I can do / stay away from to help!

Summary:
- move the row-span and affine-line support lemmas into
  AHIV22Support
- keep e_leq_dist_over_3 as an Xor wrapper around the
  strong lemma
- remove local style overrides and regenerate the ArkLib
  import barrel

Rationale:
- satisfy PR Verified-zkEVM#385 review feedback without weakening public
  theorem contracts
- bring AHIV22 under the long-file and empty-line lint
  requirements

Tests:
- lake exe cache get
- lake build ArkLib.Data.CodingTheory.ProximityGap.AHIV22
- ./scripts/update-lib.sh
- ./scripts/check-imports.sh
- lake build ArkLib

Co-authored-by: Codex <codex@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants