• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
      • Std/lists
      • Std/alists
      • Obags
      • Std/util
      • Std/strings
        • Pretty-printing
        • Printtree
        • Base64
        • Charset-p
        • Strtok!
        • Cases
        • Concatenation
        • Html-encoding
        • Character-kinds
        • Substrings
          • Istrpos
          • Strrpos
          • Strpos
          • Collect-syms-with-isubstr
          • Istrprefixp
          • Collect-strs-with-isubstr
          • Iprefixp
          • Strsuffixp
          • Firstn-chars
          • Strprefixp
          • Isubstrp
          • Substrp
          • Strtok
          • Equivalences
          • Url-encoding
          • Lines
          • Explode-implode-equalities
          • Ordering
          • Numbers
          • Pad-trim
          • Coercion
          • Std/strings/digit-to-char
          • Substitution
          • Symbols
        • 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
    • Substrings

    Substrp

    Case-sensitive test for the existence of a substring.

    (substrp x y) determines if x ever occurs as a substring of y. The test is case-sensitive.

    See also isubstrp for a case-insensitive version, and strpos or strrpos for alternatives that say where a match occurs.

    Definitions and Theorems

    Function: substrp$inline

    (defun substrp$inline (x y)
      (declare (type string x y))
      (mbe :logic (sublistp (explode x) (explode y))
           :exec (if (strpos x y) t nil)))

    Theorem: streqv-implies-equal-substrp-1

    (defthm streqv-implies-equal-substrp-1
      (implies (streqv x x-equiv)
               (equal (substrp x y)
                      (substrp x-equiv y)))
      :rule-classes (:congruence))

    Theorem: streqv-implies-equal-substrp-2

    (defthm streqv-implies-equal-substrp-2
      (implies (streqv y y-equiv)
               (equal (substrp x y)
                      (substrp x y-equiv)))
      :rule-classes (:congruence))