• 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
        • Defun
        • Verify-guards
        • Table
        • Mutual-recursion
        • Memoize
        • Make-event
        • Include-book
        • Encapsulate
        • Defun-sk
        • Defttag
        • Defstobj
        • Defpkg
        • Defattach
        • Defabsstobj
        • Defchoose
        • Progn
        • Defconst
        • Verify-termination
        • Redundant-events
        • Defmacro
          • Prohibition-of-loop$-and-lambda$
          • Ignored-attachment
          • Defmac
          • Defmacro-untouchable
          • Defmacro+
            • Defmacro+-implementation
              • Defmacro+-extract-parents/short/long
                • Defmacro+-fn
                • Defmacro+-macro-definition
            • Defmacroq
          • Skip-proofs
          • In-theory
          • Embedded-event-form
          • Value-triple
          • Comp
          • Local
          • Defthm
          • Progn!
          • Defevaluator
          • Theory-invariant
          • Assert-event
          • Defun-inline
          • Project-dir-alist
          • Partial-encapsulate
          • Define-trusted-clause-processor
          • Defproxy
          • Defexec
          • Defun-nx
          • Defthmg
          • Defpun
          • Defabbrev
          • Set-table-guard
          • Name
          • Defrec
          • Add-custom-keyword-hint
          • Regenerate-tau-database
          • Defcong
          • Deftheory
          • Defaxiom
          • Deftheory-static
          • Defund
          • Evisc-table
          • Verify-guards+
          • Logical-name
          • Profile
          • Defequiv
          • Defmacro-untouchable
          • Add-global-stobj
          • Defthmr
          • Defstub
          • Defrefinement
          • Deflabel
          • In-arithmetic-theory
          • Unmemoize
          • Defabsstobj-missing-events
          • Defthmd
          • Fake-event
          • Set-body
          • Defun-notinline
          • Functions-after
          • Macros-after
          • Dump-events
          • Defund-nx
          • Defun$
          • Remove-global-stobj
          • Remove-custom-keyword-hint
          • Dft
          • Defthy
          • Defund-notinline
          • Defnd
          • Defn
          • Defund-inline
          • Defmacro-last
        • Parallelism
        • History
        • Programming
        • Operational-semantics
        • Real
        • Start-here
        • Miscellaneous
        • Output-controls
        • Bdd
        • Macros
        • Installation
        • Mailing-lists
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Defmacro+-implementation

    Defmacro+-extract-parents/short/long

    Extract the XDOC keyword options from defmacro+.

    This is similar to std::extract-keywords, but more restricted. We introduce a new function here, instead of using std::extract-keywords, to reduce the book inclusions in the defmacro+ book. If std::extract-keywords is refactored at some point, we could use that here and eliminate this more restricted function.

    The argument rest of this function consists of the arguments of defmacro+ after the name and macro arguments. See the definition of defmacro+.

    This function returns two results. The first result is an alist from the keywords :parents, :short, and :long to their corresponding values; if a keyword is not supplied, it is not in the alist. The second result consists of rest without the keyword options.

    Definitions and Theorems

    Function: defmacro+-find-parents/short/long

    (defun defmacro+-find-parents/short/long (rest)
     (declare (xargs :guard (true-listp rest)))
     (if (endp rest)
         (mv nil nil)
      (let ((next (car rest)))
       (if (member-eq next '(:parents :short :long))
           (if (consp (cdr rest))
               (let ((val (cadr rest)))
                 (mv-let (alist rest)
                         (defmacro+-find-parents/short/long (cddr rest))
                   (if (assoc-eq next alist)
                       (prog2$ (er hard? 'defmacro+
                                   "Duplicate keyword ~x0." next)
                               (mv nil nil))
                     (mv (acons next val alist) rest))))
             (prog2$ (er hard? 'defmacro+
                         "Keyword ~x0 without a value." next)
                     (mv nil nil)))
         (mv-let (alist rest)
                 (defmacro+-find-parents/short/long (cdr rest))
           (mv alist (cons next rest)))))))

    Theorem: alistp-of-mv-nth-0-of-defmacro+-find-parents/short/long

    (defthm alistp-of-mv-nth-0-of-defmacro+-find-parents/short/long
      (alistp (mv-nth 0
                      (defmacro+-find-parents/short/long rest))))

    Theorem: true-listp-of-mv-nth-1-of-defmacro+-find-parents/short/long

    (defthm true-listp-of-mv-nth-1-of-defmacro+-find-parents/short/long
      (true-listp (mv-nth 1
                          (defmacro+-find-parents/short/long rest))))