FormalConjecturesForMathlib/Combinatorics/SimpleGraph/HomDensity.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

3 declarations, 0 contain sorry, 0 declared as axioms

Homomorphism density for finite simple graphs

Mathlib does not (as of 2026-04) provide SimpleGraph.homDensity. We define a lightweight version here, specialised to finite vertex types on the host G, and prove the basic homDensity H G ≤ 1 upper bound used as a sanity check in Sidorenko-style arguments.

The extension to infinite hosts uses the same formula with Fintype.card replaced by measure-theoretic integrals; we do not need that generality here.

Imports (2)
Imported by 1 file
  1. def SimpleGraph.homCount The number of graph homomorphisms H → G, as a natural number line 41 source

    Source documentation

    The number of graph homomorphisms H → G, as a natural number. For finite vertex types this is just the cardinality of the Hom type.

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

    Statement uses: Fintype, DecidableEq, SimpleGraph, DecidableRel, SimpleGraph.Adj, Nat

    Proof uses: Fintype.card, SimpleGraph.Hom

    1 instances, coercions and auxiliary constants left out.

    noncomputable def homCount [Fintype V] [Fintype W] [DecidableEq V] [DecidableEq W]
        (H : SimpleGraph V) (G : SimpleGraph W) [DecidableRel H.Adj] [DecidableRel G.Adj] : ℕ :=
    …
  2. def SimpleGraph.homDensity The homomorphism density t(H, G) of a simple graph H in a simple graph G with finite vertex sets is #Hom(H, G) / |V(G)|^{|V(H)|} line 47 source

    Source documentation

    The homomorphism density t(H, G) of a simple graph H in a simple graph G with finite vertex sets is #Hom(H, G) / |V(G)|^{|V(H)|}.

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

    Statement uses: Fintype, DecidableEq, SimpleGraph, DecidableRel, SimpleGraph.Adj, Real

    Proof uses: HDiv.hDiv, SimpleGraph.homCount, HPow.hPow, Nat, Fintype.card

    9 instances, coercions and auxiliary constants left out.

    noncomputable def homDensity [Fintype V] [Fintype W] [DecidableEq V] [DecidableEq W]
        (H : SimpleGraph V) (G : SimpleGraph W) [DecidableRel H.Adj] [DecidableRel G.Adj] : ℝ :=
    …
  3. lemma SimpleGraph.homDensity_le_one The homomorphism density t(H, G) is at most 1 line 55 source

    Source documentation

    The homomorphism density t(H, G) is at most 1.

    Proof outline: the underlying function of a H →g G-homomorphism is an element of V → W, which has |W|^|V| elements, so homCount H G ≤ |W|^|V|. Divide.

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

    Statement uses: Fintype, Nonempty, DecidableEq, SimpleGraph, DecidableRel, SimpleGraph.Adj, LE.le, Real, SimpleGraph.homDensity, OfNat.ofNat

    Proof uses: LT.lt, Nat, Fintype.card, Fintype.card_pos, SimpleGraph.Hom, Fintype.card_le_of_injective, DFunLike.coe_injective, Eq, HPow.hPow, Fintype.card_fun, SimpleGraph.homCount, id, Eq.rec, Iff.mpr, Nat.cast_le, Eq.mpr, Eq.mp, congrArg, Nat.cast_pow, pow_pos and 9 more

    72 instances, coercions and auxiliary constants left out.

    Tactic trace: 13 steps

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

    lemma homDensity_le_one {V W : Type*} [Fintype V] [Fintype W] [Nonempty W]
        [DecidableEq V] [DecidableEq W]
        (H : SimpleGraph V) (G : SimpleGraph W)
        [DecidableRel H.Adj] [DecidableRel G.Adj] :
        homDensity H G ≤ 1 := by
    …

    Mentions: SimpleGraph.homDensity