• 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-update-ext

    Update the externals map with an identifier.

    Signature
    (valid-update-ext ident type uid table) → new-table
    Arguments
    ident — Guard (identp ident).
    type — Guard (typep type).
    uid — Guard (uidp uid).
    table — Guard (valid-tablep table).
    Returns
    new-table — Type (valid-tablep new-table).

    If no entry exists for the identifier, add a new valid-ext-info. If an entry does exist, update the declared-in field to include the name of the current translation unit.

    When an existing entry already exists, type compatibility is not checked, nor is the UID. Instead, the caller should check compatibility and ensure a proper UID before updating.

    Definitions and Theorems

    Function: valid-update-ext

    (defun valid-update-ext (ident type uid table)
     (declare (xargs :guard (and (identp ident)
                                 (typep type)
                                 (uidp uid)
                                 (valid-tablep table))))
     (b*
      (((valid-table table) table)
       (info? (valid-lookup-ext ident table))
       (new-info
        (valid-ext-info-option-case
         info?
         :some
         (change-valid-ext-info
          info?
          :declared-in (insert table.filepath
                               (valid-ext-info->declared-in info?.val)))
         :none
         (make-valid-ext-info :type type
                              :declared-in (insert table.filepath nil)
                              :uid uid)))
       (new-externals (omap::update (ident-fix ident)
                                    new-info table.externals)))
      (change-valid-table table
                          :externals new-externals)))

    Theorem: valid-tablep-of-valid-update-ext

    (defthm valid-tablep-of-valid-update-ext
      (b* ((new-table (valid-update-ext ident type uid table)))
        (valid-tablep new-table))
      :rule-classes :rewrite)

    Theorem: valid-update-ext-of-ident-fix-ident

    (defthm valid-update-ext-of-ident-fix-ident
      (equal (valid-update-ext (ident-fix ident)
                               type uid table)
             (valid-update-ext ident type uid table)))

    Theorem: valid-update-ext-ident-equiv-congruence-on-ident

    (defthm valid-update-ext-ident-equiv-congruence-on-ident
      (implies (ident-equiv ident ident-equiv)
               (equal (valid-update-ext ident type uid table)
                      (valid-update-ext ident-equiv type uid table)))
      :rule-classes :congruence)

    Theorem: valid-update-ext-of-type-fix-type

    (defthm valid-update-ext-of-type-fix-type
      (equal (valid-update-ext ident (type-fix type)
                               uid table)
             (valid-update-ext ident type uid table)))

    Theorem: valid-update-ext-type-equiv-congruence-on-type

    (defthm valid-update-ext-type-equiv-congruence-on-type
      (implies (type-equiv type type-equiv)
               (equal (valid-update-ext ident type uid table)
                      (valid-update-ext ident type-equiv uid table)))
      :rule-classes :congruence)

    Theorem: valid-update-ext-of-uid-fix-uid

    (defthm valid-update-ext-of-uid-fix-uid
      (equal (valid-update-ext ident type (uid-fix uid)
                               table)
             (valid-update-ext ident type uid table)))

    Theorem: valid-update-ext-uid-equiv-congruence-on-uid

    (defthm valid-update-ext-uid-equiv-congruence-on-uid
      (implies (uid-equiv uid uid-equiv)
               (equal (valid-update-ext ident type uid table)
                      (valid-update-ext ident type uid-equiv table)))
      :rule-classes :congruence)

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

    (defthm valid-update-ext-of-valid-table-fix-table
      (equal (valid-update-ext ident type uid (valid-table-fix table))
             (valid-update-ext ident type uid table)))

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

    (defthm valid-update-ext-valid-table-equiv-congruence-on-table
      (implies (valid-table-equiv table table-equiv)
               (equal (valid-update-ext ident type uid table)
                      (valid-update-ext ident type uid table-equiv)))
      :rule-classes :congruence)