Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(algebra/gcd_monoid/*): assorted lemmas (#10508)
From flt-regular. Co-authored-by: Johan Commelin <johan@commelin.net>
- Loading branch information
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/- | ||
Copyright (c) 2021 Eric Rodriguez. All rights reserved. | ||
Released under Apache 2.0 license as described in the file LICENSE. | ||
Authors: Eric Rodriguez | ||
-/ | ||
import algebra.gcd_monoid.finset | ||
import number_theory.padics.padic_norm | ||
|
||
/-! | ||
# Basic results about setwise gcds on ℕ | ||
This file proves some basic results about `finset.gcd` on `ℕ`. | ||
## Main results | ||
* `finset.coprime_of_div_gcd`: The elements of a set divided through by their gcd are coprime. | ||
-/ | ||
|
||
instance : is_idempotent ℕ gcd_monoid.gcd := ⟨nat.gcd_self⟩ | ||
|
||
namespace finset | ||
|
||
theorem coprime_of_div_gcd (s : finset ℕ) {x : ℕ} (hx : x ∈ s) (hnz : x ≠ 0) : | ||
s.gcd (/ (s.gcd id)) = 1 := | ||
begin | ||
rw nat.eq_one_iff_not_exists_prime_dvd, | ||
intros p hp hdvd, | ||
haveI : fact p.prime := ⟨hp⟩, | ||
rw dvd_gcd_iff at hdvd, | ||
replace hdvd : ∀ b ∈ s, s.gcd id * p ∣ b, | ||
{ intros b hb, | ||
specialize hdvd b hb, | ||
rwa nat.dvd_div_iff at hdvd, | ||
apply gcd_dvd hb }, | ||
have : s.gcd id ≠ 0 := (not_iff_not.mpr gcd_eq_zero_iff).mpr (λ h, hnz $ h x hx), | ||
apply @pow_succ_padic_val_nat_not_dvd p _ _ this.bot_lt, | ||
apply dvd_gcd, | ||
intros b hb, | ||
obtain ⟨k, rfl⟩ := hdvd b hb, | ||
rw [id, mul_right_comm, pow_succ', mul_dvd_mul_iff_right hp.ne_zero], | ||
apply dvd_mul_of_dvd_left, | ||
exact pow_padic_val_nat_dvd | ||
end | ||
|
||
end finset |