Skip to content

Commit

Permalink
feat(Nat/Defs): Add div_dvd_iff_dvd_mul (#12243)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jun2M committed Apr 24, 2024
1 parent 7b35e32 commit a11d678
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Mathlib/Data/Nat/Defs.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1377,6 +1377,17 @@ lemma dvd_div_of_mul_dvd (h : a * b ∣ c) : b ∣ c / a :=
fun h => mul_dvd_of_dvd_div hbc h, fun h => dvd_div_of_mul_dvd h⟩
#align nat.dvd_div_iff Nat.dvd_div_iff

lemma dvd_mul_of_div_dvd (h : b ∣ a) (hdiv : a / b ∣ c) : a ∣ b * c := by
obtain ⟨e, rfl⟩ := hdiv
rw [← Nat.mul_assoc, Nat.mul_comm _ (a / b), Nat.div_mul_cancel h]
exact Nat.dvd_mul_right a e

@[simp] lemma div_dvd_iff_dvd_mul (h : b ∣ a) (hb : b ≠ 0) : a / b ∣ c ↔ a ∣ b * c :=
exists_congr <| fun d => by
have := Nat.dvd_trans (Nat.dvd_mul_left _ d) (Nat.mul_dvd_mul_left d h)
rw [eq_comm, Nat.mul_comm, ← Nat.mul_div_assoc d h,
Nat.div_eq_iff_eq_mul_right (Nat.pos_of_ne_zero hb) this, Nat.mul_comm, eq_comm]

@[simp] lemma div_div_div_eq_div (dvd : b ∣ a) (dvd2 : a ∣ c) : c / (a / b) / b = c / a :=
match a, b, c with
| 0, _, _ => by simp
Expand Down

0 comments on commit a11d678

Please sign in to comment.