Skip to content

[Merged by Bors] - feat(LinearAlgebra/QuadraticForm/TensorProduct): base change of quadratic forms - #6636

Closed
eric-wieser wants to merge 9 commits into
masterfrom
eric-wieser/QuadraticForm.baseChange
Closed

eric-wieser wants to merge 9 commits into
masterfrom
eric-wieser/QuadraticForm.baseChange

Conversation

@eric-wieser

@eric-wieser eric-wieser commented Aug 17, 2023 •

Copy link
Copy Markdown
Member

@eric-wieser eric-wieser added awaiting-review awaiting-CI This PR does not pass CI yet. This label is automatically removed once it does. t-algebra Algebra (groups, rings, fields, etc) labels Aug 17, 2023
@eric-wieser eric-wieser changed the title feat(LinearAlgebra/QuadraticForm/TensorProduct): base change of bilinear forms feat(LinearAlgebra/QuadraticForm/TensorProduct): base change of quadratic forms Aug 17, 2023
@eric-wieser

Copy link
Copy Markdown
Member Author

I also tried to prove:

theorem _root_.BilinForm.toQuadraticForm_tmul (B₁ : BilinForm A M₁) (B₂ : BilinForm R M₂) :
    (B₁.tmul B₂).toQuadraticForm
      = B₁.toQuadraticForm.tmul B₂.toQuadraticForm := by
  letI : Invertible (2 : A) := (Invertible.map (algebraMap R A) 2).copy 2 (map_ofNat _ _).symm
  rw [QuadraticForm.tmul, tensorDistrib, BilinForm.tmul]
  dsimp
  refine (associated_rightInverse R).injective ?_
  refine BilinForm.toLin.injective ?_
  ext a₁ a₂ b₁ b₂
  dsimp [-associated_apply]
  simp [sub_smul, smul_sub, add_smul, smul_add, ←smul_mul_smul]
  set aa₁ := B₁ a₁ a₁
  set ab₁ := B₁ a₁ b₁
  set ba₁ := B₁ b₁ a₁
  set bb₁ := B₁ b₁ b₁
  set aa₂ := B₂ a₂ a₂
  set ab₂ := B₂ a₂ b₂
  set ba₂ := B₂ b₂ a₂
  set bb₂ := B₂ b₂ b₂
  sorry

though the algebra is too painful to get to a point where it's obvious whether it's true.

@github-actions github-actions Bot removed the awaiting-CI This PR does not pass CI yet. This label is automatically removed once it does. label Aug 17, 2023
@ghost

ghost commented Aug 17, 2023

Copy link
Copy Markdown

@eric-wieser
eric-wieser requested a review from alexjbest August 21, 2023 22:28
@alexjbest

Copy link
Copy Markdown
Member

maintainer merge

@github-actions

Copy link
Copy Markdown

🚀 Pull request has been placed on the maintainer queue by alexjbest.

@ocfnash ocfnash left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

bors d+

@bors

bors Bot commented Aug 25, 2023

Copy link
Copy Markdown

✌️ eric-wieser can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@ghost ghost added delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). and removed awaiting-review labels Aug 25, 2023
@eric-wieser

Copy link
Copy Markdown
Member Author

bors merge

@github-actions github-actions Bot added the ready-to-merge This PR has been sent to bors. label Aug 25, 2023
bors Bot pushed a commit that referenced this pull request Aug 25, 2023
@bors

bors Bot commented Aug 25, 2023

Copy link
Copy Markdown

Pull request successfully merged into master.

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors Bot changed the title feat(LinearAlgebra/QuadraticForm/TensorProduct): base change of quadratic forms [Merged by Bors] - feat(LinearAlgebra/QuadraticForm/TensorProduct): base change of quadratic forms Aug 25, 2023
@bors bors Bot closed this Aug 25, 2023
@bors
bors Bot deleted the eric-wieser/QuadraticForm.baseChange branch August 25, 2023 11:15
tau-ceti-bors Bot pushed a commit to TauCetiProject/TauCeti that referenced this pull request Oct 14, 2026
…ase change (#16538)

This PR makes the Spin base-change lemmas in `TauCeti/LinearAlgebra/CliffordAlgebra/Spin/BaseChange.lean` take `[Invertible (2 : A)]` as an instance argument. Until now each statement fixed that instance with `letI : Invertible (2 : A) := (Invertible.map (algebraMap R A) 2).copy 2 _`. Five lemmas change: `spinVectorAction_baseChange_tmul`, `spinToSpecialOrthogonal_baseChange`, `spinGroupBaseChange_spinTransvection`, `spinToOrthogonal_baseChange` and `spinGroupBaseChange_comp_spinTransvectionHom`. Their proofs are the same except that the `let` restating the transported instance is gone. No proof depended on which inverse of two it was given.

The old statements broke at concrete fields. Over `ℝ` or `ℚ_[p]` the goal uses the field's own instance (`invertibleTwo`, `TauCeti.instInvertibleTwoPadic`), and these are not definitionally equal to the transported one, so `rfl` cannot identify them. As a result `exact spinToSpecialOrthogonal_baseChange Q x` fails with a type mismatch between the two instances. `rw` rewrites the left side and then leaves a goal whose two sides print the same but are not closed. `simp`, `simp only` and `erw` all leave the goal unsolved, and `convert` ends with the side goal `invertibleTwo = (Invertible.map (algebraMap ℚ ℝ) 2).copy 2 _`. So every caller at a concrete field had to align the instances by hand:

- `finiteAdelicSpinToSpecialOrthogonal_comp_finiteAdelicSpinDiagonal` (`Diagonal/Finite.lean`), `fullAdelicSpinToSpecialOrthogonal_comp_fullAdelicSpinDiagonal` (`Diagonal/Full.lean`) and `eventually_mem_integralSpinSubgroup` (`Integral/Spin.lean`) each used `have h := …` followed by `rw [Subsingleton.elim (transported) (inferInstance : Invertible (2 : _))] at h`. These steps are now gone: the lemma goes straight into the existing `simp only` or `exact`, which saves 5 lines at each site.
- `tendsto_finiteAdelicSpinDiagonal_spinTransvection_factorial` (`Diagonal/NonDiscrete/Spin.lean`) pinned the transported instance on `ℚ_[p]` for a whole block, so that `spinGroupBaseChange_spinTransvection` could rewrite. That `let` is removed. Without the pin, the old lemma fails `rw` with "synthesized type class instance is not definitionally equal to expression inferred by typing rules".

The `@[simp]` attributes on these lemmas now fire at concrete fields. Before, they could never match there. Inside the generic files, callers that build the transported instance with `let` (for example `spinorNormKernelBaseChange_spinToSpinorNormKernel` in `Spin/SpinorNorm/BaseChange.lean`) are unaffected, because instance search returns their local instance.

This is the shape Mathlib uses for statements about quadratic forms after base change. `QuadraticForm.associated_baseChange` and `QuadraticForm.polarBilin_baseChange` take `[Invertible (2 : A)]` (`Mathlib/LinearAlgebra/QuadraticForm/TensorProduct.lean:135`, `:141`). `QuadraticMap.associated_tmul` (`:72`) does the same and aligns the instances once inside its proof (`:75-77`). The transported `letI` appears only in definition bodies (`QuadraticMap.tensorDistrib`, `:50`) and in proofs whose statements do not mention the instance (`tensorDistrib_tmul`, `:63`). This split goes back to the file's introduction in leanprover-community/mathlib4#6636, where `associated_tmul` and `associated_baseChange` were already stated with `[Invertible (2 : A)]`.

The old design had one advantage. With no `Invertible (2 : A)` instance in scope, the old lemmas still applied and produced the transported instance themselves. Such a caller now needs one `letI : Invertible (2 : A) := (Invertible.map (algebraMap R A) 2).copy 2 (map_ofNat _ _).symm` before using the lemma, and this recovers the old statement exactly. No caller in the library is in that position. Two lemmas in this file, `spinGroupBaseChange_baseChange` and `evenUnitaryGroupBaseChange_baseChange`, keep the transported instance, because the type of the definition `QuadraticForm.baseChangeBaseChange` they are stated through fixes it.

No declarations are removed or renamed. The five lemmas above keep their names and change only in that the instance is now an argument.

Roadmap: OrthogonalSpinGroups

<!--tauceti-target:v1 {"focus":"OrthogonalSpinGroups","id":"cliffordalgebra-spintospecialorthogonal-basechange"}-->

🤖 Prepared with Claude Code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). 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