Merge two already-alphordered lists of atoms.
This is just a completely standard ordered-union operation for atom-listps, except that:
This is used in aig-vars and 4v-sexpr-vars.
When the inputs happen to be ordered sets, the result is also an ordered set
and
Function:
(defun hons-alphorder-merge (a b) (declare (xargs :guard (and (atom-listp a) (atom-listp b)))) (cond ((atom a) b) ((atom b) a) ((equal (car a) (car b)) (hons-alphorder-merge (cdr a) b)) ((fast-alphorder (car b) (car a)) (hons (car b) (hons-alphorder-merge a (cdr b)))) (t (hons (car a) (hons-alphorder-merge (cdr a) b)))))
Function:
(defun hons-alphorder-merge-memoize-condition (a b) (declare (ignorable a b) (xargs :guard (if (atom-listp a) (atom-listp b) 'nil))) (or (consp a) (consp b)))
Theorem:
(defthm atom-listp-hons-alphorder-merge (implies (and (atom-listp a) (atom-listp b)) (atom-listp (hons-alphorder-merge a b))))
Theorem:
(defthm member-equal-hons-alphorder-merge (iff (member-equal k (hons-alphorder-merge a b)) (or (member-equal k a) (member-equal k b))))
Theorem:
(defthm hons-set-equiv-hons-alphorder-merge-append (set-equiv (hons-alphorder-merge a b) (append a b)))
Theorem:
(defthm setp-of-hons-alphorder-merge (implies (and (set::setp x) (set::setp y) (atom-listp x) (atom-listp y)) (set::setp (hons-alphorder-merge x y))))
Theorem:
(defthm in-of-hons-alphorder-merge (implies (and (set::setp x) (set::setp y) (atom-listp x) (atom-listp y)) (equal (set::in a (hons-alphorder-merge x y)) (or (set::in a x) (set::in a y)))))
Theorem:
(defthm hons-alphorder-merge-is-union-for-sets-of-atoms (implies (and (set::setp x) (set::setp y) (atom-listp x) (atom-listp y)) (equal (hons-alphorder-merge x y) (set::union x y))))