Skip to content

Commit a23fbfe

Browse files
committed
finalize v1.0
1 parent 759722d commit a23fbfe

3 files changed

Lines changed: 189 additions & 165 deletions

File tree

fitch.hacker.txt

Lines changed: 128 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ which is provided in the file fitchdoc.tex.
55

66
GENERAL
77

8-
Global identifiers defined by this package start with '\nd*'. The only
8+
Global identifiers defined by this package start with '\nd@'. The only
99
exceptions are \ndref, \nddim, \ndindent, and the "nd" and "ndresume"
1010
latex environments.
1111

@@ -22,36 +22,36 @@ REFERENCES
2222

2323
We start with some macros to facilitate automatic line numbering, and
2424
for referencing of lines by labels. The macros defined here are:
25-
\nd*reset to reset the line number count. \nd*num{x}, to generate the
26-
next line number and store it in reference x; \nd*ref{x} to print the
25+
\nd@reset to reset the line number count. \nd@num{x}, to generate the
26+
next line number and store it in reference x; \nd@ref{x} to print the
2727
line number referenced by x, \ndref{xxx} to parse a list of
2828
references, separated by commas, periods, and hyphens, and translate
2929
all references to line numbers. Note: \ndref ignores spaces in its
3030
argument, but puts a space after each comma or period in the
31-
output. Also note: \nd*ref can be useful outside a natded environment,
31+
output. Also note: \nd@ref can be useful outside a natded environment,
3232
and thus it has a user accessible name. Most general ``line numbers''
3333
actually consist of a name (such as ``n'') and a number (such as
34-
``2''), to produce output such as $n+2$. \nd*set{n}{m} is called to
34+
``2''), to produce output such as $n+2$. \nd@set{n}{m} is called to
3535
set the letter to n and the number to m. As special cases, if the
3636
second argument is empty, it is not set, and if the first argument is
3737
\relax, it is not set.
3838

3939
Example for references:
4040

41-
\nd*reset \nd*num{x}; \nd*num{y}; \nd*numopt{n+1}{z}; \nd*num{zz};
42-
\nd*ref{y}; \ndref{x, y-zz, z}
41+
\nd@reset \nd@num{x}; \nd@num{y}; \nd@numopt{n+1}{z}; \nd@num{zz};
42+
\nd@ref{y}; \ndref{x, y-zz, z}
4343
will produce: 1; 2; n+1; 3; 2; 1, 2-3, n+1
4444

4545
LAYER A
4646

4747
Layer A provides primitive picture elements which can be combined into
48-
natural deduction derivations. These are: \nd*t to make a topmost
49-
vertical line segment; \nd*v to make a continuation vertical line
50-
segment, \nd*i to produce the indentation for a subproof, \nd*s to
48+
natural deduction derivations. These are: \nd@t to make a topmost
49+
vertical line segment; \nd@v to make a continuation vertical line
50+
segment, \nd@i to produce the indentation for a subproof, \nd@s to
5151
produce the horizontal space between a vertical line and a formula,
52-
\nd*u{x} to underline x with appropriate spacing for a
53-
hypothesis. \nd*f{x} typesets the formula x with the appropriate
54-
vertical spacing. \nd*g{x} is like \nd*i, except it puts a guard in
52+
\nd@u{x} to underline x with appropriate spacing for a
53+
hypothesis. \nd@f{x} typesets the formula x with the appropriate
54+
vertical spacing. \nd@g{x} is like \nd@i, except it puts a guard in
5555
the space it creates. These elements are spaced so that they are
5656
appropriate as left-aligned array entries. Line numberings and
5757
justifications must be provided manually in this layer. All explicit
@@ -62,132 +62,132 @@ Example of a derivation using layer A syntax:
6262

6363
\[
6464
\begin{array}{lll}
65-
1 & \nd*t\nd*s\nd*f {P\vee Q} \\
66-
2 & \nd*v\nd*s\nd*u {\neg Q} \\
67-
3 & \nd*v\nd*i\nd*t\nd*s\nd*u {P} \\
68-
4 & \nd*v\nd*i\nd*v\nd*s\nd*f {P} & \mbox{by 3} \\
69-
5 & \nd*v\nd*i\nd*t\nd*s\nd*u {Q} \\
70-
6 & \nd*v\nd*i\nd*v\nd*s\nd*f {\neg Q} & \mbox{by 2} \\
71-
7 & \nd*v\nd*i\nd*v\nd*s\nd*f {\bot} & \mbox{by 5, 6} \\
72-
8 & \nd*v\nd*i\nd*v\nd*s\nd*f {P} & \mbox{by 7} \\
73-
9 & \nd*v\nd*s\nd*f {P} & \mbox{by 1, 3-4, 5-8} \\
65+
1 & \nd@t\nd@s\nd@f {P\vee Q} \\
66+
2 & \nd@v\nd@s\nd@u {\neg Q} \\
67+
3 & \nd@v\nd@i\nd@t\nd@s\nd@u {P} \\
68+
4 & \nd@v\nd@i\nd@v\nd@s\nd@f {P} & \mbox{by 3} \\
69+
5 & \nd@v\nd@i\nd@t\nd@s\nd@u {Q} \\
70+
6 & \nd@v\nd@i\nd@v\nd@s\nd@f {\neg Q} & \mbox{by 2} \\
71+
7 & \nd@v\nd@i\nd@v\nd@s\nd@f {\bot} & \mbox{by 5, 6} \\
72+
8 & \nd@v\nd@i\nd@v\nd@s\nd@f {P} & \mbox{by 7} \\
73+
9 & \nd@v\nd@s\nd@f {P} & \mbox{by 1, 3-4, 5-8} \\
7474
\end{array}
7575
\]
7676

7777
LISTS
7878

7979
This is a bit of a hack. We implement linked lists as follows: a list
80-
is either \nd*nil, or \nd*cons{T}{H}, where T is another list, and H
80+
is either \nd@nil, or \nd@cons{T}{H}, where T is another list, and H
8181
is some arbitrary code. Note that lists grow to the right. The
8282
following macros operate on a list that is stored in a macro \list.
8383

84-
\nd*push\list{item} pushes the item onto the list
85-
\nd*pop\list{item} pops and discards the last item from the list
86-
\nd*item\list{command} applies command to each element of the list
87-
\nd*modify\list\n{elt} modifies the \n-th element of the
84+
\nd@push\list{item} pushes the item onto the list
85+
\nd@pop\list{item} pops and discards the last item from the list
86+
\nd@item\list{command} applies command to each element of the list
87+
\nd@modify\list\n{elt} modifies the \n-th element of the
8888
list, if there is such an element. Here \n is a counter. Elements
8989
are counted from the right, starting from 1.
9090

91-
We use lists of items of the forms \nd*t, \nd*v, \nd*i, and \nd*g{...}
91+
We use lists of items of the forms \nd@t, \nd@v, \nd@i, and \nd@g{...}
9292
to represent the current indentation level and format (see Layer A,
93-
above). The function \nd*cont computes the indentation for the
94-
following line by replacing all items of the form \nd*t by \nd*v and
95-
\nd*g{...} by \nd*i.
93+
above). The function \nd@cont computes the indentation for the
94+
following line by replacing all items of the form \nd@t by \nd@v and
95+
\nd@g{...} by \nd@i.
9696

9797
With the list syntax, a derivation can be expressed like this:
9898

9999
\[
100100
\begin{array}{lll}
101-
\gdef\stack{\nd*nil}
101+
\gdef\stack{\nd@nil}
102102
\newcount\n
103-
\nd*push\stack{\nd*t}
104-
1 & \nd*iter\stack\relax\nd*s\nd*u {\neg\exists xP(x)} \\
105-
\nd*cont\stack
106-
\nd*push\stack{\nd*i}
107-
\nd*push\stack{\nd*t}
108-
\nd*n=2\nd*modify\stack\n{\nd*g{u}}
109-
\nd*push\stack{\nd*i}
110-
\nd*push\stack{\nd*t}
111-
2 & \nd*iter\stack\relax\nd*s\nd*u {P(u)} \\
112-
\nd*cont\stack
113-
3 & \nd*iter\stack\relax\nd*s\nd*f {\exists xP(x)} \\
114-
\nd*cont\stack
115-
4 & \nd*iter\stack\relax\nd*s\nd*f {\neg\exists xP(x)} \\
116-
\nd*cont\stack
117-
5 & \nd*iter\stack\relax\nd*s\nd*f {\bot} \\
118-
\nd*cont\stack
119-
\nd*pop\stack
120-
\nd*pop\stack
121-
6 & \nd*iter\stack\relax\nd*s\nd*f {\neg P(u)} \\
122-
\nd*cont\stack
123-
\nd*pop\stack
124-
\nd*pop\stack
125-
7 & \nd*iter\stack\relax\nd*s\nd*f {\forall y\neg P(y)} \\
126-
\nd*cont\stack
103+
\nd@push\stack{\nd@t}
104+
1 & \nd@iter\stack\relax\nd@s\nd@u {\neg\exists xP(x)} \\
105+
\nd@cont\stack
106+
\nd@push\stack{\nd@i}
107+
\nd@push\stack{\nd@t}
108+
\nd@n=2\nd@modify\stack\n{\nd@g{u}}
109+
\nd@push\stack{\nd@i}
110+
\nd@push\stack{\nd@t}
111+
2 & \nd@iter\stack\relax\nd@s\nd@u {P(u)} \\
112+
\nd@cont\stack
113+
3 & \nd@iter\stack\relax\nd@s\nd@f {\exists xP(x)} \\
114+
\nd@cont\stack
115+
4 & \nd@iter\stack\relax\nd@s\nd@f {\neg\exists xP(x)} \\
116+
\nd@cont\stack
117+
5 & \nd@iter\stack\relax\nd@s\nd@f {\bot} \\
118+
\nd@cont\stack
119+
\nd@pop\stack
120+
\nd@pop\stack
121+
6 & \nd@iter\stack\relax\nd@s\nd@f {\neg P(u)} \\
122+
\nd@cont\stack
123+
\nd@pop\stack
124+
\nd@pop\stack
125+
7 & \nd@iter\stack\relax\nd@s\nd@f {\forall y\neg P(y)} \\
126+
\nd@cont\stack
127127
\end{array}
128128
\]
129129

130130
LAYER B
131131

132132
Layer B is simply a wrapper around layer A. It provides commands
133-
\nd*beginb, \nd*resumeb, \nd*endb, \nd*openb, \nd*closeb, \nd*guardb,
134-
\nd*hypob, and \nd*haveb which abstract from the layer A
133+
\nd@beginb, \nd@resumeb, \nd@endb, \nd@openb, \nd@closeb, \nd@guardb,
134+
\nd@hypob, and \nd@haveb which abstract from the layer A
135135
primitives. This includes automatic line numbering, and automatic
136-
indentation. \nd*hypocontb and \nd*havecontb are like \nd*hypob and
137-
\nd*haveb, except that they introduce continuation lines that are
138-
slightly indented and have no line number/label. \nd*beginb and
139-
\nd*endb enclose a natural deduction in layer B syntax. \nd*resumeb is
140-
like \nd*beginb, except that it resumes a deduction in progress (for
141-
instance, after a manual page break). \nd*openb and \nd*closeb open,
142-
respectively close, a subproof. \nd*guardb{n}{g} adds the guard g to
136+
indentation. \nd@hypocontb and \nd@havecontb are like \nd@hypob and
137+
\nd@haveb, except that they introduce continuation lines that are
138+
slightly indented and have no line number/label. \nd@beginb and
139+
\nd@endb enclose a natural deduction in layer B syntax. \nd@resumeb is
140+
like \nd@beginb, except that it resumes a deduction in progress (for
141+
instance, after a manual page break). \nd@openb and \nd@closeb open,
142+
respectively close, a subproof. \nd@guardb{n}{g} adds the guard g to
143143
the nth enclosing subderivation (counted from 1 from the
144-
inside). \nd*hypob introduces a hypothesis, and \nd*haveb introduces a
144+
inside). \nd@hypob introduces a hypothesis, and \nd@haveb introduces a
145145
non-hypothesis line in a proof. Line numbering is integrated, but
146146
justifications must still be given manually. Also, proof lines must
147147
still be terminated by '\\'. An idiosyncracy of this layer is that in
148148
a list of several hypotheses, all but the last one must be called with
149-
\nd*haveb, not \nd*hypob, to avoid drawing a horizontal line under
149+
\nd@haveb, not \nd@hypob, to avoid drawing a horizontal line under
150150
each of them.
151151

152152
Example of a derivation using layer B syntax. Note that the "line
153153
numbers" are really labels, which will be replaced by consecutive line
154154
numbers in the output.
155155

156156
\[
157-
\nd*beginb
158-
\nd*haveb {1}{P\vee Q} \\
159-
\nd*hypob {2}{\neg Q} \\
160-
\nd*openb
161-
\nd*hypob {3}{P} \\
162-
\nd*haveb {4}{P} \mbox{by \ndref{3}} \\
163-
\nd*closeb
164-
\nd*openb
165-
\nd*hypob {5}{Q} \\
166-
\nd*haveb {6}{\neg Q} \mbox{by \ndref{2}} \\
167-
\nd*haveb {6a}{\bot} \mbox{by \ndref{5,6}} \\
168-
\nd*haveb {6b}{P} \mbox{by \ndref{6a}} \\
169-
\nd*closeb
170-
\nd*haveb {8}{P} \mbox{by \ndref{1,3-4,5-6b}} \\
171-
\nd*endb
157+
\nd@beginb
158+
\nd@haveb {1}{P\vee Q} \\
159+
\nd@hypob {2}{\neg Q} \\
160+
\nd@openb
161+
\nd@hypob {3}{P} \\
162+
\nd@haveb {4}{P} \mbox{by \ndref{3}} \\
163+
\nd@closeb
164+
\nd@openb
165+
\nd@hypob {5}{Q} \\
166+
\nd@haveb {6}{\neg Q} \mbox{by \ndref{2}} \\
167+
\nd@haveb {6a}{\bot} \mbox{by \ndref{5,6}} \\
168+
\nd@haveb {6b}{P} \mbox{by \ndref{6a}} \\
169+
\nd@closeb
170+
\nd@haveb {8}{P} \mbox{by \ndref{1,3-4,5-6b}} \\
171+
\nd@endb
172172
\]
173173

174174
Here is another example, using a guard.
175175

176176
\[
177-
\nd*beginb
178-
\nd*hypob {1}{\neg\exists xP(x)} \\
179-
\nd*openb
180-
\nd*guardb {1}{u}
181-
\nd*openb
182-
\nd*hypob {2}{P(u)} \\
183-
\nd*haveb {3}{\exists xP(x)} \mbox{by \ndref{2}} \\
184-
\nd*haveb {4}{\neg\exists xP(x)} \mbox{by \ndref{1}} \\
185-
\nd*haveb {5}{\bot} \mbox{by \ndref{3,4}}\\
186-
\nd*closeb
187-
\nd*haveb {6}{\neg P(u)} \mbox{by \ndref{2-5}}\\
188-
\nd*closeb
189-
\nd*haveb {7}{\forall y\neg P(y)} \mbox{by \ndref{2-6}}\\
190-
\nd*endb
177+
\nd@beginb
178+
\nd@hypob {1}{\neg\exists xP(x)} \\
179+
\nd@openb
180+
\nd@guardb {1}{u}
181+
\nd@openb
182+
\nd@hypob {2}{P(u)} \\
183+
\nd@haveb {3}{\exists xP(x)} \mbox{by \ndref{2}} \\
184+
\nd@haveb {4}{\neg\exists xP(x)} \mbox{by \ndref{1}} \\
185+
\nd@haveb {5}{\bot} \mbox{by \ndref{3,4}}\\
186+
\nd@closeb
187+
\nd@haveb {6}{\neg P(u)} \mbox{by \ndref{2-5}}\\
188+
\nd@closeb
189+
\nd@haveb {7}{\forall y\neg P(y)} \mbox{by \ndref{2-6}}\\
190+
\nd@endb
191191
\]
192192

193193
LAYER C
@@ -197,42 +197,42 @@ information and putting it correctly into an array. Specifically, in
197197
layer C, it is no more necessary to explicitly give '\\', and all
198198
hypotheses are denoted \hypo. Layer C also provides a convenient
199199
syntax for writing justification labels. Further, layer C provides
200-
``multi-line'' commands, thus e.g. \nd*mhypoc{a}{x\\y\\z} is an
201-
abbreviation for \nd*hypoc{a}{x}\nd*hypocontc{y}\nd*hypocontc{z}. In
202-
addition there is a \nd*by command for writing justification labels,
203-
in the style of \nd*by{$\vee$E}{1,2-4,5-6}.
200+
``multi-line'' commands, thus e.g. \nd@mhypoc{a}{x\\y\\z} is an
201+
abbreviation for \nd@hypoc{a}{x}\nd@hypocontc{y}\nd@hypocontc{z}. In
202+
addition there is a \nd@by command for writing justification labels,
203+
in the style of \nd@by{$\vee$E}{1,2-4,5-6}.
204204

205-
Commands exported by layer C are: \nd*hypoc, \nd*havec, \nd*hypocontc,
206-
\nd*havecontc, \nd*mhypoc, \nd*mhavec, \nd*mhypocontc, \nd*mhavecontc,
207-
\nd*by, \nd*beginc, \nd*resumec, \nd*endc, \nd*openc, \nd*closec,
208-
\nd*guardc.
205+
Commands exported by layer C are: \nd@hypoc, \nd@havec, \nd@hypocontc,
206+
\nd@havecontc, \nd@mhypoc, \nd@mhavec, \nd@mhypocontc, \nd@mhavecontc,
207+
\nd@by, \nd@beginc, \nd@resumec, \nd@endc, \nd@openc, \nd@closec,
208+
\nd@guardc.
209209

210210
The layer C macros work by storing each line in a data structure
211-
\ppp,\nd*typ,\nd*byt. The line is ejected when the beginning of the
211+
\ppp,\nd@typ,\nd@byt. The line is ejected when the beginning of the
212212
next line is read, and once at the very end. In this way, we can put
213213
in the correct line breaks (whether or not the line carries a
214214
justification), and a hypothesis does not get typeset until we know
215-
whether it is followed by another hypothesis. \nd*sto stores a new
216-
line, \nd*clr clears the current line, \nd*cmd outputs the current
215+
whether it is followed by another hypothesis. \nd@sto stores a new
216+
line, \nd@clr clears the current line, \nd@cmd outputs the current
217217
line.
218218

219219
Example of layer C syntax:
220220

221221
\[
222-
\nd*beginc
223-
\nd*hypoc {1}{\neg\exists xP(x)}
224-
\nd*openc
225-
\nd*guardc {1}{u}
226-
\nd*openc
227-
\nd*hypoc {2}{P(u)}
228-
\nd*havec {3}{\exists xP(x)} \nd*by{$\exists$I}{2}
229-
\nd*havec {4}{\neg\exists xP(x)} \nd*by{R}{1}
230-
\nd*havec {5}{\bot} \nd*by{$\neg$E}{3,4}
231-
\nd*closec
232-
\nd*havec {6}{\neg P(u)} \nd*by{$\neg$I}{2-5}
233-
\nd*closec
234-
\nd*havec {7}{\forall y\neg P(y)} \nd*by{$\forall$I}{2-6}
235-
\nd*endc
222+
\nd@beginc
223+
\nd@hypoc {1}{\neg\exists xP(x)}
224+
\nd@openc
225+
\nd@guardc {1}{u}
226+
\nd@openc
227+
\nd@hypoc {2}{P(u)}
228+
\nd@havec {3}{\exists xP(x)} \nd@by{$\exists$I}{2}
229+
\nd@havec {4}{\neg\exists xP(x)} \nd@by{R}{1}
230+
\nd@havec {5}{\bot} \nd@by{$\neg$E}{3,4}
231+
\nd@closec
232+
\nd@havec {6}{\neg P(u)} \nd@by{$\neg$I}{2-5}
233+
\nd@closec
234+
\nd@havec {7}{\forall y\neg P(y)} \nd@by{$\forall$I}{2-6}
235+
\nd@endc
236236
\]
237237

238238
LAYER D
@@ -250,24 +250,24 @@ global name space. There is also an environment ndresume which is like
250250
nd, except that it continues a proof in progress (with continuous
251251
nesting and labeling).
252252

253-
The macros \nd*hypod, \nd*haved, \nd*opend, \nd*guardd are essentially
253+
The macros \nd@hypod, \nd@haved, \nd@opend, \nd@guardd are essentially
254254
the user-level macros, but with all optional argument spelled-out. The
255255
versions without the final "d" allow the optional arguments to be
256256
omitted.
257257

258-
The functions \nd*optarg and \nd*optargg are used to handle optional
259-
arguments. Usage: \nd*optarg{default}{continuation}xxx - reads an
258+
The functions \nd@optarg and \nd@optargg are used to handle optional
259+
arguments. Usage: \nd@optarg{default}{continuation}xxx - reads an
260260
optional argument, supplies default if necessary, then continues with
261261
continuation. Continuation expects optional argument between
262-
[...]. I.e., \nd*optarg{d}{c}[xxx] => c[xxx], and \nd*optarg{d}{c}x =>
263-
c[d]x if x != '['. Behavior is undefined if x is {[...}. \nd*optargg
262+
[...]. I.e., \nd@optarg{d}{c}[xxx] => c[xxx], and \nd@optarg{d}{c}x =>
263+
c[d]x if x != '['. Behavior is undefined if x is {[...}. \nd@optargg
264264
is similar except it takes two continuations: first one for optional
265265
argument present, second for not present. It takes no default value.
266266

267-
The function \nd*five{\a} reads five, partly optional arguments of the
267+
The function \nd@five{\a} reads five, partly optional arguments of the
268268
shape [][]{}[]{}, then call \a with these arguments.
269269

270-
Finally, \nd*init puts all the commands which are visible inside an
270+
Finally, \nd@init puts all the commands which are visible inside an
271271
nd-environment in the current name space.
272272

273273
Example of a derivation using layer D syntax. As before, the "line

0 commit comments

Comments
 (0)