• 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
                  • Op-shl-wrapped
                  • Op-shr-wrapped
                    • Op-shr
                    • Op-shl
                  • Errors
                  • Value-expressions
                  • Locations
                  • Input-execution
                  • Edwards-bls12-generator
                  • Equality-operations
                  • Logical-operations
                  • Program-execution
                  • Ordering-operations
                  • Bitwise-operations
                  • 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
    • Shift-operations

    Op-shr-wrapped

    Leo wrapped right shift operation.

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

    Definitions and Theorems

    Function: op-shr-wrapped

    (defun op-shr-wrapped (left right)
     (declare (xargs :guard (and (valuep left) (valuep right))))
     (let ((__function__ 'op-shr-wrapped))
      (declare (ignorable __function__))
      (b*
       ((err (list :op-shr-wrapped (value-fix left)
                   (value-fix right)))
        ((unless (int-valuep left))
         (reserrf err))
        ((unless (int-valuep right))
         (reserrf err))
        (left-operand-numbits (int-value-numbits left))
        (left-operand-int (int-value-to-int left))
        ((unless (member-eq (value-kind right)
                            '(:u8 :u16 :u32)))
         (reserrf err))
        (right-operand-int (int-value-to-int right))
        ((unless (natp right-operand-int))
         (reserrf err))
        (right-operand-int (mod right-operand-int left-operand-numbits))
        (shifted-value (floor left-operand-int
                              (expt 2 right-operand-int))))
       (make-int-value (value-kind left)
                       shifted-value))))

    Theorem: value-resultp-of-op-shr-wrapped

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