• 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
          • Expression-sizing
            • Expression-sizing-minutia
            • Expression-sizing-intro
            • Vl-keyvalue-pattern-collect-array-replacements
            • Vl-assignpattern-positional-replacement
            • Vl-plainarg-exprsize
            • Vl-assignpattern-keyvalue-replacement
            • Vl-keyvalue-pattern-collect-struct-replacements
            • Vl-modulelist-exprsize
            • Vl-expr-assignpattern-extend/truncate
            • Vl-structmemberlist->types
            • Vl-expr-size
            • Vl-expr-selfdetermine-type
            • Vl-assignpattern-multi-replacement
            • Vl-parse-keyval-pattern-struct
            • Vl-plainarglist-exprsize
            • Vl-parse-keyval-pattern-array
            • Vl-warn-about-implicit-extension
            • Vl-assigncontext-size
            • Vl-arguments-exprsize
            • Vl-assignpattern-replacement
            • Vl-packeddimensionlist-exprsize
            • Vl-namedparamvaluelist-exprsize
            • Vl-maybe-delayoreventcontrol-exprsize
            • Vl-repeateventcontrol-exprsize
            • Vl-paramvaluelist-exprsize
            • Vl-maybe-packeddimension-exprsize
            • Vl-delayoreventcontrol-exprsize
            • Vl-namedparamvalue-exprsize
            • Vl-namedarglist-exprsize
            • Vl-enumitemlist-exprsize
            • Vl-packeddimension-exprsize
            • Vl-maybe-paramvalue-exprsize
            • Vl-evatomlist-exprsize
            • Vl-atom-selfdetermine-type
            • Vl-rangelist-exprsize
            • Vl-maybe-gatedelay-exprsize
            • Vl-maybe-datatype-exprsize
            • Vl-gatedelay-exprsize
            • Vl-paramargs-exprsize
            • Vl-namedarg-exprsize
            • Vl-eventcontrol-exprsize
            • Vl-enumbasetype-exprsize
            • Vl-delaycontrol-exprsize
            • Vl-paramvalue-exprsize
            • Vl-maybe-range-exprsize
            • Vl-enumitem-exprsize
            • Vl-range-exprsize
            • Vl-paramdecl-exprsize
            • Vl-paramdecllist-exprsize
            • Vl-maybe-expr-size
            • Vl-evatom-exprsize
            • Vl-vardecllist-exprsize
            • Vl-portdecllist-exprsize
            • Vl-modinstlist-exprsize
            • Vl-initiallist-exprsize
            • Vl-gateinstlist-exprsize
            • Vl-fundecllist-exprsize
            • Vl-assign-exprsize
            • Vl-interfaceport-exprsize
            • Vl-assignlist-exprsize
            • Vl-alwayslist-exprsize
            • Vl-portlist-exprsize
            • Vl-modinst-exprsize
            • Vl-gateinst-exprsize
            • Vl-fundecl-exprsize
            • Vl-vardecl-exprsize
            • Vl-regularport-exprsize
            • Vl-portdecl-exprsize
            • Vl-initial-exprsize
            • Vl-always-exprsize
            • Vl-port-exprsize
            • Vl-lvalue-type
            • Vl-classify-extension-warning-hook
            • Welltyped
            • Vl-castexpr->datatype
            • Vl-expr-size-assigncontext
              • Vl-arrayslice-expr-size-assigncontext
              • Vl-index-expr-size-assigncontext
              • Vl-atom-size-assigncontext
              • Vl-type-expr-pairs-sum-datatype-sizes
              • Vl-basictype->datatype
              • Vl-expr-replace-assignpatterns
              • Vl-design-exprsize
              • Vl-op-simple-vector-p
              • Vl-expr-val-alist-max-count
              • Vl-expr-has-patterns
              • Vl-exprlist-max-count
              • Vl-unsigned-when-size-zero-lst
              • Vl-type-expr-pairs
              • Append-n
              • Vl-expr-val-alist
              • Vl-datatypelist
            • Occform
            • Oprewrite
            • Expand-functions
            • Delayredux
            • Unparameterization
            • Caseelim
            • Split
            • Selresolve
            • Weirdint-elim
            • Vl-delta
            • Replicate-insts
            • Rangeresolve
            • Propagate
            • Clean-selects
            • Clean-params
            • Blankargs
            • Inline-mods
            • Expr-simp
            • Trunc
            • Always-top
            • Gatesplit
            • Gate-elim
            • Expression-optimization
            • Elim-supplies
            • Wildelim
            • Drop-blankports
            • Clean-warnings
            • Addinstnames
            • Custom-transform-hooks
            • Annotate
            • Latchcode
            • Elim-unused-vars
            • Problem-modules
          • Lint
          • Mlib
          • Server
          • Kit
          • Printer
          • Esim-vl
          • Well-formedness
        • Sv
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Vl-expr-size-assigncontext

    Vl-atom-size-assigncontext

    Check and size an atom in an unpacked type context.

    Signature
    (vl-atom-size-assigncontext lhs-type x ss ctx warnings) 
      → 
    (mv successp new-x new-warnings)
    Arguments
    lhs-type — Guard (vl-datatype-p lhs-type).
    x — Guard (vl-expr-p x).
    ss — Guard (vl-scopestack-p ss).
    ctx — Guard (vl-context-p ctx).
    warnings — Guard (vl-warninglist-p warnings).
    Returns
    successp — Type (booleanp successp).
    new-x — Type (vl-expr-p new-x).
    new-warnings — Type (vl-warninglist-p new-warnings).

    Definitions and Theorems

    Function: vl-atom-size-assigncontext

    (defun vl-atom-size-assigncontext (lhs-type x ss ctx warnings)
     (declare (xargs :guard (and (vl-datatype-p lhs-type)
                                 (vl-expr-p x)
                                 (vl-scopestack-p ss)
                                 (vl-context-p ctx)
                                 (vl-warninglist-p warnings))))
     (declare (xargs :guard (vl-atom-p x)))
     (let ((__function__ 'vl-atom-size-assigncontext))
      (declare (ignorable __function__))
      (b*
       ((x (vl-expr-fix x))
        (ctx (vl-context-fix ctx))
        ((vl-atom x))
        ((unless (member (tag x.guts)
                         '(:vl-id :vl-hidpiece)))
         (mv
          nil x
          (warn
               :type :vl-assignpattern-elim-fail
               :msg "~a0: Bad expression for unpacked type context: ~a1"
               :args (list ctx x)))))
       (vl-index-expr-size-assigncontext lhs-type x ss ctx warnings))))

    Theorem: booleanp-of-vl-atom-size-assigncontext.successp

    (defthm booleanp-of-vl-atom-size-assigncontext.successp
      (b* (((mv ?successp ?new-x ?new-warnings)
            (vl-atom-size-assigncontext lhs-type x ss ctx warnings)))
        (booleanp successp))
      :rule-classes :type-prescription)

    Theorem: vl-expr-p-of-vl-atom-size-assigncontext.new-x

    (defthm vl-expr-p-of-vl-atom-size-assigncontext.new-x
      (b* (((mv ?successp ?new-x ?new-warnings)
            (vl-atom-size-assigncontext lhs-type x ss ctx warnings)))
        (vl-expr-p new-x))
      :rule-classes :rewrite)

    Theorem: vl-warninglist-p-of-vl-atom-size-assigncontext.new-warnings

    (defthm vl-warninglist-p-of-vl-atom-size-assigncontext.new-warnings
      (b* (((mv ?successp ?new-x ?new-warnings)
            (vl-atom-size-assigncontext lhs-type x ss ctx warnings)))
        (vl-warninglist-p new-warnings))
      :rule-classes :rewrite)

    Theorem: vl-expr-selfsize-of-vl-atom-expr-size-assigncontext

    (defthm vl-expr-selfsize-of-vl-atom-expr-size-assigncontext
      (b* (((mv ok new-x &)
            (vl-atom-size-assigncontext lhs-type x ss ctx warnings))
           ((mv warning typesize)
            (vl-datatype-size lhs-type))
           ((mv & selfsize)
            (vl-expr-selfsize new-x ss ctx2 warnings2)))
        (implies (and ok (not warning))
                 (equal selfsize typesize))))

    Theorem: vl-atom-size-assigncontext-of-vl-datatype-fix-lhs-type

    (defthm vl-atom-size-assigncontext-of-vl-datatype-fix-lhs-type
      (equal (vl-atom-size-assigncontext (vl-datatype-fix lhs-type)
                                         x ss ctx warnings)
             (vl-atom-size-assigncontext lhs-type x ss ctx warnings)))

    Theorem: vl-atom-size-assigncontext-vl-datatype-equiv-congruence-on-lhs-type

    (defthm
     vl-atom-size-assigncontext-vl-datatype-equiv-congruence-on-lhs-type
     (implies
      (vl-datatype-equiv lhs-type lhs-type-equiv)
      (equal
         (vl-atom-size-assigncontext lhs-type x ss ctx warnings)
         (vl-atom-size-assigncontext lhs-type-equiv x ss ctx warnings)))
     :rule-classes :congruence)

    Theorem: vl-atom-size-assigncontext-of-vl-expr-fix-x

    (defthm vl-atom-size-assigncontext-of-vl-expr-fix-x
      (equal (vl-atom-size-assigncontext lhs-type (vl-expr-fix x)
                                         ss ctx warnings)
             (vl-atom-size-assigncontext lhs-type x ss ctx warnings)))

    Theorem: vl-atom-size-assigncontext-vl-expr-equiv-congruence-on-x

    (defthm vl-atom-size-assigncontext-vl-expr-equiv-congruence-on-x
     (implies
      (vl-expr-equiv x x-equiv)
      (equal
         (vl-atom-size-assigncontext lhs-type x ss ctx warnings)
         (vl-atom-size-assigncontext lhs-type x-equiv ss ctx warnings)))
     :rule-classes :congruence)

    Theorem: vl-atom-size-assigncontext-of-vl-scopestack-fix-ss

    (defthm vl-atom-size-assigncontext-of-vl-scopestack-fix-ss
      (equal
           (vl-atom-size-assigncontext lhs-type x (vl-scopestack-fix ss)
                                       ctx warnings)
           (vl-atom-size-assigncontext lhs-type x ss ctx warnings)))

    Theorem: vl-atom-size-assigncontext-vl-scopestack-equiv-congruence-on-ss

    (defthm
        vl-atom-size-assigncontext-vl-scopestack-equiv-congruence-on-ss
     (implies
      (vl-scopestack-equiv ss ss-equiv)
      (equal
         (vl-atom-size-assigncontext lhs-type x ss ctx warnings)
         (vl-atom-size-assigncontext lhs-type x ss-equiv ctx warnings)))
     :rule-classes :congruence)

    Theorem: vl-atom-size-assigncontext-of-vl-context-fix-ctx

    (defthm vl-atom-size-assigncontext-of-vl-context-fix-ctx
     (equal
          (vl-atom-size-assigncontext lhs-type x ss (vl-context-fix ctx)
                                      warnings)
          (vl-atom-size-assigncontext lhs-type x ss ctx warnings)))

    Theorem: vl-atom-size-assigncontext-vl-context-equiv-congruence-on-ctx

    (defthm
          vl-atom-size-assigncontext-vl-context-equiv-congruence-on-ctx
     (implies
      (vl-context-equiv ctx ctx-equiv)
      (equal
         (vl-atom-size-assigncontext lhs-type x ss ctx warnings)
         (vl-atom-size-assigncontext lhs-type x ss ctx-equiv warnings)))
     :rule-classes :congruence)

    Theorem: vl-atom-size-assigncontext-of-vl-warninglist-fix-warnings

    (defthm vl-atom-size-assigncontext-of-vl-warninglist-fix-warnings
      (equal (vl-atom-size-assigncontext
                  lhs-type
                  x ss ctx (vl-warninglist-fix warnings))
             (vl-atom-size-assigncontext lhs-type x ss ctx warnings)))

    Theorem: vl-atom-size-assigncontext-vl-warninglist-equiv-congruence-on-warnings

    (defthm
     vl-atom-size-assigncontext-vl-warninglist-equiv-congruence-on-warnings
     (implies
      (vl-warninglist-equiv warnings warnings-equiv)
      (equal
         (vl-atom-size-assigncontext lhs-type x ss ctx warnings)
         (vl-atom-size-assigncontext lhs-type x ss ctx warnings-equiv)))
     :rule-classes :congruence)