• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • C
        • Syntax-for-tools
          • Formalized-subset
          • Mapping-to-language-definition
          • Input-files
          • Compilation-database
          • Printer
          • Output-files
          • Abstract-syntax-operations
          • Implementation-environments
          • Abstract-syntax
          • Concrete-syntax
          • Disambiguation
            • Disambiguator
              • Dimb-exprs/decls/stmts
              • Dimb-make/adjust-expr-cast
              • Dimb-make/adjust-expr-binary
              • Dimb-params-to-names
              • Dimb-fundef
              • Dimb-cast/call-to-call
              • Dimb-transunit
              • Dimb-dirdeclor
              • Dimb-transunit-ensemble
              • Dimb-make/adjust-expr-unary
              • Dimb-expr
              • Dimb-amb-declor/absdeclor
              • Dimb-cast/call-to-cast
              • Dimb-cast/addsub-to-cast
              • Dimb-cast/addsub-to-addsub
                • Dimb-add-ident
                • Dimb-kind
                • Dimb-amb-expr/tyname
                • Dimb-ext-declon-list
                • Dimb-ext-declon
                • Dimb-cast/logand-to-logand
                • Dimb-cast/and-to-cast
                • Dimb-cast/mul-to-cast
                • Dimb-cast/logand-to-cast
                • Dimb-cast/mul-to-mul
                • Dimb-cast/and-to-and
                • Dimb-declor
                • Dimb-kind-option
                • Dimb-type-spec
                • Dimb-add-ident-objfun-file-scope
                • Dimb-make/adjust-expr-label-addr
                • Dimb-param-declor
                • Dimb-lookup-ident
                • Dimb-decl-spec
                • Dimb-add-idents-objfun
                • Dimb-add-ident-objfun
                • Dimb-param-declon
                • Dimb-amb-declon/stmt
                • Dimb-table
                • Dimb-pop-scope
                • Dimb-init-declor
                • Dimb-stmt
                • Dimb-push-scope
                • Dimb-comp-stmt
                • Dimb-declor-option
                • Dimb-enum-spec
                • Dimb-declon
                • Dimb-struct-declor
                • Dimb-scope
                • Dimb-init-declor-list
                • Dimb-decl-spec-list
                • Dimb-absdeclor
                • Dimb-dirabsdeclor
                • Dimb-align-spec
                • Dimb-struni-spec
                • Dimb-init-table
                • Dimb-spec/qual-list
                • Dimb-spec/qual
                • Irr-dimb-table
                • Irr-dimb-kind
                • Dimb-param-declon-list
                • Dimb-enumer-list
                • Dimb-enumer
                • Dimb-dirabsdeclor-option
                • Dimb-block-item
                • Dimb-struct-declor-list
                • Dimb-struct-declon-list
                • Dimb-struct-declon
                • Dimb-statassert
                • Dimb-label
                • Dimb-desiniter-list
                • Dimb-desiniter
                • Dimb-declon-list
                • Dimb-const-expr-option
                • Dimb-absdeclor-option
                • Dimb-member-designor
                • Dimb-initer-option
                • Dimb-genassoc-list
                • Dimb-genassoc
                • Dimb-expr-option
                • Dimb-expr-list
                • Dimb-designor-list
                • Dimb-designor
                • Dimb-const-expr
                • Dimb-block-item-list
                • Dimb-tyname
                • Dimb-initer
              • Unambiguity
            • Validation
            • Gcc-builtins
            • Preprocessing
            • Parsing
          • Atc
          • Transformation-tools
          • Language
          • Representation
          • Insertion-sort
          • Pack
        • Proof-checker-array
        • Soft
        • Farray
        • Rp-rewriter
        • Instant-runoff-voting
        • Imp-language
        • Sidekick
        • Ethereum
        • Leftist-trees
        • Java
        • Riscv
        • Taspi
        • Bitcoin
        • Zcash
        • Des
        • X86isa
        • Sha-2
        • Yul
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Axe
        • Poseidon
        • Where-do-i-place-my-book
        • Aleo
        • 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
    • Disambiguator

    Dimb-cast/addsub-to-addsub

    Disambiguate an ambiguous cast or addition/subtraction expression to be an addition or subtraction expression.

    Signature
    (dimb-cast/addsub-to-addsub arg1 inc/dec arg2 add/sub) → expr
    Arguments
    arg1 — Guard (exprp arg1).
    inc/dec — Guard (inc/dec-op-listp inc/dec).
    arg2 — Guard (exprp arg2).
    add/sub — Guard (binopp add/sub).
    Returns
    expr — Type (exprp expr).

    This is analogous in purpose to dimb-cast/call-to-call, but for a different kind of ambiguous expression, actually two kinds, which are very similar and thus handled together; the two kinds are selected by the binary operator passed as input. Note that the + or -, which is binary in this disambiguation, is implicit in the abstract syntax of the ambiguous expression.

    Definitions and Theorems

    Function: dimb-cast/addsub-to-addsub

    (defun dimb-cast/addsub-to-addsub (arg1 inc/dec arg2 add/sub)
      (declare (xargs :guard (and (exprp arg1)
                                  (inc/dec-op-listp inc/dec)
                                  (exprp arg2)
                                  (binopp add/sub))))
      (declare (xargs :guard (and (expr-unambp arg1)
                                  (expr-unambp arg2)
                                  (or (binop-case add/sub :add)
                                      (binop-case add/sub :sub)))))
      (let ((__function__ 'dimb-cast/addsub-to-addsub))
        (declare (ignorable __function__))
        (dimb-make/adjust-expr-binary
             add/sub
             (apply-post-inc/dec-ops arg1 inc/dec)
             arg2)))

    Theorem: exprp-of-dimb-cast/addsub-to-addsub

    (defthm exprp-of-dimb-cast/addsub-to-addsub
     (b* ((expr (dimb-cast/addsub-to-addsub arg1 inc/dec arg2 add/sub)))
       (exprp expr))
     :rule-classes :rewrite)

    Theorem: expr-unambp-of-dimb-cast/addsub-to-addsub

    (defthm expr-unambp-of-dimb-cast/addsub-to-addsub
     (implies
       (and (expr-unambp arg1)
            (expr-unambp arg2))
       (b*
        ((?expr (dimb-cast/addsub-to-addsub arg1 inc/dec arg2 add/sub)))
        (expr-unambp expr))))

    Theorem: dimb-cast/addsub-to-addsub-of-expr-fix-arg1

    (defthm dimb-cast/addsub-to-addsub-of-expr-fix-arg1
      (equal (dimb-cast/addsub-to-addsub (expr-fix arg1)
                                         inc/dec arg2 add/sub)
             (dimb-cast/addsub-to-addsub arg1 inc/dec arg2 add/sub)))

    Theorem: dimb-cast/addsub-to-addsub-expr-equiv-congruence-on-arg1

    (defthm dimb-cast/addsub-to-addsub-expr-equiv-congruence-on-arg1
     (implies
      (expr-equiv arg1 arg1-equiv)
      (equal
          (dimb-cast/addsub-to-addsub arg1 inc/dec arg2 add/sub)
          (dimb-cast/addsub-to-addsub arg1-equiv inc/dec arg2 add/sub)))
     :rule-classes :congruence)

    Theorem: dimb-cast/addsub-to-addsub-of-inc/dec-op-list-fix-inc/dec

    (defthm dimb-cast/addsub-to-addsub-of-inc/dec-op-list-fix-inc/dec
     (equal
          (dimb-cast/addsub-to-addsub arg1 (inc/dec-op-list-fix inc/dec)
                                      arg2 add/sub)
          (dimb-cast/addsub-to-addsub arg1 inc/dec arg2 add/sub)))

    Theorem: dimb-cast/addsub-to-addsub-inc/dec-op-list-equiv-congruence-on-inc/dec

    (defthm
     dimb-cast/addsub-to-addsub-inc/dec-op-list-equiv-congruence-on-inc/dec
     (implies
      (inc/dec-op-list-equiv inc/dec inc/dec-equiv)
      (equal
          (dimb-cast/addsub-to-addsub arg1 inc/dec arg2 add/sub)
          (dimb-cast/addsub-to-addsub arg1 inc/dec-equiv arg2 add/sub)))
     :rule-classes :congruence)

    Theorem: dimb-cast/addsub-to-addsub-of-expr-fix-arg2

    (defthm dimb-cast/addsub-to-addsub-of-expr-fix-arg2
      (equal (dimb-cast/addsub-to-addsub arg1 inc/dec (expr-fix arg2)
                                         add/sub)
             (dimb-cast/addsub-to-addsub arg1 inc/dec arg2 add/sub)))

    Theorem: dimb-cast/addsub-to-addsub-expr-equiv-congruence-on-arg2

    (defthm dimb-cast/addsub-to-addsub-expr-equiv-congruence-on-arg2
     (implies
      (expr-equiv arg2 arg2-equiv)
      (equal
          (dimb-cast/addsub-to-addsub arg1 inc/dec arg2 add/sub)
          (dimb-cast/addsub-to-addsub arg1 inc/dec arg2-equiv add/sub)))
     :rule-classes :congruence)

    Theorem: dimb-cast/addsub-to-addsub-of-binop-fix-add/sub

    (defthm dimb-cast/addsub-to-addsub-of-binop-fix-add/sub
     (equal
      (dimb-cast/addsub-to-addsub arg1 inc/dec arg2 (binop-fix add/sub))
      (dimb-cast/addsub-to-addsub arg1 inc/dec arg2 add/sub)))

    Theorem: dimb-cast/addsub-to-addsub-binop-equiv-congruence-on-add/sub

    (defthm dimb-cast/addsub-to-addsub-binop-equiv-congruence-on-add/sub
     (implies
      (binop-equiv add/sub add/sub-equiv)
      (equal
          (dimb-cast/addsub-to-addsub arg1 inc/dec arg2 add/sub)
          (dimb-cast/addsub-to-addsub arg1 inc/dec arg2 add/sub-equiv)))
     :rule-classes :congruence)