The first step in creating the logic is to declare a term to define well-formedness of expressions. We use the term type to provide a well-formedness type judgment. Proofs of well-formedness are computationally meaningless, and we also declare a trivial proof term trivial.
To form this judgment we create a module Fol_type. First, create an interface:
1. Create the file fol_type.mli, containing the line:
declare "type"{'A} declare trivial
The intent of this term is that if the expression type{'t} is provable, then the term 't is a well-formed formula.
The next step is to compile this interface.
2. Compile the interface fol_type.mli, with the command:
% prlc -c fol_type.mli
This step creates two new files: fol_type.cmi defines the ML interface, and the file file_type.cmiz contains the logical signature for the module.
Next, we create the implementation. The rules for well-formedness will be stated in the module for the logical operators, so the only implementation we need to include is the syntax declaration and a display form to produce pretty output.
3. Create the file fol_type.ml, containing the following lines:
extends Base_theory declare "type"{'A} declare trivial dform type_df : except_mode[src] :: "type"{'A} = slot{'A} `" type" dform trivial_df : except_mode[src] :: trivial = cdot
The Base_theory is included for basic logic and display form definitions. The display form prints the term type{'t} as the term 't type. The trivial term is printed as the single character cdot, which is defined in the Nuprl_font module in the Base_theory theory.
The next step is to compile this implementation.
4. Compile the implementation fol_type.ml, with the following command:
% prlc -c -I . -I ../base fol_type.ml
The compile step produces two files: the fol_type.cmo file contains the ML implementation, and the fol_type.cmoz file contains the logical implementation. The implementation is checked with the interface during the compile step. Any discrepancies produce an error.
Now that the module is defined, we can view it with the module editor. To compile the new editor, change to the editor/ml directory.
5. Compile the new editor, with the following commands:
% cd editor/ml % make
Now, invoke the editor, and view the Fol_type module.
6. Start the editor, and view the Fol_type module,
![]()
The theory listing includes the declarations with their unqualified names. It also lists the display forms in expanded form. The editor can be exited with the command exit 0;;, or with EOF (usually ^D in Emacs).