@@ -197,17 +197,33 @@ le_of_not_gt
197
197
have h2 : b * c < a * c, from mul_lt_mul_of_pos_right h1 hc,
198
198
h2.not_le h)
199
199
200
- lemma pos_of_mul_pos_left (h : 0 < a * b) (h1 : 0 ≤ a) : 0 < b :=
201
- lt_of_not_ge
202
- (assume h2 : b ≤ 0 ,
203
- have h3 : a * b ≤ 0 , from mul_nonpos_of_nonneg_of_nonpos h1 h2,
204
- h3.not_lt h)
200
+ lemma pos_and_pos_or_neg_and_neg_of_mul_pos (hab : 0 < a * b) :
201
+ (0 < a ∧ 0 < b) ∨ (a < 0 ∧ b < 0 ) :=
202
+ begin
203
+ rcases lt_trichotomy 0 a with (ha|rfl|ha),
204
+ { refine or.inl ⟨ha, _⟩,
205
+ contrapose! hab,
206
+ exact mul_nonpos_of_nonneg_of_nonpos ha.le hab },
207
+ { rw [zero_mul] at hab, exact hab.false.elim },
208
+ { refine or.inr ⟨ha, _⟩,
209
+ contrapose! hab,
210
+ exact mul_nonpos_of_nonpos_of_nonneg ha.le hab }
211
+ end
205
212
206
- lemma pos_of_mul_pos_right (h : 0 < a * b) (h1 : 0 ≤ b) : 0 < a :=
207
- lt_of_not_ge
208
- (assume h2 : a ≤ 0 ,
209
- have h3 : a * b ≤ 0 , from mul_nonpos_of_nonpos_of_nonneg h2 h1,
210
- h3.not_lt h)
213
+ lemma nonneg_and_nonneg_or_nonpos_and_nonpos_of_mul_nnonneg (hab : 0 ≤ a * b) :
214
+ (0 ≤ a ∧ 0 ≤ b) ∨ (a ≤ 0 ∧ b ≤ 0 ) :=
215
+ begin
216
+ contrapose! hab,
217
+ rcases lt_trichotomy 0 a with (ha|rfl|ha),
218
+ exacts [mul_neg_of_pos_of_neg ha (hab.1 ha.le), ((hab.1 le_rfl).asymm (hab.2 le_rfl)).elim,
219
+ mul_neg_of_neg_of_pos ha (hab.2 ha.le)]
220
+ end
221
+
222
+ lemma pos_of_mul_pos_left (h : 0 < a * b) (ha : 0 ≤ a) : 0 < b :=
223
+ ((pos_and_pos_or_neg_and_neg_of_mul_pos h).resolve_right $ λ h, h.1 .not_le ha).2
224
+
225
+ lemma pos_of_mul_pos_right (h : 0 < a * b) (hb : 0 ≤ b) : 0 < a :=
226
+ ((pos_and_pos_or_neg_and_neg_of_mul_pos h).resolve_right $ λ h, h.2 .not_le hb).1
211
227
212
228
lemma nonneg_of_mul_nonneg_left (h : 0 ≤ a * b) (h1 : 0 < a) : 0 ≤ b :=
213
229
le_of_not_gt (assume h2 : b < 0 , (mul_neg_of_pos_of_neg h1 h2).not_le h)
@@ -523,29 +539,37 @@ instance linear_ordered_ring.to_linear_ordered_semiring : linear_ordered_semirin
523
539
le_total := linear_ordered_ring.le_total,
524
540
..‹linear_ordered_ring α› }
525
541
542
+ @[priority 100 ] -- see Note [lower instance priority]
543
+ instance linear_ordered_ring.to_domain : domain α :=
544
+ { eq_zero_or_eq_zero_of_mul_eq_zero :=
545
+ begin
546
+ intros a b hab,
547
+ contrapose! hab,
548
+ cases (lt_or_gt_of_ne hab.1 ) with ha ha; cases (lt_or_gt_of_ne hab.2 ) with hb hb,
549
+ exacts [(mul_pos_of_neg_of_neg ha hb).ne.symm, (mul_neg_of_neg_of_pos ha hb).ne,
550
+ (mul_neg_of_pos_of_neg ha hb).ne, (mul_pos ha hb).ne.symm]
551
+ end ,
552
+ .. ‹linear_ordered_ring α› }
553
+
554
+ lemma mul_pos_iff : 0 < a * b ↔ 0 < a ∧ 0 < b ∨ a < 0 ∧ b < 0 :=
555
+ ⟨pos_and_pos_or_neg_and_neg_of_mul_pos,
556
+ λ h, h.elim (and_imp.2 mul_pos) (and_imp.2 mul_pos_of_neg_of_neg)⟩
557
+
558
+ lemma mul_neg_iff : a * b < 0 ↔ 0 < a ∧ b < 0 ∨ a < 0 ∧ 0 < b :=
559
+ by rw [← neg_pos, neg_mul_eq_mul_neg, mul_pos_iff, neg_pos, neg_lt_zero]
560
+
561
+ lemma mul_nonneg_iff : 0 ≤ a * b ↔ 0 ≤ a ∧ 0 ≤ b ∨ a ≤ 0 ∧ b ≤ 0 :=
562
+ ⟨nonneg_and_nonneg_or_nonpos_and_nonpos_of_mul_nnonneg,
563
+ λ h, h.elim (and_imp.2 mul_nonneg) (and_imp.2 mul_nonneg_of_nonpos_of_nonpos)⟩
564
+
565
+ lemma mul_nonpos_iff : a * b ≤ 0 ↔ 0 ≤ a ∧ b ≤ 0 ∨ a ≤ 0 ∧ 0 ≤ b :=
566
+ by rw [← neg_nonneg, neg_mul_eq_mul_neg, mul_nonneg_iff, neg_nonneg, neg_nonpos]
567
+
526
568
lemma mul_self_nonneg (a : α) : 0 ≤ a * a :=
527
569
or.elim (le_total 0 a)
528
570
(assume h : a ≥ 0 , mul_nonneg h h)
529
571
(assume h : a ≤ 0 , mul_nonneg_of_nonpos_of_nonpos h h)
530
572
531
- lemma pos_and_pos_or_neg_and_neg_of_mul_pos (hab : 0 < a * b) :
532
- (0 < a ∧ 0 < b) ∨ (a < 0 ∧ b < 0 ) :=
533
- match lt_trichotomy 0 a with
534
- | or.inl hlt₁ :=
535
- match lt_trichotomy 0 b with
536
- | or.inl hlt₂ := or.inl ⟨hlt₁, hlt₂⟩
537
- | or.inr (or.inl heq₂) := begin rw [← heq₂, mul_zero] at hab, exact absurd hab (lt_irrefl _) end
538
- | or.inr (or.inr hgt₂) := absurd hab (lt_asymm (mul_neg_of_pos_of_neg hlt₁ hgt₂))
539
- end
540
- | or.inr (or.inl heq₁) := begin rw [← heq₁, zero_mul] at hab, exact absurd hab (lt_irrefl _) end
541
- | or.inr (or.inr hgt₁) :=
542
- match lt_trichotomy 0 b with
543
- | or.inl hlt₂ := absurd hab (lt_asymm (mul_neg_of_neg_of_pos hgt₁ hlt₂))
544
- | or.inr (or.inl heq₂) := begin rw [← heq₂, mul_zero] at hab, exact absurd hab (lt_irrefl _) end
545
- | or.inr (or.inr hgt₂) := or.inr ⟨hgt₁, hgt₂⟩
546
- end
547
- end
548
-
549
573
lemma gt_of_mul_lt_mul_neg_left (h : c * a < c * b) (hc : c ≤ 0 ) : b < a :=
550
574
have nhc : 0 ≤ -c, from neg_nonneg_of_nonpos hc,
551
575
have h2 : -(c * b) < -(c * a), from neg_lt_neg h,
@@ -555,7 +579,6 @@ have h3 : (-c) * b < (-c) * a, from calc
555
579
... = (-c) * a : by rewrite neg_mul_eq_neg_mul,
556
580
lt_of_mul_lt_mul_left h3 nhc
557
581
558
-
559
582
lemma neg_one_lt_zero : -1 < (0 :α) :=
560
583
begin
561
584
have this := neg_lt_neg (@zero_lt_one α _),
@@ -579,44 +602,13 @@ lemma mul_self_lt_mul_self_iff {a b : α} (h1 : 0 ≤ a) (h2 : 0 ≤ b) : a < b
579
602
iff.trans (lt_iff_not_ge _ _) $ iff.trans (not_iff_not_of_iff $ mul_self_le_mul_self_iff h2 h1) $
580
603
iff.symm (lt_iff_not_ge _ _)
581
604
582
- lemma linear_ordered_ring.eq_zero_or_eq_zero_of_mul_eq_zero
583
- {a b : α} (h : a * b = 0 ) : a = 0 ∨ b = 0 :=
584
- match lt_trichotomy 0 a with
585
- | or.inl hlt₁ :=
586
- match lt_trichotomy 0 b with
587
- | or.inl hlt₂ :=
588
- have 0 < a * b, from mul_pos hlt₁ hlt₂,
589
- begin rw h at this , exact absurd this (lt_irrefl _) end
590
- | or.inr (or.inl heq₂) := or.inr heq₂.symm
591
- | or.inr (or.inr hgt₂) :=
592
- have 0 > a * b, from mul_neg_of_pos_of_neg hlt₁ hgt₂,
593
- begin rw h at this , exact absurd this (lt_irrefl _) end
594
- end
595
- | or.inr (or.inl heq₁) := or.inl heq₁.symm
596
- | or.inr (or.inr hgt₁) :=
597
- match lt_trichotomy 0 b with
598
- | or.inl hlt₂ :=
599
- have 0 > a * b, from mul_neg_of_neg_of_pos hgt₁ hlt₂,
600
- begin rw h at this , exact absurd this (lt_irrefl _) end
601
- | or.inr (or.inl heq₂) := or.inr heq₂.symm
602
- | or.inr (or.inr hgt₂) :=
603
- have 0 < a * b, from mul_pos_of_neg_of_neg hgt₁ hgt₂,
604
- begin rw h at this , exact absurd this (lt_irrefl _) end
605
- end
606
- end
607
-
608
605
/- TODO This theorem ought to be written in the context of `nontrivial` linearly ordered (additive)
609
606
commutative groups rather than linearly ordered rings; however, the former concept does not
610
607
currently exist in mathlib. -/
611
608
@[priority 100 ] -- see Note [lower instance priority]
612
609
instance linear_ordered_ring.to_no_bot_order : no_bot_order α :=
613
610
⟨assume a, ⟨a - 1 , sub_lt_iff_lt_add.mpr $ lt_add_of_pos_right _ zero_lt_one⟩⟩
614
611
615
- @[priority 100 ] -- see Note [lower instance priority]
616
- instance linear_ordered_ring.to_domain : domain α :=
617
- { eq_zero_or_eq_zero_of_mul_eq_zero := @linear_ordered_ring.eq_zero_or_eq_zero_of_mul_eq_zero α _,
618
- ..‹linear_ordered_ring α› }
619
-
620
612
@[simp] lemma mul_le_mul_left_of_neg {a b c : α} (h : c < 0 ) : c * a ≤ c * b ↔ b ≤ a :=
621
613
⟨le_imp_le_of_lt_imp_lt $ λ h', mul_lt_mul_of_neg_left h' h,
622
614
λ h', mul_le_mul_of_nonpos_left h' h.le⟩
@@ -675,9 +667,9 @@ such that multiplication with a positive number and addition are monotone. -/
675
667
class linear_ordered_comm_ring (α : Type u) extends linear_ordered_ring α, comm_monoid α
676
668
677
669
@[priority 100 ] -- see Note [lower instance priority]
678
- instance linear_ordered_comm_ring.to_integral_domain [s: linear_ordered_comm_ring α] : integral_domain α :=
679
- { eq_zero_or_eq_zero_of_mul_eq_zero := @linear_ordered_ring.eq_zero_or_eq_zero_of_mul_eq_zero α _,
680
- ..s }
670
+ instance linear_ordered_comm_ring.to_integral_domain [s: linear_ordered_comm_ring α] :
671
+ integral_domain α :=
672
+ { ..s, .. linear_ordered_ring.to_domain }
681
673
682
674
/-- A `decidable_linear_ordered_comm_ring α` is a commutative ring `α` with a
683
675
decidable linear order such that multiplication with a positive number and
@@ -786,17 +778,14 @@ begin
786
778
apply sub_le_sub_left,
787
779
iterate {rw mul_assoc},
788
780
apply mul_le_mul_of_nonneg_left,
789
- rw [← abs_mul],
790
- apply le_abs_self,
791
- apply le_of_lt,
792
- apply add_pos,
793
- apply zero_lt_one,
794
- apply zero_lt_one
781
+ { rw [← abs_mul],
782
+ apply le_abs_self },
783
+ { exact (add_pos (@zero_lt_one α _) zero_lt_one).le }
795
784
end
796
785
797
786
-- The proof doesn't need commutativity but we have no `decidable_linear_ordered_ring`
798
787
@[simp] lemma abs_two : abs (2 :α) = 2 :=
799
- abs_of_pos $ by refine zero_lt_two
788
+ abs_of_pos zero_lt_two
800
789
801
790
end decidable_linear_ordered_comm_ring
802
791
0 commit comments