Skip to content

feat(Mersenne31): prove exact canonical circle domain enumeration - #418

Open
adrienlacombe wants to merge 2 commits into
Verified-zkEVM:mainfrom
adrienlacombe:codex/m31-circle-domain-enumeration
Open

adrienlacombe wants to merge 2 commits into
Verified-zkEVM:mainfrom
adrienlacombe:codex/m31-circle-domain-enumeration

Conversation

@adrienlacombe

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #415. For any canonical M31 coset and bounded full-coset position, CanonicCoset.existsUnique_circleDomain_pointAt gives the unique bounded domain position with the same circle point.

The proof identifies the first half with the even full-coset positions and the conjugate half with the odd positions in reverse. This proves disjointness and equality of the bounded index and point ranges.

For arbitrary domains, CircleDomain.Valid requires a valid half coset disjoint from its conjugate. The PR proves bounded index and point injectivity and the cardinality of both ranges under this hypothesis.

Regression coverage

Local validation

  • lake build --wfail
  • lake test
  • lake exe axiomsweep --check
  • ./scripts/lint-style.sh and ./scripts/check-imports.sh
  • Documentation integrity, writing check, and git diff --check

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

🤖 PR Summary

Mathematical Formalization

  • CircleDomain.Valid predicate and valid_iff theorem (CompPoly/Fields/Mersenne31/Circle.lean): Defines a valid circle domain as one whose half coset is HalfCoset.Valid and whose bounded indices are disjoint from their negatives. This captures the condition that the two halves are disjoint.

  • Injectivity and cardinality for valid domains: indexAt_injective, pointAt_injective, card_range_indexAt, and card_range_pointAt prove that for any valid D : CircleDomain …, the index and point mappings from Fin D.size are injective and have range cardinality equal to D.size.

  • CanonicCoset validity and enumeration: The core theorem circleDomain_valid proves that the canonical circle domain is valid at every supported log size (1 through 30). Supporting private lemmas (subgroupGen_double, step_eq, half_parameters, full_size, half_indexAt, neg_half_indexAt) establish the relationship between the half coset’s parameters and the full coset’s index mapping: the first half visits even positions ascending, the conjugate half visits odd positions descending.

  • Range equalities and unique preimage: range_circleDomain_indexAt and range_circleDomain_pointAt show that the canonical circle domain’s index and point ranges coincide with the full coset’s bounded ranges. existsUnique_circleDomain_pointAt gives, for every bounded full-coset position, a unique domain position with the same circle point.

Documentation

  • docs/wiki/field-extensions.md: Replaces a previous TODO with a detailed exposition of the newly proved theorems, including the disjointness argument, the even/odd mapping, and the uniqueness result.

Testing

  • tests/CompPolyTests/Fields/Mersenne31/Circle.lean: Adds verification examples:
    • The trivial coset (Coset.subgroup 0) yields an invalid CircleDomain because its half coset is nonempty and fails the disjointness condition.
    • For any valid CircleDomain, pointAt is injective (invoking pointAt_injective).
    • For CanonicCoset, the point range equals the full coset’s range (range_circleDomain_pointAt) and each coset point has a unique preimage (existsUnique_circleDomain_pointAt).
    • Concrete cardinality checks: the canonical circle domain’s point set has size 2 for log-size 1 and 2^30 for log-size 30 (via card_range_pointAt and circleDomain_size).

All theorems are proved – no sorry or admit are introduced in this PR.


Statistics

Metric Count
📝 Files Changed 4
✅ Lines Added 209
❌ Lines Removed 7

Lean Declarations

✏️ Added: 22 declaration(s)

CompPoly/Fields/Mersenne31/Circle.lean (16)

  • def Valid (D : CircleDomain) : Prop
  • private theorem full_size (c : CanonicCoset) : c.coset.size = 2 * c.halfCoset.size
  • private theorem half_indexAt (c : CanonicCoset) (i : Nat) :
  • private theorem half_parameters (c : CanonicCoset) :
  • private theorem neg_half_indexAt (c : CanonicCoset) (i : Fin c.halfCoset.size) :
  • private theorem step_eq (c : CanonicCoset) : c.coset.stepSize = 2 * c.coset.initialIndex
  • private theorem subgroupGen_double (n : Nat) (h : n + 1 ≤ logOrder) :
  • theorem card_range_indexAt (D : CircleDomain) (hD : D.Valid) :
  • theorem card_range_pointAt (D : CircleDomain) (hD : D.Valid) :
  • theorem circleDomain_valid (c : CanonicCoset) : c.circleDomain.Valid
  • theorem existsUnique_circleDomain_pointAt (c : CanonicCoset) (j : Fin c.coset.size) :
  • theorem indexAt_injective (D : CircleDomain) (hD : D.Valid) :
  • theorem pointAt_injective (D : CircleDomain) (hD : D.Valid) :
  • theorem range_circleDomain_indexAt (c : CanonicCoset) :
  • theorem range_circleDomain_pointAt (c : CanonicCoset) :
  • theorem valid_iff (D : CircleDomain) : D.Valid ↔ D.halfCoset.Valid ∧

tests/CompPolyTests/Fields/Mersenne31/Circle.lean (6)

  • example (D : CircleDomain) (h : D.Valid) :
  • example (c : CanonicCoset) (j : Fin c.coset.size) :
  • example (c : CanonicCoset) :
  • example : let c : CanonicCoset
  • example : let c : CanonicCoset
  • example : ¬ (CircleDomain.new (Coset.subgroup 0 (by decide))).Valid

sorry Tracking

  • No sorrys were added, removed, or affected.

📋 **Additional Analysis**

Style Guide Adherence: No violations found except one line exceeding 100 characters (see below).

Line Length Violation: In circleDomain_valid (Circle.lean), the line
have he := congrArg Fin.val (c.coset.indexAt_injective c.coset_valid (a₁ := ⟨2 * i.val, by omega⟩) (a₂ := ⟨c.coset.size - (2 * j.val + 1), by omega⟩) hij)
exceeds 100 characters. The style guide requires .lean source lines under 100 characters.

Documentation Cross-Reference: The updates to CompPoly/Fields/README.md and docs/wiki/field-extensions.md accurately reflect the new theorems (circleDomain_valid, indexAt_injective, pointAt_injective, card_range_pointAt, range_circleDomain_pointAt, existsUnique_circleDomain_pointAt). No drift found.

Test Coverage: The added example statements in tests/CompPolyTests/Fields/Mersenne31/Circle.lean test the new validity condition, injectivity, and coverage lemmas. The test provides positive and negative cases.

Project Framework Progress: Not applicable (no tier transitions, obligation mappings, or count deltas in this diff).


📄 **Per-File Summaries**
  • CompPoly/Fields/Mersenne31/Circle.lean: Added a Valid predicate and valid_iff theorem for CircleDomain, establishing that a valid domain has a valid half coset whose bounded indices are not negations of each other. Proved indexAt_injective, pointAt_injective, card_range_indexAt, and card_range_pointAt for valid domains, showing distinct indices/points and cardinality matching D.size. For CanonicCoset, added private lemmas subgroupGen_double, step_eq, half_parameters, full_size, half_indexAt, and neg_half_indexAt linking the half coset's parameters and index mapping to the full coset, then used them to prove circleDomain_valid (the canonical domain is valid), range_circleDomain_indexAt and range_circleDomain_pointAt (its index/point ranges equal the full coset's), and existsUnique_circleDomain_pointAt (each full coset point has a unique domain position). Also updated two module docstrings to reflect that validity is now defined and that it ensures distinctness and cardinality.
  • docs/wiki/field-extensions.md: Replaced a terse TODO paragraph about half-coset overlaps and domain cardinality with detailed documentation of several newly established theorems. Specifically, it now states that CircleDomain.Valid requires a valid half coset whose bounded indices are disjoint from their conjugates, and that CircleDomain.pointAt_injective and CircleDomain.card_range_pointAt prove, respectively, injectivity and the point count for a valid domain. It further documents CanonicCoset.circleDomain_valid, which proves validity at every supported log size from 1 through 30, and explains how the first half visits the even positions ascending while its conjugate visits the odd positions descending. Finally, it notes CanonicCoset.range_circleDomain_pointAt identifies the resulting point set with the full coset's bounded range, and CanonicCoset.existsUnique_circleDomain_pointAt gives a unique matching domain position for any full-coset position.
  • tests/CompPolyTests/Fields/Mersenne31/Circle.lean: This diff adds several new example theorems to Circle.lean. First, it proves that the CircleDomain constructed from the trivial coset (Coset.subgroup 0) is not Valid, by showing its half-coset is nonempty and that two distinct index-0 points would be declared equal, violating the disjointness condition of CircleDomain.valid_iff. Second, it introduces a lemma that for any valid CircleDomain D, the mapping from Fin D.size via D.pointAt is injective (delegating to the existing property D.pointAt_injective). Third, it adds two statements about CanonicCoset: that the range of points from its circle domain equals the range from its coset, and that each coset point has a unique preimage in the circle domain (both are direct invocations of existing API lemmas). Finally, two concrete cardinality calculations are included for the CanonicCoset with parameters ⟨1, …⟩ and ⟨30, …⟩, showing that the size of the circle-domain point set equals 2 and 2^30 respectively, by using CircleDomain.card_range_pointAt and CanonicCoset.circleDomain_size.
  • 1 file(s) filtered as noise (lockfiles, generated, or trivial): CompPoly/Fields/README.md

Last updated: 2026-11-18 09:19 UTC.

@adrienlacombe
adrienlacombe marked this pull request as ready for review November 18, 2026 09:21
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T09:22:59.305062Z 93bf98b Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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