Download data/lean/OAI/Combinatorics/PerfectMatching/Basic.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.06 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/PerfectMatching/Basic.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/PerfectMatching/Basic.lean
-
curl -L -o Basic.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/PerfectMatching/Basic.lean
4.06 kB
| 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 | |