The informal language we used in Naive Type Theory does not reveal any
pattern to the notation. We see forms like
, f(a),
,
, Ui consisting of infix
operators, parenthesized arguments, prefix operators,
subscripts, etc. We would like a regular pattern to the terms that is
a basis for analyzing and manipulating them. A Lisp-like syntax,
might be adequate, but does not provide the
flexibility we want for dealing with binding structure; Lisp only
allows
for binding. So the term
structure in Nuprl has the form
For display purposes, if
is empty, we do not show it, and
if n=0 we drop the parentheses. Here is a list of all the Nuprl
terms we need
| term | display form |
Syntactic variety comes from the display forms, written in the right column. These are like LATEXprint macros, but they are also used for input as well.
Syntactic Theory
To understand how to compute with terms, we first need a complete account of certain aspects of the syntax. The main idea we need is the notion of substitution of a term s for occurrences of a variable x in a term t, written
terms
| Variables |
Induction Principle
The induction principle corresponding to this class is given by
for all terms and x a variable |
![]()
Inductive Definitions
Objects can be defined inductively over the class of
terms
using the same induction principle. Here is the definition of the
set of free variables, FV(t), of a term t.
| FV(t) = case | t is a variable v
then |
|---|
Based on the syntactic theory, we can define exactly the kind of substitution we want. The interesting feature is that it must rename bound variables to avoid capture and rename them in a minimal way, i. e. rename as few variables as possible. For example, in
![]()
if we substitute x for z, then we must rename the bound occurrences of x, but we do not want to rename them to y, because this will cause y to be renamed in the scope of x.
Aitken gives a precise definition of all this. He uses the concept t[s/x]t' defined as:
Definition We say that t' is a substitution of s for x in t, written t[s/x]t',
iff
| x [s/x] s |
Theorem:
LTerm.
Var.
LTerm
From a (constructive) proof of this
formula, we can
extract a function to compute t' from t and s.