• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • Proof-checker-array
      • Soft
      • C
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Riscv
      • Taspi
      • Bitcoin
      • Des
      • Ethereum
      • X86isa
      • Sha-2
      • Yul
      • Zcash
      • Proof-checker-itp13
      • Regex
      • ACL2-programming-language
      • Json
      • Jfkr
      • Equational
      • Cryptography
      • Poseidon
      • Where-do-i-place-my-book
      • Axe
      • Aleo
        • Aleobft
        • Aleovm
        • Leo
          • Grammar
          • Early-version
            • Json2ast
            • Testing
            • Definition
              • Flattening
              • Abstract-syntax
              • Dynamic-semantics
                • Execution
                • Values
                • Dynamic-environments
                • Arithmetic-operations
                • Curve-parameterization
                • Shift-operations
                • Errors
                • Value-expressions
                • Locations
                • Input-execution
                • Edwards-bls12-generator
                • Equality-operations
                • Logical-operations
                • Program-execution
                • Ordering-operations
                • Bitwise-operations
                  • Op-bitior
                    • Op-bitand
                    • Op-bitxor
                    • Op-not
                  • Literal-evaluation
                  • Type-maps-for-struct-components
                  • Output-execution
                  • Tuple-operations
                  • Struct-operations
                • Compilation
                • Static-semantics
                • Concrete-syntax
        • Bigmems
        • Builtins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Community
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Bitwise-operations

    Op-bitior

    Leo bitwise-inclusive-or operation.

    Signature
    (op-bitior left right) → result
    Arguments
    left — Guard (valuep left).
    right — Guard (valuep right).
    Returns
    result — Type (value-resultp result).

    This or operation operates on integers in a bitwise fashion and on booleans where both arguments are evaluated.

    Definitions and Theorems

    Function: op-bitior

    (defun op-bitior (left right)
      (declare (xargs :guard (and (valuep left) (valuep right))))
      (let ((__function__ 'op-bitior))
        (declare (ignorable __function__))
        (b* ((err (list :op-bitior (value-fix left)
                        (value-fix right))))
          (cond ((and (value-case left :bool)
                      (value-case right :bool))
                 (let ((leftval (value-bool->get left))
                       (rightval (value-bool->get right)))
                   (value-bool (or leftval rightval))))
                ((and (value-case left :u8)
                      (value-case right :u8))
                 (value-u8 (logior (value-u8->get left)
                                   (value-u8->get right))))
                ((and (value-case left :u16)
                      (value-case right :u16))
                 (value-u16 (logior (value-u16->get left)
                                    (value-u16->get right))))
                ((and (value-case left :u32)
                      (value-case right :u32))
                 (value-u32 (logior (value-u32->get left)
                                    (value-u32->get right))))
                ((and (value-case left :u64)
                      (value-case right :u64))
                 (value-u64 (logior (value-u64->get left)
                                    (value-u64->get right))))
                ((and (value-case left :u128)
                      (value-case right :u128))
                 (value-u128 (logior (value-u128->get left)
                                     (value-u128->get right))))
                ((and (value-case left :i8)
                      (value-case right :i8))
                 (value-i8 (logior (value-i8->get left)
                                   (value-i8->get right))))
                ((and (value-case left :i16)
                      (value-case right :i16))
                 (value-i16 (logior (value-i16->get left)
                                    (value-i16->get right))))
                ((and (value-case left :i32)
                      (value-case right :i32))
                 (value-i32 (logior (value-i32->get left)
                                    (value-i32->get right))))
                ((and (value-case left :i64)
                      (value-case right :i64))
                 (value-i64 (logior (value-i64->get left)
                                    (value-i64->get right))))
                ((and (value-case left :i128)
                      (value-case right :i128))
                 (value-i128 (logior (value-i128->get left)
                                     (value-i128->get right))))
                (t (reserrf err))))))

    Theorem: value-resultp-of-op-bitior

    (defthm value-resultp-of-op-bitior
      (b* ((result (op-bitior left right)))
        (value-resultp result))
      :rule-classes :rewrite)

    Theorem: op-bitior-of-value-fix-left

    (defthm op-bitior-of-value-fix-left
      (equal (op-bitior (value-fix left) right)
             (op-bitior left right)))

    Theorem: op-bitior-value-equiv-congruence-on-left

    (defthm op-bitior-value-equiv-congruence-on-left
      (implies (value-equiv left left-equiv)
               (equal (op-bitior left right)
                      (op-bitior left-equiv right)))
      :rule-classes :congruence)

    Theorem: op-bitior-of-value-fix-right

    (defthm op-bitior-of-value-fix-right
      (equal (op-bitior left (value-fix right))
             (op-bitior left right)))

    Theorem: op-bitior-value-equiv-congruence-on-right

    (defthm op-bitior-value-equiv-congruence-on-right
      (implies (value-equiv right right-equiv)
               (equal (op-bitior left right)
                      (op-bitior left right-equiv)))
      :rule-classes :congruence)