• 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

    Genvar$

    A logic-mode guard-verified version of genvar.

    Signature
    (genvar$ pkg-witness prefix n avoid-lst state) → var
    Arguments
    pkg-witness — Guard (symbolp pkg-witness).
    prefix — Guard (stringp prefix).
    n — Guard (maybe-natp n).
    avoid-lst — Guard (symbol-listp avoid-lst).
    Returns
    var — Type (symbolp var).

    This has a stronger guard than genvar and always returns a symbol (if it does not cause an error). We use magic-ev-fncall to call genvar, and check that the result is a symbol. Hard errors happening in genvar are not suppressed, i.e. cause genvar$ to stop with those hard errors. If magic-ev-fncall fails, or if the result is not a symbol, we also stop with hard errors.

    Compared to genvar, this utility requires a state argument. It may also be slightly less efficient due the magic-ev-fncall overhead. However, it can be used in logic-mode guard-verified code that follows a statically typed discipline.

    Definitions and Theorems

    Function: genvar$

    (defun
       genvar$
       (pkg-witness prefix n avoid-lst state)
       (declare (xargs :stobjs (state)))
       (declare (xargs :guard (and (symbolp pkg-witness)
                                   (stringp prefix)
                                   (maybe-natp n)
                                   (symbol-listp avoid-lst))))
       (let ((__function__ 'genvar$))
            (declare (ignorable __function__))
            (b* (((mv erp var)
                  (magic-ev-fncall 'genvar
                                   (list pkg-witness prefix n avoid-lst)
                                   state nil t))
                 ((when erp)
                  (raise "Internal error: ~@0" var))
                 ((unless (symbolp var))
                  (raise "Internal error: ~x0 is not a symbol."
                         var)))
                var)))

    Theorem: symbolp-of-genvar$

    (defthm symbolp-of-genvar$
            (b* ((var (genvar$ pkg-witness prefix n avoid-lst state)))
                (symbolp var))
            :rule-classes :rewrite)