Generic typed list fixing function.
Function:
(defun element-list-fix (x) (if (atom x) (and (element-list-final-cdr-p t) x) (cons (element-fix (car x)) (element-list-fix (cdr x)))))
Theorem:
(defthm element-list-p-of-element-list-fix (implies (element-p (element-example)) (element-list-p (element-list-fix x))) :rule-classes :rewrite)
Theorem:
(defthm element-list-fix-when-element-list-p (implies (element-list-p x) (equal (element-list-fix x) x)) :rule-classes :rewrite)
Theorem:
(defthm consp-of-element-list-fix (equal (consp (element-list-fix x)) (consp x)) :rule-classes :rewrite)
Theorem:
(defthm element-list-fix-of-cons (equal (element-list-fix (cons a x)) (cons (element-fix a) (element-list-fix x))) :rule-classes :rewrite)
Theorem:
(defthm len-of-element-list-fix (equal (len (element-list-fix x)) (len x)) :rule-classes :rewrite)
Theorem:
(defthm element-fix-of-append (equal (element-list-fix (append a b)) (append (element-list-fix a) (element-list-fix b))) :rule-classes :rewrite)