• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
        • Svex-stvs
        • Svex-decomposition-methodology
        • Sv-versus-esim
        • Svex-decomp
        • Svex-compose-dfs
        • Svex-compilation
        • Moddb
        • Svmods
          • Address
          • Wire
          • Module
          • Lhs
            • Lhs.lisp
              • Lhs-vars-normorderedp
              • Lhs-norm
              • Lhatom-normorderedp
              • Lhs-normp
              • Svex-lhsrewrite-aux
              • Lhs-concat
              • Lhs-check-masks
              • Lhrange-combine
              • Svexarr-vars-aux
              • Assigns-check-masks
              • Svex->lhs-range
                • Svex-lhs-preproc-blkrev
                • Svarlist-boundedp-badguy
                • Driverlist-rest-after-strength
                • Aliases-normorderedp
                • Lhs-rsh
                • Lhs-cons
                • Svarlist-boundedp
                • Lhs-bitproj
                • Lhs-vars
                • Driver
                • Svex-override
                • Make-simple-lhs
                • Lhssvex-range-p
                • Lhs-override
                • Lhs-first-aux
                • Lhrange-combinable-dec
                • Lhrange-bitproj
                • Lhatom
                • Driverlist-values-of-strength
                • Lhs-rest-aux
                • Lhs-rest
                • Aliases-normorderedp-aux
                • Svexarr-vars
                • Lhsarr-to-svexarr
                • Svexarr-vars-witness-aux
                • Lhbit
                • Svex-lhsrewrite
                • Svar-boundedp
                • Lhs-decomp-aux
                • Svex->lhs-bound
                • Aliases-vars-aux
                • Svexarr
                • Svexarr-vars-witness
                • Svar-set-index
                • Lhsarr
                • Lhs-override-vars
                • Lhatom-eval-zero
                • Lhatom-bitproj
                • Lhrange-nextbit
                • Lhrange-combinable
                • Driverlist->svex
                • Svexlist-resolve
                • Lhs->svex-zero
                • Lhs-overridelist-vars
                • Lhs-overridelist-keys
                • Lhbit-eval
                • Driverlist-vars
                • Assigns-vars
                • Svex-int
                • Lhssvex-bounded-p
                • Lhslist-vars
                • Lhs-decomp
                • Lhatom-vars
                • Svar-map-vars
                • Lhssvex-unbounded-p
                • Lhspairs-vars
                • Lhs-width
                • Aliases-vars
                • Lhs-first
                • Svar-index
                • Assigns
                • Svar-indexedp
                • Lhspairs
                • Svex-overridelist
                • Lhslist
                • Lhs-overridelist
                • Driverlist
                • Svex-lhs-preproc
                • Svexarr-fix
                • Lhsarr-fix
              • Lhs-p
              • Lhs-fix
              • Lhrange
              • Lhs-eval-zx
              • Lhs-equiv
              • Lhs-eval
              • Lhs->svex
            • Path
            • Svar-add-namespace
            • Design
            • Modinst
            • Lhs-add-namespace
            • Modalist
            • Path-add-namespace
            • Modname->submodnames
            • Name
            • Constraintlist-addr-p
            • Svex-alist-addr-p
            • Svar-map-addr-p
            • Lhspairs-addr-p
            • Modname
            • Assigns-addr-p
            • Lhs-addr-p
            • Lhatom-addr-p
            • Modhier-list-measure
            • Attributes
            • Modhier-measure
            • Modhier-list-measure-aux
            • Modhier-loopfreelist-p
            • Modhier-loopfree-p
          • Svstmt
          • Sv-tutorial
          • Expressions
          • Symbolic-test-vector
          • Vl-to-svex
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Lhs.lisp

    Svex->lhs-range

    Signature
    (svex->lhs-range rsh w x) → lhs
    Arguments
    rsh — Guard (natp rsh).
    w — Guard (natp w).
    x — Guard (svex-p x).
    Returns
    lhs — Type (lhs-p lhs).

    Definitions and Theorems

    Function: svex->lhs-range

    (defun svex->lhs-range (rsh w x)
     (declare (xargs :guard (and (natp rsh) (natp w) (svex-p x))))
     (declare (xargs :guard (lhssvex-range-p rsh w x)))
     (let ((__function__ 'svex->lhs-range))
      (declare (ignorable __function__))
      (if (zp w)
          nil
        (svex-case
             x :var
             (list (lhrange w (lhatom-var x.name rsh)))
             :quote (list (lhrange w (lhatom-z)))
             :call
             (case x.fn
               (concat (b* (((unless (mbt (eql (len x.args) 3)))
                             nil)
                            ((list x.w x.lo x.hi) x.args)
                            (x.wval (2vec->val (svex-quote->val x.w)))
                            ((when (<= x.wval (lnfix rsh)))
                             (svex->lhs-range (- (lnfix rsh) x.wval)
                                              w x.hi))
                            ((when (<= (+ (lnfix rsh) w) x.wval))
                             (svex->lhs-range rsh w x.lo))
                            (lo-width (- x.wval (lnfix rsh))))
                         (lhs-concat lo-width
                                     (svex->lhs-range rsh lo-width x.lo)
                                     (svex->lhs-range 0 (- w lo-width)
                                                      x.hi))))
               (rsh (b* (((unless (mbt (eql (len x.args) 2)))
                          nil)
                         ((list x.sh x.sub) x.args)
                         (x.shval (2vec->val (svex-quote->val x.sh))))
                      (svex->lhs-range (+ x.shval (lnfix rsh))
                                       w x.sub))))))))

    Theorem: lhs-p-of-svex->lhs-range

    (defthm lhs-p-of-svex->lhs-range
      (b* ((lhs (svex->lhs-range rsh w x)))
        (lhs-p lhs))
      :rule-classes :rewrite)

    Theorem: vars-of-svex->lhs-range

    (defthm vars-of-svex->lhs-range
      (b* ((?lhs (svex->lhs-range rsh w x)))
        (implies (not (member v (svex-vars x)))
                 (not (member v (lhs-vars lhs))))))

    Theorem: svex->lhs-range-of-nfix-rsh

    (defthm svex->lhs-range-of-nfix-rsh
      (equal (svex->lhs-range (nfix rsh) w x)
             (svex->lhs-range rsh w x)))

    Theorem: svex->lhs-range-nat-equiv-congruence-on-rsh

    (defthm svex->lhs-range-nat-equiv-congruence-on-rsh
      (implies (nat-equiv rsh rsh-equiv)
               (equal (svex->lhs-range rsh w x)
                      (svex->lhs-range rsh-equiv w x)))
      :rule-classes :congruence)

    Theorem: svex->lhs-range-of-nfix-w

    (defthm svex->lhs-range-of-nfix-w
      (equal (svex->lhs-range rsh (nfix w) x)
             (svex->lhs-range rsh w x)))

    Theorem: svex->lhs-range-nat-equiv-congruence-on-w

    (defthm svex->lhs-range-nat-equiv-congruence-on-w
      (implies (nat-equiv w w-equiv)
               (equal (svex->lhs-range rsh w x)
                      (svex->lhs-range rsh w-equiv x)))
      :rule-classes :congruence)

    Theorem: svex->lhs-range-of-svex-fix-x

    (defthm svex->lhs-range-of-svex-fix-x
      (equal (svex->lhs-range rsh w (svex-fix x))
             (svex->lhs-range rsh w x)))

    Theorem: svex->lhs-range-svex-equiv-congruence-on-x

    (defthm svex->lhs-range-svex-equiv-congruence-on-x
      (implies (svex-equiv x x-equiv)
               (equal (svex->lhs-range rsh w x)
                      (svex->lhs-range rsh w x-equiv)))
      :rule-classes :congruence)

    Theorem: svex->lhs-range-correct

    (defthm svex->lhs-range-correct
      (b* ((?lhs (svex->lhs-range rsh w x)))
        (implies (lhssvex-range-p rsh w x)
                 (equal (lhs-eval lhs env)
                        (4vec-concat (2vec (nfix w))
                                     (4vec-rsh (2vec (nfix rsh))
                                               (svex-eval x env))
                                     (4vec-z))))))