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

Commit 1edb79a

Browse files
committed
refactor(ring_theory/associated): rename associated_elements
1 parent 956398c commit 1edb79a

File tree

2 files changed

+34
-7
lines changed

2 files changed

+34
-7
lines changed

ring_theory/associated_elements.lean renamed to ring_theory/associated.lean

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ def is_unit [monoid α] (a : α) : Prop := ∃u:units α, a = u
1515
@[simp] theorem not_is_unit_zero [nonzero_comm_ring α] : ¬ is_unit (0 : α)
1616
| ⟨⟨a, b, hab, hba⟩, rfl⟩ := have 0 * b = 1, from hab, by simpa using this
1717

18-
@[simp] theorem is_unit_nat {n : ℕ} : is_unit n ↔ n = 1 :=
19-
iff.intro
20-
(assume ⟨u, hu⟩, match n, u, hu, nat.units_eq_one u with _, _, rfl, rfl := rfl end)
21-
(assume h, h.symm ▸ ⟨1, rfl⟩)
22-
2318
@[simp] theorem is_unit_one [monoid α] : is_unit (1:α) := ⟨1, rfl⟩
2419

2520
theorem units.is_unit_of_mul_one [comm_monoid α] (a b : α) (h : a * b = 1) : is_unit a :=
@@ -32,12 +27,29 @@ iff.intro
3227
by rwa [mul_assoc, units.mul_inv, mul_one] at this)
3328
(assume ⟨v, hv⟩, hv.symm ▸ ⟨v * u, (units.mul_coe v u).symm⟩)
3429

30+
theorem is_unit_iff_dvd_one {α} [comm_semiring α] {x : α} : is_unit x ↔ x ∣ 1 :=
31+
by rintro ⟨u, rfl⟩; exact ⟨_, u.mul_inv.symm⟩,
32+
λ ⟨y, h⟩, ⟨⟨x, y, h.symm, by rw [h, mul_comm]⟩, rfl⟩⟩
33+
34+
theorem is_unit_iff_forall_dvd {α} [comm_semiring α] {x : α} :
35+
is_unit x ↔ ∀ y, x ∣ y :=
36+
is_unit_iff_dvd_one.trans ⟨λ h y, dvd.trans h (one_dvd _), λ h, h _⟩
37+
38+
theorem is_unit_of_dvd_unit {α} [comm_semiring α] {x y : α}
39+
(xy : x ∣ y) (hu : is_unit y) : is_unit x :=
40+
is_unit_iff_dvd_one.2 $ dvd_trans xy $ is_unit_iff_dvd_one.1 hu
41+
42+
@[simp] theorem is_unit_nat {n : ℕ} : is_unit n ↔ n = 1 :=
43+
iff.intro
44+
(assume ⟨u, hu⟩, match n, u, hu, nat.units_eq_one u with _, _, rfl, rfl := rfl end)
45+
(assume h, h.symm ▸ ⟨1, rfl⟩)
46+
3547
/-- `irreducible p` states that `p` is non-unit and only factors into units.
3648
3749
We explicitly avoid stating that `p` is non-zero, this would require a semiring. Assuming only a
3850
monoid allows us to reuse irreducible for associated elements.
3951
-/
40-
def irreducible [monoid α] (p : α) : Prop :=
52+
@[class] def irreducible [monoid α] (p : α) : Prop :=
4153
¬ is_unit p ∧ ∀a b, p = a * b → is_unit a ∨ is_unit b
4254

4355
@[simp] theorem not_irreducible_one [monoid α] : ¬ irreducible (1 : α) :=
@@ -47,6 +59,21 @@ by simp [irreducible]
4759
| ⟨hn0, h⟩ := have is_unit (0:α) ∨ is_unit (0:α), from h 0 0 ((mul_zero 0).symm),
4860
this.elim hn0 hn0
4961

62+
theorem of_irreducible_mul {α} [monoid α] {x y : α} :
63+
irreducible (x * y) → is_unit x ∨ is_unit y
64+
| ⟨_, h⟩ := h _ _ rfl
65+
66+
theorem irreducible_or_factor {α} [monoid α] (x : α) (h : ¬ is_unit x) :
67+
irreducible x ∨ ∃ a b, ¬ is_unit a ∧ ¬ is_unit b ∧ a * b = x :=
68+
begin
69+
haveI := classical.dec,
70+
refine or_iff_not_imp_right.2 (λ H, _),
71+
simp [h, irreducible] at H ⊢,
72+
refine λ a b h, classical.by_contradiction $ λ o, _,
73+
simp [not_or_distrib] at o,
74+
exact H _ o.1 _ o.2 h.symm
75+
end
76+
5077
theorem irreducible_iff_nat_prime : ∀(a : ℕ), irreducible a ↔ nat.prime a
5178
| 0 := by simp [nat.not_prime_zero]
5279
| 1 := by simp [nat.prime, one_lt_two]

ring_theory/unique_factorization_domain.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Theory of unique factorization domains.
77
88
@TODO: setup the complete lattice structure on `factor_set`.
99
-/
10-
import ring_theory.associated_elements algebra.gcd_domain
10+
import ring_theory.associated algebra.gcd_domain
1111

1212
variables {α : Type*}
1313
local infix ` ~ᵤ ` : 50 := associated

0 commit comments

Comments
 (0)