• 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
            • Abs-*-decimal-digit-to-nat
            • Abs-?-expression-*-comma-expression
            • Abs-?-constraint-*-comma-constraint
            • Abs-*-letter/decimaldigit/underscore
            • Abs-letter/decimaldigit/underscore
            • Abs-?-identifier-*-comma-identifier
            • Abs-*-comma-constraint
            • Abs-definition
            • Abs-*-comma-identifier
            • Abs-*-comma-expression
            • Abs-decimal-digit-to-nat
            • Abs-*-definition
            • Abs-*-constraint
            • Abs-relation-constraint
            • Abs-decimal-digit-to-char
            • Abs-uppercase-letter
            • Abs-lowercase-letter
            • Abs-equality-constraint
            • Check-optional-minus-sign-p
            • Abs-letter
            • Abs-comma-expression
            • Abs-comma-constraint
            • Abs-integer
              • Abs-constraint
              • Abs-comma-identifier
              • Check-?-comma
              • Abs-identifier
              • Abs-system
              • Abs-numeral
              • Abs-primary-expression
              • Abs-multiplication-expression
              • Abs-addition-expression
              • Abs-expression
            • Expression
            • 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
    • Syntax-abstraction

    Abs-integer

    Abstract an integer to an ACL2 int.

    Signature
    (abs-integer tree) → int
    Arguments
    tree — Guard (abnf::treep tree).
    Returns
    int — Type (integer-resultp int).

    Definitions and Theorems

    Function: abs-integer

    (defun abs-integer (tree)
      (declare (xargs :guard (abnf::treep tree)))
      (let ((__function__ 'abs-integer))
        (declare (ignorable __function__))
        (b* (((okf (abnf::tree-list-tuple2 sub))
              (abnf::check-tree-nonleaf-2 tree "integer"))
             ((okf optional-minus-tree)
              (abnf::check-tree-list-1 sub.1st))
             ((okf has-minus-sign?)
              (check-optional-minus-sign-p optional-minus-tree))
             ((okf numeral-tree)
              (abnf::check-tree-list-1 sub.2nd))
             ((okf nat-value)
              (abs-numeral numeral-tree)))
          (if has-minus-sign? (- nat-value)
            nat-value))))

    Theorem: integer-resultp-of-abs-integer

    (defthm integer-resultp-of-abs-integer
      (b* ((int (abs-integer tree)))
        (integer-resultp int))
      :rule-classes :rewrite)

    Theorem: abs-integer-of-tree-fix-tree

    (defthm abs-integer-of-tree-fix-tree
      (equal (abs-integer (abnf::tree-fix tree))
             (abs-integer tree)))

    Theorem: abs-integer-tree-equiv-congruence-on-tree

    (defthm abs-integer-tree-equiv-congruence-on-tree
      (implies (abnf::tree-equiv tree tree-equiv)
               (equal (abs-integer tree)
                      (abs-integer tree-equiv)))
      :rule-classes :congruence)