Documentation

Graphon.Sampling

Sampling Random Graphs from Graphons #

This file defines the finite distribution of the W-random graph G(k, W) and the expected edge density, WITHOUT introducing random variables: the probability mass of each graph is defined directly as an integral.

Main definitions #

Main results #

Implementation notes #

The sampling process for G(n, W) is:

  1. Sample n i.i.d. points x₁, ..., xₙ uniformly from [0,1]
  2. Connect vertices i and j (i < j) independently with probability W(xᵢ, xⱼ)

This is a two-level randomness: first the positions, then the edges.

The key result established here is that the expected edge density equals the integral of the graphon. Concentration is proved in Graphon/SamplingConcentration.lean / SamplingPointwise.lean / SamplingRounding.lean, culminating in the First Sampling Lemma (Graphon/SamplingLemma.lean); convergence in Graphon/Convergence.lean.

References #

Sampling definition #

noncomputable def Graphon.sampleGraphExpectedDensity {α : Type u_1} [MeasurableSpace α] {μ : MeasureTheory.Measure α} (W : Graphon α μ) :

The expected edge density of a graph sampled from a graphon.

For a graphon W, if we sample n points x₁,...,xₙ and connect i~j with probability W(xᵢ,xⱼ), the expected edge density is ∫∫ W(x,y) dμ(x) dμ(y).

Note: This is the expected density over both the position randomness and the edge randomness.

Equations
Instances For

    The expected edge density equals the double integral of the graphon.

    The sampled graph distribution #

    The distribution of the W-random graph G(k, W) on Fin k, given by explicit probability masses. Everything here is finite algebra plus integrals: no random variables, no concentration.

    theorem Graphon.ae_pairMap_of_prod {α : Type u_1} [MeasurableSpace α] {μ : MeasureTheory.Measure α} [MeasureTheory.IsProbabilityMeasure μ] {k : } (a b : Fin k) (hab : a b) {Φ : α × αProp} (h : ∀ᵐ (p : α × α) μ.prod μ, Φ p) :
    ∀ᵐ (x : Fin kα) MeasureTheory.Measure.pi fun (x : Fin k) => μ, Φ (x a, x b)

    A.e. transfer from the product measure to a pair of distinct sampled coordinates: if Φ holds μ.prod μ-a.e., it holds a.e. at (x a, x b) for i.i.d. samples x and a ≠ b. (Generalized from SamplingPointwise — needs only a probability measure, no standard-Borel or atomlessness hypotheses.)

    noncomputable def Graphon.sampleIntegrand {α : Type u_1} [MeasurableSpace α] {μ : MeasureTheory.Measure α} {k : } (W : Graphon α μ) (G : SimpleGraph (Fin k)) (x : Fin kα) :

    The integrand of the sampled-graph mass: edges of G contribute W, non-edges contribute 1 − W.

    Equations
    Instances For
      noncomputable def Graphon.sampleMass {α : Type u_1} [MeasurableSpace α] {μ : MeasureTheory.Measure α} {k : } (W : Graphon α μ) (G : SimpleGraph (Fin k)) :

      The sampled graph distribution: the probability that the W-random graph G(k, W) equals G. Sample k i.i.d. positions, then include each pair {i, j} as an edge independently with probability W(xᵢ, xⱼ); integrating out the positions gives this mass directly, with no random-variable formalism.

      Equations
      Instances For

        The sampled-graph integrand is integrable (as a finite signed sum of integrable hom-density integrands). Public: used by the concentration scaffold.

        Mass expansion: each sampled-graph mass is a finite signed sum of homomorphism densities of graphs on Fin k (inclusion–exclusion over the non-edges of G).

        theorem Graphon.ae_top_edges_mem_Icc {α : Type u_1} [MeasurableSpace α] {μ : MeasureTheory.Measure α} [MeasureTheory.IsProbabilityMeasure μ] {k : } (W : Graphon α μ) :
        ∀ᵐ (x : Fin kα) MeasureTheory.Measure.pi fun (x : Fin k) => μ, e.edgeFinset, W.toAEEqFun (x (Quot.out e).1, x (Quot.out e).2) Set.Icc 0 1

        All edge evaluations over lie in [0,1] almost everywhere (public: used by the concentration scaffold for a.e. nonnegativity of conditional masses).

        Sampled-graph masses are nonnegative.

        theorem Graphon.sum_sampleIntegrand_eq_one {α : Type u_1} [MeasurableSpace α] {μ : MeasureTheory.Measure α} {k : } (W : Graphon α μ) (x : Fin kα) :
        G : SimpleGraph (Fin k), W.sampleIntegrand G x = 1

        Pointwise: the sampled-graph integrands sum to 1 over all graphs on Fin k (public: this is the conditional-distribution normalization used by the concentration scaffold).

        The sampled-graph masses form a probability distribution: they sum to 1.

        The forward Möbius / supergraph-mass identity (issue #20) #

        homDensity F W = ∑_{G ⊇ F} sampleMass W G: the homomorphism density of F is exactly the probability that the sampled graph contains every edge of F. This is the forward companion of the inclusion–exclusion expansion sampleMass_eq_sum_homDensity above. Proof route (vetted 2026-07-10): at fixed vertex positions, supergraphs of F are in bijection with subsets of the optional edges ⊤.edgeFinset \ F.edgeFinset; summing the Bernoulli integrand over the Boolean cube via Finset.prod_add collapses each optional factor to w e + (1 - w e) = 1, leaving the plain edge product of F.

        The forward Möbius / supergraph-mass identity (filtered form): the total sample mass of the supergraphs of F is exactly the homomorphism density of F. Accepts an ambient [DecidableRel F.Adj] (bridged to the classical core by homDensity_congr_decRel).

        The forward Möbius / supergraph-mass identity (issue #20 orientation): t(F, W) = ∑_{G ⊇ F} sampleMass W G on a common labeled vertex set. Accepts an ambient [DecidableRel F.Adj].

        theorem Graphon.sampleMass_close_of_homDensity_close {α : Type u_1} [MeasurableSpace α] {μ : MeasureTheory.Measure α} [MeasureTheory.IsProbabilityMeasure μ] {k : } (U W : Graphon α μ) (δ : ) (h : ∀ (F : SimpleGraph (Fin k)) [inst : DecidableRel F.Adj], |homDensity F U - homDensity F W| δ) (G : SimpleGraph (Fin k)) :
        |U.sampleMass G - W.sampleMass G| 2 ^ (k * k) * δ

        Mass closeness from hom-density closeness: if all hom densities of graphs on Fin k agree within δ, each sampled-graph mass agrees within 2^(k·k) · δ.

        theorem Graphon.sampleDistribution_tv_close_of_homDensity_close {α : Type u_1} [MeasurableSpace α] {μ : MeasureTheory.Measure α} [MeasureTheory.IsProbabilityMeasure μ] {k : } (U W : Graphon α μ) (δ : ) (h : ∀ (F : SimpleGraph (Fin k)) [inst : DecidableRel F.Adj], |homDensity F U - homDensity F W| δ) :
        G : SimpleGraph (Fin k), |U.sampleMass G - W.sampleMass G| 2 ^ (k * k) * (2 ^ (k * k) * δ)

        Total-variation closeness from hom-density closeness — the deliverable bridge for the BCLSV sampling route: if all hom densities of graphs on Fin k agree within δ, the sampled graph distributions of U and W agree within 4^(k·k) · δ in (twice the) total variation distance.

        theorem Graphon.sum_sampleMass_event_sub_le {α : Type u_1} [MeasurableSpace α] {μ : MeasureTheory.Measure α} {k : } (U W : Graphon α μ) (A : Finset (SimpleGraph (Fin k))) (tv : ) (htv : G : SimpleGraph (Fin k), |U.sampleMass G - W.sampleMass G| tv) :
        GA, U.sampleMass G - GA, W.sampleMass G tv

        Event extraction from total variation: any event's probabilities under the two sampled distributions differ by at most the (summed) total variation distance.