Skip to content

feat(LinearAlgebra/SesquilinearForm): add instances for SeparatingLeft, SeparatingRight and Nondegenerate - #43143

Open
martinwintermath wants to merge 24 commits into
leanprover-community:masterfrom
martinwintermath:bilinear-separating-fact
Open

martinwintermath wants to merge 24 commits into
leanprover-community:masterfrom
martinwintermath:bilinear-separating-fact

Conversation

@martinwintermath

@martinwintermath martinwintermath commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Add typeclass instances for Fact B.SeparatingLeft, Fact B.SeparatingRight, Fact B.Nondegenerate:

  • inferring Fact B.flip.SeparatingLeft from Fact B.SeparatingRight and vice versa
  • inferring Fact B.SeparatingLeft and Fact B.SeparatingRight from Fact B.Nondegenerate
  • inferring Fact B.SeparatingLeft and Fact B.Nondegenerate for .id and Dual.eval
  • inferring Fact B.Nondegenerate from B.IsPerfPair

I also updated PointedCone.dual_univ to demonstrate a use for these additions. Note that I needed to add an import to Cone/Dual.lean which somehow imports cardinals. So I needed to remove cardinals from assert_not_exists.

Zulip: #mathlib4 > Typeclass instances for separating bilinear forms


Open in Gitpod

@github-actions github-actions Bot added the large-import Automatically added label for PRs with a significant increase in transitive imports label Aug 26, 2026
@github-actions

github-actions Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

PR summary cbf391c058

Import changes exceeding 2%

% File
+34.97% Mathlib.Geometry.Convex.Cone.Dual

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.Geometry.Convex.Cone.Dual 1224 1652 +428 (+34.97%)
Import changes for all files
Files Import difference
4 files Mathlib.Analysis.Convex.Cone.Dual Mathlib.Analysis.Convex.Cone.InnerDual Mathlib.Analysis.Convex.Cone.TensorProduct Mathlib.Geometry.Convex.Cone.TensorProduct
1
Mathlib.Geometry.Convex.Cone.DualFinite 399
Mathlib.Geometry.Convex.Cone.Dual 428

Declarations diff (regex)

+ SeparatingLeft.ker_eq_bot
+ dual_univ_eq_ker
+ instance : Fact (Dual.eval R M).SeparatingRight := ⟨.eval⟩
+ instance : Fact (SeparatingLeft (M₁ := M₁ →ₛₗ[I₁] M) .id) := ⟨.id⟩
+ instance : Fact p.Nondegenerate := ⟨‹p.IsPerfPair›.nondegenerate⟩
+ instance [inst : Fact B.Nondegenerate] : Fact B.SeparatingLeft := ⟨inst.elim.1⟩
+ instance [inst : Fact B.Nondegenerate] : Fact B.SeparatingRight := ⟨inst.elim.2⟩
+ instance [inst : Fact B.SeparatingLeft] : Fact B.flip.SeparatingRight
+ instance [inst : Fact B.SeparatingRight] : Fact B.flip.SeparatingLeft

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

  • +9 new declarations
  • −0 removed declarations
+LinearMap.SeparatingLeft.ker_eq_bot
+LinearMap.instFactNondegenerate
+LinearMap.instFactSeparatingLeftFlipOfSeparatingRight
+LinearMap.instFactSeparatingLeftId
+LinearMap.instFactSeparatingLeftOfNondegenerate
+LinearMap.instFactSeparatingRightDualEval
+LinearMap.instFactSeparatingRightFlipOfSeparatingLeft
+LinearMap.instFactSeparatingRightOfNondegenerate
+PointedCone.dual_univ_eq_ker

No changes to strong technical debt.
No changes to weak technical debt.

Current commit cbf391c058
Reference commit 17e9f587d8

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-convex-geometry Affine geometry, cones, simplices label Aug 26, 2026
@github-actions github-actions Bot added t-algebra Algebra (groups, rings, fields, etc) and removed t-convex-geometry Affine geometry, cones, simplices labels Aug 26, 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 Aug 26, 2026
mathlib-bors Bot pushed a commit that referenced this pull request Aug 31, 2026
…orms (#34487)

Some file cleanup and adding minor lemmas.

This is an extract from and in preparation for #43143.

Co-authored-by: Martin Winter <[email protected]>
@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 31, 2026
@mathlib-dependent-issues

Copy link
Copy Markdown

joelriou pushed a commit to joelriou/mathlib4 that referenced this pull request Sep 5, 2026
…orms (leanprover-community#34487)

Some file cleanup and adding minor lemmas.

This is an extract from and in preparation for leanprover-community#43143.

Co-authored-by: Martin Winter <[email protected]>
Comment thread Mathlib/Geometry/Convex/Cone/Dual.lean Resolved

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

I don't know how I feel about all these Fact global instances

@martinwintermath

martinwintermath commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor Author

I don't know how I feel about all these Fact global instances

I also don't think this is great. The alternative is to make SeparatingLeft, Nondegenerate and whatever else is natural and will be needed into classes (like IsPerfPair). I briefly spoke to @grunweg and he was not immediately convinced that classes are the better solution. So, to be honest, someone has to tell me what to do here.

If this needs discussion, happy to have it here: #mathlib4 > More typeclass instances for bilinear forms

@themathqueen

Copy link
Copy Markdown
Member

Sure, let's discuss this on the Zulip thread. Maybe mentioning what the "end goal" here is would help?
An immediate solution is to have these instances scoped. But this all depends on your use case.

@themathqueen themathqueen added the awaiting-zulip There is a Zulip discussion; the author should await and report/implement the decision reached there label Oct 5, 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 6, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

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

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

awaiting-zulip There is a Zulip discussion; the author should await and report/implement the decision reached there large-import Automatically added label for PRs with a significant increase in transitive imports merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) t-algebra Algebra (groups, rings, fields, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants