summaryrefslogtreecommitdiff
path: root/paper/patterns.tex
diff options
context:
space:
mode:
Diffstat (limited to 'paper/patterns.tex')
-rw-r--r--paper/patterns.tex10
1 files changed, 5 insertions, 5 deletions
diff --git a/paper/patterns.tex b/paper/patterns.tex
index 2937fd0..80f6d4b 100644
--- a/paper/patterns.tex
+++ b/paper/patterns.tex
@@ -7,7 +7,7 @@ sister(X,Y):- % X is Y’s sister when:
parent(P,X),
parent(P,Y), % X and Y share a common parent P,
female(X), % X is female, and
- X \textbackslash{}= Y. % X and Y are not the same person.
+ X \textrm{\textbackslash{}}= Y. % X and Y are not the same person.
\end{Verbatim}
Figure~\ref{fig:sister} shows the program’s AST with two patterns. The pattern drawn with blue dotted arrows encodes the fact that the first argument to the \code{sister} predicate also appears as the first argument in the call to \code{female}. In other words, this pattern states that \code{X} must be female to be a sister. We write this pattern as the s-expression
@@ -39,7 +39,7 @@ Figure~\ref{fig:sister} shows the program’s AST with two patterns. The pattern
[and
[compound,name=g3 [functor,name=g3f [female,name=g3fl]]
[args,name=g3a [var,name=g3av [X,name=g3avl,draw,rectangle,thick,blue,dotted,line width=0.4mm]]]]
- [binop [var [X]] [\textbackslash{}{=}] [var [Y]]]]]]]]
+ [binop [var [X]] [\textrm{\textbackslash{}}{=}] [var [Y]]]]]]]]
% first pattern
\path[-{Latex[length=1.5mm,width=1mm]},thick,relative,red] (top) edge[out=-10,in=-170] (g1);
\path[-{Latex[length=1.5mm,width=1mm]},thick,relative,red] (g1) edge[transform canvas={xshift=-1.5mm}] (g1f);
@@ -88,8 +88,8 @@ Patterns describe relations between nodes in a program’s AST. Specifically, th
sister(X,Y):- sister(X,Y):- sister(X,Y):-
female(X), female(X), parent(A,X),
parent(P,X), parent(A,X), female(X),
- X \textbackslash{}= Y. parent(B,Y), parent(A,Y),
- X \textbackslash{}= Y. X \textbackslash{}= Y.
+ X \textrm{\textbackslash{}}= Y. parent(B,Y), parent(A,Y),
+ X \textrm{\textbackslash{}}= Y. X \textrm{\textbackslash{}}= Y.
\end{Verbatim}
A relation between any two objects in a program is insufficient to reason about the program’s behavior on the whole. In the tutoring context, however, there are patterns that strongly indicate the presence of certain bugs. Take for example the following incorrect program to sum a list:
@@ -188,4 +188,4 @@ We include such patterns in our feature set to cover the base-case clauses in re
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "aied2017"
-%%% End: \ No newline at end of file
+%%% End: