• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Debugging
    • Projects
    • 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
          • Ordering
          • Numbers
          • Pad-trim
          • Coercion
          • Std/strings-extensions
          • Std/strings/digit-to-char
          • Substitution
          • Symbols
        • 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
    • Substrings

    Collect-strs-with-isubstr

    Gather strings that have some (case-insensitive) substring.

    (collect-strs-with-isubstr a x) returns a list of all the strings in the list x that have a as a case-insensitve substring. The substring tests are carried out with isubstrp.

    See also collect-syms-with-isubstr, which is similar but for symbol lists instead of string lists.

    Definitions and Theorems

    Function: collect-strs-with-isubstr

    (defun collect-strs-with-isubstr (a x)
      (declare (xargs :guard (and (stringp a) (string-listp x))))
      (cond ((atom x) nil)
            ((isubstrp a (car x))
             (cons (car x)
                   (collect-strs-with-isubstr a (cdr x))))
            (t (collect-strs-with-isubstr a (cdr x)))))

    Theorem: istreqv-implies-equal-collect-strs-with-isubstr-1

    (defthm istreqv-implies-equal-collect-strs-with-isubstr-1
      (implies (istreqv a a-equiv)
               (equal (collect-strs-with-isubstr a x)
                      (collect-strs-with-isubstr a-equiv x)))
      :rule-classes (:congruence))

    Theorem: collect-strs-with-isubstr-when-atom

    (defthm collect-strs-with-isubstr-when-atom
      (implies (atom x)
               (equal (collect-strs-with-isubstr a x)
                      nil)))

    Theorem: collect-strs-with-isubstr-of-cons

    (defthm collect-strs-with-isubstr-of-cons
      (equal (collect-strs-with-isubstr a (cons b x))
             (if (isubstrp a b)
                 (cons b (collect-strs-with-isubstr a x))
               (collect-strs-with-isubstr a x))))

    Theorem: member-equal-collect-strs-with-isubstr

    (defthm member-equal-collect-strs-with-isubstr
      (iff (member-equal b (collect-strs-with-isubstr a x))
           (and (member-equal b x)
                (isubstrp a b))))

    Theorem: subsetp-equal-of-collect-strs-with-isubstr

    (defthm subsetp-equal-of-collect-strs-with-isubstr
      (implies (subsetp-equal x y)
               (subsetp-equal (collect-strs-with-isubstr a x)
                              y)))

    Theorem: subsetp-equal-collect-strs-with-isubstr-self

    (defthm subsetp-equal-collect-strs-with-isubstr-self
      (subsetp-equal (collect-strs-with-isubstr a x)
                     x))