Remove equal formals and actuals from two lists of the same length.
(remove-equal-formals-actuals formals actuals) → (mv new-formals new-actuals)
This is used by remove-trivial-vars, but it may be more generally useful. In fact, it could be generalized to an operation on lists.
Function:
(defun remove-equal-formals-actuals (formals actuals) (declare (xargs :guard (and (symbol-listp formals) (pseudo-term-listp actuals)))) (declare (xargs :guard (= (len formals) (len actuals)))) (let ((__function__ 'remove-equal-formals-actuals)) (declare (ignorable __function__)) (b* (((when (endp formals)) (mv nil nil)) ((unless (mbt (consp actuals))) (mv nil nil)) (formal (car formals)) (actual (car actuals)) ((when (eq formal actual)) (remove-equal-formals-actuals (cdr formals) (cdr actuals))) ((mv rest-formals rest-actuals) (remove-equal-formals-actuals (cdr formals) (cdr actuals)))) (mv (cons formal rest-formals) (cons actual rest-actuals)))))
Theorem:
(defthm symbol-listp-of-remove-equal-formals-actuals.new-formals (implies (symbol-listp formals) (b* (((mv ?new-formals ?new-actuals) (remove-equal-formals-actuals formals actuals))) (symbol-listp new-formals))) :rule-classes :rewrite)
Theorem:
(defthm pseudo-term-listp-of-remove-equal-formals-actuals.new-actuals (implies (pseudo-term-listp actuals) (b* (((mv ?new-formals ?new-actuals) (remove-equal-formals-actuals formals actuals))) (pseudo-term-listp new-actuals))) :rule-classes :rewrite)
Theorem:
(defthm remove-equal-formals-actuals-same-len (equal (len (mv-nth 0 (remove-equal-formals-actuals formals actuals))) (len (mv-nth 1 (remove-equal-formals-actuals formals actuals)))))
Theorem:
(defthm true-listp-of-remove-equal-formals-actuals.new-formals (b* (((mv ?new-formals ?new-actuals) (remove-equal-formals-actuals formals actuals))) (true-listp new-formals)) :rule-classes :type-prescription)
Theorem:
(defthm true-listp-of-remove-equal-formals-actuals.new-actuals (b* (((mv ?new-formals ?new-actuals) (remove-equal-formals-actuals formals actuals))) (true-listp new-actuals)) :rule-classes :type-prescription)
Theorem:
(defthm acl2-count-of-remove-equal-formals-actuals.formals (b* (((mv ?new-formals ?new-actuals) (remove-equal-formals-actuals formals actuals))) (<= (acl2-count new-formals) (acl2-count formals))) :rule-classes :linear)
Theorem:
(defthm acl2-count-of-remove-equal-formals-actuals.actuals (b* (((mv ?new-formals ?new-actuals) (remove-equal-formals-actuals formals actuals))) (<= (acl2-count new-actuals) (acl2-count actuals))) :rule-classes :linear)