• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Recursion-and-induction
      • Hons-and-memoization
      • Events
      • Parallelism
      • History
      • Programming
        • Defun
        • Declare
        • System-utilities
        • Stobj
        • State
        • Mutual-recursion
        • Memoize
        • Mbe
        • Io
        • Defpkg
        • Apply$
        • Loop$
        • Programming-with-state
        • Arrays
        • Characters
        • Time$
        • Defconst
        • Fast-alists
        • Defmacro
        • Loop$-primer
        • Evaluation
        • Guard
        • Equality-variants
        • Compilation
        • Hons
        • ACL2-built-ins
        • Developers-guide
        • System-attachments
        • Advanced-features
        • Set-check-invariant-risk
        • Numbers
        • Efficiency
        • Irrelevant-formals
        • Introduction-to-programming-in-ACL2-for-those-who-know-lisp
        • Redefining-programs
        • Lists
        • Invariant-risk
        • Errors
        • Defabbrev
        • Conses
        • Alists
        • Set-register-invariant-risk
        • Strings
          • Std/strings
            • Pretty-printing
            • Printtree
            • Base64
            • Charset-p
            • Strtok!
            • Cases
            • Concatenation
            • Character-kinds
            • Html-encoding
            • Substrings
            • Strtok
            • Equivalences
            • Url-encoding
            • Lines
            • Explode-implode-equalities
            • Ordering
            • Numbers
            • Pad-trim
            • Coercion
            • Std/strings/digit-to-char
            • Substitution
              • Strsubst-list
                • Strsubst
              • Symbols
            • String-listp
            • Stringp
            • Length
            • Search
            • Remove-duplicates
            • Position
            • Coerce
            • Concatenate
            • Reverse
            • String
            • Subseq
            • Substitute
            • String-upcase
            • String-downcase
            • Count
            • Char
            • String<
            • String-equal
            • String-utilities
            • String-append
            • String>=
            • String<=
            • String>
            • Hex-digit-char-theorems
            • String-downcase-gen
            • String-upcase-gen
          • Program-wrapper
          • Get-internal-time
          • Basics
          • Packages
          • Oracle-eval
          • Defmacro-untouchable
          • <<
          • Primitive
          • Revert-world
          • Unmemoize
          • Set-duplicate-keys-action
          • Symbols
          • Def-list-constructor
          • Easy-simplify-term
          • Defiteration
          • Fake-oracle-eval
          • Defopen
          • Sleep
        • Operational-semantics
        • Real
        • Start-here
        • Miscellaneous
        • Output-controls
        • Bdd
        • Macros
        • Installation
        • Mailing-lists
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Substitution

    Strsubst-list

    Carry out a strsubst replacement throughout a list of strings.

    (strsubst-list old new x) replaces every occurrence of old with new throughout x. Here, old and new are strings, but x is a list of strings. A new list of strings is returned.

    Example:

    (strsubst-list "Sun"
                   "Moon"
                   '("Sun Roof" "Hello Sun" "Sunny Sunshades"))
      -->
    ("Moon Roof" "Hello Moon" "Moonny Moonshades")

    Definitions and Theorems

    Function: strsubst-list

    (defun strsubst-list (old new x)
      (declare (xargs :guard (and (stringp old)
                                  (stringp new)
                                  (string-listp x))))
      (if (atom x)
          nil
        (cons (strsubst old new (car x))
              (strsubst-list old new (cdr x)))))

    Theorem: strsubst-list-when-atom

    (defthm strsubst-list-when-atom
      (implies (atom x)
               (equal (strsubst-list old new x) nil)))

    Theorem: strsubst-list-of-cons

    (defthm strsubst-list-of-cons
      (equal (strsubst-list old new (cons a x))
             (cons (strsubst old new a)
                   (strsubst-list old new x))))

    Theorem: string-listp-of-strsubst-list

    (defthm string-listp-of-strsubst-list
      (string-listp (strsubst-list old new x)))

    Theorem: list-equiv-implies-equal-strsubst-list-3

    (defthm list-equiv-implies-equal-strsubst-list-3
      (implies (list-equiv x x-equiv)
               (equal (strsubst-list old new x)
                      (strsubst-list old new x-equiv)))
      :rule-classes (:congruence))

    Theorem: strsubst-list-of-append

    (defthm strsubst-list-of-append
      (equal (strsubst-list old new (append x y))
             (append (strsubst-list old new x)
                     (strsubst-list old new y))))

    Theorem: strsubst-list-of-revappend

    (defthm strsubst-list-of-revappend
      (equal (strsubst-list old new (revappend x y))
             (revappend (strsubst-list old new x)
                        (strsubst-list old new y))))

    Theorem: strsubst-list-of-rev

    (defthm strsubst-list-of-rev
      (equal (strsubst-list old new (rev x))
             (rev (strsubst-list old new x))))