• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
      • Std/lists
        • Std/lists/abstract
        • Rev
        • Defsort
        • List-fix
        • Std/lists/nth
        • Hons-remove-duplicates
        • Std/lists/update-nth
        • Set-equiv
        • Duplicity
        • Prefixp
          • Prefixp-theorems
          • Std/lists/take
          • Std/lists/intersection$
          • Nats-equiv
          • Repeat
          • Index-of
          • All-equalp
          • Sublistp
          • Std/lists/nthcdr
          • Listpos
          • List-equiv
          • Final-cdr
          • Std/lists/append
          • Std/lists/remove
          • Subseq-list
          • Rcons
          • Std/lists/revappend
          • Std/lists/remove-duplicates-equal
          • Std/lists/reverse
          • Std/lists/last
          • Std/lists/resize-list
          • Flatten
          • Suffixp
          • Std/lists/butlast
          • Std/lists/set-difference
          • 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
          • Std/lists/add-to-set
          • Append-without-guard
          • Std/lists/subsetp
          • Std/lists/member
        • Std/alists
        • Obags
        • Std/util
        • Std/strings
        • Std/osets
        • Std/io
        • Std/basic
        • Std/system
        • Std/typed-lists
        • Std/bitsets
        • Std/testing
        • Std/typed-alists
        • Std/stobjs
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • List-utilities
    • Prefixp

    Prefixp-theorems

    Some theorems about the library function prefixp.

    Definitions and Theorems

    Theorem: same-car-when-prefixp-and-consp

    (defthm same-car-when-prefixp-and-consp
      (implies (and (prefixp x y) (consp x))
               (equal (car x) (car y)))
      :rule-classes nil)

    Theorem: same-take-when-prefixp-and-longer

    (defthm same-take-when-prefixp-and-longer
      (implies (and (prefixp x y)
                    (>= (len x) (nfix n)))
               (equal (take n x) (take n y)))
      :rule-classes nil)

    Theorem: prefixp-of-cdr-cdr

    (defthm prefixp-of-cdr-cdr
      (implies (and (prefixp x y) (consp x))
               (prefixp (cdr x) (cdr y))))

    Theorem: prefixp-of-rcons

    (defthm prefixp-of-rcons
      (equal (prefixp x (rcons a y))
             (or (list-equiv x (rcons a y))
                 (prefixp x y))))

    Theorem: prefixp-of-butlast-1-right

    (defthm prefixp-of-butlast-1-right
      (equal (prefixp x (butlast y 1))
             (and (prefixp x y)
                  (or (not (consp y))
                      (not (list-equiv x y))))))