Hypercubes #
The n-dimensional hypercube is represented as Boolean coordinate functions
Fin n → Bool. Two vertices are adjacent when they differ in exactly one
coordinate.
Vertices of the n-cube.
Equations
- PebblingLean.HypercubeVertex n = (Fin n → Bool)
Instances For
Hamming distance on Boolean coordinate functions.
Equations
- PebblingLean.Hypercube.dist x y = {i : Fin n | x i ≠ y i}.card
Instances For
Coordinates on which two hypercube vertices differ.
Equations
- PebblingLean.Hypercube.diffSet x y = {i : Fin n | x i ≠ y i}
Instances For
Hamming distance in Q_n is at most n.
The vertex obtained from base by flipping exactly the coordinates in
s.
Instances For
Vertices of Q_n are equivalent to subsets of coordinates, by recording
where they differ from a fixed base vertex.
Equations
- PebblingLean.Hypercube.diffSetEquiv base = { toFun := PebblingLean.Hypercube.diffSet base, invFun := PebblingLean.Hypercube.fromDiffSet base, left_inv := ⋯, right_inv := ⋯ }
Instances For
The Hamming sphere of radius k around any fixed hypercube vertex has
cardinality n choose k.
Hamming distance satisfies the triangle inequality.
The n-dimensional hypercube graph.
Equations
- PebblingLean.Hypercube.graph n = { Adj := fun (x y : PebblingLean.HypercubeVertex n) => PebblingLean.Hypercube.dist x y = 1, symm := ⋯, loopless := ⋯ }
Instances For
Adjacent hypercube vertices have distances to any third vertex that differ by at most one in this direction.