@@ -5,7 +5,7 @@ which is provided in the file fitchdoc.tex.
55
66GENERAL
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
99exceptions are \ndref, \nddim, \ndindent, and the "nd" and "ndresume"
1010latex environments.
1111
@@ -22,36 +22,36 @@ REFERENCES
2222
2323We start with some macros to facilitate automatic line numbering, and
2424for 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
2727line number referenced by x, \ndref{xxx} to parse a list of
2828references, separated by commas, periods, and hyphens, and translate
2929all references to line numbers. Note: \ndref ignores spaces in its
3030argument, 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,
3232and thus it has a user accessible name. Most general ``line numbers''
3333actually 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
3535set the letter to n and the number to m. As special cases, if the
3636second argument is empty, it is not set, and if the first argument is
3737\relax, it is not set.
3838
3939Example 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}
4343will produce: 1; 2; n+1; 3; 2; 1, 2-3, n+1
4444
4545LAYER A
4646
4747Layer 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
5151produce 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
5555the space it creates. These elements are spaced so that they are
5656appropriate as left-aligned array entries. Line numberings and
5757justifications 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
7777LISTS
7878
7979This 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
8181is some arbitrary code. Note that lists grow to the right. The
8282following 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
8888list, if there is such an element. Here \n is a counter. Elements
8989are 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{...}
9292to 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
9797With 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
130130LAYER B
131131
132132Layer 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
135135primitives. 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
143143the 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
145145non-hypothesis line in a proof. Line numbering is integrated, but
146146justifications must still be given manually. Also, proof lines must
147147still be terminated by '\\'. An idiosyncracy of this layer is that in
148148a 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
150150each of them.
151151
152152Example of a derivation using layer B syntax. Note that the "line
153153numbers" are really labels, which will be replaced by consecutive line
154154numbers 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
174174Here 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
193193LAYER C
@@ -197,42 +197,42 @@ information and putting it correctly into an array. Specifically, in
197197layer C, it is no more necessary to explicitly give '\\', and all
198198hypotheses are denoted \hypo. Layer C also provides a convenient
199199syntax 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
210210The 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
212212next line is read, and once at the very end. In this way, we can put
213213in the correct line breaks (whether or not the line carries a
214214justification), 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
217217line.
218218
219219Example 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
238238LAYER D
@@ -250,24 +250,24 @@ global name space. There is also an environment ndresume which is like
250250nd, except that it continues a proof in progress (with continuous
251251nesting 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
254254the user-level macros, but with all optional argument spelled-out. The
255255versions without the final "d" allow the optional arguments to be
256256omitted.
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
260260optional argument, supplies default if necessary, then continues with
261261continuation. 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
264264is similar except it takes two continuations: first one for optional
265265argument 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
268268shape [][]{}[]{}, 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
271271nd-environment in the current name space.
272272
273273Example of a derivation using layer D syntax. As before, the "line
0 commit comments