• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
        • Warnings
        • Primitives
        • Use-set
        • Syntax
        • Getting-started
        • Utilities
        • Loader
        • Transforms
        • Lint
        • Mlib
          • Scopestack
          • Filtering-by-name
          • Vl-namefactory
          • Substitution
          • Allexprs
          • Hid-tools
          • Vl-consteval
            • Vl-consteval-$bits
            • Vl-consteval-shiftop
            • Vl-consteval-concat
            • Vl-consteval-ans
            • Vl-consteval-unary-reduxop
            • Vl-consteval-binop
            • Vl-consteval-cmpop
            • Vl-consteval-usertype-bits
            • Vl-consteval-binlogic
              • Vl-clog2
              • Vl-consteval-basictype-bits
              • Vl-consteval-wideunary
              • Vl-consteval-main
              • *vl-fake-elem-for-vl-consteval*
            • Range-tools
            • Lvalexprs
            • Hierarchy
            • Finding-by-name
            • Expr-tools
            • Expr-slicing
            • Stripping-functions
            • Stmt-tools
            • Modnamespace
            • Vl-parse-expr-from-str
            • Welltyped
            • Reordering-by-name
            • Flat-warnings
            • Genblob
            • Expr-building
            • Datatype-tools
            • Syscalls
            • Relocate
            • Expr-cleaning
            • Namemangle
            • Caremask
            • Port-tools
            • Lvalues
          • Server
          • Kit
          • Printer
          • Esim-vl
          • Well-formedness
        • Sv
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Vl-consteval

    Vl-consteval-binlogic

    Signature
    (vl-consteval-binlogic op aval bval) → ans
    Arguments
    op — Guard (member op '(:vl-binary-logand :vl-binary-logor :vl-implies :vl-equiv)) .
    aval — Guard (natp aval).
    bval — Guard (natp bval).
    Returns
    ans — Type (bitp ans).

    Definitions and Theorems

    Function: vl-consteval-binlogic

    (defun vl-consteval-binlogic (op aval bval)
     (declare
      (xargs
         :guard (and (member op
                             '(:vl-binary-logand :vl-binary-logor
                                                 :vl-implies :vl-equiv))
                     (natp aval)
                     (natp bval))))
     (let ((__function__ 'vl-consteval-binlogic))
      (declare (ignorable __function__))
      (b* ((aval (lnfix aval))
           (bval (lnfix bval)))
        (case op
              (:vl-binary-logand (if (and (posp aval) (posp bval)) 1 0))
              (:vl-binary-logor (if (or (posp aval) (posp bval)) 1 0))
              (:vl-implies (if (implies (posp aval) (posp bval))
                               1
                             0))
              (:vl-equiv (if (equal (posp aval) (posp bval))
                             1
                           0))
              (otherwise (progn$ (impossible) 0))))))

    Theorem: bitp-of-vl-consteval-binlogic

    (defthm bitp-of-vl-consteval-binlogic
      (b* ((ans (vl-consteval-binlogic op aval bval)))
        (bitp ans))
      :rule-classes :rewrite)

    Theorem: vl-consteval-binlogic-of-nfix-aval

    (defthm vl-consteval-binlogic-of-nfix-aval
      (equal (vl-consteval-binlogic op (nfix aval)
                                    bval)
             (vl-consteval-binlogic op aval bval)))

    Theorem: vl-consteval-binlogic-nat-equiv-congruence-on-aval

    (defthm vl-consteval-binlogic-nat-equiv-congruence-on-aval
      (implies (acl2::nat-equiv aval aval-equiv)
               (equal (vl-consteval-binlogic op aval bval)
                      (vl-consteval-binlogic op aval-equiv bval)))
      :rule-classes :congruence)

    Theorem: vl-consteval-binlogic-of-nfix-bval

    (defthm vl-consteval-binlogic-of-nfix-bval
      (equal (vl-consteval-binlogic op aval (nfix bval))
             (vl-consteval-binlogic op aval bval)))

    Theorem: vl-consteval-binlogic-nat-equiv-congruence-on-bval

    (defthm vl-consteval-binlogic-nat-equiv-congruence-on-bval
      (implies (acl2::nat-equiv bval bval-equiv)
               (equal (vl-consteval-binlogic op aval bval)
                      (vl-consteval-binlogic op aval bval-equiv)))
      :rule-classes :congruence)