• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
      • Std/lists
        • Std/lists/abstract
          • Element-list-p
          • Element-list-equiv
          • Element-list-nonempty-p
            • Elementlist-projection
            • Element-equiv
            • Generic-eval-requirement
            • Element-list-fix
            • Elementlist-mapappend
            • Element-fix
            • Outelement-list-p
            • Outelement-p
            • Element-xformer
            • Element-listxformer
            • Element-p
            • Def-listp-rule
            • Def-projection-rule
            • Def-nonempty-listp-rule
            • Def-mapappend-rule
            • Def-listfix-rule
          • Rev
          • Defsort
          • List-fix
          • Std/lists/nth
          • Hons-remove-duplicates
          • Std/lists/update-nth
          • Set-equiv
          • Duplicity
          • Prefixp
          • Std/lists/take
          • Std/lists/intersection$
          • Nats-equiv
          • Repeat
          • Index-of
          • All-equalp
          • Sublistp
          • Std/lists/nthcdr
          • Std/lists/append
          • Listpos
          • List-equiv
          • Final-cdr
          • Std/lists/remove
          • Subseq-list
          • Rcons
          • Std/lists/revappend
          • Std/lists/remove-duplicates-equal
          • Std/lists/last
          • Std/lists/reverse
          • Std/lists/resize-list
          • Flatten
          • Suffixp
          • Std/lists/set-difference
          • Std/lists/butlast
          • Std/lists/len
          • Std/lists/intersectp
          • Std/lists/true-listp
          • Intersectp-witness
          • Subsetp-witness
          • Std/lists/remove1-equal
          • Rest-n
          • First-n
          • Std/lists/union
          • Append-without-guard
          • Std/lists/subsetp
          • Std/lists/member
        • Std/alists
        • Obags
        • Std/util
        • Std/strings
        • Std/io
        • Std/osets
        • Std/system
        • Std/basic
        • Std/typed-lists
        • Std/bitsets
        • Std/testing
        • Std/typed-alists
        • Std/stobjs
        • Std-extensions
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Std/lists/abstract

    Element-list-nonempty-p

    Generic typed list recognizer function.

    Definitions and Theorems

    Function: element-list-nonempty-p

    (defun element-list-nonempty-p (x)
           (and (consp x)
                (element-p (car x))
                (let ((x (cdr x)))
                     (if (consp x)
                         (element-list-nonempty-p x)
                         (element-list-final-cdr-p x)))))

    Theorem: element-list-nonempty-p-of-cons

    (defthm element-list-nonempty-p-of-cons
            (implies (element-list-nonempty-p x)
                     (iff (element-list-nonempty-p (cons a x))
                          (element-p a)))
            :rule-classes :rewrite)

    Theorem: element-list-nonempty-p-of-singleton-true-list

    (defthm element-list-nonempty-p-of-singleton-true-list
            (iff (element-list-nonempty-p (cons a nil))
                 (element-p a))
            :rule-classes :rewrite)

    Theorem: element-list-nonempty-p-of-singleton-non-true-list

    (defthm element-list-nonempty-p-of-singleton-non-true-list
            (implies (and (not (consp x))
                          (element-list-final-cdr-p t))
                     (iff (element-list-nonempty-p (cons a x))
                          (element-p a)))
            :rule-classes :rewrite)

    Theorem: element-list-nonempty-p-of-cdr-when-element-list-nonempty-p

    (defthm element-list-nonempty-p-of-cdr-when-element-list-nonempty-p
            (implies (and (element-list-nonempty-p (double-rewrite x))
                          (consp (cdr x)))
                     (element-list-nonempty-p (cdr x)))
            :rule-classes :rewrite)

    Theorem: element-list-nonempty-p-when-not-consp

    (defthm element-list-nonempty-p-when-not-consp
            (implies (not (consp x))
                     (not (element-list-nonempty-p x)))
            :rule-classes :rewrite)

    Theorem: element-list-nonempty-p-implies-consp

    (defthm element-list-nonempty-p-implies-consp
            (implies (element-list-nonempty-p x)
                     (consp x))
            :rule-classes :forward-chaining)

    Theorem: element-p-of-car-when-element-list-nonempty-p

    (defthm element-p-of-car-when-element-list-nonempty-p
            (implies (element-list-nonempty-p x)
                     (element-p (car x)))
            :rule-classes :rewrite)

    Theorem: true-listp-when-element-list-nonempty-p-rewrite

    (defthm true-listp-when-element-list-nonempty-p-rewrite
            (implies (and (element-list-nonempty-p x)
                          (not (element-list-final-cdr-p t)))
                     (true-listp x))
            :rule-classes nil)

    Theorem: true-listp-when-element-list-nonempty-p-compound-recognizer

    (defthm true-listp-when-element-list-nonempty-p-compound-recognizer
            (implies (and (element-list-nonempty-p x)
                          (not (element-list-final-cdr-p t)))
                     (true-listp x))
            :rule-classes nil)

    Theorem: element-list-nonempty-p-of-append

    (defthm element-list-nonempty-p-of-append
            (implies (and (element-list-nonempty-p a)
                          (element-list-nonempty-p b))
                     (element-list-nonempty-p (append a b)))
            :rule-classes :rewrite)