FormalConjecturesForMathlib/Data/Set/Density.lean

GitHub source file

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)
Imported by 1 file
  1. abbrev Set.partialDensity Documented declaration: partialDensity line 42 source

    Source documentation

    Given a set S and an element b in an order β, where all intervals bounded above are finite, we define the partial density of S (relative to a set A) to be the proportion of elements in {x ∈ A | x < b} that lie in S ∩ 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, Real

    Proof uses: HDiv.hDiv, Set.ncard, Inter.inter, Set.Iio

    6 instances, coercions and auxiliary constants left out.

    noncomputable abbrev partialDensity {β : Type*} [Preorder β] [LocallyFiniteOrderBot β]
        (S : Set β) (A : Set β := Set.univ) (b : β) : ℝ :=
    …
  2. theorem Set.partialDensity_le_one line 46 source

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Preorder, LocallyFiniteOrderBot, Set, optParam, Set.univ, LE.le, Real, Set.partialDensity, OfNat.ofNat

    Proof 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_nonneg

    42 instances, coercions and auxiliary constants left out.

    Tactic trace: 2 steps

    Open to load the checked before-and-after goal states.

  3. def Set.upperDensity Documented declaration: upperDensity line 56 source

    Source documentation

    Given a set S in an order β, where all intervals bounded above are finite, we define the upper density of S (relative to a set A) to be the limsup of the partial densities of S (relative to A) for b → ∞.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Preorder, LocallyFiniteOrderBot, Set, optParam, Set.univ, Real

    Proof uses: Filter.limsup, Set.partialDensity, Filter.atTop

    2 instances, coercions and auxiliary constants left out.

    noncomputable def upperDensity {β : Type*} [Preorder β] [LocallyFiniteOrderBot β]
        (S : Set β) (A : Set β := Set.univ) : ℝ :=
    …
  4. def Set.lowerDensity Documented declaration: lowerDensity line 65 source

    Source documentation

    Given a set S in an order β, where all intervals bounded above are finite, we define the lower density of S (relative to a set A) to be the liminf of the partial densities of S (relative to A) for b → ∞.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Preorder, LocallyFiniteOrderBot, Set, optParam, Set.univ, Real

    Proof uses: Filter.liminf, Set.partialDensity, Filter.atTop

    2 instances, coercions and auxiliary constants left out.

    noncomputable def lowerDensity {β : Type*} [Preorder β] [LocallyFiniteOrderBot β]
        (S : Set β) (A : Set β := Set.univ) : ℝ :=
    …
  5. theorem Set.lowerDensity_le_one line 69 source

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Preorder, LocallyFiniteOrderBot, Set, optParam, Set.univ, LE.le, Real, Set.lowerDensity, OfNat.ofNat

    Proof 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, Not and 15 more

    39 instances, coercions and auxiliary constants left out.

    Tactic trace: 7 steps

    Open to load the checked before-and-after goal states.

  6. theorem Set.lowerDensity_nonneg line 77 source

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Preorder, LocallyFiniteOrderBot, Set, optParam, Set.univ, LE.le, Real, OfNat.ofNat, Set.lowerDensity

    Proof 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.ncard and 5 more

    43 instances, coercions and auxiliary constants left out.

    Tactic trace: 3 steps

    Open to load the checked before-and-after goal states.

  7. def Set.HasDensity Documented declaration: HasDensity line 91 source

    Source documentation

    A set S in an order β where all intervals bounded above are finite is said to have density α : ℝ (relative to a set A) if the proportion of x ∈ S such that x < n in A tends to α as n → ∞.

    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.univ

    Proof uses: Filter.Tendsto, Set.partialDensity, Filter.atTop, nhds

    3 instances, coercions and auxiliary constants left out.

    def HasDensity {β : Type*} [Preorder β] [LocallyFiniteOrderBot β]
        (S : Set β) (α : ℝ) (A : Set β := Set.univ) : Prop :=
    …
  8. def Set.HasPosDensity Documented declaration: HasPosDensity line 100 source

    Source documentation

    A set S in an order β where all intervals bounded above are finite is said to have positive density (relative to a set A) if there exists a positive α : ℝ such that S has density α (relative to a set A).

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Preorder, LocallyFiniteOrderBot, Set, optParam, Set.univ

    Proof uses: Exists, Real, And, GT.gt, OfNat.ofNat, Set.HasDensity

    3 instances, coercions and auxiliary constants left out.

    def HasPosDensity {β : Type*} [Preorder β] [LocallyFiniteOrderBot β]
        (S : Set β) (A : Set β := Set.univ) : Prop :=
    …
  9. def Set.intPartialDensity The two-sided partial natural density of a set of integers, counted inside the interval [-N, N] line 108 source

    Source 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, Real

    Proof uses: HDiv.hDiv, Finset.card, Finset.filter, Membership.mem, Classical.propDecidable, Finset.Icc, Neg.neg, HAdd.hAdd, HMul.hMul, OfNat.ofNat

    23 instances, coercions and auxiliary constants left out.

    noncomputable def intPartialDensity (S : Set ℤ) (N : ℕ) : ℝ :=
    …
  10. def Set.HasIntDensity A set of integers has two-sided natural density α line 114 source

    Source documentation

    A set of integers has two-sided natural density α.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Set, Int, Real

    Proof uses: Filter.Tendsto, Nat, Set.intPartialDensity, Filter.atTop, nhds

    4 instances, coercions and auxiliary constants left out.

    def HasIntDensity (S : Set ℤ) (α : ℝ) : Prop :=
    …
  11. theorem Set.intPartialDensity_empty line 118 source

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, Eq, Real, Set.intPartialDensity, EmptyCollection.emptyCollection, Set, Int, OfNat.ofNat

    Proof 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_zero and 2 more

    57 instances, coercions and auxiliary constants left out.

    Tactic trace: 1 steps

    Open to load the checked before-and-after goal states.

  12. theorem Set.HasIntDensity.empty line 124 source

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Set.HasIntDensity, EmptyCollection.emptyCollection, Set, Int, OfNat.ofNat, Real

    Proof uses: of_eq_true, Filter.Tendsto, Nat, Set.intPartialDensity, Filter.atTop, nhds, Eq.trans, Eq, True, congrFun', Filter, congrArg, funext, Set.intPartialDensity_empty, eq_self

    24 instances, coercions and auxiliary constants left out.

    Tactic trace: 1 steps

    Open to load the checked before-and-after goal states.

  13. theorem Set.HasDensity.univ In a non-trivial partial order with a least element, the set of all elements has density one line 136 source

    Source 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, Real

    Proof 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, id and 20 more

    52 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

  14. theorem Set.HasDensity.univ_nat_hasDensity_one line 145 source

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Set.HasDensity, Nat, Set.univ, OfNat.ofNat, Real

    Proof uses: Set.HasDensity.univ

    10 instances, coercions and auxiliary constants left out.

  15. theorem Set.HasDensity.empty line 148 source

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Preorder, LocallyFiniteOrderBot, optParam, Set, Set.univ, Set.HasDensity, EmptyCollection.emptyCollection, OfNat.ofNat, Real

    Proof 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_zero and 2 more

    38 instances, coercions and auxiliary constants left out.

    Tactic trace: 1 steps

    Open to load the checked before-and-after goal states.

  16. theorem Set.HasDensity.mono line 152 source

    standard 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.univ

    Proof 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_cast and 5 more

    49 instances, coercions and auxiliary constants left out.

    Tactic trace: 6 steps

    Open to load the checked before-and-after goal states.

  17. theorem Set.HasDensity.nonneg line 162 source

    standard 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.ofNat

    Proof 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_inter and 1 more

    60 instances, coercions and auxiliary constants left out.

    Tactic trace: 1 steps

    Open to load the checked before-and-after goal states.

  18. theorem Nat.hasDensity_even The natural density of the set of even numbers is 1 / 2 line 175 source

    Source 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.univ

    Proof 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_inter and 167 more

    213 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
    …
  19. theorem Nat.hasDensity_zero_of_finite A finite set has natural density zero line 196 source

    Source 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.univ

    Proof 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 more

    125 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
    …
  20. theorem Nat.infinite_of_hasDensity_pos A set of positive natural density is infinite line 207 source

    Source 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.Infinite

    Proof uses: mt, Set.Finite, Nat.hasDensity_zero_of_finite, tendsto_nhds_unique, Set.partialDensity, Filter.atTop

    28 instances, coercions and auxiliary constants left out.

    theorem infinite_of_hasDensity_pos {S : Set ℕ} {α : ℝ} (h : S.HasDensity α) (hα : α ≠ 0) :
        S.Infinite :=
    …
  21. def Set.HasLogDensity A set A of natural numbers has logarithmic density d if the sequence $(1 / \log n) \cdot \sum_{k \in A, k \le n} (1/k)$ converges to d line 226 source

    Source documentation

    A set A of natural numbers has logarithmic density d if the sequence $(1 / \log n) \cdot \sum_{k \in A, k \le n} (1/k)$ converges to d. Logarithmic density is a weaker notion than natural density: if a set has natural density d, then it also has logarithmic density d (see Set.HasDensity.hasLogDensity), but the converse is false.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Set, Nat, Real

    Proof uses: Filter.Tendsto, Finset.sum, Finset.filter, Membership.mem, Classical.propDecidable, Finset.Iic, HDiv.hDiv, Inv.inv, Real.log, Filter.atTop, nhds

    15 instances, coercions and auxiliary constants left out.

    def Set.HasLogDensity (A : Set ℕ) (d : ℝ) : Prop :=
    …