• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • Soft
        • C
        • Bv
        • Imp-language
        • Event-macros
        • Java
        • Bitcoin
        • Ethereum
        • Yul
        • Zcash
        • ACL2-programming-language
        • Prime-fields
        • Json
        • Syntheto
          • Process-syntheto-toplevel-fn
          • Translation
          • Language
            • Static-semantics
              • Check-expression-fns
              • Subtypep
              • Match-type
              • Check-product-update-expression
              • Get-builtin-function-in/out/pre-post
              • Check-sum-update-expression
              • Check-sum-field-expression
              • Check-strict-binary-expression
              • Check-lt/le/gt/ge-expression
              • Check-eq/ne-expression
              • Check-div/rem-expression
              • Check-add/sub/mul-expression
              • Align-let-vars-values
              • Check-iff-expression
              • Check-function-definition-top/nontop
              • Check-sum-construct-expression
              • Check-rem-expression
              • Check-mul-expression
              • Check-sub-expression
              • Check-div-expression
              • Check-add-expression
              • Check-ne-expression
              • Check-lt-expression
              • Check-le-expression
              • Check-gt-expression
              • Check-ge-expression
              • Check-eq-expression
              • Check-function-specifier
              • Type-result
              • Check-product-construct-expression
              • Supremum-type
              • Check-call-expression
              • Check-product-field-expression
              • Check-function-definer
              • Make-subproof-obligations
              • Get-function-in/out/pre/post
              • Check-sum-test-expression
              • Match-field
              • Decompose-expression
              • Match-to-target
              • Check-unary-expression
              • Max-supertype
              • Match-type-list
              • Check-minus-expression
              • Check-type-definition
              • Check-not-expression
                • Check-type-product
                • Match-field-list
                • Check-type-subset
                • Check-type-definition-in-recursion
                • Align-let-vars-values-aux
                • Non-trivial-proof-obligation
                • Check-type-recursion
                • Check-function-specification
                • Check-toplevel
                • Supremum-type-list
                • Check-component-expression
                • Check-branch-list
                • Check-function-recursion
                • Check-function-definition
                • Binding
                • Check-function-header
                • Check-function-definition-list
                • Check-type-definition-list-in-recursion
                • Check-theorem
                • Check-nonstrict-binary-expression
                • Context-add-variables
                • Decompose-expression-aux
                • Check-alternative
                • Check-multi-expression
                • Check-type-sum
                • Check-type
                • Check-alternative-list
                • Context-add-condition
                • Check-type-definer
                • Check-transform
                • Check-variable
                • Check-transform-args
                • Check-toplevel-list
                • Context-add-condition-list
                • Check-if/when/unless-expression
                • Initializers-to-variable-substitution
                • Context-add-binding
                • Check-function-header-list
                • Context-add-toplevel
                • Ensure-single-type
                • Max-supertypes
                • Check-bind-expression
                • Check-type-list
                • Check-literal
                • Literal-type
                • Check-expression-list
                • Variable-context
                • Check-cond-expression
                • Check-branch
                • Args-without-defaults
                • Check-expression
                • *builtin-function-names*
                • Function-called-in
              • Abstract-syntax
              • Outcome
              • Abstract-syntax-operations
              • Outcome-list
              • Outcomes
            • Process-syntheto-toplevel
            • Shallow-embedding
          • File-io-light
          • Cryptography
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Static-semantics

    Check-not-expression

    Check if a boolean negation expression is well-formed.

    Signature
    (check-not-expression arg arg-type arg-obligs expr ctxt) 
      → 
    result
    Arguments
    arg — Guard (expressionp arg).
    arg-type — Guard (typep arg-type).
    arg-obligs — Guard (proof-obligation-listp arg-obligs).
    expr — Guard (expressionp expr).
    ctxt — Guard (contextp ctxt).
    Returns
    result — Type (type-resultp result).

    The operand must be a boolean, and the result is a boolean.

    Definitions and Theorems

    Function: check-not-expression

    (defun check-not-expression (arg arg-type arg-obligs expr ctxt)
     (declare (xargs :guard (and (expressionp arg)
                                 (typep arg-type)
                                 (proof-obligation-listp arg-obligs)
                                 (expressionp expr)
                                 (contextp ctxt))))
     (declare (ignorable expr))
     (let ((__function__ 'check-not-expression))
       (declare (ignorable __function__))
       (b*
        (((mv okp obligs)
          (match-type arg arg-type (type-boolean)
                      ctxt))
         ((unless okp)
          (type-result-err (list :type-mismatch-not (expression-fix arg)
                                 (type-fix arg-type)
                                 (type-boolean))))
         ((acl2::run-when (consp obligs))
          (raise "Internal error: obligations ~x0 for the boolean type."
                 obligs)))
        (make-type-result-ok :types (list (type-boolean))
                             :obligations (append arg-obligs obligs)))))

    Theorem: type-resultp-of-check-not-expression

    (defthm type-resultp-of-check-not-expression
      (b*
        ((result
              (check-not-expression arg arg-type arg-obligs expr ctxt)))
        (type-resultp result))
      :rule-classes :rewrite)

    Theorem: check-not-expression-of-expression-fix-arg

    (defthm check-not-expression-of-expression-fix-arg
      (equal (check-not-expression (expression-fix arg)
                                   arg-type arg-obligs expr ctxt)
             (check-not-expression arg arg-type arg-obligs expr ctxt)))

    Theorem: check-not-expression-expression-equiv-congruence-on-arg

    (defthm check-not-expression-expression-equiv-congruence-on-arg
     (implies
         (expression-equiv arg arg-equiv)
         (equal (check-not-expression arg arg-type arg-obligs expr ctxt)
                (check-not-expression arg-equiv
                                      arg-type arg-obligs expr ctxt)))
     :rule-classes :congruence)

    Theorem: check-not-expression-of-type-fix-arg-type

    (defthm check-not-expression-of-type-fix-arg-type
      (equal (check-not-expression arg (type-fix arg-type)
                                   arg-obligs expr ctxt)
             (check-not-expression arg arg-type arg-obligs expr ctxt)))

    Theorem: check-not-expression-type-equiv-congruence-on-arg-type

    (defthm check-not-expression-type-equiv-congruence-on-arg-type
     (implies
       (type-equiv arg-type arg-type-equiv)
       (equal
            (check-not-expression arg arg-type arg-obligs expr ctxt)
            (check-not-expression arg
                                  arg-type-equiv arg-obligs expr ctxt)))
     :rule-classes :congruence)

    Theorem: check-not-expression-of-proof-obligation-list-fix-arg-obligs

    (defthm check-not-expression-of-proof-obligation-list-fix-arg-obligs
     (equal (check-not-expression arg arg-type
                                  (proof-obligation-list-fix arg-obligs)
                                  expr ctxt)
            (check-not-expression arg arg-type arg-obligs expr ctxt)))

    Theorem: check-not-expression-proof-obligation-list-equiv-congruence-on-arg-obligs

    (defthm
     check-not-expression-proof-obligation-list-equiv-congruence-on-arg-obligs
     (implies
       (proof-obligation-list-equiv arg-obligs arg-obligs-equiv)
       (equal
            (check-not-expression arg arg-type arg-obligs expr ctxt)
            (check-not-expression arg
                                  arg-type arg-obligs-equiv expr ctxt)))
     :rule-classes :congruence)

    Theorem: check-not-expression-of-expression-fix-expr

    (defthm check-not-expression-of-expression-fix-expr
      (equal (check-not-expression arg arg-type
                                   arg-obligs (expression-fix expr)
                                   ctxt)
             (check-not-expression arg arg-type arg-obligs expr ctxt)))

    Theorem: check-not-expression-expression-equiv-congruence-on-expr

    (defthm check-not-expression-expression-equiv-congruence-on-expr
     (implies
       (expression-equiv expr expr-equiv)
       (equal
            (check-not-expression arg arg-type arg-obligs expr ctxt)
            (check-not-expression arg
                                  arg-type arg-obligs expr-equiv ctxt)))
     :rule-classes :congruence)

    Theorem: check-not-expression-of-context-fix-ctxt

    (defthm check-not-expression-of-context-fix-ctxt
      (equal (check-not-expression arg arg-type
                                   arg-obligs expr (context-fix ctxt))
             (check-not-expression arg arg-type arg-obligs expr ctxt)))

    Theorem: check-not-expression-context-equiv-congruence-on-ctxt

    (defthm check-not-expression-context-equiv-congruence-on-ctxt
     (implies
       (context-equiv ctxt ctxt-equiv)
       (equal
            (check-not-expression arg arg-type arg-obligs expr ctxt)
            (check-not-expression arg
                                  arg-type arg-obligs expr ctxt-equiv)))
     :rule-classes :congruence)