|
54 | 54 | Before we can start constructing circuits, we must specify the components we can use.
|
55 | 55 |
|
56 | 56 | \begin{definition}[Circuit signature]
|
57 |
| - Let \(\Sigma\) be a tuple \((\mathcal{V},\bullet,\circ,\mathcal{G})\) where \(\mathcal{V}\) is a finite set of \emph{values} with distinguished elements \(\bullet,\circ \in \mathcal{V}\), and \(\mathcal{G}\) is a finite set of tuples \((g,m)\) where \(g\) is a \emph{gate symbol} and \(m \in \nat\) is its \emph{arity}. |
| 57 | + Let \(\Sigma\) be a tuple \((\mathcal{V},\disconnected,\shortcircuit,\mathcal{G})\) where \(\mathcal{V}\) is a finite set of \emph{values} with distinguished elements \(\disconnected,\shortcircuit \in \mathcal{V}\), and \(\mathcal{G}\) is a finite set of tuples \((g,m)\) where \(g\) is a \emph{gate symbol} and \(m \in \nat\) is its \emph{arity}. |
58 | 58 | \end{definition}
|
59 | 59 |
|
60 | 60 | \noindent
|
61 | 61 | The distinct elements \(\bullet\) and \(\circ\) represent a \emph{disconnected wire} (a \emph{lack} of information) and a \emph{short circuit} (a \emph{glut} of information) respectively.
|
62 |
| - Using a signature, we can construct digital circuits as morphisms in a freely generated symmetric traced monoidal category. |
| 62 | + Using a signature, digital circuits are constructed as morphisms in a freely generated symmetric traced monoidal category (STMC). |
63 | 63 | To aid in the presentation, we shall use the graphical calculus of \emph{string diagrams}~\cite{joyal1991geometry,joyal1996traced,selinger2011survey}.
|
64 | 64 |
|
65 | 65 | \begin{definition}[Sequential circuits]
|
|
83 | 83 | The small boxes are \emph{values}: these represent the signals that can flow through our circuits.
|
84 | 84 | Next come the generators for each gate symbol in our signature, and three \emph{structural} generators for forking, joining and stubbing wires.
|
85 | 85 | The final generator is a \emph{delay} generator: one can think of this as delaying its inputs for one tick of the clock.
|
86 |
| - We write arbitrary sequential circuits obtained by composing generators together as squares \iltikzfig{circuits/components/circuits/f-seq}. |
87 |
| - If a circuit is \emph{combinational}, i.e. it contains no delay or trace, it is drawn in a lighter square \iltikzfig{circuits/components/circuits/f-comb}. |
| 86 | + We write arbitrary sequential circuits obtained by composing generators together as green squares \iltikzfig{circuits/components/circuits/f-seq}. |
| 87 | + If a circuit is \emph{combinational}, i.e. it contains no delay or trace, it is drawn in a lighter blue square \iltikzfig{circuits/components/circuits/f-comb}. |
| 88 | + When restricted to the combinational circuits, this work is similar to~\cite{lafont2003algebraic}: where the approaches diverge is the inclusion of delay and feedback. |
88 | 89 |
|
89 | 90 | \paragraph*{Semantics.}
|
90 | 91 |
|
|
93 | 94 |
|
94 | 95 | \begin{definition}[Interpretation]\label{def:interpretation}
|
95 | 96 | Let \(\circuitsignature = (\circuitsignaturevalues,\circuitsignaturegates)\) be a circuit signature.
|
96 |
| - A interpretation of \(\circuitsignature\) is a tuple \(\interpretation = (\mathbf{V}, \valueinterpretation,\gateinterpretation)\) where \(\values\) is a finite lattice, \(\valueinterpretation\) is a bijective function \(\valueinterpretation \setminus \{\bot,\top\} \to \values \setminus \{\top,\bot\}\), and \(\gateinterpretation\) is a map from each gate \((g,m) \in \circuitsignaturegates\) to a monotone function \(\morph{\overline{g}}{\valuetuple{m}}{\values}\). |
| 97 | + A interpretation of \(\circuitsignature\) is a tuple \(\interpretation = (\mathbf{V}, \valueinterpretation,\gateinterpretation)\) where \(\values\) is a finite lattice, \(\valueinterpretation\) is a bijective function \(\valueinterpretation \setminus \{\disconnected,\shortcircuit\} \to \values \setminus \{\top,\bot\}\), and \(\gateinterpretation\) is a map from each gate \((g,m) \in \circuitsignaturegates\) to a monotone function \(\morph{\overline{g}}{\valuetuple{m}}{\values}\). |
97 | 98 | \end{definition}
|
98 | 99 |
|
99 | 100 | \begin{figure}[p]
|
|
139 | 140 | \end{figure}
|
140 | 141 |
|
141 | 142 | \begin{example}\label{ex:interp}
|
142 |
| - Let \(\Sigma_\star = (\{\bot,\valuetrue,\valuefalse,\top\}, \bot, \top, \{\text{AND},\text{OR},\text{NOT}\}\)) be a signature. |
143 |
| - The corresponding generators for values are \(\iltikzfig{strings/structure/monoid/init}, \iltikzfig{circuits/components/values/true}, \iltikzfig{circuits/components/values/false}\) and \(\iltikzfig{strings/structure/monoid/init-white}\); and the gates \(\iltikzfig{circuits/components/gates/and}, \iltikzfig{circuits/components/gates/or}\) and \(\iltikzfig{circuits/components/gates/not}\). |
144 |
| - The values can be interpreted in the four value lattice \(\mathbf{V}_\star = \{\bot, 0, 1, \top\}\), where the join \(0 \ljoin 1 = \top\) and the meet \(0 \lmeet 1 = \bot\). |
145 |
| - Gates can be interpreted using Belnap logic~\cite{belnap1977useful}: the truth tables are listed in Figure~\ref{tab:truths}. |
| 143 | + Let \(\Sigma_\star = (\{\disconnected,\valuetrue,\valuefalse,\shortcircuit\}, \disconnected, \shortcircuit, \{(\text{AND},2),(\text{OR},2),(\text{NOT},1)\}\)) be a signature. |
| 144 | + In \(\scirc{\Sigma_\star}\), the values are \(\iltikzfig{strings/structure/monoid/init}, \iltikzfig{circuits/components/values/true}, \iltikzfig{circuits/components/values/false}\) and \(\iltikzfig{strings/structure/monoid/init-white}\); the gates are \(\iltikzfig{circuits/components/gates/and}, \iltikzfig{circuits/components/gates/or}\) and \(\iltikzfig{circuits/components/gates/not}\). |
| 145 | + Let \(\values_\star\) be the lattice \((\{\bot, 0, 1, \top\},\sqsubseteq)\), with the join defined as \(0 \ljoin 1 = \top\) and the meet defined as \(0 \lmeet 1 = \bot\). |
| 146 | + Let \(\{\wedge,\vee,\neg\}\) be the \emph{Belnap logic} operators~\cite{belnap1977useful}: the truth tables are listed in \cref{tab:truths}. |
146 | 147 | Let \(\interpretation_\star = (\mathbf{V}_\star, \{\mathsf{f} \mapsto 0, \mathsf{t} \mapsto 1\}, \{\text{AND} \mapsto \land, \text{OR} \mapsto \lor, \text{NOT} \mapsto \neg\})\).
|
147 | 148 | \end{example}
|
148 | 149 |
|
|
174 | 175 |
|
175 | 176 | \paragraph*{Equational reasoning.}
|
176 | 177 |
|
177 |
| - Circuits of different structure can have the same semantics. |
| 178 | + Circuits of different structure can have the same semantics as stream functions. |
178 | 179 | However, in general it is prohibitive to check that the corresponding streams for two circuits are equal~\cite{ghica2017diagrammatica}: it is more efficient to reason \emph{equationally}.
|
179 | 180 | Equations are identities that hold in the quotient category \(\scircsigmai\).
|
180 |
| - Given a set of equations \(\mathcal{E}\), we write \(\iltikzfig{circuits/components/circuits/f-seq} \eqaxioms{\mathcal{E}} \iltikzfig{circuits/components/circuits/g-seq}\) if \iltikzfig{circuits/components/circuits/f-seq} can be rewritten to \iltikzfig{circuits/components/circuits/g-seq} by equations in \(\mathcal{E}\). |
| 181 | + Given a set of equations \(\mathcal{E}\), we write \(\iltikzfig{circuits/components/circuits/f-seq} \eqaxioms{\mathcal{E}} \iltikzfig{circuits/components/circuits/g-seq}\) if \iltikzfig{circuits/components/circuits/f-seq} can be rewritten to \iltikzfig{circuits/components/circuits/g-seq} by applying equations in \(\mathcal{E}\). |
181 | 182 | Note that since we are using string diagrams, the axioms of STMCs are `absorbed' into the notation and always hold by moving wires and boxes around.
|
182 | 183 |
|
183 | 184 | \begin{figure}[p]
|
|
239 | 240 | A set of equations was presented in~\cite{ghica2016categorical}.
|
240 | 241 | However, they were not \emph{complete}: these axioms could not necessarily handle circuits with \emph{non-delay-guarded feedback}, in which every feedback loop does not pass through a delay generator.
|
241 | 242 | While in some circuits `instant feedback' is useful~\cite{riedel2004cyclic,mendler2012constructive}, in other cases it can result in an unproductive circuit.
|
242 |
| - To tackle this, we take inspiration from \emph{Kleene's fixpoint theorem}: since all the gates in an interpretation are monotonic, they have a least fixpoint; since our lattice is finite, we are able to compute it after a finite number of iterations. |
| 243 | + To tackle this, we take inspiration from \emph{Kleene's fixpoint theorem}: since all the gates in an interpretation are monotone, they have a least fixpoint; since our lattice is finite, we are able to compute it after a finite number of iterations. |
243 | 244 |
|
244 | 245 | \begin{definition}
|
245 | 246 |
|
|
267 | 268 | \end{definition}
|
268 | 269 |
|
269 | 270 | \noindent
|
270 |
| - The complete set of equations \(\mathcal{C}\) for closed circuits is shown in \cref{fig:closed-circuit-axioms}. |
| 271 | + The complete set of equations \(\mathcal{C}\) for closed circuits under \emph{any} interpretation is shown in \cref{fig:closed-circuit-axioms}. |
271 | 272 |
|
272 | 273 | \begin{theorem}
|
273 | 274 | Any closed sequential circuit \iltikzfig{circuits/components/circuits/f-seq-closed} is productive under \(\mathcal{C}\).
|
|
282 | 283 | In the closed case these equations suffice as the input values are propagated across the circuit, with gates evaluated one by one.
|
283 | 284 | However, when faced with an \emph{open circuit} the equations in \(\mathcal{C}\) are not sufficient.
|
284 | 285 | For example, consider the circuits \iltikzfig{circuits/examples/demorgan-lhs} and
|
285 |
| - \iltikzfig{circuits/examples/demorgan-rhs}: when interpreted under \(\interpretation_\star\) they have the same stream function by applying de Morgan's law. |
| 286 | + \iltikzfig{circuits/examples/demorgan-rhs}: when interpreted under \(\interpretation_\star\) their stream functions are equal by applying de Morgan's law. |
286 | 287 | To tackle this we must consider additional equivalences between \emph{combinational circuits}.
|
287 | 288 |
|
288 | 289 | All circuits will include the generators for the fork, join, stub and disconnected wire.
|
|
418 | 419 | \end{theorem}
|
419 | 420 |
|
420 | 421 | \noindent
|
421 |
| - This allows us to reason \emph{purely equationally} with digital circuits, rather than having to appeal to te |
422 |
| - An initial , and is still current work. |
423 |
| - |
424 |
| - |
| 422 | + This allows us to reason \emph{purely equationally} with digital circuits, rather than having to appeal to the potentially inefficient stream semantics. |
| 423 | + Even so, this does not immediately yield an \emph{automatic} rewriting framework: as computationally it is difficult to handle the trace. |
| 424 | + A suitable strategy for tackling this problem was presented in~\cite{ghica2017diagrammatic} using graph rewriting on \emph{framed point graphs}~\cite{ghica2017diagrammatic}; a current thread of work involves reworking this using recent work on rewriting with \emph{hypergraphs}~\cite{bonchi2016rewriting}. |
425 | 425 |
|
426 | 426 | \printbibliography[heading=bibintoc,title={References}]
|
427 | 427 |
|
|
0 commit comments