Skip to content

refactor: TrivSqZeroExt extending Prod - #43232

Open
Parcly-Taxel wants to merge 11 commits into
leanprover-community:masterfrom
Parcly-Taxel:tsze2
Open

Parcly-Taxel wants to merge 11 commits into
leanprover-community:masterfrom
Parcly-Taxel:tsze2

Conversation

@Parcly-Taxel

@Parcly-Taxel Parcly-Taxel commented Aug 30, 2026 •

Copy link
Copy Markdown
Collaborator

Define à la Unitization (#mathlib4 > TrivSqZeroExt as a 2-field structure @ 💬)

structure TrivSqZeroExt (R : Type u) (M : Type v) extends R × M

This PR came out of investigating the source of the DualQuaternion slowdown in #43078. (DualNumber R is an abbrev for TrivSqZeroExt R R.)

Topology.Instances.TrivSqZeroExt and Analysis.Normed.Algebra.TrivSqZeroExt were filled in with significant help from GPT-6.1 Sol.

@github-actions

github-actions Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

PR summary ef23181274

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.Topology.Instances.TrivSqZeroExt 1368 1369 +1 (+0.07%)
Import changes for all files
Files Import difference
Mathlib.Topology.Instances.TrivSqZeroExt 1

Declarations diff (regex)

+ addEquiv
+ continuous_mk
+ equiv
+ instance : IsBoundedSMul S (tsze R M)
+ instance : NormedAddCommGroup (tsze R M)
+ instance : NormedAlgebra 𝕜 (tsze R M)
+ instance : NormedCommRing (tsze R M)
+ instance : NormedRing (tsze R M)
+ instance : NormedSpace 𝕜 (tsze R M)
+ instance : SeminormedAddCommGroup (tsze R M)
+ instance : SeminormedCommRing (tsze R M)
+ instance : SeminormedRing (tsze R M)
+ instance : TopologicalSpace (tsze R M)
+ instance : UniformSpace (tsze R M) := instUniformSpaceProd.comap equiv
+ instance [T2Space R] [T2Space M] : T2Space (tsze R M) := isEmbedding_equiv.t2Space
+ isEmbedding_equiv
+ mk_bijective
+ mk_injective
+ mk_surjective
+ mk_toProd
+ toProd_bijective
+ toProd_inj_iff
+ toProd_injective
+ toProd_mk
+ toProd_surjective
+ uniformEquivProd
- ext
- fst
- instL1IsBoundedSMul
- instL1NormedAddCommGroup
- instL1NormedAlgebra
- instL1NormedCommRing
- instL1NormedRing
- instL1NormedSpace
- instL1SeminormedAddCommGroup
- instL1SeminormedCommRing
- instL1SeminormedRing
- instTopologicalSpace
- instUniformSpace
- instance [T2Space R] [T2Space M] : T2Space (tsze R M)
- snd

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 ef23181).

  • +43 new declarations
  • −13 removed declarations
-Matrix.dualNumberEquiv_apply
+Matrix.dualNumberEquiv_apply_fst
+Matrix.dualNumberEquiv_apply_snd
+TrivSqZeroExt.addEquiv
+TrivSqZeroExt.addEquiv_apply
+TrivSqZeroExt.addEquiv_symm_apply
+TrivSqZeroExt.casesOn
+TrivSqZeroExt.continuous_mk
+TrivSqZeroExt.ctorIdx
+TrivSqZeroExt.equiv
+TrivSqZeroExt.equiv_apply
+TrivSqZeroExt.equiv_symm_apply
-TrivSqZeroExt.fst
+TrivSqZeroExt.instIsBoundedSMul
-TrivSqZeroExt.instL1IsBoundedSMul
-TrivSqZeroExt.instL1NormedAddCommGroup
-TrivSqZeroExt.instL1NormedAlgebra
-TrivSqZeroExt.instL1NormedCommRing
-TrivSqZeroExt.instL1NormedRing
-TrivSqZeroExt.instL1NormedSpace
-TrivSqZeroExt.instL1SeminormedAddCommGroup
-TrivSqZeroExt.instL1SeminormedCommRing
-TrivSqZeroExt.instL1SeminormedRing
+TrivSqZeroExt.instNormedAddCommGroup
+TrivSqZeroExt.instNormedAlgebra
+TrivSqZeroExt.instNormedCommRing
+TrivSqZeroExt.instNormedRing
+TrivSqZeroExt.instNormedSpace
+TrivSqZeroExt.instSeminormedAddCommGroup
+TrivSqZeroExt.instSeminormedCommRing
+TrivSqZeroExt.instSeminormedRing
-TrivSqZeroExt.invertibleEquivInvertibleFst_symm_apply_invOf
+TrivSqZeroExt.invertibleEquivInvertibleFst_symm_apply_invOf_fst
+TrivSqZeroExt.invertibleEquivInvertibleFst_symm_apply_invOf_snd
+TrivSqZeroExt.isEmbedding_equiv
+TrivSqZeroExt.mk
+TrivSqZeroExt.mk.inj
+TrivSqZeroExt.mk.injEq
+TrivSqZeroExt.mk.noConfusion
+TrivSqZeroExt.mk.sizeOf_spec
+TrivSqZeroExt.mk_bijective
+TrivSqZeroExt.mk_injective
+TrivSqZeroExt.mk_surjective
+TrivSqZeroExt.mk_toProd
+TrivSqZeroExt.noConfusion
+TrivSqZeroExt.noConfusionType
+TrivSqZeroExt.rec
+TrivSqZeroExt.recOn
-TrivSqZeroExt.snd
+TrivSqZeroExt.toProd
+TrivSqZeroExt.toProd_bijective
+TrivSqZeroExt.toProd_inj_iff
+TrivSqZeroExt.toProd_injective
+TrivSqZeroExt.toProd_mk
+TrivSqZeroExt.toProd_surjective
+TrivSqZeroExt.uniformEquivProd

Decrease in strong tech debt: (relative, absolute) = (1.30, 0.00)
Current number Change Type (strong)
3496 -4 backward.isDefEq.respectTransparency
1949 -1 backward.isDefEq.respectTransparency.types
486 -1 erw
No changes to weak technical debt.

Current commit ef23181274
Reference commit f1070cd4d9

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 Aug 30, 2026
@Parcly-Taxel Parcly-Taxel added the help-wanted The author needs attention to resolve issues label Aug 30, 2026
@github-actions github-actions Bot added the tech debt Fixes cross-cutting technical debt, see the "technical debt counters" stream on zulip label Aug 31, 2026
@Parcly-Taxel Parcly-Taxel changed the title refactor: TrivSqZeroExt as a 2-field structure refactor: TrivSqZeroExt extending Prod Aug 31, 2026
@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Sep 2, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

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

@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 Sep 2, 2026
@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Sep 26, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

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

@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 Sep 26, 2026
@Parcly-Taxel Parcly-Taxel removed the help-wanted The author needs attention to resolve issues label Sep 26, 2026
@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Oct 9, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

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

@Parcly-Taxel Parcly-Taxel removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Oct 9, 2026
R × M
It is a square-zero extension because `M ^ 2 = 0`. -/
@[ext]
structure TrivSqZeroExt (R : Type u) (M : Type v) extends R × M

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.

See also #26976, where we decided not to extend Prod. Though I don't think it's possible to give more informative names to the fields in this case.

@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Oct 26, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

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

@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 Oct 26, 2026
@Parcly-Taxel Parcly-Taxel added the LLM-generated PRs with substantial input from LLMs - review accordingly label Oct 27, 2026
@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Nov 5, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

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

@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 Nov 6, 2026
@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Nov 27, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

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

@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 Nov 27, 2026

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 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.

2 participants