• 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
        • Syntax-for-tools
        • Atc
        • Language
          • Abstract-syntax
          • Integer-ranges
          • Implementation-environments
          • Dynamic-semantics
            • Exec
            • Exec-arrsub
            • Exec-expr-pure
            • Exec-expr-asg
            • Init-value-to-value
            • Exec-memberp
            • Apconvert-expr-value
            • Exec-address
            • Exec-member
            • Init-scope
            • Exec-unary
            • Exec-fun
            • Exec-block-item
            • Eval-iconst
            • Exec-binary-strict-pure
            • Exec-expr-pure-list
            • Eval-binary-strict-pure
            • Exec-block-item-list
            • Exec-indir
            • Exec-expr-call-or-pure
            • Exec-stmt-while
            • Exec-stmt
            • Exec-ident
            • Eval-cast
            • Exec-cast
            • Eval-unary
              • Exec-const
              • Exec-initer
              • Exec-expr-call-or-asg
              • Eval-const
              • Exec-expr-call
            • Static-semantics
            • Grammar
            • Integer-formats
            • Types
            • Portable-ascii-identifiers
            • Values
            • Integer-operations
            • Computation-states
            • Object-designators
            • Operations
            • Errors
            • Tag-environments
            • Function-environments
            • Character-sets
            • Flexible-array-member-removal
            • Arithmetic-operations
            • Pointer-operations
            • Bytes
            • Keywords
            • Real-operations
            • Array-operations
            • Scalar-operations
            • Structure-operations
          • Representation
          • Transformation-tools
          • Insertion-sort
          • Pack
        • Farray
        • Rp-rewriter
        • Instant-runoff-voting
        • Imp-language
        • Sidekick
        • Leftist-trees
        • Java
        • Taspi
        • Bitcoin
        • Riscv
        • 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
        • Bigmems
        • Builtins
        • Execloader
        • Aleo
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Dynamic-semantics

    Eval-unary

    Evaluate a unary operation that does not involve pointers, on a value, returning a value.

    Signature
    (eval-unary op arg) → val
    Arguments
    op — Guard (unopp op).
    arg — Guard (valuep arg).
    Returns
    val — Type (value-resultp val).

    Definitions and Theorems

    Function: eval-unary

    (defun eval-unary (op arg)
      (declare (xargs :guard (and (unopp op) (valuep arg))))
      (declare (xargs :guard (unop-nonpointerp op)))
      (let ((__function__ 'eval-unary))
        (declare (ignorable __function__))
        (case (unop-kind op)
          (:plus (plus-value arg))
          (:minus (minus-value arg))
          (:bitnot (bitnot-value arg))
          (:lognot (lognot-value arg))
          (t (error (impossible))))))

    Theorem: value-resultp-of-eval-unary

    (defthm value-resultp-of-eval-unary
      (b* ((val (eval-unary op arg)))
        (value-resultp val))
      :rule-classes :rewrite)

    Theorem: eval-unary-of-unop-fix-op

    (defthm eval-unary-of-unop-fix-op
      (equal (eval-unary (unop-fix op) arg)
             (eval-unary op arg)))

    Theorem: eval-unary-unop-equiv-congruence-on-op

    (defthm eval-unary-unop-equiv-congruence-on-op
      (implies (unop-equiv op op-equiv)
               (equal (eval-unary op arg)
                      (eval-unary op-equiv arg)))
      :rule-classes :congruence)

    Theorem: eval-unary-of-value-fix-arg

    (defthm eval-unary-of-value-fix-arg
      (equal (eval-unary op (value-fix arg))
             (eval-unary op arg)))

    Theorem: eval-unary-value-equiv-congruence-on-arg

    (defthm eval-unary-value-equiv-congruence-on-arg
      (implies (value-equiv arg arg-equiv)
               (equal (eval-unary op arg)
                      (eval-unary op arg-equiv)))
      :rule-classes :congruence)