• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • 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
        • C
        • Soft
        • Bv
        • Imp-language
        • Ethereum
        • Event-macros
        • Java
        • Riscv
        • Bitcoin
        • Zcash
        • Yul
        • ACL2-programming-language
        • Prime-fields
        • Json
        • Syntheto
          • Process-syntheto-toplevel-fn
          • Translation
          • Language
            • Static-semantics
            • Abstract-syntax
              • Expression
                • Expressionp
                • Expression-case
                • Expression-sum-field
                • Expression-sum-update
                • Expression-equiv
                • Expression-kind
                  • Expression-product-field
                  • Expression-when
                  • Expression-unless
                  • Expression-sum-test
                  • Expression-sum-construct
                  • Expression-product-update
                  • Expression-if
                  • Expression-call
                  • Expression-bind
                  • Expression-binary
                  • Expression-product-construct
                  • Expression-unary
                  • Expression-component
                  • Expression-variable
                  • Expression-multi
                  • Expression-literal
                  • Expression-cond
                  • Expression-bad-expression
                  • Expression-fix
                  • Expression-count
                • Expression-sum-field-list
                • Type
                • Binary-op
                • Expression-product-field-list
                • Abstract-syntax-operations
                • Function-definition-list->header-list
                • Type-definition-list->name-list
                • Initializer-list->value-list
                • Function-header-list->name-list
                • Typed-variable-list->type-list
                • Typed-variable-list->name-list
                • Branch-list->condition-list
                • Alternative-list->name-list
                • Function-specifier
                • Expression-variable-list
                • Type-subset
                • Field-list->type-list
                • Field-list->name-list
                • Function-specification
                • Identifier
                • Toplevel
                • Function-definer
                • Function-header
                • Type-definer
                • Literal
                • Type-product
                • Function-definition
                • Type-sum
                • Maybe-expression
                • Transform-argument-value
                • Transform
                • Theorem
                • Quantifier
                • Maybe-function-specification
                • Maybe-typed-variable
                • Maybe-type-definition
                • Maybe-function-header
                • Maybe-function-definition
                • Maybe-type-sum
                • Maybe-type-subset
                • Maybe-type-product
                • Maybe-type-definer
                • Maybe-theorem
                • Maybe-type
                • Initializer
                • Type-definition
                • Alternative
                • Unary-op
                • Typed-variable
                • Branch
                • Field
                • Transform-argument
                • Type-recursion
                • Program
                • Function-recursion
                • Typed-variable-list
                • Toplevel-name
                • Toplevel-list
                • Initializer-list
                • Expression-fixtypes
                  • Expression
                    • Expressionp
                    • Expression-case
                    • Expression-sum-field
                    • Expression-sum-update
                    • Expression-equiv
                    • Expression-kind
                      • Expression-product-field
                      • Expression-when
                      • Expression-unless
                      • Expression-sum-test
                      • Expression-sum-construct
                      • Expression-product-update
                      • Expression-if
                      • Expression-call
                      • Expression-bind
                      • Expression-binary
                      • Expression-product-construct
                      • Expression-unary
                      • Expression-component
                      • Expression-variable
                      • Expression-multi
                      • Expression-literal
                      • Expression-cond
                      • Expression-bad-expression
                      • Expression-fix
                      • Expression-count
                    • Initializer
                    • Branch
                    • Initializer-list
                    • Expression-list
                    • Branch-list
                  • Toplevel-fn-names
                  • Lookup-transform-argument
                  • Function-definition-names
                  • Type-definition-list
                  • Transform-argument-list
                  • Function-header-list
                  • Function-definition-list
                  • Alternative-list
                  • Type-list
                  • Identifier-set
                  • Identifier-list
                  • Field-list
                  • Expression-list
                  • Branch-list
                  • Extract-default-param-alist
                  • Create-arg-defaults-table
                • Outcome
                • Abstract-syntax-operations
                • Outcome-list
                • Outcomes
              • Process-syntheto-toplevel
              • Shallow-embedding
            • File-io-light
            • Cryptography
            • Number-theory
            • Axe
            • Lists-light
            • Builtins
            • Solidity
            • Helpers
            • Htclient
            • Typed-lists-light
            • Arithmetic-light
          • X86isa
          • Axe
          • Execloader
        • Math
        • Testing-utilities
      • Expression

      Expression-kind

      Get the kind (tag) of a expression structure.

      Signature
      (expression-kind x) → kind
      Arguments
      x — Guard (expressionp x).

      Definitions and Theorems

      Function: expression-kind$inline

      (defun expression-kind$inline (x)
        (declare (xargs :guard (expressionp x)))
        (let ((__function__ 'expression-kind))
          (declare (ignorable __function__))
          (mbe :logic (cond ((or (atom x) (eq (car x) :literal))
                             :literal)
                            ((eq (car x) :variable) :variable)
                            ((eq (car x) :unary) :unary)
                            ((eq (car x) :binary) :binary)
                            ((eq (car x) :if) :if)
                            ((eq (car x) :when) :when)
                            ((eq (car x) :unless) :unless)
                            ((eq (car x) :cond) :cond)
                            ((eq (car x) :call) :call)
                            ((eq (car x) :multi) :multi)
                            ((eq (car x) :component) :component)
                            ((eq (car x) :bind) :bind)
                            ((eq (car x) :product-construct)
                             :product-construct)
                            ((eq (car x) :product-field)
                             :product-field)
                            ((eq (car x) :product-update)
                             :product-update)
                            ((eq (car x) :sum-construct)
                             :sum-construct)
                            ((eq (car x) :sum-field) :sum-field)
                            ((eq (car x) :sum-update) :sum-update)
                            ((eq (car x) :sum-test) :sum-test)
                            (t :bad-expression))
               :exec (car x))))

      Theorem: expression-kind-possibilities

      (defthm expression-kind-possibilities
        (or (equal (expression-kind x) :literal)
            (equal (expression-kind x) :variable)
            (equal (expression-kind x) :unary)
            (equal (expression-kind x) :binary)
            (equal (expression-kind x) :if)
            (equal (expression-kind x) :when)
            (equal (expression-kind x) :unless)
            (equal (expression-kind x) :cond)
            (equal (expression-kind x) :call)
            (equal (expression-kind x) :multi)
            (equal (expression-kind x) :component)
            (equal (expression-kind x) :bind)
            (equal (expression-kind x)
                   :product-construct)
            (equal (expression-kind x)
                   :product-field)
            (equal (expression-kind x)
                   :product-update)
            (equal (expression-kind x)
                   :sum-construct)
            (equal (expression-kind x) :sum-field)
            (equal (expression-kind x) :sum-update)
            (equal (expression-kind x) :sum-test)
            (equal (expression-kind x)
                   :bad-expression))
        :rule-classes
        ((:forward-chaining :trigger-terms ((expression-kind x)))))