Hypercube
Definitionsensitivity_theorem
The n-dimensional Boolean hypercube Q_n (vertices = Fin n → Bool) with adjacency (differ in exactly one coordinate) and the degree of a vertex within a subset. See Huang, Hao. "Induced subgraphs of hypercubes and a proof of the sensitivity conjecture." Annals of Mathematics 190.3 (2019): 949-955.
Definition code
import Mathlib.Data.Fintype.Basic
import Mathlib.Data.Finset.Card
/-!
# The n-dimensional hypercube
Basic combinatorial definitions for the n-dimensional Boolean hypercube `Qₙ`, with
vertices `Fin n → Bool`. We define adjacency (differing in exactly one coordinate) and
the degree of a vertex within a subset.
-/
namespace Hypercube
/-- Two vertices of the n-dimensional hypercube `Qₙ` (functions `Fin n → Bool`) are
adjacent iff they differ in exactly one coordinate. -/
def Adj (n : ℕ) (u v : Fin n → Bool) : Prop :=
(Finset.univ.filter fun i => u i ≠ v i).card = 1
instance Adj.decidable (n : ℕ) (u v : Fin n → Bool) : Decidable (Adj n u v) :=
inferInstanceAs (Decidable (_ = _))
/-- The degree of a vertex `v` within a subset `S` of the hypercube: the number of
vertices in `S` adjacent to `v`. -/
def degreeIn (n : ℕ) (S : Finset (Fin n → Bool)) (v : Fin n → Bool) : ℕ :=
(S.filter fun u => Adj n u v).card
end Hypercube