• 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
            • Implementation-environments
            • Abstract-syntax
            • Concrete-syntax
            • Disambiguation
            • Validation
              • Validator
                • Valid-exprs/decls/stmts
                • Valid-stmt
                • Valid-expr
                • Valid-dirdeclor
                • Valid-binary
                • Valid-type-spec
                • Valid-transunit
                • Valid-stor-spec-list
                • Valid-prototype-args
                • Valid-fundef
                • Valid-unary
                • Valid-init-declor
                • Valid-stringlit-list
                • Valid-type-spec-list-residual
                • Valid-transunit-ensemble
                • Valid-cond
                • Valid-lookup-ord
                • Valid-c-char
                • Valid-funcall
                • Valid-iconst
                • Valid-add-ord-objfuns-file-scope
                • Valid-initer
                • Valid-declor
                • Valid-add-ord
                • Valid-arrsub
                • Valid-update-ext
                • Valid-ext-declon-list
                • Valid-ext-declon
                  • Valid-univ-char-name
                  • Valid-memberp
                  • Valid-add-ord-file-scope
                  • Valid-var
                  • Valid-s-char
                  • Valid-decl-spec
                  • Valid-cconst
                  • Valid-cast
                  • Valid-sizeof/alignof
                  • Valid-stringlit
                  • Valid-spec/qual
                  • Valid-oct-escape
                  • Valid-get-fresh-uid
                  • Valid-param-declon
                  • Valid-struct-declon
                  • Valid-struct-declor
                  • Valid-has-internalp
                  • Valid-escape
                  • Valid-enum-const
                  • Valid-gensel
                  • Valid-const
                  • Valid-desiniter-list
                  • Valid-designor
                  • Valid-param-declor
                  • Valid-dec/oct/hex-const
                  • Valid-s-char-list
                  • Valid-decl-spec-list
                  • Valid-c-char-list
                  • Valid-member
                  • Valid-init-table
                  • Valid-lookup-ord-file-scope
                  • Valid-comp-stmt
                  • Valid-spec/qual-list
                  • Valid-lookup-ext
                  • Valid-designor-list
                  • Valid-fconst
                  • Valid-block-item
                  • Valid-struct-declor-list
                  • Valid-genassoc-list
                  • Valid-align-spec
                  • Valid-enumer
                  • Valid-declon
                  • Valid-simple-escape
                  • Valid-enum-spec
                  • Valid-dirabsdeclor
                  • Valid-declor-option
                  • Valid-pop-scope
                  • Valid-initer-option
                  • Valid-expr-list
                  • Valid-block-item-list
                  • Valid-absdeclor
                  • Valid-struct-declon-list
                  • Valid-push-scope
                  • Valid-label
                  • Valid-genassoc
                  • Valid-tyname
                  • Valid-struni-spec
                  • Valid-dirabsdeclor-option
                  • Valid-const-expr
                  • Valid-init-declor-list
                  • Valid-absdeclor-option
                  • Valid-param-declon-list
                  • Valid-desiniter
                  • Valid-const-expr-option
                  • Valid-table-num-scopes
                  • Valid-expr-option
                  • Valid-statassert
                  • Valid-enumer-list
                  • Valid-member-designor
                  • Valid-declon-list
                  • Valid-empty-scope
                • Validation-information
              • 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
    • Validator

    Valid-ext-declon

    Validate an external declaration.

    Signature
    (valid-ext-declon edecl table ienv) 
      → 
    (mv erp new-edecl new-table)
    Arguments
    edecl — Guard (ext-declonp edecl).
    table — Guard (valid-tablep table).
    ienv — Guard (ienvp ienv).
    Returns
    erp — Type (maybe-msgp erp).
    new-edecl — Type (ext-declonp new-edecl).
    new-table — Type (valid-tablep new-table).

    For now we do not do anything with assembler statements. The empty external declaration is always valid. We check that declarations contain no return statements.

    Definitions and Theorems

    Function: valid-ext-declon

    (defun valid-ext-declon (edecl table ienv)
     (declare (xargs :guard (and (ext-declonp edecl)
                                 (valid-tablep table)
                                 (ienvp ienv))))
     (declare (xargs :guard (ext-declon-unambp edecl)))
     (b* (((reterr)
           (irr-ext-declon)
           (irr-valid-table)))
      (ext-declon-case
       edecl :fundef
       (b* (((erp new-fundef table)
             (valid-fundef edecl.fundef table ienv)))
         (retok (ext-declon-fundef new-fundef)
                table))
       :declon
       (b*
        (((erp new-decl types table)
          (valid-declon edecl.declon table ienv))
         ((unless (emptyp types))
          (retmsg$
           "The top-level declaration ~x0 ~
                               contains return statements."
           edecl.declon)))
        (retok (ext-declon-declon new-decl)
               table))
       :empty (retok (ext-declon-empty)
                     (valid-table-fix table))
       :asm (retok (ext-declon-fix edecl)
                   (valid-table-fix table)))))

    Theorem: maybe-msgp-of-valid-ext-declon.erp

    (defthm maybe-msgp-of-valid-ext-declon.erp
      (b* (((mv acl2::?erp ?new-edecl ?new-table)
            (valid-ext-declon edecl table ienv)))
        (maybe-msgp erp))
      :rule-classes :rewrite)

    Theorem: ext-declonp-of-valid-ext-declon.new-edecl

    (defthm ext-declonp-of-valid-ext-declon.new-edecl
      (b* (((mv acl2::?erp ?new-edecl ?new-table)
            (valid-ext-declon edecl table ienv)))
        (ext-declonp new-edecl))
      :rule-classes :rewrite)

    Theorem: valid-tablep-of-valid-ext-declon.new-table

    (defthm valid-tablep-of-valid-ext-declon.new-table
      (b* (((mv acl2::?erp ?new-edecl ?new-table)
            (valid-ext-declon edecl table ienv)))
        (valid-tablep new-table))
      :rule-classes :rewrite)

    Theorem: ext-declon-unambp-of-valid-ext-declon

    (defthm ext-declon-unambp-of-valid-ext-declon
      (implies (ext-declon-unambp edecl)
               (b* (((mv acl2::?erp ?new-edecl ?new-table)
                     (valid-ext-declon edecl table ienv)))
                 (implies (not erp)
                          (ext-declon-unambp new-edecl)))))

    Theorem: valid-ext-declon-of-ext-declon-fix-edecl

    (defthm valid-ext-declon-of-ext-declon-fix-edecl
      (equal (valid-ext-declon (ext-declon-fix edecl)
                               table ienv)
             (valid-ext-declon edecl table ienv)))

    Theorem: valid-ext-declon-ext-declon-equiv-congruence-on-edecl

    (defthm valid-ext-declon-ext-declon-equiv-congruence-on-edecl
      (implies (ext-declon-equiv edecl edecl-equiv)
               (equal (valid-ext-declon edecl table ienv)
                      (valid-ext-declon edecl-equiv table ienv)))
      :rule-classes :congruence)

    Theorem: valid-ext-declon-of-valid-table-fix-table

    (defthm valid-ext-declon-of-valid-table-fix-table
      (equal (valid-ext-declon edecl (valid-table-fix table)
                               ienv)
             (valid-ext-declon edecl table ienv)))

    Theorem: valid-ext-declon-valid-table-equiv-congruence-on-table

    (defthm valid-ext-declon-valid-table-equiv-congruence-on-table
      (implies (valid-table-equiv table table-equiv)
               (equal (valid-ext-declon edecl table ienv)
                      (valid-ext-declon edecl table-equiv ienv)))
      :rule-classes :congruence)

    Theorem: valid-ext-declon-of-ienv-fix-ienv

    (defthm valid-ext-declon-of-ienv-fix-ienv
      (equal (valid-ext-declon edecl table (ienv-fix ienv))
             (valid-ext-declon edecl table ienv)))

    Theorem: valid-ext-declon-ienv-equiv-congruence-on-ienv

    (defthm valid-ext-declon-ienv-equiv-congruence-on-ienv
      (implies (ienv-equiv ienv ienv-equiv)
               (equal (valid-ext-declon edecl table ienv)
                      (valid-ext-declon edecl table ienv-equiv)))
      :rule-classes :congruence)