Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat: tensor algebra of free module over integral domain is a domain #9890

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
3055e86
feat: tensor algebra of free module over integral domain is a domain
bustercopley Jan 21, 2024
b99a098
Fix import order in Mathlib.lean
bustercopley Jan 21, 2024
934adb7
golf
eric-wieser Jan 21, 2024
b861593
Update module docstring
bustercopley Jan 21, 2024
4705499
little more golf
bustercopley Jan 21, 2024
e15c584
Use `MonoidAlgebra.instNoZeroDivisorsOfUniqueProds`
bustercopley Jan 21, 2024
5ab3655
golf
bustercopley Jan 21, 2024
819fade
golf
bustercopley Jan 22, 2024
31a084a
Find better homes for the instances
bustercopley Jan 22, 2024
3156084
FreeMonoid.instTwoUniqueProds
bustercopley Jan 22, 2024
37ad415
style
bustercopley Jan 22, 2024
13039c1
tiny golf
bustercopley Jan 22, 2024
b1fd445
tidy up
bustercopley Jan 22, 2024
30cf27c
golf
eric-wieser Jan 22, 2024
77ec13d
further golf
eric-wieser Jan 22, 2024
6dac9bc
renames
bustercopley Jan 22, 2024
f485d07
fix indentation
bustercopley Jan 22, 2024
18aa9ce
golf
bustercopley Jan 22, 2024
99eecd8
`IsDomain` instance for FreeAlgera
bustercopley Jan 22, 2024
4553c15
Update Mathlib/Algebra/Group/UniqueProds.lean
bustercopley Jan 22, 2024
79faa1b
of_graded_mul
bustercopley Jan 25, 2024
d259e58
golf whitespace
bustercopley Jan 25, 2024
833b4ab
delete "by exact"
bustercopley Jan 25, 2024
12ad50a
less re-use of names
bustercopley Jan 25, 2024
fcf4fdb
more docstrings
bustercopley Jan 28, 2024
23293d0
introduce `UniqueProds.of_mulHom` and refactor
alreadydone Feb 3, 2024
c777c75
rename `mulHom_image_of_injective` to `of_injective_mulHom`
alreadydone Feb 3, 2024
8d670d6
instance implicit
alreadydone Feb 3, 2024
f70e365
UniqueProds.mulHom_image_iff -> MulEquiv.uniqueProds_iff & deprecation
alreadydone Feb 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Mathlib/Algebra/FreeAlgebra.lean
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Authors: Scott Morrison, Adam Topaz, Eric Wieser
-/
import Mathlib.Algebra.Algebra.Subalgebra.Basic
import Mathlib.Algebra.Algebra.Tower
import Mathlib.Algebra.MonoidAlgebra.Basic
import Mathlib.Algebra.MonoidAlgebra.NoZeroDivisors
import Mathlib.RingTheory.Adjoin.Basic

#align_import algebra.free_algebra from "leanprover-community/mathlib"@"6623e6af705e97002a9054c1c05a980180276fc1"
Expand Down Expand Up @@ -474,6 +474,12 @@ noncomputable def equivMonoidAlgebraFreeMonoid :
instance [Nontrivial R] : Nontrivial (FreeAlgebra R X) :=
equivMonoidAlgebraFreeMonoid.surjective.nontrivial

instance instNoZeroDivisors [NoZeroDivisors R] : NoZeroDivisors (FreeAlgebra R X) :=
equivMonoidAlgebraFreeMonoid.toMulEquiv.noZeroDivisors

instance instIsDomain {R X} [CommRing R] [IsDomain R] : IsDomain (FreeAlgebra R X) :=
NoZeroDivisors.to_isDomain _

section

/-- The left-inverse of `algebraMap`. -/
Expand Down
42 changes: 42 additions & 0 deletions Mathlib/Algebra/Group/UniqueProds.lean
Original file line number Diff line number Diff line change
Expand Up @@ -622,3 +622,45 @@ instance {ι G} [AddZeroClass G] [TwoUniqueSums G] : TwoUniqueSums (ι →₀ G)
`TwoUniqueSums` because it's ordered. -/
instance [AddCommGroup G] [Module ℚ G] : TwoUniqueSums G :=
TwoUniqueSums.addHom_image_of_injective _ (Basis.ofVectorSpace ℚ G).repr.injective inferInstance

/-- Any `FreeMonoid` has the `TwoUniqueProds` property. -/
@[to_additive "Any `FreeAddMonoid` has the `TwoUniqueSums` property."]
instance FreeMonoid.instTwoUniqueProds {κ : Type*} : TwoUniqueProds (FreeMonoid κ) where
uniqueMul_of_one_lt_card {A} {B} h := by
have max_length {s : Finset (FreeMonoid κ)} (hs : s.Nonempty) :
∃ w ∈ s, ∀ u ∈ s, u.length ≤ w.length :=
have ⟨w, hws, hw⟩ := Finset.mem_image.1 <| (s.image (·.length)).max'_mem (hs.image _)
⟨w, hws, fun u hu => hw ▸ Finset.le_max' _ _ (Finset.mem_image.2 ⟨_, hu, rfl⟩)⟩
have min_length {s : Finset (FreeMonoid κ)} (hs : s.Nonempty) :
∃ w ∈ s, ∀ u ∈ s, w.length ≤ u.length :=
have ⟨w, hws, hw⟩ := Finset.mem_image.1 <| (s.image (·.length)).min'_mem (hs.image _)
⟨w, hws, fun u hu => hw ▸ Finset.min'_le _ _ (Finset.mem_image.2 ⟨_, hu, rfl⟩)⟩
have ⟨hA, hB, hAB⟩ := Nat.one_lt_mul_iff.mp h
rw [Finset.card_pos] at hA hB
have ⟨x, hxA, hx⟩ := max_length hA
have ⟨y, hyB, hy⟩ := max_length hB
have ⟨x', hx'A, hx'⟩ := min_length hA
have ⟨y', hy'B, hy'⟩ := min_length hB
by_cases heq : (x, y) = (x', y')
· rw [Finset.one_lt_card, Finset.one_lt_card] at hAB
obtain (⟨u, hu, v, hv, hne⟩ | ⟨u, hu, v, hv, hne⟩) := hAB
· have hl (u) (hu) := le_antisymm (hx u hu) (congrArg (·.1.length) heq ▸ hx' u hu)
exact ⟨(u, y), Finset.mk_mem_product hu hyB, (v, y), Finset.mk_mem_product hv hyB,
fun heq => hne (congrArg Prod.fst heq),
fun w z hw _ h => List.append_inj h <| (hl w hw).trans (hl u hu).symm,
fun w z hw _ h => List.append_inj h <| (hl w hw).trans (hl v hv).symm⟩
· have hl (u) (hu) := le_antisymm (hy u hu) (congrArg (·.2.length) heq ▸ hy' u hu)
exact ⟨(x, u), Finset.mk_mem_product hxA hu, (x, v), Finset.mk_mem_product hxA hv,
fun heq => hne (congrArg Prod.snd heq),
fun w z _ hz h => List.append_inj' h <| (hl z hz).trans (hl u hu).symm,
fun w z _ hz h => List.append_inj' h <| (hl z hz).trans (hl v hv).symm⟩
refine ⟨(x, y), Finset.mk_mem_product hxA hyB, (x', y'), Finset.mk_mem_product hx'A hy'B,
heq, fun u v hu hv h => ?_, fun u v hu hv h => ?_⟩
· exact List.append_inj h <| And.left <| by
rw [← add_eq_add_iff_eq_and_eq (hx u hu) (hy v hv),
← List.length_append, ← List.length_append]
exact congrArg List.length h
· exact List.append_inj h <| And.left <| by
rw [eq_comm, ← add_eq_add_iff_eq_and_eq (hx' u hu) (hy' v hv), eq_comm,
← List.length_append, ← List.length_append]
exact congrArg List.length h
4 changes: 4 additions & 0 deletions Mathlib/LinearAlgebra/TensorAlgebra/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ theorem algebraMap_eq_one_iff (x : R) : algebraMap R (TensorAlgebra R M) x = 1
map_eq_one_iff (algebraMap _ _) (algebraMap_leftInverse _).injective
#align tensor_algebra.algebra_map_eq_one_iff TensorAlgebra.algebraMap_eq_one_iff

/-- A `TensorAlgebra` over a nontrivial semiring is nontrivial. -/
instance [Nontrivial R] : Nontrivial (TensorAlgebra R M) :=
(algebraMap_leftInverse M).injective.nontrivial

variable {M}

/-- The canonical map from `TensorAlgebra R M` into `TrivSqZeroExt R M` that sends
Expand Down
8 changes: 8 additions & 0 deletions Mathlib/LinearAlgebra/TensorAlgebra/Basis.lean
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,19 @@ instance instModuleFree [Module.Free R M] : Module.Free R (TensorAlgebra R M) :=
let ⟨⟨_κ, b⟩⟩ := Module.Free.exists_basis (R := R) (M := M)
.of_basis b.tensorAlgebra

instance instNoZeroDivisors [NoZeroDivisors R] [Module.Free R M] :
NoZeroDivisors (TensorAlgebra R M) :=
have ⟨⟨κ, b⟩⟩ := ‹Module.Free R M›
(equivFreeAlgebra b).toMulEquiv.noZeroDivisors

end CommSemiring

section CommRing
variable [CommRing R] [AddCommGroup M] [Module R M]

instance instIsDomain [IsDomain R] [Module.Free R M] : IsDomain (TensorAlgebra R M) :=
bustercopley marked this conversation as resolved.
Show resolved Hide resolved
NoZeroDivisors.to_isDomain _

attribute [pp_with_univ] Cardinal.lift

open Cardinal in
Expand Down
Loading