• 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-ans

    Signature
    (vl-consteval-ans &key value width type) → ans
    Arguments
    value — Guard (natp value).
    width — Guard (posp width).
    type — Guard (vl-exprtype-p type).
    Returns
    ans — Type (vl-expr-p ans).

    Definitions and Theorems

    Function: vl-consteval-ans-fn

    (defun vl-consteval-ans-fn (value width type)
      (declare (xargs :guard (and (natp value)
                                  (posp width)
                                  (vl-exprtype-p type))))
      (declare (xargs :guard (unsigned-byte-p width value)))
      (let ((__function__ 'vl-consteval-ans))
        (declare (ignorable __function__))
        (b* ((width (lposfix width))
             (type (vl-exprtype-fix type))
             (guts (make-vl-constint :value value
                                     :origwidth width
                                     :origtype type))
             (ans (make-vl-atom :guts guts
                                :finalwidth width
                                :finaltype type)))
          ans)))

    Theorem: vl-expr-p-of-vl-consteval-ans

    (defthm vl-expr-p-of-vl-consteval-ans
      (b* ((ans (vl-consteval-ans-fn value width type)))
        (vl-expr-p ans))
      :rule-classes :rewrite)

    Theorem: vl-expr-resolved-p-of-vl-consteval-ans

    (defthm vl-expr-resolved-p-of-vl-consteval-ans
      (vl-expr-resolved-p (vl-consteval-ans :value value
                                            :width width
                                            :type type)))

    Theorem: vl-expr-welltyped-p-of-vl-consteval-ans

    (defthm vl-expr-welltyped-p-of-vl-consteval-ans
      (vl-expr-welltyped-p (vl-consteval-ans :value value
                                             :width width
                                             :type type)))

    Theorem: vl-expr->finalwidth-of-vl-consteval-ans

    (defthm vl-expr->finalwidth-of-vl-consteval-ans
      (equal (vl-expr->finalwidth (vl-consteval-ans :value value
                                                    :width width
                                                    :type type))
             (pos-fix width)))

    Theorem: vl-expr->finaltype-of-vl-consteval-ans

    (defthm vl-expr->finaltype-of-vl-consteval-ans
      (equal (vl-expr->finaltype (vl-consteval-ans :value value
                                                   :width width
                                                   :type type))
             (vl-exprtype-fix type)))

    Theorem: vl-consteval-ans-fn-of-nfix-value

    (defthm vl-consteval-ans-fn-of-nfix-value
      (equal (vl-consteval-ans-fn (nfix value)
                                  width type)
             (vl-consteval-ans-fn value width type)))

    Theorem: vl-consteval-ans-fn-nat-equiv-congruence-on-value

    (defthm vl-consteval-ans-fn-nat-equiv-congruence-on-value
      (implies (acl2::nat-equiv value value-equiv)
               (equal (vl-consteval-ans-fn value width type)
                      (vl-consteval-ans-fn value-equiv width type)))
      :rule-classes :congruence)

    Theorem: vl-consteval-ans-fn-of-pos-fix-width

    (defthm vl-consteval-ans-fn-of-pos-fix-width
      (equal (vl-consteval-ans-fn value (pos-fix width)
                                  type)
             (vl-consteval-ans-fn value width type)))

    Theorem: vl-consteval-ans-fn-pos-equiv-congruence-on-width

    (defthm vl-consteval-ans-fn-pos-equiv-congruence-on-width
      (implies (acl2::pos-equiv width width-equiv)
               (equal (vl-consteval-ans-fn value width type)
                      (vl-consteval-ans-fn value width-equiv type)))
      :rule-classes :congruence)

    Theorem: vl-consteval-ans-fn-of-vl-exprtype-fix-type

    (defthm vl-consteval-ans-fn-of-vl-exprtype-fix-type
      (equal (vl-consteval-ans-fn value width (vl-exprtype-fix type))
             (vl-consteval-ans-fn value width type)))

    Theorem: vl-consteval-ans-fn-vl-exprtype-equiv-congruence-on-type

    (defthm vl-consteval-ans-fn-vl-exprtype-equiv-congruence-on-type
      (implies (vl-exprtype-equiv type type-equiv)
               (equal (vl-consteval-ans-fn value width type)
                      (vl-consteval-ans-fn value width type-equiv)))
      :rule-classes :congruence)