• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • 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-unary-reduxop

    Signature
    (vl-consteval-unary-reduxop op aval width) → ans
    Arguments
    op — Guard (member op '(:vl-unary-bitand :vl-unary-nand :vl-unary-bitor :vl-unary-nor :vl-unary-xor :vl-unary-xnor :vl-unary-lognot)) .
    aval — Guard (natp aval).
    width — Guard (posp width).
    Returns
    ans — Type (bitp ans).

    Definitions and Theorems

    Function: vl-consteval-unary-reduxop

    (defun vl-consteval-unary-reduxop (op aval width)
     (declare
      (xargs
       :guard
       (and (member op
                    '(:vl-unary-bitand :vl-unary-nand :vl-unary-bitor
                                       :vl-unary-nor :vl-unary-xor
                                       :vl-unary-xnor :vl-unary-lognot))
            (natp aval)
            (posp width))))
     (let ((__function__ 'vl-consteval-unary-reduxop))
       (declare (ignorable __function__))
       (b* ((aval (lnfix aval))
            (width (lposfix width)))
         (case op
               (:vl-unary-bitand (if (equal (acl2::loghead width aval)
                                            (1- (expt 2 width)))
                                     1
                                   0))
               (:vl-unary-nand (if (equal (acl2::loghead width aval)
                                          (1- (expt 2 width)))
                                   0
                                 1))
               (:vl-unary-bitor (if (posp aval) 1 0))
               (:vl-unary-nor (if (posp aval) 0 1))
               (:vl-unary-xor (if (oddp aval) 1 0))
               (:vl-unary-xnor (if (oddp aval) 0 1))
               (:vl-unary-lognot (if (posp aval) 0 1))
               (otherwise (progn$ (impossible) 0))))))

    Theorem: bitp-of-vl-consteval-unary-reduxop

    (defthm bitp-of-vl-consteval-unary-reduxop
      (b* ((ans (vl-consteval-unary-reduxop op aval width)))
        (bitp ans))
      :rule-classes :rewrite)

    Theorem: vl-consteval-unary-reduxop-of-nfix-aval

    (defthm vl-consteval-unary-reduxop-of-nfix-aval
      (equal (vl-consteval-unary-reduxop op (nfix aval)
                                         width)
             (vl-consteval-unary-reduxop op aval width)))

    Theorem: vl-consteval-unary-reduxop-nat-equiv-congruence-on-aval

    (defthm vl-consteval-unary-reduxop-nat-equiv-congruence-on-aval
      (implies (acl2::nat-equiv aval aval-equiv)
               (equal (vl-consteval-unary-reduxop op aval width)
                      (vl-consteval-unary-reduxop op aval-equiv width)))
      :rule-classes :congruence)

    Theorem: vl-consteval-unary-reduxop-of-pos-fix-width

    (defthm vl-consteval-unary-reduxop-of-pos-fix-width
      (equal (vl-consteval-unary-reduxop op aval (pos-fix width))
             (vl-consteval-unary-reduxop op aval width)))

    Theorem: vl-consteval-unary-reduxop-pos-equiv-congruence-on-width

    (defthm vl-consteval-unary-reduxop-pos-equiv-congruence-on-width
      (implies (acl2::pos-equiv width width-equiv)
               (equal (vl-consteval-unary-reduxop op aval width)
                      (vl-consteval-unary-reduxop op aval width-equiv)))
      :rule-classes :congruence)