Documentation

CslibFrontier.Logics.FirstOrder.ZeroOneLaw.RandomGraph

The uniform random graph G(n, 1/2) #

Cslib.Logic.FO.graph.randomGraph n is the uniform distribution on the labelled simple graphs with vertex set Fin n, the random graph G(n, 1/2) of the 0-1 law for first-order logic [Fag76] [Libkin2004, Section 12.1]. Cslib.Logic.FO.graph.randomGraphProb n P is the probability that it has the property P, that is, the fraction of the labelled graphs on Fin n with P.

Besides the basic API (complement, monotonicity, union bound), this file records a counting principle: a property exchanged with its negation by an involution of the graphs on Fin n has probability exactly 1/2. Toggling one potential edge is such an involution, so every potential edge is present with probability 1/2, and for n ≥ 2 the number of edges is even with probability exactly 1/2.

randomGraph n is Mathlib's binomial random graph G(Fin n, p) (SimpleGraph.binomialRandom) at p = 1/2: under both, every labelled graph on Fin n has the same probability (Cslib.Logic.FO.graph.binomialRandom_real_eq_randomGraphProb).

Main definitions #

Main results #

References #

noncomputable def Cslib.Logic.FO.graph.randomGraph (n : ℕ) :

The uniform random graph G(n, 1/2): the uniform distribution on the labelled simple graphs with vertex set Fin n [Libkin2004, Section 12.1].

noncomputable def Cslib.Logic.FO.graph.randomGraphProb (n : ℕ) (P : SimpleGraph (Fin n) → Prop) :

The probability that G(n, 1/2) has the property P.

The probability of P is the fraction of labelled graphs on Fin n with property P.

The probability of ¬ P is one minus the probability of P.

theorem Cslib.Logic.FO.graph.randomGraphProb_mono {n : ℕ} {P Q : SimpleGraph (Fin n) → Prop} (h : ∀ (G : SimpleGraph (Fin n)), P G → Q G) :
theorem Cslib.Logic.FO.graph.exists_of_randomGraphProb_pos {n : ℕ} {P : SimpleGraph (Fin n) → Prop} (h : 0 < randomGraphProb n P) :
∃ (G : SimpleGraph (Fin n)), P G

A property of positive probability holds for some graph.

theorem Cslib.Logic.FO.graph.randomGraphProb_exists_le {ι : Type u_1} (n : ℕ) (I : Finset ι) (P : ι → SimpleGraph (Fin n) → Prop) :
(randomGraphProb n fun (G : SimpleGraph (Fin n)) => ∃ i ∈ I, P i G) ≤ ∑ i ∈ I, randomGraphProb n (P i)

Union bound.

theorem Cslib.Logic.FO.graph.randomGraphProb_eq_half_of_involutive {n : ℕ} {P : SimpleGraph (Fin n) → Prop} (τ : SimpleGraph (Fin n) → SimpleGraph (Fin n)) (hτ : Function.Involutive τ) (hP : ∀ (G : SimpleGraph (Fin n)), P (τ G) ↔ ¬P G) :
randomGraphProb n P = 1 / 2

If an involution of the graphs on Fin n exchanges P and ¬ P, then P has probability exactly 1/2.

theorem Cslib.Logic.FO.graph.randomGraphProb_adj {n : ℕ} {u v : Fin n} (huv : u ≠ v) :
(randomGraphProb n fun (G : SimpleGraph (Fin n)) => G.Adj u v) = 1 / 2

In G(n, 1/2), each potential edge is present with probability 1/2.

For n ≥ 2, G(n, 1/2) has an even number of edges with probability exactly 1/2.

G(n, 1/2) is the uniform random graph #

G(n, 1/2) is the uniform random graph. At p = 1/2 every labelled graph on Fin n has the same probability 2 ^ (-n (n - 1) / 2), so the probability of a graph property in G(Fin n, p) is its probability randomGraphProb n P in Cslib.Logic.FO.graph.randomGraph.