# Arithmetic Functions and Dirichlet Convolution #

This file defines arithmetic functions, which are functions from ℕ to a specified type that map 0 to 0. In the literature, they are often instead defined as functions from ℕ+. These arithmetic functions are endowed with a multiplication, given by Dirichlet convolution, and pointwise addition, to form the Dirichlet ring.

## Main Definitions #

• ArithmeticFunction R consists of functions f : ℕ → R such that f 0 = 0.
• An arithmetic function f IsMultiplicative when x.coprime y → f (x * y) = f x * f y.
• The pointwise operations pmul and ppow differ from the multiplication and power instances on ArithmeticFunction R, which use Dirichlet multiplication.
• ζ is the arithmetic function such that ζ x = 1 for 0 < x.
• σ k is the arithmetic function such that σ k x = ∑ y ∈ divisors x, y ^ k for 0 < x.
• pow k is the arithmetic function such that pow k x = x ^ k for 0 < x.
• id is the identity arithmetic function on ℕ.
• ω n is the number of distinct prime factors of n.
• Ω n is the number of prime factors of n counted with multiplicity.
• μ is the Möbius function (spelled moebius in code).

## Main Results #

• Several forms of Möbius inversion:
• sum_eq_iff_sum_mul_moebius_eq for functions to a CommRing
• sum_eq_iff_sum_smul_moebius_eq for functions to an AddCommGroup
• prod_eq_iff_prod_pow_moebius_eq for functions to a CommGroup
• prod_eq_iff_prod_pow_moebius_eq_of_nonzero for functions to a CommGroupWithZero
• And variants that apply when the equalities only hold on a set S : Set ℕ such that m ∣ n → n ∈ S → m ∈ S:
• sum_eq_iff_sum_mul_moebius_eq_on for functions to a CommRing
• sum_eq_iff_sum_smul_moebius_eq_on for functions to an AddCommGroup
• prod_eq_iff_prod_pow_moebius_eq_on for functions to a CommGroup
• prod_eq_iff_prod_pow_moebius_eq_on_of_nonzero for functions to a CommGroupWithZero

## Notation #

All notation is localized in the namespace ArithmeticFunction.

The arithmetic functions ζ, σ, ω, Ω and μ have Greek letter names.

In addition, there are separate locales ArithmeticFunction.zeta for ζ, ArithmeticFunction.sigma for σ, ArithmeticFunction.omega for ω, ArithmeticFunction.Omega for Ω, and ArithmeticFunction.Moebius for μ, to allow for selective access to these notations.

The arithmetic function $$n \mapsto \prod_{p \mid n} f(p)$$ is given custom notation ∏ᵖ p ∣ n, f p when applied to n.

## Tags #

arithmetic functions, dirichlet convolution, divisors

def ArithmeticFunction (R : Type u_1) [Zero R] :
Type u_1

An arithmetic function is a function from ℕ that maps 0 to 0. In the literature, they are often instead defined as functions from ℕ+. Multiplication on ArithmeticFunctions is by Dirichlet convolution.

Equations
Instances For
instance ArithmeticFunction.zero (R : Type u_1) [Zero R] :
Equations
instance instInhabitedArithmeticFunction (R : Type u_1) [Zero R] :
Equations
Equations
@[simp]
theorem ArithmeticFunction.toFun_eq {R : Type u_1} [Zero R] (f : ) :
f.toFun = f
@[simp]
theorem ArithmeticFunction.coe_mk {R : Type u_1} [Zero R] (f : R) (hf : f 0 = 0) :
{ toFun := f, map_zero' := hf } = f
@[simp]
theorem ArithmeticFunction.map_zero {R : Type u_1} [Zero R] {f : } :
f 0 = 0
theorem ArithmeticFunction.coe_inj {R : Type u_1} [Zero R] {f : } {g : } :
f = g f = g
@[simp]
theorem ArithmeticFunction.zero_apply {R : Type u_1} [Zero R] {x : } :
0 x = 0
theorem ArithmeticFunction.ext {R : Type u_1} [Zero R] ⦃f : ⦃g : (h : ∀ (x : ), f x = g x) :
f = g
theorem ArithmeticFunction.ext_iff {R : Type u_1} [Zero R] {f : } {g : } :
f = g ∀ (x : ), f x = g x
instance ArithmeticFunction.one {R : Type u_1} [Zero R] [One R] :
Equations
• ArithmeticFunction.one = { one := { toFun := fun (x : ) => if x = 1 then 1 else 0, map_zero' := } }
theorem ArithmeticFunction.one_apply {R : Type u_1} [Zero R] [One R] {x : } :
1 x = if x = 1 then 1 else 0
@[simp]
theorem ArithmeticFunction.one_one {R : Type u_1} [Zero R] [One R] :
1 1 = 1
@[simp]
theorem ArithmeticFunction.one_apply_ne {R : Type u_1} [Zero R] [One R] {x : } (h : x 1) :
1 x = 0

Coerce an arithmetic function with values in ℕ to one with values in R. We cannot inline this in natCoe because it gets unfolded too much.

Equations
• f = { toFun := fun (n : ) => (f n), map_zero' := }
Instances For
instance ArithmeticFunction.natCoe {R : Type u_1} [] :
Equations
• ArithmeticFunction.natCoe = { coe := ArithmeticFunction.natToArithmeticFunction }
@[simp]
theorem ArithmeticFunction.natCoe_nat (f : ) :
f = f
@[simp]
theorem ArithmeticFunction.natCoe_apply {R : Type u_1} [] {f : } {x : } :
f x = (f x)
def ArithmeticFunction.ofInt {R : Type u_1} [] :

Coerce an arithmetic function with values in ℤ to one with values in R. We cannot inline this in intCoe because it gets unfolded too much.

Equations
• f = { toFun := fun (n : ) => (f n), map_zero' := }
Instances For
instance ArithmeticFunction.intCoe {R : Type u_1} [] :
Equations
• ArithmeticFunction.intCoe = { coe := ArithmeticFunction.ofInt }
@[simp]
theorem ArithmeticFunction.intCoe_int (f : ) :
f = f
@[simp]
theorem ArithmeticFunction.intCoe_apply {R : Type u_1} [] {f : } {x : } :
f x = (f x)
@[simp]
theorem ArithmeticFunction.coe_coe {R : Type u_1} [] {f : } :
f = f
@[simp]
theorem ArithmeticFunction.natCoe_one {R : Type u_1} [] :
1 = 1
@[simp]
theorem ArithmeticFunction.intCoe_one {R : Type u_1} [] :
1 = 1
instance ArithmeticFunction.add {R : Type u_1} [] :
Equations
• ArithmeticFunction.add = { add := fun (f g : ) => { toFun := fun (n : ) => f n + g n, map_zero' := } }
@[simp]
theorem ArithmeticFunction.add_apply {R : Type u_1} [] {f : } {g : } {n : } :
(f + g) n = f n + g n
instance ArithmeticFunction.instAddMonoid {R : Type u_1} [] :
Equations
• ArithmeticFunction.instAddMonoid = let __src := ; let __src_1 := ArithmeticFunction.add; AddMonoid.mk nsmulRec
Equations
• ArithmeticFunction.instAddMonoidWithOne = let __src := ArithmeticFunction.instAddMonoid; let __src_1 := ArithmeticFunction.one;
Equations
• ArithmeticFunction.instAddCommMonoid = let __src := ArithmeticFunction.instAddMonoid;
instance ArithmeticFunction.instNeg {R : Type u_1} [] :
Equations
• ArithmeticFunction.instNeg = { neg := fun (f : ) => { toFun := fun (n : ) => -f n, map_zero' := } }
instance ArithmeticFunction.instAddGroup {R : Type u_1} [] :
Equations
• ArithmeticFunction.instAddGroup = let __src := ArithmeticFunction.instAddMonoid;
Equations
• ArithmeticFunction.instAddCommGroup = let __src := let_fun this := inferInstance; this;
instance ArithmeticFunction.instSMul {R : Type u_1} {M : Type u_2} [Zero R] [] [SMul R M] :

The Dirichlet convolution of two arithmetic functions f and g is another arithmetic function such that (f * g) n is the sum of f x * g y over all (x,y) such that x * y = n.

Equations
• One or more equations did not get rendered due to their size.
@[simp]
theorem ArithmeticFunction.smul_apply {R : Type u_1} {M : Type u_2} [Zero R] [] [SMul R M] {f : } {g : } {n : } :
(f g) n = xn.divisorsAntidiagonal, f x.1 g x.2
instance ArithmeticFunction.instMul {R : Type u_1} [] :

The Dirichlet convolution of two arithmetic functions f and g is another arithmetic function such that (f * g) n is the sum of f x * g y over all (x,y) such that x * y = n.

Equations
• ArithmeticFunction.instMul = { mul := fun (x x_1 : ) => x x_1 }
@[simp]
theorem ArithmeticFunction.mul_apply {R : Type u_1} [] {f : } {g : } {n : } :
(f * g) n = xn.divisorsAntidiagonal, f x.1 * g x.2
theorem ArithmeticFunction.mul_apply_one {R : Type u_1} [] {f : } {g : } :
(f * g) 1 = f 1 * g 1
@[simp]
theorem ArithmeticFunction.natCoe_mul {R : Type u_1} [] {f : } {g : } :
(f * g) = f * g
@[simp]
theorem ArithmeticFunction.intCoe_mul {R : Type u_1} [Ring R] {f : } {g : } :
(f * g) = f * g
theorem ArithmeticFunction.mul_smul' {R : Type u_1} {M : Type u_2} [] [] [Module R M] (f : ) (g : ) (h : ) :
(f * g) h = f g h
theorem ArithmeticFunction.one_smul' {R : Type u_1} {M : Type u_2} [] [] [Module R M] (b : ) :
1 b = b
instance ArithmeticFunction.instMonoid {R : Type u_1} [] :
Equations
• ArithmeticFunction.instMonoid = Monoid.mk npowRec
instance ArithmeticFunction.instSemiring {R : Type u_1} [] :
Equations
• One or more equations did not get rendered due to their size.
Equations
• ArithmeticFunction.instCommSemiring = let __src := ArithmeticFunction.instSemiring;
instance ArithmeticFunction.instCommRing {R : Type u_1} [] :
Equations
• ArithmeticFunction.instCommRing = let __src := ArithmeticFunction.instSemiring;
instance ArithmeticFunction.instModule {R : Type u_1} {M : Type u_2} [] [] [Module R M] :
Equations
• ArithmeticFunction.instModule =

ζ 0 = 0, otherwise ζ x = 1. The Dirichlet Series is the Riemann ζ.

Equations
Instances For

ζ 0 = 0, otherwise ζ x = 1. The Dirichlet Series is the Riemann ζ.

Equations
Instances For

ζ 0 = 0, otherwise ζ x = 1. The Dirichlet Series is the Riemann ζ.

Equations
Instances For
@[simp]
theorem ArithmeticFunction.zeta_apply {x : } :
ArithmeticFunction.zeta x = if x = 0 then 0 else 1
theorem ArithmeticFunction.zeta_apply_ne {x : } (h : x 0) :
ArithmeticFunction.zeta x = 1
theorem ArithmeticFunction.coe_zeta_smul_apply {R : Type u_1} {M : Type u_2} [] [] [Module R M] {f : } {x : } :
() x = ix.divisors, f i
theorem ArithmeticFunction.coe_zeta_mul_apply {R : Type u_1} [] {f : } {x : } :
() x = ix.divisors, f i
theorem ArithmeticFunction.coe_mul_zeta_apply {R : Type u_1} [] {f : } {x : } :
() x = ix.divisors, f i
theorem ArithmeticFunction.zeta_mul_apply {f : } {x : } :
x = ix.divisors, f i
theorem ArithmeticFunction.mul_zeta_apply {f : } {x : } :
x = ix.divisors, f i
def ArithmeticFunction.pmul {R : Type u_1} [] (f : ) (g : ) :

This is the pointwise product of ArithmeticFunctions.

Equations
• f.pmul g = { toFun := fun (x : ) => f x * g x, map_zero' := }
Instances For
@[simp]
theorem ArithmeticFunction.pmul_apply {R : Type u_1} [] {f : } {g : } {x : } :
(f.pmul g) x = f x * g x
theorem ArithmeticFunction.pmul_comm {R : Type u_1} (f : ) (g : ) :
f.pmul g = g.pmul f
theorem ArithmeticFunction.pmul_assoc {R : Type u_1} (f₁ : ) (f₂ : ) (f₃ : ) :
(f₁.pmul f₂).pmul f₃ = f₁.pmul (f₂.pmul f₃)
@[simp]
theorem ArithmeticFunction.pmul_zeta {R : Type u_1} [] (f : ) :
f.pmul = f
@[simp]
theorem ArithmeticFunction.zeta_pmul {R : Type u_1} [] (f : ) :
.pmul f = f
def ArithmeticFunction.ppow {R : Type u_1} [] (f : ) (k : ) :

This is the pointwise power of ArithmeticFunctions.

Equations
• f.ppow k = if h0 : k = 0 then else { toFun := fun (x : ) => f x ^ k, map_zero' := }
Instances For
@[simp]
theorem ArithmeticFunction.ppow_zero {R : Type u_1} [] {f : } :
f.ppow 0 =
@[simp]
theorem ArithmeticFunction.ppow_apply {R : Type u_1} [] {f : } {k : } {x : } (kpos : 0 < k) :
(f.ppow k) x = f x ^ k
theorem ArithmeticFunction.ppow_succ' {R : Type u_1} [] {f : } {k : } :
f.ppow (k + 1) = f.pmul (f.ppow k)
theorem ArithmeticFunction.ppow_succ {R : Type u_1} [] {f : } {k : } {kpos : 0 < k} :
f.ppow (k + 1) = (f.ppow k).pmul f
def ArithmeticFunction.pdiv {R : Type u_1} [] (f : ) (g : ) :

This is the pointwise division of ArithmeticFunctions.

Equations
• f.pdiv g = { toFun := fun (n : ) => f n / g n, map_zero' := }
Instances For
@[simp]
theorem ArithmeticFunction.pdiv_apply {R : Type u_1} [] (f : ) (g : ) (n : ) :
(f.pdiv g) n = f n / g n
@[simp]
theorem ArithmeticFunction.pdiv_zeta {R : Type u_1} [] (f : ) :
f.pdiv = f

This result only holds for DivisionSemirings instead of GroupWithZeros because zeta takes values in ℕ, and hence the coercion requires an AddMonoidWithOne. TODO: Generalise zeta

def ArithmeticFunction.prodPrimeFactors {R : Type u_1} (f : R) :

The map $n \mapsto \prod_{p \mid n} f(p)$ as an arithmetic function

Equations
• = { toFun := fun (d : ) => if d = 0 then 0 else pd.primeFactors, f p, map_zero' := }
Instances For

∏ᵖ p ∣ n, f p is custom notation for prodPrimeFactors f n

Equations
• One or more equations did not get rendered due to their size.
Instances For
@[simp]
theorem ArithmeticFunction.prodPrimeFactors_apply {R : Type u_1} {f : R} {n : } (hn : n 0) :
(ArithmeticFunction.prodPrimeFactors fun (p : ) => f p) n = pn.primeFactors, f p

Multiplicative functions

Equations
• f.IsMultiplicative = (f 1 = 1 ∀ {m n : }, m.Coprime nf (m * n) = f m * f n)
Instances For
@[simp]
theorem ArithmeticFunction.IsMultiplicative.map_one {R : Type u_1} [] {f : } (h : f.IsMultiplicative) :
f 1 = 1
@[simp]
theorem ArithmeticFunction.IsMultiplicative.map_mul_of_coprime {R : Type u_1} [] {f : } (hf : f.IsMultiplicative) {m : } {n : } (h : m.Coprime n) :
f (m * n) = f m * f n
theorem ArithmeticFunction.IsMultiplicative.map_prod {R : Type u_1} {ι : Type u_2} (g : ι) {f : } (hf : f.IsMultiplicative) (s : ) (hs : (s).Pairwise ()) :
f (is, g i) = is, f (g i)
theorem ArithmeticFunction.IsMultiplicative.map_prod_of_prime {R : Type u_1} [] {f : } (h_mult : f.IsMultiplicative) (t : ) (ht : pt, ) :
f (at, a) = at, f a
theorem ArithmeticFunction.IsMultiplicative.map_prod_of_subset_primeFactors {R : Type u_1} [] {f : } (h_mult : f.IsMultiplicative) (l : ) (t : ) (ht : t l.primeFactors) :
f (at, a) = at, f a
theorem ArithmeticFunction.IsMultiplicative.natCast {R : Type u_1} {f : } [] (h : f.IsMultiplicative) :
(f).IsMultiplicative
@[deprecated ArithmeticFunction.IsMultiplicative.natCast]
theorem ArithmeticFunction.IsMultiplicative.nat_cast {R : Type u_1} {f : } [] (h : f.IsMultiplicative) :
(f).IsMultiplicative

Alias of ArithmeticFunction.IsMultiplicative.natCast.

theorem ArithmeticFunction.IsMultiplicative.intCast {R : Type u_1} {f : } [Ring R] (h : f.IsMultiplicative) :
(f).IsMultiplicative
@[deprecated ArithmeticFunction.IsMultiplicative.intCast]
theorem ArithmeticFunction.IsMultiplicative.int_cast {R : Type u_1} {f : } [Ring R] (h : f.IsMultiplicative) :
(f).IsMultiplicative

Alias of ArithmeticFunction.IsMultiplicative.intCast.

theorem ArithmeticFunction.IsMultiplicative.mul {R : Type u_1} [] {f : } {g : } (hf : f.IsMultiplicative) (hg : g.IsMultiplicative) :
(f * g).IsMultiplicative
theorem ArithmeticFunction.IsMultiplicative.pmul {R : Type u_1} [] {f : } {g : } (hf : f.IsMultiplicative) (hg : g.IsMultiplicative) :
(f.pmul g).IsMultiplicative
theorem ArithmeticFunction.IsMultiplicative.pdiv {R : Type u_1} {f : } {g : } (hf : f.IsMultiplicative) (hg : g.IsMultiplicative) :
(f.pdiv g).IsMultiplicative
theorem ArithmeticFunction.IsMultiplicative.multiplicative_factorization {R : Type u_1} (f : ) (hf : f.IsMultiplicative) {n : } (hn : n 0) :
f n = n.factorization.prod fun (p k : ) => f (p ^ k)

For any multiplicative function f and any n > 0, we can evaluate f n by evaluating f at p ^ k over the factorization of n

theorem ArithmeticFunction.IsMultiplicative.iff_ne_zero {R : Type u_1} [] {f : } :
f.IsMultiplicative f 1 = 1 ∀ {m n : }, m 0n 0m.Coprime nf (m * n) = f m * f n

A recapitulation of the definition of multiplicative that is simpler for proofs

theorem ArithmeticFunction.IsMultiplicative.eq_iff_eq_on_prime_powers {R : Type u_1} (f : ) (hf : f.IsMultiplicative) (g : ) (hg : g.IsMultiplicative) :
f = g ∀ (p i : ), f (p ^ i) = g (p ^ i)

Two multiplicative functions f and g are equal if and only if they agree on prime powers

theorem ArithmeticFunction.IsMultiplicative.prodPrimeFactors {R : Type u_1} (f : R) :
.IsMultiplicative
theorem ArithmeticFunction.IsMultiplicative.prodPrimeFactors_add_of_squarefree {R : Type u_1} [] {f : } {g : } (hf : f.IsMultiplicative) (hg : g.IsMultiplicative) {n : } (hn : ) :
(ArithmeticFunction.prodPrimeFactors fun (p : ) => (f + g) p) n = (f * g) n
theorem ArithmeticFunction.IsMultiplicative.lcm_apply_mul_gcd_apply {R : Type u_1} {f : } (hf : f.IsMultiplicative) {x : } {y : } :
f (x.lcm y) * f (x.gcd y) = f x * f y

The identity on ℕ as an ArithmeticFunction.

Equations
Instances For
@[simp]
theorem ArithmeticFunction.id_apply {x : } :
ArithmeticFunction.id x = x

pow k n = n ^ k, except pow 0 0 = 0.

Equations
Instances For
@[simp]
theorem ArithmeticFunction.pow_apply {k : } {n : } :
= if k = 0 n = 0 then 0 else n ^ k

σ k n is the sum of the kth powers of the divisors of n

Equations
• = { toFun := fun (n : ) => dn.divisors, d ^ k, map_zero' := }
Instances For

σ k n is the sum of the kth powers of the divisors of n

Equations
Instances For

σ k n is the sum of the kth powers of the divisors of n

Equations
Instances For
theorem ArithmeticFunction.sigma_apply {k : } {n : } :
= dn.divisors, d ^ k
theorem ArithmeticFunction.sigma_one_apply (n : ) :
= dn.divisors, d
theorem ArithmeticFunction.sigma_zero_apply (n : ) :
= n.divisors.card
theorem ArithmeticFunction.sigma_zero_apply_prime_pow {p : } {i : } (hp : ) :
(p ^ i) = i + 1
theorem ArithmeticFunction.IsMultiplicative.ppow {R : Type u_1} [] {f : } (hf : f.IsMultiplicative) {k : } :
(f.ppow k).IsMultiplicative
theorem ArithmeticFunction.isMultiplicative_pow {k : } :
.IsMultiplicative
theorem ArithmeticFunction.isMultiplicative_sigma {k : } :
.IsMultiplicative

Ω n is the number of prime factors of n.

Equations
Instances For

Ω n is the number of prime factors of n.

Equations
Instances For

Ω n is the number of prime factors of n.

Equations
Instances For
theorem ArithmeticFunction.cardFactors_apply {n : } :
ArithmeticFunction.cardFactors n = n.factors.length
theorem ArithmeticFunction.cardFactors_zero :
ArithmeticFunction.cardFactors 0 = 0
@[simp]
theorem ArithmeticFunction.cardFactors_one :
ArithmeticFunction.cardFactors 1 = 0
@[simp]
theorem ArithmeticFunction.cardFactors_eq_one_iff_prime {n : } :
ArithmeticFunction.cardFactors n = 1
theorem ArithmeticFunction.cardFactors_mul {m : } {n : } (m0 : m 0) (n0 : n 0) :
ArithmeticFunction.cardFactors (m * n) = ArithmeticFunction.cardFactors m + ArithmeticFunction.cardFactors n
theorem ArithmeticFunction.cardFactors_multiset_prod {s : } (h0 : s.prod 0) :
ArithmeticFunction.cardFactors s.prod = .sum
@[simp]
theorem ArithmeticFunction.cardFactors_apply_prime {p : } (hp : ) :
ArithmeticFunction.cardFactors p = 1
@[simp]
theorem ArithmeticFunction.cardFactors_apply_prime_pow {p : } {k : } (hp : ) :
ArithmeticFunction.cardFactors (p ^ k) = k

ω n is the number of distinct prime factors of n.

Equations
Instances For

ω n is the number of distinct prime factors of n.

Equations
Instances For

ω n is the number of distinct prime factors of n.

Equations
Instances For
theorem ArithmeticFunction.cardDistinctFactors_zero :
ArithmeticFunction.cardDistinctFactors 0 = 0
@[simp]
theorem ArithmeticFunction.cardDistinctFactors_one :
ArithmeticFunction.cardDistinctFactors 1 = 0
theorem ArithmeticFunction.cardDistinctFactors_apply {n : } :
ArithmeticFunction.cardDistinctFactors n = n.factors.dedup.length
theorem ArithmeticFunction.cardDistinctFactors_eq_cardFactors_iff_squarefree {n : } (h0 : n 0) :
ArithmeticFunction.cardDistinctFactors n = ArithmeticFunction.cardFactors n
@[simp]
theorem ArithmeticFunction.cardDistinctFactors_apply_prime_pow {p : } {k : } (hp : ) (hk : k 0) :
ArithmeticFunction.cardDistinctFactors (p ^ k) = 1
@[simp]
theorem ArithmeticFunction.cardDistinctFactors_apply_prime {p : } (hp : ) :
ArithmeticFunction.cardDistinctFactors p = 1

μ is the Möbius function. If n is squarefree with an even number of distinct prime factors, μ n = 1. If n is squarefree with an odd number of distinct prime factors, μ n = -1. If n is not squarefree, μ n = 0.

Equations
Instances For

μ is the Möbius function. If n is squarefree with an even number of distinct prime factors, μ n = 1. If n is squarefree with an odd number of distinct prime factors, μ n = -1. If n is not squarefree, μ n = 0.

Equations
Instances For

μ is the Möbius function. If n is squarefree with an even number of distinct prime factors, μ n = 1. If n is squarefree with an odd number of distinct prime factors, μ n = -1. If n is not squarefree, μ n = 0.

Equations
Instances For
@[simp]
theorem ArithmeticFunction.moebius_apply_of_squarefree {n : } (h : ) :
ArithmeticFunction.moebius n = (-1) ^ ArithmeticFunction.cardFactors n
@[simp]
theorem ArithmeticFunction.moebius_eq_zero_of_not_squarefree {n : } (h : ) :
ArithmeticFunction.moebius n = 0
theorem ArithmeticFunction.moebius_apply_one :
ArithmeticFunction.moebius 1 = 1
theorem ArithmeticFunction.moebius_ne_zero_iff_squarefree {n : } :
ArithmeticFunction.moebius n 0
theorem ArithmeticFunction.moebius_eq_or (n : ) :
ArithmeticFunction.moebius n = 0 ArithmeticFunction.moebius n = 1 ArithmeticFunction.moebius n = -1
theorem ArithmeticFunction.moebius_ne_zero_iff_eq_or {n : } :
ArithmeticFunction.moebius n 0 ArithmeticFunction.moebius n = 1 ArithmeticFunction.moebius n = -1
theorem ArithmeticFunction.moebius_sq_eq_one_of_squarefree {l : } (hl : ) :
ArithmeticFunction.moebius l ^ 2 = 1
theorem ArithmeticFunction.abs_moebius_eq_one_of_squarefree {l : } (hl : ) :
|ArithmeticFunction.moebius l| = 1
theorem ArithmeticFunction.moebius_sq {n : } :
ArithmeticFunction.moebius n ^ 2 = if then 1 else 0
theorem ArithmeticFunction.abs_moebius {n : } :
|ArithmeticFunction.moebius n| = if then 1 else 0
theorem ArithmeticFunction.abs_moebius_le_one {n : } :
|ArithmeticFunction.moebius n| 1
theorem ArithmeticFunction.moebius_apply_prime {p : } (hp : ) :
ArithmeticFunction.moebius p = -1
theorem ArithmeticFunction.moebius_apply_prime_pow {p : } {k : } (hp : ) (hk : k 0) :
ArithmeticFunction.moebius (p ^ k) = if k = 1 then -1 else 0
theorem ArithmeticFunction.moebius_apply_isPrimePow_not_prime {n : } (hn : ) (hn' : ) :
ArithmeticFunction.moebius n = 0
theorem ArithmeticFunction.IsMultiplicative.prodPrimeFactors_one_add_of_squarefree {R : Type u_1} [] {f : } (h_mult : f.IsMultiplicative) {n : } (hn : ) :
pn.primeFactors, (1 + f p) = dn.divisors, f d
theorem ArithmeticFunction.IsMultiplicative.prodPrimeFactors_one_sub_of_squarefree {R : Type u_1} [] (f : ) (hf : f.IsMultiplicative) {n : } (hn : ) :
pn.primeFactors, (1 - f p) = dn.divisors, (ArithmeticFunction.moebius d) * f d
Equations
• ArithmeticFunction.instInvertibleNatToArithmeticFunctionZeta = { invOf := , invOf_mul_self := , mul_invOf_self := }

A unit in ArithmeticFunction R that evaluates to ζ, with inverse μ.

Equations
• ArithmeticFunction.zetaUnit = { val := , inv := , val_inv := , inv_val := }
Instances For
@[simp]
theorem ArithmeticFunction.coe_zetaUnit {R : Type u_1} [] :
ArithmeticFunction.zetaUnit =
@[simp]
theorem ArithmeticFunction.inv_zetaUnit {R : Type u_1} [] :
ArithmeticFunction.zetaUnit⁻¹ =
theorem ArithmeticFunction.sum_eq_iff_sum_smul_moebius_eq {R : Type u_1} [] {f : R} {g : R} :
(n > 0, in.divisors, f i = g n) n > 0, xn.divisorsAntidiagonal, ArithmeticFunction.moebius x.1 g x.2 = f n

Möbius inversion for functions to an AddCommGroup.

theorem ArithmeticFunction.sum_eq_iff_sum_mul_moebius_eq {R : Type u_1} [Ring R] {f : R} {g : R} :
(n > 0, in.divisors, f i = g n) n > 0, xn.divisorsAntidiagonal, (ArithmeticFunction.moebius x.1) * g x.2 = f n

Möbius inversion for functions to a Ring.

theorem ArithmeticFunction.prod_eq_iff_prod_pow_moebius_eq {R : Type u_1} [] {f : R} {g : R} :
(n > 0, in.divisors, f i = g n) n > 0, xn.divisorsAntidiagonal, g x.2 ^ ArithmeticFunction.moebius x.1 = f n

Möbius inversion for functions to a CommGroup.

theorem ArithmeticFunction.prod_eq_iff_prod_pow_moebius_eq_of_nonzero {R : Type u_1} {f : R} {g : R} (hf : ∀ (n : ), 0 < nf n 0) (hg : ∀ (n : ), 0 < ng n 0) :
(n > 0, in.divisors, f i = g n) n > 0, xn.divisorsAntidiagonal, g x.2 ^ ArithmeticFunction.moebius x.1 = f n

Möbius inversion for functions to a CommGroupWithZero.

theorem ArithmeticFunction.sum_eq_iff_sum_smul_moebius_eq_on {R : Type u_1} [] {f : R} {g : R} (s : ) (hs : ∀ (m n : ), m nn sm s) :
(n > 0, n sin.divisors, f i = g n) n > 0, n sxn.divisorsAntidiagonal, ArithmeticFunction.moebius x.1 g x.2 = f n

Möbius inversion for functions to an AddCommGroup, where the equalities only hold on a well-behaved set.

theorem ArithmeticFunction.sum_eq_iff_sum_smul_moebius_eq_on' {R : Type u_1} [] {f : R} {g : R} (s : ) (hs : ∀ (m n : ), m nn sm s) (hs₀ : 0s) :
(ns, in.divisors, f i = g n) ns, xn.divisorsAntidiagonal, ArithmeticFunction.moebius x.1 g x.2 = f n
theorem ArithmeticFunction.sum_eq_iff_sum_mul_moebius_eq_on {R : Type u_1} [Ring R] {f : R} {g : R} (s : ) (hs : ∀ (m n : ), m nn sm s) :
(n > 0, n sin.divisors, f i = g n) n > 0, n sxn.divisorsAntidiagonal, (ArithmeticFunction.moebius x.1) * g x.2 = f n

Möbius inversion for functions to a Ring, where the equalities only hold on a well-behaved set.

theorem ArithmeticFunction.prod_eq_iff_prod_pow_moebius_eq_on {R : Type u_1} [] {f : R} {g : R} (s : ) (hs : ∀ (m n : ), m nn sm s) :
(n > 0, n sin.divisors, f i = g n) n > 0, n sxn.divisorsAntidiagonal, g x.2 ^ ArithmeticFunction.moebius x.1 = f n

Möbius inversion for functions to a CommGroup, where the equalities only hold on a well-behaved set.

theorem ArithmeticFunction.prod_eq_iff_prod_pow_moebius_eq_on_of_nonzero {R : Type u_1} (s : ) (hs : ∀ (m n : ), m nn sm s) {f : R} {g : R} (hf : n > 0, f n 0) (hg : n > 0, g n 0) :
(n > 0, n sin.divisors, f i = g n) n > 0, n sxn.divisorsAntidiagonal, g x.2 ^ ArithmeticFunction.moebius x.1 = f n

Möbius inversion for functions to a CommGroupWithZero, where the equalities only hold on a well-behaved set.

theorem Nat.card_divisors {n : } (hn : n 0) :
n.divisors.card = xn.primeFactors, (n.factorization x + 1)
@[deprecated]
theorem ArithmeticFunction.card_divisors (n : ) (hn : n 0) :
n.divisors.card = xn.primeFactors, (n.factorization x + 1)