Skip to content

Commit

Permalink
feat(NumberTheory.NumberField.Basic): add mem_span_integralBasis (#5996)
Browse files Browse the repository at this point in the history
Add the following result: 
```lean
theorem mem_span_integralBasis {x : K} :
    x ∈ Submodule.span ℤ (Set.range (integralBasis K)) ↔ x ∈ 𝓞 K
```
that is, `integralBasis` is indeed a `ℤ`-basis of the ring of integers. 

Co-authored-by: Riccardo Brasca <[email protected]>



Co-authored-by: Riccardo Brasca <[email protected]>
  • Loading branch information
xroblot and riccardobrasca committed Aug 2, 2023
1 parent 9688c5a commit 6538bed
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 12 deletions.
13 changes: 13 additions & 0 deletions Mathlib/Algebra/Algebra/Subalgebra/Tower.lean
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,19 @@ def ofRestrictScalars (U : Subalgebra S A) (f : U →ₐ[S] B) : U.restrictScala

end Semiring

section CommSemiring

@[simp]
lemma range_isScalarTower_toAlgHom [CommSemiring R] [CommSemiring A]
[Algebra R A] (S : Subalgebra R A) :
LinearMap.range (IsScalarTower.toAlgHom R S A) = Subalgebra.toSubmodule S := by
ext
simp only [← Submodule.range_subtype (Subalgebra.toSubmodule S), LinearMap.mem_range,
IsScalarTower.coe_toAlgHom', Subalgebra.mem_toSubmodule]
rfl

end CommSemiring

end Subalgebra

namespace IsScalarTower
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/LinearAlgebra/FreeModule/PID.lean
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ noncomputable def Module.basisOfFiniteTypeTorsionFree [Fintype ι] {s : ι → M
have : LinearMap.range φ ≤ N := by
-- as announced, `A • M ⊆ N`
suffices ∀ i, φ (s i) ∈ N by
rw [LinearMap.range_eq_map, ← hs, φ.map_span_le]
rw [LinearMap.range_eq_map, ← hs, map_span_le]
rintro _ ⟨i, rfl⟩
apply this
intro i
Expand Down
20 changes: 10 additions & 10 deletions Mathlib/LinearAlgebra/Span.lean
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ variable {x : M} (p p' : Submodule R M)

variable [Semiring R₂] {σ₁₂ : R →+* R₂}

variable [AddCommMonoid M₂] [Module R₂ M₂]
variable [AddCommMonoid M₂] [Module R₂ M₂] {F : Type _} [SemilinearMapClass F σ₁₂ M M₂]

section

Expand Down Expand Up @@ -92,7 +92,7 @@ theorem span_coe_eq_restrictScalars [Semiring S] [SMul S R] [Module S M] [IsScal
span_eq (p.restrictScalars S)
#align submodule.span_coe_eq_restrict_scalars Submodule.span_coe_eq_restrictScalars

theorem map_span [RingHomSurjective σ₁₂] (f : M →ₛₗ[σ₁₂] M₂) (s : Set M) :
theorem map_span [RingHomSurjective σ₁₂] (f : F) (s : Set M) :
(span R s).map f = span R₂ (f '' s) :=
Eq.symm <|
span_eq_of_le _ (Set.image_subset f subset_span) <|
Expand All @@ -102,9 +102,9 @@ theorem map_span [RingHomSurjective σ₁₂] (f : M →ₛₗ[σ₁₂] M₂) (
alias Submodule.map_span ← _root_.LinearMap.map_span
#align linear_map.map_span LinearMap.map_span

theorem map_span_le [RingHomSurjective σ₁₂] (f : M →ₛₗ[σ₁₂] M₂) (s : Set M) (N : Submodule R₂ M₂) :
theorem map_span_le [RingHomSurjective σ₁₂] (f : F) (s : Set M) (N : Submodule R₂ M₂) :
map f (span R s) ≤ N ↔ ∀ m ∈ s, f m ∈ N := by
rw [f.map_span, span_le, Set.image_subset_iff]
rw [map_span, span_le, Set.image_subset_iff]
exact Iff.rfl
#align submodule.map_span_le Submodule.map_span_le

Expand All @@ -119,7 +119,7 @@ theorem span_insert_zero : span R (insert (0 : M) s) = span R s := by
#align submodule.span_insert_zero Submodule.span_insert_zero

-- See also `span_preimage_eq` below.
theorem span_preimage_le (f : M →ₛₗ[σ₁₂] M₂) (s : Set M₂) :
theorem span_preimage_le (f : F) (s : Set M₂) :
span R (f ⁻¹' s) ≤ (span R₂ s).comap f := by
rw [span_le, comap_coe]
exact preimage_mono subset_span
Expand Down Expand Up @@ -583,18 +583,18 @@ theorem span_singleton_eq_span_singleton {R M : Type _} [Ring R] [AddCommGroup M
#align submodule.span_singleton_eq_span_singleton Submodule.span_singleton_eq_span_singleton

@[simp]
theorem span_image [RingHomSurjective σ₁₂] (f : M →ₛₗ[σ₁₂] M₂) :
theorem span_image [RingHomSurjective σ₁₂] (f : F) :
span R₂ (f '' s) = map f (span R s) :=
(map_span f s).symm
#align submodule.span_image Submodule.span_image

theorem apply_mem_span_image_of_mem_span [RingHomSurjective σ₁₂] (f : M →ₛₗ[σ₁₂] M₂) {x : M}
theorem apply_mem_span_image_of_mem_span [RingHomSurjective σ₁₂] (f : F) {x : M}
{s : Set M} (h : x ∈ Submodule.span R s) : f x ∈ Submodule.span R₂ (f '' s) := by
rw [Submodule.span_image]
exact Submodule.mem_map_of_mem h
#align submodule.apply_mem_span_image_of_mem_span Submodule.apply_mem_span_image_of_mem_span

theorem apply_mem_span_image_iff_mem_span [RingHomSurjective σ₁₂] {f : M →ₛₗ[σ₁₂] M₂} {x : M}
theorem apply_mem_span_image_iff_mem_span [RingHomSurjective σ₁₂] {f : F} {x : M}
{s : Set M} (hf : Function.Injective f) :
f x ∈ Submodule.span R₂ (f '' s) ↔ x ∈ Submodule.span R s := by
rw [← Submodule.mem_comap, ← Submodule.map_span, Submodule.comap_map_eq_of_injective hf]
Expand All @@ -605,7 +605,7 @@ theorem map_subtype_span_singleton {p : Submodule R M} (x : p) :
#align submodule.map_subtype_span_singleton Submodule.map_subtype_span_singleton

/-- `f` is an explicit argument so we can `apply` this theorem and obtain `h` as a new goal. -/
theorem not_mem_span_of_apply_not_mem_span_image [RingHomSurjective σ₁₂] (f : M →ₛₗ[σ₁₂] M₂) {x : M}
theorem not_mem_span_of_apply_not_mem_span_image [RingHomSurjective σ₁₂] (f : F) {x : M}
{s : Set M} (h : f x ∉ Submodule.span R₂ (f '' s)) : x ∉ Submodule.span R s :=
h.imp (apply_mem_span_image_of_mem_span f)
#align submodule.not_mem_span_of_apply_not_mem_span_image Submodule.not_mem_span_of_apply_not_mem_span_image
Expand Down Expand Up @@ -837,7 +837,7 @@ variable [Ring R] [AddCommGroup M] [Module R M]
theorem span_neg (s : Set M) : span R (-s) = span R s :=
calc
span R (-s) = span R ((-LinearMap.id : M →ₗ[R] M) '' s) := by simp
_ = map (-LinearMap.id) (span R s) := ((-LinearMap.id).map_span _).symm
_ = map (-LinearMap.id) (span R s) := (map_span (-LinearMap.id) _).symm
_ = span R s := by simp
#align submodule.span_neg Submodule.span_neg

Expand Down
5 changes: 5 additions & 0 deletions Mathlib/NumberTheory/NumberField/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ theorem integralBasis_apply (i : Free.ChooseBasisIndex ℤ (𝓞 K)) :
Basis.localizationLocalization_apply ℚ (nonZeroDivisors ℤ) K (RingOfIntegers.basis K) i
#align number_field.integral_basis_apply NumberField.integralBasis_apply

theorem mem_span_integralBasis {x : K} :
x ∈ Submodule.span ℤ (Set.range (integralBasis K)) ↔ x ∈ 𝓞 K := by
rw [integralBasis, Basis.localizationLocalization_span, Subalgebra.range_isScalarTower_toAlgHom,
Subalgebra.mem_toSubmodule]

theorem RingOfIntegers.rank : FiniteDimensional.finrank ℤ (𝓞 K) = FiniteDimensional.finrank ℚ K :=
IsIntegralClosure.rank ℤ ℚ K (𝓞 K)
#align number_field.ring_of_integers.rank NumberField.RingOfIntegers.rank
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/RingTheory/Finiteness.lean
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ theorem fg_of_fg_map_injective (f : M →ₗ[R] P) (hf : Function.Injective f) {
let ⟨t, ht⟩ := hfn
⟨t.preimage f fun x _ y _ h => hf h,
Submodule.map_injective_of_injective hf <| by
rw [f.map_span, Finset.coe_preimage, Set.image_preimage_eq_inter_range,
rw [map_span, Finset.coe_preimage, Set.image_preimage_eq_inter_range,
Set.inter_eq_self_of_subset_left, ht]
rw [← LinearMap.range_coe, ← span_le, ht, ← map_top]
exact map_mono le_top⟩
Expand Down
8 changes: 8 additions & 0 deletions Mathlib/RingTheory/Localization/Module.lean
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ theorem Basis.localizationLocalization_repr_algebraMap {ι : Type _} (b : Basis
_ = algebraMap R Rₛ (b.repr x i) := by simp [Algebra.smul_def]
#align basis.localization_localization_repr_algebra_map Basis.localizationLocalization_repr_algebraMap

theorem Basis.localizationLocalization_span {ι : Type _} (b : Basis ι R A) :
Submodule.span R (Set.range (b.localizationLocalization Rₛ S Aₛ)) =
LinearMap.range (IsScalarTower.toAlgHom R A Aₛ) :=
calc span R (Set.range ↑(localizationLocalization Rₛ S Aₛ b))
_ = span R (↑(IsScalarTower.toAlgHom R A Aₛ) '' Set.range ↑b) := by congr; ext; simp
_ = map (IsScalarTower.toAlgHom R A Aₛ) (span R (Set.range b)) := by rw [Submodule.map_span]
_ = LinearMap.range (IsScalarTower.toAlgHom R A Aₛ) := by rw [b.span_eq, Submodule.map_top]

end LocalizationLocalization

end Localization
Expand Down

0 comments on commit 6538bed

Please sign in to comment.