Documentation

CslibFrontier.Computability.PropertyTesting.Monotonicity.UnateDistance

Unateness Distance, Sparse Relative Distance, and Violated-Edge Lower Bounds #

Provides general Boolean-function property-testing distance measures and matching lower bounds on finite Boolean hypercubes ι → Bool:

Main definitions #

Main results #

def Cslib.BitString.bitXor {ι : Type u_1} (x a : ι → Bool) :
ι → Bool

Bitwise XOR of two Boolean vectors on ι.

@[simp]
theorem Cslib.BitString.bitXor_apply {ι : Type u_1} (x a : ι → Bool) (i : ι) :
bitXor x a i = (x i ^^ a i)
@[simp]
theorem Cslib.BitString.bitXor_self_right {ι : Type u_1} (x a : ι → Bool) :
bitXor (bitXor x a) a = x
theorem Cslib.BitString.bitXor_update {ι : Type u_1} [DecidableEq ι] (x a : ι → Bool) (i : ι) (b : Bool) :
bitXor (Function.update x i b) a = Function.update (bitXor x a) i (b ^^ a i)

Updating coordinate i commutes with bitwise XOR by flipping the written bit when a i = true.

theorem Cslib.BitString.isUnate_iff_exists_xor_monotone {ι : Type u_1} [Finite ι] [DecidableEq ι] {f : (ι → Bool) → Bool} :
IsUnate f ↔ ∃ (a : ι → Bool), Monotone fun (x : ι → Bool) => f (bitXor x a)

A Boolean function on a finite cube is unate iff there exists an orientation vector a such that x ↦ f (bitXor x a) is monotone.

def Cslib.BitString.supportFinset {ι : Type u_1} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → Bool) :
Finset (ι → Bool)

The support {x | f x = true} of a Boolean function on ι → Bool.

@[simp]
theorem Cslib.BitString.mem_supportFinset {ι : Type u_1} [Fintype ι] [DecidableEq ι] {f : (ι → Bool) → Bool} {x : ι → Bool} :

The symmetric difference of supports of f and g has cardinality equal to their Hamming distance.

noncomputable def Cslib.BitString.distUnate {ι : Type u_1} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → Bool) :

Absolute Hamming distance from f to the class of unate Boolean functions.

theorem Cslib.BitString.distUnate_le {ι : Type u_1} [Fintype ι] [DecidableEq ι] {f g : (ι → Bool) → Bool} (hg : IsUnate g) :
theorem Cslib.BitString.exists_isUnate_hammingDist_eq_distUnate {ι : Type u_1} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → Bool) :
∃ (g : (ι → Bool) → Bool), IsUnate g ∧ hammingDist f g = distUnate f
noncomputable def Cslib.BitString.sparseRelDist {ι : Type u_1} [Fintype ι] [DecidableEq ι] (f g : (ι → Bool) → Bool) :

Sparse relative distance |f⁻¹(1) △ g⁻¹(1)| / |f⁻¹(1)|.

noncomputable def Cslib.BitString.sparseRelDistMonotone {ι : Type u_1} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → Bool) :

Sparse relative distance from f to monotone functions.

noncomputable def Cslib.BitString.sparseRelDistUnate {ι : Type u_1} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → Bool) :

Sparse relative distance from f to unate functions.

theorem Cslib.BitString.le_sparseRelDistMonotone_iff {ι : Type u_1} [Fintype ι] [DecidableEq ι] {f : (ι → Bool) → Bool} {ε : ℝ} :
ε ≤ sparseRelDistMonotone f ↔ ∀ (g : (ι → Bool) → Bool), Monotone g → ε ≤ sparseRelDist f g
theorem Cslib.BitString.le_sparseRelDistUnate_iff {ι : Type u_1} [Fintype ι] [DecidableEq ι] {f : (ι → Bool) → Bool} {ε : ℝ} :
ε ≤ sparseRelDistUnate f ↔ ∀ (g : (ι → Bool) → Bool), IsUnate g → ε ≤ sparseRelDist f g
theorem Cslib.BitString.disjoint_violating_pairs_le_relDistMonotone {ι : Type u_1} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → Bool) (S : Finset ((ι → Bool) × (ι → Bool))) (hviol : ∀ p ∈ S, p.1 ≤ p.2 ∧ f p.1 = true ∧ f p.2 = false) (hdisj : ∀ p ∈ S, ∀ q ∈ S, p ≠ q → p.1 ≠ q.1 ∧ p.1 ≠ q.2 ∧ p.2 ≠ q.1 ∧ p.2 ≠ q.2) :

If S is a finite set of pairwise vertex-disjoint pairs (x, y) violating monotonicity of f (x ≤ y, f x = true, and f y = false), then |S| / 2^|ι| ≤ relDistMonotone f.

theorem Cslib.BitString.min_directed_edges_le_sparseRelDistUnate {ι : Type u_1} [Fintype ι] [DecidableEq ι] (f : (ι → Bool) → Bool) (i : ι) :
min ↑(violatedEdges (fun (x : ι → Bool) => !f x) i).card ↑(violatedEdges f i).card / ↑(supportFinset f).card ≤ sparseRelDistUnate f

For any coordinate i, the minimum of the numbers of strictly increasing (violatedEdges (!f) i) and strictly decreasing (violatedEdges f i) i-edges, divided by |f⁻¹(1)|, lower-bounds sparseRelDistUnate f.