introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
2.95 kB
import Mathlib.Algebra.MvPolynomial.Degrees
import Mathlib.Algebra.BigOperators.Field
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Analysis.Real.Sqrt
import Mathlib.Tactic.NormNum
namespace OAI
/-!
# Polynomial thresholds and average sensitivity
The Boolean cube encodes the sign cube `{βˆ’1,1}^n`:
`false` represents `βˆ’1` and `true` represents `1`. The public statement
quantifies directly over real multilinear polynomials and uses uniform counting
probability, the convention `sign(0) = 1`, and the exact constant `8`.
`GotsmanLinialStatement` is a proposition definition, not a proof of the bound.
-/
open scoped BigOperators
namespace LeanBlast.GotsmanLinial
/-- The sign cube `{βˆ’1,1}^n`, with Boolean coordinates encoding the signs. -/
abbrev Cube (n : β„•) := Fin n β†’ Bool
/-- Interpret a Boolean cube coordinate as the corresponding real sign. -/
def cubeCoord {n : β„•} (x : Cube n) (i : Fin n) : ℝ :=
if x i then 1 else -1
/-- Reverse one coordinate of a cube vertex. -/
def flip {n : β„•} (i : Fin n) (x : Cube n) : Cube n :=
Function.update x i (!(x i))
/-- The threshold convention assigns `1` at zero. -/
noncomputable def thresholdSign (t : ℝ) : ℝ :=
if 0 ≀ t then 1 else -1
/-- Vertices at which reversing coordinate `i` changes the function. -/
noncomputable def sensitiveVertices {n : β„•} (f : Cube n β†’ ℝ) (i : Fin n) :
Finset (Cube n) := by
classical
exact Finset.univ.filter fun x => f x β‰  f (flip i x)
/-- Number of ordered sensitive edges, indexed by their initial vertex and direction. -/
noncomputable def sensitiveEdgeCount {n : β„•} (f : Cube n β†’ ℝ) : β„• :=
βˆ‘ i : Fin n, (sensitiveVertices f i).card
/-- Sum of the uniform probabilities that a coordinate flip changes `f`. -/
noncomputable def averageSensitivity {n : β„•} (f : Cube n β†’ ℝ) : ℝ :=
βˆ‘ i : Fin n, ((sensitiveVertices f i).card : ℝ) / (2 : ℝ) ^ n
/-- Every exponent in every supported monomial is at most one. -/
def IsMultilinear {n : β„•} (p : MvPolynomial (Fin n) ℝ) : Prop :=
βˆ€ m ∈ p.support, βˆ€ i : Fin n, m i ≀ 1
/-- Evaluate a real polynomial at the signs represented by a cube vertex. -/
noncomputable def polynomialValue {n : β„•} (p : MvPolynomial (Fin n) ℝ)
(x : Cube n) : ℝ :=
MvPolynomial.eval (cubeCoord x) p
/-- The polynomial threshold function with the nonnegative-at-zero convention. -/
noncomputable def polynomialThreshold {n : β„•} (p : MvPolynomial (Fin n) ℝ) :
Cube n β†’ ℝ :=
fun x => thresholdSign (polynomialValue p x)
/-- The average-sensitivity bound for positive dimension and degree at most the dimension. -/
def GotsmanLinialStatement : Prop :=
βˆ€ (n d : β„•), 1 ≀ n β†’ 1 ≀ d β†’ d ≀ n β†’
βˆ€ p : MvPolynomial (Fin n) ℝ,
IsMultilinear p β†’ p.totalDegree ≀ d β†’
averageSensitivity (polynomialThreshold p) ≀ 8 * (d : ℝ) * Real.sqrt (n : ℝ)
end LeanBlast.GotsmanLinial
end OAI