FormalConjecturesForMathlib/Data/Set/Density.lean
Explanation legend Lean4 Domain Explanation Language (L4DEL)
L4DEL explanations are a separate layer. They do not change the Lean source. Intuition is explanatory prose; numbered items are a reading path; sources link the wording back to evidence.
- L4DEL
- Lean4 Domain Explanation Language
Credit: The upstream authors and contributors retain credit for the project and mathematics. lean4-explainer only renders their pinned source and adds the separately disclosed explanation layer.
Project sources: Pinned project documentation, Formal Conjectures paper, arXiv v1
21 declarations, 0 contain sorry, 0 declared as axioms
Logarithmic Density
Imports (7)
- Mathlib.Analysis.SpecialFunctions.Log.Basic
- FormalConjecturesForMathlib.Algebra.Order.Group.Pointwise.Interval
- FormalConjecturesForMathlib.Data.Set.Interval
- FormalConjecturesForMathlib.Order.Interval.Finset.Basic
- FormalConjecturesForMathlib.Order.Interval.Finset.Nat
- Batteries.Util.ProofWanted
- Mathlib.Tactic
Imported by 1 file
- abbrev
Set.partialDensityDocumented declaration: partialDensity line 42 sourceSource documentation
Given a set
Sand an elementbin an orderβ, where all intervals bounded above are finite, we define the partial density ofS(relative to a setA) to be the proportion of elements in{x ∈ A | x < b}that lie inS ∩ A.This definition was inspired from https://github.com/b-mehta/unit-fractions
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Preorder,LocallyFiniteOrderBot,Set,optParam,Set.univ,RealProof uses:
HDiv.hDiv,Set.ncard,Inter.inter,Set.Iio6 instances, coercions and auxiliary constants left out.
noncomputable abbrev partialDensity {β : Type*} [Preorder β] [LocallyFiniteOrderBot β] (S : Set β) (A : Set β := Set.univ) (b : β) : ℝ := … - theorem
Set.partialDensity_le_oneline 46 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Preorder,LocallyFiniteOrderBot,Set,optParam,Set.univ,LE.le,Real, Set.partialDensity,OfNat.ofNatProof uses:
div_le_one_of_le₀,Set.ncard,Inter.inter,Set.Iio,cast,Nat,Eq.symm,Set.ncard_le_ncard,Set.inter_subset_inter_left,Set.inter_subset_right,Set.toFinite,Nat.cast_nonneg42 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
- def
Set.upperDensityDocumented declaration: upperDensity line 56 sourceSource documentation
Given a set
Sin an orderβ, where all intervals bounded above are finite, we define the upper density ofS(relative to a setA) to be the limsup of the partial densities ofS(relative toA) forb → ∞.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Preorder,LocallyFiniteOrderBot,Set,optParam,Set.univ,RealProof uses:
Filter.limsup, Set.partialDensity,Filter.atTop2 instances, coercions and auxiliary constants left out.
noncomputable def upperDensity {β : Type*} [Preorder β] [LocallyFiniteOrderBot β] (S : Set β) (A : Set β := Set.univ) : ℝ := … - def
Set.lowerDensityDocumented declaration: lowerDensity line 65 sourceSource documentation
Given a set
Sin an orderβ, where all intervals bounded above are finite, we define the lower density ofS(relative to a setA) to be the liminf of the partial densities ofS(relative toA) forb → ∞.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Preorder,LocallyFiniteOrderBot,Set,optParam,Set.univ,RealProof uses:
Filter.liminf, Set.partialDensity,Filter.atTop2 instances, coercions and auxiliary constants left out.
noncomputable def lowerDensity {β : Type*} [Preorder β] [LocallyFiniteOrderBot β] (S : Set β) (A : Set β := Set.univ) : ℝ := … - theorem
Set.lowerDensity_le_oneline 69 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Preorder,LocallyFiniteOrderBot,Set,optParam,Set.univ,LE.le,Real, Set.lowerDensity,OfNat.ofNatProof uses:
dite,Eq,Filter,Filter.atTop,Bot.bot,Classical.propDecidable,of_eq_true,Eq.trans,True,congrFun',congrArg,Filter.liminf, Set.partialDensity,SupSet.sSup,Set.ofPred,Filter.Eventually,EmptyCollection.emptyCollection,funext,csSup_of_not_bddAbove,Notand 15 more39 instances, coercions and auxiliary constants left out.
Tactic trace: 7 steps
Open to load the checked before-and-after goal states.
- theorem
Set.lowerDensity_nonnegline 77 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Preorder,LocallyFiniteOrderBot,Set,optParam,Set.univ,LE.le,Real,OfNat.ofNat, Set.lowerDensityProof uses:
Eq.mpr,Filter.liminf, Set.partialDensity,Filter.atTop,id,Eq,congrArg,Set.lowerDensity.eq_1,SupSet.sSup,Set.ofPred,Filter.Eventually,Filter.liminf_eq,Or.elim,BddAbove,Not,em,le_csSup,Filter.Eventually.of_forall,div_nonneg,Set.ncardand 5 more43 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- def
Set.HasDensityDocumented declaration: HasDensity line 91 sourceSource documentation
A set
Sin an orderβwhere all intervals bounded above are finite is said to have densityα : ℝ(relative to a setA) if the proportion ofx ∈ Ssuch thatx < ninAtends toαasn → ∞.When
β = ℕthis by default defines the natural density of a set (i.e., relative to all ofℕ).standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Preorder,LocallyFiniteOrderBot,Set,Real,optParam,Set.univProof uses:
Filter.Tendsto, Set.partialDensity,Filter.atTop,nhds3 instances, coercions and auxiliary constants left out.
def HasDensity {β : Type*} [Preorder β] [LocallyFiniteOrderBot β] (S : Set β) (α : ℝ) (A : Set β := Set.univ) : Prop := … - def
Set.HasPosDensityDocumented declaration: HasPosDensity line 100 sourceSource documentation
A set
Sin an orderβwhere all intervals bounded above are finite is said to have positive density (relative to a setA) if there exists a positiveα : ℝsuch thatShas densityα(relative to a setA).standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Preorder,LocallyFiniteOrderBot,Set,optParam,Set.univProof uses:
Exists,Real,And,GT.gt,OfNat.ofNat, Set.HasDensity3 instances, coercions and auxiliary constants left out.
def HasPosDensity {β : Type*} [Preorder β] [LocallyFiniteOrderBot β] (S : Set β) (A : Set β := Set.univ) : Prop := … - def
Set.intPartialDensityThe two-sided partial natural density of a set of integers, counted inside the interval[-N, N]line 108 sourceSource documentation
The two-sided partial natural density of a set of integers, counted inside the interval
[-N, N].standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Set,Int,Nat,RealProof uses:
HDiv.hDiv,Finset.card,Finset.filter,Membership.mem,Classical.propDecidable,Finset.Icc,Neg.neg,HAdd.hAdd,HMul.hMul,OfNat.ofNat23 instances, coercions and auxiliary constants left out.
noncomputable def intPartialDensity (S : Set ℤ) (N : ℕ) : ℝ := …
- def
Set.HasIntDensityA set of integers has two-sided natural densityαline 114 sourceSource documentation
A set of integers has two-sided natural density
α.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Set,Int,RealProof uses:
Filter.Tendsto,Nat, Set.intPartialDensity,Filter.atTop,nhds4 instances, coercions and auxiliary constants left out.
def HasIntDensity (S : Set ℤ) (α : ℝ) : Prop := …
- theorem
Set.intPartialDensity_emptyline 118 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq,Real, Set.intPartialDensity,EmptyCollection.emptyCollection,Set,Int,OfNat.ofNatProof uses:
of_eq_true,Eq.trans,True,congrFun',congrArg,HDiv.hDiv,Finset.card,Finset.filter,Membership.mem,Classical.propDecidable,Finset.Icc,Neg.neg,HAdd.hAdd,HMul.hMul,Finset,False,Finset.filter_congr,Iff.of_eq,Finset.filter_false,CharP.cast_eq_zeroand 2 more57 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
- theorem
Set.HasIntDensity.emptyline 124 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Set.HasIntDensity,
EmptyCollection.emptyCollection,Set,Int,OfNat.ofNat,RealProof uses:
of_eq_true,Filter.Tendsto,Nat, Set.intPartialDensity,Filter.atTop,nhds,Eq.trans,Eq,True,congrFun',Filter,congrArg,funext, Set.intPartialDensity_empty,eq_self24 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
- theorem
Set.HasDensity.univIn a non-trivial partial order with a least element, the set of all elements has density one line 136 sourceSource documentation
In a non-trivial partial order with a least element, the set of all elements has density one.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
PartialOrder,LocallyFiniteOrder,OrderBot,Nontrivial, Set.HasDensity,Set.univ,OfNat.ofNat,RealProof uses:
dite,Eq,Filter,Filter.atTop,Bot.bot,Classical.propDecidable,of_eq_true,Filter.Tendsto, Set.partialDensity,nhds,Eq.trans,True,congrFun',congrArg,Not,Eq.mpr,HDiv.hDiv,Set.ncard,Set.Iio,idand 20 more52 instances, coercions and auxiliary constants left out.
Tactic trace: 8 steps
Open to load the checked before-and-after goal states.
theorem univ {β : Type*} [PartialOrder β] [LocallyFiniteOrder β] [OrderBot β] [Nontrivial β] : (@Set.univ β).HasDensity 1 := by …Mentions: Set.HasDensity
- theorem
Set.HasDensity.univ_nat_hasDensity_oneline 145 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Set.HasDensity,
Nat,Set.univ,OfNat.ofNat,RealProof uses: Set.HasDensity.univ
10 instances, coercions and auxiliary constants left out.
- theorem
Set.HasDensity.emptyline 148 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Preorder,LocallyFiniteOrderBot,optParam,Set,Set.univ, Set.HasDensity,EmptyCollection.emptyCollection,OfNat.ofNat,RealProof uses:
Eq.mpr,Filter.Tendsto,Filter.atTop,nhds,id,Eq,congrFun',Filter, Set.partialDensity,congrArg,funext,HDiv.hDiv,Set.ncard,Inter.inter,Set.Iio,Eq.trans,Nat,Set.empty_inter,Set.ncard_empty,CharP.cast_eq_zeroand 2 more38 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
- theorem
Set.HasDensity.monoline 152 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
PartialOrder,LocallyFiniteOrder,OrderBot,Set,Real,Filter.NeBot,Filter.atTop,LE.le, Set.HasDensity,Set.univProof uses:
le_of_tendsto_of_tendsto, Set.partialDensity,Eq.mp,Filter.Tendsto,nhds,congrArg,Set.HasDensity.eq_1,Filter.mp_mem,Set.ofPred,Bot.bot,Filter.eventually_ge_atTop,Filter.univ_mem',Membership.mem,id,div_le_div_of_nonneg_right,Set.ncard,Inter.inter,Set.Iio,le_imp_le_of_le_of_le,Nat.mono_castand 5 more49 instances, coercions and auxiliary constants left out.
Tactic trace: 6 steps
Open to load the checked before-and-after goal states.
- theorem
Set.HasDensity.nonnegline 162 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Preorder,LocallyFiniteOrderBot,Filter.NeBot,Filter.atTop,Set,Real, Set.HasDensity,Set.univ,LE.le,OfNat.ofNatProof uses:
le_of_tendsto_of_tendsto', Set.partialDensity,EmptyCollection.emptyCollection, Set.HasDensity.empty,of_eq_true,Eq.trans,HDiv.hDiv,Set.ncard,Inter.inter,Set.Iio,True,congr,congrArg,Nat,congrFun',Set.inter_univ,Set.empty_inter,Set.ncard_empty,CharP.cast_eq_zero,Set.univ_interand 1 more60 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
- theorem
Nat.hasDensity_evenThe natural density of the set of even numbers is1 / 2line 175 sourceSource documentation
The natural density of the set of even numbers is
1 / 2.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Set.HasDensity,
Nat,Set.ofPred,Even,HDiv.hDiv,Real,OfNat.ofNat,Set.univProof uses:
Eq.mpr,Filter.Tendsto,Set.ncard,Inter.inter,Set,Set.Iio,Filter.atTop,nhds,Inv.inv,id,Eq,congr,Filter, Set.partialDensity,congrFun',congrArg,funext,Set.inter_univ,Eq.trans,Set.univ_interand 167 more213 instances, coercions and auxiliary constants left out.
Tactic trace: 19 steps
Open to load the checked before-and-after goal states.
theorem hasDensity_even : {n : ℕ | Even n}.HasDensity (1 / 2) := by … - theorem
Nat.hasDensity_zero_of_finiteA finite set has natural density zero line 196 sourceSource documentation
A finite set has natural density zero.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Set,Nat,Set.Finite, Set.HasDensity,OfNat.ofNat,Real,Set.univProof uses:
Eq.mpr,Filter.Tendsto,HDiv.hDiv,Set.ncard,Inter.inter,Set.Iio,Filter.atTop,nhds,id,Eq,congrFun',Filter, Set.partialDensity,congrArg,funext,congr,Set.inter_univ,Eq.trans,Set.univ_inter, Nat.ncard_Iio and 26 more125 instances, coercions and auxiliary constants left out.
Tactic trace: 9 steps
Open to load the checked before-and-after goal states.
theorem hasDensity_zero_of_finite {S : Set ℕ} (h : S.Finite) : S.HasDensity 0 := by … - theorem
Nat.infinite_of_hasDensity_posA set of positive natural density is infinite line 207 sourceSource documentation
A set of positive natural density is infinite.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Set,Nat,Real, Set.HasDensity,Set.univ,Ne,OfNat.ofNat,Set.InfiniteProof uses:
mt,Set.Finite, Nat.hasDensity_zero_of_finite,tendsto_nhds_unique, Set.partialDensity,Filter.atTop28 instances, coercions and auxiliary constants left out.
theorem infinite_of_hasDensity_pos {S : Set ℕ} {α : ℝ} (h : S.HasDensity α) (hα : α ≠ 0) : S.Infinite := … - def
Set.HasLogDensityA setAof natural numbers has logarithmic densitydif the sequence $(1 / \log n) \cdot \sum_{k \in A, k \le n} (1/k)$ converges todline 226 sourceSource documentation
A set
Aof natural numbers has logarithmic densitydif the sequence $(1 / \log n) \cdot \sum_{k \in A, k \le n} (1/k)$ converges tod. Logarithmic density is a weaker notion than natural density: if a set has natural densityd, then it also has logarithmic densityd(seeSet.HasDensity.hasLogDensity), but the converse is false.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Set,Nat,RealProof uses:
Filter.Tendsto,Finset.sum,Finset.filter,Membership.mem,Classical.propDecidable,Finset.Iic,HDiv.hDiv,Inv.inv,Real.log,Filter.atTop,nhds15 instances, coercions and auxiliary constants left out.
def Set.HasLogDensity (A : Set ℕ) (d : ℝ) : Prop := …