Skip to content

feat(LinearAlgebra/QuadraticForm): base change for quadratic forms without Invertible 2 - #46693

Open
skipgaribaldi wants to merge 11 commits into
leanprover-community:masterfrom
skipgaribaldi:skip/quadratic-base-change
Open

skipgaribaldi wants to merge 11 commits into
leanprover-community:masterfrom
skipgaribaldi:skip/quadratic-base-change

Conversation

@skipgaribaldi

Copy link
Copy Markdown

Currently, base change for quadratic forms QuadraticForm.baseChange requires Invertible (2 : R), but that is not required by the math. This PR fixes that.

It defines QuadraticMap.bilinTmul, the tensor product of a symmetric bilinear map b with a quadratic map Q. The construction is heterobasic, where b is on an A-module for an R-algebra A and Q is defined on an R-module. The tensor product is defined on an A-module by an explicit formula. The full generality of this construction is needed for further developments in quadratic form theory, such as the definitions of Pfister forms and of the module structure on the Witt group.

The special case where the bilinear map b is the multiplication on an R-algebra A defines the base change of Q to A. This gives the new QuadraticMap.baseChange, and QuadraticForm.baseChange is redefined using it.

When 2 is invertible, the new definition agrees with the old one, as witnessed by QuadraticForm.baseChange_eq_tmul.

The new definition for base change means that Invertible 2 is no longer necessary in Mathlib/LinearAlgebra/CliffordAlgebra/BaseChange.lean. This PR also drops that unneeded hypothesis where it occurs.

This PR adds the reference Garibaldi–Petersson–Racine, Albert Algebras over Commutative Rings, to docs/references.bib as a textbook account (Proposition 11.4 and Corollary 11.5). Disclosure: I am a co-author. The math is elementary and well known, so there are other possible choices. This one has the advantage of having a free, machine-readable PDF available online, see the URL in the reference.

Migration: QuadraticForm.baseChange, QuadraticForm.baseChange_tmul, QuadraticForm.associated_baseChange and QuadraticForm.polarBilin_baseChange move from Mathlib/LinearAlgebra/QuadraticForm/TensorProduct.lean to the new file Mathlib/LinearAlgebra/QuadraticForm/BaseChange.lean. Import Mathlib.LinearAlgebra.QuadraticForm.BaseChange. QuadraticForm.baseChange is no longer defined to be QuadraticForm.tmul QuadraticMap.sq Q; use QuadraticForm.baseChange_eq_tmul instead. Declarations in CliffordAlgebra/BaseChange.lean no longer take [Invertible (2 : R)].


Use of AI: I chose the approach and directed Claude Opus 5.5 to write the Lean code, working interactively. I used ChatGPT 6.1 Sol to review the code at various stages, leveraging Cameron Freer's lean4-skills.

Zulip discussion: https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/QuadraticForm.2EbaseChange.20without.20Invertible.202/with/644221143

skipgaribaldi and others added 8 commits November 27, 2026 09:29
Construct the base change of a quadratic map along `R → A` over an
arbitrary commutative ring, with no hypothesis on `2` and no finiteness
hypothesis on the module. Present `M` as a quotient of `M →₀ R`, base
change a bilinear representative on the free module, and descend along
`QuadraticMap.lift` using right exactness of the tensor product.

`QuadraticForm.baseChange` is redefined via this construction and moves,
with `baseChange_tmul`, `associated_baseChange` and
`polarBilin_baseChange`, from `QuadraticForm/TensorProduct.lean` to the
new file `QuadraticForm/BaseChange.lean`. `baseChange`, `baseChange_tmul`
and `polarBilin_baseChange` no longer assume `Invertible 2`.

`QuadraticForm.baseChange` is now `noncomputable`, and so are the Clifford
algebra base-change maps built on it. `ofBaseChangeAux`, `ofBaseChange`
and their simp lemmas no longer assume `Invertible 2`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…etric bilinear map

Generalize the construction of base change to the tensor product
`QuadraticMap.bilinTmul b hb Q : QuadraticMap A (V ⊗[R] M) (W ⊗[R] N)` of a
symmetric bilinear map `b` over `A` with a quadratic map `Q` over `R`, with no
hypothesis on `2`. Its polar form is `b.tmul (polarBilin Q)`.
`QuadraticMap.baseChange` is now the special case where `b` is
multiplication on `A`.

Also add `QuadraticMap.polarBilin_baseChange` and the compatibility lemma
`QuadraticForm.baseChange_eq_tmul` with the previous definition when `2` is
invertible, cite Garibaldi–Petersson–Racine Proposition 11.4 and
Corollary 11.5, and simplify a helper proof with
`LinearMap.quotKerEquivOfSurjective_symm_apply`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…linTmul`

Replace the free-presentation construction of `QuadraticMap.bilinTmul` with
an explicit formula on words in the free additive monoid underlying the
tensor product, using the order of the word in place of a chosen bilinear
representative. This removes all uses of choice, so `bilinTmul`,
`QuadraticMap.baseChange`, `QuadraticForm.baseChange` and the Clifford
algebra base-change maps are computable again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…aseChange`, trim docs

Prove `associated_baseChange` from `baseChange_eq_tmul` and
`associated_tmul`, and drop development history from the docstrings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Prove that `toBaseChange` respects the quadratic form by comparing two
quadratic maps on `1 ⊗ₜ v` with `baseChange_ext`, instead of reducing to
the polar form. This removes the `Invertible (2 : R)` hypothesis from
`toBaseChange`, `equivBaseChange` and the remaining lemmas in the file, so
`CliffordAlgebra (Q.baseChange A) ≃ₐ[A] A ⊗[R] CliffordAlgebra Q` holds
over any commutative ring.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! label Nov 28, 2026
@github-actions

Copy link
Copy Markdown

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 awaiting-author tag, or another reason described in the Lifecycle of a PR. The review dashboard has a dedicated webpage which shows whether your PR is on the review queue, and (if not), why.

If you haven't already done so, please come to Zulip and join the Lean community.
Thank you again for joining our community.

@github-actions github-actions Bot added tech debt Fixes cross-cutting technical debt, see the "technical debt counters" stream on zulip LLM-generated PRs with substantial input from LLMs - review accordingly labels Nov 28, 2026
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

PR summary 5c24b2ede0

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.LinearAlgebra.CliffordAlgebra.BaseChange 1
Mathlib.LinearAlgebra.QuadraticForm.BaseChange (new file) 1853

Declarations diff (regex)

+ addConGen_le_quadCon
+ baseChange_eq_tmul
+ bilinTmul
+ bilinTmulFun
+ bilinTmulFun_add
+ bilinTmulFun_smul
+ bilinTmulFun_tmul
+ bilinTmul_tmul
+ listQuad
+ listQuad_append
+ listQuad_cons
+ listQuad_nil
+ listTensor
+ listTensor_append
+ listTensor_cons
+ listTensor_nil
+ listTensor_toList
+ mul_comm'
+ polarBilin_bilinTmul
+ polar_bilinTmul_tmul
+ quadCon
+ quadCon_iff
++ polar_baseChange_tmul
++- polarBilin_baseChange
+-+ baseChange
+-+ baseChange_tmul

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 5c24b2e).

  • +10 new declarations
  • −0 removed declarations
+QuadraticForm.baseChange_eq_tmul
+QuadraticForm.polar_baseChange_tmul
+QuadraticMap.baseChange
+QuadraticMap.baseChange_tmul
+QuadraticMap.bilinTmul
+QuadraticMap.bilinTmul_tmul
+QuadraticMap.polarBilin_baseChange
+QuadraticMap.polarBilin_bilinTmul
+QuadraticMap.polar_baseChange_tmul
+QuadraticMap.polar_bilinTmul_tmul

Decrease in strong tech debt: (relative, absolute) = (1.00, 0.00)
Current number Change Type (strong)
1730 -1 backward.defeqAttrib.useBackward
No changes to weak technical debt.

Current commit 5c24b2ede0
Reference commit 872764eb0f

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.py 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 Nov 28, 2026
@skipgaribaldi

Copy link
Copy Markdown
Author

LLM-generated

…iles`

These commands made the changes in this commit.
To make the same fixes yourself, run them in your mathlib4 checkout.
@eric-wieser
eric-wieser self-requested a review November 28, 2026 19:44
skipgaribaldi and others added 2 commits November 28, 2026 11:49
Co-Authored-By: Claude Opus 5.5 <[email protected]>
These commands made the changes in this commit.
To make the same fixes yourself, run them in your mathlib4 checkout.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LLM-generated PRs with substantial input from LLMs - review accordingly new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! t-algebra Algebra (groups, rings, fields, etc) tech debt Fixes cross-cutting technical debt, see the "technical debt counters" stream on zulip

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant