About Types
About Types
The universe of ACL2 objects includes objects of many different
types. For example, t is a ``symbol'' and 3 is an ``integer.'' Roughly
speaking the objects of ACL2 can be partitioned into the following types:
- Numbers such as 3, -22/7,
#c(3 5/2).
- Characters such as #\A,
#\a, #\Space.
- Strings such as "This is a
string.".
- Symbols such as 'abc,
'smith::abc.
- Conses (or
Ordered Pairs) such as '((a . 1) (b . 2)).
When proving theorems it is important to know the types of object returned
by a term. ACL2 uses a complicated heuristic algorithm, called type-set , to determine what types of objects a term may
produce. The user can more or less program the type-set algorithm by
proving type-prescription
rules.
ACL2 is an ``untyped'' logic in the sense that the syntax is not typed: It
is legal to apply a function symbol of n arguments to any n terms, regardless
of the types of the argument terms. Thus, it is permitted to write such odd
expressions as (+ t 3) which sums the symbol t and the integer 3.
Common Lisp does not prohibit such expressions. We like untyped languages
because they are simple to describe, though proving theorems about them can be
awkward because, unless one is careful in the way one defines or states
things, unusual cases (like (+ t 3)) can arise.
To make theorem proving easier in ACL2, the axioms actually define a value
for such terms. The value of (+ t 3) is 3; under the ACL2 axioms,
non-numeric arguments to + are treated as though they were 0.
You might immediately wonder about our claim that ACL2 is Common Lisp,
since (+ t 3) is ``an error'' (and will sometimes even ``signal an
error'') in Common Lisp. It is to handle this problem that ACL2 has
guards. We will discuss guards later in the Walking Tour. However,
many new users simply ignore the issue of guards entirely and that is what we
recommend for now.
You should now return to the Walking Tour.