PURE_LIST_CONV takes a term of the form:
CONST1 ... (CONST2 ...) ...
where CONST1 and CONST2 are operators on lists and CONST2
returns a list result. It can be one of NIL, CONS, SNOC, APPEND,
FLAT or REVERSE. The form of the resulting theorem depends on CONST1 and
CONST2. Some auxiliary theorems must be provided about CONST1.
PURE_LIST_CONV. These are passed as a record argument.
The Fold_thms field of the record should hold a theorem defining the constant
in terms of FOLDR or FOLDL. The definition should have the form:
|- CONST1 ...l... = fold f e l
where fold is either FOLDR or FOLDL, f is a function, e a
base element and l a list variable. For example, a suitable theorem for
SUM is
Given this theorem, no auxiliary theorems and the term
--`SUM (CONS x l)`--, a call to PURE_LIST_CONV returns the theorem:
|- SUM (CONS x l) = x + (SUM l)
The Aux_thms field of the record argument to PURE_LIST_CONV provides
auxiliary theorems concerning the terms f and e found in the definition
with respect to FOLDR or FOLDL. For example, given the theorem:
and given the term --`SUM (APPEND l1 l2)`--, a call to
PURE_LIST_CONV returns the theorem
|- SUM (APPEND l1 l2) = (SUM l1) + (SUM l2)
The following table shows the form of the theorem returned and the
auxiliary theorems needed if CONST1 is defined in terms of FOLDR.
CONST2 | side conditions | tm2 in result |- tm1 = tm2
==============|================================|===========================
[] | NONE | e
[x] | NONE | f x e
CONS x l | NONE | f x (CONST1 l)
SNOC x l | e is a list variable | CONST1 (f x e) l
APPEND l1 l2 | e is a list variable | CONST1 (CONST1 l1) l2
APPEND l1 l2 | |- FCOMM g f, |- LEFT_ID g e | g (CONST1 l1) (CONST2 l2)
FLAT l1 | |- FCOMM g f, |- LEFT_ID g e, |
| |- CONST3 l = FOLDR g e l | CONST3 (MAP CONST1 l)
REVERSE l | |- COMM f, |- ASSOC f | CONST1 l
REVERSE l | f == (\x l. h (g x) l) |
| |- COMM h, |- ASSOC h | CONST1 l
The following table shows the form of the theorem returned and the
auxiliary theorems needed if CONST1 is defined in terms of FOLDL.
CONST2 | side conditions | tm2 in result |- tm1 = tm2
==============|================================|===========================
[] | NONE | e
[x] | NONE | f x e
SNOC x l | NONE | f x (CONST1 l)
CONS x l | e is a list variable | CONST1 (f x e) l
APPEND l1 l2 | e is a list variable | CONST1 (CONST1 l1) l2
APPEND l1 l2 | |- FCOMM f g, |- RIGHT_ID g e | g (CONST1 l1) (CONST2 l2)
FLAT l1 | |- FCOMM f g, |- RIGHT_ID g e, |
| |- CONST3 l = FOLDR g e l | CONST3 (MAP CONST1 l)
REVERSE l | |- COMM f, |- ASSOC f | CONST1 l
REVERSE l | f == (\l x. h l (g x)) |
| |- COMM h, |- ASSOC h | CONST1 l
|- MONOID f e can be used instead of |- FCOMM f f,
|- LEFT_ID f or |- RIGHT_ID f. |- ASSOC f can also be used in place of
|- FCOMM f f.