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 Rconsists of functionsf : ℕ → Rsuch thatf 0 = 0.- An arithmetic function
fIsMultiplicativewhenx.Coprime y → f (x * y) = f x * f y. - The pointwise operations
pmulandppowdiffer from the multiplication and power instances onArithmeticFunction R, which use Dirichlet multiplication. ζis the arithmetic function such thatζ x = 1for0 < x.σ kis the arithmetic function such thatσ k x = ∑ y ∈ divisors x, y ^ kfor0 < x.pow kis the arithmetic function such thatpow k x = x ^ kfor0 < x.idis the identity arithmetic function onℕ.ω nis the number of distinct prime factors ofn.Ω nis the number of prime factors ofncounted with multiplicity.μis the Möbius function (spelledmoebiusin code).
Main Results #
- Several forms of Möbius inversion:
sum_eq_iff_sum_mul_moebius_eqfor functions to aCommRingsum_eq_iff_sum_smul_moebius_eqfor functions to anAddCommGroupprod_eq_iff_prod_pow_moebius_eqfor functions to aCommGroupprod_eq_iff_prod_pow_moebius_eq_of_nonzerofor functions to aCommGroupWithZero- And variants that apply when the equalities only hold on a set
S : Set ℕsuch thatm ∣ n → n ∈ S → m ∈ S: sum_eq_iff_sum_mul_moebius_eq_onfor functions to aCommRingsum_eq_iff_sum_smul_moebius_eq_onfor functions to anAddCommGroupprod_eq_iff_prod_pow_moebius_eq_onfor functions to aCommGroupprod_eq_iff_prod_pow_moebius_eq_on_of_nonzerofor functions to aCommGroupWithZero
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
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
- ArithmeticFunction R = ZeroHom ℕ R
Instances For
Equations
- ArithmeticFunction.zero R = inferInstanceAs (Zero (ZeroHom ℕ R))
Equations
Equations
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.
Instances For
Equations
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.
Instances For
Equations
Equations
- ArithmeticFunction.add = { add := fun (f g : ArithmeticFunction R) => { toFun := fun (n : ℕ) => f n + g n, map_zero' := ⋯ } }
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- ArithmeticFunction.instAddCommMonoid = { toAddMonoid := ArithmeticFunction.instAddMonoid, add_comm := ⋯ }
Equations
- ArithmeticFunction.instNeg = { neg := fun (f : ArithmeticFunction R) => { toFun := fun (n : ℕ) => -f n, map_zero' := ⋯ } }
Equations
- One or more equations did not get rendered due to their size.
Equations
- ArithmeticFunction.instAddCommGroup = { toAddGroup := have this := inferInstance; this, add_comm := ⋯ }
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.
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 (x1 x2 : ArithmeticFunction R) => x1 • x2 }
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- ArithmeticFunction.instCommSemiring = { toSemiring := ArithmeticFunction.instSemiring, mul_comm := ⋯ }
Equations
- One or more equations did not get rendered due to their size.
Equations
- ArithmeticFunction.instModule = { toSMul := ArithmeticFunction.instSMul, one_smul := ⋯, mul_smul := ⋯, smul_zero := ⋯, smul_add := ⋯, add_smul := ⋯, zero_smul := ⋯ }
ζ 0 = 0, otherwise ζ x = 1. The Dirichlet Series is the Riemann ζ.
Equations
- ArithmeticFunction.zeta = { toFun := fun (x : ℕ) => if x = 0 then 0 else 1, map_zero' := ArithmeticFunction.zeta._proof_1 }
Instances For
ζ 0 = 0, otherwise ζ x = 1. The Dirichlet Series is the Riemann ζ.
Equations
- ArithmeticFunction.termζ = Lean.ParserDescr.node `ArithmeticFunction.termζ 1024 (Lean.ParserDescr.symbol "ζ")
Instances For
ζ 0 = 0, otherwise ζ x = 1. The Dirichlet Series is the Riemann ζ.
Equations
- ArithmeticFunction.zeta.termζ = Lean.ParserDescr.node `ArithmeticFunction.zeta.termζ 1024 (Lean.ParserDescr.symbol "ζ")
Instances For
@[simp]-normal form of coe_zeta_smul_apply.
This is the pointwise product of ArithmeticFunctions.
Instances For
This is the pointwise power of ArithmeticFunctions.
Equations
Instances For
This is the pointwise division of ArithmeticFunctions.
Instances For
This result only holds for DivisionSemirings instead of GroupWithZeros because zeta takes
values in ℕ, and hence the coercion requires an AddMonoidWithOne. TODO: Generalise zeta
The map $n \mapsto \prod_{p \mid n} f(p)$ as an arithmetic function
Equations
- ArithmeticFunction.prodPrimeFactors f = { toFun := fun (d : ℕ) => if d = 0 then 0 else ∏ p ∈ d.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
Multiplicative functions
Instances For
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
A recapitulation of the definition of multiplicative that is simpler for proofs
Two multiplicative functions f and g are equal if and only if
they agree on prime powers
The identity on ℕ as an ArithmeticFunction.
Equations
- ArithmeticFunction.id = { toFun := id, map_zero' := ArithmeticFunction.id._proof_1 }
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
- ArithmeticFunction.termσ = Lean.ParserDescr.node `ArithmeticFunction.termσ 1024 (Lean.ParserDescr.symbol "σ")
Instances For
σ k n is the sum of the kth powers of the divisors of n
Equations
- ArithmeticFunction.sigma.termσ = Lean.ParserDescr.node `ArithmeticFunction.sigma.termσ 1024 (Lean.ParserDescr.symbol "σ")
Instances For
Ω n is the number of prime factors of n.
Equations
- ArithmeticFunction.cardFactors = { toFun := fun (n : ℕ) => n.primeFactorsList.length, map_zero' := ArithmeticFunction.cardFactors._proof_1 }
Instances For
Ω n is the number of prime factors of n.
Equations
- ArithmeticFunction.termΩ = Lean.ParserDescr.node `ArithmeticFunction.termΩ 1024 (Lean.ParserDescr.symbol "Ω")
Instances For
Ω n is the number of prime factors of n.
Equations
- ArithmeticFunction.Omega.termΩ = Lean.ParserDescr.node `ArithmeticFunction.Omega.termΩ 1024 (Lean.ParserDescr.symbol "Ω")
Instances For
ω n is the number of distinct prime factors of n.
Equations
- ArithmeticFunction.cardDistinctFactors = { toFun := fun (n : ℕ) => n.primeFactorsList.dedup.length, map_zero' := ArithmeticFunction.cardDistinctFactors._proof_1 }
Instances For
ω n is the number of distinct prime factors of n.
Equations
- ArithmeticFunction.termω = Lean.ParserDescr.node `ArithmeticFunction.termω 1024 (Lean.ParserDescr.symbol "ω")
Instances For
ω n is the number of distinct prime factors of n.
Equations
- ArithmeticFunction.omega.termω = Lean.ParserDescr.node `ArithmeticFunction.omega.termω 1024 (Lean.ParserDescr.symbol "ω")
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
- ArithmeticFunction.moebius = { toFun := fun (n : ℕ) => if Squarefree n then (-1) ^ ArithmeticFunction.cardFactors n else 0, map_zero' := ArithmeticFunction.moebius._proof_1 }
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
- ArithmeticFunction.termμ = Lean.ParserDescr.node `ArithmeticFunction.termμ 1024 (Lean.ParserDescr.symbol "μ")
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
- ArithmeticFunction.Moebius.termμ = Lean.ParserDescr.node `ArithmeticFunction.Moebius.termμ 1024 (Lean.ParserDescr.symbol "μ")
Instances For
Equations
- ArithmeticFunction.instInvertibleNatToArithmeticFunctionZeta = { invOf := ↑ArithmeticFunction.moebius, invOf_mul_self := ⋯, mul_invOf_self := ⋯ }
A unit in ArithmeticFunction R that evaluates to ζ, with inverse μ.
Equations
- ArithmeticFunction.zetaUnit = { val := ↑ArithmeticFunction.zeta, inv := ↑ArithmeticFunction.moebius, val_inv := ⋯, inv_val := ⋯ }
Instances For
Möbius inversion for functions to an AddCommGroup.
Möbius inversion for functions to a Ring.
Möbius inversion for functions to a CommGroupWithZero.
Möbius inversion for functions to an AddCommGroup, where the equalities only hold on a
well-behaved set.
Möbius inversion for functions to a CommGroupWithZero, where the equalities only hold on
a well-behaved set.
Extension for ArithmeticFunction.sigma.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Extension for ArithmeticFunction.zeta.
Equations
- One or more equations did not get rendered due to their size.