@@ -13,7 +13,7 @@ import Mathlib.Data.Sym.Card
1313This file defines the distribution of binomial random graphs.
1414-/
1515
16- open MeasureTheory Measure ProbabilityTheory unitInterval
16+ open MeasureTheory Measure ProbabilityTheory unitInterval Sym2
1717open scoped Finset
1818
1919namespace SimpleGraph
@@ -73,29 +73,32 @@ vertices `V`. This is the law `G(V, p)` of binomial random graphs with probabili
7373variable (V p) in
7474/-- The binomial distribution with parameter `p` on simple graphs with vertices `V`. -/
7575@[expose]
76- noncomputable def binomialRandom : Measure (SimpleGraph V) := Ber({e | ¬ e.IsDiag} , p).comap edgeSet
76+ noncomputable def binomialRandom : Measure (SimpleGraph V) := Ber(diagSetᶜ , p).comap edgeSet
7777
7878@[inherit_doc] scoped notation "G(" V ", " p ")" => binomialRandom V p
7979
8080section Countable
8181variable [Countable V]
8282
8383variable (V p) in
84- lemma binomialRandom_eq_map : G(V, p) = map fromEdgeSet Ber({e | ¬ e.IsDiag} , p) := by
84+ lemma binomialRandom_eq_map : G(V, p) = map fromEdgeSet Ber(diagSetᶜ , p) := by
8585 refine (map_eq_comap measurable_fromEdgeSet measurableEmbedding_edgeSet ?_
8686 fromEdgeSet_edgeSet).symm
8787 filter_upwards [bernoulliOn_ae_subset] with S hS
88- exact ⟨fromEdgeSet S, by simpa [← Set.compl_setOf, Set.subset_compl_iff_disjoint_right] using hS⟩
88+ refine ⟨fromEdgeSet S, ?_⟩
89+ simpa [Sym2.diagSet_eq_setOf_isDiag, ← Set.compl_setOf, Set.subset_compl_iff_disjoint_right]
90+ using hS
8991
90- lemma isBernoulliOn_edgeSet_binomialRandom : IsBernoulliOn edgeSet {e | ¬ e.IsDiag} p G(V, p) where
92+ lemma isBernoulliOn_edgeSet_binomialRandom : IsBernoulliOn edgeSet diagSetᶜ p G(V, p) where
9193 map_eq := by
92- rw [binomialRandom_eq_map, map_map (by fun_prop) (by fun_prop), map_congr, map_id]
94+ rw [binomialRandom_eq_map, map_map (by fun_prop) (by fun_prop), Measure.map_congr,
95+ Measure.map_id]
9396 filter_upwards [bernoulliOn_ae_subset] with S hS
94- simpa [← Set.subset_compl_iff_disjoint_right]
97+ simpa [Set.subset_compl_iff_disjoint_right] using hS
9598
9699variable (p) in
97100lemma binomialRandom_apply' (S : Set (SimpleGraph V)) :
98- G(V, p) S = Ber({e : Sym2 V | ¬ e.IsDiag} , p) (edgeSet '' S) := by
101+ G(V, p) S = Ber(diagSetᶜ , p) (edgeSet '' S) := by
99102 rw [binomialRandom, measurableEmbedding_edgeSet.comap_apply]
100103
101104variable (p) in
@@ -109,7 +112,8 @@ instance : IsProbabilityMeasure G(V, p) := by
109112 refine measurableEmbedding_edgeSet.isProbabilityMeasure_comap ?_
110113 filter_upwards [bernoulliOn_ae_subset] with s hs
111114 refine ⟨.fromEdgeSet s, ?_⟩
112- simpa [← Set.disjoint_compl_right_iff_subset, ← Set.compl_setOf] using hs
115+ simpa [Sym2.diagSet_eq_setOf_isDiag, ← Set.disjoint_compl_right_iff_subset, ← Set.compl_setOf]
116+ using hs
113117
114118variable (V) in
115119@[simp] lemma binomialRandom_zero : G(V, 0 ) = dirac ⊥ := by simp [binomialRandom_eq_map]
@@ -127,11 +131,11 @@ variable (p) in
127131 cases nonempty_fintype V
128132 simp only [binomialRandom, measurableEmbedding_edgeSet.comap_apply, Set.image_singleton,
129133 edgeSet_subset_setOf_not_isDiag, bernoulliOn_singleton]
130- rw [Set.ncard_diff (by exact fun _ ↦ not_isDiag_of_mem_edgeSet _)]
134+ rw [Set.ncard_diff (edgeSet_subset_setOf_not_isDiag _)]
131135 congr!
132136 rw [Nat.card_eq_fintype_card, ← Sym2.card_subtype_not_diag, Fintype.card_eq_nat_card,
133137 ← Nat.card_coe_set_eq]
134- rfl
138+ simp [diagSet_compl_eq_setOf_not_isDiag]
135139
136140/-! ### Binomial random graphs -/
137141
@@ -162,7 +166,7 @@ lemma IsBinomialRandom.inf (hG : IsBinomialRandom G p P) (hY : IsBinomialRandom
162166variable [Countable V]
163167
164168lemma IsBinomialRandom.isBernoulliOn_edgeSet (hG : IsBinomialRandom G p P) :
165- IsBernoulliOn (fun ω ↦ (G ω).edgeSet) {e | ¬ e.IsDiag} p P :=
169+ IsBernoulliOn (fun ω ↦ (G ω).edgeSet) diagSetᶜ p P :=
166170 isBernoulliOn_edgeSet_binomialRandom.comp hG
167171
168172lemma IsBinomialRandom.sup (hG : IsBinomialRandom G p P) (hY : IsBinomialRandom H q P) :
0 commit comments