2015-02-25 21:58:39 +00:00
|
|
|
|
import data.nat
|
2015-10-13 22:39:03 +00:00
|
|
|
|
open nat eq.ops algebra
|
2015-02-25 21:58:39 +00:00
|
|
|
|
|
2015-04-06 16:24:09 +00:00
|
|
|
|
theorem lcm_dvd {m n k : nat} (H1 : m ∣ k) (H2 : (n ∣ k)) : (lcm m n ∣ k) :=
|
2015-02-25 21:58:39 +00:00
|
|
|
|
match eq_zero_or_pos k with
|
2015-02-26 00:20:44 +00:00
|
|
|
|
| @or.inl _ _ kzero :=
|
2015-02-25 21:58:39 +00:00
|
|
|
|
begin
|
|
|
|
|
rewrite kzero,
|
|
|
|
|
apply dvd_zero
|
2015-02-26 00:20:44 +00:00
|
|
|
|
end
|
|
|
|
|
| @or.inr _ _ kpos :=
|
2015-02-25 21:58:39 +00:00
|
|
|
|
obtain (p : nat) (km : k = m * p), from exists_eq_mul_right_of_dvd H1,
|
|
|
|
|
obtain (q : nat) (kn : k = n * q), from exists_eq_mul_right_of_dvd H2,
|
|
|
|
|
begin
|
|
|
|
|
have mpos : m > 0, from pos_of_dvd_of_pos H1 kpos,
|
|
|
|
|
have npos : n > 0, from pos_of_dvd_of_pos H2 kpos,
|
|
|
|
|
have gcd_pos : gcd m n > 0, from gcd_pos_of_pos_left n mpos,
|
|
|
|
|
have ppos : p > 0,
|
|
|
|
|
begin
|
|
|
|
|
apply pos_of_mul_pos_left,
|
|
|
|
|
apply (eq.rec_on km),
|
|
|
|
|
exact kpos
|
|
|
|
|
end,
|
|
|
|
|
have qpos : q > 0, from pos_of_mul_pos_left (kn ▸ kpos),
|
|
|
|
|
have H3 : p * q * (m * n * gcd p q) = p * q * (gcd m n * k),
|
|
|
|
|
begin
|
|
|
|
|
apply sorry
|
|
|
|
|
end,
|
|
|
|
|
have H4 : m * n * gcd p q = gcd m n * k, from
|
|
|
|
|
!eq_of_mul_eq_mul_left (mul_pos ppos qpos) H3,
|
|
|
|
|
have H5 : gcd m n * (lcm m n * gcd p q) = gcd m n * k,
|
|
|
|
|
begin
|
|
|
|
|
rewrite [-mul.assoc, gcd_mul_lcm],
|
|
|
|
|
exact H4
|
|
|
|
|
end,
|
|
|
|
|
have H6 : lcm m n * gcd p q = k, from
|
|
|
|
|
!eq_of_mul_eq_mul_left gcd_pos H5,
|
|
|
|
|
exact (dvd.intro H6)
|
|
|
|
|
end
|
|
|
|
|
end
|