Skip to content

Commit 0ddb962

Browse files
committed
refactor: make Set into a one-field structure
1 parent 76948d8 commit 0ddb962

118 files changed

Lines changed: 464 additions & 426 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/Algebra/DirectSum/Module.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ theorem linearMap_ext ⦃ψ ψ' : (⨁ i, M i) →ₗ[R] N⦄
140140
/-- The inclusion of a subset of the direct summands
141141
into a larger subset of the direct summands, as a linear map. -/
142142
def lsetToSet (S T : Set ι) (H : S ⊆ T) : (⨁ i : S, M i) →ₗ[R] ⨁ i : T, M i :=
143-
toModule R _ _ fun i ↦ lof R T (fun i : Subtype T ↦ M i) ⟨i, H i.prop⟩
143+
toModule R _ _ fun i ↦ lof R T (fun i : T ↦ M i) ⟨i, H i.prop⟩
144144

145145
variable (ι M)
146146

Mathlib/Algebra/FreeAlgebra.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ theorem induction {motive : FreeAlgebra R X → Prop}
548548
(a : FreeAlgebra R X) : motive a := by
549549
-- the arguments are enough to construct a subalgebra, and a mapping into it from X
550550
let s : Subalgebra R (FreeAlgebra R X) :=
551-
{ carrier := motive
551+
{ carrier := {x | motive x}
552552
mul_mem' := mul _ _
553553
add_mem' := add _ _
554554
algebraMap_mem' := grade0 }

Mathlib/Algebra/Group/Action/Equidecomp.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ open scoped Classical in
163163
theorem IsDecompOn.comp {g f : X → X} {B A : Set X} {T S : Finset G}
164164
(hg : IsDecompOn g B T) (hf : IsDecompOn f A S) (h : MapsTo f A B) :
165165
IsDecompOn (g ∘ f) A (T * S) := by
166-
rw [left_eq_inter.mpr h]
166+
rw [left_eq_inter.mpr h.subset_preimage]
167167
exact hg.comp' hf
168168

169169
/-- The composition of two equidecompositions as an equidecomposition. -/

Mathlib/Algebra/Group/Irreducible/Indecomposable.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ def IsMulIndecomposable (v : ι → M) (s : Set ι) (i : ι) : Prop :=
3232

3333
@[to_additive]
3434
protected lemma IsMulIndecomposable.subset (v : ι → M) (s : Set ι) :
35-
{i | IsMulIndecomposable v s i} ⊆ s := by
36-
aesop
35+
{i | IsMulIndecomposable v s i} ⊆ s := fun _ hi ↦ hi.1
3736

3837
@[to_additive]
3938
lemma isMulIndecomposable_id_univ [Subsingleton Mˣ] {x : M} (hx : x ≠ 1) :

Mathlib/Algebra/GroupWithZero/NonZeroDivisors.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ lemma mem_nonZeroDivisorsLeft_iff : x ∈ nonZeroDivisorsLeft M₀ ↔ ∀ y, x
5555

5656
lemma notMem_nonZeroDivisorsLeft_iff :
5757
x ∉ nonZeroDivisorsLeft M₀ ↔ {y | x * y = 0 ∧ y ≠ 0}.Nonempty := by
58-
simpa [mem_nonZeroDivisorsLeft_iff] using! Set.nonempty_def.symm
58+
simp [mem_nonZeroDivisorsLeft_iff, Set.Nonempty]
5959

6060
/-- The collection of elements of a `MonoidWithZero` that are not right zero divisors form a
6161
`Submonoid`. -/
@@ -69,7 +69,7 @@ lemma mem_nonZeroDivisorsRight_iff : x ∈ nonZeroDivisorsRight M₀ ↔ ∀ y,
6969

7070
lemma notMem_nonZeroDivisorsRight_iff :
7171
x ∉ nonZeroDivisorsRight M₀ ↔ {y | y * x = 0 ∧ y ≠ 0}.Nonempty := by
72-
simpa [mem_nonZeroDivisorsRight_iff] using! Set.nonempty_def.symm
72+
simp [mem_nonZeroDivisorsRight_iff, Set.Nonempty]
7373

7474
lemma nonZeroDivisorsLeft_eq_right (M₀ : Type*) [CommMonoidWithZero M₀] :
7575
nonZeroDivisorsLeft M₀ = nonZeroDivisorsRight M₀ := by

Mathlib/Algebra/Module/FinitePresentation.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ lemma Module.finitePresentation_of_surjective [h : Module.FinitePresentation R M
171171
obtain ⟨t, ht⟩ := hl'
172172
have H : Function.Surjective (Finsupp.linearCombination R ((↑) : s → M)) :=
173173
LinearMap.range_eq_top.mp
174-
(by rw [range_linearCombination, Subtype.range_val, ← hs])
174+
(by rw [range_linearCombination, Subtype.range_coe_subtype, ← hs]; rfl)
175175
apply Module.finitePresentation_of_free_of_surjective (l ∘ₗ linearCombination R Subtype.val)
176176
(hl.comp H)
177177
choose σ hσ using (show _ from H)
@@ -188,7 +188,7 @@ lemma Module.FinitePresentation.fg_ker [Module.Finite R M]
188188
obtain ⟨s, hs, hs'⟩ := h
189189
have H : Function.Surjective (Finsupp.linearCombination R ((↑) : s → N)) :=
190190
LinearMap.range_eq_top.mp
191-
(by rw [range_linearCombination, Subtype.range_val, ← hs])
191+
(by rw [range_linearCombination, Subtype.range_coe_subtype, ← hs]; rfl)
192192
obtain ⟨f, hf⟩ : ∃ f : (s →₀ R) →ₗ[R] M, l ∘ₗ f = (Finsupp.linearCombination R Subtype.val) := by
193193
choose f hf using show _ from hl
194194
exact ⟨Finsupp.linearCombination R (fun i ↦ f i), by ext; simp [hf]⟩
@@ -221,7 +221,7 @@ lemma Module.finitePresentation_of_ker [Module.FinitePresentation R N]
221221
let π := Finsupp.linearCombination R ((↑) : s → M)
222222
have H : Function.Surjective π :=
223223
LinearMap.range_eq_top.mp
224-
(by rw [range_linearCombination, Subtype.range_val, ← hs])
224+
(by rw [range_linearCombination, Subtype.range_coe_subtype, ← hs]; rfl)
225225
have inst : Module.Finite R (LinearMap.ker (l ∘ₗ π)) :=
226226
.of_fg <| Module.FinitePresentation.fg_ker _ (hl.comp H)
227227
let f : LinearMap.ker (l ∘ₗ π) →ₗ[R] LinearMap.ker l := LinearMap.restrict π (fun x ↦ id)
@@ -365,7 +365,7 @@ lemma Module.FinitePresentation.exists_lift_of_isLocalizedModule
365365
let π := Finsupp.linearCombination R ((↑) : σ → M)
366366
have hπ : Function.Surjective π :=
367367
LinearMap.range_eq_top.mp
368-
(by rw [range_linearCombination, Subtype.range_val, ← hσ])
368+
(by rw [range_linearCombination, Subtype.range_coe_subtype, ← hσ]; rfl)
369369
classical
370370
choose s hs using IsLocalizedModule.surj S f
371371
let i : σ → N :=

Mathlib/Algebra/Module/ZLattice/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ theorem volume_real_fundamentalDomain [Fintype ι] [DecidableEq ι] (b : Basis
399399

400400
theorem fundamentalDomain_ae_parallelepiped [Fintype ι] [MeasurableSpace E] (μ : Measure E)
401401
[BorelSpace E] [Measure.IsAddHaarMeasure μ] :
402-
fundamentalDomain b =[μ] parallelepiped b := by
402+
fundamentalDomain b =ᵐˢ[μ] parallelepiped b := by
403403
classical
404404
have : FiniteDimensional ℝ E := b.finiteDimensional_of_finite
405405
rw [← measure_symmDiff_eq_zero_iff, symmDiff_of_le (fundamentalDomain_subset_parallelepiped b)]

Mathlib/Algebra/MonoidAlgebra/Grading.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ abbrev gradeBy (f : M → ι) (i : ι) : Submodule R R[M] where
5252
zero_mem' m h := by cases h
5353
add_mem' {a b} ha hb m h := by
5454
classical exact (Finset.mem_union.mp (Finsupp.support_add h)).elim (ha m) (hb m)
55-
smul_mem' _ _ h := Set.Subset.trans Finsupp.support_smul h
55+
smul_mem' _ _ h m hm := h m (Finsupp.support_smul hm)
5656

5757
/-- The submodule corresponding to each grade. -/
5858
abbrev grade (m : M) : Submodule R R[M] :=
@@ -61,11 +61,11 @@ abbrev grade (m : M) : Submodule R R[M] :=
6161
theorem gradeBy_id : gradeBy R (id : M → M) = grade R := rfl
6262

6363
theorem mem_gradeBy_iff (f : M → ι) (i : ι) (a : R[M]) :
64-
a ∈ gradeBy R f i ↔ (a.coeff.support : Set M) ⊆ f ⁻¹' {i} := by rfl
64+
a ∈ gradeBy R f i ↔ (a.coeff.support : Set M) ⊆ f ⁻¹' {i} :=
65+
fun h m hm => h m hm, fun h _ hm => h hm⟩
6566

6667
theorem mem_grade_iff (m : M) (a : R[M]) : a ∈ grade R m ↔ a.coeff.support ⊆ {m} := by
67-
rw [← Finset.coe_subset, Finset.coe_singleton]
68-
rfl
68+
simp [← Finset.coe_subset]
6969

7070
theorem mem_grade_iff' (m : M) (a : R[M]) :
7171
a ∈ grade R m ↔ a ∈ LinearMap.range (lsingle (R := R) m) := by

Mathlib/Algebra/Order/Archimedean/Class.lean

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,11 @@ theorem mk_mabs (a : M) : mk |a|ₘ = mk a :=
259259
instance [Subsingleton M] : Subsingleton (MulArchimedeanClass M) :=
260260
inferInstanceAs (Subsingleton (Antisymmetrization ..))
261261

262+
-- Shortcut instance for computability
263+
@[to_additive]
264+
instance : PartialOrder (MulArchimedeanClass M) :=
265+
inferInstanceAs <| PartialOrder (Antisymmetrization (MulArchimedeanOrder M) (· ≤ ·))
266+
262267
@[to_additive]
263268
noncomputable
264269
instance : LinearOrder (MulArchimedeanClass M) :=

Mathlib/Algebra/Order/Ring/StandardPart.lean

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -460,13 +460,8 @@ theorem stdPart_eq_sInf (f : ℝ →+*o K) (x : K) : stdPart x = sInf {r | x < f
460460
exact hs.le.trans (f.monotone' hs'.le)
461461
· rw [stdPart_of_mk_ne_zero hx.ne]
462462
have hr {r} := hx.trans_le (mk_map_nonneg_of_archimedean f r)
463-
obtain h | h := le_or_gt 0 x
464-
· convert! Real.sInf_empty.symm
465-
rw [Set.eq_empty_iff_forall_notMem]
466-
exact fun r ↦ (lt_of_mk_lt_mk_of_nonneg hr h).not_gt
467-
· convert! Real.sInf_univ.symm
468-
rw [Set.eq_univ_iff_forall]
469-
exact fun r ↦ lt_of_mk_lt_mk_of_nonpos hr h.le
463+
obtain hx | hx := le_total 0 x <;>
464+
simp [(lt_of_mk_lt_mk_of_nonneg hr _).not_gt, lt_of_mk_lt_mk_of_nonpos hr, *]
470465

471466
theorem stdPart_eq_sSup (f : ℝ →+*o K) (x : K) : stdPart x = sSup {r | f r < x} := by
472467
rw [← neg_inj, ← stdPart_neg, stdPart_eq_sInf f, ← Real.sInf_neg]

0 commit comments

Comments
 (0)