summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/gene-logic/gn-logic14.tex
blob: 1ad9ff0e1584a3b99f3d1ce4b39092edc7d9da94 (plain)
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
%*****************************************************************************/
%*                                                                           */
%*      Version:  1.00   Date: 21/04/92   File: gn-logic14.tex               */
%* Last Version:                          File:                              */
%* Changes:                                                                  */
%* 30/12/90 First version of documentation.                                  */
%* 21/04/92 new properties                                                   */
%*                                                                           */
%* Title:                                                                    */
%* Author: Gerd Neugebauer                                                   */
%*                                                                           */
%* Usage:  latex gn-logic14.tex                                              */
%*                                                                           */
%*****************************************************************************/

\documentstyle[11pt,dina4,gn-logic14]{article}

\setlength{\unitlength}{1pt}


\begin{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newlength{\Width} \Width=\textwidth \advance\Width by -1.5em \divide\Width by 2

\section{The {\tt gn-logic} style option}
Description of Version 1.4 (5/95) by Gerd Neugebauer \bigskip

The {\tt gn-logic} style option provides a facility to typeset logical
formulas of a certain kind. This style option provides an environment like
\verb|eqnarray|, an extended {\tt newtheorem} environment and several macros.



\subsection{Mathematical Symbols}

The following marcos provide better usage of the junctors and quantifiers.
Especially the spacing  is improved.


\noindent\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}*{4}{l}}
\multicolumn{1}{c}{\small Symbol}
	   & \multicolumn{1}{c}{\small Macro}
			     & 	\multicolumn{2}{c}{\small Example}	  \\
	   &		     &			      & 		  \\
$\AND$	   & \verb|\AND|     & \verb$A\AND B$	      & $A\AND B$	  \\
$\OR$	   & \verb|\OR|	     & \verb$A\OR B$	      & $A\OR B$	  \\
$\XOR$	   & \verb|\XOR|     & \verb$A\XOR B$	      & $A\XOR B$	  \\
$\IMPLIES$ & \verb|\IMPLIES| & \verb$A\IMPLIES B$     & $A\IMPLIES B$	  \\
$\IMPL$	   & \verb|\IMPL|    & \verb$A\IMPL B$	      & $A\IMPL B$	  \\
$\IF$	   & \verb|\IF|	     & \verb$A\IF B$	      & $A\IF B$	  \\
$\IFF$	   & \verb|\IFF|     & \verb$A\IFF B$	      & $A\IFF B$	  \\
$\IFFdef$  & \verb|\IFFdef|  & \verb$A\IFFdef B$      & $A\IFFdef B$	  \\
$\ANDdots$ & \verb|\ANDdots| & \verb$A_1\ANDdots A_n$ & $A_1\ANDdots A_n$ \\
$\ORdots$  & \verb|\ORdots|  & \verb$A_1\ORdots A_n$  & $A_1\ORdots A_n$  \\
$\is$	   & \verb|\is|	     & \verb$x\is y$	      & $x\is y$	  \\
$\Nat$	   & \verb|\Nat|     & \verb$n\in\Nat$	      & $n\in\Nat$	  \\
$\Forall$  & \verb|\Forall|  & \verb$\Forall x P(x)$  & $\Forall x P(x)$  \\
$\Exists$  & \verb|\Exists|  & \verb$\Exists y P(x)$  & $\Exists y P(x)$  \\
\end{tabular*}


\newcommand{\bs}{{\tt\char"5C}}
\newcommand{\mac}[1]{The {\tt\char92 #1} Macro}
\newcommand{\macs}[2]{The {\tt\char92 #1} and the {\tt\char92 #2} Macros}
\newenvironment{compare}%
{\noindent\begin{center}%
  \begin{tabular}{@{}l@{\hspace*{1.5em}produces\hspace*{1.5em}}l@{}}}%
{\end{tabular}\end{center}}

\subsubsection*{\mac{AND}}
This macro can be used for the logical conjunction. In addition to the
\verb|\wedge| macro it adds more space and the formulas tend to be better
readable. Compare

\begin{compare}
\verb$x=1\AND y=x$	& $x=1\AND y=x$		\\
\verb$x=1\wedge y=x$	& $x=1\wedge y=x$	\\
\verb$x=1\land y=x$	& $x=1\land y=x$
\end{compare}

\subsubsection*{\mac{OR}}
This macro can be used for the logical disjunction. In addition to the
\verb|\vee| macro it adds more space. Compare

\begin{compare}
\verb$x=1\OR y=x$	& $x=1\OR y=x$	\\
\verb$x=1\vee y=x$	& $x=1\vee y=x$	\\
\verb$x=1\lor y=x$	& $x=1\lor y=x$
\end{compare}


\subsubsection*{\mac{XOR}}
This macro can be used for the exclusive disjunction. It has no common
counterpart. The spacing is like in in all junctor macros.

\begin{compare}
\verb$x=1\XOR y=x$	& $x=1\XOR y=x$
\end{compare}


\subsubsection*{\macs{IMPL}{IMPLIES}}
These macros can be used for the logical implication. In addition to the
\verb|\rightarrow| macro it adds more space. Compare

\begin{compare}
\verb$x=1\IMPL y=x$		& $x=1\IMPL y=x$	\\
\verb$x=1\IMPLIES y=x$		& $x=1\IMPLIES y=x$	\\
\verb$x=1\rightarrow y=x$	& $x=1\rightarrow y=x$
\end{compare}


\subsubsection*{\mac{IF}}
 This macro can be used for the logical implication written in reverse order.
In addition to the \verb|\leftarrow| macro it adds more space. Compare

\begin{compare}
\verb$x=1\IF y=x$		& $x=1\IF y=x$	\\
\verb$x=1\lefttarrow y=x$	& $x=1\leftarrow y=x$
\end{compare}

\subsubsection*{\mac{IFF}}
 This macro can be used for the logical equivalence.
In addition to the \verb|\leftrightarrow| macro it adds more space. Compare

\begin{compare}
\verb$x=1\IFF y=x$		& $x=1\IFF y=x$	\\
\verb$x=1\leftrighttarrow y=x$	& $x=1\leftrightarrow y=x$
\end{compare}

\subsubsection*{\mac{IFFdef}}
 Like above but with a small ``def'' above the arrow.

\begin{compare}
\verb$x=1\IFFdef y=x$		& $x=1\IFFdef y=x$
\end{compare}

\subsubsection*{\mac{is}}
 This macro is for typesetting unifiers. In this case the predefined
\verb|\setminus| produces to much space.

\begin{compare}
\verb$\{y\setminus x, z\setminus 4\}$	& $\{y\setminus x, z\setminus 4\}$ \\
\verb$\{y\is x, z\is 4\}$		& $\{y\is x, z\is 4\}$		   \\
\verb$\{y\backslash x, z\backslash 4P}$	& $\{y\backslash x, z\backslash 4\}$
\end{compare}

\ifx\AmSTeX\undefined
\def\AmSTeX{$\cal A$\kern-.1667em\lower.5ex\hbox
 {$\cal M$}\kern-.125em$\cal S$-\kern-.1em\TeX}
\fi

\subsubsection*{The Number Macros}
This are macros for those who have no access to the \AmSTeX{} fonts. It makes
the symbols for the natural numbers, integers, rationals, reals and complex
numbers. The usual magnification commands apply to it aswell.


\def\BB#1{\csname bb#1\endcsname}
\def\Line#1{\LINE{#1}\(\BB{#1}_{\BB{#1}}\)}
\def\LINE#1{{\tt \char92bb#1}&%
  {\tiny\BB{#1}}&%
  {\scriptsize\BB{#1}}&%
  {\footnotesize\BB{#1}}&%
  {\small\BB{#1}}&%
  {\normalsize\BB{#1}}&%
  {\large\BB{#1}}&%
  {\Large\BB{#1}}&%
  {\LARGE\BB{#1}}&%
  {\huge\BB{#1}}&%
  {\Huge\BB{#1}}&%
  }
\begin{center}
  \begin{tabular}{c|cccccccccc|c}
    &\multicolumn{10}{|c|}{{\tt \char92tiny \hfill...\hfill\char92normalsize \hfill...\hfill\char92Huge}}&\verb|X_X|
    \\\hline
    \Line B\\
    \verb|\Complex|\Line C\\
    \Line D\\
    \Line E\\
    \Line F\\
    \Line G\\
    \Line H\\
    \Line I\\
    \Line J\\
    \Line K\\
    \Line L\\
    \Line M\\
    \verb|\Nat|  \Line N\\
    \Line O\\
    \Line P\\
    \verb|\Rat|  \Line Q\\
    \verb|\Real| \Line R\\
    \verb|\Int|  \Line Z\\
    \Line{One}
  \end{tabular}
\end{center}

Unfortunately the macros \verb|\bbC|, \verb|\bbG|, \verb|\bbO|, and
\verb|\bbQ| do not scale properly when used in subscripts or superscripts of
formulae. The following examples shows how the sizing can be achieved manually

\noindent\begin{compare}
\verb$\bbQ_{\mbox{\scriptsize \bbQ}}$  & $\bbQ_{\mbox{\scriptsize \bbQ}}$
\end{compare}



\subsubsection*{\macs{Forall}{Exists}}
 The general problem with quantifies is that after the quantified variable the
following formula is not automatically seperated with a small space. This can
be overcome by the following macros.

The \verb|\Forall| and the \verb|\Exists| macros take one argument. They
typeset the respective quantifier followed by the argument (i.e.\ the variable)
and finally a small space. As usual the argument has to be enclosed in braces
if it consists of more than one character. Otherwise the braces can be omitted.
This allows a elegant notation of short quantified formulas.

\noindent\begin{compare}
\verb$\Forall x P(x)$  & $\Forall x P(x)$\\
\verb$\Forall{x_1,\ldots,x_n}P(x_1,\ldots,x_n)$%
&$\Forall{x_1,\ldots,x_n}P(x_1,\ldots,x_n)$\\
\verb$\Exists x P(x)$  & $\Exists x P(x)$\\
\verb$\Exists{x_1,\ldots,x_n}P(x_1,\ldots,x_n)$%
& $\Exists{x_1,\ldots,x_n}P(x_1,\ldots,x_n)$
\end{compare}



\subsection{The {\tt Formula} Environment}

This environment allows to typeset logical formulas. The main problem with the
\verb|eqnarray| environment was the numbering. In multiline formulas my
intention was to have the number in the middle of the formula. Inside this
environment several macros are valid.

\begin{description}
 \item[{\tt\bs begin\{Formula\}[{\em label}] \bs end\{Formula\}}] \ \\
	Start the list of formulas. Optionally a label can be given. This label
	is used to reference the first formula.
 \item[{\tt\bs =}] \ \\
	Start a new line.
 \item[{\tt\bs >}{\em level}] \ \\
	Start a new line and indent to the given {\em level}. This indentation
	is done in quantities of \verb|\FormulaIndent| which can be set with
	the \verb|\setlength| command. The default value is {\tt 3em}.
 \item[{\tt\bs Form[{\em label}]}] \ \\
	Start a new formula. Optionally a {\em label} can be given. This {\em
	label} can be used to reference to the formula (see \verb|\ref|).
\end{description}

Now lets have a look at some examples. First, we see a single two-line formula.
Note that the number at the right side is centered between the two lines.
\medskip

\noindent
\begin{minipage}{\Width}
\small\begin{verbatim}
\begin{Formula}
    P(X) \IMPL
\=  Q(X) \IFF R_1(X) \OR R_2(X)
\end{Formula}
\end{verbatim}
\end{minipage}
\hfill
\begin{minipage}{\Width}
\begin{Formula}
	P(X) \IMPL
\=	Q(X) \IFF R_1(X) \OR R_2(X)
\end{Formula}
\end{minipage}\medskip

Next we will see an example of several formulas. The first formula is split to
three lines and the third line is indented to level 1. Remark: \verb|\=| is in
reality an abbrevation for \verb|\>0|.
\medskip

\noindent
\begin{minipage}{\Width}
\small\begin{verbatim}
\begin{Formula}[form:1]
    P(X) \IMPL
\=  Q(X) \IFF R_1(X)
\>1 \OR R_2(X)
\Form[form:2]
    S(X) \IMPL
\=  \neg Q(X) \IFF R_1(X) \OR R_2(X)
\end{Formula}
\end{verbatim}
\end{minipage}
\hfill
\begin{minipage}{\Width}
\begin{Formula}[form:1]
    P(X) \IMPL
\=  Q(X) \IFF R_1(X)
\>1 \OR R_2(X)
\Form[form:2]
    S(X) \IMPL
\=  \neg Q(X) \IFF R_1(X) \OR R_2(X)
\end{Formula}
\end{minipage}\medskip


\subsection{The {\tt NewTheorem} Environment}

My experience with the {\tt newtheorem} environment was that I had a certain
scheme to use it. First, every theorem got a label. Thus, every {\em theorem}
was followed by a {\tt label} command. Optionally a {\em theorem} may have a
name. This name is typeset right after the number. The body of the {\em
  theorem} allways started in the next line. This let to the definition of an
extended {\tt NewTheorem} environment. The arguments are the same as those of
the {\tt newtheorem} environment. But the environment defined by this extended
command take two optional arguments. The first optional argument is a label to
be assigned to the {\em theorem}. This argument has to be enclosed in
parentheses. The second type of optional argument has to be enclosed in
brakets. It is typeset in \verb|\small| after the title text. The third
optional argument is enclosed in \verb|<>|. It is typeset in \verb|\small\bf|
and surrounded by parentheses.
\medskip

\noindent\begin{minipage}{\Width}
\small\begin{verbatim}

\NewTheorem{guess}{Conjecture}

\begin{guess}[Fermat](thm:fermat)
 There do not exist integers $n>2$,
 $x$, $y$, and $z$ such that
 $x^n+y^n=z^n$.
\end{guess}
\end{verbatim}
\end{minipage}
\hfill
\begin{minipage}{\Width}
\NewTheorem{guess}{Conjecture}

\begin{guess}[Fermat](thm:fermat)
 There do not exist integers $n>2$,
 $x$, $y$, and $z$ such that
 $x^n+y^n=z^n$.
\end{guess}
\end{minipage}
\medskip

The commands used to typeset some of the optional argument can be customized
in the following way. The macros \verb|\TheoremTitle| and \verb|\TheoremName|
are used to typeset their argument in \verb|\small| and \verb|\small\bf| and
enclosed in parentheses respectively. This macros can be redefined using
\verb|\renewcommand| as shown in the following example:
\medskip

\noindent\begin{minipage}{\Width}
\footnotesize\begin{verbatim}
\NewTheorem{theorem}{Theorem}
\renewcommand{\TheoremTitle}[1]{{\sf [#1]}}
\renewcommand{\TheoremName}[1]{{\small(#1)}}
\begin{theorem}[Fermat]<conjecture>(thm:f2)
 There do not exist integers ...
\end{theorem}
\end{verbatim}
\end{minipage}
\hfill
\begin{minipage}{\Width}
\NewTheorem{theorem}{Theorem}
\renewcommand{\TheoremTitle}[1]{{\sf #1}}
\renewcommand{\TheoremName}[1]{{\small(#1)}}
\begin{theorem}[Fermat]<conjecture>(thm:f2)
 There do not exist integers $n>2$,
 $x$, $y$, and $z$ such that
 $x^n+y^n=z^n$.
\end{theorem}
\end{minipage}

\end{document}



\newcommand{\ENTRY}[1]{{#1 \Nat}& {#1 \Int}& {#1 \Rat}&{#1 \Real}& {#1 \Complex}}

\begin{center}
\begin{tabular}{l|ccccc}
&\verb|\Nat|&\verb|\Int|&\verb|\Rat|&\verb|\Real|&\verb|\Complex|\\
&&\\\hline&&\\
\verb$\tiny$		& \ENTRY{\tiny}		\\
\verb$\scriptsize$	& \ENTRY{\scriptsize}	\\
\verb$\footnotesize$	& \ENTRY{\footnotesize} \\
\verb$\small$		& \ENTRY{\small}	\\
\verb$\normalsize$	& \ENTRY{\normalsize}	\\
\verb$\large$		& \ENTRY{\large}	\\
\verb$\Large$		& \ENTRY{\Large}	\\
\verb$\LARGE$		& \ENTRY{\LARGE}	\\
\verb$\huge$		& \ENTRY{\huge}		\\
\verb$\Huge$		& \ENTRY{\Huge}
\end{tabular}\end{center}