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 functionsf : ℕ → R
such thatf 0 = 0
.- An arithmetic function
f
IsMultiplicative
whenx.coprime y → f (x * y) = f x * f y
. - The pointwise operations
pmul
andppow
differ from the multiplication and power instances onArithmeticFunction R
, which use Dirichlet multiplication. ζ
is the arithmetic function such thatζ x = 1
for0 < x
.σ k
is the arithmetic function such thatσ k x = ∑ y in divisors x, y ^ k
for0 < x
.pow k
is the arithmetic function such thatpow k x = x ^ k
for0 < x
.id
is the identity arithmetic function onℕ
.ω n
is the number of distinct prime factors ofn
.Ω n
is the number of prime factors ofn
counted with multiplicity.μ
is the Möbius function (spelledmoebius
in code).
Main Results #
- Several forms of Möbius inversion:
sum_eq_iff_sum_mul_moebius_eq
for functions to aCommRing
sum_eq_iff_sum_smul_moebius_eq
for functions to anAddCommGroup
prod_eq_iff_prod_pow_moebius_eq
for functions to aCommGroup
prod_eq_iff_prod_pow_moebius_eq_of_nonzero
for 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_on
for functions to aCommRing
sum_eq_iff_sum_smul_moebius_eq_on
for functions to anAddCommGroup
prod_eq_iff_prod_pow_moebius_eq_on
for functions to aCommGroup
prod_eq_iff_prod_pow_moebius_eq_on_of_nonzero
for functions to aCommGroupWithZero
Notation #
All notation is localized in the namespace ArithmeticFunction
.
The arithmetic functions ζ
, σ
, ω
, Ω
and μ
have Greek letter names.
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
- One or more equations did not get rendered due to their size.
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
- ArithmeticFunction.natCoe = { coe := ArithmeticFunction.natToArithmeticFunction }
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
- ArithmeticFunction.intCoe = { coe := ArithmeticFunction.ofInt }
Equations
- One or more equations did not get rendered due to their size.
Equations
- ArithmeticFunction.instAddMonoidWithOne = let src := ArithmeticFunction.instAddMonoid; let src_1 := ArithmeticFunction.one; AddMonoidWithOne.mk
Equations
- ArithmeticFunction.instAddCommMonoid = let src := ArithmeticFunction.instAddMonoid; AddCommMonoid.mk (_ : ∀ (x x_1 : ArithmeticFunction R), x + x_1 = x_1 + x)
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.
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.instMulArithmeticFunctionToZeroToMonoidWithZero = { mul := fun (x x_1 : ArithmeticFunction R) => x • x_1 }
Equations
- ArithmeticFunction.instMonoid = Monoid.mk (_ : ∀ (b : ArithmeticFunction R), 1 • b = b) (_ : ∀ (f : ArithmeticFunction R), f * 1 = f) npowRec
Equations
- One or more equations did not get rendered due to their size.
Equations
- ArithmeticFunction.instCommSemiringArithmeticFunctionToZeroToCommMonoidWithZero = let src := ArithmeticFunction.instSemiring; CommSemiring.mk (_ : ∀ (f g : ArithmeticFunction R), f * g = g * f)
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.
ζ 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
This is the pointwise product of ArithmeticFunction
s.
Equations
Instances For
This is the pointwise power of ArithmeticFunction
s.
Equations
- ArithmeticFunction.ppow f k = if h0 : k = 0 then ↑ArithmeticFunction.zeta else { toFun := fun (x : ℕ) => f x ^ k, map_zero' := (_ : (fun (x : ℕ) => f x ^ k) 0 = 0) }
Instances For
This is the pointwise division of ArithmeticFunction
s.
Equations
Instances For
This result only holds for DivisionSemiring
s instead of GroupWithZero
s 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
- One or more equations did not get rendered due to their size.
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
Equations
- ArithmeticFunction.IsMultiplicative f = (f 1 = 1 ∧ ∀ {m n : ℕ}, Nat.Coprime m n → f (m * n) = f m * f n)
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 k
th powers of the divisors of n
Equations
- ArithmeticFunction.sigma k = { toFun := fun (n : ℕ) => Finset.sum (Nat.divisors n) fun (d : ℕ) => d ^ k, map_zero' := (_ : (Finset.sum (Nat.divisors 0) fun (d : ℕ) => d ^ k) = 0) }
Instances For
σ k n
is the sum of the k
th powers of the divisors 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.cardFactors = { toFun := fun (n : ℕ) => List.length (Nat.factors n), 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 distinct prime factors of n
.
Equations
- ArithmeticFunction.cardDistinctFactors = { toFun := fun (n : ℕ) => List.length (List.dedup (Nat.factors n)), 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
μ
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
Equations
- One or more equations did not get rendered due to their size.
A unit in ArithmeticFunction R
that evaluates to ζ
, with inverse μ
.
Equations
- One or more equations did not get rendered due to their size.
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 CommGroup
.
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 Ring
, where the equalities only hold on a well-behaved
set.
Möbius inversion for functions to a CommGroup
, 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.