Add a member at the end of a list of member types.
(member-type-add-last name type members) → new-members
We check that a member with the same name is not already in the list, to maintain the well-formedness of the list.
Function:
(defun member-type-add-last (name type members) (declare (xargs :guard (and (identp name) (typep type) (member-type-listp members)))) (let ((__function__ 'member-type-add-last)) (declare (ignorable __function__)) (b* ((found (member-type-lookup name members)) ((when found) (member-type-list-option-none))) (member-type-list-option-some (rcons (make-member-type :name name :type type) members)))))
Theorem:
(defthm member-type-list-optionp-of-member-type-add-last (b* ((new-members (member-type-add-last name type members))) (member-type-list-optionp new-members)) :rule-classes :rewrite)
Theorem:
(defthm member-type-add-last-of-ident-fix-name (equal (member-type-add-last (ident-fix name) type members) (member-type-add-last name type members)))
Theorem:
(defthm member-type-add-last-ident-equiv-congruence-on-name (implies (ident-equiv name name-equiv) (equal (member-type-add-last name type members) (member-type-add-last name-equiv type members))) :rule-classes :congruence)
Theorem:
(defthm member-type-add-last-of-type-fix-type (equal (member-type-add-last name (type-fix type) members) (member-type-add-last name type members)))
Theorem:
(defthm member-type-add-last-type-equiv-congruence-on-type (implies (type-equiv type type-equiv) (equal (member-type-add-last name type members) (member-type-add-last name type-equiv members))) :rule-classes :congruence)
Theorem:
(defthm member-type-add-last-of-member-type-list-fix-members (equal (member-type-add-last name type (member-type-list-fix members)) (member-type-add-last name type members)))
Theorem:
(defthm member-type-add-last-member-type-list-equiv-congruence-on-members (implies (member-type-list-equiv members members-equiv) (equal (member-type-add-last name type members) (member-type-add-last name type members-equiv))) :rule-classes :congruence)