@@ -18,7 +18,7 @@ set_option default_priority 100 -- see Note [default priority]
18
18
/-- An ordered (additive) commutative monoid is a commutative monoid
19
19
with a partial order such that addition is an order embedding, i.e.
20
20
`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 α :=
22
22
(add_le_add_left : ∀ a b : α, a ≤ b → ∀ c : α, c + a ≤ c + b)
23
23
(lt_of_add_lt_add_left : ∀ a b c : α, a + b < a + c → b < c)
24
24
@@ -27,22 +27,22 @@ class ordered_comm_monoid (α : Type*) extends add_comm_monoid α, partial_order
27
27
which is to say, `a ≤ b` iff there exists `c` with `b = a + c`.
28
28
This is satisfied by the natural numbers, for example, but not
29
29
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 α :=
31
31
(le_iff_exists_add : ∀a b:α, a ≤ b ↔ ∃c, b = a + c)
32
32
33
33
end old_structure_cmd
34
34
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 : α}
37
37
38
38
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
40
40
41
41
lemma add_le_add_right' (h : a ≤ b) : a + c ≤ b + c :=
42
42
add_comm c a ▸ add_comm c b ▸ add_le_add_left' h
43
43
44
44
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
46
46
47
47
lemma add_le_add' (h₁ : a ≤ b) (h₂ : c ≤ d) : a + c ≤ b + d :=
48
48
le_trans (add_le_add_right' h₁) (add_le_add_left' h₂)
@@ -133,7 +133,7 @@ iff.intro
133
133
lemma bit0_pos {a : α} (h : 0 < a) : 0 < bit0 a :=
134
134
add_pos' h h
135
135
136
- end ordered_comm_monoid
136
+ end ordered_add_comm_monoid
137
137
138
138
namespace units
139
139
@@ -176,10 +176,10 @@ instance [decidable_linear_order α] :
176
176
decidable_linear_order (with_zero α) := with_bot.decidable_linear_order
177
177
178
178
/--
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 `.
180
180
-/
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 α) :=
183
183
begin
184
184
suffices , refine {
185
185
add_le_add_left := this ,
@@ -236,7 +236,7 @@ instance [add_comm_monoid α] : add_comm_monoid (with_top α) :=
236
236
..@additive.add_comm_monoid _ $
237
237
@with_zero.comm_monoid (multiplicative α) _ }
238
238
239
- instance [ordered_comm_monoid α] : ordered_comm_monoid (with_top α) :=
239
+ instance [ordered_add_comm_monoid α] : ordered_add_comm_monoid (with_top α) :=
240
240
begin
241
241
suffices , refine {
242
242
add_le_add_left := this ,
@@ -260,22 +260,22 @@ begin
260
260
exact ⟨_, rfl, add_le_add_left' h⟩, }
261
261
end
262
262
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 α) < ⊤ :=
264
264
coe_lt_top 0
265
265
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 :=
267
267
coe_lt_coe
268
268
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 + ⊤ = ⊤
270
270
| none := rfl
271
271
| (some a) := rfl
272
272
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
274
274
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 = ⊤ :=
276
276
by cases a; cases b; simp [none_eq_top, some_eq_coe, coe_add.symm]
277
277
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 < ⊤ :=
279
279
begin
280
280
apply not_iff_not.1 ,
281
281
simp [lt_top_iff_ne_top, add_eq_top],
@@ -284,21 +284,21 @@ begin
284
284
apply classical.dec _,
285
285
end
286
286
287
- instance [canonically_ordered_monoid α] : canonically_ordered_monoid (with_top α) :=
287
+ instance [canonically_ordered_add_monoid α] : canonically_ordered_add_monoid (with_top α) :=
288
288
{ le_iff_exists_add := assume a b,
289
289
match a, b with
290
290
| a, none := show a ≤ ⊤ ↔ ∃c, ⊤ = a + c, by simp; refine ⟨⊤, _⟩; cases a; refl
291
291
| (some a), (some b) := show (a:with_top α) ≤ ↑b ↔ ∃c:with_top α, ↑b = ↑a + c,
292
292
begin
293
- simp [canonically_ordered_monoid .le_iff_exists_add, -add_comm],
293
+ simp [canonically_ordered_add_monoid .le_iff_exists_add, -add_comm],
294
294
split,
295
295
{ rintro ⟨c, rfl⟩, refine ⟨c, _⟩, simp [coe_add] },
296
296
{ exact assume h, match b, h with _, ⟨some c, rfl⟩ := ⟨_, rfl⟩ end }
297
297
end
298
298
| none, some b := show (⊤ : with_top α) ≤ b ↔ ∃c:with_top α, ↑b = ⊤ + c, by simp
299
299
end ,
300
300
.. with_top.order_bot,
301
- .. with_top.ordered_comm_monoid }
301
+ .. with_top.ordered_add_comm_monoid }
302
302
303
303
end with_top
304
304
@@ -309,7 +309,7 @@ instance [add_comm_semigroup α] : add_comm_semigroup (with_bot α) := with_top.
309
309
instance [add_monoid α] : add_monoid (with_bot α) := with_top.add_monoid
310
310
instance [add_comm_monoid α] : add_comm_monoid (with_bot α) := with_top.add_comm_monoid
311
311
312
- instance [ordered_comm_monoid α] : ordered_comm_monoid (with_bot α) :=
312
+ instance [ordered_add_comm_monoid α] : ordered_add_comm_monoid (with_bot α) :=
313
313
begin
314
314
suffices , refine {
315
315
add_le_add_left := this ,
@@ -337,21 +337,21 @@ end
337
337
338
338
@[simp] lemma coe_add [add_semigroup α] (a b : α) : ((a + b : α) : with_bot α) = a + b := rfl
339
339
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
341
341
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
343
343
344
344
instance has_one [has_one α] : has_one (with_bot α) := ⟨(1 : α)⟩
345
345
346
346
@[simp] lemma coe_one [has_one α] : ((1 : α) : with_bot α) = 1 := rfl
347
347
348
348
end with_bot
349
349
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 : α}
352
352
353
353
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
355
355
356
356
@[simp] lemma zero_le (a : α) : 0 ≤ a := le_iff_exists_add.mpr ⟨a, by simp⟩
357
357
@@ -377,8 +377,8 @@ lemma le_add_right (h : a ≤ b) : a ≤ b + c :=
377
377
calc a = a + 0 : by simp
378
378
... ≤ b + c : add_le_add' h (zero_le _)
379
379
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 α) :=
382
382
{ le_iff_exists_add := λ a b, begin
383
383
cases a with a,
384
384
{ exact iff_of_true bot_le ⟨b, (zero_add b).symm⟩ },
@@ -395,13 +395,13 @@ instance with_zero.canonically_ordered_monoid :
395
395
end ,
396
396
bot := 0 ,
397
397
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 }
399
399
400
- end canonically_ordered_monoid
400
+ end canonically_ordered_add_monoid
401
401
402
402
@[priority 100 ] -- see Note [lower instance priority]
403
403
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 α :=
405
405
{ lt_of_add_lt_add_left := @lt_of_add_lt_add_left _ _, ..H }
406
406
407
407
section ordered_cancel_comm_monoid
@@ -471,13 +471,13 @@ by simpa [add_comm] using @with_top.add_lt_add_iff_left _ _ a b c
471
471
472
472
end ordered_cancel_comm_monoid
473
473
474
- section ordered_comm_group
474
+ section ordered_add_comm_group
475
475
476
476
/--
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
478
478
we can't remove it for now. This alternative constructor is the best we can do.
479
479
-/
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 α]
481
481
(add_le_add_left : ∀ a b : α, a ≤ b → ∀ c : α, c + a ≤ c + b) :
482
482
ordered_add_comm_group α :=
483
483
{ add_le_add_left := add_le_add_left,
@@ -655,7 +655,7 @@ sub_le_iff_le_add'.trans (le_add_iff_nonneg_left _)
655
655
lemma sub_lt_self_iff (a : α) {b : α} : a - b < a ↔ 0 < b :=
656
656
sub_lt_iff_lt_add'.trans (lt_add_iff_pos_left _)
657
657
658
- end ordered_comm_group
658
+ end ordered_add_comm_group
659
659
660
660
namespace decidable_linear_ordered_add_comm_group
661
661
variables [s : decidable_linear_ordered_add_comm_group α]
@@ -678,7 +678,7 @@ section prio
678
678
set_option default_priority 100 -- see Note [default priority]
679
679
/-- This is not so much a new structure as a construction mechanism
680
680
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 α :=
682
682
(nonneg : α → Prop )
683
683
(pos : α → Prop := λ a, nonneg a ∧ ¬ nonneg (neg a))
684
684
(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 α :=
687
687
(nonneg_antisymm : ∀ {a}, nonneg a → nonneg (-a) → a = 0 )
688
688
end prio
689
689
690
- namespace nonneg_comm_group
691
- variable [s : nonneg_comm_group α]
690
+ namespace nonneg_add_comm_group
691
+ variable [s : nonneg_add_comm_group α]
692
692
include s
693
693
694
694
@[reducible, priority 100 ] -- see Note [lower instance priority]
@@ -724,7 +724,7 @@ theorem nonneg_total_iff :
724
724
λ h a, by rw [nonneg_def, nonneg_def, neg_nonneg]; apply h⟩
725
725
726
726
/--
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`
728
728
if `nonneg` is total and decidable.
729
729
-/
730
730
def to_decidable_linear_ordered_add_comm_group
@@ -740,13 +740,13 @@ def to_decidable_linear_ordered_add_comm_group
740
740
le_total := nonneg_total_iff.1 nonneg_total,
741
741
decidable_le := by apply_instance,
742
742
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 }
744
744
745
- end nonneg_comm_group
745
+ end nonneg_add_comm_group
746
746
747
747
namespace order_dual
748
748
749
- instance [ordered_comm_monoid α] : ordered_comm_monoid (order_dual α) :=
749
+ instance [ordered_add_comm_monoid α] : ordered_add_comm_monoid (order_dual α) :=
750
750
{ add_le_add_left := λ a b h c, @add_le_add_left' α _ b a c h,
751
751
lt_of_add_lt_add_left := λ a b c h, @lt_of_add_lt_add_left' α _ a c b h,
752
752
..order_dual.partial_order α,
@@ -756,11 +756,11 @@ instance [ordered_cancel_add_comm_monoid α] : ordered_cancel_add_comm_monoid (o
756
756
{ le_of_add_le_add_left := λ a b c : α, le_of_add_le_add_left,
757
757
add_left_cancel := @add_left_cancel α _,
758
758
add_right_cancel := @add_right_cancel α _,
759
- ..order_dual.ordered_comm_monoid }
759
+ ..order_dual.ordered_add_comm_monoid }
760
760
761
761
instance [ordered_add_comm_group α] : ordered_add_comm_group (order_dual α) :=
762
762
{ add_left_neg := λ a : α, add_left_neg a,
763
- ..order_dual.ordered_comm_monoid ,
763
+ ..order_dual.ordered_add_comm_monoid ,
764
764
..show add_comm_group α, by apply_instance }
765
765
766
766
end order_dual
0 commit comments