Skip to content

Commit df04ddf

Browse files
authored
Merge branch 'master' into IsSelfAdjoint-structure
2 parents d2335f7 + 05e1c7a commit df04ddf

46 files changed

Lines changed: 899 additions & 245 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Mathlib.lean

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2755,6 +2755,7 @@ import Mathlib.Combinatorics.Quiver.Cast
27552755
import Mathlib.Combinatorics.Quiver.ConnectedComponent
27562756
import Mathlib.Combinatorics.Quiver.Covering
27572757
import Mathlib.Combinatorics.Quiver.Path
2758+
import Mathlib.Combinatorics.Quiver.Path.Weight
27582759
import Mathlib.Combinatorics.Quiver.Prefunctor
27592760
import Mathlib.Combinatorics.Quiver.Push
27602761
import Mathlib.Combinatorics.Quiver.ReflQuiver
@@ -4035,6 +4036,7 @@ import Mathlib.LinearAlgebra.Dimension.Subsingleton
40354036
import Mathlib.LinearAlgebra.Dimension.Torsion.Basic
40364037
import Mathlib.LinearAlgebra.Dimension.Torsion.Finite
40374038
import Mathlib.LinearAlgebra.DirectSum.Basis
4039+
import Mathlib.LinearAlgebra.DirectSum.Finite
40384040
import Mathlib.LinearAlgebra.DirectSum.Finsupp
40394041
import Mathlib.LinearAlgebra.DirectSum.TensorProduct
40404042
import Mathlib.LinearAlgebra.Dual.Basis

Mathlib/Algebra/BigOperators/Group/Finset/Basic.lean

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -369,19 +369,9 @@ lemma prod_congr_of_eq_on_inter {ι M : Type*} {s₁ s₂ : Finset ι} {f g : ι
369369
theorem prod_eq_mul_of_mem {s : Finset ι} {f : ι → M} (a b : ι) (ha : a ∈ s) (hb : b ∈ s)
370370
(hn : a ≠ b) (h₀ : ∀ c ∈ s, c ≠ a ∧ c ≠ b → f c = 1) : ∏ x ∈ s, f x = f a * f b := by
371371
haveI := Classical.decEq ι; let s' := ({a, b} : Finset ι)
372-
have hu : s' ⊆ s := by
373-
refine insert_subset_iff.mpr ?_
374-
apply And.intro ha
375-
apply singleton_subset_iff.mpr hb
376-
have hf : ∀ c ∈ s, c ∉ s' → f c = 1 := by
377-
intro c hc hcs
378-
apply h₀ c hc
379-
apply not_or.mp
380-
intro hab
381-
apply hcs
382-
rw [mem_insert, mem_singleton]
383-
exact hab
384-
rw [← prod_subset hu hf]
372+
have hu : s' ⊆ s := by grind [Finset.insert_subset_iff, Finset.singleton_subset_iff]
373+
have hf : ∀ c ∈ s, c ∉ s' → f c = 1 := by grind [Finset.mem_insert, Finset.mem_singleton]
374+
rw [← Finset.prod_subset hu hf]
385375
exact Finset.prod_pair hn
386376

387377
@[to_additive]

Mathlib/Algebra/Category/CoalgCat/ComonEquivalence.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ attribute [local simp] Mon_Class.tensorObj.one_def Mon_Class.tensorObj.mul_def i
165165
theorem comul_tensorObj_tensorObj_right :
166166
Coalgebra.comul (R := R) (A := (CoalgCat.of R M ⊗
167167
(CoalgCat.of R N ⊗ CoalgCat.of R P) : CoalgCat R))
168-
= Coalgebra.comul (A := M ⊗[R] N ⊗[R] P) := by
168+
= Coalgebra.comul (A := M ⊗[R] (N ⊗[R] P)) := by
169169
rw [ofComonObjCoalgebraStruct_comul]
170170
simp only [Comon_.monoidal_tensorObj_comon_comul]
171171
simp [tensorμ_eq_tensorTensorTensorComm, TensorProduct.comul_def,
@@ -176,7 +176,7 @@ attribute [local simp] Mon_Class.tensorObj.one_def Mon_Class.tensorObj.mul_def i
176176
theorem comul_tensorObj_tensorObj_left :
177177
Coalgebra.comul (R := R)
178178
(A := ((CoalgCat.of R M ⊗ CoalgCat.of R N) ⊗ CoalgCat.of R P : CoalgCat R))
179-
= Coalgebra.comul (A := (M ⊗[R] N) ⊗[R] P) := by
179+
= Coalgebra.comul (A := M ⊗[R] N ⊗[R] P) := by
180180
rw [ofComonObjCoalgebraStruct_comul]
181181
dsimp
182182
simp only [toComonObj]

Mathlib/Algebra/Group/Subgroup/Defs.lean

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -322,18 +322,18 @@ theorem mem_carrier {s : Subgroup G} {x : G} : x ∈ s.carrier ↔ x ∈ s :=
322322
Iff.rfl
323323

324324
@[to_additive (attr := simp)]
325-
theorem mem_mk {s : Set G} {x : G} (h_one) (h_mul) (h_inv) :
326-
x ∈ mk ⟨⟨s, h_one⟩, h_mul⟩ h_inv ↔ x ∈ s :=
325+
theorem mem_mk {s : Submonoid G} {x : G} (h_inv) :
326+
x ∈ mk s h_inv ↔ x ∈ s :=
327327
Iff.rfl
328328

329-
@[to_additive (attr := simp, norm_cast)]
330-
theorem coe_set_mk {s : Set G} (h_one) (h_mul) (h_inv) :
331-
(mk ⟨⟨s, h_one⟩, h_mul⟩ h_inv : Set G) = s :=
329+
@[to_additive (attr := simp)]
330+
theorem coe_set_mk {s : Submonoid G} (h_inv) :
331+
(mk s h_inv : Set G) = s :=
332332
rfl
333333

334334
@[to_additive (attr := simp)]
335-
theorem mk_le_mk {s t : Set G} (h_one) (h_mul) (h_inv) (h_one') (h_mul') (h_inv') :
336-
mk ⟨⟨s, h_one⟩, h_mul⟩ h_inv ≤ mk ⟨⟨t, h_one'⟩, h_mul'⟩ h_inv' ↔ s t :=
335+
theorem mk_le_mk {s t : Submonoid G} (h_inv) (h_inv') :
336+
mk s h_inv ≤ mk t h_inv' ↔ s t :=
337337
Iff.rfl
338338

339339
@[to_additive (attr := simp)]

Mathlib/Algebra/Group/Subgroup/Ker.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ theorem ker_id : (MonoidHom.id G).ker = ⊥ :=
293293
rfl
294294

295295
@[to_additive] theorem ker_eq_top_iff {f : G →* M} : f.ker = ⊤ ↔ f = 1 := by
296-
simp_rw [ker, ← top_le_iff, SetLike.le_def, f.ext_iff, Subgroup.mem_top, true_imp_iff]; rfl
296+
simp [ker, ← top_le_iff, SetLike.le_def, f.ext_iff]
297297

298298
@[to_additive] theorem range_eq_bot_iff {f : G →* G'} : f.range = ⊥ ↔ f = 1 := by
299299
rw [← le_bot_iff, f.range_eq_map, map_le_iff_le_comap, top_le_iff, comap_bot, ker_eq_top_iff]

Mathlib/Algebra/MonoidAlgebra/NoZeroDivisors.lean

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,14 @@ theorem mul_apply_mul_eq_mul_of_uniqueMul [Mul A] {f g : MonoidAlgebra R A} {a0
7272
classical
7373
simp_rw [mul_apply, sum, ← Finset.sum_product']
7474
refine (Finset.sum_eq_single (a0, b0) ?_ ?_).trans (if_pos rfl) <;> simp_rw [Finset.mem_product]
75-
· refine fun ab hab hne => if_neg (fun he => hne <| Prod.ext ?_ ?_)
75+
· refine fun ab hab hne if_neg (fun he hne <| Prod.ext ?_ ?_)
7676
exacts [(h hab.1 hab.2 he).1, (h hab.1 hab.2 he).2]
77-
· refine fun hnotMem => ite_eq_right_iff.mpr (fun _ => ?_)
77+
· refine fun hnotMem ite_eq_right_iff.mpr (fun _ ?_)
7878
rcases not_and_or.mp hnotMem with af | bg
7979
· rw [notMem_support_iff.mp af, zero_mul]
8080
· rw [notMem_support_iff.mp bg, mul_zero]
8181

82-
instance instNoZeroDivisorsOfUniqueProds [NoZeroDivisors R] [Mul A] [UniqueProds A] :
83-
NoZeroDivisors (MonoidAlgebra R A) where
82+
instance [NoZeroDivisors R] [Mul A] [UniqueProds A] : NoZeroDivisors (MonoidAlgebra R A) where
8483
eq_zero_or_eq_zero_of_mul_eq_zero {a b} ab := by
8584
contrapose! ab
8685
obtain ⟨da, a0, db, b0, h⟩ := UniqueProds.uniqueMul_of_nonempty
@@ -89,6 +88,34 @@ instance instNoZeroDivisorsOfUniqueProds [NoZeroDivisors R] [Mul A] [UniqueProds
8988
rw [mem_support_iff] at a0 b0 ⊢
9089
exact mul_apply_mul_eq_mul_of_uniqueMul h ▸ mul_ne_zero a0 b0
9190

91+
instance [IsCancelAdd R] [IsLeftCancelMulZero R] [Mul A] [UniqueProds A] :
92+
IsLeftCancelMulZero (MonoidAlgebra R A) where
93+
mul_left_cancel_of_ne_zero {f g₁ g₂} hf eq := by
94+
classical
95+
induction hg : g₁.support ∪ g₂.support using Finset.eraseInduction generalizing g₁ g₂ with
96+
| _ s ih =>
97+
obtain h | h := s.eq_empty_or_nonempty <;> subst s
98+
· simp_rw [Finset.union_eq_empty, support_eq_empty] at h; exact h.1.trans h.2.symm
99+
have ⟨af, haf, ag, hag, uniq⟩ := UniqueProds.uniqueMul_of_nonempty (support_nonempty_iff.2 hf) h
100+
have h := mul_apply_mul_eq_mul_of_uniqueMul (uniq.mono subset_rfl Finset.subset_union_left)
101+
rw [eq, mul_apply_mul_eq_mul_of_uniqueMul (uniq.mono subset_rfl Finset.subset_union_right)] at h
102+
have := mul_left_cancel₀ (mem_support_iff.mp haf) h
103+
rw [← g₁.erase_add_single ag, ← g₂.erase_add_single ag, this] at eq ⊢
104+
simp_rw [mul_add, add_right_cancel_iff] at eq
105+
rw [ih ag hag eq]
106+
simp_rw [support_erase, Finset.erase_union_distrib]
107+
108+
instance [IsCancelAdd R] [IsRightCancelMulZero R] [Mul A] [UniqueProds A] :
109+
IsRightCancelMulZero (MonoidAlgebra R A) :=
110+
MulOpposite.isLeftCancelMulZero_iff.mp <|
111+
MonoidAlgebra.opRingEquiv.injective.isLeftCancelMulZero _ (map_zero _) (map_mul _)
112+
113+
instance [IsCancelAdd R] [IsCancelMulZero R] [Mul A] [UniqueProds A] :
114+
IsCancelMulZero (MonoidAlgebra R A) where
115+
116+
instance [IsCancelAdd R] [IsDomain R] [Monoid A] [UniqueProds A] :
117+
IsDomain (MonoidAlgebra R A) where
118+
92119
end MonoidAlgebra
93120

94121
namespace AddMonoidAlgebra
@@ -100,26 +127,20 @@ theorem mul_apply_add_eq_mul_of_uniqueAdd [Add A] {f g : R[A]} {a0 b0 : A}
100127
(f * g) (a0 + b0) = f a0 * g b0 :=
101128
MonoidAlgebra.mul_apply_mul_eq_mul_of_uniqueMul (A := Multiplicative A) h
102129

103-
instance instNoZeroDivisorsOfUniqueSums [NoZeroDivisors R] [Add A] [UniqueSums A] :
104-
NoZeroDivisors R[A] := MonoidAlgebra.instNoZeroDivisorsOfUniqueProds (A := Multiplicative A)
105-
106-
end AddMonoidAlgebra
107-
end Semiring
108-
109-
section Ring
110-
variable [Ring R] [IsDomain R]
130+
instance [NoZeroDivisors R] [Add A] [UniqueSums A] : NoZeroDivisors R[A] :=
131+
inferInstanceAs (NoZeroDivisors (MonoidAlgebra R (Multiplicative A)))
111132

112-
namespace MonoidAlgebra
133+
instance [IsCancelAdd R] [IsLeftCancelMulZero R] [Add A] [UniqueSums A] :
134+
IsLeftCancelMulZero R[A] :=
135+
inferInstanceAs (IsLeftCancelMulZero (MonoidAlgebra R (Multiplicative A)))
113136

114-
instance instIsDomainOfUniqueProds [Monoid A] [UniqueProds A] : IsDomain (MonoidAlgebra R A) :=
115-
NoZeroDivisors.to_isDomain _
137+
instance [IsCancelAdd R] [IsRightCancelMulZero R] [Add A] [UniqueSums A] :
138+
IsRightCancelMulZero R[A] :=
139+
inferInstanceAs (IsRightCancelMulZero (MonoidAlgebra R (Multiplicative A)))
116140

117-
end MonoidAlgebra
141+
instance [IsCancelAdd R] [IsCancelMulZero R] [Add A] [UniqueSums A] : IsCancelMulZero R[A] where
118142

119-
namespace AddMonoidAlgebra
120-
121-
instance instIsDomainOfUniqueSums [AddMonoid A] [UniqueSums A] : IsDomain R[A] :=
122-
NoZeroDivisors.to_isDomain _
143+
instance [IsCancelAdd R] [IsDomain R] [AddMonoid A] [UniqueSums A] : IsDomain R[A] where
123144

124145
end AddMonoidAlgebra
125-
end Ring
146+
end Semiring

Mathlib/Algebra/MvPolynomial/Basic.lean

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import Mathlib.Algebra.Algebra.Subalgebra.Lattice
77
import Mathlib.Algebra.Algebra.Tower
88
import Mathlib.Algebra.GroupWithZero.Divisibility
99
import Mathlib.Algebra.MonoidAlgebra.Basic
10+
import Mathlib.Algebra.MonoidAlgebra.NoZeroDivisors
1011
import Mathlib.Algebra.MonoidAlgebra.Support
1112
import Mathlib.Algebra.Regular.Pow
1213
import Mathlib.Data.Finsupp.Antidiagonal
@@ -243,6 +244,16 @@ instance infinite_of_nonempty (σ : Type*) (R : Type*) [Nonempty σ] [CommSemiri
243244
Infinite.of_injective ((fun s : σ →₀ ℕ => monomial s 1) ∘ Finsupp.single (Classical.arbitrary σ))
244245
<| (monomial_left_injective one_ne_zero).comp (Finsupp.single_injective _)
245246

247+
instance [CommSemiring R] [NoZeroDivisors R] : NoZeroDivisors (MvPolynomial σ R) :=
248+
inferInstanceAs (NoZeroDivisors (AddMonoidAlgebra ..))
249+
250+
instance [CommSemiring R] [IsCancelAdd R] [IsCancelMulZero R] :
251+
IsCancelMulZero (MvPolynomial σ R) :=
252+
inferInstanceAs (IsCancelMulZero (AddMonoidAlgebra ..))
253+
254+
/-- The multivariate polynomial ring over an integral domain is an integral domain. -/
255+
instance [CommSemiring R] [IsCancelAdd R] [IsDomain R] : IsDomain (MvPolynomial σ R) where
256+
246257
theorem C_eq_coe_nat (n : ℕ) : (C ↑n : MvPolynomial σ R) = n := by
247258
induction n <;> simp [*]
248259

Mathlib/Algebra/MvPolynomial/Funext.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ Authors: Johan Commelin
55
-/
66
import Mathlib.Algebra.Polynomial.RingDivision
77
import Mathlib.Algebra.Polynomial.Roots
8+
import Mathlib.Algebra.MvPolynomial.CommRing
89
import Mathlib.Algebra.MvPolynomial.Polynomial
910
import Mathlib.Algebra.MvPolynomial.Rename
10-
import Mathlib.RingTheory.Polynomial.Basic
1111

1212
/-!
1313
## Function extensionality for multivariate polynomials

Mathlib/Algebra/Polynomial/Basic.lean

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Chris Hughes, Johannes Hölzl, Kim Morrison, Jens Wagemaker
55
-/
66
import Mathlib.Algebra.Group.Submonoid.Operations
7-
import Mathlib.Algebra.MonoidAlgebra.Defs
7+
import Mathlib.Algebra.MonoidAlgebra.NoZeroDivisors
88
import Mathlib.Algebra.Order.Monoid.Unbundled.WithTop
99
import Mathlib.Algebra.Ring.Action.Rat
1010
import Mathlib.Data.Finset.Sort
@@ -1146,7 +1146,7 @@ instance commRing [CommRing R] : CommRing R[X] :=
11461146
{ toRing := Polynomial.ring
11471147
mul_comm := mul_comm }
11481148

1149-
section NonzeroSemiring
1149+
section Semiring
11501150

11511151
variable [Semiring R]
11521152

@@ -1160,7 +1160,20 @@ instance nontrivial [Nontrivial R] : Nontrivial R[X] := by
11601160
theorem X_ne_zero [Nontrivial R] : (X : R[X]) ≠ 0 :=
11611161
mt (congr_arg fun p => coeff p 1) (by simp)
11621162

1163-
end NonzeroSemiring
1163+
instance [NoZeroDivisors R] : NoZeroDivisors R[X] :=
1164+
(toFinsuppIso R).injective.noZeroDivisors _ (map_zero _) (map_mul _)
1165+
1166+
instance [IsCancelAdd R] [IsLeftCancelMulZero R] : IsLeftCancelMulZero R[X] :=
1167+
(toFinsuppIso R).injective.isLeftCancelMulZero _ (map_zero _) (map_mul _)
1168+
1169+
instance [IsCancelAdd R] [IsRightCancelMulZero R] : IsRightCancelMulZero R[X] :=
1170+
(toFinsuppIso R).injective.isRightCancelMulZero _ (map_zero _) (map_mul _)
1171+
1172+
instance [IsCancelAdd R] [IsCancelMulZero R] : IsCancelMulZero R[X] where
1173+
1174+
instance [IsCancelAdd R] [IsDomain R] : IsDomain R[X] where
1175+
1176+
end Semiring
11641177

11651178
section DivisionSemiring
11661179
variable [DivisionSemiring R]

Mathlib/Algebra/Polynomial/Degree/Domain.lean

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ section Semiring
3030

3131
variable [Semiring R] [NoZeroDivisors R] {p q : R[X]}
3232

33-
instance : NoZeroDivisors R[X] where
34-
eq_zero_or_eq_zero_of_mul_eq_zero h := by
35-
rw [← leadingCoeff_eq_zero, ← leadingCoeff_eq_zero]
36-
refine eq_zero_or_eq_zero_of_mul_eq_zero ?_
37-
rw [← leadingCoeff_zero, ← leadingCoeff_mul, h]
38-
3933
lemma natDegree_mul (hp : p ≠ 0) (hq : q ≠ 0) : (p*q).natDegree = p.natDegree + q.natDegree := by
4034
rw [← Nat.cast_inj (R := WithBot ℕ), ← degree_eq_natDegree (mul_ne_zero hp hq),
4135
Nat.cast_add, ← degree_eq_natDegree hp, ← degree_eq_natDegree hq, degree_mul]
@@ -97,11 +91,4 @@ lemma natDegree_sub_eq_of_prod_eq {p₁ p₂ q₁ q₂ : R[X]} (hp₁ : p₁ ≠
9791

9892
end Semiring
9993

100-
section Ring
101-
102-
variable [Ring R] [Nontrivial R] [IsDomain R] {p q : R[X]}
103-
104-
instance : IsDomain R[X] := NoZeroDivisors.to_isDomain _
105-
106-
end Ring
10794
end Polynomial

0 commit comments

Comments
 (0)