cfahlgren1/math / lean /ComparatorChallenges /MatchingEntropy.lean
cfahlgren1's picture
download
raw
2.11 kB
import Mathlib
namespace OAI
noncomputable section
open scoped BigOperators
namespace MatchingEntropy
/-- Nonnegative real weights with total mass one. -/
def probabilitySimplex (Index : Type*) [Fintype Index] : Set (Index → ℝ) :=
{weights | (∀ index, 0 ≤ weights index) ∧ ∑ index, weights index = 1}
structure LooplessGraph (V E : Type*) where
left : E → V
right : E → V
loopless : ∀ e, left e ≠ right e
variable {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E]
namespace LooplessGraph
def Incident (G : LooplessGraph V E) (v : V) (e : E) : Prop :=
G.left e = v ∨ G.right e = v
def IsPerfectMatching (G : LooplessGraph V E) (M : Finset E) : Prop :=
∀ v, ∃! e, e ∈ M ∧ G.Incident v e
abbrev Matching (G : LooplessGraph V E) := {M : Finset E // G.IsPerfectMatching M}
instance matchingFintype (G : LooplessGraph V E) : Fintype G.Matching :=
Fintype.ofFinite _
def indicator (G : LooplessGraph V E) (M : G.Matching) (e : E) : ℝ :=
if e ∈ M.val then 1 else 0
def polytope (G : LooplessGraph V E) : Set (E → ℝ) :=
convexHull ℝ (Set.range G.indicator)
def mean (G : LooplessGraph V E) (p : G.Matching → ℝ) (e : E) : ℝ :=
∑ M, p M * G.indicator M e
def feasibleLaws (G : LooplessGraph V E) (y : E → ℝ) : Set (G.Matching → ℝ) :=
{p | p ∈ probabilitySimplex G.Matching ∧ G.mean p = y}
end LooplessGraph
def entropy {ι : Type*} [Fintype ι] (p : ι → ℝ) : ℝ :=
∑ i, Real.negMulLog (p i)
def marginalEntropy (y : E → ℝ) : ℝ := entropy y
def maxMatchingEntropy (G : LooplessGraph V E) (y : E → ℝ) : ℝ :=
sSup (entropy '' G.feasibleLaws y)
/-- Main entropy comparison, for every marginal in the actual matching polytope. -/
theorem entropy_main (G : LooplessGraph V E) (m : ℕ)
(hm : 0 < m) (hV : Fintype.card V = 2 * m)
(hPM : Nonempty G.Matching) (y : E → ℝ) (hy : y ∈ G.polytope) :
marginalEntropy y - maxMatchingEntropy G y ≤
8 * (m : ℝ) * (1 - Real.exp (-marginalEntropy y / (m : ℝ))) := by
sorry
end MatchingEntropy
end
end OAI

Xet Storage Details

Size:
2.11 kB
·
Xet hash:
47fdace9c52b76a883c00fe787e7983c507823660a9cbdf3f4313660a4a520cd

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.