@@ -383,6 +383,93 @@ protected lemma decidable.one_le_mul_of_one_le_of_one_le [@decidable_rel α (≤
383
383
lemma one_le_mul_of_one_le_of_one_le {a b : α} : 1 ≤ a → 1 ≤ b → (1 : α) ≤ a * b :=
384
384
by classical; exact decidable.one_le_mul_of_one_le_of_one_le
385
385
386
+ namespace decidable
387
+
388
+ variables {β : Type *} [@decidable_rel α (≤)] [preorder β] {f g : β → α}
389
+
390
+ lemma monotone_mul_left_of_nonneg (ha : 0 ≤ a) : monotone (λ x, a*x) :=
391
+ assume b c b_le_c, decidable.mul_le_mul_of_nonneg_left b_le_c ha
392
+
393
+ lemma monotone_mul_right_of_nonneg (ha : 0 ≤ a) : monotone (λ x, x*a) :=
394
+ assume b c b_le_c, decidable.mul_le_mul_of_nonneg_right b_le_c ha
395
+
396
+ lemma monotone_mul {β : Type *} [preorder β] {f g : β → α}
397
+ (hf : monotone f) (hg : monotone g) (hf0 : ∀ x, 0 ≤ f x) (hg0 : ∀ x, 0 ≤ g x) :
398
+ monotone (λ x, f x * g x) :=
399
+ λ x y h, decidable.mul_le_mul (hf h) (hg h) (hg0 x) (hf0 y)
400
+
401
+ lemma strict_mono_mul_monotone (hf : strict_mono f) (hg : monotone g) (hf0 : ∀ x, 0 ≤ f x)
402
+ (hg0 : ∀ x, 0 < g x) :
403
+ strict_mono (λ x, f x * g x) :=
404
+ λ x y h, decidable.mul_lt_mul (hf h) (hg h.le) (hg0 x) (hf0 y)
405
+
406
+ lemma monotone_mul_strict_mono (hf : monotone f) (hg : strict_mono g) (hf0 : ∀ x, 0 < f x)
407
+ (hg0 : ∀ x, 0 ≤ g x) :
408
+ strict_mono (λ x, f x * g x) :=
409
+ λ x y h, decidable.mul_lt_mul' (hf h.le) (hg h) (hg0 x) (hf0 y)
410
+
411
+ lemma strict_mono_mul (hf : strict_mono f) (hg : strict_mono g) (hf0 : ∀ x, 0 ≤ f x)
412
+ (hg0 : ∀ x, 0 ≤ g x) :
413
+ strict_mono (λ x, f x * g x) :=
414
+ λ x y h, decidable.mul_lt_mul'' (hf h) (hg h) (hf0 x) (hg0 x)
415
+
416
+ end decidable
417
+
418
+ section mono
419
+
420
+ open_locale classical
421
+
422
+ variables {β : Type *} [preorder β] {f g : β → α}
423
+
424
+ lemma monotone_mul_left_of_nonneg (ha : 0 ≤ a) : monotone (λ x, a*x) :=
425
+ decidable.monotone_mul_left_of_nonneg ha
426
+
427
+ lemma monotone_mul_right_of_nonneg (ha : 0 ≤ a) : monotone (λ x, x*a) :=
428
+ decidable.monotone_mul_right_of_nonneg ha
429
+
430
+ lemma monotone.mul_const (hf : monotone f) (ha : 0 ≤ a) :
431
+ monotone (λ x, (f x) * a) :=
432
+ (monotone_mul_right_of_nonneg ha).comp hf
433
+
434
+ lemma monotone.const_mul (hf : monotone f) (ha : 0 ≤ a) :
435
+ monotone (λ x, a * (f x)) :=
436
+ (monotone_mul_left_of_nonneg ha).comp hf
437
+
438
+ lemma monotone.mul (hf : monotone f) (hg : monotone g) (hf0 : ∀ x, 0 ≤ f x) (hg0 : ∀ x, 0 ≤ g x) :
439
+ monotone (λ x, f x * g x) :=
440
+ decidable.monotone_mul hf hg hf0 hg0
441
+
442
+ lemma strict_mono_mul_left_of_pos (ha : 0 < a) : strict_mono (λ x, a * x) :=
443
+ assume b c b_lt_c, mul_lt_mul_of_pos_left b_lt_c ha
444
+
445
+ lemma strict_mono_mul_right_of_pos (ha : 0 < a) : strict_mono (λ x, x * a) :=
446
+ assume b c b_lt_c, mul_lt_mul_of_pos_right b_lt_c ha
447
+
448
+ lemma strict_mono.mul_const (hf : strict_mono f) (ha : 0 < a) :
449
+ strict_mono (λ x, (f x) * a) :=
450
+ (strict_mono_mul_right_of_pos ha).comp hf
451
+
452
+ lemma strict_mono.const_mul (hf : strict_mono f) (ha : 0 < a) :
453
+ strict_mono (λ x, a * (f x)) :=
454
+ (strict_mono_mul_left_of_pos ha).comp hf
455
+
456
+ lemma strict_mono.mul_monotone (hf : strict_mono f) (hg : monotone g) (hf0 : ∀ x, 0 ≤ f x)
457
+ (hg0 : ∀ x, 0 < g x) :
458
+ strict_mono (λ x, f x * g x) :=
459
+ decidable.strict_mono_mul_monotone hf hg hf0 hg0
460
+
461
+ lemma monotone.mul_strict_mono (hf : monotone f) (hg : strict_mono g) (hf0 : ∀ x, 0 < f x)
462
+ (hg0 : ∀ x, 0 ≤ g x) :
463
+ strict_mono (λ x, f x * g x) :=
464
+ decidable.monotone_mul_strict_mono hf hg hf0 hg0
465
+
466
+ lemma strict_mono.mul (hf : strict_mono f) (hg : strict_mono g) (hf0 : ∀ x, 0 ≤ f x)
467
+ (hg0 : ∀ x, 0 ≤ g x) :
468
+ strict_mono (λ x, f x * g x) :=
469
+ decidable.strict_mono_mul hf hg hf0 hg0
470
+
471
+ end mono
472
+
386
473
/-- Pullback an `ordered_semiring` under an injective map.
387
474
See note [reducible non-instances]. -/
388
475
@[reducible]
@@ -586,6 +673,8 @@ class linear_ordered_semiring (α : Type u)
586
673
section linear_ordered_semiring
587
674
variables [linear_ordered_semiring α] {a b c d : α}
588
675
676
+ local attribute [instance] linear_ordered_semiring.decidable_le
677
+
589
678
-- `norm_num` expects the lemma stating `0 < 1` to have a single typeclass argument
590
679
-- (see `norm_num.prove_pos_nat`).
591
680
-- Rather than working out how to relax that assumption,
@@ -594,33 +683,20 @@ variables [linear_ordered_semiring α] {a b c d : α}
594
683
lemma zero_lt_one' : 0 < (1 : α) := zero_lt_one
595
684
596
685
lemma lt_of_mul_lt_mul_left (h : c * a < c * b) (hc : 0 ≤ c) : a < b :=
597
- by haveI := @linear_order.decidable_le α _; exact lt_of_not_ge
598
- (assume h1 : b ≤ a,
599
- have h2 : c * b ≤ c * a, from decidable.mul_le_mul_of_nonneg_left h1 hc,
600
- h2.not_lt h)
686
+ (decidable.monotone_mul_left_of_nonneg hc).reflect_lt h
601
687
602
688
lemma lt_of_mul_lt_mul_right (h : a * c < b * c) (hc : 0 ≤ c) : a < b :=
603
- by haveI := @linear_order.decidable_le α _; exact lt_of_not_ge
604
- (assume h1 : b ≤ a,
605
- have h2 : b * c ≤ a * c, from decidable.mul_le_mul_of_nonneg_right h1 hc,
606
- h2.not_lt h)
689
+ (decidable.monotone_mul_right_of_nonneg hc).reflect_lt h
607
690
608
691
lemma le_of_mul_le_mul_left (h : c * a ≤ c * b) (hc : 0 < c) : a ≤ b :=
609
- le_of_not_gt
610
- (assume h1 : b < a,
611
- have h2 : c * b < c * a, from mul_lt_mul_of_pos_left h1 hc,
612
- h2.not_le h)
692
+ (strict_mono_mul_left_of_pos hc).le_iff_le.1 h
613
693
614
694
lemma le_of_mul_le_mul_right (h : a * c ≤ b * c) (hc : 0 < c) : a ≤ b :=
615
- le_of_not_gt
616
- (assume h1 : b < a,
617
- have h2 : b * c < a * c, from mul_lt_mul_of_pos_right h1 hc,
618
- h2.not_le h)
695
+ (strict_mono_mul_right_of_pos hc).le_iff_le.1 h
619
696
620
697
lemma pos_and_pos_or_neg_and_neg_of_mul_pos (hab : 0 < a * b) :
621
698
(0 < a ∧ 0 < b) ∨ (a < 0 ∧ b < 0 ) :=
622
699
begin
623
- haveI := @linear_order.decidable_le α _,
624
700
rcases lt_trichotomy 0 a with (ha|rfl|ha),
625
701
{ refine or.inl ⟨ha, lt_imp_lt_of_le_imp_le (λ hb, _) hab⟩,
626
702
exact decidable.mul_nonpos_of_nonneg_of_nonpos ha.le hb },
632
708
lemma nonneg_and_nonneg_or_nonpos_and_nonpos_of_mul_nnonneg (hab : 0 ≤ a * b) :
633
709
(0 ≤ a ∧ 0 ≤ b) ∨ (a ≤ 0 ∧ b ≤ 0 ) :=
634
710
begin
635
- haveI := @linear_order.decidable_le α _,
636
711
refine decidable.or_iff_not_and_not.2 _,
637
712
simp only [not_and, not_le], intros ab nab, apply not_lt_of_le hab _,
638
713
rcases lt_trichotomy 0 a with (ha|rfl|ha),
@@ -665,12 +740,10 @@ lemma nonneg_of_mul_nonneg_right (h : 0 ≤ a * b) (ha : 0 < a) : 0 ≤ b :=
665
740
le_of_not_gt $ λ hb, (mul_neg_of_pos_of_neg ha hb).not_le h
666
741
667
742
lemma neg_of_mul_neg_left (h : a * b < 0 ) (hb : 0 ≤ b) : a < 0 :=
668
- by haveI := @linear_order.decidable_le α _; exact
669
- lt_of_not_ge (λ ha : a ≥ 0 , (decidable.mul_nonneg ha hb).not_lt h)
743
+ lt_of_not_ge $ λ ha, (decidable.mul_nonneg ha hb).not_lt h
670
744
671
745
lemma neg_of_mul_neg_right (h : a * b < 0 ) (ha : 0 ≤ a) : b < 0 :=
672
- by haveI := @linear_order.decidable_le α _; exact
673
- lt_of_not_ge (assume hb : b ≥ 0 , (decidable.mul_nonneg ha hb).not_lt h)
746
+ lt_of_not_ge $ λ hb, (decidable.mul_nonneg ha hb).not_lt h
674
747
675
748
lemma nonpos_of_mul_nonpos_left (h : a * b ≤ 0 ) (hb : 0 < b) : a ≤ 0 :=
676
749
le_of_not_gt (assume ha : a > 0 , (mul_pos ha hb).not_le h)
@@ -679,22 +752,16 @@ lemma nonpos_of_mul_nonpos_right (h : a * b ≤ 0) (ha : 0 < a) : b ≤ 0 :=
679
752
le_of_not_gt (assume hb : b > 0 , (mul_pos ha hb).not_le h)
680
753
681
754
@[simp] lemma mul_le_mul_left (h : 0 < c) : c * a ≤ c * b ↔ a ≤ b :=
682
- by haveI := @linear_order.decidable_le α _; exact
683
- ⟨λ h', le_of_mul_le_mul_left h' h, λ h', decidable.mul_le_mul_of_nonneg_left h' h.le⟩
755
+ (strict_mono_mul_left_of_pos h).le_iff_le
684
756
685
757
@[simp] lemma mul_le_mul_right (h : 0 < c) : a * c ≤ b * c ↔ a ≤ b :=
686
- by haveI := @linear_order.decidable_le α _; exact
687
- ⟨λ h', le_of_mul_le_mul_right h' h, λ h', decidable.mul_le_mul_of_nonneg_right h' h.le⟩
758
+ (strict_mono_mul_right_of_pos h).le_iff_le
688
759
689
760
@[simp] lemma mul_lt_mul_left (h : 0 < c) : c * a < c * b ↔ a < b :=
690
- by haveI := @linear_order.decidable_le α _; exact
691
- ⟨lt_imp_lt_of_le_imp_le $ λ h', decidable.mul_le_mul_of_nonneg_left h' h.le,
692
- λ h', mul_lt_mul_of_pos_left h' h⟩
761
+ (strict_mono_mul_left_of_pos h).lt_iff_lt
693
762
694
763
@[simp] lemma mul_lt_mul_right (h : 0 < c) : a * c < b * c ↔ a < b :=
695
- by haveI := @linear_order.decidable_le α _; exact
696
- ⟨lt_imp_lt_of_le_imp_le $ λ h', decidable.mul_le_mul_of_nonneg_right h' h.le,
697
- λ h', mul_lt_mul_of_pos_right h' h⟩
764
+ (strict_mono_mul_right_of_pos h).lt_iff_lt
698
765
699
766
@[simp] lemma zero_le_mul_left (h : 0 < c) : 0 ≤ c * b ↔ 0 ≤ b :=
700
767
by { convert mul_le_mul_left h, simp }
@@ -842,64 +909,6 @@ ordered_semiring.to_char_zero
842
909
843
910
end linear_ordered_semiring
844
911
845
- section mono
846
- variables {β : Type *} [linear_ordered_semiring α] [preorder β] {f g : β → α} {a : α}
847
-
848
- lemma monotone_mul_left_of_nonneg (ha : 0 ≤ a) : monotone (λ x, a*x) :=
849
- by haveI := @linear_order.decidable_le α _; exact
850
- assume b c b_le_c, decidable.mul_le_mul_of_nonneg_left b_le_c ha
851
-
852
- lemma monotone_mul_right_of_nonneg (ha : 0 ≤ a) : monotone (λ x, x*a) :=
853
- by haveI := @linear_order.decidable_le α _; exact
854
- assume b c b_le_c, decidable.mul_le_mul_of_nonneg_right b_le_c ha
855
-
856
- lemma monotone.mul_const (hf : monotone f) (ha : 0 ≤ a) :
857
- monotone (λ x, (f x) * a) :=
858
- (monotone_mul_right_of_nonneg ha).comp hf
859
-
860
- lemma monotone.const_mul (hf : monotone f) (ha : 0 ≤ a) :
861
- monotone (λ x, a * (f x)) :=
862
- (monotone_mul_left_of_nonneg ha).comp hf
863
-
864
- lemma monotone.mul (hf : monotone f) (hg : monotone g) (hf0 : ∀ x, 0 ≤ f x) (hg0 : ∀ x, 0 ≤ g x) :
865
- monotone (λ x, f x * g x) :=
866
- by haveI := @linear_order.decidable_le α _; exact
867
- λ x y h, decidable.mul_le_mul (hf h) (hg h) (hg0 x) (hf0 y)
868
-
869
- lemma strict_mono_mul_left_of_pos (ha : 0 < a) : strict_mono (λ x, a * x) :=
870
- assume b c b_lt_c, (mul_lt_mul_left ha).2 b_lt_c
871
-
872
- lemma strict_mono_mul_right_of_pos (ha : 0 < a) : strict_mono (λ x, x * a) :=
873
- assume b c b_lt_c, (mul_lt_mul_right ha).2 b_lt_c
874
-
875
- lemma strict_mono.mul_const (hf : strict_mono f) (ha : 0 < a) :
876
- strict_mono (λ x, (f x) * a) :=
877
- (strict_mono_mul_right_of_pos ha).comp hf
878
-
879
- lemma strict_mono.const_mul (hf : strict_mono f) (ha : 0 < a) :
880
- strict_mono (λ x, a * (f x)) :=
881
- (strict_mono_mul_left_of_pos ha).comp hf
882
-
883
- lemma strict_mono.mul_monotone (hf : strict_mono f) (hg : monotone g) (hf0 : ∀ x, 0 ≤ f x)
884
- (hg0 : ∀ x, 0 < g x) :
885
- strict_mono (λ x, f x * g x) :=
886
- by haveI := @linear_order.decidable_le α _; exact
887
- λ x y h, decidable.mul_lt_mul (hf h) (hg h.le) (hg0 x) (hf0 y)
888
-
889
- lemma monotone.mul_strict_mono (hf : monotone f) (hg : strict_mono g) (hf0 : ∀ x, 0 < f x)
890
- (hg0 : ∀ x, 0 ≤ g x) :
891
- strict_mono (λ x, f x * g x) :=
892
- by haveI := @linear_order.decidable_le α _; exact
893
- λ x y h, decidable.mul_lt_mul' (hf h.le) (hg h) (hg0 x) (hf0 y)
894
-
895
- lemma strict_mono.mul (hf : strict_mono f) (hg : strict_mono g) (hf0 : ∀ x, 0 ≤ f x)
896
- (hg0 : ∀ x, 0 ≤ g x) :
897
- strict_mono (λ x, f x * g x) :=
898
- by haveI := @linear_order.decidable_le α _; exact
899
- λ x y h, decidable.mul_lt_mul'' (hf h) (hg h) (hf0 x) (hg0 x)
900
-
901
- end mono
902
-
903
912
section linear_ordered_semiring
904
913
variables [linear_ordered_semiring α] {a b c : α}
905
914
@@ -1030,6 +1039,26 @@ lemma mul_pos_of_neg_of_neg {a b : α} (ha : a < 0) (hb : b < 0) : 0 < a * b :=
1030
1039
have 0 * b < a * b, from mul_lt_mul_of_neg_right ha hb,
1031
1040
by rwa zero_mul at this
1032
1041
1042
+ lemma decidable.antitone_mul_left [@decidable_rel α (≤)] {a : α} (ha : a ≤ 0 ) :
1043
+ antitone ((*) a) :=
1044
+ λ b c b_le_c, decidable.mul_le_mul_of_nonpos_left b_le_c ha
1045
+
1046
+ lemma antitone_mul_left {a : α} (ha : a ≤ 0 ) : antitone ((*) a) :=
1047
+ λ b c b_le_c, mul_le_mul_of_nonpos_left b_le_c ha
1048
+
1049
+ lemma decidable.antitone_mul_right [@decidable_rel α (≤)] {a : α} (ha : a ≤ 0 ) :
1050
+ antitone (λ x, x * a) :=
1051
+ λ b c b_le_c, decidable.mul_le_mul_of_nonpos_right b_le_c ha
1052
+
1053
+ lemma antitone_mul_right {a : α} (ha : a ≤ 0 ) : antitone (λ x, x * a) :=
1054
+ λ b c b_le_c, mul_le_mul_of_nonpos_right b_le_c ha
1055
+
1056
+ lemma strict_anti_mul_left {a : α} (ha : a < 0 ) : strict_anti ((*) a) :=
1057
+ λ b c b_lt_c, mul_lt_mul_of_neg_left b_lt_c ha
1058
+
1059
+ lemma strict_anti_mul_right {a : α} (ha : a < 0 ) : strict_anti (λ x, x * a) :=
1060
+ λ b c b_lt_c, mul_lt_mul_of_neg_right b_lt_c ha
1061
+
1033
1062
/-- Pullback an `ordered_ring` under an injective map.
1034
1063
See note [reducible non-instances]. -/
1035
1064
@[reducible]
@@ -1123,6 +1152,8 @@ end linear_ordered_semiring
1123
1152
section linear_ordered_ring
1124
1153
variables [linear_ordered_ring α] {a b c : α}
1125
1154
1155
+ local attribute [instance] linear_ordered_ring.decidable_le linear_ordered_ring.decidable_lt
1156
+
1126
1157
@[priority 100 ] -- see Note [lower instance priority]
1127
1158
instance linear_ordered_ring.to_linear_ordered_semiring : linear_ordered_semiring α :=
1128
1159
{ mul_zero := mul_zero,
@@ -1244,20 +1275,16 @@ lt_of_mul_lt_mul_left h3 nhc
1244
1275
lemma neg_one_lt_zero : -1 < (0 :α) := neg_lt_zero.2 zero_lt_one
1245
1276
1246
1277
@[simp] lemma mul_le_mul_left_of_neg {a b c : α} (h : c < 0 ) : c * a ≤ c * b ↔ b ≤ a :=
1247
- by haveI := @linear_order.decidable_le α _; exact
1248
- ⟨le_imp_le_of_lt_imp_lt $ λ h', mul_lt_mul_of_neg_left h' h,
1249
- λ h', decidable.mul_le_mul_of_nonpos_left h' h.le⟩
1278
+ (strict_anti_mul_left h).le_iff_le
1250
1279
1251
1280
@[simp] lemma mul_le_mul_right_of_neg {a b c : α} (h : c < 0 ) : a * c ≤ b * c ↔ b ≤ a :=
1252
- by haveI := @linear_order.decidable_le α _; exact
1253
- ⟨le_imp_le_of_lt_imp_lt $ λ h', mul_lt_mul_of_neg_right h' h,
1254
- λ h', decidable.mul_le_mul_of_nonpos_right h' h.le⟩
1281
+ (strict_anti_mul_right h).le_iff_le
1255
1282
1256
1283
@[simp] lemma mul_lt_mul_left_of_neg {a b c : α} (h : c < 0 ) : c * a < c * b ↔ b < a :=
1257
- lt_iff_lt_of_le_iff_le (mul_le_mul_left_of_neg h)
1284
+ (strict_anti_mul_left h).lt_iff_lt
1258
1285
1259
1286
@[simp] lemma mul_lt_mul_right_of_neg {a b c : α} (h : c < 0 ) : a * c < b * c ↔ b < a :=
1260
- lt_iff_lt_of_le_iff_le (mul_le_mul_right_of_neg h)
1287
+ (strict_anti_mul_right h).lt_iff_lt
1261
1288
1262
1289
lemma sub_one_lt (a : α) : a - 1 < a :=
1263
1290
sub_lt_iff_lt_add.2 (lt_add_one a)
0 commit comments