fact stringlengths 6 3.84k | type stringclasses 11
values | library stringclasses 32
values | imports listlengths 1 14 | filename stringlengths 20 95 | symbolic_name stringlengths 1 90 | docstring stringlengths 7 20k ⌀ |
|---|---|---|---|---|---|---|
abs_moebius_le_one {n : ℕ} : |μ n| ≤ 1 := by
rw [abs_moebius, apply_ite (· ≤ 1)]
simp | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | abs_moebius_le_one | null |
moebius_apply_prime {p : ℕ} (hp : p.Prime) : μ p = -1 := by
rw [moebius_apply_of_squarefree hp.squarefree, cardFactors_apply_prime hp, pow_one] | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | moebius_apply_prime | null |
moebius_apply_prime_pow {p k : ℕ} (hp : p.Prime) (hk : k ≠ 0) :
μ (p ^ k) = if k = 1 then -1 else 0 := by
split_ifs with h
· rw [h, pow_one, moebius_apply_prime hp]
rw [moebius_eq_zero_of_not_squarefree]
rw [squarefree_pow_iff hp.ne_one hk, not_and_or]
exact Or.inr h | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | moebius_apply_prime_pow | null |
moebius_apply_isPrimePow_not_prime {n : ℕ} (hn : IsPrimePow n) (hn' : ¬n.Prime) :
μ n = 0 := by
obtain ⟨p, k, hp, hk, rfl⟩ := (isPrimePow_nat_iff _).1 hn
rw [moebius_apply_prime_pow hp hk.ne', if_neg]
rintro rfl
exact hn' (by simpa)
@[arith_mult] | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | moebius_apply_isPrimePow_not_prime | null |
isMultiplicative_moebius : IsMultiplicative μ := by
rw [IsMultiplicative.iff_ne_zero]
refine ⟨by simp, fun {n m} hn hm hnm => ?_⟩
simp only [moebius, coe_mk,
squarefree_mul hnm, ite_zero_mul_ite_zero,
cardFactors_mul hn hm, pow_add] | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | isMultiplicative_moebius | null |
IsMultiplicative.prodPrimeFactors_one_add_of_squarefree [CommSemiring R]
{f : ArithmeticFunction R} (h_mult : f.IsMultiplicative) {n : ℕ} (hn : Squarefree n) :
∏ p ∈ n.primeFactors, (1 + f p) = ∑ d ∈ n.divisors, f d := by
trans (∏ᵖ p ∣ n, ((ζ : ArithmeticFunction R) + f) p)
· simp_rw [prodPrimeFactors_apply... | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | IsMultiplicative.prodPrimeFactors_one_add_of_squarefree | null |
IsMultiplicative.prodPrimeFactors_one_sub_of_squarefree [CommRing R]
(f : ArithmeticFunction R) (hf : f.IsMultiplicative) {n : ℕ} (hn : Squarefree n) :
∏ p ∈ n.primeFactors, (1 - f p) = ∑ d ∈ n.divisors, μ d * f d := by
trans (∏ p ∈ n.primeFactors, (1 + (ArithmeticFunction.pmul (μ : ArithmeticFunction R) f) p... | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | IsMultiplicative.prodPrimeFactors_one_sub_of_squarefree | null |
moebius_mul_coe_zeta : (μ * ζ : ArithmeticFunction ℤ) = 1 := by
ext n
induction n using recOnPosPrimePosCoprime with
| zero => rw [ZeroHom.map_zero, ZeroHom.map_zero]
| one => simp
| prime_pow p n hp hn =>
rw [coe_mul_zeta_apply, sum_divisors_prime_pow hp, sum_range_succ']
simp_rw [Nat.pow_zero, moebi... | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | moebius_mul_coe_zeta | null |
coe_zeta_mul_moebius : (ζ * μ : ArithmeticFunction ℤ) = 1 := by
rw [mul_comm, moebius_mul_coe_zeta]
@[simp] | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | coe_zeta_mul_moebius | null |
coe_moebius_mul_coe_zeta [Ring R] : (μ * ζ : ArithmeticFunction R) = 1 := by
rw [← coe_coe, ← intCoe_mul, moebius_mul_coe_zeta, intCoe_one]
@[simp] | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | coe_moebius_mul_coe_zeta | null |
coe_zeta_mul_coe_moebius [Ring R] : (ζ * μ : ArithmeticFunction R) = 1 := by
rw [← coe_coe, ← intCoe_mul, coe_zeta_mul_moebius, intCoe_one] | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | coe_zeta_mul_coe_moebius | null |
zetaUnit : (ArithmeticFunction R)ˣ :=
⟨ζ, μ, coe_zeta_mul_coe_moebius, coe_moebius_mul_coe_zeta⟩
@[simp] | def | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | zetaUnit | A unit in `ArithmeticFunction R` that evaluates to `ζ`, with inverse `μ`. |
coe_zetaUnit : ((zetaUnit : (ArithmeticFunction R)ˣ) : ArithmeticFunction R) = ζ :=
rfl
@[simp] | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | coe_zetaUnit | null |
inv_zetaUnit : ((zetaUnit⁻¹ : (ArithmeticFunction R)ˣ) : ArithmeticFunction R) = μ :=
rfl | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | inv_zetaUnit | null |
sum_eq_iff_sum_smul_moebius_eq [AddCommGroup R] {f g : ℕ → R} :
(∀ n > 0, ∑ i ∈ n.divisors, f i = g n) ↔
∀ n > 0, ∑ x ∈ n.divisorsAntidiagonal, μ x.fst • g x.snd = f n := by
let f' : ArithmeticFunction R := ⟨fun x => if x = 0 then 0 else f x, if_pos rfl⟩
let g' : ArithmeticFunction R := ⟨fun x => if x = 0... | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | sum_eq_iff_sum_smul_moebius_eq | Möbius inversion for functions to an `AddCommGroup`. |
sum_eq_iff_sum_mul_moebius_eq [NonAssocRing R] {f g : ℕ → R} :
(∀ n > 0, ∑ i ∈ n.divisors, f i = g n) ↔
∀ n > 0, ∑ x ∈ n.divisorsAntidiagonal, (μ x.fst : R) * g x.snd = f n := by
rw [sum_eq_iff_sum_smul_moebius_eq]
apply forall_congr'
refine fun a => imp_congr_right fun _ => (sum_congr rfl fun x _hx => ... | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | sum_eq_iff_sum_mul_moebius_eq | Möbius inversion for functions to a `Ring`. |
prod_eq_iff_prod_pow_moebius_eq [CommGroup R] {f g : ℕ → R} :
(∀ n > 0, ∏ i ∈ n.divisors, f i = g n) ↔
∀ n > 0, ∏ x ∈ n.divisorsAntidiagonal, g x.snd ^ μ x.fst = f n :=
@sum_eq_iff_sum_smul_moebius_eq (Additive R) _ _ _ | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | prod_eq_iff_prod_pow_moebius_eq | Möbius inversion for functions to a `CommGroup`. |
prod_eq_iff_prod_pow_moebius_eq_of_nonzero [CommGroupWithZero R] {f g : ℕ → R}
(hf : ∀ n : ℕ, 0 < n → f n ≠ 0) (hg : ∀ n : ℕ, 0 < n → g n ≠ 0) :
(∀ n > 0, ∏ i ∈ n.divisors, f i = g n) ↔
∀ n > 0, ∏ x ∈ n.divisorsAntidiagonal, g x.snd ^ μ x.fst = f n := by
refine
Iff.trans
(Iff.trans (forall... | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | prod_eq_iff_prod_pow_moebius_eq_of_nonzero | Möbius inversion for functions to a `CommGroupWithZero`. |
sum_eq_iff_sum_smul_moebius_eq_on [AddCommGroup R] {f g : ℕ → R}
(s : Set ℕ) (hs : ∀ m n, m ∣ n → n ∈ s → m ∈ s) :
(∀ n > 0, n ∈ s → (∑ i ∈ n.divisors, f i) = g n) ↔
∀ n > 0, n ∈ s → (∑ x ∈ n.divisorsAntidiagonal, μ x.fst • g x.snd) = f n := by
constructor
· intro h
let G := fun (n : ℕ) => (∑ i ∈ ... | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | sum_eq_iff_sum_smul_moebius_eq_on | Möbius inversion for functions to an `AddCommGroup`, where the equalities only hold on a
well-behaved set. |
sum_eq_iff_sum_smul_moebius_eq_on' [AddCommGroup R] {f g : ℕ → R}
(s : Set ℕ) (hs : ∀ m n, m ∣ n → n ∈ s → m ∈ s) (hs₀ : 0 ∉ s) :
(∀ n ∈ s, (∑ i ∈ n.divisors, f i) = g n) ↔
∀ n ∈ s, (∑ x ∈ n.divisorsAntidiagonal, μ x.fst • g x.snd) = f n := by
have : ∀ P : ℕ → Prop, ((∀ n ∈ s, P n) ↔ (∀ n > 0, n ∈ s → P ... | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | sum_eq_iff_sum_smul_moebius_eq_on' | null |
sum_eq_iff_sum_mul_moebius_eq_on [NonAssocRing R] {f g : ℕ → R}
(s : Set ℕ) (hs : ∀ m n, m ∣ n → n ∈ s → m ∈ s) :
(∀ n > 0, n ∈ s → (∑ i ∈ n.divisors, f i) = g n) ↔
∀ n > 0, n ∈ s →
(∑ x ∈ n.divisorsAntidiagonal, (μ x.fst : R) * g x.snd) = f n := by
rw [sum_eq_iff_sum_smul_moebius_eq_on s hs]
... | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | sum_eq_iff_sum_mul_moebius_eq_on | Möbius inversion for functions to a `Ring`, where the equalities only hold on a well-behaved
set. |
prod_eq_iff_prod_pow_moebius_eq_on [CommGroup R] {f g : ℕ → R}
(s : Set ℕ) (hs : ∀ m n, m ∣ n → n ∈ s → m ∈ s) :
(∀ n > 0, n ∈ s → (∏ i ∈ n.divisors, f i) = g n) ↔
∀ n > 0, n ∈ s → (∏ x ∈ n.divisorsAntidiagonal, g x.snd ^ μ x.fst) = f n :=
@sum_eq_iff_sum_smul_moebius_eq_on (Additive R) _ _ _ s hs | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | prod_eq_iff_prod_pow_moebius_eq_on | Möbius inversion for functions to a `CommGroup`, where the equalities only hold on a
well-behaved set. |
prod_eq_iff_prod_pow_moebius_eq_on_of_nonzero [CommGroupWithZero R]
(s : Set ℕ) (hs : ∀ m n, m ∣ n → n ∈ s → m ∈ s) {f g : ℕ → R}
(hf : ∀ n > 0, f n ≠ 0) (hg : ∀ n > 0, g n ≠ 0) :
(∀ n > 0, n ∈ s → (∏ i ∈ n.divisors, f i) = g n) ↔
∀ n > 0, n ∈ s → (∏ x ∈ n.divisorsAntidiagonal, g x.snd ^ μ x.fst) = f ... | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | prod_eq_iff_prod_pow_moebius_eq_on_of_nonzero | Möbius inversion for functions to a `CommGroupWithZero`, where the equalities only hold on
a well-behaved set. |
card_divisors_mul {m n : ℕ} (hmn : m.Coprime n) :
#(m * n).divisors = #m.divisors * #n.divisors := by
simp only [← sigma_zero_apply, isMultiplicative_sigma.map_mul_of_coprime hmn] | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | card_divisors_mul | null |
sum_divisors_mul {m n : ℕ} (hmn : m.Coprime n) :
∑ d ∈ (m * n).divisors, d = (∑ d ∈ m.divisors, d) * ∑ d ∈ n.divisors, d := by
simp only [← sigma_one_apply, isMultiplicative_sigma.map_mul_of_coprime hmn] | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | sum_divisors_mul | null |
@[positivity ArithmeticFunction.sigma _ _]
evalArithmeticFunctionSigma : PositivityExt where eval {u α} z p e := do
match u, α, e with
| 0, ~q(ℕ), ~q(ArithmeticFunction.sigma $k $n) =>
let rn ← core z p n
assumeInstancesCommute
match rn with
| .positive pn => return .positive q(Iff.mpr ArithmeticFun... | def | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | evalArithmeticFunctionSigma | Extension for `ArithmeticFunction.sigma`. |
@[positivity ArithmeticFunction.zeta _]
evalArithmeticFunctionZeta : PositivityExt where eval {u α} z p e := do
match u, α, e with
| 0, ~q(ℕ), ~q(ArithmeticFunction.zeta $n) =>
let rn ← core z p n
assumeInstancesCommute
match rn with
| .positive pn => return .positive q(Iff.mpr ArithmeticFunction.ze... | def | NumberTheory | [
"Mathlib.Algebra.BigOperators.Ring.Finset",
"Mathlib.Algebra.Module.BigOperators",
"Mathlib.NumberTheory.Divisors",
"Mathlib.Data.Nat.Squarefree",
"Mathlib.Data.Nat.GCD.BigOperators",
"Mathlib.Data.Nat.Factorization.Induction",
"Mathlib.Tactic.ArithMult"
] | Mathlib/NumberTheory/ArithmeticFunction.lean | evalArithmeticFunctionZeta | Extension for `ArithmeticFunction.zeta`. |
in the construction of the ring of Witt vectors. | lemma | NumberTheory | [
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Basic.lean | in | null |
dvd_sub_pow_of_dvd_sub {R : Type*} [CommRing R] {p : ℕ} {a b : R} (h : (p : R) ∣ a - b)
(k : ℕ) : (p ^ (k + 1) : R) ∣ a ^ p ^ k - b ^ p ^ k := by
induction k with
| zero => rwa [pow_one, pow_zero, pow_one, pow_one]
| succ k ih =>
rw [pow_succ p k, pow_mul, pow_mul, ← geom_sum₂_mul, pow_succ']
refine m... | theorem | NumberTheory | [
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Basic.lean | dvd_sub_pow_of_dvd_sub | null |
bernoulli' (n : ℕ) : ℚ :=
1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k | def | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | bernoulli' | The Bernoulli numbers:
the $n$-th Bernoulli number $B_n$ is defined recursively via
$$B_n = 1 - \sum_{k < n} \binom{n}{k}\frac{B_k}{n+1-k}$$ |
bernoulli'_def' (n : ℕ) :
bernoulli' n = 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k := by
rw [bernoulli'] | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | bernoulli'_def' | null |
bernoulli'_def (n : ℕ) :
bernoulli' n = 1 - ∑ k ∈ range n, n.choose k / (n - k + 1) * bernoulli' k := by
rw [bernoulli'_def', ← Fin.sum_univ_eq_sum_range] | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | bernoulli'_def | null |
bernoulli'_spec (n : ℕ) :
(∑ k ∈ range n.succ, (n.choose (n - k) : ℚ) / (n - k + 1) * bernoulli' k) = 1 := by
rw [sum_range_succ_comm, bernoulli'_def n, tsub_self, choose_zero_right, sub_self, zero_add,
div_one, cast_one, one_mul, sub_add, ← sum_sub_distrib, ← sub_eq_zero, sub_sub_cancel_left,
neg_eq_zero... | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | bernoulli'_spec | null |
bernoulli'_spec' (n : ℕ) :
(∑ k ∈ antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli' k.1) = 1 := by
refine ((sum_antidiagonal_eq_sum_range_succ_mk _ n).trans ?_).trans (bernoulli'_spec n)
refine sum_congr rfl fun x hx => ?_
simp only [add_tsub_cancel_of_le, mem_range_succ_iff.mp hx, cast_su... | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | bernoulli'_spec' | null |
@[simp]
bernoulli'_zero : bernoulli' 0 = 1 := by
rw [bernoulli'_def]
simp
@[simp] | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | bernoulli'_zero | null |
bernoulli'_one : bernoulli' 1 = 1 / 2 := by
rw [bernoulli'_def]
norm_num
@[simp] | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | bernoulli'_one | null |
bernoulli'_two : bernoulli' 2 = 1 / 6 := by
rw [bernoulli'_def]
norm_num [sum_range_succ, sum_range_succ, sum_range_zero]
@[simp] | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | bernoulli'_two | null |
bernoulli'_three : bernoulli' 3 = 0 := by
rw [bernoulli'_def]
norm_num [sum_range_succ, sum_range_succ, sum_range_zero]
@[simp] | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | bernoulli'_three | null |
bernoulli'_four : bernoulli' 4 = -1 / 30 := by
have : Nat.choose 4 2 = 6 := by decide -- shrug
rw [bernoulli'_def]
norm_num [sum_range_succ, sum_range_succ, sum_range_zero, this] | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | bernoulli'_four | null |
@[simp]
sum_bernoulli' (n : ℕ) : (∑ k ∈ range n, (n.choose k : ℚ) * bernoulli' k) = n := by
cases n with | zero => simp | succ n =>
suffices
((n + 1 : ℚ) * ∑ k ∈ range n, ↑(n.choose k) / (n - k + 1) * bernoulli' k) =
∑ x ∈ range n, ↑(n.succ.choose x) * bernoulli' x by
rw_mod_cast [sum_range_succ, bern... | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | sum_bernoulli' | null |
bernoulli'PowerSeries :=
mk fun n => algebraMap ℚ A (bernoulli' n / n !) | def | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | bernoulli'PowerSeries | The exponential generating function for the Bernoulli numbers `bernoulli' n`. |
bernoulli'PowerSeries_mul_exp_sub_one :
bernoulli'PowerSeries A * (exp A - 1) = X * exp A := by
ext n
cases n with | zero => simp | succ n =>
rw [bernoulli'PowerSeries, coeff_mul, mul_comm X, sum_antidiagonal_succ']
suffices (∑ p ∈ antidiagonal n,
bernoulli' p.1 / p.1! * ((p.2 + 1) * p.2! : ℚ)⁻¹) = (n... | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | bernoulli'PowerSeries_mul_exp_sub_one | null |
bernoulli'_odd_eq_zero {n : ℕ} (h_odd : Odd n) (hlt : 1 < n) : bernoulli' n = 0 := by
let B := mk fun n => bernoulli' n / (n ! : ℚ)
suffices (B - evalNegHom B) * (exp ℚ - 1) = X * (exp ℚ - 1) by
rcases mul_eq_mul_right_iff.mp this with h | h <;>
simp only [PowerSeries.ext_iff, evalNegHom, coeff_X] at h
... | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | bernoulli'_odd_eq_zero | Odd Bernoulli numbers (greater than 1) are zero. |
bernoulli (n : ℕ) : ℚ :=
(-1) ^ n * bernoulli' n | def | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | bernoulli | The Bernoulli numbers are defined to be `bernoulli'` with a parity sign. |
bernoulli'_eq_bernoulli (n : ℕ) : bernoulli' n = (-1) ^ n * bernoulli n := by
simp [bernoulli, ← mul_assoc, ← sq, ← pow_mul, mul_comm n 2]
@[simp] | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | bernoulli'_eq_bernoulli | null |
bernoulli_zero : bernoulli 0 = 1 := by simp [bernoulli]
@[simp] | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | bernoulli_zero | null |
bernoulli_one : bernoulli 1 = -1 / 2 := by norm_num [bernoulli] | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | bernoulli_one | null |
bernoulli_eq_bernoulli'_of_ne_one {n : ℕ} (hn : n ≠ 1) : bernoulli n = bernoulli' n := by
by_cases h0 : n = 0; · simp [h0]
rw [bernoulli, neg_one_pow_eq_pow_mod_two]
rcases mod_two_eq_zero_or_one n with h | h
· simp [h]
· simp [bernoulli'_odd_eq_zero (odd_iff.mpr h) (one_lt_iff_ne_zero_and_ne_one.mpr ⟨h0, hn⟩... | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | bernoulli_eq_bernoulli'_of_ne_one | null |
sum_bernoulli (n : ℕ) :
(∑ k ∈ range n, (n.choose k : ℚ) * bernoulli k) = if n = 1 then 1 else 0 := by
cases n with | zero => simp | succ n =>
cases n with
| zero => simp
| succ n =>
suffices (∑ i ∈ range n, ↑((n + 2).choose (i + 2)) * bernoulli (i + 2)) = n / 2 by
simp only [this, sum_range_succ', ca... | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | sum_bernoulli | null |
bernoulli_spec' (n : ℕ) :
(∑ k ∈ antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli k.1) =
if n = 0 then 1 else 0 := by
cases n with | zero => simp | succ n =>
rw [if_neg (succ_ne_zero _)]
have h₁ : (1, n) ∈ antidiagonal n.succ := by simp [mem_antidiagonal, add_comm]
have h₂ : (n : ℚ... | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | bernoulli_spec' | null |
bernoulliPowerSeries :=
mk fun n => algebraMap ℚ A (bernoulli n / n !) | def | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | bernoulliPowerSeries | The exponential generating function for the Bernoulli numbers `bernoulli n`. |
bernoulliPowerSeries_mul_exp_sub_one : bernoulliPowerSeries A * (exp A - 1) = X := by
ext n
cases n with | zero => simp | succ n =>
simp only [bernoulliPowerSeries, coeff_mul, coeff_X, sum_antidiagonal_succ', one_div, coeff_mk,
coeff_one, coeff_exp, LinearMap.map_sub, factorial, if_pos, cast_succ, cast_mul,
... | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | bernoulliPowerSeries_mul_exp_sub_one | null |
sum_range_pow (n p : ℕ) :
(∑ k ∈ range n, (k : ℚ) ^ p) =
∑ i ∈ range (p + 1), bernoulli i * ((p + 1).choose i) * (n : ℚ) ^ (p + 1 - i) / (p + 1) := by
have hne : ∀ m : ℕ, (m ! : ℚ) ≠ 0 := fun m => mod_cast factorial_ne_zero m
have h_cauchy :
((mk fun p => bernoulli p / p !) * mk fun q => coeff (q + 1)... | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | sum_range_pow | **Faulhaber's theorem** relating the **sum of p-th powers** to the Bernoulli numbers:
$$\sum_{k=0}^{n-1} k^p = \sum_{i=0}^p B_i\binom{p+1}{i}\frac{n^{p+1-i}}{p+1}.$$
See https://proofwiki.org/wiki/Faulhaber%27s_Formula and [orosi2018faulhaber] for
the proof provided here. |
sum_Ico_pow (n p : ℕ) :
(∑ k ∈ Ico 1 (n + 1), (k : ℚ) ^ p) =
∑ i ∈ range (p + 1), bernoulli' i * (p + 1).choose i * (n : ℚ) ^ (p + 1 - i) / (p + 1) := by
rw [← Nat.cast_succ]
cases p with | zero => simp | succ p =>
let f i := bernoulli i * p.succ.succ.choose i * (n : ℚ) ^ (p.succ.succ - i) / p.succ.succ... | theorem | NumberTheory | [
"Mathlib.Algebra.BigOperators.Field",
"Mathlib.RingTheory.PowerSeries.Inverse",
"Mathlib.RingTheory.PowerSeries.WellKnown"
] | Mathlib/NumberTheory/Bernoulli.lean | sum_Ico_pow | Alternate form of **Faulhaber's theorem**, relating the sum of p-th powers to the Bernoulli
numbers: $$\sum_{k=1}^{n} k^p = \sum_{i=0}^p (-1)^iB_i\binom{p+1}{i}\frac{n^{p+1-i}}{p+1}.$$
Deduced from `sum_range_pow`. |
bernoulli (n : ℕ) : ℚ[X] :=
∑ i ∈ range (n + 1), Polynomial.monomial (n - i) (_root_.bernoulli i * choose n i) | def | NumberTheory | [
"Mathlib.Algebra.Polynomial.AlgebraMap",
"Mathlib.Algebra.Polynomial.Derivative",
"Mathlib.Data.Nat.Choose.Cast",
"Mathlib.NumberTheory.Bernoulli"
] | Mathlib/NumberTheory/BernoulliPolynomials.lean | bernoulli | The Bernoulli polynomials are defined in terms of the negative Bernoulli numbers. |
bernoulli_def (n : ℕ) : bernoulli n =
∑ i ∈ range (n + 1), Polynomial.monomial i (_root_.bernoulli (n - i) * choose n i) := by
rw [← sum_range_reflect, add_succ_sub_one, add_zero, bernoulli]
apply sum_congr rfl
rintro x hx
rw [mem_range_succ_iff] at hx
rw [choose_symm hx, tsub_tsub_cancel_of_le hx]
/- | theorem | NumberTheory | [
"Mathlib.Algebra.Polynomial.AlgebraMap",
"Mathlib.Algebra.Polynomial.Derivative",
"Mathlib.Data.Nat.Choose.Cast",
"Mathlib.NumberTheory.Bernoulli"
] | Mathlib/NumberTheory/BernoulliPolynomials.lean | bernoulli_def | null |
@[simp]
bernoulli_zero : bernoulli 0 = 1 := by simp [bernoulli]
@[simp] | theorem | NumberTheory | [
"Mathlib.Algebra.Polynomial.AlgebraMap",
"Mathlib.Algebra.Polynomial.Derivative",
"Mathlib.Data.Nat.Choose.Cast",
"Mathlib.NumberTheory.Bernoulli"
] | Mathlib/NumberTheory/BernoulliPolynomials.lean | bernoulli_zero | null |
bernoulli_eval_zero (n : ℕ) : (bernoulli n).eval 0 = _root_.bernoulli n := by
rw [bernoulli, eval_finset_sum, sum_range_succ]
have : ∑ x ∈ range n, _root_.bernoulli x * n.choose x * 0 ^ (n - x) = 0 := by
apply sum_eq_zero fun x hx => _
intro x hx
simp [tsub_eq_zero_iff_le, mem_range.1 hx]
simp [this]
... | theorem | NumberTheory | [
"Mathlib.Algebra.Polynomial.AlgebraMap",
"Mathlib.Algebra.Polynomial.Derivative",
"Mathlib.Data.Nat.Choose.Cast",
"Mathlib.NumberTheory.Bernoulli"
] | Mathlib/NumberTheory/BernoulliPolynomials.lean | bernoulli_eval_zero | null |
bernoulli_eval_one (n : ℕ) : (bernoulli n).eval 1 = bernoulli' n := by
simp only [bernoulli, eval_finset_sum]
simp only [← succ_eq_add_one, sum_range_succ, mul_one, cast_one, choose_self,
(_root_.bernoulli _).mul_comm, sum_bernoulli, one_pow, mul_one, eval_monomial, one_mul]
by_cases h : n = 1
· norm_num [h... | theorem | NumberTheory | [
"Mathlib.Algebra.Polynomial.AlgebraMap",
"Mathlib.Algebra.Polynomial.Derivative",
"Mathlib.Data.Nat.Choose.Cast",
"Mathlib.NumberTheory.Bernoulli"
] | Mathlib/NumberTheory/BernoulliPolynomials.lean | bernoulli_eval_one | null |
derivative_bernoulli_add_one (k : ℕ) :
Polynomial.derivative (bernoulli (k + 1)) = (k + 1) * bernoulli k := by
simp_rw [bernoulli, derivative_sum, derivative_monomial, Nat.sub_sub, Nat.add_sub_add_right]
rw [range_add_one, sum_insert notMem_range_self, tsub_self, cast_zero, mul_zero,
map_zero, zero_add, mul... | theorem | NumberTheory | [
"Mathlib.Algebra.Polynomial.AlgebraMap",
"Mathlib.Algebra.Polynomial.Derivative",
"Mathlib.Data.Nat.Choose.Cast",
"Mathlib.NumberTheory.Bernoulli"
] | Mathlib/NumberTheory/BernoulliPolynomials.lean | derivative_bernoulli_add_one | null |
derivative_bernoulli (k : ℕ) :
Polynomial.derivative (bernoulli k) = k * bernoulli (k - 1) := by
cases k with
| zero => rw [Nat.cast_zero, zero_mul, bernoulli_zero, derivative_one]
| succ k => exact mod_cast derivative_bernoulli_add_one k
@[simp]
nonrec theorem sum_bernoulli (n : ℕ) :
(∑ k ∈ range (n + 1)... | theorem | NumberTheory | [
"Mathlib.Algebra.Polynomial.AlgebraMap",
"Mathlib.Algebra.Polynomial.Derivative",
"Mathlib.Data.Nat.Choose.Cast",
"Mathlib.NumberTheory.Bernoulli"
] | Mathlib/NumberTheory/BernoulliPolynomials.lean | derivative_bernoulli | null |
bernoulli_eq_sub_sum (n : ℕ) :
(n.succ : ℚ) • bernoulli n =
monomial n (n.succ : ℚ) - ∑ k ∈ Finset.range n, ((n + 1).choose k : ℚ) • bernoulli k := by
rw [Nat.cast_succ, ← sum_bernoulli n, sum_range_succ, add_sub_cancel_left, choose_succ_self_right,
Nat.cast_succ] | theorem | NumberTheory | [
"Mathlib.Algebra.Polynomial.AlgebraMap",
"Mathlib.Algebra.Polynomial.Derivative",
"Mathlib.Data.Nat.Choose.Cast",
"Mathlib.NumberTheory.Bernoulli"
] | Mathlib/NumberTheory/BernoulliPolynomials.lean | bernoulli_eq_sub_sum | Another version of `Polynomial.sum_bernoulli`. |
sum_range_pow_eq_bernoulli_sub (n p : ℕ) :
((p + 1 : ℚ) * ∑ k ∈ range n, (k : ℚ) ^ p) = (bernoulli p.succ).eval (n : ℚ) -
_root_.bernoulli p.succ := by
rw [sum_range_pow, bernoulli_def, eval_finset_sum, ← sum_div, mul_div_cancel₀ _ _]
· simp_rw [eval_monomial]
symm
rw [← sum_flip _, sum_range_succ]
... | theorem | NumberTheory | [
"Mathlib.Algebra.Polynomial.AlgebraMap",
"Mathlib.Algebra.Polynomial.Derivative",
"Mathlib.Data.Nat.Choose.Cast",
"Mathlib.NumberTheory.Bernoulli"
] | Mathlib/NumberTheory/BernoulliPolynomials.lean | sum_range_pow_eq_bernoulli_sub | Another version of `sum_range_pow`. |
bernoulli_succ_eval (n p : ℕ) : (bernoulli p.succ).eval (n : ℚ) =
_root_.bernoulli p.succ + (p + 1 : ℚ) * ∑ k ∈ range n, (k : ℚ) ^ p := by
apply eq_add_of_sub_eq'
rw [sum_range_pow_eq_bernoulli_sub] | theorem | NumberTheory | [
"Mathlib.Algebra.Polynomial.AlgebraMap",
"Mathlib.Algebra.Polynomial.Derivative",
"Mathlib.Data.Nat.Choose.Cast",
"Mathlib.NumberTheory.Bernoulli"
] | Mathlib/NumberTheory/BernoulliPolynomials.lean | bernoulli_succ_eval | Rearrangement of `Polynomial.sum_range_pow_eq_bernoulli_sub`. |
bernoulli_eval_one_add (n : ℕ) (x : ℚ) :
(bernoulli n).eval (1 + x) = (bernoulli n).eval x + n * x ^ (n - 1) := by
refine Nat.strong_induction_on n fun d hd => ?_
have nz : ((d.succ : ℕ) : ℚ) ≠ 0 := by norm_cast
apply (mul_right_inj' nz).1
rw [← smul_eq_mul, ← eval_smul, bernoulli_eq_sub_sum, mul_add, ← smu... | theorem | NumberTheory | [
"Mathlib.Algebra.Polynomial.AlgebraMap",
"Mathlib.Algebra.Polynomial.Derivative",
"Mathlib.Data.Nat.Choose.Cast",
"Mathlib.NumberTheory.Bernoulli"
] | Mathlib/NumberTheory/BernoulliPolynomials.lean | bernoulli_eval_one_add | null |
bernoulli_generating_function (t : A) :
(mk fun n => aeval t ((1 / n ! : ℚ) • bernoulli n)) * (exp A - 1) =
PowerSeries.X * rescale t (exp A) := by
ext n
cases n with | zero => simp | succ n =>
rw [coeff_succ_X_mul, coeff_rescale, coeff_exp, PowerSeries.coeff_mul,
Nat.sum_antidiagonal_eq_sum_range_s... | theorem | NumberTheory | [
"Mathlib.Algebra.Polynomial.AlgebraMap",
"Mathlib.Algebra.Polynomial.Derivative",
"Mathlib.Data.Nat.Choose.Cast",
"Mathlib.NumberTheory.Bernoulli"
] | Mathlib/NumberTheory/BernoulliPolynomials.lean | bernoulli_generating_function | The theorem that $(e^X - 1) * ∑ Bₙ(t)* X^n/n! = Xe^{tX}$ |
real_main_inequality {x : ℝ} (x_large : (512 : ℝ) ≤ x) :
x * (2 * x) ^ √(2 * x) * 4 ^ (2 * x / 3) ≤ 4 ^ x := by
let f : ℝ → ℝ := fun x => log x + √(2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : ∀ x, 0 < x → 0 < x * (2 * x) ^ √(2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos... | theorem | NumberTheory | [
"Mathlib.Data.Nat.Choose.Factorization",
"Mathlib.NumberTheory.Primorial",
"Mathlib.Analysis.Convex.SpecificFunctions.Basic",
"Mathlib.Analysis.Convex.SpecificFunctions.Deriv",
"Mathlib.Tactic.NormNum.Prime"
] | Mathlib/NumberTheory/Bertrand.lean | real_main_inequality | A refined version of the `Bertrand.main_inequality` below.
This is not best possible: it actually holds for 464 ≤ x. |
bertrand_main_inequality {n : ℕ} (n_large : 512 ≤ n) :
n * (2 * n) ^ sqrt (2 * n) * 4 ^ (2 * n / 3) ≤ 4 ^ n := by
rw [← @cast_le ℝ]
simp only [cast_mul, cast_pow, ← Real.rpow_natCast, cast_ofNat]
refine _root_.trans ?_ (Bertrand.real_main_inequality (by exact_mod_cast n_large))
gcongr
· have n2_pos : 0 < ... | theorem | NumberTheory | [
"Mathlib.Data.Nat.Choose.Factorization",
"Mathlib.NumberTheory.Primorial",
"Mathlib.Analysis.Convex.SpecificFunctions.Basic",
"Mathlib.Analysis.Convex.SpecificFunctions.Deriv",
"Mathlib.Tactic.NormNum.Prime"
] | Mathlib/NumberTheory/Bertrand.lean | bertrand_main_inequality | The inequality which contradicts Bertrand's postulate, for large enough `n`. |
centralBinom_factorization_small (n : ℕ) (n_large : 2 < n)
(no_prime : ¬∃ p : ℕ, p.Prime ∧ n < p ∧ p ≤ 2 * n) :
centralBinom n = ∏ p ∈ Finset.range (2 * n / 3 + 1), p ^ (centralBinom n).factorization p := by
refine (Eq.trans ?_ n.prod_pow_factorization_centralBinom).symm
apply Finset.prod_subset
· exact F... | theorem | NumberTheory | [
"Mathlib.Data.Nat.Choose.Factorization",
"Mathlib.NumberTheory.Primorial",
"Mathlib.Analysis.Convex.SpecificFunctions.Basic",
"Mathlib.Analysis.Convex.SpecificFunctions.Deriv",
"Mathlib.Tactic.NormNum.Prime"
] | Mathlib/NumberTheory/Bertrand.lean | centralBinom_factorization_small | A lemma that tells us that, in the case where Bertrand's postulate does not hold, the prime
factorization of the central binomial coefficient only has factors at most `2 * n / 3 + 1`. |
centralBinom_le_of_no_bertrand_prime (n : ℕ) (n_large : 2 < n)
(no_prime : ¬∃ p : ℕ, Nat.Prime p ∧ n < p ∧ p ≤ 2 * n) :
centralBinom n ≤ (2 * n) ^ sqrt (2 * n) * 4 ^ (2 * n / 3) := by
have n_pos : 0 < n := (Nat.zero_le _).trans_lt n_large
have n2_pos : 1 ≤ 2 * n := mul_pos (zero_lt_two' ℕ) n_pos
let S := ... | theorem | NumberTheory | [
"Mathlib.Data.Nat.Choose.Factorization",
"Mathlib.NumberTheory.Primorial",
"Mathlib.Analysis.Convex.SpecificFunctions.Basic",
"Mathlib.Analysis.Convex.SpecificFunctions.Deriv",
"Mathlib.Tactic.NormNum.Prime"
] | Mathlib/NumberTheory/Bertrand.lean | centralBinom_le_of_no_bertrand_prime | An upper bound on the central binomial coefficient used in the proof of Bertrand's postulate.
The bound splits the prime factors of `centralBinom n` into those
1. At most `sqrt (2 * n)`, which contribute at most `2 * n` for each such prime.
2. Between `sqrt (2 * n)` and `2 * n / 3`, which contribute at most `4^(2 * n /... |
exists_prime_lt_and_le_two_mul_eventually (n : ℕ) (n_large : 512 ≤ n) :
∃ p : ℕ, p.Prime ∧ n < p ∧ p ≤ 2 * n := by
by_contra no_prime
have H1 : n * (2 * n) ^ sqrt (2 * n) * 4 ^ (2 * n / 3) ≤ 4 ^ n := bertrand_main_inequality n_large
have H2 : 4 ^ n < n * n.centralBinom :=
Nat.four_pow_lt_mul_centralBinom ... | theorem | NumberTheory | [
"Mathlib.Data.Nat.Choose.Factorization",
"Mathlib.NumberTheory.Primorial",
"Mathlib.Analysis.Convex.SpecificFunctions.Basic",
"Mathlib.Analysis.Convex.SpecificFunctions.Deriv",
"Mathlib.Tactic.NormNum.Prime"
] | Mathlib/NumberTheory/Bertrand.lean | exists_prime_lt_and_le_two_mul_eventually | Proves that **Bertrand's postulate** holds for all sufficiently large `n`. |
exists_prime_lt_and_le_two_mul_succ {n} (q) {p : ℕ} (prime_p : Nat.Prime p)
(covering : p ≤ 2 * q) (H : n < q → ∃ p : ℕ, p.Prime ∧ n < p ∧ p ≤ 2 * n) (hn : n < p) :
∃ p : ℕ, p.Prime ∧ n < p ∧ p ≤ 2 * n := by
grind | theorem | NumberTheory | [
"Mathlib.Data.Nat.Choose.Factorization",
"Mathlib.NumberTheory.Primorial",
"Mathlib.Analysis.Convex.SpecificFunctions.Basic",
"Mathlib.Analysis.Convex.SpecificFunctions.Deriv",
"Mathlib.Tactic.NormNum.Prime"
] | Mathlib/NumberTheory/Bertrand.lean | exists_prime_lt_and_le_two_mul_succ | Proves that Bertrand's postulate holds over all positive naturals less than n by identifying a
descending list of primes, each no more than twice the next, such that the list contains a witness
for each number ≤ n. |
exists_prime_lt_and_le_two_mul (n : ℕ) (hn0 : n ≠ 0) :
∃ p, Nat.Prime p ∧ n < p ∧ p ≤ 2 * n := by
rcases lt_or_ge 511 n with h | h
· exact exists_prime_lt_and_le_two_mul_eventually n h
replace h : n < 521 := h.trans_lt (by norm_num1)
revert h
open Lean Elab Tactic in
run_tac do
for i in [317, 163, 8... | theorem | NumberTheory | [
"Mathlib.Data.Nat.Choose.Factorization",
"Mathlib.NumberTheory.Primorial",
"Mathlib.Analysis.Convex.SpecificFunctions.Basic",
"Mathlib.Analysis.Convex.SpecificFunctions.Deriv",
"Mathlib.Tactic.NormNum.Prime"
] | Mathlib/NumberTheory/Bertrand.lean | exists_prime_lt_and_le_two_mul | **Bertrand's Postulate**: For any positive natural number, there is a prime which is greater than
it, but no more than twice as large. |
IsPoly : ((α → ℕ) → ℤ) → Prop
| proj : ∀ i, IsPoly fun x : α → ℕ => x i
| const : ∀ n : ℤ, IsPoly fun _ : α → ℕ => n
| sub : ∀ {f g : (α → ℕ) → ℤ}, IsPoly f → IsPoly g → IsPoly fun x => f x - g x
| mul : ∀ {f g : (α → ℕ) → ℤ}, IsPoly f → IsPoly g → IsPoly fun x => f x * g x | inductive | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | IsPoly | A predicate asserting that a function is a multivariate integer polynomial.
(We are being a bit lazy here by allowing many representations for multiplication,
rather than only allowing monomials and addition, but the definition is equivalent
and this is easier to use.) |
IsPoly.neg {f : (α → ℕ) → ℤ} : IsPoly f → IsPoly (-f) := by
rw [← zero_sub]; exact (IsPoly.const 0).sub | theorem | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | IsPoly.neg | null |
IsPoly.add {f g : (α → ℕ) → ℤ} (hf : IsPoly f) (hg : IsPoly g) : IsPoly (f + g) := by
rw [← sub_neg_eq_add]; exact hf.sub hg.neg | theorem | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | IsPoly.add | null |
Poly (α : Type u) := { f : (α → ℕ) → ℤ // IsPoly f } | def | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | Poly | The type of multivariate integer polynomials |
instFunLike : FunLike (Poly α) (α → ℕ) ℤ :=
⟨Subtype.val, Subtype.val_injective⟩ | instance | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | instFunLike | null |
protected isPoly (f : Poly α) : IsPoly f := f.2 | theorem | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | isPoly | The underlying function of a `Poly` is a polynomial |
@[ext]
ext {f g : Poly α} : (∀ x, f x = g x) → f = g := DFunLike.ext _ _ | theorem | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | ext | Extensionality for `Poly α` |
proj (i : α) : Poly α := ⟨_, IsPoly.proj i⟩
@[simp] | def | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | proj | The `i`th projection function, `x_i`. |
proj_apply (i : α) (x) : proj i x = x i := rfl | theorem | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | proj_apply | null |
const (n : ℤ) : Poly α := ⟨_, IsPoly.const n⟩
@[simp] | def | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | const | The constant function with value `n : ℤ`. |
const_apply (n) (x : α → ℕ) : const n x = n := rfl | theorem | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | const_apply | null |
@[simp]
coe_zero : ⇑(0 : Poly α) = const 0 := rfl
@[simp] | theorem | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | coe_zero | null |
coe_one : ⇑(1 : Poly α) = const 1 := rfl
@[simp] | theorem | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | coe_one | null |
coe_neg (f : Poly α) : ⇑(-f) = -f := rfl
@[simp] | theorem | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | coe_neg | null |
coe_add (f g : Poly α) : ⇑(f + g) = f + g := rfl
@[simp] | theorem | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | coe_add | null |
coe_sub (f g : Poly α) : ⇑(f - g) = f - g := rfl
@[simp] | theorem | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | coe_sub | null |
coe_mul (f g : Poly α) : ⇑(f * g) = f * g := rfl
@[simp] | theorem | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | coe_mul | null |
zero_apply (x) : (0 : Poly α) x = 0 := rfl
@[simp] | theorem | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | zero_apply | null |
one_apply (x) : (1 : Poly α) x = 1 := rfl
@[simp] | theorem | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | one_apply | null |
neg_apply (f : Poly α) (x) : (-f) x = -f x := rfl
@[simp] | theorem | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | neg_apply | null |
add_apply (f g : Poly α) (x : α → ℕ) : (f + g) x = f x + g x := rfl
@[simp] | theorem | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | add_apply | null |
sub_apply (f g : Poly α) (x : α → ℕ) : (f - g) x = f x - g x := rfl
@[simp] | theorem | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | sub_apply | null |
mul_apply (f g : Poly α) (x : α → ℕ) : (f * g) x = f x * g x := rfl | theorem | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | mul_apply | null |
induction {C : Poly α → Prop} (H1 : ∀ i, C (proj i)) (H2 : ∀ n, C (const n))
(H3 : ∀ f g, C f → C g → C (f - g)) (H4 : ∀ f g, C f → C g → C (f * g)) (f : Poly α) : C f := by
obtain ⟨f, pf⟩ := f
induction pf with
| proj => apply H1
| const => apply H2
| sub _ _ ihf ihg => apply H3 _ _ ihf ihg
| mul _ _ i... | theorem | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | induction | null |
sumsq : List (Poly α) → Poly α
| [] => 0
| p::ps => p * p + sumsq ps | def | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | sumsq | The sum of squares of a list of polynomials. This is relevant for
Diophantine equations, because it means that a list of equations
can be encoded as a single equation: `x = 0 ∧ y = 0 ∧ z = 0` is
equivalent to `x^2 + y^2 + z^2 = 0`. |
sumsq_nonneg (x : α → ℕ) : ∀ l, 0 ≤ sumsq l x
| [] => le_refl 0
| p::ps => by
rw [sumsq]
exact add_nonneg (mul_self_nonneg _) (sumsq_nonneg _ ps) | theorem | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | sumsq_nonneg | null |
sumsq_eq_zero (x) : ∀ l, sumsq l x = 0 ↔ l.Forall fun a : Poly α => a x = 0
| [] => eq_self_iff_true _
| p::ps => by
rw [List.forall_cons, ← sumsq_eq_zero _ ps]; rw [sumsq]
exact
⟨fun h : p x * p x + sumsq ps x = 0 =>
have : p x = 0 :=
eq_zero_of_mul_self_eq_zero <|
le_an... | theorem | NumberTheory | [
"Mathlib.Data.Fin.Fin2",
"Mathlib.Data.PFun",
"Mathlib.Data.Vector3",
"Mathlib.NumberTheory.PellMatiyasevic"
] | Mathlib/NumberTheory/Dioph.lean | sumsq_eq_zero | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.