• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • Proof-automation
    • ACL2
    • Macro-libraries
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • Soft
        • C
          • Syntax-for-tools
            • Disambiguator
            • Abstract-syntax
            • Parser
            • Validator
            • Printer
            • Formalized-subset
            • Mapping-to-language-definition
            • Input-files
            • Defpred
            • Output-files
            • Abstract-syntax-operations
              • Abstract-syntax-irrelevants
              • Expr-priority
              • Expr-priority-<=
              • Combine-dirabsdeclor-into-dirabsdeclor
              • Check-decl-spec-list-all-typespec/stoclass
              • Binop-expected-priorities
              • Expr->priority
              • Transunit-at-path
              • Check-expr-binary
              • Apply-pre-inc/dec-ops
              • Apply-post-inc/dec-ops
              • Check-spec/qual-list-all-typespec
              • Check-decl-spec-list-all-typespec
              • Check-expr-mul
              • Type-spec-list-signed-long-long-int-p
              • Expr-unary/postfix/primary-p
              • Expr-to-asg-expr-list
              • Transunit-ensemble-paths
              • Type-spec-list-signed-short-int-p
              • Type-spec-list-signed-long-long-p
              • Type-spec-list-signed-long-int-p
              • Expr-postfix/primary-p
              • Dirabsdeclor-declor?-nil-p
              • Check-strunispec-no-members
              • Type-spec-list-signed-short-p
              • Type-spec-list-signed-long-p
              • Type-spec-list-signed-int128-p
              • Type-spec-list-signed-char-p
              • Expr-zerop
              • Type-spec-list-unsigned-long-long-int-p
              • Type-spec-list-signed-int-p
              • Spec/qual-list-to-type-spec-list
              • Expr-priority->=
              • Expr-priority->
              • Expr-priority-<
              • Decl-spec-list-to-type-spec-list
              • Decl-spec-list-to-stor-spec-list
              • Check-enumspec-no-list
              • Type-spec-list-unsigned-short-int-p
              • Type-spec-list-unsigned-long-long-p
              • Type-spec-list-long-double-complex-p
              • Stor-spec-list-static-threadloc-p
              • Stor-spec-list-extern-threadloc-p
              • Binop->priority
              • Type-spec-list-unsigned-short-p
              • Type-spec-list-unsigned-long-int-p
              • Type-spec-list-unsigned-int128-p
              • Type-spec-list-signed-p
              • Type-spec-list-long-long-int-p
              • Type-spec-list-double-complex-p
              • Type-spec-list-unsigned-long-p
              • Type-spec-list-unsigned-int-p
              • Type-spec-list-unsigned-char-p
              • Type-spec-list-long-double-p
              • Type-spec-list-float-complex-p
              • Type-spec-list-short-int-p
              • Type-spec-list-long-long-p
              • Type-spec-list-long-int-p
              • Stringlit-list->prefix?-list
              • Stor-spec-list-typedef-p
              • Stor-spec-list-threadloc-p
              • Stor-spec-list-static-p
              • Stor-spec-list-register-p
              • Stor-spec-list-extern-p
              • Type-spec-list-unsigned-p
              • Type-spec-list-short-p
              • Type-spec-list-long-p
              • Type-spec-list-int128-p
              • Type-spec-list-float-p
              • Type-spec-list-double-p
              • Type-spec-list-char-p
              • Stor-spec-list-auto-p
              • Check-expr-iconst
                • Type-spec-list-int-p
                • Check-expr-ident
                • Declor->ident
                • Type-spec-list-permp
                • Initdeclor->ident
              • Validation-information
              • Implementation-environments
              • Concrete-syntax
              • Ascii-identifiers
              • Unambiguity
              • Preprocessing
              • Abstraction-mapping
            • Atc
            • Language
            • Representation
            • Transformation-tools
            • Insertion-sort
            • Pack
          • Bv
          • Imp-language
          • Event-macros
          • Java
          • Bitcoin
          • Ethereum
          • Yul
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Abstract-syntax-operations

    Check-expr-iconst

    Check if an expression is an integer constant, returning the integer constant if the check passes.

    Signature
    (check-expr-iconst expr) → iconst?
    Arguments
    expr — Guard (exprp expr).
    Returns
    iconst? — Type (iconst-optionp iconst?).

    Definitions and Theorems

    Function: check-expr-iconst

    (defun check-expr-iconst (expr)
      (declare (xargs :guard (exprp expr)))
      (let ((__function__ 'check-expr-iconst))
        (declare (ignorable __function__))
        (b* (((unless (expr-case expr :const)) nil)
             (const (expr-const->const expr))
             ((unless (const-case const :int)))
             (iconst (const-int->unwrap const)))
          iconst)))

    Theorem: iconst-optionp-of-check-expr-iconst

    (defthm iconst-optionp-of-check-expr-iconst
      (b* ((iconst? (check-expr-iconst expr)))
        (iconst-optionp iconst?))
      :rule-classes :rewrite)

    Theorem: check-expr-iconst-of-expr-fix-expr

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

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

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