Skip to content

Commit 33c530f

Browse files
feat: add Nat.gcd_right_comm and Int.gcd_right_comm (#39937)
1 parent 8d95dbc commit 33c530f

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

Mathlib/Data/Int/Init.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,4 +356,7 @@ lemma natMod_lt {n : ℕ} (hn : n ≠ 0) : m.natMod n < n :=
356356
@[simp] lemma gcd_negSucc_negSucc (m n : ℕ) :
357357
(negSucc m).gcd (negSucc n) = (m + 1).gcd (n + 1) := by simp [gcd]
358358

359+
theorem gcd_right_comm (a b c : ℤ) : gcd (gcd a b) c = gcd (gcd a c) b := by
360+
rw [gcd_assoc, gcd_assoc, gcd_comm b c]
361+
359362
end Int

Mathlib/Data/Nat/GCD/Basic.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ theorem gcd_greatest {a b d : ℕ} (hda : d ∣ a) (hdb : d ∣ b) (hd : ∀ e :
3636
d = a.gcd b :=
3737
(dvd_antisymm (hd _ (gcd_dvd_left a b) (gcd_dvd_right a b)) (dvd_gcd hda hdb)).symm
3838

39+
theorem gcd_right_comm (a b c : ℕ) : gcd (gcd a b) c = gcd (gcd a c) b := by
40+
rw [gcd_assoc, gcd_assoc, gcd_comm b c]
41+
3942
/-! Lemmas where one argument consists of addition of a multiple of the other -/
4043

4144
@[simp]

0 commit comments

Comments
 (0)