Skip to content

Conversation

@sun123zxy
Copy link
Contributor

@sun123zxy sun123zxy commented Dec 28, 2025


Split from PR #33247

Open in Gitpod

@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 Dec 28, 2025
@github-actions
Copy link

github-actions bot commented Dec 28, 2025

PR summary e78e242c45

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ le_spanRank_restrictScalars
+ spanFinrank_map_le_of_fg
+ spanRank_eq_spanRank_of_equiv
+ spanRank_eq_spanRank_of_equiv'
+ spanRank_le_spanRank_of_map_eq
+ spanRank_le_spanRank_of_range_eq
+ spanRank_le_spanRank_of_surjective
+ spanRank_map_le
+ spanRank_restrictScalars_eq
- Submodule.spanFinrank_map_le_of_fg
- Submodule.spanRank_map_le

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/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 Dec 28, 2025
@github-actions
Copy link

github-actions bot commented Dec 28, 2025

✅ PR Title Formatted Correctly

The title of this PR has been updated to match our commit style conventions.
Thank you!

@sun123zxy sun123zxy changed the title feat(Algebra/Module/SpanRank) add comparing lemmas for span rank feat(Algebra/Module/SpanRank): add comparing lemmas for span rank Dec 28, 2025
Copy link
Member

@erdOne erdOne left a comment

Choose a reason for hiding this comment

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

I would argue that we don't want lemmas that mention linear maps between submodules.

I think what we want is something like

lemma spanRank_map_eq {σ : R →+* S} [RingHomSurjective σ]
    (f : M →ₛₗ[σ] N) (hf : Function.Injective f) (p : Submodule R M) :
    (p.map f).spanRank = p.spanRank := by
  refine (spanRank_map_le f p).antisymm ?_
  obtain ⟨s, hs, e⟩ := (p.map f).exists_span_set_card_eq_spanRank
  obtain ⟨s, rfl⟩ : ∃ y, f '' y = s := Set.subset_range_iff_exists_image_eq.mp
    ((subset_span.trans e.le).trans LinearMap.map_le_range)
  obtain rfl : span R s = p := by simpa [(map_injective_of_injective hf).eq_iff] using e
  grw [← hs, spanRank_span_le_card, Cardinal.mk_image_eq hf]

lemma spanRank_range_le {σ : R →+* S} [RingHomSurjective σ]
    (f : M →ₛₗ[σ] N) : (LinearMap.range f).spanRank ≤ (⊤ : Submodule R M).spanRank := by
  simpa using spanRank_map_le f ⊤

@[simp]
lemma spanRank_top_eq_spanRank (p : Submodule R M) :
    (⊤ : Submodule R p).spanRank = p.spanRank := by
  simpa using (spanRank_map_eq _ p.subtype_injective ⊤).symm

And then for example if you really want spanRank_le_spanRank_of_range_eq you can get it via simpa [*] using spanRank_range_le f, which I argue you can just do inline.

@erdOne erdOne added the awaiting-author A reviewer has asked the author a question or requested changes. label Jan 3, 2026
Comment on lines 333 to 348
lemma spanRank_restrictScalars_eq_spanRank (M₁ : Submodule R M) :
(M₁.restrictScalars S).spanRank = M₁.spanRank := by
apply le_antisymm
· rcases exists_span_set_card_eq_spanRank M₁ with ⟨s, hscard, hsspan⟩
rw [FG.spanRank_le_iff_exists_span_set_card_le]
use s
constructor
· rw [hscard]
· rw [← hsspan, ← span_coe_eq_restrictScalars,
coe_span_eq_span_of_surjective S R <| RingHom.surjective (algebraMap S R)]
simp
· let f : M₁.restrictScalars S →ₛₗ[algebraMap S R] M₁ := {
AddEquiv.refl M₁ with
map_smul' := by simp
}
apply spanRank_le_spanRank_of_surjective f Function.surjective_id
Copy link
Member

Choose a reason for hiding this comment

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

This might be a better approach:

variable {R S : Type*} {M : Type u} [CommSemiring R] [Semiring S] [AddCommMonoid M]
  [Algebra R S] [Module R M] [Module S M] [IsScalarTower R S M]

lemma le_spanRank_restrictScalars
    (N : Submodule S M) : N.spanRank ≤ (N.restrictScalars R).spanRank := by
  obtain ⟨s, hs, e⟩ := (N.restrictScalars R).exists_span_set_card_eq_spanRank
  obtain rfl : span S s = N :=
    le_antisymm (span_le.mpr (span_le.mp e.le:)) (e.ge.trans (span_le_restrictScalars R S s))
  grw [← hs, spanRank_span_le_card]

lemma spanRank_restrictScalars_eq (H : Function.Surjective (algebraMap R S))
    (N : Submodule S M) : (N.restrictScalars R).spanRank = N.spanRank := by
  refine N.le_spanRank_restrictScalars.antisymm' ?_
  obtain ⟨s, hs, rfl⟩ := N.exists_span_set_card_eq_spanRank
  grw [restrictScalars_span R S H s, ← hs, spanRank_span_le_card]

@sun123zxy
Copy link
Contributor Author

I would argue that we don't want lemmas that mention linear maps between submodules.

I think what we want is something like

lemma spanRank_map_eq {σ : R →+* S} [RingHomSurjective σ]
    (f : M →ₛₗ[σ] N) (hf : Function.Injective f) (p : Submodule R M) :
    (p.map f).spanRank = p.spanRank := by
  refine (spanRank_map_le f p).antisymm ?_
  obtain ⟨s, hs, e⟩ := (p.map f).exists_span_set_card_eq_spanRank
  obtain ⟨s, rfl⟩ : ∃ y, f '' y = s := Set.subset_range_iff_exists_image_eq.mp
    ((subset_span.trans e.le).trans LinearMap.map_le_range)
  obtain rfl : span R s = p := by simpa [(map_injective_of_injective hf).eq_iff] using e
  grw [← hs, spanRank_span_le_card, Cardinal.mk_image_eq hf]

lemma spanRank_range_le {σ : R →+* S} [RingHomSurjective σ]
    (f : M →ₛₗ[σ] N) : (LinearMap.range f).spanRank ≤ (⊤ : Submodule R M).spanRank := by
  simpa using spanRank_map_le f ⊤

@[simp]
lemma spanRank_top_eq_spanRank (p : Submodule R M) :
    (⊤ : Submodule R p).spanRank = p.spanRank := by
  simpa using (spanRank_map_eq _ p.subtype_injective ⊤).symm

And then for example if you really want spanRank_le_spanRank_of_range_eq you can get it via simpa [*] using spanRank_range_le f, which I argue you can just do inline.

If so, I think I'll apply these changes, remove spanRank_le_spanRank_of_range_eq, spanRank_le_spanRank_of_map_eq but keep spanRank_le_spanRank_of_surjective and the equiv statements. Does this look good to you?

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

Labels

awaiting-author A reviewer has asked the author a question or requested changes. 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)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants