-
Notifications
You must be signed in to change notification settings - Fork 1
/
example4.tex
87 lines (72 loc) · 2.71 KB
/
example4.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
% ----------------------------------------------------------------------
% Example with variables (Notation)
% ----------------------------------------------------------------------
\begin{frame}[fragile]{A longer one}
\vspace{-1cm}
%
{\small
\begin{verbatim}
n(1). n(2).
{a(X)}:- n(X).
b(X) :- a(X).
:- n(X), not b(X).
\end{verbatim}
}%
\vspace{-1.75cm}
%
\begin{columns}
%\begin{column}{0.001\textwidth}\end{column}
\begin{column}{1.01\textwidth}
\begin{tikzpicture}[
examples,
smallsm/.style={smodel, font=\tiny\ttfamily, align=center, inner sep=1mm},
every node/.style={node distance=1.5cm and 1cm, on grid, font=\scriptsize},
]
% line 0
\node[smallsm, draw=none] (node01) {};
% line 1
\uncover<2->{\alert<2>{
\node[smallsm, below=of node01, yshift=2.5mm] (node11) {n(1) n(2)}
edge[arrow, dashed] (node01);
\node[rule, right=of node11, xshift=5cm, yshift=5mm] (newrule1) {\scode \footnotesize n(1).\hspace{12mm}};
\node[rule, right=of node11, xshift=5cm] (rule1) {\scode \footnotesize n(2).\hspace{12mm}};
}}
% line 2
\uncover<3->{\alert<3>{
\node[smallsm, below left=of node11, xshift=-1mm, yshift=4mm] (node21) {n(1) n(2)\\ a(1)}
edge [arrow] (node11);
\node[smallsm, left=of node21, xshift=-12mm] (node22) {n(1) n(2)}
edge [arrow] (node11);
\node[smallsm, below right=of node11, xshift=1mm, yshift=4mm] (node23) {n(1) n(2) \\ a(2)}
edge [arrow] (node11);
\node[smallsm, right=of node23, xshift=12mm] (node24) {n(1) n(2) \\ a(1) a(2)}
edge [arrow] (node11);
\node[rule, below=of rule1, yshift=4mm] (rule2) {\scode \footnotesize \hspace{3mm}\{a(X)\} :- n(X).};
}}
% line 3
\uncover<4->{\alert<4>{
\node[smallsm, below=of node21, yshift=-3mm] (node31) {n(1) n(2)\\ a(1) b(1)}
edge [arrow] (node21);
\node[smallsm, below=of node22, yshift=-3mm] (node32) {n(1) n(2)}
edge [arrow] (node22);
\node[smallsm, below=of node23, yshift=-3mm] (node33) {n(1) n(2)\\ a(2) b(2)}
edge [arrow] (node23);
\node[smallsm, below=of node24, yshift=-3mm] (node34) {n(1) n(2)\\ a(1) b(1)\\ a(2) b(2)}
edge [arrow] (node24);
\node[rule, below=of rule2, yshift=-3mm] (rule3) {\scode \footnotesize \hspace{1mm}b(X) :- a(X).};
}}
% line 3
\uncover<5->{\alert<5>{
\node[smallsm, below=of node34, yshift=-5mm] (node44) {n(1) n(2)\\ a(1) b(1)\\ a(2) b(2)}
edge [arrow] (node34);
\node[rule, below=of rule3, yshift=-5mm] (rule4) {\scode \scriptsize \hspace{6mm}:- n(X), not b(X).};
}}
\uncover<6->{\node[any, below=of node34, xshift=9.5mm, yshift=-10.5mm] (ok) {\MiddleBigBiggerOK};}
\visible<7>{
\draw[on grid] ($ (newrule1.north west) + (-1.5mm,1mm) $) rectangle ($ (rule4.south east) + (-0.5mm,-1mm) $);
\node[on grid] at ($ (newrule1.north) + (3mm,4mm) $) {\small \texttt{example4.lp}};
}
\end{tikzpicture}
\end{column}
\end{columns}
\end{frame}