• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
        • Proof-support
        • Abstract-syntax
          • Syntax-abstraction
          • Expression
            • Expression-fix
            • Expression-case
            • Expressionp
              • Expression-count
              • Expression-equiv
              • Expression-mul
              • Expression-add
              • Expression-var
              • Expression-const
              • Expression-kind
            • Definition
            • Constraint
            • Definition-option
            • Abstract-syntax-operations
            • System
            • Convenience-constructors
            • System-result
            • Expression-result
            • Expression-list-result
            • Definition-result
            • Definition-list-result
            • Constraint-result
            • Constraint-list-result
            • Expression-list
            • Definition-list
            • Constraint-list
          • R1cs-subset
          • Semantics
          • Abstract-syntax-operations
          • Indexed-names
          • Well-formedness
          • Concrete-syntax
          • R1cs-bridge
          • Parser-interface
        • Legacy-defrstobj
        • Proof-checker-array
        • Soft
        • C
        • 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
    • Expression

    Expressionp

    Recognizer for expression structures.

    Signature
    (expressionp x) → *

    Definitions and Theorems

    Function: expressionp

    (defun expressionp (x)
      (declare (xargs :guard t))
      (let ((__function__ 'expressionp))
        (declare (ignorable __function__))
        (and (consp x)
             (cond ((or (atom x) (eq (car x) :const))
                    (and (true-listp (cdr x))
                         (eql (len (cdr x)) 1)
                         (b* ((value (std::da-nth 0 (cdr x))))
                           (integerp value))))
                   ((eq (car x) :var)
                    (and (true-listp (cdr x))
                         (eql (len (cdr x)) 1)
                         (b* ((name (std::da-nth 0 (cdr x))))
                           (stringp name))))
                   ((eq (car x) :add)
                    (and (true-listp (cdr x))
                         (eql (len (cdr x)) 2)
                         (b* ((arg1 (std::da-nth 0 (cdr x)))
                              (arg2 (std::da-nth 1 (cdr x))))
                           (and (expressionp arg1)
                                (expressionp arg2)))))
                   (t (and (eq (car x) :mul)
                           (and (true-listp (cdr x))
                                (eql (len (cdr x)) 2))
                           (b* ((arg1 (std::da-nth 0 (cdr x)))
                                (arg2 (std::da-nth 1 (cdr x))))
                             (and (expressionp arg1)
                                  (expressionp arg2)))))))))

    Theorem: consp-when-expressionp

    (defthm consp-when-expressionp
      (implies (expressionp x) (consp x))
      :rule-classes :compound-recognizer)