• 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
                • Expression
                  • Expressionp
                  • Expression-case
                  • Expression-equiv
                  • Expression-static-call
                  • Expression-binary
                  • Expression-cond
                  • Expression-assoc-const
                  • Expression-struct-component
                  • Expression-struct
                  • Expression-kind
                    • Expression-unary
                    • Expression-tuple-component
                    • Expression-internal-call
                    • Expression-external-call
                    • Expression-var/const
                    • Expression-tuple
                    • Expression-literal
                    • Expression-unit
                    • Expression-fix
                    • Expression-count
                  • Syntax-abstraction
                  • Statement
                  • Files
                  • Input-files
                  • Identifiers
                  • Types
                  • Struct-init
                  • Branch
                  • Statements
                  • Format-strings
                  • Input-syntax-abstraction
                  • Expressions
                  • Output-files
                  • Addresses
                  • Literals
                  • Characters
                  • Expression-list
                  • Statement-list
                  • Output-syntax-abstraction
                  • Struct-init-list
                  • Branch-list
                  • Annotations
                  • Abstract-syntax-trees
                  • Symbols
                  • Keywords
                  • Programs
                  • Packages
                  • Bit-sizes
                • Dynamic-semantics
                • 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
    • 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) :var/const) :var/const)
                          ((eq (car x) :assoc-const) :assoc-const)
                          ((eq (car x) :unary) :unary)
                          ((eq (car x) :binary) :binary)
                          ((eq (car x) :cond) :cond)
                          ((eq (car x) :unit) :unit)
                          ((eq (car x) :tuple) :tuple)
                          ((eq (car x) :tuple-component)
                           :tuple-component)
                          ((eq (car x) :struct) :struct)
                          ((eq (car x) :struct-component)
                           :struct-component)
                          ((eq (car x) :internal-call)
                           :internal-call)
                          ((eq (car x) :external-call)
                           :external-call)
                          (t :static-call))
             :exec (car x))))

    Theorem: expression-kind-possibilities

    (defthm expression-kind-possibilities
      (or (equal (expression-kind x) :literal)
          (equal (expression-kind x) :var/const)
          (equal (expression-kind x) :assoc-const)
          (equal (expression-kind x) :unary)
          (equal (expression-kind x) :binary)
          (equal (expression-kind x) :cond)
          (equal (expression-kind x) :unit)
          (equal (expression-kind x) :tuple)
          (equal (expression-kind x)
                 :tuple-component)
          (equal (expression-kind x) :struct)
          (equal (expression-kind x)
                 :struct-component)
          (equal (expression-kind x)
                 :internal-call)
          (equal (expression-kind x)
                 :external-call)
          (equal (expression-kind x)
                 :static-call))
      :rule-classes
      ((:forward-chaining :trigger-terms ((expression-kind x)))))