• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
      • Std/lists
      • Std/alists
      • Obags
      • Std/util
      • Std/strings
      • Std/osets
      • Std/io
      • Std/basic
      • Std/system
        • Fresh-logical-name-with-$s-suffix
        • Irrelevant-formals-info
        • Std/system/function-queries
        • Std/system/term-queries
        • Std/system/term-transformations
          • Make-mv-let-call
          • Mvify
          • Remove-trivial-vars
          • Remove-unused-vars
          • Fsublis-fn-rec
          • Close-lambdas
          • Fsublis-var
          • Remove-mbe-logic/exec
            • Remove-mbe-logic
            • Remove-mbe-exec
            • Remove-mbe-logic/exec-lst
          • Untranslate$
          • Remove-dead-if-branches
          • Remove-progn
          • Make-mv-nth-calls
          • Apply-fn-into-ifs
          • Conjoin-equalities
          • Fapply-unary-to-terms
          • Apply-unary-to-terms
          • Apply-terms-same-args
          • Apply-term
          • Fsublis-fn-lst-simple
          • Fsublis-fn
          • Fapply-terms-same-args
          • Fsublis-fn-simple
          • Fapply-term
          • Remove-mbe-logic
          • Remove-mbe-exec
          • Quote-term
          • Quote-term-list
          • Apply-term*
          • Std/system/fsubcor-var
          • Std/system/conjoin
          • Std/system/flatten-ands-in-lit
          • Fapply-term*
          • Std/system/dumb-negate-lit
        • Std/system/enhanced-utilities
        • Install-not-normalized-event
        • Install-not-normalized-event-lst
        • Std/system/term-function-recognizers
        • Genvar$
        • Std/system/event-name-queries
        • Pseudo-tests-and-call-listp
        • Maybe-pseudo-event-formp
        • Add-suffix-to-fn-or-const
        • Chk-irrelevant-formals-ok
        • Table-alist+
        • Pseudo-tests-and-callp
        • 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-command-landmark-listp
        • Install-not-normalized$
        • Pseudo-event-landmark-listp
        • Known-packages
        • Std/system/partition-rest-and-keyword-args
        • Rune-enabledp
        • Rune-disabledp
        • Included-books
        • Std/system/pseudo-event-formp
        • Std/system/plist-worldp-with-formals
        • Std/system/w
        • Std/system/geprops
        • Std/system/arglistp
        • Std/system/constant-queries
      • Std/typed-lists
      • Std/bitsets
      • Std/testing
      • Std/typed-alists
      • Std/stobjs
    • Community
    • Proof-automation
    • ACL2
    • Macro-libraries
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Math
    • Testing-utilities
  • Std/system/term-transformations

Remove-mbe-logic/exec

Turn every call (mbe :logic a :exec b) in a term into just its :logic part a or :exec part b.

Signature
(remove-mbe-logic/exec term logic?) → new-term
Arguments
term — Guard (pseudo-termp term).
logic? — Guard (booleanp logic?).
Returns
new-term — Type (pseudo-termp new-term), given (pseudo-termp term).

The choice is determinated by the boolean flag, which is t when the :logic part is to be removed.

In translated terms, mbes have the form (return-last 'mbe1-raw b a). We turn that form into a or b, based on the flag.

Function: remove-mbe-logic/exec

(defun remove-mbe-logic/exec (term logic?)
 (declare (xargs :guard (and (pseudo-termp term)
                             (booleanp logic?))))
 (let ((__function__ 'remove-mbe-logic/exec))
   (declare (ignorable __function__))
   (b*
     (((when (variablep term)) term)
      ((when (fquotep term)) term)
      (fn (ffn-symb term))
      (args (fargs term))
      ((when (and (eq fn 'return-last)
                  (equal (first args) ''mbe1-raw)))
       (remove-mbe-logic/exec (if logic? (second args) (third args))
                              logic?))
      (new-fn (if (symbolp fn)
                  fn
                (make-lambda (lambda-formals fn)
                             (remove-mbe-logic/exec (lambda-body fn)
                                                    logic?))))
      (new-args (remove-mbe-logic/exec-lst args logic?)))
     (fcons-term new-fn new-args))))

Function: remove-mbe-logic/exec-lst

(defun remove-mbe-logic/exec-lst (terms logic?)
  (declare (xargs :guard (and (pseudo-term-listp terms)
                              (booleanp logic?))))
  (let ((__function__ 'remove-mbe-logic/exec-lst))
    (declare (ignorable __function__))
    (b* (((when (endp terms)) nil)
         ((cons term terms) terms)
         (new-term (remove-mbe-logic/exec term logic?))
         (new-terms (remove-mbe-logic/exec-lst terms logic?)))
      (cons new-term new-terms))))

Theorem: return-type-of-remove-mbe-logic/exec.new-term

(defthm return-type-of-remove-mbe-logic/exec.new-term
  (implies (pseudo-termp term)
           (b* ((?new-term (remove-mbe-logic/exec term logic?)))
             (pseudo-termp new-term)))
  :rule-classes :rewrite)

Theorem: return-type-of-remove-mbe-logic/exec-lst.new-terms

(defthm return-type-of-remove-mbe-logic/exec-lst.new-terms
  (implies
       (pseudo-term-listp terms)
       (b* ((?new-terms (remove-mbe-logic/exec-lst terms logic?)))
         (and (pseudo-term-listp new-terms)
              (equal (len new-terms) (len terms)))))
  :rule-classes :rewrite)

Subtopics

Remove-mbe-logic
Turn every call (mbe :logic a :exec b) in a term into just its :exec part b.
Remove-mbe-exec
Turn every call (mbe :logic a :exec b) in a term into just its :logic part a.
Remove-mbe-logic/exec-lst