Skip to content

feat(LinearAlgebra/AffineSpace/AffineSubspace): using AffineSubspace.direction to reinterpret AffineSubspace as Submodule#38731

Open
martinwintermath wants to merge 4 commits intoleanprover-community:masterfrom
martinwintermath:affineSubspace-improve
Open

feat(LinearAlgebra/AffineSpace/AffineSubspace): using AffineSubspace.direction to reinterpret AffineSubspace as Submodule#38731
martinwintermath wants to merge 4 commits intoleanprover-community:masterfrom
martinwintermath:affineSubspace-improve

Conversation

@martinwintermath
Copy link
Copy Markdown
Contributor

@martinwintermath martinwintermath commented Apr 29, 2026

  • add AffineSubspace.vsub_self_of_zero_mem that states s -ᵥ s = s if 0 ∈ s
  • add AffineSubspace.direction_eq_self_of_zero_mem that states that if 0 ∈ s, then the directions coerce back to the affine subspace.
  • add corresponding CanLift instance.
  • modify doc-string of AffineSubspace.direction to state that this can be used for reinterpretation of an affine subspace as a submodule.
  • add Coe instance based on Submodule.toAffineSubspace and adds corresponding @[coe] attribute.

The PR also performs a slight cleanup of the file: statements about SetLike or Submodule.toAffineSubspace have been moved closer to their respective definitions.


Open in Gitpod

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 29, 2026

PR summary 672768680f

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ direction_eq_self_of_zero_mem
+ instance : CanLift (AffineSubspace k V) (Submodule k V) (·) (0 ∈ ·) := ⟨
+ instance : Coe (Submodule k V) (AffineSubspace k V) := ⟨toAffineSubspace⟩
+ vsub_self_of_zero_mem

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.


No changes to technical debt.

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 Apr 29, 2026
Comment thread Mathlib/LinearAlgebra/AffineSpace/AffineSubspace/Defs.lean Outdated
@wwylele
Copy link
Copy Markdown
Collaborator

wwylele commented Apr 29, 2026

One thing I just realized: isn't this just a specialization of AffineSubspace.direction? When 0 is a member, you can prove that AffineSubspace.direction and AffineSubspace.toSubmodule are equal. So I don't think we need this. We can add a doc to note that one can use AffineSubspace.direction to convert to submodule

Edit: and we can add a lemma that (AffineSubspace.direction s).toAffineSubspace = s when 0 is a member of s

Copy link
Copy Markdown
Collaborator

@wwylele wwylele left a comment

Choose a reason for hiding this comment

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

Don't forget to update PR title and description

@martinwintermath martinwintermath changed the title feat(LinearAlgebra/AffineSpace/AffineSubspace): conversion from AffineSubspace to Submodule feat(LinearAlgebra/AffineSpace/AffineSubspace): using AffineSubspace.direction to reinterpret AffineSubspace as Submodule Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-algebra Algebra (groups, rings, fields, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants