File size: 4,064 Bytes
e5a97c6 | 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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | import OAI.Combinatorics.PerfectMatching.Model
import OAI.Combinatorics.PerfectMatching.Simplex
namespace OAI
/-!
Finite loopless multigraphs, perfect matching indicators, and their convex hull.
The edge type distinguishes parallel edges. Feasible laws are probability vectors
on perfect matchings with a prescribed mean.
-/
noncomputable section
open scoped BigOperators Topology
open Filter
namespace MatchingEntropy
variable {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E]
namespace LooplessGraph
instance incidentDecidable (G : LooplessGraph V E) (v : V) (e : E) :
Decidable (G.Incident v e) := inferInstanceAs (Decidable (G.left e = v ∨ G.right e = v))
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}
omit [Fintype V] [Fintype E] [DecidableEq V] in
@[simp] theorem indicator_nonneg (G : LooplessGraph V E) (M : G.Matching) (e : E) :
0 ≤ G.indicator M e := by
simp only [indicator]
split <;> norm_num
omit [Fintype V] [Fintype E] [DecidableEq V] in
@[simp] theorem indicator_le_one (G : LooplessGraph V E) (M : G.Matching) (e : E) :
G.indicator M e ≤ 1 := by
simp only [indicator]
split <;> norm_num
omit [Fintype V] [DecidableEq V] in
theorem continuous_mean (G : LooplessGraph V E) : Continuous G.mean := by
unfold mean
fun_prop
def meanLinear (G : LooplessGraph V E) : (G.Matching → ℝ) →ₗ[ℝ] (E → ℝ) where
toFun := G.mean
map_add' p q := by
ext e
simp [mean, add_mul, Finset.sum_add_distrib]
map_smul' a p := by
ext e
simp [mean, mul_assoc, Finset.mul_sum]
omit [Fintype V] [DecidableEq V] in
theorem mean_mem_polytope (G : LooplessGraph V E) {p : G.Matching → ℝ}
(hp : p ∈ probabilitySimplex G.Matching) : G.mean p ∈ G.polytope := by
have h := (convex_convexHull ℝ (Set.range G.indicator)).sum_mem
(fun M _ ↦ hp.1 M) hp.2 (fun M _ ↦ subset_convexHull ℝ _ (Set.mem_range_self M))
have he : G.mean p = ∑ M, p M • G.indicator M := by
ext e
simp [mean]
rw [he]
exact h
omit [Fintype V] [DecidableEq V] in
@[simp] theorem mean_single (G : LooplessGraph V E) (M : G.Matching) :
G.mean (Pi.single M 1) = G.indicator M := by
classical
ext e
simp [mean, Pi.single_apply, ite_mul]
omit [Fintype V] [DecidableEq V] in
/-- Exact equivalence between the convex hull of matching indicators and feasible finite laws. -/
theorem mem_polytope_iff (G : LooplessGraph V E) (y : E → ℝ) :
y ∈ G.polytope ↔ (G.feasibleLaws y).Nonempty := by
classical
constructor
· intro hy
have hc : Convex ℝ (G.mean '' probabilitySimplex G.Matching) :=
(convex_probabilitySimplex G.Matching).linear_image G.meanLinear
have hs : Set.range G.indicator ⊆ G.mean '' probabilitySimplex G.Matching := by
rintro _ ⟨M, rfl⟩
exact ⟨Pi.single M 1, single_mem_probabilitySimplex M, G.mean_single M⟩
obtain ⟨p, hp, rfl⟩ := convexHull_min hs hc hy
exact ⟨p, hp, rfl⟩
· rintro ⟨p, hp, rfl⟩
exact G.mean_mem_polytope hp
omit [Fintype V] [DecidableEq V] in
theorem compact_feasibleLaws (G : LooplessGraph V E) (y : E → ℝ) :
IsCompact (G.feasibleLaws y) := by
exact (isCompact_probabilitySimplex G.Matching).inter_right
(isClosed_eq G.continuous_mean continuous_const)
omit [Fintype V] [DecidableEq V] in
theorem compact_polytope (G : LooplessGraph V E) : IsCompact G.polytope := by
have heq : G.polytope = G.mean '' probabilitySimplex G.Matching := by
ext y
rw [G.mem_polytope_iff]
rfl
rw [heq]
exact (isCompact_probabilitySimplex G.Matching).image G.continuous_mean
end LooplessGraph
end MatchingEntropy
end
end OAI
|