(all-have-len x n) determines if every element of
(all-have-len x n) → *
Function:
(defun all-have-len (x n) (declare (xargs :guard t)) (let ((__function__ 'all-have-len)) (declare (ignorable __function__)) (if (consp x) (and (eql (len (car x)) n) (all-have-len (cdr x) n)) t)))
Theorem:
(defthm all-have-len-when-not-consp (implies (not (consp x)) (all-have-len x n)))
Theorem:
(defthm all-have-len-of-cons (equal (all-have-len (cons a x) n) (and (equal (len a) n) (all-have-len x n))))
Theorem:
(defthm all-have-len-of-strip-cdrs (implies (and (not (zp n)) (all-have-len x n)) (all-have-len (strip-cdrs x) (1- n))))
Theorem:
(defthm alistp-when-all-have-len (implies (and (not (zp n)) (all-have-len x n)) (equal (alistp x) (true-listp x))))