• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • 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
        • Svstmt
        • Sv-tutorial
        • Expressions
          • Rewriting
          • Svex
            • Svar
            • Least-fixpoint
            • Svex-p
            • Svex-select
              • Svex-select-staticify-assignment
              • Svex-select-fix
              • Svex-select-case
              • Svex-select-split-static
              • Svex-select-p
              • Svex-selects-merge
                • Svex-select-replace-indices
                • Svex-select-vars
                • Svex-select-to-svex-with-substitution
                • Svex-select-equiv
                • Svex-select-part
                • Svex-select-count
                • Svex-select-var
                • Svex-select-to-lhs
                • Svex-select-staticp
                • Svex-select-inner-var
                • Svex-select->indices
                • Svex-select-to-svex
                • Svex-select-inner-width
                • Svex-select->width
                • Svex-select-kind
              • Svex-alist
              • Svex-equiv
              • Svexlist
              • Svex-call
              • Fnsym
              • Svex-quote
              • Svex-var
              • Svcall-rw
              • Svcall
              • Svex-kind
              • Svcall*
              • Svex-fix
              • Svex-count
              • Svex-1z
              • Svex-1x
              • Svex-z
              • Svex-x
            • Bit-blasting
            • Functions
            • 4vmask
            • Why-infinite-width
            • Svex-vars
            • Evaluation
            • Values
          • Symbolic-test-vector
          • Vl-to-svex
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Svex-select

    Svex-selects-merge

    Apply one select operation to the result of another.

    Signature
    (svex-selects-merge outer inner) → composition
    Arguments
    outer — Guard (svex-select-p outer).
    inner — Guard (svex-select-p inner).
    Returns
    composition — Type (svex-select-p composition).

    Definitions and Theorems

    Function: svex-selects-merge

    (defun svex-selects-merge (outer inner)
     (declare (xargs :guard (and (svex-select-p outer)
                                 (svex-select-p inner))))
     (let ((__function__ 'svex-selects-merge))
      (declare (ignorable __function__))
      (svex-select-case
          outer
          :var (svex-select-fix inner)
          :part (change-svex-select-part
                     outer
                     :subexp (svex-selects-merge outer.subexp inner)))))

    Theorem: svex-select-p-of-svex-selects-merge

    (defthm svex-select-p-of-svex-selects-merge
      (b* ((composition (svex-selects-merge outer inner)))
        (svex-select-p composition))
      :rule-classes :rewrite)

    Theorem: svex-select->width-of-svex-select-merge

    (defthm svex-select->width-of-svex-select-merge
      (implies
           (equal (svex-select-inner-width outer)
                  (svex-select->width inner))
           (equal (svex-select->width (svex-selects-merge outer inner))
                  (svex-select->width outer))))

    Theorem: svex-selects-merge-is-svex-compose

    (defthm svex-selects-merge-is-svex-compose
     (b* nil
      (b* ((inner-var (svex-select-inner-var outer)))
       (implies
        (and (not (member inner-var
                          (svexlist-vars (svex-select->indices outer))))
             (equal (svex-select-inner-width outer)
                    (svex-select->width inner)))
        (equal
           (svex-eval
                (svex-select-to-svex (svex-selects-merge outer inner))
                env)
           (svex-eval (svex-select-to-svex outer)
                      (cons (cons inner-var
                                  (svex-eval (svex-select-to-svex inner)
                                             env))
                            env)))))))

    Theorem: svex-select->indices-of-svex-selects-merge

    (defthm svex-select->indices-of-svex-selects-merge
      (b* ((?composition (svex-selects-merge outer inner)))
        (equal (svex-select->indices composition)
               (append (svex-select->indices outer)
                       (svex-select->indices inner)))))

    Theorem: svex-selects-merge-of-svex-select-fix-outer

    (defthm svex-selects-merge-of-svex-select-fix-outer
      (equal (svex-selects-merge (svex-select-fix outer)
                                 inner)
             (svex-selects-merge outer inner)))

    Theorem: svex-selects-merge-svex-select-equiv-congruence-on-outer

    (defthm svex-selects-merge-svex-select-equiv-congruence-on-outer
      (implies (svex-select-equiv outer outer-equiv)
               (equal (svex-selects-merge outer inner)
                      (svex-selects-merge outer-equiv inner)))
      :rule-classes :congruence)

    Theorem: svex-selects-merge-of-svex-select-fix-inner

    (defthm svex-selects-merge-of-svex-select-fix-inner
      (equal (svex-selects-merge outer (svex-select-fix inner))
             (svex-selects-merge outer inner)))

    Theorem: svex-selects-merge-svex-select-equiv-congruence-on-inner

    (defthm svex-selects-merge-svex-select-equiv-congruence-on-inner
      (implies (svex-select-equiv inner inner-equiv)
               (equal (svex-selects-merge outer inner)
                      (svex-selects-merge outer inner-equiv)))
      :rule-classes :congruence)