FormalConjecturesForMathlib/Combinatorics/SimpleGraph/HomDensity.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
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.
Imported by 1 file
- def
SimpleGraph.homCountThe number of graph homomorphismsH → G, as a natural number line 41 sourceSource documentation
The number of graph homomorphisms
H → G, as a natural number. For finite vertex types this is just the cardinality of theHomtype.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Fintype,DecidableEq,SimpleGraph,DecidableRel,SimpleGraph.Adj,NatProof uses:
Fintype.card,SimpleGraph.Hom1 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] : ℕ := … - def
SimpleGraph.homDensityThe homomorphism densityt(H, G)of a simple graphHin a simple graphGwith finite vertex sets is#Hom(H, G) / |V(G)|^{|V(H)|}line 47 sourceSource documentation
The homomorphism density
t(H, G)of a simple graphHin a simple graphGwith 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,RealProof uses:
HDiv.hDiv, SimpleGraph.homCount,HPow.hPow,Nat,Fintype.card9 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] : ℝ := … - lemma
SimpleGraph.homDensity_le_oneThe homomorphism densityt(H, G)is at most1line 55 sourceSource documentation
The homomorphism density
t(H, G)is at most1.Proof outline: the underlying function of a
H →g G-homomorphism is an element ofV → W, which has|W|^|V|elements, sohomCount 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.ofNatProof 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_posand 9 more72 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