|
34 | 34 | \addbibresource{refs/refs.biblatex.bib}
|
35 | 35 | \pagenumbering{gobble}
|
36 | 36 |
|
37 |
| -\title{\vspace{-3em}Full abstraction for digital circuits: \textbf{Extended abstract}} |
| 37 | +\title{\vspace{-3em}Fully abstract categorical semantics for digital circuits: \textbf{Extended abstract}} |
38 | 38 | \author{\textbf{George Kaye}, David Sprunger and Dan R. Ghica}
|
39 | 39 |
|
40 | 40 | \begin{document}
|
41 | 41 | \maketitle
|
42 | 42 |
|
43 |
| - \paragraph*{Motivation.} |
44 |
| - Digital circuits are ubiquitous in today's society, so it is essential that we have easy ways to verify their correctness and reason with them. |
45 |
| - Conventionally, this is done by translation into an executable model such as an automaton, which can be simulated to observe its behaviour. |
46 |
| - An alternative approach, used commonly in software, is to reason \emph{syntactically}: programs are formulated equationally and can be reduced step by step by identifying \emph{redexes} in terms. |
47 |
| - When provided with inputs, the goal of such a system is to apply redexes and eventually return an output value. |
| 43 | + \paragraph*{Contribution.} |
| 44 | + It is essential that we have ways to verify the correctness of digital circuits and reason with them. |
| 45 | + Conventionally, this is done by translation into an executable model which can be simulated to observe its behaviour. |
| 46 | + An alternative approach, used in software, is to reason \emph{syntactically}: programs are formulated equationally and can be reduced step by step. |
| 47 | + When provided with inputs, the goal of such a system is to apply reductions and derive an output value. |
48 | 48 |
|
49 |
| - Such an equational system was first presented in~\cite{ghica2016categorical,ghica2017diagrammatic}, in which digital circuits with delay and feedback are modelled as morphisms in a freely generated traced cartesian category, or \emph{dataflow category}~\cite{cazanescu1990new,cazanescu1994feedback}. |
50 |
| - However, there were some informalities in the presentation, and, crucially, the framework was not guaranteed to reduce circuits with \emph{non-delay-guarded feedback} to a value. |
| 49 | + Such an equational system was first presented in~\cite{ghica2016categorical,ghica2017diagrammatic}, in which digital circuits with delay and (instant) feedback are modelled as morphisms in a freely generated traced cartesian category, or \emph{dataflow category}~\cite{cazanescu1994feedback,hasegawa1997recursion}. |
| 50 | + However, the presentation was informal and, crucially, not complete, and could not reduce all circuits to a stream of values. |
51 | 51 | Our work brings this project to its conclusion, formalising the categorical semantics and completing the set of equations.
|
52 | 52 |
|
53 | 53 | \paragraph*{Syntax.}
|
54 |
| - Before we can start constructing circuits, we must specify the components we can use. |
55 | 54 |
|
56 | 55 | \begin{definition}[Circuit signature]
|
57 | 56 | 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 | 57 | \end{definition}
|
59 | 58 |
|
60 | 59 | \noindent
|
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. |
| 60 | + The distinct elements \(\bullet\) and \(\circ\) represent a \emph{disconnected wire} (a \emph{lack} of information) and a \emph{short circuit} (\emph{inconsistent} information) respectively. |
62 | 61 | Using a signature, digital circuits are constructed as morphisms in a freely generated symmetric traced monoidal category (STMC).
|
63 | 62 | To aid in the presentation, we shall use the graphical calculus of \emph{string diagrams}~\cite{joyal1991geometry,joyal1996traced,selinger2011survey}.
|
64 | 63 |
|
|
85 | 84 | The final generator is a \emph{delay} generator: one can think of this as delaying its inputs for one tick of the clock.
|
86 | 85 | We write arbitrary sequential circuits obtained by composing generators together as green squares \iltikzfig{circuits/components/circuits/f-seq}.
|
87 | 86 | 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. |
| 87 | + When restricted to the combinational circuits, this work is similar to~\cite{lafont2003algebraic}. |
| 88 | + Where the approaches diverge is the inclusion of delay and feedback. |
89 | 89 |
|
90 | 90 | \paragraph*{Semantics.}
|
91 | 91 |
|
92 |
| - Circuits specified syntactically have no computational content associated with them. |
| 92 | + Circuits specified syntactically have no computational content. |
93 | 93 | To add \emph{semantics} to circuits, first the signature must be interpreted in some domain.
|
94 | 94 |
|
95 | 95 | \begin{definition}[Interpretation]\label{def:interpretation}
|
96 |
| - Let \(\circuitsignature = (\circuitsignaturevalues,\circuitsignaturegates)\) be a circuit signature. |
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}\). |
| 96 | + Let \(\circuitsignature = (\circuitsignaturevalues,\circuitsignaturegates)\) be a signature. |
| 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 \((g,m) \in \circuitsignaturegates\) to a monotone function \(\morph{\overline{g}}{\valuetuple{m}}{\values}\). |
98 | 98 | \end{definition}
|
99 | 99 |
|
100 | 100 | \begin{figure}[p]
|
|
170 | 170 |
|
171 | 171 | \begin{theorem}[\cite{ghica2022full}]
|
172 | 172 | Let \(\scircsigmai\) be the category obtained by quotienting \(\scircsigma\) by \(\eqaxioms{\mathcal{B}}\).
|
173 |
| - Then, \(\scircsigmai \cong \streami\). |
| 173 | + Then, there is an isomorphism of categories \(\scircsigmai \cong \streami\). |
174 | 174 | \end{theorem}
|
175 | 175 |
|
176 | 176 | \paragraph*{Equational reasoning.}
|
177 | 177 |
|
178 |
| - Circuits of different structure can have the same semantics as stream functions. |
| 178 | + Circuits of non-equal syntax can have the same semantics as stream functions. |
179 | 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}.
|
180 | 180 | Equations are identities that hold in the quotient category \(\scircsigmai\).
|
181 | 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}\).
|
|
224 | 224 | \label{fig:closed-circuit-axioms}
|
225 | 225 | \end{figure}
|
226 | 226 |
|
| 227 | + \begin{figure}[p] |
| 228 | + \centering |
| 229 | + \begin{align*} |
| 230 | + \iltikzfig{strings/traced/trace-rhs.seq} |
| 231 | + = \iltikzfig{circuits/examples/reasoning/unfolding/unfolding-1} |
| 232 | + = \iltikzfig{circuits/examples/reasoning/unfolding/unfolding-2} |
| 233 | + = \iltikzfig{circuits/examples/reasoning/unfolding/unfolding-3} |
| 234 | + \end{align*} |
| 235 | + \caption{Deriving the \emph{unfolding} rule using equations in \(\mathcal{C}\).} |
| 236 | + \label{fig:unfolding} |
| 237 | + \end{figure} |
| 238 | + |
227 | 239 | \paragraph*{Productivity.}
|
228 |
| - A common use of equational reasoning is to take a circuit and reduce it to its output values. |
| 240 | + A common use of equational reasoning is to take a circuit and reduce it to its stream of output values. |
229 | 241 |
|
230 | 242 | \begin{definition}[Productivity]
|
231 | 243 | For a set of equations \(\mathcal{E}\), a closed sequential circuit \iltikzfig{circuits/components/fcirc-closed-traced} is called \emph{productive under} \(\mathcal{E}\) if there exist values \iltikzfig{circuits/components/values/vs} and sequential circuit \iltikzfig{circuits/components/gcirc-closed-traced} such that
|
|
240 | 252 | A set of equations was presented in~\cite{ghica2016categorical}.
|
241 | 253 | 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.
|
242 | 254 | While in some circuits `instant feedback' is useful~\cite{riedel2004cyclic,mendler2012constructive}, in other cases it can result in an unproductive circuit.
|
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. |
| 255 | + To tackle this, we use \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. |
244 | 256 |
|
245 | 257 | \begin{definition}
|
246 | 258 |
|
|
269 | 281 |
|
270 | 282 | \noindent
|
271 | 283 | The complete set of equations \(\mathcal{C}\) for closed circuits under \emph{any} interpretation is shown in \cref{fig:closed-circuit-axioms}.
|
| 284 | + An important consequence of these is that the \emph{unfolding} rule for circuits with feedback can be derived, illustrated in \cref{fig:unfolding}. |
272 | 285 |
|
273 | 286 | \begin{theorem}
|
274 | 287 | Any closed sequential circuit \iltikzfig{circuits/components/circuits/f-seq-closed} is productive under \(\mathcal{C}\).
|
|
291 | 304 | All that remains is to add equations for equivalences between gates
|
292 | 305 |
|
293 | 306 | \begin{definition}
|
294 |
| - We say that a set of equations \(\mathcal{E}\), where each \(e \in \mathcal{E}\) contains at least one gate, is \emph{combinationally complete} for an interpretation \(\interpretation\) if for all combinational circuits \(\iltikzfig{circuits/components/circuits/f-comb}\) and \(\iltikzfig{circuits/components/circuits/g-comb}\), if \(\circuittostream[\iltikzfig{circuits/components/circuits/f-comb}]{\interpretation} = \circuittostream[\iltikzfig{circuits/components/circuits/g-comb}]{\interpretation}\) then there exists a sequence of axioms in \(\mathcal{E}\) such that \(\circuittostream[\iltikzfig{circuits/components/circuits/f-comb}]{\interpretation} \eqaxioms{\mathcal{E}}\circuittostream[\iltikzfig{circuits/components/circuits/g-comb}]{\interpretation}\). |
| 307 | + We say that a set of equations \(\mathcal{E}\), where each \(e \in \mathcal{E}\) contains at least one gate, is \emph{combinationally complete} for an interpretation \(\interpretation\) if for all combinational circuits \(\iltikzfig{circuits/components/circuits/f-comb}\) and \(\iltikzfig{circuits/components/circuits/g-comb}\), if \(\circuittostream[\iltikzfig{circuits/components/circuits/f-comb}]{\interpretation} = \circuittostream[\iltikzfig{circuits/components/circuits/g-comb}]{\interpretation}\) then there exists a sequence of equations in \(\mathcal{E}\) such that \(\circuittostream[\iltikzfig{circuits/components/circuits/f-comb}]{\interpretation} \eqaxioms{\mathcal{E}}\circuittostream[\iltikzfig{circuits/components/circuits/g-comb}]{\interpretation}\). |
295 | 308 | \end{definition}
|
296 | 309 |
|
297 | 310 | \begin{example}
|
298 | 311 | A set of equations combinationally complete for \(\interpretation_\star\) are listed in \cref{fig:combinational-axioms}.
|
299 | 312 | \end{example}
|
300 | 313 |
|
301 |
| - \begin{figure} |
| 314 | + \begin{figure}[p] |
302 | 315 | \centering
|
303 | 316 | \begin{align*}
|
304 | 317 | \iltikzfig{strings/structure/comonoid/unitality-l-lhs} &\eqaxioms{\mathcal{B}}
|
|
409 | 422 | &\eqaxioms{\mathcal{P}}
|
410 | 423 | \iltikzfig{circuits/axioms/belnap/de-morgan-2-rhs}
|
411 | 424 | \end{align*}
|
412 |
| - \caption{A set of equations \(\mathcal{P}\) which is combinationally complete for \(\interpretation_\star\).} |
| 425 | + \caption{A (not necessarily minimal) set of equations \(\mathcal{P}\) which is combinationally complete for \(\interpretation_\star\), adapted from~\cite{rodrigues1998translation}.} |
413 | 426 | \label{fig:combinational-axioms}
|
414 | 427 | \end{figure}
|
415 | 428 |
|
|
420 | 433 |
|
421 | 434 | \noindent
|
422 | 435 | 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}. |
| 436 | + Even so, this does not immediately yield an \emph{automatic} rewriting framework, as computationally it is difficult to handle the trace. |
| 437 | + A suitable strategy for tackling this problem was presented in~\cite{ghica2017diagrammatic} using graph rewriting on \emph{framed point graphs}; a current thread of work involves reworking this using recent work on rewriting with \emph{hypergraphs}~\cite{bonchi2016rewriting,kaye2021rewriting}. |
425 | 438 |
|
426 | 439 | \printbibliography[heading=bibintoc,title={References}]
|
427 | 440 |
|
|
0 commit comments