Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit e1feab4

Browse files
committed
refactor(*): rename ordered groups/monoids to ordered add_ groups/monoids (#2347)
In the perfectoid project we need ordered commutative monoids, and they are multiplicative. So the additive versions should be renamed to make some place.
1 parent c9fca15 commit e1feab4

26 files changed

+106
-106
lines changed

scripts/nolints.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3492,4 +3492,4 @@ apply_nolint uniform_space.separation_setoid doc_blame
34923492

34933493
-- topology/uniform_space/uniform_embedding.lean
34943494
apply_nolint uniform_embedding doc_blame
3495-
apply_nolint uniform_inducing doc_blame
3495+
apply_nolint uniform_inducing doc_blame

src/algebra/archimedean.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ variables {α : Type*}
1212

1313
open_locale add_monoid
1414

15-
class archimedean (α) [ordered_comm_monoid α] : Prop :=
15+
class archimedean (α) [ordered_add_comm_monoid α] : Prop :=
1616
(arch : ∀ (x : α) {y}, 0 < y → ∃ n : ℕ, x ≤ n • y)
1717

1818
theorem exists_nat_gt [linear_ordered_semiring α] [archimedean α]

src/algebra/big_operators.lean

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ theorem dvd_sum [comm_semiring α] {a : α} {s : finset β} {f : β → α}
590590
(h : ∀ x ∈ s, a ∣ f x) : a ∣ s.sum f :=
591591
multiset.dvd_sum (λ y hy, by rcases multiset.mem_map.1 hy with ⟨x, hx, rfl⟩; exact h x hx)
592592

593-
lemma le_sum_of_subadditive [add_comm_monoid α] [ordered_comm_monoid β]
593+
lemma le_sum_of_subadditive [add_comm_monoid α] [ordered_add_comm_monoid β]
594594
(f : α → β) (h_zero : f 0 = 0) (h_add : ∀x y, f (x + y) ≤ f x + f y) (s : finset γ) (g : γ → α) :
595595
f (s.sum g) ≤ s.sum (λc, f (g c)) :=
596596
begin
@@ -793,8 +793,8 @@ end
793793

794794
end integral_domain
795795

796-
section ordered_comm_monoid
797-
variables [ordered_comm_monoid β]
796+
section ordered_add_comm_monoid
797+
variables [ordered_add_comm_monoid β]
798798

799799
lemma sum_le_sum : (∀x∈s, f x ≤ g x) → s.sum f ≤ s.sum g :=
800800
begin
@@ -839,10 +839,10 @@ have (singleton a).sum f ≤ s.sum f,
839839
(λ x e, (mem_singleton.1 e).symm ▸ h) (λ x h _, hf x h),
840840
by rwa sum_singleton at this
841841

842-
end ordered_comm_monoid
842+
end ordered_add_comm_monoid
843843

844-
section canonically_ordered_monoid
845-
variables [canonically_ordered_monoid β]
844+
section canonically_ordered_add_monoid
845+
variables [canonically_ordered_add_monoid β]
846846

847847
lemma sum_le_sum_of_subset (h : s₁ ⊆ s₂) : s₁.sum f ≤ s₂.sum f :=
848848
sum_le_sum_of_subset_of_nonneg h $ assume x h₁ h₂, zero_le _
@@ -857,7 +857,7 @@ calc s₁.sum f = (s₁.filter (λx, f x = 0)).sum f + (s₁.filter (λx, f x
857857
(sum_nonpos $ by simp only [mem_filter, and_imp]; exact λ _ _, le_of_eq)
858858
(sum_le_sum_of_subset $ by simpa only [subset_iff, mem_filter, and_imp])
859859

860-
end canonically_ordered_monoid
860+
end canonically_ordered_add_monoid
861861

862862
section ordered_cancel_comm_monoid
863863

@@ -1067,7 +1067,7 @@ open finset
10671067
open_locale classical
10681068

10691069
/-- sum of finite numbers is still finite -/
1070-
lemma sum_lt_top [ordered_comm_monoid β] {s : finset α} {f : α → with_top β} :
1070+
lemma sum_lt_top [ordered_add_comm_monoid β] {s : finset α} {f : α → with_top β} :
10711071
(∀a∈s, f a < ⊤) → s.sum f < ⊤ :=
10721072
finset.induction_on s (by { intro h, rw sum_empty, exact coe_lt_top _ })
10731073
(λa s ha ih h,
@@ -1078,7 +1078,7 @@ finset.induction_on s (by { intro h, rw sum_empty, exact coe_lt_top _ })
10781078
end)
10791079

10801080
/-- sum of finite numbers is still finite -/
1081-
lemma sum_lt_top_iff [canonically_ordered_monoid β] {s : finset α} {f : α → with_top β} :
1081+
lemma sum_lt_top_iff [canonically_ordered_add_monoid β] {s : finset α} {f : α → with_top β} :
10821082
s.sum f < ⊤ ↔ (∀a∈s, f a < ⊤) :=
10831083
iff.intro (λh a ha, lt_of_le_of_lt (single_le_sum (λa ha, zero_le _) ha) h) sum_lt_top
10841084

src/algebra/group_power.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ end
472472
@[field_simps] theorem pow_ne_zero [domain R] {a : R} (n : ℕ) (h : a ≠ 0) : a ^ n ≠ 0 :=
473473
mt pow_eq_zero h
474474

475-
theorem add_monoid.smul_nonneg [ordered_comm_monoid R] {a : R} (H : 0 ≤ a) : ∀ n : ℕ, 0 ≤ n • a
475+
theorem add_monoid.smul_nonneg [ordered_add_comm_monoid R] {a : R} (H : 0 ≤ a) : ∀ n : ℕ, 0 ≤ n • a
476476
| 0 := le_refl _
477477
| (n+1) := add_nonneg' H (add_monoid.smul_nonneg n)
478478

@@ -484,7 +484,7 @@ lemma abs_neg_one_pow [decidable_linear_ordered_comm_ring R] (n : ℕ) : abs ((-
484484
by rw [←pow_abs, abs_neg, abs_one, one_pow]
485485

486486
namespace add_monoid
487-
variable [ordered_comm_monoid A]
487+
variable [ordered_add_comm_monoid A]
488488

489489
theorem smul_le_smul {a : A} {n m : ℕ} (ha : 0 ≤ a) (h : n ≤ m) : n • a ≤ m • a :=
490490
let ⟨k, hk⟩ := nat.le.dest h in

src/algebra/order_functions.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ lemma min_mul_max [decidable_linear_order α] [comm_semigroup α] (n m : α) :
181181
min n m * max n m = n * m :=
182182
fn_min_mul_fn_max id n m
183183

184-
section decidable_linear_ordered_comm_group
184+
section decidable_linear_ordered_add_comm_group
185185
variables [decidable_linear_ordered_add_comm_group α] {a b c : α}
186186

187187
attribute [simp] abs_zero abs_neg
@@ -283,7 +283,7 @@ end
283283
lemma max_sub_min_eq_abs (a b : α) : max a b - min a b = abs (b - a) :=
284284
by { rw [abs_sub], exact max_sub_min_eq_abs' _ _ }
285285

286-
end decidable_linear_ordered_comm_group
286+
end decidable_linear_ordered_add_comm_group
287287

288288
section decidable_linear_ordered_semiring
289289
variables [decidable_linear_ordered_semiring α] {a b c d : α}

src/algebra/ordered_group.lean

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ set_option default_priority 100 -- see Note [default priority]
1818
/-- An ordered (additive) commutative monoid is a commutative monoid
1919
with a partial order such that addition is an order embedding, i.e.
2020
`a + b ≤ a + c ↔ b ≤ c`. These monoids are automatically cancellative. -/
21-
class ordered_comm_monoid (α : Type*) extends add_comm_monoid α, partial_order α :=
21+
class ordered_add_comm_monoid (α : Type*) extends add_comm_monoid α, partial_order α :=
2222
(add_le_add_left : ∀ a b : α, a ≤ b → ∀ c : α, c + a ≤ c + b)
2323
(lt_of_add_lt_add_left : ∀ a b c : α, a + b < a + c → b < c)
2424

@@ -27,22 +27,22 @@ class ordered_comm_monoid (α : Type*) extends add_comm_monoid α, partial_order
2727
which is to say, `a ≤ b` iff there exists `c` with `b = a + c`.
2828
This is satisfied by the natural numbers, for example, but not
2929
the integers or other ordered groups. -/
30-
class canonically_ordered_monoid (α : Type*) extends ordered_comm_monoid α, order_bot α :=
30+
class canonically_ordered_add_monoid (α : Type*) extends ordered_add_comm_monoid α, order_bot α :=
3131
(le_iff_exists_add : ∀a b:α, a ≤ b ↔ ∃c, b = a + c)
3232

3333
end old_structure_cmd
3434

35-
section ordered_comm_monoid
36-
variables [ordered_comm_monoid α] {a b c d : α}
35+
section ordered_add_comm_monoid
36+
variables [ordered_add_comm_monoid α] {a b c d : α}
3737

3838
lemma add_le_add_left' (h : a ≤ b) : c + a ≤ c + b :=
39-
ordered_comm_monoid.add_le_add_left a b h c
39+
ordered_add_comm_monoid.add_le_add_left a b h c
4040

4141
lemma add_le_add_right' (h : a ≤ b) : a + c ≤ b + c :=
4242
add_comm c a ▸ add_comm c b ▸ add_le_add_left' h
4343

4444
lemma lt_of_add_lt_add_left' : a + b < a + c → b < c :=
45-
ordered_comm_monoid.lt_of_add_lt_add_left a b c
45+
ordered_add_comm_monoid.lt_of_add_lt_add_left a b c
4646

4747
lemma add_le_add' (h₁ : a ≤ b) (h₂ : c ≤ d) : a + c ≤ b + d :=
4848
le_trans (add_le_add_right' h₁) (add_le_add_left' h₂)
@@ -133,7 +133,7 @@ iff.intro
133133
lemma bit0_pos {a : α} (h : 0 < a) : 0 < bit0 a :=
134134
add_pos' h h
135135

136-
end ordered_comm_monoid
136+
end ordered_add_comm_monoid
137137

138138
namespace units
139139

@@ -176,10 +176,10 @@ instance [decidable_linear_order α] :
176176
decidable_linear_order (with_zero α) := with_bot.decidable_linear_order
177177

178178
/--
179-
If `0` is the least element in `α`, then `with_zero α` is an `ordered_comm_monoid`.
179+
If `0` is the least element in `α`, then `with_zero α` is an `ordered_add_comm_monoid`.
180180
-/
181-
def ordered_comm_monoid [ordered_comm_monoid α]
182-
(zero_le : ∀ a : α, 0 ≤ a) : ordered_comm_monoid (with_zero α) :=
181+
def ordered_add_comm_monoid [ordered_add_comm_monoid α]
182+
(zero_le : ∀ a : α, 0 ≤ a) : ordered_add_comm_monoid (with_zero α) :=
183183
begin
184184
suffices, refine {
185185
add_le_add_left := this,
@@ -236,7 +236,7 @@ instance [add_comm_monoid α] : add_comm_monoid (with_top α) :=
236236
..@additive.add_comm_monoid _ $
237237
@with_zero.comm_monoid (multiplicative α) _ }
238238

239-
instance [ordered_comm_monoid α] : ordered_comm_monoid (with_top α) :=
239+
instance [ordered_add_comm_monoid α] : ordered_add_comm_monoid (with_top α) :=
240240
begin
241241
suffices, refine {
242242
add_le_add_left := this,
@@ -260,22 +260,22 @@ begin
260260
exact ⟨_, rfl, add_le_add_left' h⟩, }
261261
end
262262

263-
@[simp] lemma zero_lt_top [ordered_comm_monoid α] : (0 : with_top α) < ⊤ :=
263+
@[simp] lemma zero_lt_top [ordered_add_comm_monoid α] : (0 : with_top α) < ⊤ :=
264264
coe_lt_top 0
265265

266-
@[simp] lemma zero_lt_coe [ordered_comm_monoid α] (a : α) : (0 : with_top α) < a ↔ 0 < a :=
266+
@[simp] lemma zero_lt_coe [ordered_add_comm_monoid α] (a : α) : (0 : with_top α) < a ↔ 0 < a :=
267267
coe_lt_coe
268268

269-
@[simp] lemma add_top [ordered_comm_monoid α] : ∀{a : with_top α}, a + ⊤ = ⊤
269+
@[simp] lemma add_top [ordered_add_comm_monoid α] : ∀{a : with_top α}, a + ⊤ = ⊤
270270
| none := rfl
271271
| (some a) := rfl
272272

273-
@[simp] lemma top_add [ordered_comm_monoid α] {a : with_top α} : ⊤ + a = ⊤ := rfl
273+
@[simp] lemma top_add [ordered_add_comm_monoid α] {a : with_top α} : ⊤ + a = ⊤ := rfl
274274

275-
lemma add_eq_top [ordered_comm_monoid α] (a b : with_top α) : a + b = ⊤ ↔ a = ⊤ ∨ b = ⊤ :=
275+
lemma add_eq_top [ordered_add_comm_monoid α] (a b : with_top α) : a + b = ⊤ ↔ a = ⊤ ∨ b = ⊤ :=
276276
by cases a; cases b; simp [none_eq_top, some_eq_coe, coe_add.symm]
277277

278-
lemma add_lt_top [ordered_comm_monoid α] (a b : with_top α) : a + b < ⊤ ↔ a < ⊤ ∧ b < ⊤ :=
278+
lemma add_lt_top [ordered_add_comm_monoid α] (a b : with_top α) : a + b < ⊤ ↔ a < ⊤ ∧ b < ⊤ :=
279279
begin
280280
apply not_iff_not.1,
281281
simp [lt_top_iff_ne_top, add_eq_top],
@@ -284,21 +284,21 @@ begin
284284
apply classical.dec _,
285285
end
286286

287-
instance [canonically_ordered_monoid α] : canonically_ordered_monoid (with_top α) :=
287+
instance [canonically_ordered_add_monoid α] : canonically_ordered_add_monoid (with_top α) :=
288288
{ le_iff_exists_add := assume a b,
289289
match a, b with
290290
| a, none := show a ≤ ⊤ ↔ ∃c, ⊤ = a + c, by simp; refine ⟨⊤, _⟩; cases a; refl
291291
| (some a), (some b) := show (a:with_top α) ≤ ↑b ↔ ∃c:with_top α, ↑b = ↑a + c,
292292
begin
293-
simp [canonically_ordered_monoid.le_iff_exists_add, -add_comm],
293+
simp [canonically_ordered_add_monoid.le_iff_exists_add, -add_comm],
294294
split,
295295
{ rintro ⟨c, rfl⟩, refine ⟨c, _⟩, simp [coe_add] },
296296
{ exact assume h, match b, h with _, ⟨some c, rfl⟩ := ⟨_, rfl⟩ end }
297297
end
298298
| none, some b := show (⊤ : with_top α) ≤ b ↔ ∃c:with_top α, ↑b = ⊤ + c, by simp
299299
end,
300300
.. with_top.order_bot,
301-
.. with_top.ordered_comm_monoid }
301+
.. with_top.ordered_add_comm_monoid }
302302

303303
end with_top
304304

@@ -309,7 +309,7 @@ instance [add_comm_semigroup α] : add_comm_semigroup (with_bot α) := with_top.
309309
instance [add_monoid α] : add_monoid (with_bot α) := with_top.add_monoid
310310
instance [add_comm_monoid α] : add_comm_monoid (with_bot α) := with_top.add_comm_monoid
311311

312-
instance [ordered_comm_monoid α] : ordered_comm_monoid (with_bot α) :=
312+
instance [ordered_add_comm_monoid α] : ordered_add_comm_monoid (with_bot α) :=
313313
begin
314314
suffices, refine {
315315
add_le_add_left := this,
@@ -337,21 +337,21 @@ end
337337

338338
@[simp] lemma coe_add [add_semigroup α] (a b : α) : ((a + b : α) : with_bot α) = a + b := rfl
339339

340-
@[simp] lemma bot_add [ordered_comm_monoid α] (a : with_bot α) : ⊥ + a = ⊥ := rfl
340+
@[simp] lemma bot_add [ordered_add_comm_monoid α] (a : with_bot α) : ⊥ + a = ⊥ := rfl
341341

342-
@[simp] lemma add_bot [ordered_comm_monoid α] (a : with_bot α) : a + ⊥ = ⊥ := by cases a; refl
342+
@[simp] lemma add_bot [ordered_add_comm_monoid α] (a : with_bot α) : a + ⊥ = ⊥ := by cases a; refl
343343

344344
instance has_one [has_one α] : has_one (with_bot α) := ⟨(1 : α)⟩
345345

346346
@[simp] lemma coe_one [has_one α] : ((1 : α) : with_bot α) = 1 := rfl
347347

348348
end with_bot
349349

350-
section canonically_ordered_monoid
351-
variables [canonically_ordered_monoid α] {a b c d : α}
350+
section canonically_ordered_add_monoid
351+
variables [canonically_ordered_add_monoid α] {a b c d : α}
352352

353353
lemma le_iff_exists_add : a ≤ b ↔ ∃c, b = a + c :=
354-
canonically_ordered_monoid.le_iff_exists_add a b
354+
canonically_ordered_add_monoid.le_iff_exists_add a b
355355

356356
@[simp] lemma zero_le (a : α) : 0 ≤ a := le_iff_exists_add.mpr ⟨a, by simp⟩
357357

@@ -377,8 +377,8 @@ lemma le_add_right (h : a ≤ b) : a ≤ b + c :=
377377
calc a = a + 0 : by simp
378378
... ≤ b + c : add_le_add' h (zero_le _)
379379

380-
instance with_zero.canonically_ordered_monoid :
381-
canonically_ordered_monoid (with_zero α) :=
380+
instance with_zero.canonically_ordered_add_monoid :
381+
canonically_ordered_add_monoid (with_zero α) :=
382382
{ le_iff_exists_add := λ a b, begin
383383
cases a with a,
384384
{ exact iff_of_true bot_le ⟨b, (zero_add b).symm⟩ },
@@ -395,13 +395,13 @@ instance with_zero.canonically_ordered_monoid :
395395
end,
396396
bot := 0,
397397
bot_le := assume a a' h, option.no_confusion h,
398-
.. with_zero.ordered_comm_monoid zero_le }
398+
.. with_zero.ordered_add_comm_monoid zero_le }
399399

400-
end canonically_ordered_monoid
400+
end canonically_ordered_add_monoid
401401

402402
@[priority 100] -- see Note [lower instance priority]
403403
instance ordered_cancel_add_comm_monoid.to_ordered_add_comm_monoid
404-
[H : ordered_cancel_add_comm_monoid α] : ordered_comm_monoid α :=
404+
[H : ordered_cancel_add_comm_monoid α] : ordered_add_comm_monoid α :=
405405
{ lt_of_add_lt_add_left := @lt_of_add_lt_add_left _ _, ..H }
406406

407407
section ordered_cancel_comm_monoid
@@ -471,13 +471,13 @@ by simpa [add_comm] using @with_top.add_lt_add_iff_left _ _ a b c
471471

472472
end ordered_cancel_comm_monoid
473473

474-
section ordered_comm_group
474+
section ordered_add_comm_group
475475

476476
/--
477-
The `add_lt_add_left` field of `ordered_comm_group` is redundant, but it is in core so
477+
The `add_lt_add_left` field of `ordered_add_comm_group` is redundant, but it is in core so
478478
we can't remove it for now. This alternative constructor is the best we can do.
479479
-/
480-
def ordered_comm_group.mk' {α : Type u} [add_comm_group α] [partial_order α]
480+
def ordered_add_comm_group.mk' {α : Type u} [add_comm_group α] [partial_order α]
481481
(add_le_add_left : ∀ a b : α, a ≤ b → ∀ c : α, c + a ≤ c + b) :
482482
ordered_add_comm_group α :=
483483
{ add_le_add_left := add_le_add_left,
@@ -655,7 +655,7 @@ sub_le_iff_le_add'.trans (le_add_iff_nonneg_left _)
655655
lemma sub_lt_self_iff (a : α) {b : α} : a - b < a ↔ 0 < b :=
656656
sub_lt_iff_lt_add'.trans (lt_add_iff_pos_left _)
657657

658-
end ordered_comm_group
658+
end ordered_add_comm_group
659659

660660
namespace decidable_linear_ordered_add_comm_group
661661
variables [s : decidable_linear_ordered_add_comm_group α]
@@ -678,7 +678,7 @@ section prio
678678
set_option default_priority 100 -- see Note [default priority]
679679
/-- This is not so much a new structure as a construction mechanism
680680
for ordered groups, by specifying only the "positive cone" of the group. -/
681-
class nonneg_comm_group (α : Type*) extends add_comm_group α :=
681+
class nonneg_add_comm_group (α : Type*) extends add_comm_group α :=
682682
(nonneg : α → Prop)
683683
(pos : α → Prop := λ a, nonneg a ∧ ¬ nonneg (neg a))
684684
(pos_iff : ∀ a, pos a ↔ nonneg a ∧ ¬ nonneg (-a) . order_laws_tac)
@@ -687,8 +687,8 @@ class nonneg_comm_group (α : Type*) extends add_comm_group α :=
687687
(nonneg_antisymm : ∀ {a}, nonneg a → nonneg (-a) → a = 0)
688688
end prio
689689

690-
namespace nonneg_comm_group
691-
variable [s : nonneg_comm_group α]
690+
namespace nonneg_add_comm_group
691+
variable [s : nonneg_add_comm_group α]
692692
include s
693693

694694
@[reducible, priority 100] -- see Note [lower instance priority]
@@ -724,7 +724,7 @@ theorem nonneg_total_iff :
724724
λ h a, by rw [nonneg_def, nonneg_def, neg_nonneg]; apply h⟩
725725

726726
/--
727-
A `nonneg_comm_group` is a `decidable_linear_ordered_add_comm_group`
727+
A `nonneg_add_comm_group` is a `decidable_linear_ordered_add_comm_group`
728728
if `nonneg` is total and decidable.
729729
-/
730730
def to_decidable_linear_ordered_add_comm_group
@@ -740,13 +740,13 @@ def to_decidable_linear_ordered_add_comm_group
740740
le_total := nonneg_total_iff.1 nonneg_total,
741741
decidable_le := by apply_instance,
742742
decidable_lt := by apply_instance,
743-
..@nonneg_comm_group.to_ordered_add_comm_group _ s }
743+
..@nonneg_add_comm_group.to_ordered_add_comm_group _ s }
744744

745-
end nonneg_comm_group
745+
end nonneg_add_comm_group
746746

747747
namespace order_dual
748748

749-
instance [ordered_comm_monoid α] : ordered_comm_monoid (order_dual α) :=
749+
instance [ordered_add_comm_monoid α] : ordered_add_comm_monoid (order_dual α) :=
750750
{ add_le_add_left := λ a b h c, @add_le_add_left' α _ b a c h,
751751
lt_of_add_lt_add_left := λ a b c h, @lt_of_add_lt_add_left' α _ a c b h,
752752
..order_dual.partial_order α,
@@ -756,11 +756,11 @@ instance [ordered_cancel_add_comm_monoid α] : ordered_cancel_add_comm_monoid (o
756756
{ le_of_add_le_add_left := λ a b c : α, le_of_add_le_add_left,
757757
add_left_cancel := @add_left_cancel α _,
758758
add_right_cancel := @add_right_cancel α _,
759-
..order_dual.ordered_comm_monoid }
759+
..order_dual.ordered_add_comm_monoid }
760760

761761
instance [ordered_add_comm_group α] : ordered_add_comm_group (order_dual α) :=
762762
{ add_left_neg := λ a : α, add_left_neg a,
763-
..order_dual.ordered_comm_monoid,
763+
..order_dual.ordered_add_comm_monoid,
764764
..show add_comm_group α, by apply_instance }
765765

766766
end order_dual

0 commit comments

Comments
 (0)