• 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
          • Bit-blasting
          • Functions
            • 4vec-operations
              • 4vec-bit?
              • 4vec-part-install
              • 4vec-concat
              • 4vec-?
              • 4vec-rsh
              • 4vec-bit?!
              • 4vec-===*
              • 4vec-reduction-and
              • 4vec-bit-extract
              • 4vec-rev-blocks
              • 4vec-lsh
              • 4vec-resor
              • 4vec-resand
              • 4vec-parity
              • 4vec-plus
              • 4vec-<
              • 4vec-minus
              • 4vec-res
              • 4vec-override
              • 4vec-bit-index
              • 4vec-?!
              • 4vec-zero-ext
              • 4vec-part-select
              • 4vec-===
              • 4vec-remainder
              • 4vec-reduction-or
              • 4vec-idx->4v
              • 4vec-==
              • 4vec-sign-ext
              • 4vec-quotient
              • 4vec-?*
              • 4vec-bitxor
                • 4vec-wildeq
                • 4vec-times
                • 4vec-bitmux
                • 4vec-symwildeq
                • 4vec-bitand
                • 4vec-wildeq-safe
                • 4vec-bitor
                • 4vec-shift-core
                • 4vec-pow
                • 4vec-onset
                • 4vec-offset
                • 4vec-xdet
                • 4vec-uminus
                • 4vec-clog2
                • 4vec-bitnot
                • 4vec-onehot
                • 4vec-countones
                • 4veclist-p-to-stringp
                • 4vec-p-to-stringp
                • 4vec-onehot0
                • 4vec-1mask
                • 4vec-p-to-stringp-aux
                • 4v->4vec-bit
                • 4v-to-characterp
                • Bool->vec
                • Unsigned-4vec-p
              • 3vec-operations
              • *svex-op-table*
            • 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
    • 4vec-operations

    4vec-bitxor

    Bitwise logical XOR of 4vecs.

    Signature
    (4vec-bitxor x y) → x^y
    Arguments
    x — Guard (4vec-p x).
    y — Guard (4vec-p y).
    Returns
    x^y — Type (3vec-p! x^y).

    Definitions and Theorems

    Function: 4vec-bitxor

    (defun 4vec-bitxor (x y)
      (declare (xargs :guard (and (4vec-p x) (4vec-p y))))
      (let ((__function__ '4vec-bitxor))
        (declare (ignorable __function__))
        (if-2vec-p (x y)
                   (2vec (logxor (2vec->val x) (2vec->val y)))
                   (b* (((4vec x))
                        ((4vec y))
                        (xmask (logior (logxor x.upper x.lower)
                                       (logxor y.upper y.lower))))
                     (4vec (logior xmask (logxor x.upper y.upper))
                           (logand (lognot xmask)
                                   (logxor x.lower y.lower)))))))

    Theorem: 3vec-p!-of-4vec-bitxor

    (defthm 3vec-p!-of-4vec-bitxor
      (b* ((x^y (4vec-bitxor x y)))
        (3vec-p! x^y))
      :rule-classes :rewrite)

    Theorem: 4vec-bitxor-redef

    (defthm 4vec-bitxor-redef
      (equal (4vec-bitxor x y)
             (3vec-bitxor (3vec-fix x)
                          (3vec-fix y))))

    Main correctness theorem: each result bit is just the ACL2::4v-xor of the corresponding input bits.

    Theorem: 4vec-bitxor-bits

    (defthm 4vec-bitxor-bits
      (equal (4vec-idx->4v n (4vec-bitxor x y))
             (acl2::4v-xor (4vec-idx->4v n x)
                           (4vec-idx->4v n y))))

    Theorem: 4vec-bitxor-of-3vec-fix-x

    (defthm 4vec-bitxor-of-3vec-fix-x
      (equal (4vec-bitxor (3vec-fix x) y)
             (4vec-bitxor x y)))

    Theorem: 4vec-bitxor-3vec-equiv-congruence-on-x

    (defthm 4vec-bitxor-3vec-equiv-congruence-on-x
      (implies (3vec-equiv x x-equiv)
               (equal (4vec-bitxor x y)
                      (4vec-bitxor x-equiv y)))
      :rule-classes :congruence)

    Theorem: 4vec-bitxor-of-3vec-fix-y

    (defthm 4vec-bitxor-of-3vec-fix-y
      (equal (4vec-bitxor x (3vec-fix y))
             (4vec-bitxor x y)))

    Theorem: 4vec-bitxor-3vec-equiv-congruence-on-y

    (defthm 4vec-bitxor-3vec-equiv-congruence-on-y
      (implies (3vec-equiv y y-equiv)
               (equal (4vec-bitxor x y)
                      (4vec-bitxor x y-equiv)))
      :rule-classes :congruence)