p-adic Valuation #
This file defines the p-adic valuation on ℕ, ℤ, and ℚ.
The p-adic valuation on ℚ is the difference of the multiplicities of p in the numerator and
denominator of q. This function obeys the standard properties of a valuation, with the appropriate
assumptions on p. The p-adic valuations on ℕ and ℤ agree with that on ℚ.
The valuation induces a norm on ℚ. This norm is defined in
Mathlib/NumberTheory/Padics/PadicNorm.lean.
Notation #
This file uses the local notation /. for Rat.mk.
Implementation notes #
Much, but not all, of this file assumes that p is prime. This assumption is inferred automatically
by taking [Fact p.Prime] as a type class argument.
Calculations with p-adic valuations #
multiplicity_factorial: Legendre's Theorem. Thep-adic valuation ofn!is the sum of the quotientsn / p ^ i. This sum is expressed over the finsetIco 1 bwherebis any bound greater thanlog p n.Nat.Prime.sub_one_mul_multiplicity_factorial: Legendre's Theorem. Taking (p - 1) times thep-adic valuation ofn!equalsnminus the sum of basepdigits ofn.multiplicity_choose: Kummer's Theorem. Thep-adic valuation ofn.choose kis the number of carries whenkandn - kare added in basep. This sum is expressed over the finsetIco 1 bwherebis any bound greater thanlog p n.sub_one_mul_multiplicity_choose_eq_sub_sum_digits: Kummer's Theorem. Taking (p - 1) times thep-adic valuation of the binomialnoverkequals the sum of the digits ofkplus the sum of the digits ofn - kminus the sum of digits ofn, all basep.
References #
- [F. Q. Gouvêa, p-adic numbers][gouvea1997]
- [R. Y. Lewis, A formal proof of Hensel's lemma over the p-adic integers][lewis2019]
- https://en.wikipedia.org/wiki/P-adic_number
Tags #
p-adic, p adic, padic, norm, valuation
Alias of Nat.multiplicity_self.
Alias of multiplicity_eq_zero_of_not_dvd.
Alias of Nat.multiplicity_dvd_of_ne_zero.
For p ≠ 1, the p-adic valuation of an integer z ≠ 0 is the largest natural number k such
that p^k divides z. If x = 0 or p = 1, then padicValInt p q defaults to 0.
Equations
- padicValInt p z = multiplicity p z.natAbs
Instances For
The p-adic value of a natural is its p-adic value as an integer.
If p ≠ 0 and p ≠ 1, then padicValInt p p is 1.
padicValRat defines the valuation of a rational q to be the valuation of q.num minus the
valuation of q.den. If q = 0 or p = 1, then padicValRat p q defaults to 0.
Equations
- padicValRat p q = ↑(padicValInt p q.num) - ↑(multiplicity p q.den)
Instances For
padicValRat p q is symmetric in q.
The p-adic value of an integer z ≠ 0 is its p-adic value as a rational.
The p-adic value of an integer z ≠ 0 is the multiplicity of p in z.
The p-adic value of an integer z ≠ 0 is its p-adic value as a rational.
If p ≠ 0 and p ≠ 1, then padicValRat p p is 1.
padicValRat coincides with multiplicity.
Alias of Nat.Prime.multiplicity_self.
Alias of one_le_multiplicity_of_dvd.
Alias of dvd_iff_multiplicity_ne_zero.
The multiplicity of p : ℕ in a : ℤ is finite exactly when a ≠ 0.
A rewrite lemma for padicValRat p q when q is expressed in terms of Rat.mk.
A rewrite lemma for padicValRat p (q * r) with conditions q ≠ 0, r ≠ 0.
A rewrite lemma for padicValRat p (q^k).
A rewrite lemma for padicValRat p (q⁻¹).
A rewrite lemma for padicValRat p (q / r) with conditions q ≠ 0, r ≠ 0.
A condition for padicValRat p (n₁ / d₁) ≤ padicValRat p (n₂ / d₂), in terms of
divisibility by p^n.
Sufficient conditions to show that the p-adic valuation of q is less than or equal to the
p-adic valuation of q + r.
Ultrametric property of a p-adic valuation.
A finite sum of rationals with positive p-adic valuation has positive p-adic valuation
(if the sum is non-zero).
If the p-adic valuation of a finite set of positive rationals is greater than a given rational number, then the p-adic valuation of their sum is also greater than the same rational number.
The numerator or denominator of a rational number has zero p-adic valuation.
The numerator and denominator of a rational number with even p-adic valuation
also have even p-adic valuation.
A rewrite lemma for multiplicity p (a * b) with conditions a ≠ 0, b ≠ 0.
Dividing out by a prime factor reduces the multiplicity by 1.
A version of padicValRat.pow for multiplicity.
Alias of Nat.multiplicity_mul.
A rewrite lemma for multiplicity p (a * b) with conditions a ≠ 0, b ≠ 0.
Alias of Nat.multiplicity_div_of_dvd.
Alias of Nat.multiplicity_div.
Dividing out by a prime factor reduces the multiplicity by 1.
Alias of Nat.multiplicity_pow.
A version of padicValRat.pow for multiplicity.
Alias of Nat.multiplicity_prime_pow.
Alias of Nat.multiplicity_div_pow.
Alias of Nat.multiplicity_div'.
Alias of dvd_of_one_le_multiplicity.
Alias of Nat.pow_dvd_iff_le_multiplicity.
Alias of multiplicity_dvd_iff_le.
Alias of multiplicity_dvd_iff_of_ne_one.
Alias of multiplicity_dvd_iff.
Alias of pow_succ_multiplicity_not_dvd.
Alias of multiplicity_primes.
Alias of multiplicity_prime_prime_pow.
Alias of multiplicity_mul_pow_left.
Alias of multiplicity_mul_pow_right.
The p-adic valuation of n is less than or equal to its logarithm w.r.t. p.
Alias of multiplicity_le_nat_log.
The p-adic valuation of n is less than or equal to its logarithm w.r.t. p.
Alias of multiplicity_add_le_self.
The p-adic valuation of n is equal to the logarithm w.r.t. p iff
n is less than p raised to one plus the p-adic valuation of n.
Alias of nat_log_eq_multiplicity_iff.
The p-adic valuation of n is equal to the logarithm w.r.t. p iff
n is less than p raised to one plus the p-adic valuation of n.
This is false for prime numbers other than 2:
for p = 3, n = 1, one has log 3 1 = multiplicity 3 2 = 0.
Alias of Nat.log_ne_multiplicity_succ.
This is false for prime numbers other than 2:
for p = 3, n = 1, one has log 3 1 = multiplicity 3 2 = 0.
Alias of range_pow_multiplicity_subset_divisors.
Alias of range_pow_multiplicity_subset_divisors'.
The p-adic valuation of (p * n)! is n more than that of n!.
Alias of multiplicity_factorial_mul.
The p-adic valuation of (p * n)! is n more than that of n!.
Alias of multiplicity_eq_zero_of_mem_Ioo.
The p-adic valuation of m equals zero if it is between p * k and p * (k + 1) for
some k.
Alias of multiplicity_factorial_mul_add.
The p-adic valuation of n! is equal to the p-adic valuation of the factorial of the
largest multiple of p below n, i.e. (p * ⌊n / p⌋)!.
Alias of multiplicity_mul_div_factorial.
The p-adic valuation of n! is equal to the p-adic valuation of the factorial of the
largest multiple of p below n, i.e. (p * ⌊n / p⌋)!.
Alias of multiplicity_factorial.
Legendre's Theorem
The p-adic valuation of n! is the sum of the quotients n / p ^ i. This sum is expressed
over the finset Ico 1 b where b is any bound greater than log p n.
Alias of multiplicity_factorial_lt_of_ne_zero.
Alias of multiplicity_factorial_le.
Kummer's Theorem
The p-adic valuation of n.choose k is the number of carries when k and n - k are added
in base p. This sum is expressed over the finset Ico 1 b where b is any bound greater than
log p n.
Alias of multiplicity_choose.
Kummer's Theorem
The p-adic valuation of n.choose k is the number of carries when k and n - k are added
in base p. This sum is expressed over the finset Ico 1 b where b is any bound greater than
log p n.
Kummer's Theorem
The p-adic valuation of (n + k).choose k is the number of carries when k and n are added
in base p. This sum is expressed over the finset Ico 1 b where b is any bound greater than
log p (n + k).
Alias of multiplicity_choose'.
Kummer's Theorem
The p-adic valuation of (n + k).choose k is the number of carries when k and n are added
in base p. This sum is expressed over the finset Ico 1 b where b is any bound greater than
log p (n + k).
Kummer's Theorem
Taking (p - 1) times the p-adic valuation of the binomial n + k over k equals the sum of the
digits of k plus the sum of the digits of n minus the sum of digits of n + k, all base p.
Alias of sub_one_mul_multiplicity_choose_eq_sub_sum_digits'.
Kummer's Theorem
Taking (p - 1) times the p-adic valuation of the binomial n + k over k equals the sum of the
digits of k plus the sum of the digits of n minus the sum of digits of n + k, all base p.
Kummer's Theorem
Taking (p - 1) times the p-adic valuation of the binomial n over k equals the sum of the
digits of k plus the sum of the digits of n - k minus the sum of digits of n, all base p.
Alias of sub_one_mul_multiplicity_choose_eq_sub_sum_digits.
Kummer's Theorem
Taking (p - 1) times the p-adic valuation of the binomial n over k equals the sum of the
digits of k plus the sum of the digits of n - k minus the sum of digits of n, all base p.