@@ -35,7 +35,7 @@ lemma is_unit_of_dvd_one [comm_monoid α] : ∀a ∣ 1, is_unit (a:α)
35
35
| a ⟨b, eq⟩ := ⟨units.mk_of_mul_eq_one a b eq.symm, rfl⟩
36
36
37
37
lemma dvd_and_not_dvd_iff [comm_cancel_monoid_with_zero α] {x y : α} :
38
- x ∣ y ∧ ¬y ∣ x ↔ x ≠ 0 ∧ ∃ d : α, ¬ is_unit d ∧ y = x * d :=
38
+ x ∣ y ∧ ¬y ∣ x ↔ dvd_not_unit x y :=
39
39
⟨λ ⟨⟨d, hd⟩, hyx⟩, ⟨λ hx0, by simpa [hx0] using hyx, ⟨d,
40
40
mt is_unit_iff_dvd_one.1 (λ ⟨e, he⟩, hyx ⟨e, by rw [hd, mul_assoc, ← he, mul_one]⟩), hd⟩⟩,
41
41
λ ⟨hx0, d, hdu, hdx⟩, ⟨⟨d, hdx⟩, λ ⟨e, he⟩, hdu (is_unit_of_dvd_one _
@@ -367,6 +367,9 @@ iff.intro
367
367
(assume h a, h _)
368
368
(assume h a, quotient.induction_on a h)
369
369
370
+ theorem mk_surjective [monoid α] : function.surjective (@associates.mk α _) :=
371
+ forall_associated.2 (λ a, ⟨a, rfl⟩)
372
+
370
373
instance [monoid α] : has_one (associates α) := ⟨⟦ 1 ⟧⟩
371
374
372
375
theorem one_eq_mk_one [monoid α] : (1 : associates α) = associates.mk 1 := rfl
@@ -547,6 +550,55 @@ begin
547
550
rw [mk_mul_mk, mk_dvd_mk, mk_dvd_mk, mk_dvd_mk],
548
551
end
549
552
553
+ theorem irreducible_mk (a : α) : irreducible (associates.mk a) ↔ irreducible a :=
554
+ begin
555
+ simp only [irreducible, is_unit_mk],
556
+ apply and_congr iff.rfl,
557
+ split,
558
+ { rintro h x y rfl,
559
+ simpa [is_unit_mk] using h (associates.mk x) (associates.mk y) rfl },
560
+ { intros h x y,
561
+ refine quotient.induction_on₂ x y (assume x y a_eq, _),
562
+ rcases quotient.exact a_eq.symm with ⟨u, a_eq⟩,
563
+ rw mul_assoc at a_eq,
564
+ show is_unit (associates.mk x) ∨ is_unit (associates.mk y),
565
+ simpa [is_unit_mk] using h _ _ a_eq.symm }
566
+ end
567
+
568
+ theorem mk_dvd_not_unit_mk_iff {a b : α} :
569
+ dvd_not_unit (associates.mk a) (associates.mk b) ↔
570
+ dvd_not_unit a b :=
571
+ begin
572
+ rw [dvd_not_unit, dvd_not_unit, ne, ne, mk_eq_zero],
573
+ apply and_congr_right, intro ane0,
574
+ split,
575
+ { contrapose!, rw forall_associated,
576
+ intros h x hx hbax,
577
+ rw [mk_mul_mk, mk_eq_mk_iff_associated] at hbax,
578
+ cases hbax with u hu,
579
+ apply h (x * ↑u⁻¹),
580
+ { rw is_unit_mk at hx,
581
+ rw is_unit_iff_of_associated,
582
+ apply hx,
583
+ use u,
584
+ simp, },
585
+ simp [← mul_assoc, ← hu] },
586
+ { rintro ⟨x, ⟨hx, rfl⟩⟩,
587
+ use associates.mk x,
588
+ simp [is_unit_mk, mk_mul_mk, hx], }
589
+ end
590
+
591
+ theorem dvd_not_unit_of_lt {a b : associates α} (hlt : a < b) :
592
+ dvd_not_unit a b :=
593
+ begin
594
+ split, { rintro rfl, apply not_lt_of_le _ hlt, apply dvd_zero },
595
+ rcases hlt with ⟨⟨x, rfl⟩, ndvd⟩,
596
+ refine ⟨x, _, rfl⟩,
597
+ contrapose! ndvd,
598
+ rcases ndvd with ⟨u, rfl⟩,
599
+ simp,
600
+ end
601
+
550
602
end comm_monoid_with_zero
551
603
552
604
section comm_cancel_monoid_with_zero
@@ -579,27 +631,11 @@ theorem prod_eq_zero_iff [nontrivial α] {s : multiset (associates α)} :
579
631
multiset.induction_on s (by simp) $
580
632
assume a s, by simp [mul_eq_zero, @eq_comm _ 0 a] {contextual := tt}
581
633
582
- theorem irreducible_mk_iff (a : α) : irreducible (associates.mk a) ↔ irreducible a :=
583
- begin
584
- simp [irreducible, is_unit_mk],
585
- apply and_congr iff.rfl,
586
- split,
587
- { assume h x y eq,
588
- have : is_unit (associates.mk x) ∨ is_unit (associates.mk y),
589
- from h _ _ (by rw [eq]; refl),
590
- simpa [is_unit_mk] },
591
- { refine assume h x y, quotient.induction_on₂ x y (assume x y eq, _),
592
- rcases quotient.exact eq.symm with ⟨u, eq⟩,
593
- have : a = x * (y * u), by rwa [mul_assoc, eq_comm] at eq,
594
- show is_unit (associates.mk x) ∨ is_unit (associates.mk y),
595
- simpa [is_unit_mk] using h _ _ this }
596
- end
597
-
598
634
theorem irreducible_iff_prime_iff :
599
635
(∀ a : α, irreducible a ↔ prime a) ↔ (∀ a : (associates α), irreducible a ↔ prime a) :=
600
636
begin
601
637
rw forall_associated, split;
602
- intros h a; have ha := h a; rw irreducible_mk_iff at *; rw prime_mk at *; exact ha,
638
+ intros h a; have ha := h a; rw irreducible_mk at *; rw prime_mk at *; exact ha,
603
639
end
604
640
605
641
lemma eq_of_mul_eq_mul_left :
@@ -619,10 +655,6 @@ lemma le_of_mul_le_mul_left (a b c : associates α) (ha : a ≠ 0) :
619
655
a * b ≤ a * c → b ≤ c
620
656
| ⟨d, hd⟩ := ⟨d, eq_of_mul_eq_mul_left a _ _ ha $ by rwa ← mul_assoc⟩
621
657
622
- lemma le_of_mul_le_mul_right (a b c : associates α) (hb : b ≠ 0 ) :
623
- a * b ≤ c * b → a ≤ c :=
624
- (mul_comm b a) ▸ (mul_comm b c) ▸ (le_of_mul_le_mul_left b a c hb)
625
-
626
658
lemma one_or_eq_of_le_of_prime :
627
659
∀(p m : associates α), prime p → m ≤ p → (m = 1 ∨ m = p)
628
660
| _ m ⟨hp0, hp1, h⟩ ⟨d, rfl⟩ :=
@@ -644,6 +676,10 @@ instance : comm_cancel_monoid_with_zero (associates α) :=
644
676
mul_right_cancel_of_ne_zero := eq_of_mul_eq_mul_right,
645
677
.. (infer_instance : comm_monoid_with_zero (associates α)) }
646
678
679
+ theorem dvd_not_unit_iff_lt {a b : associates α} :
680
+ dvd_not_unit a b ↔ a < b :=
681
+ dvd_and_not_dvd_iff.symm
682
+
647
683
end comm_cancel_monoid_with_zero
648
684
649
685
end associates
0 commit comments