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 #
The arithmetic functions ζ
and σ
have Greek letter names, which are localized notation in
the namespace ArithmeticFunction
.
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
Instances For
Equations
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
- Nat.ArithmeticFunction.natCoe = { coe := Nat.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
- Nat.ArithmeticFunction.intCoe = { coe := Nat.ArithmeticFunction.ofInt }
Equations
- One or more equations did not get rendered due to their size.
Equations
- Nat.ArithmeticFunction.instAddMonoidWithOne = let src := Nat.ArithmeticFunction.instAddMonoid; let src_1 := Nat.ArithmeticFunction.one; AddMonoidWithOne.mk
Equations
- Nat.ArithmeticFunction.instAddCommMonoid = let src := Nat.ArithmeticFunction.instAddMonoid; AddCommMonoid.mk (_ : ∀ (x x_1 : Nat.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
- Nat.ArithmeticFunction.instMonoid = Monoid.mk (_ : ∀ (b : Nat.ArithmeticFunction R), 1 • b = b) (_ : ∀ (f : Nat.ArithmeticFunction R), f * 1 = f) npowRec
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
- 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
- Nat.ArithmeticFunction.zeta = { toFun := fun x => if x = 0 then 0 else 1, map_zero' := Nat.ArithmeticFunction.zeta.proof_1 }
Instances For
ζ 0 = 0
, otherwise ζ x = 1
. The Dirichlet Series is the Riemann ζ
.
Equations
- Nat.ArithmeticFunction.termζ = Lean.ParserDescr.node `Nat.ArithmeticFunction.termζ 1024 (Lean.ParserDescr.symbol "ζ")
Instances For
This is the pointwise product of ArithmeticFunction
s.
Equations
- Nat.ArithmeticFunction.pmul f g = { toFun := fun x => ↑f x * ↑g x, map_zero' := (_ : ↑f 0 * ↑g 0 = 0) }
Instances For
This is the pointwise power of ArithmeticFunction
s.
Equations
- Nat.ArithmeticFunction.ppow f k = if h0 : k = 0 then ↑Nat.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
- Nat.ArithmeticFunction.pdiv f g = { toFun := fun n => ↑f n / ↑g n, map_zero' := (_ : ↑f 0 / ↑g 0 = 0) }
Instances For
This result only holds for DivisionSemiring
s instead of GroupWithZero
s because zeta takes
values in ℕ, and hence the coersion requires an AddMonoidWithOne
. TODO: Generalise zeta
Multiplicative functions
Equations
- Nat.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
- Nat.ArithmeticFunction.id = { toFun := id, map_zero' := Nat.ArithmeticFunction.id.proof_1 }
Instances For
σ k n
is the sum of the k
th powers of the divisors of n
Equations
- Nat.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
- Nat.ArithmeticFunction.termσ = Lean.ParserDescr.node `Nat.ArithmeticFunction.termσ 1024 (Lean.ParserDescr.symbol "σ")
Instances For
Ω n
is the number of prime factors of n
.
Equations
- Nat.ArithmeticFunction.cardFactors = { toFun := fun n => List.length (Nat.factors n), map_zero' := Nat.ArithmeticFunction.cardFactors.proof_1 }
Instances For
Ω n
is the number of prime factors of n
.
Equations
- Nat.ArithmeticFunction.termΩ = Lean.ParserDescr.node `Nat.ArithmeticFunction.termΩ 1024 (Lean.ParserDescr.symbol "Ω")
Instances For
ω n
is the number of distinct prime factors of n
.
Equations
- Nat.ArithmeticFunction.cardDistinctFactors = { toFun := fun n => List.length (List.dedup (Nat.factors n)), map_zero' := Nat.ArithmeticFunction.cardDistinctFactors.proof_1 }
Instances For
ω n
is the number of distinct prime factors of n
.
Equations
- Nat.ArithmeticFunction.termω = Lean.ParserDescr.node `Nat.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
- Nat.ArithmeticFunction.moebius = { toFun := fun n => if Squarefree n then (-1) ^ ↑Nat.ArithmeticFunction.cardFactors n else 0, map_zero' := Nat.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
- Nat.ArithmeticFunction.termμ = Lean.ParserDescr.node `Nat.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.