Lemmas about nthcdr available in the std/lists library.
Theorem:
(defthm nthcdr-when-zp (implies (zp n) (equal (nthcdr n x) x)))
Theorem:
(defthm nthcdr-when-atom (implies (atom x) (equal (nthcdr n x) (if (zp n) x nil))))
Theorem:
(defthm nthcdr-of-cons (equal (nthcdr n (cons a x)) (if (zp n) (cons a x) (nthcdr (- n 1) x))))
Theorem:
(defthm true-listp-of-nthcdr (equal (true-listp (nthcdr n x)) (or (true-listp x) (< (len x) (nfix n)))) :rule-classes ((:rewrite)))
Theorem:
(defthm len-of-nthcdr (equal (len (nthcdr n l)) (nfix (- (len l) (nfix n)))))
Theorem:
(defthm consp-of-nthcdr (equal (consp (nthcdr n x)) (< (nfix n) (len x))))
Theorem:
(defthm open-small-nthcdr (implies (syntaxp (and (quotep n) (natp (unquote n)) (< (unquote n) 5))) (equal (nthcdr n x) (if (zp n) x (nthcdr (+ -1 n) (cdr x))))))
Theorem:
(defthm acl2-count-of-nthcdr-rewrite (equal (< (acl2-count (nthcdr n x)) (acl2-count x)) (if (zp n) nil (or (consp x) (< 0 (acl2-count x))))))
Theorem:
(defthm acl2-count-of-nthcdr-linear (implies (and (not (zp n)) (consp x)) (< (acl2-count (nthcdr n x)) (acl2-count x))) :rule-classes :linear)
Theorem:
(defthm acl2-count-of-nthcdr-linear-weak (<= (acl2-count (nthcdr n x)) (acl2-count x)) :rule-classes :linear)
Theorem:
(defthm car-of-nthcdr (equal (car (nthcdr i x)) (nth i x)))
Theorem:
(defthm nthcdr-of-cdr (equal (nthcdr i (cdr x)) (cdr (nthcdr i x))))
Theorem:
(defthm nthcdr-when-less-than-len-under-iff (implies (< (nfix n) (len x)) (iff (nthcdr n x) t)))
Theorem:
(defthm nthcdr-of-nthcdr (equal (nthcdr a (nthcdr b x)) (nthcdr (+ (nfix a) (nfix b)) x)))
Theorem:
(defthm append-of-take-and-nthcdr (implies (<= (nfix n) (len x)) (equal (append (take n x) (nthcdr n x)) x)))
Theorem:
(defthm nthcdr-of-list-fix (equal (nthcdr n (list-fix x)) (list-fix (nthcdr n x))))
Theorem:
(defthm element-list-p-of-nthcdr (implies (element-list-p (double-rewrite x)) (element-list-p (nthcdr n x))) :rule-classes :rewrite)
Theorem:
(defthm nthcdr-of-elementlist-projection (equal (nthcdr n (elementlist-projection x)) (elementlist-projection (nthcdr n x))) :rule-classes :rewrite)
Theorem:
(defthm subsetp-of-nthcdr (subsetp-equal (nthcdr n l) l))