MerLean-example

3 Rem 3: Binary Vector Notation

Throughout this work, we abuse notation by identifying a subset of vertices, edges, or cycles with its characteristic binary vector over \(\mathbb {Z}_2 = \mathbb {F}_2\). For a set \(S\) of vertices/edges/cycles, the corresponding binary vector has a \(1\) in position \(i\) if and only if element \(i\) belongs to \(S\). Addition of binary vectors corresponds to symmetric difference of sets. This identification allows us to use linear algebra over \(\mathbb {Z}_2\) to reason about graph-theoretic properties.

3.1 Binary Vectors over \(\mathbb {Z}/2\mathbb {Z}\)

Definition 73 Binary Vector
#

A binary vector over an index set \(\alpha \) is a function \(\alpha \to \mathbb {Z}/2\mathbb {Z}\). This is the type of characteristic vectors.

Definition 74 Zero Binary Vector
#

The zero vector is the binary vector that is \(0\) at every coordinate:

\[ \mathbf{0}(i) = 0 \quad \text{for all } i \in \alpha . \]
Definition 75 Ones Binary Vector
#

The all-ones vector is the binary vector that is \(1\) at every coordinate:

\[ \mathbf{1}(i) = 1 \quad \text{for all } i \in \alpha . \]
Definition 76 Binary Vector Addition
#

Addition of binary vectors \(v, w : \alpha \to \mathbb {Z}/2\mathbb {Z}\) is defined componentwise:

\[ (v + w)(i) = v(i) + w(i) \quad \text{in } \mathbb {Z}/2\mathbb {Z}. \]

3.2 Characteristic Vector of a Set

Definition 77 Characteristic Vector
#

The characteristic vector of a finset \(S \subseteq \alpha \) is the binary vector \(\chi _S : \alpha \to \mathbb {Z}/2\mathbb {Z}\) defined by

\[ \chi _S(i) = \begin{cases} 1 & \text{if } i \in S, \\ 0 & \text{if } i \notin S. \end{cases} \]
Theorem 78 Characteristic Vector Membership

For a finset \(S \subseteq \alpha \) and an element \(i \in \alpha \),

\[ \chi _S(i) = 1 \iff i \in S. \]
Proof

We prove each direction separately. For the forward direction, assume \(\chi _S(i) = 1\). By definition of \(\chi _S\), we unfold the characteristic vector. We split on whether \(i \in S\): if \(i \in S\), we are done; if \(i \notin S\), then \(\chi _S(i) = 0\), contradicting \(\chi _S(i) = 1\) by simplification. For the reverse direction, assume \(i \in S\). Then by definition \(\chi _S(i) = 1\), and this follows by simplification using the membership hypothesis.

Theorem 79 Characteristic Vector Non-Membership

For a finset \(S \subseteq \alpha \) and an element \(i \in \alpha \),

\[ \chi _S(i) = 0 \iff i \notin S. \]
Proof

We prove each direction separately. For the forward direction, assume \(\chi _S(i) = 0\). Unfolding the definition of the characteristic vector and splitting on membership: if \(i \in S\), then \(\chi _S(i) = 1\), contradicting \(\chi _S(i) = 0\) by simplification; if \(i \notin S\), we are done. For the reverse direction, assume \(i \notin S\). Then by definition \(\chi _S(i) = 0\), which follows by simplification.

3.3 Symmetric Difference and Vector Addition

Theorem 80 Addition Corresponds to Symmetric Difference

For finsets \(S, T \subseteq \alpha \),

\[ \chi _S + \chi _T = \chi _{S \mathbin {\triangle } T}. \]

Addition of characteristic vectors corresponds to symmetric difference. This is the fundamental property that allows linear algebra over \(\mathbb {Z}/2\mathbb {Z}\) to encode set operations.

Proof

By extensionality, it suffices to show equality for an arbitrary element \(i\). We simplify the left-hand side using the pointwise addition definition and the characteristic vector definition, and the right-hand side using the membership condition for symmetric difference. We then perform a case split on whether \(i \in S\) and whether \(i \in T\):

  • If \(i \in S\) and \(i \in T\): the left-hand side is \(1 + 1 = 0\) in \(\mathbb {Z}/2\mathbb {Z}\), and the right-hand side is \(0\) since \(i \notin S \mathbin {\triangle } T\).

  • If \(i \in S\) and \(i \notin T\): both sides equal \(1\) by simplification.

  • If \(i \notin S\) and \(i \in T\): both sides equal \(1\) by simplification.

  • If \(i \notin S\) and \(i \notin T\): both sides equal \(0\) by simplification.

Theorem 81 Symmetric Difference as Addition

For finsets \(S, T \subseteq \alpha \),

\[ \chi _{S \mathbin {\triangle } T} = \chi _S + \chi _T. \]
Proof

This is the symmetric form of the previous theorem, obtained by applying symmetry to \(\chi _S + \chi _T = \chi _{S \mathbin {\triangle } T}\).

Theorem 82 Self-Addition is Zero

For a finset \(S \subseteq \alpha \),

\[ \chi _S + \chi _S = 0. \]
Proof

Rewriting using the addition-symmetric difference correspondence, \(\chi _S + \chi _S = \chi _{S \mathbin {\triangle } S}\). Since \(S \mathbin {\triangle } S = \emptyset \), we have \(\chi _\emptyset = 0\).

Theorem 83 Negation Equals Self

In \(\mathbb {Z}/2\mathbb {Z}\), every element is its own additive inverse. For a finset \(S\),

\[ -\chi _S = \chi _S. \]
Proof

By extensionality, it suffices to show \((-\chi _S)(i) = \chi _S(i)\) for each \(i\). We simplify the negation and unfold the characteristic vector definition, then split on whether \(i \in S\). In both cases (\(\chi _S(i) = 1\) or \(\chi _S(i) = 0\)), the result follows by computation (deciding) in \(\mathbb {Z}/2\mathbb {Z}\), since \(-1 = 1\) and \(-0 = 0\) in this ring.

3.4 Inverse Map: From Binary Vector to Finset

Definition 84 From Binary Vector to Finset
#

Given a binary vector \(v : \alpha \to \mathbb {Z}/2\mathbb {Z}\), we define the corresponding finset as the support of \(v\):

\[ \mathrm{fromBinaryVector}(v) = \{ i \in \alpha \mid v(i) = 1 \} . \]
Theorem 85 Round-Trip: Vector to Finset

For any finset \(S \subseteq \alpha \),

\[ \mathrm{fromBinaryVector}(\chi _S) = S. \]
Proof

By extensionality, \(i \in \mathrm{fromBinaryVector}(\chi _S)\) iff \(\chi _S(i) = 1\). By the characteristic vector membership characterization, this is equivalent to \(i \in S\). The result follows by simplification.

Theorem 86 Round-Trip: Finset to Vector

For any binary vector \(v : \alpha \to \mathbb {Z}/2\mathbb {Z}\),

\[ \chi _{\mathrm{fromBinaryVector}(v)} = v. \]
Proof

By extensionality, it suffices to show equality at each coordinate \(i\). We unfold the definitions of the characteristic vector and \(\mathrm{fromBinaryVector}\). Since every element of \(\mathbb {Z}/2\mathbb {Z}\) is either \(0\) or \(1\), we decompose \(v(i)\) into these two cases. In each case, the result follows by simplification: if \(v(i) = 0\), then \(i \notin \mathrm{fromBinaryVector}(v)\), so \(\chi (i) = 0 = v(i)\); if \(v(i) = 1\), then \(i \in \mathrm{fromBinaryVector}(v)\), so \(\chi (i) = 1 = v(i)\).

Theorem 87 Injectivity of Characteristic Vector

The characteristic vector map \(\chi : \mathrm{Finset}(\alpha ) \to \mathrm{BinaryVector}(\alpha )\) is injective.

Proof

Let \(S, T\) be finsets with \(\chi _S = \chi _T\). By extensionality, we need to show \(i \in S \iff i \in T\) for all \(i\). Using the membership characterization, \(i \in S \iff \chi _S(i) = 1 \iff \chi _T(i) = 1 \iff i \in T\), where the middle equivalence follows from \(\chi _S = \chi _T\).

Theorem 88 Surjectivity of Characteristic Vector

The characteristic vector map \(\chi : \mathrm{Finset}(\alpha ) \to \mathrm{BinaryVector}(\alpha )\) is surjective.

Proof

Given a binary vector \(v\), take \(S = \mathrm{fromBinaryVector}(v)\). Then \(\chi _S = v\) by the round-trip property, which follows by simplification.

Theorem 89 Bijectivity of Characteristic Vector

The characteristic vector map \(\chi : \mathrm{Finset}(\alpha ) \to \mathrm{BinaryVector}(\alpha )\) is a bijection.

Proof

This follows directly from injectivity and surjectivity of the characteristic vector map.

Definition 90 Characteristic Vector Equivalence

The characteristic vector map as a type equivalence \(\mathrm{Finset}(\alpha ) \simeq \mathrm{BinaryVector}(\alpha )\), with forward map \(\chi \) and inverse map \(\mathrm{fromBinaryVector}\). Theleft and right inverses are given by the two round-trip properties.

3.5 Algebraic Structure: Finsets as a Vector Space over \(\mathbb {Z}/2\mathbb {Z}\)

Definition 91 Finset Addition via Symmetric Difference
#

Addition on \(\mathrm{Finset}(\alpha )\) is defined via symmetric difference:

\[ S + T := S \mathbin {\triangle } T. \]
Definition 92 Finset Additive Commutative Group
#

The type \(\mathrm{Finset}(\alpha )\) forms an additive commutative group with symmetric difference as addition, \(\emptyset \) as the zero element, and identity as negation (since every element is its own inverse in \(\mathbb {Z}/2\mathbb {Z}\)). The group axioms hold because:

  • Associativity: \((S \mathbin {\triangle } T) \mathbin {\triangle } U = S \mathbin {\triangle } (T \mathbin {\triangle } U)\).

  • Identity: \(\emptyset \mathbin {\triangle } S = S\) and \(S \mathbin {\triangle } \emptyset = S\).

  • Inverse: \(S \mathbin {\triangle } S = \emptyset \).

  • Commutativity: \(S \mathbin {\triangle } T = T \mathbin {\triangle } S\).

Definition 93 Finset Scalar Multiplication by \(\mathbb {Z}/2\mathbb {Z}\)
#

Scalar multiplication by \(\mathbb {Z}/2\mathbb {Z}\) on \(\mathrm{Finset}(\alpha )\) is defined as:

\[ c \cdot S = \begin{cases} \emptyset & \text{if } c = 0, \\ S & \text{if } c = 1. \end{cases} \]
Definition 94 Finset Module over \(\mathbb {Z}/2\mathbb {Z}\)
#

The type \(\mathrm{Finset}(\alpha )\) forms a module (vector space) over \(\mathbb {Z}/2\mathbb {Z}\), where addition is symmetric difference and scalar multiplication is as defined above. The module axioms are verified by case analysis on elements of \(\mathbb {Z}/2\mathbb {Z}\) (which are either \(0\) or \(1\)).

Theorem 95 Characteristic Vector Preserves Addition

For finsets \(S, T \subseteq \alpha \) (where addition on finsets is symmetric difference),

\[ \chi _{S + T} = \chi _S + \chi _T. \]
Proof

We unfold the definition of addition on finsets (which is symmetric difference), and the result follows directly from the symmetric difference correspondence theorem.

Theorem 96 Characteristic Vector Preserves Scalar Multiplication

For \(c \in \mathbb {Z}/2\mathbb {Z}\) and a finset \(S \subseteq \alpha \),

\[ \chi _{c \cdot S} = c \cdot \chi _S. \]
Proof

We decompose \(c\) into the cases \(c = 0\) and \(c = 1\) (the only elements of \(\mathbb {Z}/2\mathbb {Z}\)).

Case \(c = 0\): We substitute \(c = 0\). The left-hand side becomes \(\chi _{0 \cdot S} = \chi _\emptyset = 0\). For the right-hand side, by extensionality at each coordinate \(i\), we simplify \(0 \cdot \chi _S(i)\) using the zero scalar action and verify it equals \(0\) by the symmetry of \(0 \cdot x = 0\).

Case \(c = 1\): We substitute \(c = 1\). The left-hand side becomes \(\chi _{1 \cdot S} = \chi _S\). For the right-hand side, by extensionality at each coordinate \(i\), we use \(1 \cdot \chi _S(i) = \chi _S(i)\) by the symmetry of \(1 \cdot x = x\).

Definition 97 Characteristic Vector Linear Equivalence

The characteristic vector map is a linear equivalence

\[ \chi : \mathrm{Finset}(\alpha ) \xrightarrow {\sim }_{\mathbb {Z}/2\mathbb {Z}} \mathrm{BinaryVector}(\alpha ) \]

with forward map \(\chi = \mathrm{characteristicVector}\), inverse map \(\mathrm{fromBinaryVector}\), additivity \(\chi (S + T) = \chi (S) + \chi (T)\), and scalar compatibility \(\chi (c \cdot S) = c \cdot \chi (S)\).

3.6 Properties for Graph Theory Applications

Theorem 98 Union of Disjoint Sets as Addition

For disjoint finsets \(S, T \subseteq \alpha \) (i.e., \(S \cap T = \emptyset \)),

\[ \chi _{S \cup T} = \chi _S + \chi _T. \]
Proof

Rewriting using the addition-symmetric difference correspondence, it suffices to show \(S \cup T = S \mathbin {\triangle } T\). Since \(S\) and \(T\) are disjoint, the symmetric difference equals the union, which follows from the lemma that disjoint symmetric difference equals the supremum (union).

Theorem 99 Intersection as Pointwise Multiplication
#

For finsets \(S, T \subseteq \alpha \) and any \(i \in \alpha \),

\[ \chi _{S \cap T}(i) = \chi _S(i) \cdot \chi _T(i). \]
Proof

Let \(i\) be arbitrary. We unfold the definition of the characteristic vector using the membership condition for intersections. We perform a case split on whether \(i \in S\) and whether \(i \in T\):

  • If \(i \in S\) and \(i \in T\): both sides equal \(1 \cdot 1 = 1\).

  • If \(i \in S\) and \(i \notin T\): both sides equal \(1 \cdot 0 = 0\).

  • If \(i \notin S\) and \(i \in T\): both sides equal \(0 \cdot 1 = 0\).

  • If \(i \notin S\) and \(i \notin T\): both sides equal \(0 \cdot 0 = 0\).

All cases follow by simplification.

Theorem 100 Complement as Addition with Ones

For a finset \(S \subseteq \alpha \),

\[ \chi _{S^c} = \mathbf{1} + \chi _S, \]

where \(\mathbf{1}\) denotes the all-ones vector and \(S^c\) is the complement of \(S\) relative to the universe.

Proof

By extensionality, it suffices to verify at each coordinate \(i\). We unfold the definitions of \(\mathbf{1}\), pointwise addition, and the characteristic vector, using the membership condition for complements. We split on whether \(i \in S^c\): if \(i \notin S\) then \(\chi _{S^c}(i) = 1\) and \(1 + 0 = 1\); if \(i \in S\) then \(\chi _{S^c}(i) = 0\) and \(1 + 1 = 0\) in \(\mathbb {Z}/2\mathbb {Z}\). Both cases are verified by computation.

Theorem 101 Cardinality from Characteristic Vector

The cardinality of a finset \(S\) can be recovered from its characteristic vector:

\[ |S| = \sum _{i \in \alpha } \mathrm{val}(\chi _S(i)), \]

where \(\mathrm{val} : \mathbb {Z}/2\mathbb {Z} \to \mathbb {N}\) is the distance-minimal representative.

Proof

We split the sum over the universe into a sum over elements in \(S\) and a sum over elements not in \(S\): \(\sum _{i \in \alpha } \mathrm{val}(\chi _S(i)) = \sum _{i \in S} \mathrm{val}(\chi _S(i)) + \sum _{i \notin S} \mathrm{val}(\chi _S(i))\). We first observe that \(\{ i \in \alpha \mid i \in S\} = S\) by extensionality and simplification. For the first sum: for each \(i \in S\), \(\chi _S(i) = 1\), so \(\mathrm{val}(\chi _S(i)) = 1\), hence \(\sum _{i \in S} 1 = |S|\) (rewriting the cardinality as a sum of ones). For the second sum: for each \(i \notin S\), \(\chi _S(i) = 0\), so \(\mathrm{val}(\chi _S(i)) = 0\), hence the sum is \(0\). Combining by integer arithmetic (omega), \(|S| = |S| + 0\).

Theorem 102 Finset Equality via Characteristic Vectors

Two finsets are equal if and only if their characteristic vectors are equal:

\[ S = T \iff \chi _S = \chi _T. \]
Proof

The forward direction follows by rewriting: if \(S = T\) then \(\chi _S = \chi _T\). The reverse direction follows from injectivity of the characteristic vector map: if \(\chi _S = \chi _T\) then \(S = T\).

Theorem 103 Symmetric Difference Cardinality Formula
#

For finsets \(S, T \subseteq \alpha \),

\[ |S \mathbin {\triangle } T| + 2 \cdot |S \cap T| = |S| + |T|. \]
Proof

We use the standard cardinality identity \(|S \cup T| + |S \cap T| = |S| + |T|\) (Finset.card_union_add_card_inter). We then establish that \(S \mathbin {\triangle } T = (S \cup T) \setminus (S \cap T)\) by extensionality: \(x \in S \mathbin {\triangle } T\) iff \(x \in (S \cup T) \setminus (S \cap T)\), which follows by unfolding the definitions and applying propositional logic (tauto). Since \(S \cap T \subseteq S \cup T\) (by Finset.inter_subset_union), we apply the cardinality of set difference for subsets: \(|S \mathbin {\triangle } T| = |S \cup T| - |S \cap T|\). We also have \(|S \cap T| \le |S \cup T|\) (by monotonicity of cardinality). The desired identity \(|S \mathbin {\triangle } T| + 2|S \cap T| = |S| + |T|\) then follows by integer arithmetic (omega) from these three facts.