• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • Proof-automation
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Recursion-and-induction
      • Hons-and-memoization
      • Events
      • Parallelism
      • History
      • Programming
      • Operational-semantics
      • Real
      • Start-here
      • Debugging
      • Miscellaneous
      • Output-controls
      • Macros
        • Make-event
        • Defmacro
        • Untranslate-patterns
        • Tc
        • Trans*
        • Macro-aliases-table
        • Macro-args
        • Defabbrev
        • User-defined-functions-table
        • Trans
        • Untranslate-for-execution
        • Add-macro-fn
        • Check-vars-not-free
        • Safe-mode
        • Macro-libraries
          • B*
          • Defunc
          • Fty
          • Apt
          • Std/util
            • Defprojection
            • Deflist
            • Defaggregate
            • Define
            • Defmapping
              • Defsurj
              • Defiso
              • Defmapping-implementation
                • Defmapping-event-generation
                • Defmapping-check-redundancy
                  • Defmapping-table
                  • Defmapping-fn
                  • Defmapping-input-processing
                  • Defmapping-macro-definition
                • Definj
              • Defenum
              • Add-io-pairs
              • Defalist
              • Defmapappend
              • Returns-specifiers
              • Defarbrec
              • Defines
              • Define-sk
              • Error-value-tuples
              • Defmax-nat
              • Defmin-int
              • Deftutorial
              • Extended-formals
              • Defrule
              • Defval
              • Defsurj
              • Defiso
              • Defconstrained-recognizer
              • Deffixer
              • Defmvtypes
              • Defconsts
              • Defthm-unsigned-byte-p
              • Support
              • Defthm-signed-byte-p
              • Defthm-natp
              • Defund-sk
              • Defmacro+
              • Defsum
              • Defthm-commutative
              • Definj
              • Defirrelevant
              • Defredundant
            • Defdata
            • Defrstobj
            • Seq
            • Match-tree
            • Defrstobj
            • With-supporters
            • Def-partial-measure
            • Template-subst
            • Soft
            • Defthm-domain
            • Event-macros
            • Def-universal-equiv
            • Def-saved-obligs
            • With-supporters-after
            • Definec
            • Sig
            • Outer-local
            • Data-structures
          • Trans1
          • Defmacro-untouchable
          • Set-duplicate-keys-action
          • Add-macro-alias
          • Magic-macroexpand
          • Defmacroq
          • Trans!
          • Remove-macro-fn
          • Remove-macro-alias
          • Add-binop
          • Untrans-table
          • Trans*-
          • Remove-binop
          • Tcp
          • Tca
        • Mailing-lists
        • Interfacing-tools
      • Macro-libraries
        • B*
        • Defunc
        • Fty
        • Apt
        • Std/util
          • Defprojection
          • Deflist
          • Defaggregate
          • Define
          • Defmapping
            • Defsurj
            • Defiso
            • Defmapping-implementation
              • Defmapping-event-generation
              • Defmapping-check-redundancy
                • Defmapping-table
                • Defmapping-fn
                • Defmapping-input-processing
                • Defmapping-macro-definition
              • Definj
            • Defenum
            • Add-io-pairs
            • Defalist
            • Defmapappend
            • Returns-specifiers
            • Defarbrec
            • Defines
            • Define-sk
            • Error-value-tuples
            • Defmax-nat
            • Defmin-int
            • Deftutorial
            • Extended-formals
            • Defrule
            • Defval
            • Defsurj
            • Defiso
            • Defconstrained-recognizer
            • Deffixer
            • Defmvtypes
            • Defconsts
            • Defthm-unsigned-byte-p
            • Support
            • Defthm-signed-byte-p
            • Defthm-natp
            • Defund-sk
            • Defmacro+
            • Defsum
            • Defthm-commutative
            • Definj
            • Defirrelevant
            • Defredundant
          • Defdata
          • Defrstobj
          • Seq
          • Match-tree
          • Defrstobj
          • With-supporters
          • Def-partial-measure
          • Template-subst
          • Soft
          • Defthm-domain
          • Event-macros
          • Def-universal-equiv
          • Def-saved-obligs
          • With-supporters-after
          • Definec
          • Sig
          • Outer-local
          • Data-structures
        • Interfacing-tools
        • Hardware-verification
        • Software-verification
        • Math
        • Testing-utilities
      • Defmapping-implementation

      Defmapping-check-redundancy

      Check if a call to defmapping is redundant.

      Signature
      (defmapping-check-redundancy name print show-only call ctx state) 
        → 
      (mv erp yes/no state)
      Arguments
      call — Guard (pseudo-event-formp call).
      Returns
      yes/no — A booleanp.

      If the defmapping table has no entry for name, we return nil: the call is not redundant.

      If the table has an entry for name but the call differs (after removing any :print and :show-only), an error occurs.

      If the call is redundant, we know that all the inputs except possibly :print and :show-only are valid (because they are the same as the ones of the recorded successful call); we validate these two inputs, for better error checking. If :show-only is t, we print the recorded expansion of the call. Unless :print is nil, we print a message saying that the call is redundant.

      Definitions and Theorems

      Function: defmapping-check-redundancy

      (defun defmapping-check-redundancy
             (name print show-only call ctx state)
       (declare (xargs :stobjs (state)))
       (declare (xargs :guard (pseudo-event-formp call)))
       (let ((__function__ 'defmapping-check-redundancy))
        (declare (ignorable __function__))
        (b*
         ((table (table-alist *defmapping-table-name* (w state))
      )
          (pair (assoc-equal name table))
          ((unless pair) (value nil))
          (info (cdr pair))
          (call$ (defmapping-filter-call call))
          ((unless (equal call$ (defmapping-info->call$ info)))
           (er-soft+
            ctx t nil
            "A different call to DEFMAPPING with name ~x0 ~
                         has already been performed."
            name))
          ((er &)
           (evmac-process-input-print print ctx state))
          ((er &)
           (evmac-process-input-show-only show-only ctx state))
          ((run-when show-only)
           (cw "~x0~|"
               (defmapping-info->expansion info)))
          ((run-when print)
           (cw "~%The call ~x0 is redundant.~%" call)))
         (value t))))