344 Cartesian, Linear and Quantum: Logic from the Diagonal

Logics and their categories are distinguished by what they allow the diagonal and the discard to do. Both come from the identity (Remark 350.1).

Structural rules.

Three regimes.

Regime Copy and discard Logic
cartesian both natural on every object intuitionistic, simply typed \(\lambda \)
linear neither, except under \(!\) linear logic
quantum discard natural, copy only per basis categorical quantum mechanics

Qubits and circuits again. In the quantum regime, each orthonormal basis is exactly a commutative Frobenius algebra: a diagonal that copies its own basis states and nothing else. Two complementary such diagonals, \(Z\) and \(X\), generate the ZX-calculus, in which qubits, Paulis, Hadamard, Clifford and \(T\) gates, CNOT, CZ, measurement, dephasing and teleportation are all derived. Teleportation is the triangle identity of an adjunction.

344.1 Structural rules from the floor

In a sequent \(\Gamma \vdash B\), the structural rules are:

Rule Form Floor
identity \(A\vdash A\) \(\mathrm {id}_A\)
cut from \(\Gamma \vdash A\) and \(A,\Delta \vdash B\) infer \(\Gamma ,\Delta \vdash B\) composition
exchange \(\Gamma ,A,B,\Delta \vdash C\) to \(\Gamma ,B,A,\Delta \vdash C\) swap, \(\sigma ^2=\mathrm {id}\)
contraction \(\Gamma ,A,A\vdash B\) to \(\Gamma ,A\vdash B\) diagonal \(A\to A\otimes A\)
weakening \(\Gamma \vdash B\) to \(\Gamma ,A\vdash B\) discard \(A\to I\)

Cut elimination is the statement that composites of identities and rules reduce to normal forms.

344.2 Cartesian categories

Copy and discard. In a symmetric monoidal category \((\mathcal C,\otimes ,I)\), give every object a comonoid,

\begin{equation} \delta _A:A\to A\otimes A, \qquad \epsilon _A:A\to I, \tag{21315}\end{equation}
coassociative, counital and commutative.

Fox’s theorem. \(\otimes \) is the cartesian product, and \(I\) terminal, iff \(\delta \) and \(\epsilon \) are natural:

\begin{equation} \delta _B\circ f=(f\otimes f)\circ \delta _A, \qquad \epsilon _B\circ f=\epsilon _A . \tag{21316}\end{equation}
Indeed, given natural \(\delta ,\epsilon \), the projections are \(\pi _1=(1\otimes \epsilon )\) and \(\pi _2=(\epsilon \otimes 1)\), and the pairing is \(\langle f,g\rangle =(f\otimes g)\circ \delta \). Uniqueness of the pairing is naturality. Conversely, products give \(\delta =\langle \mathrm {id},\mathrm {id}\rangle \). A cartesian category is one in which the diagonal of the floor is natural on every object.

Closure and logic. A cartesian category is closed when \(-\times A\) has a right adjoint \(A\Rightarrow -\):

\begin{equation} \mathcal C(C\times A,B)\cong \mathcal C(C,A\Rightarrow B), \tag{21317}\end{equation}
which is currying. Cartesian closed categories, simply typed \(\lambda \)-calculus and intuitionistic propositional logic are three presentations of one structure:

Contraction lets a hypothesis be used twice, and weakening lets it go unused.

Toposes. A topos adds a subobject classifier \(\Omega \), the object of cuts: subobjects of \(A\) are maps \(A\to \Omega \). In \(\mathbf {Set}\), \(\Omega =\mathbf 2\) and the cuts are idempotent indicators. A topos is Boolean iff \(\neg \neg =\mathrm {id}\) on \(\Omega \), the involution of Section 3.

344.3 Linear logic

Removing contraction and weakening. Each hypothesis must then be used exactly once. The connectives split:

Connective Meaning Categorical
\(A\otimes B\) both, used together monoidal product
\(A\multimap B\) consume \(A\), produce \(B\) internal hom, \(-\otimes A\dashv A\multimap -\)
\(A\mathbin {\& }B\) either, chosen by the user product
\(A\oplus B\) either, chosen by the provider coproduct
\(A^\perp \) linear negation dual object
\(A\parr B\) \((A^\perp \otimes B^\perp )^\perp \) De Morgan dual of \(\otimes \)
\(!A\) reusable \(A\) comonoid modality

Involutive negation. Linear negation is an involution,

\begin{equation} A^{\perp \perp }=A, \qquad (A\otimes B)^\perp =A^\perp \parr B^\perp , \qquad A\multimap B=A^\perp \parr B , \tag{21318}\end{equation}
so classical linear logic has involutive negation without the explosion of resources that contraction would bring. Models are \(\ast \)-autonomous categories.

The exponential. \(!A\) carries a comonoid, so contraction and weakening hold for it:

\begin{equation} !A\vdash \,!A\otimes !A, \qquad !A\vdash I . \tag{21319}\end{equation}
Intuitionistic logic embeds by Girard’s translation,
\begin{equation} A\Rightarrow B\ \longmapsto \ !A\multimap B , \tag{21320}\end{equation}
which is the cartesian regime recovered by putting the diagonal back on selected objects.

Compact closure. When \(\otimes =\parr \), every object has a dual \(A^{*}\) with a cup and a cap,

\begin{equation} \eta _A:I\to A^{*}\otimes A, \qquad \varepsilon _A:A\otimes A^{*}\to I, \tag{21321}\end{equation}
satisfying the triangle identities
\begin{equation} (\varepsilon _A\otimes 1_A)\circ (1_A\otimes \eta _A)=1_A, \qquad (1_{A^{*}}\otimes \varepsilon _A)\circ (\eta _A\otimes 1_{A^{*}})=1_{A^{*}}, \tag{21322}\end{equation}
which make \(A\otimes -\dashv A^{*}\otimes -\) an adjunction (Section 232).

344.4 The quantum regime

The category. \(\mathbf {FHilb}\), finite-dimensional Hilbert spaces and linear maps, is dagger compact:

States are maps \(I\to A\), effects are maps \(A\to I\), and scalars are maps \(I\to I\).

No natural diagonal. Suppose \(\delta _A:A\to A\otimes A\) were natural. Applied to the states \(\psi ,\phi \) and \(\psi +\phi \), naturality would give \(\delta (\psi )=\psi \otimes \psi \) for every state, but

\begin{equation} (\psi +\phi )\otimes (\psi +\phi )\neq \psi \otimes \psi +\phi \otimes \phi \tag{21323}\end{equation}
when \(\psi ,\phi \neq 0\). So no natural diagonal exists: this is no-cloning. More generally, a dagger compact category with a natural diagonal is degenerate, its scalars collapsing.

Discard. On mixed states (below) the trace \(\operatorname {Tr}:\rho \mapsto \operatorname {Tr}\rho \) is natural for trace-preserving maps, \(\operatorname {Tr}\circ \Phi =\operatorname {Tr}\). This causality condition is no-signalling: discarding is allowed and copying is not. The quantum regime is affine but not cartesian.

344.5 Classical structures are bases

Definition. A classical structure on \(A\) is a special commutative dagger-Frobenius algebra: a comonoid \((\delta ,\epsilon )\) with \(\mu =\delta ^\dagger \), satisfying

\begin{equation} (\mu \otimes 1)\circ (1\otimes \delta )=\delta \circ \mu =(1\otimes \mu )\circ (\delta \otimes 1), \qquad \mu \circ \delta =1 . \tag{21324}\end{equation}

Theorem. In \(\mathbf {FHilb}\), classical structures correspond exactly to orthonormal bases \(\{|i\rangle \}\):

\begin{equation} \delta |i\rangle =|i\rangle \otimes |i\rangle , \qquad \epsilon |i\rangle =1 . \tag{21325}\end{equation}

Proof sketch. \(\mu \) makes \(A\) a commutative algebra. The Frobenius law and \(\mu \circ \delta =1\) make it a commutative C\(^{*}\)-algebra, hence \(\cong \mathbb C^n\). Its minimal idempotents \(\Pi _i\) are orthogonal, \(\Pi _i\Pi _j=\delta _{ij}\Pi _i\) and \(\sum \Pi _i=1\), and their images give the basis. \(\square \)

Copyable states. The copyable states of \(\delta \), those with \(\delta \psi =\psi \otimes \psi \), are exactly the basis vectors: the diagonal of the floor survives, but only on one basis at a time. A basis is a choice of what may be copied.

Measurement and dephasing. Measurement in the basis is the map from quantum to classical data given by \(\delta \). Its effect on a density matrix, writing \(\rho \) on the doubled system, is

\begin{equation} \rho \longmapsto \sum _i\Pi _i\,\rho \,\Pi _i , \tag{21326}\end{equation}
copying the basis label into the environment and discarding the copy.

344.6 Qubits and circuits in the ZX-calculus

Two complementary structures. On \(A=\mathbb C^2\) take the \(Z\) structure for \(\{|0\rangle ,|1\rangle \}\) and the \(X\) structure for \(\{|+\rangle ,|-\rangle \}\). They are complementary: each basis vector of one is unbiased with respect to the other, \(|\langle i|\pm \rangle |^2=\tfrac 12\).

Spiders. Composites of \(\delta ,\mu ,\epsilon ,\epsilon ^\dagger \) for one structure, with a phase, depend only on the numbers of inputs and outputs:

\begin{equation} Z^{m}_{n}(\alpha )=|0\cdots 0\rangle \langle 0\cdots 0|+e^{i\alpha }|1\cdots 1\rangle \langle 1\cdots 1| , \tag{21327}\end{equation}
and \(X^{m}_{n}(\alpha )\) is the same in the \(\pm \) basis. Connected spiders of one colour fuse, adding their phases:
\begin{equation} Z(\alpha )\circ Z(\beta )=Z(\alpha +\beta ). \tag{21328}\end{equation}

Single-qubit gates.

Two-qubit gates.

\begin{equation} \mathrm {CNOT}\propto \bigl (1\otimes X^{1}_{2}\bigr )\circ \bigl (Z^{2}_{1}\otimes 1\bigr ), \tag{21330}\end{equation}
a \(Z\)-copy of the control joined to an \(X\)-merge on the target. CZ is the same with a Hadamard on the connecting wire. Complementarity gives the bialgebra law: an \(X\)-merge followed by a \(Z\)-copy equals two \(Z\)-copies, a crossing, and two \(X\)-merges. On basis states both sides send \(|a,b\rangle \mapsto |a\oplus b,\ a\oplus b\rangle \), which is the copying behaviour of CNOT.

Fragments.

Complete rule sets exist for each fragment and for the full calculus: every true equation between diagrams is derivable.

344.7 Entanglement and teleportation from the triangle identity

Bell state and effect. The cup \(\eta =|00\rangle +|11\rangle \) is the unnormalised Bell state, and the cap \(\varepsilon =\eta ^\dagger \) is the Bell effect.

Teleportation. The triangle identity

\begin{equation} (\varepsilon \otimes 1)\circ (1\otimes \eta )=1 \tag{21331}\end{equation}
says: prepare a Bell pair, measure the input together with one half in the Bell basis, and the input reappears on the other half.

Corrections. The other Bell outcomes are \((\sigma \otimes 1)^\dagger \varepsilon \) for a Pauli \(\sigma \), and sliding \(\sigma \) along the wire leaves it on the output, where the correction \(\sigma ^{-1}\) removes it. Teleportation is the unit–counit identity of the adjunction \(A\otimes -\dashv A^{*}\otimes -\).

Map–state duality. Bending wires, \(f\mapsto (1\otimes f)\circ \eta \), is the bijection between maps \(A\to B\) and states of \(A^{*}\otimes B\), the Choi–Jamiołkowski isomorphism.

344.8 Mixed states and the Born rule

Doubling. Mixed states and channels form the category \(\mathrm {CPM}(\mathbf {FHilb})\), whose morphisms are maps of the form

\begin{equation} \rho \mapsto \sum _kK_k\,\rho \,K_k^\dagger , \tag{21332}\end{equation}
a map paired with its conjugate across the involution.

Pure states and the Born rule. A pure state \(\psi \) becomes \(\psi \otimes \bar \psi =|\psi \rangle \langle \psi |\), a projector. The Born weight of an effect \(\langle e|\) is the doubled scalar

\begin{equation} \langle e|\psi \rangle \overline {\langle e|\psi \rangle }=\operatorname {Tr}\bigl (|e\rangle \langle e|\,\rho \bigr ), \tag{21333}\end{equation}
positive because it pairs a scalar with its conjugate.

344.9 Summary

Cartesian Linear Quantum (\(\mathbf {FHilb}\))
identity \(A\vdash A\) yes yes yes
exchange yes yes yes
contraction (copy) natural only under \(!\) per basis
weakening (discard) natural only under \(!\) natural (trace)
negation \(\neg \neg \neq \mathrm {id}\) (intuitionistic) \(A^{\perp \perp }=A\) dagger \(f^{\dagger \dagger }=f\)
duals — \(\ast \)-autonomous compact, \(\otimes =\parr \)
logic intuitionistic linear categorical QM
models \(\mathbf {Set}\), toposes coherence spaces \(\mathbf {FHilb}\), \(\mathrm {CPM}\)

Circuit element ZX form From
qubit \(\mathbb C^2\) with \(Z\) and \(X\) structures two bases
basis classical structure idempotents \(\Pi _i\)
copy of basis states \(\delta |i\rangle =|ii\rangle \) diagonal per basis
\(R_Z\), \(R_X\) \(Z(\alpha )\), \(X(\alpha )\) phases on spiders
Paulis, \(S\), \(T\) \(\pi \), \(\tfrac \pi 2\), \(\tfrac \pi 4\) phases
Hadamard colour change, \(Z X Z\) Euler complementarity
CNOT \(Z\)-copy then \(X\)-merge bialgebra
CZ \(Z\)–\(H\)–\(Z\) colour change
measurement, dephasing \(\delta \), \(\sum \Pi _i\rho \Pi _i\) classical structure
Bell pair cup \(\eta \) compact closure
teleportation triangle identity adjunction
no-cloning no natural \(\delta \) linearity
Born rule doubled scalar CPM

pict

Figure 285: Z (green) and X (red) spiders with \(n\) inputs, \(m\) outputs and phase \(\alpha \). The Z spider is \(|0\cdots 0\rangle \langle 0\cdots 0|+e^{i\alpha }|1\cdots 1\rangle \langle 1\cdots 1|\); the X spider is the same in the \(|\pm \rangle \) basis.

pict

Figure 286: Spider fusion: connected spiders of one colour merge into one, and their phases add, \(Z(\alpha )\circ Z(\beta )=Z(\alpha +\beta )\).

pict

Figure 287: Colour change: a Hadamard (yellow box) on every leg turns a Z spider into an X spider with the same phase.

pict

Figure 288: Single-qubit gates as one-input, one-output spiders, up to global phase: \(R_Z(\alpha )=Z(\alpha )\), \(R_X(\alpha )=X(\alpha )\), Paulis at phase \(\pi \), \(S\) and \(T\) at \(\pi /2\) and \(\pi /4\), and the Hadamard box.

pict

Figure 289: Euler decomposition of the Hadamard, \(H\propto Z(\pi /2)\,X(\pi /2)\,Z(\pi /2)\), the same \(R_Z\sqrt {X}R_Z\) pattern used for native gates in Section 342.

pict

Figure 290: CNOT is a Z-copy on the control joined to an X-merge on the target; CZ joins two Z spiders through a Hadamard. Both agree with the circuit symbols up to a nonzero scalar.

pict

Figure 291: Bialgebra law from complementarity: an X-merge followed by a Z-copy equals two Z-copies, a crossing and two X-merges. Both sides send \(|a,b\rangle \mapsto |a\oplus b,\,a\oplus b\rangle \).

pict

Figure 292: Copying: the Z spider copies the states \(X(0)\propto |0\rangle \) and \(X(\pi )\propto |1\rangle \), its own basis states, and no others. The diagonal survives on one basis at a time.

pict

Figure 293: Measurement as a classical structure: copying in the Z basis and discarding the copy, on doubled wires, is the dephasing map \(\rho \mapsto \sum _i\Pi _i\rho \Pi _i\).

pict

Figure 294: Snake identity \((\varepsilon \otimes 1)\circ (1\otimes \eta )=1\): a Bell pair followed by a Bell effect is a plain wire. This is teleportation, with Pauli corrections sliding along the wire to the output.

344.10 Post’s Theorem and NAND from \(x^2=x\)

Setup. From \(x^2=x\): \(x\in \{0,1\}\), \(x^c:=1-x\), \(x\oplus y:=x+y-2xy\), \(f:\{0,1\}^n\to \{0,1\}\).

The five Post classes.

\(T_0\): 0-preservation.

\begin{equation} f(x)(1-x)\big |_{x=0} = f(0)\cdot 1 = f(0) = 0. \tag{21334}\end{equation}
\begin{equation} \boxed {f(x)(1-x)=0 \;\Longleftrightarrow \; f(0)=0.} \tag{21335}\end{equation}

\(T_1\): 1-preservation.

\begin{equation} (f(x)+x-1)\big |_{x=1} = f(1)+1-1 = f(1)-1 = 0. \tag{21336}\end{equation}
\begin{equation} \boxed {f(x)+x-1=0 \;\Longleftrightarrow \; f(1)=1.} \tag{21337}\end{equation}

\(M\): Monotonicity.

\begin{equation} x\leq y \;\Longleftrightarrow \; x(1-y)=0, \qquad f(x)\leq f(y) \;\Longleftrightarrow \; f(x)(1-f(y))=0. \tag{21338}\end{equation}
\begin{equation} \boxed {x\leq y \;\Longrightarrow \; f(x)\leq f(y).} \tag{21339}\end{equation}

\(L\): Linearity.

\begin{equation} x\oplus y = x+y-2xy, \qquad f(x\oplus y) = f(x)\oplus f(y) = f(x)+f(y)-2f(x)f(y). \tag{21340}\end{equation}
\begin{equation} \boxed {f\text { linear} \;\Longleftrightarrow \; f\text { preserves }\oplus .} \tag{21341}\end{equation}

\(S\): Self-duality.

\begin{equation} f(1-x)=1-f(x) \;\Longleftrightarrow \; f(x)+f(1-x)=1 \;\Longleftrightarrow \; f(x)f(1-x)=0. \tag{21342}\end{equation}
\begin{equation} \boxed {f(1-x)=1-f(x).} \tag{21343}\end{equation}

NAND violates all five.

\begin{equation} \mathrm {NAND}(x,y) = 1-xy. \tag{21344}\end{equation}

\(T_0\) violation:

\begin{equation} \mathrm {NAND}(0,0) = 1-0\cdot 0 = 1 \neq 0. \quad \boxed {\mathrm {NAND}(0,0)=1.} \tag{21345}\end{equation}

\(T_1\) violation:

\begin{equation} \mathrm {NAND}(1,1) = 1-1\cdot 1 = 0 \neq 1. \quad \boxed {\mathrm {NAND}(1,1)=0.} \tag{21346}\end{equation}

\(M\) violation:

\begin{equation} (0,0)\leq (1,1),\quad \mathrm {NAND}(0,0)=1,\quad \mathrm {NAND}(1,1)=0,\quad 1\not \leq 0. \quad \boxed {\mathrm {NAND}\text { not monotone.}} \tag{21347}\end{equation}

\(L\) violation:

\begin{equation} \mathrm {NAND}(x,y)=1-xy \;\text {contains quadratic term }xy. \quad \boxed {\mathrm {NAND}\text { not linear.}} \tag{21348}\end{equation}
Explicitly: \(\mathrm {NAND}(x\oplus y,z)\neq \mathrm {NAND}(x,z)\oplus \mathrm {NAND}(y,z)\).

\(S\) violation:

\begin{align} \mathrm {NAND}(1-x,1-y) &= 1-(1-x)(1-y) = x+y-xy, \tag{21349}\\ 1-\mathrm {NAND}(x,y) &= xy. \tag{21350}\end{align}
\begin{equation} x+y-xy \neq xy. \quad \boxed {\mathrm {NAND}(1-x,1-y)\neq 1-\mathrm {NAND}(x,y).} \tag{21351}\end{equation}

Post’s completeness theorem.

\begin{equation} \boxed { \mathrm {NAND}=1-xy \;\Longrightarrow \; \mathrm {NAND}\notin T_0,\; \mathrm {NAND}\notin T_1,\; \mathrm {NAND}\notin M,\; \mathrm {NAND}\notin L,\; \mathrm {NAND}\notin S. } \tag{21352}\end{equation}
\begin{equation} \boxed {\mathrm {NAND}\text { violates all five Post classes} \;\Longrightarrow \; \langle \mathrm {NAND}\rangle = \text {All Boolean functions.}} \tag{21353}\end{equation}

Complete chain.

\begin{equation} {\scriptsize \boxed { A=A \;\Longrightarrow \; x^2=x \;\Longrightarrow \; x\in \{0,1\} \;\Longrightarrow \; \begin {cases} T_0: f(x)(1-x)=0 \\[4pt] T_1: f(x)+x-1=0 \\[4pt] M: x(1-y)=0\Rightarrow f(x)(1-f(y))=0 \\[4pt] L: f(x\oplus y)=f(x)\oplus f(y) \\[4pt] S: f(x)+f(1-x)=1 \end {cases} \;\Longrightarrow \; \langle G\rangle = T=1 \iff G\notin T_0,T_1,M,L,S. }} \tag{21354}\end{equation}

Remark 344.1 (Post’s theorem as \(x^2=x\)). Post’s five classes are five ways \(x^2=x\) can be restricted: \(T_0\) fixes \(f(0)=0\) (identity at \(0\)), \(T_1\) fixes \(f(1)=1\) (identity at \(1\)), \(M\) preserves the order \(x(1-y)=0\), \(L\) preserves XOR (\(\oplus \)), \(S\) enforces self-duality \(f(x)+f(1-x)=1\). Each constraint is \(x^2=x\) with an additional symmetry imposed. A gate set escaping all five can generate \(x^2=x\) in every form — it reaches \(T=1\), which is \(A=A\). NAND\(=1-xy\) violates all five because it is the complement of the product: it negates \(0\)-preservation (\(\mathrm {NAND}(0,0)=1\)), \(1\)-preservation (\(\mathrm {NAND}(1,1)=0\)), and monotonicity, linearity, and self-duality simultaneously. This is the algebraic expression of \(\neg (A\wedge A)=\neg A=1-A\): NAND is \(A=A\) negated, which is why it generates \(A=A\) in all its forms.

344.11 NAND from \(\Pi _O+\Pi _U=I\)

Thesis. NAND\((x,y)=1-xy\) is not a primitive gate. It is the partition complement \(\Pi _U^{(xy)}=I-\Pi _O^{(x)}\Pi _O^{(y)}\), forced by \(\Pi _O+\Pi _U=I\).

Step 1: Partition structure.

\begin{equation} \Pi _O+\Pi _U=I,\qquad \Pi _O\Pi _U=0,\qquad \Pi _O^2=\Pi _O,\qquad \Pi _U^2=\Pi _U,\qquad \Pi _U=I-\Pi _O. \tag{21355}\end{equation}
Setting \(A:=\Pi _O\):
\begin{equation} \Pi _U=1-A,\qquad A^2=A,\qquad A(1-A)=0,\qquad A+(1-A)=1. \tag{21356}\end{equation}
The totality:
\begin{equation} T:=\Pi _O+\Pi _U = A+(1-A) = 1 = T.\quad \checkmark \tag{21357}\end{equation}

Step 2: Two-variable partition.

Assign independent projectors to variables \(x\) and \(y\):

\begin{equation} x:=\Pi _O^{(x)},\qquad y:=\Pi _O^{(y)},\qquad x,y\in \{0,1\}. \tag{21358}\end{equation}
The product:
\begin{equation} xy = \Pi _O^{(x)}\Pi _O^{(y)},\qquad xy=1\Leftrightarrow x=1,y=1,\qquad xy=0\Leftrightarrow x=0\text { or }y=0. \tag{21359}\end{equation}

Step 3: NAND as partition complement.

The complement of \(xy\) in the partition:

\begin{equation} (xy)^c = 1-xy = I-\Pi _O^{(x)}\Pi _O^{(y)}. \tag{21360}\end{equation}
By \(\Pi _O+\Pi _U=I\), the complement of the O-sector product is the U-sector of the joint system:
\begin{equation} \boxed {\Pi _U^{(xy)} = I-\Pi _O^{(x)}\Pi _O^{(y)} = 1-xy.} \tag{21361}\end{equation}

Step 4: Union decomposition.

From \(\Pi _O^{(x)}+\Pi _U^{(x)}=1\) and \(\Pi _O^{(y)}+\Pi _U^{(y)}=1\):

\begin{equation} (1-x)+(1-y)+xy = 1-xy, \tag{21362}\end{equation}
\begin{equation} 1-x-y+xy = (1-x)(1-y), \tag{21363}\end{equation}
\begin{equation} 1-xy = (1-x)+(1-y)-(1-x)(1-y). \tag{21364}\end{equation}
This is the inclusion-exclusion formula for the union \(x^c\cup y^c = (xy)^c\) (De Morgan):
\begin{equation} \neg (x\wedge y) = \neg x\vee \neg y. \tag{21365}\end{equation}
\begin{equation} \boxed {\mathrm {NAND}(x,y) = 1-xy.} \tag{21366}\end{equation}
\begin{equation} \boxed {\Pi _U^{(xy)} = I-\Pi _O^{(x)}\Pi _O^{(y)}.} \tag{21367}\end{equation}
\begin{equation} \boxed {\Pi _O+\Pi _U=I \;\Longrightarrow \; \text {complement} \;\Longrightarrow \; \mathrm {NAND}=1-xy.} \tag{21368}\end{equation}

Complete chain.

\begin{equation} \boxed { A=A \;\Longrightarrow \; \Pi _O^2=\Pi _O \;\Longrightarrow \; \Pi _O+\Pi _U=I \;\Longrightarrow \; \Pi _U^{(xy)}=I-\Pi _O^{(x)}\Pi _O^{(y)} \;\Longrightarrow \; \mathrm {NAND}(x,y)=1-xy. } \tag{21369}\end{equation}

Remark 344.2 (NAND as partition complement). NAND is not a primitive logical operation chosen by convention. It is the partition complement: the U-sector of the joint O-projection \(\Pi _O^{(x)}\Pi _O^{(y)}\). \(\Pi _O+\Pi _U=I\) forces the complement \(I-\Pi _O^{(x)}\Pi _O^{(y)}\) to exist for every product of projectors, and this complement is exactly \(\mathrm {NAND}(x,y)=1-xy\).

The De Morgan law \(\neg (x\wedge y)=\neg x\vee \neg y\) is the partition identity \(I-\Pi _O^{(x)}\Pi _O^{(y)}=(I-\Pi _O^{(x)})+(I-\Pi _O^{(y)}) -(I-\Pi _O^{(x)})(I-\Pi _O^{(y)})\), which is inclusion-exclusion on the U-sectors.

Since NAND violates all five Post classes (Section 344.10), and NAND is forced by \(\Pi _O+\Pi _U=I\), the functional completeness of NAND is the completeness of the partition: \(\Pi _O+\Pi _U=I\) generates all Boolean functions, which is \(T=1\), which is \(A=A\).

344.12 De Morgan Laws from \(\Pi _O+\Pi _U=I\)

Setup.

\begin{equation} \Pi _O+\Pi _U=I,\qquad \Pi _U=I-\Pi _O,\qquad A^c:=1-A,\qquad A\cap B:=AB,\qquad A\cup B:=A+B-AB, \tag{21370}\end{equation}
with \(A^2=A\), \(B^2=B\).

De Morgan 1: \((A\cap B)^c = A^c\cup B^c\).

Scalar proof.

\begin{equation} (A\cap B)^c = 1-AB. \tag{21371}\end{equation}
\begin{align} A^c\cup B^c &= (1-A)+(1-B)-(1-A)(1-B)\notag \\ &= 2-A-B-(1-A-B+AB)\notag \\ &= 1-AB. \tag{21372}\end{align}
\begin{equation} \boxed {(A\cap B)^c = A^c\cup B^c.}\quad \checkmark \tag{21373}\end{equation}

Projector proof.

\begin{align} \Pi _{(A\cap B)^c} &= I-\Pi _A\Pi _B, \tag{21374}\\ \Pi _{A^c\cup B^c} &= (I-\Pi _A)+(I-\Pi _B)-(I-\Pi _A)(I-\Pi _B)\notag \\ &= 2I-\Pi _A-\Pi _B-(I-\Pi _A-\Pi _B+\Pi _A\Pi _B)\notag \\ &= I-\Pi _A\Pi _B. \tag{21375}\end{align}
\begin{equation} \boxed {\Pi _{(A\cap B)^c} = \Pi _{A^c\cup B^c}.}\quad \checkmark \tag{21376}\end{equation}

De Morgan 2: \((A\cup B)^c = A^c\cap B^c\).

Scalar proof.

\begin{align} (A\cup B)^c &= 1-(A+B-AB)\notag \\ &= 1-A-B+AB\notag \\ &= (1-A)(1-B)\notag \\ &= A^cB^c. \tag{21377}\end{align}
\begin{equation} \boxed {(A\cup B)^c = A^c\cap B^c.}\quad \checkmark \tag{21378}\end{equation}

Projector proof.

\begin{align} \Pi _{(A\cup B)^c} &= I-(\Pi _A+\Pi _B-\Pi _A\Pi _B)\notag \\ &= I-\Pi _A-\Pi _B+\Pi _A\Pi _B\notag \\ &= (I-\Pi _A)(I-\Pi _B)\notag \\ &= \Pi _{A^c}\Pi _{B^c}. \tag{21379}\end{align}
\begin{equation} \boxed {\Pi _{(A\cup B)^c} = \Pi _{A^c\cap B^c}.}\quad \checkmark \tag{21380}\end{equation}
\begin{equation} \boxed { \Pi _O+\Pi _U=I \;\Longrightarrow \; \text {complement structure} \;\Longrightarrow \; \text {De Morgan identities.} } \tag{21381}\end{equation}

Complete chain.

\begin{equation} \boxed { A=A \;\Longrightarrow \; \Pi _O^2=\Pi _O \;\Longrightarrow \; \Pi _O+\Pi _U=I \;\Longrightarrow \; \Pi _{A^c}=I-\Pi _A \;\Longrightarrow \; \begin {cases} \Pi _{(A\cap B)^c}=\Pi _{A^c\cup B^c} \\[4pt] \Pi _{(A\cup B)^c}=\Pi _{A^c\cap B^c} \end {cases} } \tag{21382}\end{equation}

Remark 344.3 (De Morgan as partition complement). The De Morgan laws are the projector expressions of \(\Pi _O+\Pi _U=I\):

Both identities follow from a single algebraic fact: \((I-\Pi _A)(I-\Pi _B)=I-\Pi _A-\Pi _B+\Pi _A\Pi _B\), which is the expansion of the product of two complements, forced by \(\Pi _O+\Pi _U=I\). De Morgan is \(\Pi _O+\Pi _U=I\) applied twice, which is \(A+\neg A=1\).