Special constructor for products that collapses (nil . nil) into nil.
Function:
(defun prod-cons$inline (x y) (declare (xargs :guard t)) (and (or x y) (cons x y)))
Theorem:
(defthm prod-consp-of-prod-cons (prod-consp (prod-cons x y)) :rule-classes (:rewrite :type-prescription))
Theorem:
(defthm car-of-prod-cons (equal (car (prod-cons x y)) x))
Theorem:
(defthm cdr-of-prod-cons (equal (cdr (prod-cons x y)) y))
Theorem:
(defthm prod-cons-of-car/cdr (implies (prod-consp x) (equal (prod-cons (car x) (cdr x)) x)))
Theorem:
(defthm equal-of-prod-cons (implies (prod-consp x) (equal (equal x (prod-cons a b)) (and (equal (car x) a) (equal (cdr x) b)))))
Theorem:
(defthm acl2-count-of-prod-cons (and (>= (acl2-count (prod-cons x y)) (acl2-count x)) (>= (acl2-count (prod-cons x y)) (acl2-count y))) :rule-classes :linear)
Theorem:
(defthm prod-cons-equal-cons (implies (or a b) (equal (equal (prod-cons a b) (cons c d)) (and (equal a c) (equal b d)))))
Theorem:
(defthm prod-cons-when-either (implies (or a b) (and (prod-cons a b) (consp (prod-cons a b)))) :rule-classes ((:rewrite) (:type-prescription :corollary (implies (or a b) (consp (prod-cons a b))))))
Theorem:
(defthm prod-cons-not-consp-forward (implies (not (consp (prod-cons a b))) (and (not a) (not b))) :rule-classes ((:forward-chaining :trigger-terms ((prod-cons a b)))))