45 Communication Complexity — Det Composition
45.1 Overview
This module develops the monadic structure of finite-message deterministic protocols: CommunicationComplexity.Deterministic.FiniteMessage.Protocol.map, CommunicationComplexity.Deterministic.FiniteMessage.Protocol.bind, binary CommunicationComplexity.Deterministic.FiniteMessage.Protocol.prod, and \(k\)-fold CommunicationComplexity.Deterministic.FiniteMessage.Protocol.pi constructors, together with their correctness and complexity accounting theorems.
45.2 Declarations
Given a function \(g : \alpha \to \beta \) and a protocol \(p : \mathrm{Protocol}\, X\, Y\, \alpha \), CommunicationComplexity.Deterministic.FiniteMessage.Protocol.map \(g\) \(p\) is the protocol that runs \(p\) and then applies \(g\) to the output, yielding a protocol of type \(\mathrm{Protocol}\, X\, Y\, \beta \) with the same communication structure as \(p\).
For any function \(g : \alpha \to \beta \), protocol \(p\), and inputs \(x \in X\), \(y \in Y\),
For any function \(g : \alpha \to \beta \) and protocol \(p\), \((\texttt{map}\; g\; p).\texttt{complexity} = p.\texttt{complexity}\). Mapping a post-processing function over the output does not change the number of bits communicated.
Given a protocol \(p : \mathrm{Protocol}\, X\, Y\, \alpha \) and a continuation \(q : \alpha \to \mathrm{Protocol}\, X\, Y\, \beta \), bind \(p\) \(q\) sequentially composes them: each output leaf \(a\) of \(p\) is replaced by the sub-protocol \(q\, a\), giving a protocol of type \(\mathrm{Protocol}\, X\, Y\, \beta \).
For any protocol \(p\), continuation \(q\), and inputs \(x \in X\), \(y \in Y\),
For any finite nonempty type \(\iota \), function \(f : \iota \to \mathbb {N}\), and constant \(c \in \mathbb {N}\),
This is a technical arithmetic lemma used in complexity calculations.
If \(q\, a\) has the same complexity \(c\) for every output \(a\) of \(p\), then
Given \(p_1 : \mathrm{Protocol}\, X_1\, Y_1\, \alpha _1\) and \(p_2 : \mathrm{Protocol}\, X_2\, Y_2\, \alpha _2\), their product \(p_1.\texttt{prod}\; p_2 : \mathrm{Protocol}\, (X_1 \times X_2)\, (Y_1 \times Y_2)\, (\alpha _1 \times \alpha _2)\) runs \(p_1\) on the first components and \(p_2\) on the second components, pairing the outputs.
For protocols \(p_1\), \(p_2\) and inputs \(x = (x_1, x_2)\), \(y = (y_1, y_2)\),
The complexity of the product protocol satisfies
Given a family of protocols \(p_i : \mathrm{Protocol}\, X_i\, Y_i\, \alpha _i\) for \(i \in \mathrm{Fin}\, k\), pi \(p\) is the protocol of type \(\mathrm{Protocol}\, (\Pi _i\, X_i)\, (\Pi _i\, Y_i)\, (\Pi _i\, \alpha _i)\) that runs each \(p_i\) on the \(i\)-th components and collects all outputs into a tuple. It is defined by induction on \(k\), using bind, comap, and map.
For a family \(p\) and input tuples \(x\), \(y\),
The complexity of the \(k\)-fold product satisfies