Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 7c205ff

Browse files
feat(data/nat/totient): add lemma totient_dvd_of_dvd (#15642)
Adds `totient_dvd_of_dvd (h : a ∣ b) : φ a ∣ φ b`. This is Theorem 2.5(d) in Apostol (1976) Introduction to Analytic Number Theory.
1 parent b5eb042 commit 7c205ff

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/data/finsupp/basic.lean

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,6 +1535,18 @@ have ∀ {f1 f2 : α →₀ M}, disjoint f1.support f2.support →
15351535
by simp_rw [← this hd, ← this hd.symm,
15361536
add_comm (f2 _), finsupp.prod, support_add_eq hd, prod_union hd, add_apply]
15371537

1538+
lemma prod_dvd_prod_of_subset_of_dvd [add_comm_monoid M] [comm_monoid N]
1539+
{f1 f2 : α →₀ M} {g1 g2 : α → M → N} (h1 : f1.support ⊆ f2.support)
1540+
(h2 : ∀ (a : α), a ∈ f1.support → g1 a (f1 a) ∣ g2 a (f2 a)) :
1541+
f1.prod g1 ∣ f2.prod g2 :=
1542+
begin
1543+
simp only [finsupp.prod, finsupp.prod_mul],
1544+
rw [←sdiff_union_of_subset h1, prod_union sdiff_disjoint],
1545+
apply dvd_mul_of_dvd_right,
1546+
apply prod_dvd_prod_of_dvd,
1547+
exact h2,
1548+
end
1549+
15381550
section map_range
15391551

15401552
section equiv

src/data/nat/totient.lean

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,19 @@ begin
336336
apply mul_le_mul_left' (nat.totient_le d),
337337
end
338338

339+
lemma totient_dvd_of_dvd {a b : ℕ} (h : a ∣ b) : φ a ∣ φ b :=
340+
begin
341+
rcases eq_or_ne a 0 with rfl | ha0, { simp [zero_dvd_iff.1 h] },
342+
rcases eq_or_ne b 0 with rfl | hb0, { simp },
343+
have hab' : a.factorization.support ⊆ b.factorization.support,
344+
{ intro p,
345+
simp only [support_factorization, list.mem_to_finset],
346+
apply factors_subset_of_dvd h hb0 },
347+
rw [totient_eq_prod_factorization ha0, totient_eq_prod_factorization hb0],
348+
refine finsupp.prod_dvd_prod_of_subset_of_dvd hab' (λ p hp, mul_dvd_mul _ dvd_rfl),
349+
exact pow_dvd_pow p (tsub_le_tsub_right ((factorization_le_iff_dvd ha0 hb0).2 h p) 1),
350+
end
351+
339352
lemma totient_mul_of_prime_of_dvd {p n : ℕ} (hp : p.prime) (h : p ∣ n) :
340353
(p * n).totient = p * n.totient :=
341354
begin

0 commit comments

Comments
 (0)