15-851 Computation and Deduction
Software

We will be using the Twelf system, which is an implementation of a logical framework (LF), a constraint logic programming language (Elf), and a meta-theorem prover. Below is a quick introduction. For more information see the Twelf home page and the User's Guide for Version 1.3

The executable files you need are installed in the Andrew and CS domains at CMU. You have the choice to run Twelf within Emacs or directly from a shell by typing in the full path name. We recommend running Twelf within Emacs.

What's New?

  • (Feb 6) Mini-ML examples, also available in directory /afs/cs.cmu.edu/user/fp/courses/comp-ded/elf/mini-ml/

Twelf in the Andrew domain

To run Twelf within emacs, you need to add the following line to your .emacs file:

(load "/afs/cs/local/twelf/common/andrew/emacs/twelf-init.el")

You can then continue and run the Twelf Server or the SML interface within Emacs:

  • Run Twelf Server: M-x twelf-server
  • Run SML interface: M-x twelf-sml
  • Twelf mode: M-x twelf-mode
  • View documentation: M-x twelf-info

You can also run Twelf from a shell by providing the full path to the Twelf Server or SML interface.

  • Run Twelf server: /afs/cs/local/twelf/common/andrew/bin/twelf-server
  • Run SML interface: /afs/cs/local/twelf/common/andrew/bin/twelf-sml

Twelf in the CS domain

To run Twelf within Emacs, you need to add the following line to your .emacs file:

(load "/usr/local/lib/twelf/emacs/twelf-init.el")

You can then continue and run the Twelf Server or the SML interface within Emacs:

  • Run Twelf Server: M-x twelf-server
  • Run SML interface: M-x twelf-sml
  • Twelf mode: M-x twelf-mode
  • View documentation: M-x twelf-info

You can also run Twelf from a shell by providing the full path to the twelf server and / or SML interface.

  • Run Twelf server: twelf-server
  • Run SML interface: twelf-sml

Running Twelf on other machines

If you would like to install Twelf on your own machine, please follow the instructions on the Twelf home page.

A quick start with Twelf

Step 1: First, copy the files from the Mini-ML (directory /afs/cs.cmu.edu/user/fp/courses/comp-ded/elf/mini-ml/) to your directory. We assume your .emacs file is set up as described above and your are visiting the file mini-ml.elf. The current query or declaration refers to the one under the cursor in the current buffer.

Step 2: You can type-check and load the current configuration by typing C-c C-c. Twelf will then ask what config file to use. The default config file is sources.cfg.

Step 3: To execute some example queries, load the file examples.quy. You can execute a single query by placing your cursor in the line of the query and typing C-c C-d. You can also execute the whole file by typing C-c C-s.

Summary

C-c C-c                    ; type-check and load current configuration
C-c C-d                    ; execute current query
C-c C-s                    ; execute current file

If you are using XEmacs, then you do not actually need to remember all these short-cuts. The tool bar at the top of your xemacs has an item for Twelf which contains the most important commands you need to know.

Documentation

For a more detailed explanation on how to use Twelf, please consult the Twelf User's Guide (PS, PDF). In particular, there is a Emacs command summary which you might find very useful.

Contact

If you have any problems using Twelf please send e-mail to Brigitte Pientka.

[ Home | Schedule | Assignments | Handouts | Software | Overview ]

fp@cs
Frank Pfenning