Skip to content

[Merged by Bors] - feat(Algebra/QuadraticAlgebra): discriminant and field criterion - #42206

Closed
xroblot wants to merge 13 commits into
leanprover-community:masterfrom
xroblot:quadratic-algebra-discr
Closed

xroblot wants to merge 13 commits into
leanprover-community:masterfrom
xroblot:quadratic-algebra-discr

Conversation

@xroblot

@xroblot xroblot commented Jul 28, 2026 •

Copy link
Copy Markdown
Collaborator

Add the discriminant discr a b = b ^ 2 + 4 * a of QuadraticAlgebra R a b, describe how it
transforms under a change of generator, and derive, over a field with 2 ≠ 0, a criterion for
QuadraticAlgebra K a b to be a field (it is a field iff discr a b is not a square).

This also renames omega_re/omega_im to re_omega/im_omega with deprecated aliases.

Prepared with Claude Code 🤖


Open in Gitpod

@github-actions

github-actions Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

PR summary 78f45e1742

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Algebra.QuadraticAlgebra.Discr (new file) 1362

Declarations diff (regex)

+ algebraMap_discr
+ discr
+ discr_def
+ discr_map
+ exists_sq_eq_iff_isSquare_discr
+ im_omega
+ instance {K : Type*} [Field K] {a b : K} [NeZero (2 : K)] [Fact (¬ IsSquare (discr a b))] :
+ instance {a : K} [Fact (¬ IsSquare a)] : Fact (∀ r : K, r ^ 2 ≠ a + 0 * r)
+ isField_iff_not_isSquare_discr
+ not_isField_of_isSquare_discr
+ re_omega

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

✅ Lean-aware diff — post-build, computed from the Lean environment (commit 78f45e1).

  • +11 new declarations
  • −0 removed declarations
+QuadraticAlgebra.algebraMap_discr
+QuadraticAlgebra.discr
+QuadraticAlgebra.discr_def
+QuadraticAlgebra.discr_map
+QuadraticAlgebra.exists_sq_eq_iff_isSquare_discr
+QuadraticAlgebra.im_omega
+QuadraticAlgebra.instFactForallNeHPowOfNatHAddHMul
+QuadraticAlgebra.instFactForallNeHPowOfNatHAddHMul_1
+QuadraticAlgebra.isField_iff_not_isSquare_discr
+QuadraticAlgebra.not_isField_of_isSquare_discr
+QuadraticAlgebra.re_omega

No changes to strong technical debt.

Increase in weak tech debt: (relative, absolute) = (1.00, 0.00)
Current number Change Type (weak)
4920 1 exposed public sections

Current commit 78f45e1742
Reference commit 1ae49302b2

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions github-actions Bot added the t-algebra Algebra (groups, rings, fields, etc) label Jul 28, 2026
@mathlib-dependent-issues mathlib-dependent-issues Bot added the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Jul 29, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

xroblot added 3 commits August 1, 2026 08:43
…-map

# Conflicts:
#	Mathlib/Algebra/QuadraticAlgebra/Basic.lean
…ratic-algebra-discr

# Conflicts:
#	Mathlib/Algebra/QuadraticAlgebra/Basic.lean
@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Aug 2, 2026
section discr

/-- The discriminant of the quadratic algebra `QuadraticAlgebra R a b`, that is, the
discriminant `b ^ 2 + 4 * a` of the polynomial `X ^ 2 - b * X - a`. -/

@SnirBroshi SnirBroshi Aug 3, 2026 •

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.

Could you make this claim explicit by adding:

open Polynomial in
theorem polynomialDiscr_eq_discr [CommRing R] (a b : R) :
    (X ^ 2 - b * X - a).discr = discr a b := ...

(using Polynomial.discr_of_degree_eq_two)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the suggestion but stating this needs to import Mathlib.RingTheory.Polynomial.Resultant.Basic which pulls a lot imports for a foundational file which I tried to keep slim. Furthermore, I am not sure how useful the lemma would be in practice, so I would rather leave it out.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@xroblot I do think it's good to have the connection though. If you don't want to add the import to this file, could you have a separate new file that provides this bit of API/glue?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I could add it to #42297 that relates different invariants to their classical algebra version and thus as heavier imports.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I added the lemma to #42297

@mathlib-dependent-issues mathlib-dependent-issues Bot removed the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Aug 12, 2026
@mathlib-dependent-issues

Copy link
Copy Markdown

@xroblot xroblot changed the title feat(Algebra/QuadraticAlgebra): discriminant and classification feat(Algebra/QuadraticAlgebra): discriminant and field criterion Aug 13, 2026
@xroblot xroblot removed the WIP Work in progress label Aug 13, 2026
@jcommelin jcommelin added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Aug 13, 2026
@xroblot xroblot removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Aug 13, 2026

@jcommelin jcommelin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks 🎉

bors merge

@mathlib-bors mathlib-bors Bot added the ready-to-merge This PR has been sent to bors. label Aug 13, 2026
mathlib-bors Bot pushed a commit that referenced this pull request Aug 13, 2026
)

Add the discriminant `discr a b = b ^ 2 + 4 * a` of `QuadraticAlgebra R a b`, describe how it
transforms under a change of generator, and derive, over a field with `2 ≠ 0`, a criterion for
`QuadraticAlgebra K a b` to be a field (it is a field iff `discr a b` is not a square).

This also renames `omega_re`/`omega_im` to `re_omega`/`im_omega` with deprecated aliases.

Prepared with Claude Code 🤖
@mathlib-bors mathlib-bors Bot added the bors-staging This PR is currently being built by bors on the staging branch. label Aug 13, 2026
@mathlib-bors

mathlib-bors Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

@mathlib-bors mathlib-bors Bot changed the title feat(Algebra/QuadraticAlgebra): discriminant and field criterion [Merged by Bors] - feat(Algebra/QuadraticAlgebra): discriminant and field criterion Aug 13, 2026
@mathlib-bors mathlib-bors Bot closed this Aug 13, 2026
attilavjda pushed a commit to attilavjda/mathlib4 that referenced this pull request Sep 5, 2026
…nprover-community#42206)

Add the discriminant `discr a b = b ^ 2 + 4 * a` of `QuadraticAlgebra R a b`, describe how it
transforms under a change of generator, and derive, over a field with `2 ≠ 0`, a criterion for
`QuadraticAlgebra K a b` to be a field (it is a field iff `discr a b` is not a square).

This also renames `omega_re`/`omega_im` to `re_omega`/`im_omega` with deprecated aliases.

Prepared with Claude Code 🤖
mathlib-bors Bot pushed a commit that referenced this pull request Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bors-staging This PR is currently being built by bors on the staging branch. ready-to-merge This PR has been sent to bors. t-algebra Algebra (groups, rings, fields, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants