Function:
(defun adjacent-p (clone c x) (declare (xargs :guard (and (natp clone) (natp c) (nat-listp x)))) (declare (xargs :guard (no-duplicatesp-equal x))) (let ((__function__ 'adjacent-p)) (declare (ignorable __function__)) (cond ((endp x) t) ((equal (car x) clone) (if (cdr x) (equal (car (cdr x)) c) nil)) ((equal (car x) c) (if (cdr x) (equal (car (cdr x)) clone) nil)) (t (adjacent-p clone c (cdr x))))))
Theorem:
(defthm adjacent-p-of-absent-elements (implies (and (not (member-equal c x)) (not (member-equal clone x))) (adjacent-p clone c x)))
Theorem:
(defthm adjacent-p-reflexive (implies (adjacent-p c clone x) (adjacent-p clone c x)))
Theorem:
(defthm remove-equal-preserves-adjacent-p (implies (and (adjacent-p clone c x) (true-listp x) (not (equal id c)) (not (equal id clone))) (adjacent-p clone c (remove-equal id x))))