Notion of terminated tree.
A tree is terminated iff all its leaves are natural numbers (not rule names).
Function:
(defun tree-terminatedp (tree) (declare (xargs :guard (treep tree))) (tree-case tree :leafterm t :leafrule nil :nonleaf (tree-list-list-terminatedp tree.branches)))
Function:
(defun tree-list-terminatedp (trees) (declare (xargs :guard (tree-listp trees))) (or (endp trees) (and (tree-terminatedp (car trees)) (tree-list-terminatedp (cdr trees)))))
Function:
(defun tree-list-list-terminatedp (treess) (declare (xargs :guard (tree-list-listp treess))) (or (endp treess) (and (tree-list-terminatedp (car treess)) (tree-list-list-terminatedp (cdr treess)))))
Theorem:
(defthm return-type-of-tree-terminatedp.yes/no (b* ((?yes/no (tree-terminatedp tree))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-tree-list-terminatedp.yes/no (b* ((?yes/no (tree-list-terminatedp trees))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-tree-list-list-terminatedp.yes/no (b* ((?yes/no (tree-list-list-terminatedp treess))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm tree-terminatedp-of-tree-fix-tree (equal (tree-terminatedp (tree-fix tree)) (tree-terminatedp tree)))
Theorem:
(defthm tree-list-terminatedp-of-tree-list-fix-trees (equal (tree-list-terminatedp (tree-list-fix trees)) (tree-list-terminatedp trees)))
Theorem:
(defthm tree-list-list-terminatedp-of-tree-list-list-fix-treess (equal (tree-list-list-terminatedp (tree-list-list-fix treess)) (tree-list-list-terminatedp treess)))
Theorem:
(defthm tree-terminatedp-tree-equiv-congruence-on-tree (implies (tree-equiv tree tree-equiv) (equal (tree-terminatedp tree) (tree-terminatedp tree-equiv))) :rule-classes :congruence)
Theorem:
(defthm tree-list-terminatedp-tree-list-equiv-congruence-on-trees (implies (tree-list-equiv trees trees-equiv) (equal (tree-list-terminatedp trees) (tree-list-terminatedp trees-equiv))) :rule-classes :congruence)
Theorem:
(defthm tree-list-list-terminatedp-tree-list-list-equiv-congruence-on-treess (implies (tree-list-list-equiv treess treess-equiv) (equal (tree-list-list-terminatedp treess) (tree-list-list-terminatedp treess-equiv))) :rule-classes :congruence)
Theorem:
(defthm tree-list-terminatedp-of-cons (equal (tree-list-terminatedp (cons acl2::a acl2::x)) (and (tree-terminatedp acl2::a) (tree-list-terminatedp acl2::x))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-cdr-when-tree-list-terminatedp (implies (tree-list-terminatedp (double-rewrite acl2::x)) (tree-list-terminatedp (cdr acl2::x))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-when-not-consp (implies (not (consp acl2::x)) (tree-list-terminatedp acl2::x)) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-terminatedp-of-car-when-tree-list-terminatedp (implies (tree-list-terminatedp acl2::x) (tree-terminatedp (car acl2::x))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-append (equal (tree-list-terminatedp (append acl2::a acl2::b)) (and (tree-list-terminatedp acl2::a) (tree-list-terminatedp acl2::b))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-list-fix (equal (tree-list-terminatedp (list-fix acl2::x)) (tree-list-terminatedp acl2::x)) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-sfix (iff (tree-list-terminatedp (sfix acl2::x)) (or (tree-list-terminatedp acl2::x) (not (setp acl2::x)))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-insert (iff (tree-list-terminatedp (insert acl2::a acl2::x)) (and (tree-list-terminatedp (sfix acl2::x)) (tree-terminatedp acl2::a))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-delete (implies (tree-list-terminatedp acl2::x) (tree-list-terminatedp (delete acl2::k acl2::x))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-mergesort (iff (tree-list-terminatedp (mergesort acl2::x)) (tree-list-terminatedp (list-fix acl2::x))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-union (iff (tree-list-terminatedp (union acl2::x acl2::y)) (and (tree-list-terminatedp (sfix acl2::x)) (tree-list-terminatedp (sfix acl2::y)))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-intersect-1 (implies (tree-list-terminatedp acl2::x) (tree-list-terminatedp (intersect acl2::x acl2::y))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-intersect-2 (implies (tree-list-terminatedp acl2::y) (tree-list-terminatedp (intersect acl2::x acl2::y))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-difference (implies (tree-list-terminatedp acl2::x) (tree-list-terminatedp (difference acl2::x acl2::y))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-duplicated-members (implies (tree-list-terminatedp acl2::x) (tree-list-terminatedp (duplicated-members acl2::x))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-rev (equal (tree-list-terminatedp (rev acl2::x)) (tree-list-terminatedp (list-fix acl2::x))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-rcons (iff (tree-list-terminatedp (rcons acl2::a acl2::x)) (and (tree-terminatedp acl2::a) (tree-list-terminatedp (list-fix acl2::x)))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-terminatedp-when-member-equal-of-tree-list-terminatedp (and (implies (and (member-equal acl2::a acl2::x) (tree-list-terminatedp acl2::x)) (tree-terminatedp acl2::a)) (implies (and (tree-list-terminatedp acl2::x) (member-equal acl2::a acl2::x)) (tree-terminatedp acl2::a))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-when-subsetp-equal (and (implies (and (subsetp-equal acl2::x acl2::y) (tree-list-terminatedp acl2::y)) (tree-list-terminatedp acl2::x)) (implies (and (tree-list-terminatedp acl2::y) (subsetp-equal acl2::x acl2::y)) (tree-list-terminatedp acl2::x))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-set-equiv-congruence (implies (set-equiv acl2::x acl2::y) (equal (tree-list-terminatedp acl2::x) (tree-list-terminatedp acl2::y))) :rule-classes :congruence)
Theorem:
(defthm tree-list-terminatedp-of-set-difference-equal (implies (tree-list-terminatedp acl2::x) (tree-list-terminatedp (set-difference-equal acl2::x acl2::y))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-intersection-equal-1 (implies (tree-list-terminatedp (double-rewrite acl2::x)) (tree-list-terminatedp (intersection-equal acl2::x acl2::y))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-intersection-equal-2 (implies (tree-list-terminatedp (double-rewrite acl2::y)) (tree-list-terminatedp (intersection-equal acl2::x acl2::y))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-union-equal (equal (tree-list-terminatedp (union-equal acl2::x acl2::y)) (and (tree-list-terminatedp (list-fix acl2::x)) (tree-list-terminatedp (double-rewrite acl2::y)))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-take (implies (tree-list-terminatedp (double-rewrite acl2::x)) (iff (tree-list-terminatedp (take acl2::n acl2::x)) (or (tree-terminatedp nil) (<= (nfix acl2::n) (len acl2::x))))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-repeat (iff (tree-list-terminatedp (repeat acl2::n acl2::x)) (or (tree-terminatedp acl2::x) (zp acl2::n))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-terminatedp-of-nth-when-tree-list-terminatedp (implies (tree-list-terminatedp acl2::x) (tree-terminatedp (nth acl2::n acl2::x))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-update-nth (implies (tree-list-terminatedp (double-rewrite acl2::x)) (iff (tree-list-terminatedp (update-nth acl2::n acl2::y acl2::x)) (and (tree-terminatedp acl2::y) (or (<= (nfix acl2::n) (len acl2::x)) (tree-terminatedp nil))))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-butlast (implies (tree-list-terminatedp (double-rewrite acl2::x)) (tree-list-terminatedp (butlast acl2::x acl2::n))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-nthcdr (implies (tree-list-terminatedp (double-rewrite acl2::x)) (tree-list-terminatedp (nthcdr acl2::n acl2::x))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-last (implies (tree-list-terminatedp (double-rewrite acl2::x)) (tree-list-terminatedp (last acl2::x))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-remove (implies (tree-list-terminatedp acl2::x) (tree-list-terminatedp (remove acl2::a acl2::x))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-revappend (equal (tree-list-terminatedp (revappend acl2::x acl2::y)) (and (tree-list-terminatedp (list-fix acl2::x)) (tree-list-terminatedp acl2::y))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-cons (equal (tree-list-list-terminatedp (cons acl2::a acl2::x)) (and (tree-list-terminatedp acl2::a) (tree-list-list-terminatedp acl2::x))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-cdr-when-tree-list-list-terminatedp (implies (tree-list-list-terminatedp (double-rewrite acl2::x)) (tree-list-list-terminatedp (cdr acl2::x))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-when-not-consp (implies (not (consp acl2::x)) (tree-list-list-terminatedp acl2::x)) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-car-when-tree-list-list-terminatedp (implies (tree-list-list-terminatedp acl2::x) (tree-list-terminatedp (car acl2::x))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-append (equal (tree-list-list-terminatedp (append acl2::a acl2::b)) (and (tree-list-list-terminatedp acl2::a) (tree-list-list-terminatedp acl2::b))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-list-fix (equal (tree-list-list-terminatedp (list-fix acl2::x)) (tree-list-list-terminatedp acl2::x)) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-sfix (iff (tree-list-list-terminatedp (sfix acl2::x)) (or (tree-list-list-terminatedp acl2::x) (not (setp acl2::x)))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-insert (iff (tree-list-list-terminatedp (insert acl2::a acl2::x)) (and (tree-list-list-terminatedp (sfix acl2::x)) (tree-list-terminatedp acl2::a))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-delete (implies (tree-list-list-terminatedp acl2::x) (tree-list-list-terminatedp (delete acl2::k acl2::x))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-mergesort (iff (tree-list-list-terminatedp (mergesort acl2::x)) (tree-list-list-terminatedp (list-fix acl2::x))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-union (iff (tree-list-list-terminatedp (union acl2::x acl2::y)) (and (tree-list-list-terminatedp (sfix acl2::x)) (tree-list-list-terminatedp (sfix acl2::y)))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-intersect-1 (implies (tree-list-list-terminatedp acl2::x) (tree-list-list-terminatedp (intersect acl2::x acl2::y))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-intersect-2 (implies (tree-list-list-terminatedp acl2::y) (tree-list-list-terminatedp (intersect acl2::x acl2::y))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-difference (implies (tree-list-list-terminatedp acl2::x) (tree-list-list-terminatedp (difference acl2::x acl2::y))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-duplicated-members (implies (tree-list-list-terminatedp acl2::x) (tree-list-list-terminatedp (duplicated-members acl2::x))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-rev (equal (tree-list-list-terminatedp (rev acl2::x)) (tree-list-list-terminatedp (list-fix acl2::x))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-rcons (iff (tree-list-list-terminatedp (rcons acl2::a acl2::x)) (and (tree-list-terminatedp acl2::a) (tree-list-list-terminatedp (list-fix acl2::x)))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-when-member-equal-of-tree-list-list-terminatedp (and (implies (and (member-equal acl2::a acl2::x) (tree-list-list-terminatedp acl2::x)) (tree-list-terminatedp acl2::a)) (implies (and (tree-list-list-terminatedp acl2::x) (member-equal acl2::a acl2::x)) (tree-list-terminatedp acl2::a))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-when-subsetp-equal (and (implies (and (subsetp-equal acl2::x acl2::y) (tree-list-list-terminatedp acl2::y)) (tree-list-list-terminatedp acl2::x)) (implies (and (tree-list-list-terminatedp acl2::y) (subsetp-equal acl2::x acl2::y)) (tree-list-list-terminatedp acl2::x))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-set-equiv-congruence (implies (set-equiv acl2::x acl2::y) (equal (tree-list-list-terminatedp acl2::x) (tree-list-list-terminatedp acl2::y))) :rule-classes :congruence)
Theorem:
(defthm tree-list-list-terminatedp-of-set-difference-equal (implies (tree-list-list-terminatedp acl2::x) (tree-list-list-terminatedp (set-difference-equal acl2::x acl2::y))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-intersection-equal-1 (implies (tree-list-list-terminatedp (double-rewrite acl2::x)) (tree-list-list-terminatedp (intersection-equal acl2::x acl2::y))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-intersection-equal-2 (implies (tree-list-list-terminatedp (double-rewrite acl2::y)) (tree-list-list-terminatedp (intersection-equal acl2::x acl2::y))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-union-equal (equal (tree-list-list-terminatedp (union-equal acl2::x acl2::y)) (and (tree-list-list-terminatedp (list-fix acl2::x)) (tree-list-list-terminatedp (double-rewrite acl2::y)))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-take (implies (tree-list-list-terminatedp (double-rewrite acl2::x)) (iff (tree-list-list-terminatedp (take acl2::n acl2::x)) (or (tree-list-terminatedp nil) (<= (nfix acl2::n) (len acl2::x))))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-repeat (iff (tree-list-list-terminatedp (repeat acl2::n acl2::x)) (or (tree-list-terminatedp acl2::x) (zp acl2::n))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-of-nth-when-tree-list-list-terminatedp (implies (tree-list-list-terminatedp acl2::x) (tree-list-terminatedp (nth acl2::n acl2::x))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-update-nth (implies (tree-list-list-terminatedp (double-rewrite acl2::x)) (iff (tree-list-list-terminatedp (update-nth acl2::n acl2::y acl2::x)) (and (tree-list-terminatedp acl2::y) (or (<= (nfix acl2::n) (len acl2::x)) (tree-list-terminatedp nil))))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-butlast (implies (tree-list-list-terminatedp (double-rewrite acl2::x)) (tree-list-list-terminatedp (butlast acl2::x acl2::n))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-nthcdr (implies (tree-list-list-terminatedp (double-rewrite acl2::x)) (tree-list-list-terminatedp (nthcdr acl2::n acl2::x))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-last (implies (tree-list-list-terminatedp (double-rewrite acl2::x)) (tree-list-list-terminatedp (last acl2::x))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-remove (implies (tree-list-list-terminatedp acl2::x) (tree-list-list-terminatedp (remove acl2::a acl2::x))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-list-terminatedp-of-revappend (equal (tree-list-list-terminatedp (revappend acl2::x acl2::y)) (and (tree-list-list-terminatedp (list-fix acl2::x)) (tree-list-list-terminatedp acl2::y))) :rule-classes ((:rewrite)))
Theorem:
(defthm tree-list-terminatedp-when-atom (implies (atom trees) (tree-list-terminatedp trees)))
Theorem:
(defthm tree-list-list-terminatedp-when-atom (implies (atom treess) (tree-list-list-terminatedp treess)))
Theorem:
(defthm nat-listp-of-tree->string-when-terminated (implies (tree-terminatedp tree) (nat-listp (tree->string tree))))
Theorem:
(defthm nat-listp-of-tree-list->string-when-terminated (implies (tree-list-terminatedp trees) (nat-listp (tree-list->string trees))))
Theorem:
(defthm nat-listp-of-tree-list-list->string-when-terminated (implies (tree-list-list-terminatedp treess) (nat-listp (tree-list-list->string treess))))
Theorem:
(defthm branches-terminated-when-tree-terminated (implies (tree-terminatedp tree) (tree-list-list-terminatedp (tree-nonleaf->branches tree))))