• 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

    Binop-expected-priorities

    Expected expression priorities of the operands of the binary operators.

    Signature
    (binop-expected-priorities op) → (mv left-prio right-prio)
    Arguments
    op — Guard (binopp op).
    Returns
    left-prio — Type (expr-priorityp left-prio).
    right-prio — Type (expr-priorityp right-prio).

    These are straightforwardly based on the grammar rules.

    Definitions and Theorems

    Function: binop-expected-priorities

    (defun binop-expected-priorities (op)
      (declare (xargs :guard (binopp op)))
      (binop-case op
                  :mul (mv (expr-priority-mul)
                           (expr-priority-cast))
                  :div (mv (expr-priority-mul)
                           (expr-priority-cast))
                  :rem (mv (expr-priority-mul)
                           (expr-priority-cast))
                  :add (mv (expr-priority-add)
                           (expr-priority-mul))
                  :sub (mv (expr-priority-add)
                           (expr-priority-mul))
                  :shl (mv (expr-priority-sh)
                           (expr-priority-add))
                  :shr (mv (expr-priority-sh)
                           (expr-priority-add))
                  :lt (mv (expr-priority-rel)
                          (expr-priority-sh))
                  :gt (mv (expr-priority-rel)
                          (expr-priority-sh))
                  :le (mv (expr-priority-rel)
                          (expr-priority-sh))
                  :ge (mv (expr-priority-rel)
                          (expr-priority-sh))
                  :eq (mv (expr-priority-eq)
                          (expr-priority-rel))
                  :ne (mv (expr-priority-eq)
                          (expr-priority-rel))
                  :bitand (mv (expr-priority-and)
                              (expr-priority-eq))
                  :bitxor (mv (expr-priority-xor)
                              (expr-priority-and))
                  :bitior (mv (expr-priority-ior)
                              (expr-priority-xor))
                  :logand (mv (expr-priority-logand)
                              (expr-priority-ior))
                  :logor (mv (expr-priority-logor)
                             (expr-priority-logand))
                  :asg (mv (expr-priority-unary)
                           (expr-priority-asg))
                  :asg-mul (mv (expr-priority-unary)
                               (expr-priority-asg))
                  :asg-div (mv (expr-priority-unary)
                               (expr-priority-asg))
                  :asg-rem (mv (expr-priority-unary)
                               (expr-priority-asg))
                  :asg-add (mv (expr-priority-unary)
                               (expr-priority-asg))
                  :asg-sub (mv (expr-priority-unary)
                               (expr-priority-asg))
                  :asg-shl (mv (expr-priority-unary)
                               (expr-priority-asg))
                  :asg-shr (mv (expr-priority-unary)
                               (expr-priority-asg))
                  :asg-and (mv (expr-priority-unary)
                               (expr-priority-asg))
                  :asg-xor (mv (expr-priority-unary)
                               (expr-priority-asg))
                  :asg-ior (mv (expr-priority-unary)
                               (expr-priority-asg))))

    Theorem: expr-priorityp-of-binop-expected-priorities.left-prio

    (defthm expr-priorityp-of-binop-expected-priorities.left-prio
      (b* (((mv ?left-prio ?right-prio)
            (binop-expected-priorities op)))
        (expr-priorityp left-prio))
      :rule-classes :rewrite)

    Theorem: expr-priorityp-of-binop-expected-priorities.right-prio

    (defthm expr-priorityp-of-binop-expected-priorities.right-prio
      (b* (((mv ?left-prio ?right-prio)
            (binop-expected-priorities op)))
        (expr-priorityp right-prio))
      :rule-classes :rewrite)

    Theorem: binop-expected-priorities-of-binop-fix-op

    (defthm binop-expected-priorities-of-binop-fix-op
      (equal (binop-expected-priorities (binop-fix op))
             (binop-expected-priorities op)))

    Theorem: binop-expected-priorities-binop-equiv-congruence-on-op

    (defthm binop-expected-priorities-binop-equiv-congruence-on-op
      (implies (binop-equiv op op-equiv)
               (equal (binop-expected-priorities op)
                      (binop-expected-priorities op-equiv)))
      :rule-classes :congruence)