• 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
          • Syntax-for-tools
            • Formalized-subset
            • Mapping-to-language-definition
            • Input-files
            • Compilation-database
            • Printer
            • Output-files
            • Abstract-syntax-operations
              • Expr-priority
              • Expr-priority-<=
              • Combine-dirabsdeclor-into-dirabsdeclor
              • Declor/dirdeclor-rename
              • Check-decl-spec-list-all-typespec/stoclass
              • Binop-expected-priorities
              • Expr->priority
              • Transunit-at-path
              • Declor/dirdeclor->ident
              • Declor/dirdeclor-has-params-p
              • Check-expr-binary
              • Apply-post-inc/dec-ops
              • Check-spec/qual-list-all-typespec
              • Apply-pre-inc/dec-ops
              • Check-decl-spec-list-all-typespec
              • Expr-to-asg-expr-list
              • Check-expr-mul
                • Expr-unary/postfix/primary-p
                • Transunit-ensemble-paths
                • Check-struni-spec-no-members
                • Expr-postfix/primary-p
                • Dirabsdeclor-declor?-nil-p
                • Check-enum-spec-no-list
                • Expr-zerop
                • Expr-priority->=
                • Decl-spec-list-to-stor-spec-list
                • Spec/qual-list-to-type-spec-list
                • Expr-priority->
                • Expr-priority-<
                • Declor-spec-list-filter-out-linkage-specs
                • Decl-spec-list-to-type-spec-list
                • Ident-list-map-expr-ident
                • Binop->priority
                • Stringlit-list->prefix?-list
                • Declor-spec-list-make-static
                • Binop-strictp
                • Check-expr-iconst
                • Initdeclor->ident
                • Check-expr-ident
                • Dirabsdeclor-to-dirdeclor
                • Dirabsdeclor-option-to-dirdeclor
                • Dirdeclor-has-params-p
                • Absdeclor-to-declor
                • Dirdeclor-rename
                • Declor-rename
                • Declor-has-params-p
                • Dirdeclor->ident
                • Declor->ident
              • Implementation-environments
              • Abstract-syntax
              • Concrete-syntax
              • Disambiguation
              • Validation
              • Gcc-builtins
              • Preprocessing
              • Parsing
            • Atc
            • Transformation-tools
            • Language
            • Representation
            • Insertion-sort
            • Pack
          • Soft
          • Bv
          • Imp-language
          • Ethereum
          • Event-macros
          • Java
          • Riscv
          • Bitcoin
          • Zcash
          • Yul
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Axe
          • Lists-light
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Abstract-syntax-operations

    Check-expr-mul

    Check if an expression is a multiplication.

    Signature
    (check-expr-mul expr) → (mv yes/no arg1 arg2)
    Arguments
    expr — Guard (exprp expr).
    Returns
    yes/no — Type (booleanp yes/no).
    arg1 — Type (exprp arg1).
    arg2 — Type (exprp arg2).

    If it is, return its two sub-expressions.

    Definitions and Theorems

    Function: check-expr-mul

    (defun check-expr-mul (expr)
      (declare (xargs :guard (exprp expr)))
      (if (and (expr-case expr :binary)
               (binop-case (expr-binary->op expr)
                           :mul))
          (mv t (expr-binary->arg1 expr)
              (expr-binary->arg2 expr))
        (mv nil (irr-expr) (irr-expr))))

    Theorem: booleanp-of-check-expr-mul.yes/no

    (defthm booleanp-of-check-expr-mul.yes/no
      (b* (((mv ?yes/no ?arg1 ?arg2)
            (check-expr-mul expr)))
        (booleanp yes/no))
      :rule-classes :rewrite)

    Theorem: exprp-of-check-expr-mul.arg1

    (defthm exprp-of-check-expr-mul.arg1
      (b* (((mv ?yes/no ?arg1 ?arg2)
            (check-expr-mul expr)))
        (exprp arg1))
      :rule-classes :rewrite)

    Theorem: exprp-of-check-expr-mul.arg2

    (defthm exprp-of-check-expr-mul.arg2
      (b* (((mv ?yes/no ?arg1 ?arg2)
            (check-expr-mul expr)))
        (exprp arg2))
      :rule-classes :rewrite)

    Theorem: expr-count-of-check-expr-mul-arg1

    (defthm expr-count-of-check-expr-mul-arg1
      (b* (((mv ?yes/no ?arg1 ?arg2)
            (check-expr-mul expr)))
        (implies yes/no
                 (< (expr-count arg1)
                    (expr-count expr))))
      :rule-classes :linear)

    Theorem: expr-count-of-check-expr-mul-arg2

    (defthm expr-count-of-check-expr-mul-arg2
      (b* (((mv ?yes/no ?arg1 ?arg2)
            (check-expr-mul expr)))
        (implies yes/no
                 (< (expr-count arg2)
                    (expr-count expr))))
      :rule-classes :linear)

    Theorem: check-expr-mul-of-expr-fix-expr

    (defthm check-expr-mul-of-expr-fix-expr
      (equal (check-expr-mul (expr-fix expr))
             (check-expr-mul expr)))

    Theorem: check-expr-mul-expr-equiv-congruence-on-expr

    (defthm check-expr-mul-expr-equiv-congruence-on-expr
      (implies (expr-equiv expr expr-equiv)
               (equal (check-expr-mul expr)
                      (check-expr-mul expr-equiv)))
      :rule-classes :congruence)