Skip to content

Commit 3e39009

Browse files
[asl reference] establish consistent function/relation notations
1 parent 5239cc1 commit 3e39009

10 files changed

+43
-39
lines changed

asllib/doc/ASLFormal.tex

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ \section{Mathematical Definitions and Notations\label{sec:Mathematical Definitio
9797
\hypertarget{constant-equalsign}{}
9898
\RenderType{Sign}
9999

100-
The function $\sign : \overname{\Q}{\vq} \rightarrow \overname{\Sign}{\vs}$ returns the sign of $\vq$:
100+
The function $\sign(\overname{\Q}{\vq}) \rightarrow \overname{\Sign}{\vs}$ returns the sign of $\vq$:
101101
\[
102102
\sign(\vq) \triangleq \begin{cases}
103103
\positivesign & \text{if }\vq > 0\\
@@ -145,10 +145,17 @@ \section{Mathematical Definitions and Notations\label{sec:Mathematical Definitio
145145
and the reflexive-transitive closure of $E$ by $\graphtransitivereflexive{E}$.
146146
\end{definition}
147147

148+
\paragraph{Function and Relation Notations}
149+
We use a non-standard notation for functions and relations, which is more succinct.
150+
Specifically, we write $f(T_1,\ldots,T_n) \rightarrow R$ to denote a function from
151+
the argument types $T_1,\ldots,T_n$ to the result type $R$.
152+
%
153+
We write $f(T_1,\ldots,T_n) \aslrel{} R$ to denote a relation between the argument types $T_1,\ldots,T_n$ and the result type $R$.
154+
148155
\hypertarget{def-partialfunc}{}
149156
\hypertarget{def-dom}{}
150157
\begin{definition}[Partial Function\label{def:PartialFunction}]
151-
A \emph{partial function}, denoted $f : A \partialto B$, is a function from a \underline{subset} of $A$ to $B$.
158+
A \emph{partial function}, denoted $f(A) \partialto B$, is a function from a \underline{subset} of $A$ to $B$.
152159
The \emph{domain} of a partial function $f$, denoted $\dom(f)$, is the subset of $A$ for which it is defined.
153160
We use expressions like $x \in \dom(f)$ and $x \not\in \dom(f)$ to check whether $x$ is in the domain of $f$
154161
or not in the domain of $f$, respectively.
@@ -191,7 +198,7 @@ \section{Mathematical Definitions and Notations\label{sec:Mathematical Definitio
191198

192199
\begin{definition}[Function Restriction]
193200
\hypertarget{def-restrictfunc}{}
194-
The \emph{restriction} of a function $f : X \rightarrow Y$ to a subset of its domain
201+
The \emph{restriction} of a function $f(X) \rightarrow Y$ to a subset of its domain
195202
$A \subseteq \dom(f)$, denoted as $\restrictfunc{f}{A}$, is defined
196203
in terms of the set of input-output pairs:
197204
\[
@@ -206,7 +213,7 @@ \section{Mathematical Definitions and Notations\label{sec:Mathematical Definitio
206213
the expressions corresponding to the arguments.
207214
For example,
208215
\[
209-
\sign : \overname{\Q}{\vq} \rightarrow \overname{\Sign}{\vs}
216+
\sign(\overname{\Q}{\vq}) \rightarrow \overname{\Sign}{\vs}
210217
\]
211218
defines a function type and lets us refer to its argument as $\vq$
212219
and to the result as $\vs$.
@@ -282,7 +289,7 @@ \subsection{Lists}
282289

283290
\hypertarget{relation-concat}{}
284291
\begin{definition}[List Concatenation]
285-
The parametric function $\concat : \KleeneStar{T} \cartimes \KleeneStar{T} \rightarrow \KleeneStar{T}$ concatenates two lists:
292+
The parametric function $\concat(\KleeneStar{T}, \KleeneStar{T}) \rightarrow \KleeneStar{T}$ concatenates two lists:
286293
\[
287294
L \concat{} M \triangleq
288295
\begin{cases}
@@ -318,7 +325,7 @@ \subsection{Lists}
318325
\begin{definition}[Equating List Lengths]
319326
The parametric function
320327
\[
321-
\equallength : \overname{\KleeneStar{A}}{a} \cartimes \overname{\KleeneStar{B}}{b} \rightarrow \Bool
328+
\equallength(\overname{\KleeneStar{A}}{a}, \overname{\KleeneStar{B}}{b}) \rightarrow \Bool
322329
\]
323330
compares the length of two lists:
324331
\[
@@ -328,7 +335,7 @@ \subsection{Lists}
328335

329336
\hypertarget{def-listprefix}{}
330337
\begin{definition}[List Prefix]
331-
The parametric function $\listprefixname : \overname{\KleeneStar{T}}{\vlone} \cartimes \overname{\KleeneStar{T}}{\vltwo} \rightarrow \Bool$ checks whether
338+
The parametric function $\listprefixname(\overname{\KleeneStar{T}}{\vlone}, \overname{\KleeneStar{T}}{\vltwo}) \rightarrow \Bool$ checks whether
332339
the list $\vlone$ is a \emph{prefix} of the list $\vltwo$:
333340
\[
334341
\listprefixname(\vlone, \vltwo) \triangleq \exists \vlthree.\ \vltwo = \vlone \concat \vlthree \enspace.
@@ -337,7 +344,7 @@ \subsection{Lists}
337344

338345
\hypertarget{def-listrange}{}
339346
\begin{definition}[Indices of a List]
340-
The parametric function $\listrange : \KleeneStar{T} \rightarrow \KleeneStar{\N}$ returns the ($1$-based) list of indices for a given list:
347+
The parametric function $\listrange(\KleeneStar{T}) \rightarrow \KleeneStar{\N}$ returns the ($1$-based) list of indices for a given list:
341348
\[
342349
\begin{array}{rcl}
343350
\listrange(\emptylist) &\triangleq& \emptylist\\
@@ -366,7 +373,7 @@ \subsection{Lists}
366373
\begin{definition}[Extracting the First Components from a List of Pairs]
367374
The\\ parametric function
368375
\[
369-
\listfstname : \KleeneStar{(T_1 \cartimes T_2)} \rightarrow \KleeneStar{T_1}
376+
\listfstname(\KleeneStar{(T_1 \cartimes T_2)}) \rightarrow \KleeneStar{T_1}
370377
\]
371378
transforms a list of pairs into a lists of elements containing the first components of each pair:
372379
\[
@@ -381,7 +388,7 @@ \subsection{Lists}
381388
\begin{definition}[Unzipping a List of Pairs]
382389
The parametric function
383390
\[
384-
\unziplist : \KleeneStar{(T_1 \cartimes T_2)} \rightarrow (\KleeneStar{T_1} \cartimes \KleeneStar{T_2})
391+
\unziplist(\KleeneStar{(T_1 \cartimes T_2)}) \rightarrow (\KleeneStar{T_1} \cartimes \KleeneStar{T_2})
385392
\]
386393
transforms a list of pairs into the corresponding pair of lists:
387394
\[
@@ -398,7 +405,7 @@ \subsection{Lists}
398405
\begin{definition}[Unzipping a List of Triples]
399406
The parametric function
400407
\[
401-
\unziplistthree : \KleeneStar{(T_1 \cartimes T_2 \cartimes T_3)} \rightarrow (\KleeneStar{T_1} \cartimes \KleeneStar{T_2} \cartimes \KleeneStar{T_3})
408+
\unziplistthree(\KleeneStar{(T_1 \cartimes T_2 \cartimes T_3)}) \rightarrow (\KleeneStar{T_1} \cartimes \KleeneStar{T_2} \cartimes \KleeneStar{T_3})
402409
\]
403410
transforms a list of triples into the corresponding triple of lists:
404411
\[
@@ -415,7 +422,7 @@ \subsection{Lists}
415422
\texthypertarget{relation-listcross}
416423
The parametric function
417424
\[
418-
\listcrossop : \KleeneStar{T_1} \cartimes \KleeneStar{T_2} \aslto \KleeneStar{(T_1 \cartimes T_2)}
425+
\listcrossop(\KleeneStar{T_1}, \KleeneStar{T_2}) \rightarrow \KleeneStar{(T_1 \cartimes T_2)}
419426
\]
420427
computes the cross-product of two lists:
421428
\[
@@ -441,7 +448,7 @@ \subsection{Lists}
441448
The parametric function
442449
\hypertarget{def-unionlist}{}
443450
\[
444-
\unionlist : \KleeneStar{\pow{T}} \rightarrow \pow{T}
451+
\unionlist(\KleeneStar{\pow{T}}) \rightarrow \pow{T}
445452
\]
446453
takes the union of a list of sets:
447454
\[
@@ -453,7 +460,7 @@ \subsection{Lists}
453460
The parametric function
454461
\hypertarget{def-intersectionlist}{}
455462
\[
456-
\intersectionlist : \KleeneStar{\pow{T}} \rightarrow \pow{T}
463+
\intersectionlist(\KleeneStar{\pow{T}}) \rightarrow \pow{T}
457464
\]
458465
takes the intersection of a list of sets:
459466
\[
@@ -466,13 +473,13 @@ \subsection{Lists}
466473

467474
\subsection{Strings}
468475
\hypertarget{relation-stringconcat}{}
469-
The function $\concatstrings : \Strings \cartimes \Strings \rightarrow \Strings$
476+
The function $\concatstrings(\Strings, \Strings) \rightarrow \Strings$
470477
concatenates two strings. %
471478
We slightly abuse notation by using the same symbol $\concat$ for concatenating
472479
a string $S$ and an integer $n$, separated by a hyphen, for example, \verb|return-42|.
473480

474481
\hypertarget{relation-stringofint}{}
475-
The function $\stringofintname : \Z \rightarrow \Strings$ converts an integer number
482+
The function $\stringofintname(\Z) \rightarrow \Strings$ converts an integer number
476483
to the corresponding decimal string.
477484

478485
\subsection{OCaml-style Notations}
@@ -1106,10 +1113,10 @@ \subsection{Judgments Over Optional Data Types}
11061113
Optional data types are prevalent in the AST.
11071114
To facilitate transition judgments over optional data types,
11081115
we introduce the following parametric relation,
1109-
which accepts a one-argument relation (or function) $f : A \aslrel B$
1116+
which accepts a one-argument relation (or function) $f(A) \aslrel B$
11101117
and applies it to an optional value:
11111118
\[
1112-
\mapopt{\cdot} : \overname{\Option{A}}{\vvopt} \aslrel \overname{\Option{B}}{\vvoptnew}
1119+
\mapopt{\cdot}(\overname{\Option{A}}{\vvopt}) \aslrel \overname{\Option{B}}{\vvoptnew}
11131120
\]
11141121

11151122
\ProseParagraph

asllib/doc/AbstractSyntax.tex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ \section{Building Parameterized Productions\label{sec:BuildingParameterizedProdu
442442
\[
443443
\buildlist[b](\overname{N}{\vsyms}) \;\aslrel\; \overname{A}{\vsymasts}
444444
\]
445-
which is parameterized by an AST building relation $b : E \aslrel A$,
445+
which is parameterized by an AST building relation $b(E) \aslrel A$,
446446
takes a parse node that represents a possibly-empty list of $E$ values --- $\vsyms$ --- and returns the result of applying $b$
447447
to each of them --- $\vsymasts$.
448448

@@ -470,7 +470,7 @@ \section{Building Parameterized Productions\label{sec:BuildingParameterizedProdu
470470
\[
471471
\buildclist[b](\overname{N}{\vsyms}) \;\aslrel\; \overname{A}{\vsymasts}
472472
\]
473-
which is parameterized by an AST building relation $b : E \aslrel A$,
473+
which is parameterized by an AST building relation $b(E) \aslrel A$,
474474
takes a parse node that represents a possibly-empty comma-separated list of $E$ values --- $\vsyms$ --- and returns the result of applying $b$
475475
to each of them --- $\vsymasts$.
476476

@@ -497,7 +497,7 @@ \section{Building Parameterized Productions\label{sec:BuildingParameterizedProdu
497497
\[
498498
\buildplist[b](\overname{N}{\vsyms}) \;\aslrel\; \overname{A}{\vsymasts}
499499
\]
500-
which is parameterized by an AST building relation $b : E \aslrel A$,
500+
which is parameterized by an AST building relation $b(E) \aslrel A$,
501501
takes a parse node that represents a parenthesized comma-separated list of $E$ values --- $\vsyms$ --- and returns the result of applying $b$
502502
to each of them --- $\vsymasts$.
503503

@@ -515,7 +515,7 @@ \section{Building Parameterized Productions\label{sec:BuildingParameterizedProdu
515515
\[
516516
\buildtclist[b](\overname{N}{\vsyms}) \;\aslrel\; \overname{A}{\vsymasts}
517517
\]
518-
which is parameterized by an AST building relation $b : E \aslrel A$,
518+
which is parameterized by an AST building relation $b(E) \aslrel A$,
519519
takes a parse node that represents a non-empty comma-separated trailing list of $E$ values --- $\vsyms$ --- and returns the result of applying $b$
520520
to each of them --- $\vsymasts$.
521521

@@ -542,7 +542,7 @@ \section{Building Parameterized Productions\label{sec:BuildingParameterizedProdu
542542
\[
543543
\buildoption[b](\overname{N}{\vsym}) \;\aslrel\; \overname{\Option{A}}{\vsymast}
544544
\]
545-
which is parameterized by an AST building relation $b : N \aslrel A$,
545+
which is parameterized by an AST building relation $b(N) \aslrel A$,
546546
takes a parse node that represents an optional $N$ value $\vsym$, and returns the result of applying $b$
547547
to the value if it exists --- $\vsymasts$.
548548

asllib/doc/AssignableExpressions.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ \chapter{Assignable Expressions\label{chap:AssignableExpressions}}
4949
\paragraph{Viewing Assignable Expressions as Right-hand-side Expressions:}
5050
Some of the typing rules and semantics rules require viewing \assignableexpressions\
5151
as \rhsexpressions.
52-
The correspondence is given by the function $\torexpr : \lexpr \rightarrow \expr$, defined in \secref{LeftToRight}.
52+
The correspondence is given by the function $\torexpr(\lexpr) \rightarrow \expr$, defined in \secref{LeftToRight}.
5353
%
5454
For example, \SemanticsRuleRef{LESetField}
5555
needs to evaluate the record subexpression $\rerecord$, which is an \assignableexpression.

asllib/doc/LexicalStructure.tex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ \section{Lexical Analysis\label{sec:LexicalAnalysis}}
332332
Lexical analysis, which is also referred to as \emph{scanning}, is defined via the function
333333
\hypertarget{def-aslscan}{}
334334
\[
335-
\aslscan : \LexSpec \cartimes \KleeneStar{\REasciichar} \aslto (\KleeneStar{\Token} \cup \{\LexicalErrorConfig\})
335+
\aslscan(\LexSpec, \KleeneStar{\REasciichar}) \aslto (\KleeneStar{\Token} \cup \{\LexicalErrorConfig\})
336336
\]
337337
\hypertarget{def-lexicalerrorresult}{}
338338
which takes a \emph{lexical specification} (explained soon), an ASL specification string
@@ -393,13 +393,13 @@ \section{Lexical Analysis\label{sec:LexicalAnalysis}}
393393
\begin{definition}[Lexical Specification]
394394
A \emph{lexical specification} consists of a list of pairs $[(r_1,a_1),\ldots,(r_k,a_k)] \in \LexSpec$
395395
where each pair $(r_i,a_i)$ consists of a lexical regular expression $r_i$
396-
and a \emph{lexeme action} $a_i : \Strings\cartimes\Strings \aslto \KleeneStar{\Token}$.
396+
and a \emph{lexeme action} $a_i(\Strings, \Strings) \aslto \KleeneStar{\Token}$.
397397
\end{definition}
398398

399399
\hypertarget{def-rematch}{}
400400
The function
401401
\[
402-
\remaxmatch : \overname{\RegExp}{e} \cartimes \overname{\Strings}{s} \aslto (\overname{\Strings}{s_1} \cartimes \overname{\Strings}{s_2}) \cup \{\nomatch\}
402+
\remaxmatch(\overname{\RegExp}{e}, \overname{\Strings}{s}) \aslto (\overname{\Strings}{s_1} \cartimes \overname{\Strings}{s_2}) \cup \{\nomatch\}
403403
\]
404404
returns the \emph{longest} match of a regular expression $e$ for a prefix of a string $s$.
405405
More precisely:
@@ -408,7 +408,7 @@ \section{Lexical Analysis\label{sec:LexicalAnalysis}}
408408
If no match exists, it is indicated by returning $\nomatch$.
409409

410410
\hypertarget{def-maxmatch}{}
411-
The function $\maxmatches : \overname{\LexSpec}{R} \cartimes \overname{\Strings}{s} \aslto \overname{\LexSpec}{R'}$
411+
The function $\maxmatches(\overname{\LexSpec}{R}, \overname{\Strings}{s}) \aslto \overname{\LexSpec}{R'}$
412412
returns the sublist of $R$ consisting of pairs whose maximal matches for $s$ are equal. Importantly, the result sublist $R'$ maintains
413413
the order of pairs in $R$. If all expressions in $R$ do not match (that is $\remaxmatch$ returns $\nomatch$ for all pairs in $R$), then $R'$ is the empty list.
414414

@@ -674,7 +674,7 @@ \subsection{Scanning Strings}
674674
To scan string literals, we define the following specialized scanning function.
675675
The function
676676
\[
677-
\scanstring : \overname{\KleeneStar{\REasciichar}}{\buff} \cartimes \overname{\KleeneStar{\REasciichar}}{s} \aslto (\KleeneStar{\Token} \cup \{\LexicalErrorConfig\})
677+
\scanstring(\overname{\KleeneStar{\REasciichar}}{\buff}, \overname{\KleeneStar{\REasciichar}}{s}) \aslto (\KleeneStar{\Token} \cup \{\LexicalErrorConfig\})
678678
\]
679679
scans string with the $\specstring$ specification while building the final string literal in $\buff$.
680680
It is defined via the following rules:

asllib/doc/Specifications.tex

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ \section{Formal Relations for Global Declarations\label{sec:Formal Relations for
5151
Global declarations are generated by the relation
5252
\hypertarget{build-decl}{}
5353
\[
54-
\builddecl : \overname{\parsenode{\Ndecl}}{\vparsednode} \;\aslrel\; \overname{\KleeneStar{\decl}}{\vastnode}
54+
\builddecl(\overname{\parsenode{\Ndecl}}{\vparsednode}) \;\aslrel\; \overname{\KleeneStar{\decl}}{\vastnode}
5555
\]
5656
transforms a parse node $\vparsednode$ into an AST node $\vastnode$.
5757

@@ -99,12 +99,11 @@ \section{Abstract Syntax of Specifications\label{sec:Abstract Syntax of Specific
9999
\hypertarget{build-ast}{}
100100
The relation
101101
\[
102-
\buildast : \overname{\parsenode{\Nspec}}{\vparsednode} \;\aslrel\; \overname{\spec}{\vastnode}
102+
\buildast(\overname{\parsenode{\Nspec}}{\vparsednode}) \;\aslrel\; \overname{\spec}{\vastnode}
103103
\]
104104
transforms an $\Nspec$ node $\vparsednode$ into an AST specification node $\vastnode$.
105105
} % END_OF_UNIMPORTED_RELATION
106106

107-
108107
We define this function for subprogram declarations, type declarations, and global storage declarations in the corresponding chapters.
109108

110109
\begin{mathpar}

asllib/doc/SubprogramDeclarations.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ \section{Accessors\label{sec:Accessors}}
212212
\hypertarget{build-accessorbody}{}
213213
The relation
214214
\[
215-
\buildaccessorbody : \overname{\parsenode{\Naccessorbody}}{\vparsednode} \;\aslrel\; \overname{\accessorpair}{\vaccessorpair}
215+
\buildaccessorbody(\overname{\parsenode{\Naccessorbody}}{\vparsednode}) \;\aslrel\; \overname{\accessorpair}{\vaccessorpair}
216216
\]
217217
transforms a parse node $\vparsednode$ into an $\accessorpair$.
218218
} % END_OF_UNIMPORTED_RELATION

asllib/doc/SymbolicEquivalenceTesting.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ \section{Symbolic Expressions\label{sec:symbolicexpressions}}
188188
\TypingRuleDef{AddPolynomialList}
189189
The overloaded function
190190
\[
191-
\addpolynomials : \KleeneStar{\polynomial} \rightarrow \polynomial
191+
\addpolynomials(\KleeneStar{\polynomial}) \rightarrow \polynomial
192192
\]
193193
adds a list of polynomials.
194194

asllib/doc/Syntax.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ \section{Parse Trees\label{sec:ParseTrees}}
704704
\hypertarget{def-aslparse}{}
705705
A parser is a function
706706
\[
707-
\aslparse : (\KleeneStar{\Token} \setminus \{\Terror\}) \aslto \parsenode{\Nspec} \cup \{\ParseErrorConfig\}
707+
\aslparse(\KleeneStar{\Token} \setminus \{\Terror\}) \aslto \parsenode{\Nspec} \cup \{\ParseErrorConfig\}
708708
\]
709709
\hypertarget{def-parseerror}{}
710710
where $\ParseErrorConfig$ stands for a \emph{parse error}.

asllib/doc/TypeDomains.tex

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ \subsection{The Dynamic Domain of a Type\label{sec:DynDomain}}
5454
As part of the definition, we also associate dynamic domains to integer constraints
5555
by overloading $\dynamicdomain$:
5656
\[
57-
\dynamicdomain : \overname{\envs}{\env} \cartimes \overname{\intconstraint}{\vc}
57+
\dynamicdomain(\overname{\envs}{\env}, \overname{\intconstraint}{\vc})
5858
\partialto \overname{\pow{\nativevalue}}{\vd}
5959
\]
6060

@@ -441,5 +441,3 @@ \subsection{The Dynamic Domain of a Type\label{sec:DynDomain}}
441441
the native integer value $c$,
442442
which is assigned to \texttt{N} by a given dynamic environment. The static domain of that parameter
443443
is the infinite set of all native integer values.
444-
445-

asllib/doc/TypeSystemUtilities.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ \chapter{Type System Utility Rules\label{chap:TypeSystemUtilityRules}}
9696
\hva\and
9797
\inferrule[two\_or\_more]{
9898
\listlen{\vlone} = n\\
99-
f : 1..n \rightarrow 1..n \text{ is a bijection}\\
99+
f(1..n) \rightarrow 1..n \text{ is a bijection}\\
100100
\vltwo \eqdef [\ i=1..n: \vlone[f(i)]\ ]\\
101101
i=1..n-1: \compare(\vltwo[i], \vltwo[i+1]) \geq 0
102102
}{

0 commit comments

Comments
 (0)