• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
      • Std/lists
      • Std/alists
      • Obags
      • Std/util
      • Std/strings
      • Std/io
      • Std/osets
      • Std/system
        • Fresh-logical-name-with-$s-suffix
        • Irrelevant-formals-info
        • Std/system/function-queries
        • Std/system/term-queries
        • Std/system/term-transformations
        • Std/system/enhanced-utilities
        • Install-not-normalized-event-lst
        • Install-not-normalized-event
        • Std/system/term-function-recognizers
        • Pseudo-tests-and-call-listp
        • Genvar$
        • Std/system/event-name-queries
        • Maybe-pseudo-event-formp
        • Add-suffix-to-fn-or-const
          • Chk-irrelevant-formals-ok
          • Std/system/good-atom-listp
          • Pseudo-tests-and-callp
          • Table-alist+
          • Add-suffix-to-fn-or-const-lst
          • Known-packages+
          • Add-suffix-to-fn-lst
          • Unquote-term
          • Event-landmark-names
          • Add-suffix-lst
          • Std/system/theorem-queries
          • Unquote-term-list
          • Std/system/macro-queries
          • Pseudo-event-landmark-listp
          • Pseudo-command-landmark-listp
          • Install-not-normalized$
          • Rune-disabledp
          • Known-packages
          • Std/system/partition-rest-and-keyword-args
          • Rune-enabledp
          • Included-books
          • Std/system/pseudo-event-formp
          • Std/system/plist-worldp-with-formals
          • Std/system/w
          • Std/system/geprops
          • Std/system/arglistp
          • Std/system-extensions
          • Std/system/constant-queries
        • 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/system

    Add-suffix-to-fn-or-const

    Add a suffix to a function or constant name.

    Signature
    (add-suffix-to-fn-or-const name suffix) → new-name
    Arguments
    name — Guard (symbolp name).
    suffix — Guard (stringp suffix).
    Returns
    new-name — Type (symbolp new-name).

    This is related to the built-in functions add-suffix and add-suffix-to-fn. If the argument symbol starts and ends with *, it is considered a constant name and the suffix is added just before the ending *, so that the resulting symbol is still a constant name. Otherwise, the argument symbol is considered a function name and add-suffix-to-fn is used.

    Definitions and Theorems

    Function: add-suffix-to-fn-or-const

    (defun
        add-suffix-to-fn-or-const (name suffix)
        (declare (xargs :guard (and (symbolp name) (stringp suffix))))
        (let ((__function__ 'add-suffix-to-fn-or-const))
             (declare (ignorable __function__))
             (let* ((s (symbol-name name))
                    (len (length s)))
                   (cond ((and (not (= len 0))
                               (eql (char s 0) #\*)
                               (eql (char s (1- len)) #\*))
                          (if (equal (symbol-package-name name)
                                     *main-lisp-package-name*)
                              (intern (concatenate 'string
                                                   (subseq s 0 (1- len))
                                                   suffix "*")
                                      "ACL2")
                              (intern-in-package-of-symbol
                                   (concatenate 'string
                                                (subseq s 0 (1- len))
                                                suffix "*")
                                   name)))
                         (t (add-suffix-to-fn name suffix))))))

    Theorem: symbolp-of-add-suffix-to-fn-or-const

    (defthm symbolp-of-add-suffix-to-fn-or-const
            (b* ((new-name (add-suffix-to-fn-or-const name suffix)))
                (symbolp new-name))
            :rule-classes :rewrite)