@@ -1420,3 +1420,39 @@ theorem normalize_eq_one {a : G₀} (h0 : a ≠ 0) : normalize a = 1 := by simp
1420
1420
#align comm_group_with_zero.normalize_eq_one CommGroupWithZero.normalize_eq_one
1421
1421
1422
1422
end CommGroupWithZero
1423
+
1424
+ theorem Associated.gcd [CancelCommMonoidWithZero α] [GCDMonoid α]
1425
+ {a₁ a₂ b₁ b₂ : α} (ha : Associated a₁ a₂) (hb : Associated b₁ b₂) :
1426
+ Associated (gcd a₁ b₁) (gcd a₂ b₂) :=
1427
+ associated_of_dvd_dvd (gcd_dvd_gcd ha.dvd hb.dvd) (gcd_dvd_gcd ha.symm.dvd hb.symm.dvd)
1428
+
1429
+ theorem Associated.lcm [CancelCommMonoidWithZero α] [GCDMonoid α]
1430
+ {a₁ a₂ b₁ b₂ : α} (ha : Associated a₁ a₂) (hb : Associated b₁ b₂) :
1431
+ Associated (lcm a₁ b₁) (lcm a₂ b₂) :=
1432
+ associated_of_dvd_dvd (lcm_dvd_lcm ha.dvd hb.dvd) (lcm_dvd_lcm ha.symm.dvd hb.symm.dvd)
1433
+
1434
+ namespace Associates
1435
+
1436
+ variable [CancelCommMonoidWithZero α] [GCDMonoid α]
1437
+
1438
+ instance instGCDMonoid : GCDMonoid (Associates α) where
1439
+ gcd := Quotient.map₂' gcd fun a₁ a₂ (ha : Associated _ _) b₁ b₂ (hb : Associated _ _) => ha.gcd hb
1440
+ lcm := Quotient.map₂' lcm fun a₁ a₂ (ha : Associated _ _) b₁ b₂ (hb : Associated _ _) => ha.lcm hb
1441
+ gcd_dvd_left := by rintro ⟨a⟩ ⟨b⟩; exact mk_le_mk_of_dvd (gcd_dvd_left _ _)
1442
+ gcd_dvd_right := by rintro ⟨a⟩ ⟨b⟩; exact mk_le_mk_of_dvd (gcd_dvd_right _ _)
1443
+ dvd_gcd := by
1444
+ rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ hac hbc
1445
+ exact mk_le_mk_of_dvd (dvd_gcd (dvd_of_mk_le_mk hac) (dvd_of_mk_le_mk hbc))
1446
+ gcd_mul_lcm := by
1447
+ rintro ⟨a⟩ ⟨b⟩
1448
+ rw [associated_iff_eq]
1449
+ exact Quotient.sound <| gcd_mul_lcm _ _
1450
+ lcm_zero_left := by rintro ⟨a⟩; exact congr_arg Associates.mk <| lcm_zero_left _
1451
+ lcm_zero_right := by rintro ⟨a⟩; exact congr_arg Associates.mk <| lcm_zero_right _
1452
+
1453
+ theorem gcd_mk_mk {a b : α} : gcd (Associates.mk a) (Associates.mk b) = Associates.mk (gcd a b) :=
1454
+ rfl
1455
+ theorem lcm_mk_mk {a b : α} : lcm (Associates.mk a) (Associates.mk b) = Associates.mk (lcm a b) :=
1456
+ rfl
1457
+
1458
+ end Associates
0 commit comments