You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: paper.tex
+33-9Lines changed: 33 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -365,7 +365,7 @@ \subsubsection{Wallace Tree}
365
365
366
366
\subsubsection{Dadda's Algorithm}
367
367
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}.
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.
410
410
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
+
411
414
412
415
\subsection{Circuit}
413
416
The building block of the bit heap data structure is a single bit.
414
417
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.}
415
419
416
420
A \texttt{Circuit} describes a logical expression, that can be a binary variable, constant, or any binary operation over composition Circuit objects.
417
421
The bits represented by \texttt{Circuit} are symbolic and do not hold any value.
418
422
A Circuit is assigned a value under a bit environment $\sigma$,
419
423
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.}
420
425
421
426
\[
422
427
\begin{array}{r@{\;}c@{\;}l@{\qquad}l}
@@ -427,6 +432,7 @@ \subsection{Circuit}
427
432
\Circ\ni c &::=& b_n \mid 0 \mid 1 \mid c \circledast c &
428
433
\end{array}
429
434
\]
435
+
\sam{What is $\barwedge$? You need to define it. Secondly we're missing an inversion/negation operator?}
\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.}
442
449
443
450
We write $\lift{\cdot} : \mathbb{B} \to\{0,1\}$ for the conversion of a
444
451
Boolean into the natural number, so that $\lift{\mathcal{C}\sem{c}\sigma}$ is
445
452
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).}
446
455
456
+
\sam{Currently this just looks like a semantics of Boolean arithmetic - so it may not be necessary to spell it out so much.}
447
457
\subsection{Bit Heap Data Structure}
448
458
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$.
449
459
A \texttt{Column} is a set of \texttt{Circuit} elements.
450
-
460
+
\sam{Inconsistent formatting of column.}
451
461
\[
452
462
\begin{array}{r@{\;}c@{\;}l@{\qquad}l}
453
463
\Col\ni\gamma &::=& \{c_0,\dots,c_n\} \\[2pt]
@@ -464,8 +474,9 @@ \subsection{Bit Heap Data Structure}
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?}
469
480
The value of the bit heap is computed in modular arithmetic. Therefore, all correctness statements below are stated as modulo $2^w$.
470
481
471
482
\[
@@ -502,6 +513,7 @@ \subsection{Bit Heap Data Structure}
502
513
\bottomrule
503
514
\end{tabular}
504
515
\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)?}
505
517
506
518
The value of a bit heap is obtained by summing each column and combining the columns with Horner's method:
507
519
\begin{equation}
@@ -518,13 +530,18 @@ \subsection{Bit Heap Data Structure}
518
530
519
531
Our framework is based on modular arithmetic, so correctness statements for operations on a bit heap hold only modulo $2^w$.
520
532
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?}
521
534
522
535
Two theorems describe the primitive operations. Adding a bit $c$ at
523
536
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
525
540
$c$ is present in that column, decreases it by the same amount
526
541
(\ref{thm:removeBit}).
527
542
543
+
\sam{Rename the theorems to something more concise e.g. addBit?}
544
+
528
545
\begin{theorem}[\texttt{evalMod\_heap\_addBit}]
529
546
\label{thm:addBit}
530
547
For all $h : \Heap_w$, $k : \mathbb{N}$, $c : \Circ$ and
@@ -551,18 +568,23 @@ \subsection{Bit Heap Data Structure}
551
568
552
569
Since a \texttt{Column} is defined as a set, it cannot contain duplicates.
553
570
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.
555
573
\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?}
557
575
558
576
\subsection{Compression Algorithms}
559
577
\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.}
560
580
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.}
562
583
The reduction is carried out by compressors, half adders ($2{:}2$),
563
584
full adders ($3{:}2$), or in general any $N{:}M$ compressor with
564
585
$N \ge M$. We formalize half and full adders, and build compressor trees
565
586
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?}
\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.
609
633
610
634
In our framework, we separate the correctness of the compression from the generation of the chain.
0 commit comments