File size: 2,527 Bytes
4a56cd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | import Mathlib.Data.Fintype.Powerset
import Mathlib.Basic.Real.Basic
import Mathlib.Algebra.BigOperators.Ring.Finset
import Mathlib.Combinatorics.SimpleGraph.Copy
import Mathlib.Analysis.SpecialFunctions.Log.Basic
namespace OAI
noncomputable section
universe u
namespace LeanBlast.SecondKahnKalai
def bernoulliWeight {X : Type u} [Fintype X] [DecidableEq X]
(p : β) (W : Finset X) : β :=
β x, if x β W then p else 1 - p
def bernoulliExpectation {X : Type u} [Fintype X] [DecidableEq X]
(p : β) (f : Finset X β β) : β :=
β W, bernoulliWeight p W * f W
def bernoulliProbability {X : Type u} [Fintype X] [DecidableEq X]
(p : β) (P : Finset X β Prop) : β := by
classical
exact β W, if P W then bernoulliWeight p W else 0
/-- The unordered non-loop edges of the complete graph on `n` vertices. -/
abbrev Edge (n : β) := {e : Sym2 (Fin n) // Β¬e.IsDiag}
/-- A set of edges, interpreted as an ordinary graph on all `n` vertices. -/
def graphOfEdges {n : β} (W : Finset (Edge n)) : SimpleGraph (Fin n) :=
SimpleGraph.fromEdgeSet (Subtype.val '' (W : Set (Edge n)))
/-- The number of unordered edges, each counted once. -/
def edgeCount {V : Type u} (H : SimpleGraph V) : β := Nat.card H.edgeSet
/-- Expected number of actual unlabelled non-induced copies in `G(n,p)`. -/
def expectedCopies {V : Type u} (n : β) (p : β) (H : SimpleGraph V) : β :=
bernoulliExpectation p (fun W : Finset (Edge n) =>
((graphOfEdges W).copyCount H : β))
/-- Probability that `G(n,p)` contains at least one non-induced copy. -/
def containmentProbability {V : Type u} (n : β) (p : β)
(H : SimpleGraph V) : β :=
bernoulliProbability p (fun W : Finset (Edge n) =>
0 < (graphOfEdges W).copyCount H)
def criticalThreshold {V : Type u} (n : β) (H : SimpleGraph V) : β :=
sInf {p : β | p β Set.Icc 0 1 β§ (1 / 2 : β) β€ containmentProbability n p H}
def expectationThreshold {V : Type u} (n : β) (H : SimpleGraph V) : β :=
sInf {p : β | p β Set.Icc 0 1 β§
β F : H.Subgraph, (1 / 2 : β) β€ expectedCopies n p F.coe}
def logTwo (x : β) : β := Real.log x / Real.log 2
def SecondKahnKalaiBounds {V : Type u} (n : β) (H : SimpleGraph V) : Prop :=
criticalThreshold n H β€
min 1 (2048 * Real.exp 50 * expectationThreshold n H *
(1 + logTwo (edgeCount H : β))) β§
criticalThreshold n H β€
6144 * Real.exp 50 * expectationThreshold n H * logTwo (n : β)
end LeanBlast.SecondKahnKalai
end
end OAI
|