Skip to content

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

Draft
eliasjudin wants to merge 2 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 2 commits intoVerified-zkEVM:mainfrom
eliasjudin:elias/issue-227-ahiv22-natcard-helper

Conversation

@eliasjudin
Copy link
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

github-actions bot commented Mar 4, 2026

🤖 Gemini PR Summary

Completes the Lean 4 formalization of proximity-gap results from the AHIV22 paper in ArkLib/Data/CodingTheory/ProximityGap/AHIV22.lean. This update resolves all remaining proof gaps for Lemmas 4.3, 4.4, and 4.5, transitioning the module to a fully verified state.

Mathematical Formalization

  • Lemma 4.3 (Row-Span Distance Lower Bound): Formalizes the lower bound on the distance of specific matrix row-spans to establish codeword separation.
  • Lemma 4.4 (Combinatorial Proximity Gap for Affine Lines): Provides proofs for proximity gaps within affine lines, a core component of Reed-Solomon proximity tests (IOPs).
  • Lemma 4.5 (Proximity Probability Bound): Establishes probability bounds for proximity tests, ensuring distance properties translate to reliable rejection sampling.

Technical Implementation

  • Helper Lemmas: Adds localized theorems for vector support quantification, Hamming distance metrics, and pigeonhole-style counting arguments.
  • Proof Integrity: Removes all sorry, axiom, and private axiom markers from the implementation.
  • Validation: Verified via lake build ArkLib to ensure full compatibility with downstream dependencies.

Traceability

Closes #226, #227, and #234.


Analysis of Changes

Metric Count
📝 Files Changed 1
Lines Added 1851
Lines Removed 39

Lean Declarations

✏️ **Added:** 3 declaration(s)
  • lemma dirClose_of_manyClosePts in ArkLib/Data/CodingTheory/ProximityGap/AHIV22.lean
  • lemma e_leq_dist_over_3_strong in ArkLib/Data/CodingTheory/ProximityGap/AHIV22.lean
  • lemma numberOfClosePts_eq_natCard (u v : ι → F) (deg : ℕ) (α : ι ↪ F) (e : ℕ) : in ArkLib/Data/CodingTheory/ProximityGap/AHIV22.lean
✏️ **Affected:** 3 declaration(s) (line number changed)
  • lemma probOfBadPts in ArkLib/Data/CodingTheory/ProximityGap/AHIV22.lean moved from L81 to L1510
  • lemma e_leq_dist_over_3 in ArkLib/Data/CodingTheory/ProximityGap/AHIV22.lean moved from L72 to L1436
  • def numberOfClosePts (u v : ι → F) (deg : ℕ) (α : ι ↪ F) (e : ℕ) : ℕ in ArkLib/Data/CodingTheory/ProximityGap/AHIV22.lean moved from L60 to L417

sorry Tracking

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

🎨 **Style Guide Adherence**

The following lines violate the provided style guide:

  • Variable naming conventions: The variables u, v, and w are used for terms/elements (vectors), but the guide specifies they should be used for universes. Elements of a generic type should use x, y, z.

    • Lines 25, 30, 34, 37, 43, 55, 182, 183, 185, 203, 204, 408, 414, 428, 470, 481, 482, 485, 526, 527, 528, 529, 532, 536, 539, 544, 545, 693, 712, 723, 724, 726, 767, 778, 779, 782, 786, 789, 793, 807, 810, 815, 816, 819, 823, 826, 830, 835, 839, 843, 850, 861, 862, 878, 879, 882, 886, 889, 892, 985: "u, v, w, ... : Universes" and "x, y, z, ... : Elements of a generic type".
  • Variable naming conventions (Naturals): The variable e is used for natural numbers, but the guide specifies m, n, or k.

    • Lines 55, 409, 430, 694, 1046: "m, n, k, ... : Natural numbers".
  • Variable naming conventions (Generic elements): The variable j is used for elements of the generic type ι, but the guide specifies x, y, z.

    • Lines 26, 29, 33, 38, 44, 46, 48, 51, 60, 71, 74, 76, 115, 124, 131, 140, 143, 237, 241, 244, 250, 508, 513, 533, 534, 554, 555, 600, 604, 614, 615, 623, 628, 633, 728, 732, 751, 752, 772, 776, 797, 798, 816, 817, 826, 827, 866, 875, 884, 892, 918, 922, 931, 943, 947, 951, 956, 968, 1003, 1007, 1011, 1015: "x, y, z, ... : Elements of a generic type".
  • Theorem Naming (snake_case): Several theorems use lowerCamelCase or mixed casing.

    • Line 156 (distInterleavedCodeToCodeLB), Line 692 (dirClose_of_manyClosePts), Line 1044 (probOfBadPts): "Theorems and Proofs: snake_case (e.g., add_comm, list_reverse_id)".
  • Standard Forms (le/lt): Theorems use leq instead of the standardized le.

    • Line 427 (e_leq_dist_over_3_strong), Line 984 (e_leq_dist_over_3): "In adherence with mathlib, we standardize on ≤ (le) and < (lt)."
  • Acronyms: Acronyms like RS (Reed-Solomon) and LB (Lower Bound) are not treated as words.

    • Line 39 (ProximityToRS), Line 156 (distInterleavedCodeToCodeLB): "Acronyms: Treat as words (e.g., HtmlParser not HTMLParser)".
  • Docstrings: Several definitions and theorems are missing documentation.

    • Lines 25, 28, 32, 37, 42, 54, 414, 692: "Every definition and major theorem should have a docstring."
  • Empty Lines: There are empty lines inside proof blocks.

    • Lines 61, 62, 68, 71, 78, 82, 86, 90, 93, 100, 105, 110, 115, 120, 142, 148, 161, 178, 182, 187, 219, 226, 230, 240, 243, 247, 252, 258, 260, 435, 439, 458, 461, 465, 484, 488, 492, 499, 502, 506, 511, 517, 521, 542, 552, 558, 597, 638, 642, 672, 684, 699, 715, 719, 738, 742, 746, 753, 756, 760, 765, 771, 775, 796, 806, 812, 853, 894, 915, 936, 940, 959, 963, 994, 1000, 1032, 1051, 1054, 1070, 1085, 1092, 1098, 1104, 1115, 1119, 1133, 1146, 1152, 1199, 1204, 1210: "Empty Lines: Avoid empty lines inside definitions or proofs."
  • Function Syntax: The code uses fun x => ... instead of the preferred fun x ↦.

    • Lines 26, 38, 43, 59, 60, 75, 76, 77, 186, 187, 198, 203, 244, 444, 467, 471, 555, 599, 603, 613, 614, 622, 627, 632, 706, 727, 731, 750, 751, 814, 825, 829, 865, 874, 883, 891, 917, 921, 925, 930, 942, 946, 950, 955, 967, 996, 1001, 1010, 1014, 1121, 1122, 1124, 1126, 1135, 1150, 1154, 1201: "Functions: Prefer fun x ↦ ... over λ x, ...".
  • Operator Spacing: Missing space before the colon in type ascription.

    • Line 1162: (x := (w.1 : ι → F))). "Put spaces on both sides of :, :=, and infix operators."

📄 **Per-File Summaries**
  • ArkLib/Data/CodingTheory/ProximityGap/AHIV22.lean: This update formalizes key proximity gap results from the AHIV22 paper by providing complete proofs for the row-span distance lower bound (Lemma 4.3), the combinatorial proximity gap for affine lines (Lemma 4.4), and the proximity probability bound (Lemma 4.5), while introducing several supporting definitions and auxiliary theorems regarding vector support and Hamming distance.

Last updated: 2026-03-04 10:12 UTC.

Copy link

@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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant