feat(NumberTheory/LegendreSymbol/QuadraticChar/Basic): characterize when products are squares#41989
Conversation
…hen products are squares
Welcome new contributor!Thank you for contributing to Mathlib! If you haven't done so already, please review our contribution guidelines, as well as the style guide and naming conventions. In particular, we kindly remind contributors that we have guidelines regarding the use of AI when making pull requests. We use a review queue to manage reviews. If your PR does not appear there, it is probably because it is not successfully building (i.e., it doesn't have a green checkmark), has the If you haven't already done so, please come to https://leanprover.zulipchat.com/, introduce yourself, and mention your new PR. Thank you again for joining our community. |
PR summary cc714f1733Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
|
LLM-generated |
|
This is a nice idea! I wasn't familiar with the Just one suggestion to make it more potentially useful elsewhere: as well as the iff lemma |
|
@loefflerd thank you for the suggestion! Besides adding a lemma that asserts |
I think all three of the implications (other than the straightforward "a, b square => a*b square") require the base to be a field. For the implication (a square, b non-square) => (a * b non-square), with a, b non-zero, there is a counterexample in Z/6Z (take a= 3, b = 5, noting 3 = 3^2 mod 6). To get this implication to work in a general commutative ring you need to assume a, b are units, not just non-zero. |
Yes, I meant that the |
I see: you were thinking of non-finite fields, I was thinking of finite non-fields. A lemma asserting this (and its mirror-image twin) for general fields would indeed be useful. |
…th combinations of a and b being squares / nonsquares
|
@loefflerd great, thank you! I've added the other implications, except 'a' and 'b' square => 'a*b' square, which is IsSquare.mul I think. |
Motivation
This is a basic application of the quadratic character of a finite field that can be used in many instances, for example later to characterize squares in
ℤ_[p].Summary
FiniteField.isSquare_mul_iffcharacterizes when the product of two nonzero elements in a finite field is a square, using the quadratic character.Testing
lake build Mathlib.NumberTheory.LegendreSymbol.QuadraticChar.Basic -q --log-level=infolake exe lint-style Mathlib.NumberTheory.LegendreSymbol.QuadraticChar.Basicgit diff --check upstream/master...HEADAI assistance
I was working with AI assistance (Claude Code, Codex) to formalize some fun number theory I like (Hilbert symbols, towards reciprocity laws) to help me learn Lean. I used AI assistance to highlight some small pieces that might be appropriate for mathlib, and to help me properly format these small items for mathlib.