Skip to content

Commit 4ae8ec3

Browse files
[aslspec] changes following review comments
1 parent 448ea57 commit 4ae8ec3

3 files changed

Lines changed: 155 additions & 122 deletions

File tree

asllib/doc/ASLFormal.tex

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ \subsection{Lists}
249249
The \emph{length} of a list is the number of elements in that list:
250250
$\listlen{\emptylist} \triangleq 0$ and $\listlen{v_1,\ldots,v_k}=k$.
251251
\end{definition}
252+
\texthypertarget{relation-samelength}
253+
We write $\samelengthop[H]{a}{b}$ to denote that two lists $a$ and $b$ have the same length.
252254

253255
We use the notation $a..b$, where $a,b\in\Z$ as a shorthand for the interval $[a\ldots b]$
254256
(counting up when $a \leq b$ and counting down when $a \geq b$).
@@ -1097,18 +1099,34 @@ \subsection{Checked Transitions\label{sec:Checked Transitions}}
10971099
\hva\and
10981100
\inferrule[de\_check\_false]{}{ \decheck(\False, \vcode) \evalarrow \DynamicError(\vcode) }
10991101
\end{mathpar}
1100-
} % END_OF_BACKUP_RULE
1102+
} % END_OF_BACKUP_ORIGINAL_RULE
11011103
\RenderRule{de_check}
11021104

11031105
\subsection{Boolean Transition Judgments}
11041106
\RenderRelation{bool_transition}
1105-
We define the following rules to allow us to treat Boolean values as transition judgments,
1106-
which in turn allow us to employ \shortcircuitrulemacros{}:
1107+
We use this function defined by the following trivial rule to allow us to treat Boolean values as transition judgments,
1108+
which in turn allows us to employ \shortcircuitrulemacros{}:
1109+
\BackupOriginalRule{
11071110
\begin{mathpar}
11081111
\inferrule[bool\_trans\_true]{}{ \booltrans(\overname{\True}{\cond}) \booltransarrow \overname{\True}{\vresult} }
11091112
\hva\and
11101113
\inferrule[bool\_trans\_false]{}{ \booltrans(\overname{\False}{\cond}) \booltransarrow \overname{\False}{\vresult} }
11111114
\end{mathpar}
1115+
} % END_OF_BACKUP_ORIGINAL_RULE
1116+
\RenderRule{bool_transition}
1117+
1118+
This is useful in defining functions that return a Boolean value, where if a condition does not hold,
1119+
there is no need to consider the rest of the premises, and the function can simply return $\False$:
1120+
\begin{mathpar}
1121+
\inferrule{
1122+
\booltrans(\vx > \vy) \booltransarrow \True\ \terminateas\ \False\\\\
1123+
p_2\\\\
1124+
\ldots\\\\
1125+
p_k
1126+
}{
1127+
\textfunc{complex\_condition}(\vx, \vy) \booltransarrow \vb
1128+
}
1129+
\end{mathpar}
11121130

11131131
\subsection{Judgments Over Optional Data Types}
11141132
\hypertarget{def-mapopt}{}

asllib/doc/ASLmacros.tex

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -542,33 +542,45 @@
542542

543543
\newcommand\makelist[1]{\left[{#1}\right]} % A list of expressions
544544
\newcommand\listlen[1]{\hyperlink{relation-listlen}{|}#1\hyperlink{relation-listlen}{|}}
545+
\newcommand\samelengthname[0]{\hyperlink{relation-samelength}{\textfunc{same\_length}}}
546+
\newcommand\samelengthop[3][H]{
547+
\ifthenelse{\equal{#1}{H}}{
548+
\samelengthname\left({#2}, {#3}\right)
549+
}{
550+
\samelengthname
551+
\left(\begin{array}{l}
552+
{#2},\\
553+
{#3}\\
554+
\end{array}\right)
555+
}
556+
}
545557
\newcommand\concat[0]{\hyperlink{relation-concat}{\mathbin{+}}}
546558
\newcommand\concatlist[1]{\hyperlink{relation-concatlist}{\textfunc{concat\_list}}(#1)}
547559
\newcommand\cons[0]{\hyperlink{relation-cons}{\mathbin{{+}{+}}}}
548560
\newcommand\listfstname[0]{\hyperlink{relation-listfst}{\textfunc{list\_fst}}}
549561
\newcommand\listfst[1]{\listfstname(#1)}
550562
\newcommand\listcombine[3][H]{
551563
\ifthenelse{\equal{#1}{H}}
552-
{{#2} \mathbin{\hyperlink{relation-listcombine}{\times}} {#3}}
564+
{{#2} \mathbin{\hyperlink{relation-listcombine}{\otimes}} {#3}}
553565
{
554566
\left(\begin{array}{l}
555-
{#2} \hyperlink{relation-listcombine}{\times}\\
567+
{#2} \hyperlink{relation-listcombine}{\otimes}\\
556568
{#3}\\
557569
\end{array}\right)}
558570
}
559-
\newcommand\listcrossop[0]{\hyperlink{relation-listcross}{\otimes}}
560571
\newcommand\listcombinethree[4][H]{
561572
\ifthenelse{\equal{#1}{H}}{
562-
{#2} \mathbin{\hyperlink{relation-listcombinethree}{\times_3}} {#3} \mathbin{\hyperlink{relation-listcombinethree}{\times_3}} {#4}
573+
{#2} \mathbin{\hyperlink{relation-listcombinethree}{\otimes_3}} {#3} \mathbin{\hyperlink{relation-listcombinethree}{\otimes_3}} {#4}
563574
}{
564575
\hyperlink{relation-listcombinethree}{\textfunc{list\_combine\_3}}
565576
\left(\begin{array}{l}
566-
{#2} \hyperlink{relation-listcombinethree}{\times_3}\\
567-
{#3} \hyperlink{relation-listcombinethree}{\times_3}\\
577+
{#2} \hyperlink{relation-listcombinethree}{\otimes_3}\\
578+
{#3} \hyperlink{relation-listcombinethree}{\otimes_3}\\
568579
{#4}\\
569580
\end{array}\right)
570581
}
571582
}
583+
\newcommand\listcrossop[0]{\hyperlink{relation-listcross}{\times}}
572584

573585
\newcommand\parallelcomp[0]{\hyperlink{def-parallel}{\mathbin{\parallel}}}
574586
\newcommand\parallelgraphs[1]{\hyperlink{def-parallellist}{\mathbin{\mathchoice{\Big\|}{\big\|}{\|}{\|}}}{#1}}

0 commit comments

Comments
 (0)