Twelf is the current version of a succession of implementations of the logical framework LF. Previous systems include Elf (which provided type reconstruction and the operational semantics reimplemented in Twelf) and MLF (which implemented module-level constructs loosely based on the signatures and functors of ML still missing from Twelf).
Twelf should be understood as research software. This means comments, suggestions, and bug reports are extremely welcome, but there are no guarantees regarding response times. The same remark applies to these notes which constitute the only documentation on the present Twelf implementation.
For current information including download instructions, publications, and mailing list, see the Twelf home page at http://www.cs.cmu.edu/~twelf/. This User's Guide is published as
Frank Pfenning and Carsten Schuermann Twelf User's Guide Technical Report CMU-CS-98-173, Department of Computer Science, Carnegie Mellon University, November 1998.
Below we state the typographic conventions in this manual.
code
File names for examples given in this guide are relative to the main
directory of the Twelf installation. For example
`examples/guide/nd.elf' may be found in
`/usr/local/twelf/examples/guide/nd.elf' if Twelf was installed
into the `/usr/local/' directory.
While the underlying type theory has not changed, the Twelf implementation differs from older Elf implementation in a few ways. Mostly, these are simplifications and improvements. The main feature which has not yet been ported is the Elf server interface to Emacs. Also, while the type checker is more efficient now, the operational semantics does not yet incorporate some of the optimizations of the older Elf implementations and is therefore slower.
%name
declarations has changed by allowing only one preferred
name to be specified. Also, %name
, %infix
, %prefix
and %postfix
declarations must be terminated by a period `.'
which previously was optional. Further, single lines comments now must
start with `%whitespace' or `%%' in order to avoid
misspelled keywords of the form `%keyword' to be ignored.
sigma [x:A] B
which
searched for a solution M : A
and then solved the result of
subsituting M
for x
in B
. In Twelf this
mechanism has been replaced by a declaration %solve c : A
which
searches for a solution M : A
and then defines c = M : A
,
where the remaining free variables are implicitly universally
quantified.
{x:A} B
where x
occurs in the normal form of B
are treated
statically, while non-dependent function type A -> B
or
B <- A
or {x:A} B
where x
does not occur
in B
are treated dynamically.
Assuming you are running on a Unix system with SML of New Jersey already
installed (see section 12 Installation) you can build Twelf as follows. Here
`%' is assumed to be the shell prompt. You may need to edit the
file `Makefile' to give the proper location for sml-cm
.
% gunzip twelf-1-2.tar.gz % tar -xf twelf-1-2.tar % cd twelf % make % bin/twelf-server Twelf 1.2, Aug 27 1998 %% OK %%
You can now load the examples used in this guide and pose an example
query as shown below. The prompt from the Twelf top-level is `?-'.
To drop from the Twelf top-level to the ML top-level, type C-c
(CTRL c). To exit the Twelf server you may issue the
quit
command or type C-d (CTRL c).
Config.read examples/guide/sources.cfg Config.load top ?- of (lam [x] x) T. Solving... T = arrow T1 T1. More? y No more solutions ?- C-c interrupt %% OK %% quit %
Go to the first, previous, next, last section, table of contents.