Skip to content

Commit 634129c

Browse files
committed
Adding comments throughout
1 parent 74a08a2 commit 634129c

1 file changed

Lines changed: 33 additions & 9 deletions

File tree

paper.tex

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ \subsubsection{Wallace Tree}
365365

366366
\subsubsection{Dadda's Algorithm}
367367
Dadda's algorithm is a method for reducing the partial products of an $n$-bit multiplier to a two-row representation
368-
using \acrfull{fa} and \acrfull{ha}, after which a single \acrfull{cpa} produces the final result \cite{application_specific_arithmetic} \cite{dadda_tree}.
368+
using \acrfull{fa} and \acrfull{ha}, after which a single \ac{cpa} produces the final result \cite{application_specific_arithmetic} \cite{dadda_tree}.
369369

370370
\begin{figure}[h]
371371
\centering
@@ -408,15 +408,20 @@ \subsubsection{Dadda's Algorithm}
408408
\section{Formalization}
409409
In this section, we present the formalization of the bit heap data structure as well as the underlying hardware-level constructs and compression algorithms in Lean 4.
410410
We also discuss the correctness of the composition of adders and how we relate bit heaps to bit-vector arithmetic.
411+
\sam{I'd be more concise here - "In this section, we present the formalization of the bit heap data structure in Lean 4 and prove the correctness of existing compression algorithms."}
412+
\sam{I'd also add a short statement that because we're formalizing in Lean the reader will find that we're turning to recursive definitions a lot - as this allows for simpler proofs.}
413+
411414

412415
\subsection{Circuit}
413416
The building block of the bit heap data structure is a single bit.
414417
In our formalization, the Circuit data structure represent a boolean expression, that is named by a natural-number index.
418+
\sam{Circuit is not a data structure, it is a language. Also you've got inconsistent presentation of Circuit (vs \texttt{Circuit}) - consistency is essential so I'd suggest creating a macro.}
415419

416420
A \texttt{Circuit} describes a logical expression, that can be a binary variable, constant, or any binary operation over composition Circuit objects.
417421
The bits represented by \texttt{Circuit} are symbolic and do not hold any value.
418422
A Circuit is assigned a value under a bit environment $\sigma$,
419423
which maps the \texttt{Circuit} to Boolean values.
424+
\sam{The bit environment maps a symbolic bit to a boolean value - not an arbitrary \texttt{Circuit}. The mapping of higher-level expressions is handled by your semantics.}
420425

421426
\[
422427
\begin{array}{r@{\;}c@{\;}l@{\qquad}l}
@@ -427,6 +432,7 @@ \subsection{Circuit}
427432
\Circ \ni c &::=& b_n \mid 0 \mid 1 \mid c \circledast c &
428433
\end{array}
429434
\]
435+
\sam{What is $\barwedge$? You need to define it. Secondly we're missing an inversion/negation operator?}
430436

431437
\[
432438
\begin{array}{r@{\;}c@{\;}l}
@@ -439,15 +445,19 @@ \subsection{Circuit}
439445
&=& \mathcal{C}\sem{c_0}\sigma \circledast \mathcal{C}\sem{c_1}\sigma
440446
\end{array}
441447
\]
448+
\sam{It would be more conventional to just define a set of Variables - rather than a index - is this strictly necessary? Can we just define a set of Vars? Width is also unused here.}
442449

443450
We write $\lift{\cdot} : \mathbb{B} \to \{0,1\}$ for the conversion of a
444451
Boolean into the natural number, so that $\lift{\mathcal{C}\sem{c}\sigma}$ is
445452
the numeric contribution of circuit $c$.
453+
\sam{Think you probably need a lot more explanation here - you just dump a lot of equations that will probably confuse the average DATE reviewer.
454+
Secondly, you can probably simplify to just $\sem{\cdot}_\sigma$, and you need to say that $\sem{\cdot}_\sigma: \texttt{Circuit} \to \mathbb{B}$ (or whatever is the correct mapping).}
446455

456+
\sam{Currently this just looks like a semantics of Boolean arithmetic - so it may not be necessary to spell it out so much.}
447457
\subsection{Bit Heap Data Structure}
448458
A bit heap of width $w$ is a vector of $w$ columns, where the column at index $k$ holds the bits of weight $2^k$.
449459
A \texttt{Column} is a set of \texttt{Circuit} elements.
450-
460+
\sam{Inconsistent formatting of column.}
451461
\[
452462
\begin{array}{r@{\;}c@{\;}l@{\qquad}l}
453463
\Col \ni \gamma &::=& \{c_0,\dots,c_n\} \\[2pt]
@@ -464,8 +474,9 @@ \subsection{Bit Heap Data Structure}
464474
\mathtt{BitHeap}\;w \;\triangleq\; \mathtt{Vector}\;\mathtt{Column}\;w
465475
\]
466476
\end{definition}
467-
468-
To compute the value of the bit heap, we compute the weighted sum of the value held by columns, which is the sum of the values of the bits under a certain environment.
477+
\sam{You seem to give two definitions and they are not consistent - one shows a Vector the other looks like a set?}
478+
\sam{I really feel like an example would be hugely valuable here!}
479+
To compute the value of the bit heap, we compute the weighted sum of the value held by columns, which is the sum of the values of the bits under a certain environment. \sam{environment or bit environment?}
469480
The value of the bit heap is computed in modular arithmetic. Therefore, all correctness statements below are stated as modulo $2^w$.
470481

471482
\[
@@ -502,6 +513,7 @@ \subsection{Bit Heap Data Structure}
502513
\bottomrule
503514
\end{tabular}
504515
\end{table*}
516+
\sam{This now feels like an excessive use of notation - coulde we not just write a double sum to avoid create $\mathcal{G}$ - I also think the mapping to $\mathbb{Z}$ is not correct - it should be $\mathbb{N}$ as the outer mod should just be applied when you modify the circuits (the positive residue I think this is called)?}
505517

506518
The value of a bit heap is obtained by summing each column and combining the columns with Horner's method:
507519
\begin{equation}
@@ -518,13 +530,18 @@ \subsection{Bit Heap Data Structure}
518530

519531
Our framework is based on modular arithmetic, so correctness statements for operations on a bit heap hold only modulo $2^w$.
520532
That means when a carry is produced on the last column, it is dropped.
533+
\sam{Repeated the point about moduler arithmetic - you said this earlier - the carry statement is new though - could this be combined?}
521534

522535
Two theorems describe the primitive operations. Adding a bit $c$ at
523536
column $k$ increases the value by $2^{k}\lift{\mathcal{C}\sem{c}\sigma}$
524-
(\ref{thm:addBit}). Removing a bit $c$ from column $k$, provided
537+
(\ref{thm:addBit}).
538+
\sam{Do we need to say something about mod $2^w$ here? An intuitive description would also help like for all bitheaps...}
539+
Removing a bit $c$ from column $k$, provided
525540
$c$ is present in that column, decreases it by the same amount
526541
(\ref{thm:removeBit}).
527542

543+
\sam{Rename the theorems to something more concise e.g. addBit?}
544+
528545
\begin{theorem}[\texttt{evalMod\_heap\_addBit}]
529546
\label{thm:addBit}
530547
For all $h : \Heap_w$, $k : \mathbb{N}$, $c : \Circ$ and
@@ -551,18 +568,23 @@ \subsection{Bit Heap Data Structure}
551568

552569
Since a \texttt{Column} is defined as a set, it cannot contain duplicates.
553570
Therefore, if the same bit is added to a \texttt{Column} at index k, we propagete the bit to the next column, since $2^{k}c + 2^{k}c = 2^{k+1}c$, and the propagation repeats if the next column already contains the circuit as well.
554-
Effectively this results in building the bit heap in an optimized way during construction.
571+
\sam{To distinguish between what is done automatically namely the bit propagation try to avoid saying "we" - this makes it sound like a manual process. Instead say "the bit is automatically propagted to the next column".}
572+
Effectively the bit heap is optimized during its construction.
555573
\autoref{thm:addBit} is proved by functional induction on \texttt{addBit}, following the carry propagation described above.
556-
574+
\sam{How is thm:removeBit proved? Is it the same or different?}
557575

558576
\subsection{Compression Algorithms}
559577
\label{sec:compression}
578+
579+
\sam{I feel like the reader has lost the purpose here - why are we now compressing the bit heap? They've long forgotten its purpose - a running example would help a lot.}
560580
Compression reduces the height of a bit heap to two, after which a
561-
single \acrshort{cpa} produces the result \cite{application_specific_arithmetic}.
581+
single \ac{cpa} produces the result \cite{application_specific_arithmetic}.
582+
\sam{You should just be using \\ac everywhere - as then the package figures out the first time you use an accronym and inserts the full definition.}
562583
The reduction is carried out by compressors, half adders ($2{:}2$),
563584
full adders ($3{:}2$), or in general any $N{:}M$ compressor with
564585
$N \ge M$. We formalize half and full adders, and build compressor trees
565586
from them. However, our framework can easily be extended for any compressor.
587+
\sam{Surely you're discussing FAs and HAs in the background? So this feels repetitive?}
566588

567589
\[
568590
\begin{array}{r@{\;}c@{\;}l@{\qquad}l}
@@ -575,6 +597,7 @@ \subsection{Compression Algorithms}
575597
The effects of a single step on the heap with the applicability conditions are shown in Table~\ref{tab:steps}.
576598
Both applicability conditions are forced by Theorem~\ref{thm:removeBit}, which requires bits to be present and that they are pairwise distinct.
577599
Writing $s(h)$ for the heap obtained by applying step $s$ to $h$, we prove that each step preserves the value of the heap.
600+
\sam{In the applicability conditions, you don't reference that k< width? And why not just phrase the effect in terms of addBit and removeBit?}
578601

579602
\begin{theorem}[\texttt{halfAdder\_correct\_mod}, \texttt{fullAdder\_correct\_mod}]
580603
\label{thm:step-correct}
@@ -587,6 +610,7 @@ \subsection{Compression Algorithms}
587610

588611
With proofs being similar for both half and full adder cases, the proofs rewrite the Theorems \ref{thm:addBit} and \ref{thm:removeBit} until the
589612
goal becomes an arithmetic identity over the Boolean values of bits, after which a case split on the boolean values closes the goal.
613+
\sam{Totally impenetrable to a reader - what does any of this mean?}
590614

591615
A compression algorithm produces a chain of compressors.
592616
Applicability is a condition on the heap the step is applied to, so it must be checked against the intermediate bit heap, not the original.
@@ -604,7 +628,7 @@ \subsection{Compression Algorithms}
604628
\mathcal{H}\sem{h}\sigma \;=\; \mathcal{H}\sem{S(h)}\sigma.
605629
\]
606630
\end{theorem}
607-
631+
\sam{Didn't define $S(h)$?}
608632
\autoref{thm:chain-correct} is proven by induction on the chain, using Theorem~\ref{thm:step-correct} for the base case and the induction hypothesis for the tail of the chain.
609633

610634
In our framework, we separate the correctness of the compression from the generation of the chain.

0 commit comments

Comments
 (0)