Counting interface for the indifferentiability arc - #27
Open
daira wants to merge 7 commits into
Open
Conversation
daira
marked this pull request as ready for review
August 13, 2026 19:05
daira
added a commit
to daira/ironwood
that referenced
this pull request
Aug 15, 2026
Bump the CompElliptic pin from fd997734 to 23ac3369, the head of the indiff-counting branch (daira/CompElliptic#27, the milestone-1 counting interface for the hash-to-curve indifferentiability arc), pinned temporarily until that PR merges. The new revision also carries the Pallas-side twins neg_five_not_isCube / no_onCurve_y_zero and the content of Zcash/Circuits/Specs/CompEllipticExtras.lean (daira/CompElliptic#12), so ironwood's copies are dropped: - Delete CompEllipticExtras.lean. Its importers now import the CompElliptic modules they use directly, as do MulFixed/Theorems.lean and MulFixed/ShortTheorems.lean, which had been reaching CompElliptic through transitive imports. - Delete the Pallas-side twins from Specs/Pallas.lean; CompElliptic proves them verbatim, by the same kernel-tier proofs, so the census is unchanged. - Rename uses of y_eq_or_y_eq_neg_of_onCurve to its upstream name y_eq_pm_of_onCurve_x_eq, and prove Point.y_eq_or_neg_of_same_x through it instead of repeating the square-difference argument. - Drop the module from the book's source map. Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
daira
added a commit
to daira/ironwood
that referenced
this pull request
Aug 15, 2026
Bump the CompElliptic pin from fd997734 to 23ac3369, the head of the indiff-counting branch (daira/CompElliptic#27, the milestone-1 counting interface for the hash-to-curve indifferentiability arc), pinned temporarily until that PR merges. The new revision also carries the Pallas-side twins neg_five_not_isCube / no_onCurve_y_zero and the content of Zcash/Circuits/Specs/CompEllipticExtras.lean (daira/CompElliptic#12), so ironwood's copies are dropped: - Delete CompEllipticExtras.lean. Its importers now import the CompElliptic modules they use directly, as do MulFixed/Theorems.lean and MulFixed/ShortTheorems.lean, which had been reaching CompElliptic through transitive imports. - Delete the Pallas-side twins from Specs/Pallas.lean; CompElliptic proves them verbatim, by the same kernel-tier proofs, so the census is unchanged. - Rename uses of y_eq_or_y_eq_neg_of_onCurve to its upstream name y_eq_pm_of_onCurve_x_eq, and prove Point.y_eq_or_neg_of_same_x through it instead of repeating the square-difference argument. - Drop the module from the book's source map. Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…oCurve `mapHashOutputsToCurve` and its `_eq` lemma took the field-to-curve map as `m`. Ironwood's group-hash development calls that map `f` (`f : F → G`), so rename the parameter to `f` for cross-repo consistency. Callers are unaffected — the map is passed positionally. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… 10 elements The counting fact the indifferentiability arc's rejection sampler consumes (zcash/ironwood#198, CompElliptic#25). On a field where -1 is a square (both Pasta base fields), a nonzero input is never exceptional, so a nonzero preimage of an abscissa x is a root of the explicit product polynomial combining the two branch equations cleared of their common denominator: nonzero of degree at most 10, since its second factor has degree exactly 6 with leading coefficient -B·Z³. The input u = 0 is excluded rather than counted: the probability analysis prices pairs containing 0 in its existing zero-repair correction. The optimal constant is 4, recorded in the module doc as a planned follow-up. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
-1 is a square in both Pasta base fields (q ≡ 1 mod 4, Euler's criterion), so the generic SSWU fibre bound applies, and the isogeny is injective on rational points (iso_map_bijective), so it carries through the composition: at most 10 nonzero preimages per point under the deployed mapToCurve. The generic composition step is card_fibre_comp_le in FibreBound. The census records both endpoints; they consume the Tonelli-Shanks validity witnesses and, through the isogeny's bijectivity, the order witnesses. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The counting interface the indifferentiability game side consumes (zcash/ironwood#198, CompElliptic#25), in three statements. sum_abs_prob_dev_le is the L¹ probability deviation unsquared, stated against any budget whose square dominates the squared bound, so the consumer never needs a square root and a concrete budget is checked by squaring in exact arithmetic. card_dev_ge_le is the Chebyshev-style counting form of the L² bound: regularity does not lower-bound individual fibres, so the rejection sampler's acceptance constant holds only outside a bad set of fibres, whose size this bounds. sum_abs_pairCount_sub_le prices replacing the zero-repaired mapping by the deployed one: mappings agreeing away from one input have two-term pair counts within 4·#F - 2 in L¹, by splitting every pair count at the pairs containing that input. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…Extras zcash/ironwood carried Zcash/Circuits/Specs/CompEllipticExtras.lean, written in CompElliptic's own namespaces as explicit upstreaming candidates. Adopt the curve lemmas into CurveForms/ShortWeierstrass.lean: - SWPoint.add_x / SWPoint.add_y: rfl projection lemmas for the coordinates of a sum. - y_eq_pm_of_onCurve_x_eq (was y_eq_or_y_eq_neg_of_onCurve; the rename names the shared-abscissa premiss): two points on the curve sharing an x-coordinate have y-coordinates equal up to sign. - SWPoint.onCurve_of_ne_zero: a nonzero representable point is on the curve. - SWPoint.eq_pm_of_x_eq (was SWPoint.eq_or_eq_neg_of_x_eq): nonzero representable points sharing an x-coordinate are equal up to sign. This subsumes the private eq_or_eq_neg_of_x_eq in Isogenies/Homomorphism.lean, which is removed. The ≠ 0 premisses are necessary at SWCurve generality: SWCurve requires only B ≠ 0, so a curve whose B is a square has a genuine point (0, √B) sharing x = 0 with the 𝒪 sentinel without being equal to it up to sign. Closes #12. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Consumers refer to the Pallas base and scalar fields by their pasta_curves letters, Fp and Fq. Host the abbreviations beside the role-named fields they alias. This reverses the "not to move" assessment of #12: the letters are pasta_curves' own convention, not Zcash-specific usage. Fields/Pasta.lean is generated, so the abbreviations are emitted by scripts/gen_pasta.py and the file regenerated from it (CI checks the reproduction). Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…apping sum_abs_prob_dev_transport_le combines sum_abs_prob_dev_le with sum_abs_pairCount_sub_le: a mapping agreeing away from a single input with a Weil-bounded one has regularity distance at most ε + (4·#F − 2)/(#F)². This is the form the ironwood-side single-query bias consumes at the deployed mapToCurve, whose zero-repaired variant carries the Weil-bound hypothesis. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
daira
added a commit
to daira/ironwood
that referenced
this pull request
Aug 16, 2026
Bump the CompElliptic pin from fd997734 to a18340e, the head of the indiff-counting branch (daira/CompElliptic#27, the milestone-1 counting interface for the hash-to-curve indifferentiability arc), pinned temporarily until that PR merges. The new revision also carries the Pallas-side twins neg_five_not_isCube / no_onCurve_y_zero and the content of Zcash/Circuits/Specs/CompEllipticExtras.lean (daira/CompElliptic#12), so ironwood's copies are dropped: - Delete CompEllipticExtras.lean. Its importers now import the CompElliptic modules they use directly, as do MulFixed/Theorems.lean and MulFixed/ShortTheorems.lean, which had been reaching CompElliptic through transitive imports. - Delete the Pallas-side twins from Specs/Pallas.lean; CompElliptic proves them verbatim, by the same kernel-tier proofs, so the census is unchanged. - Rename uses of y_eq_or_y_eq_neg_of_onCurve to its upstream name y_eq_pm_of_onCurve_x_eq, and prove Point.y_eq_or_neg_of_same_x through it instead of repeating the square-difference argument. - Drop the module from the book's source map. Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The counting side of the indifferentiability arc (#25; the game side is zcash/ironwood#198): everything the ironwood-side sampler and single-query lemma consume, with no probability in this repo.
Hashing/FibreBound.lean— the fibre boundAway from the input
u = 0, every point of the target curve has at most 10 preimages underSSWUParams.map, over any field where-1is a square (both Pasta base fields,q ≡ 1 (mod 4)). Nonzero inputs are never exceptional there —ta = 0would exhibit the nonsquareZas-1times a square — so a preimage of an abscissa is a root of the explicit product polynomialΦ_xcombining the two branch equations cleared of their common denominator: nonzero of degree at most 10, because its second factor has degree exactly 6 with leading coefficient-B·Z³. The inputu = 0is excluded rather than counted: the probability analysis prices pairs containing0in its zero-repair correction, and the sampler rides the same term. The optimal constant is 4 (oddness pairs±uacrossPand-P, and each branch equation is a quadratic int), recorded in the module doc as a follow-up; the sampler only needs some explicit constant.The deployed maps, per curve
isSquare_neg_oneby Euler's criterion, the generic composition stepcard_fibre_comp_le(composing with an injective map does not grow fibres), andPallas/Vesta.card_mapToCurve_fibre_lethroughiso_map_bijective. The census records both endpoints, whose native leaves are the Tonelli–Shanks validity witnesses and, through the isogeny's bijectivity, the order witnesses.Hashing/TwoTermUniformity.lean— deviation exports and the transportsum_abs_prob_dev_lestates the L¹ probability deviation unsquared, against any budget whose square dominates the squared bound, so theℝ≥0∞-side consumer never needs a square root and a concrete budget is checked by squaring, in exact arithmetic.card_dev_ge_leis the Chebyshev-style counting form of the L² bound: regularity does not lower-bound individual fibres, so the rejection sampler's acceptance constant holds only outside a bad set of fibres, whose size this bounds.sum_abs_pairCount_sub_leprices the zero-repair transport: mappings agreeing away from a single input have two-term pair counts within4·#F - 2of each other in L¹.sum_abs_prob_dev_transport_lecombines the two: a mapping agreeing away from a single input with a Weil-bounded one has regularity distance at mostε + (4·#F − 2)/(#F)²— the composed form the ironwood side consumes at the deployedmapToCurve.The absorbed ironwood extras
Two commits adopt the content of zcash/ironwood's
Zcash/Circuits/Specs/CompEllipticExtras.lean, closing #12.CurveForms/ShortWeierstrass.leangains therflprojection lemmasSWPoint.add_x/SWPoint.add_y,y_eq_pm_of_onCurve_x_eq(two points on the curve sharing anx-coordinate havey-coordinates equal up to sign),SWPoint.onCurve_of_ne_zero, andSWPoint.eq_pm_of_x_eq(nonzero representable points sharing anx-coordinate are equal up to sign) — ironwood'sy_eq_or_y_eq_neg_of_onCurveandeq_or_eq_neg_of_x_eq, renamed to name the shared-abscissa premiss. The last subsumes the private copy thatIsogenies/Homomorphism.leancarried. Its≠ 0premisses are necessary atSWCurvegenerality: onlyB ≠ 0is bundled, so a curve whoseBis a square has a genuine point(0, √B)sharingx = 0with the𝒪sentinel.Fields/Pasta.leangains theFp/Fqabbreviations under theirpasta_curvesletters, reversing the "not to move" note in #12. The Pallas-side twinsneg_five_not_isCube/no_onCurve_y_zerothat #12 also requested were already added by #19. ironwood drops its copies of all of this when it bumps its pin.Per the parallel-iteration plan, this merges once the ironwood side compiles against it. It now does (zcash/ironwood branch
fv/indiff-sampler), consuming the L¹ exports through the transport;card_dev_ge_leand the fibre bound get their consumers in the costed milestone.🤖 Claude Opus 4.8