• 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-exprs/decls/stmts

    Valid-decl-spec

    Validate a declaration specifier.

    Signature
    (valid-decl-spec declspec type? tyspecs storspecs table ienv) 
      → 
    (mv erp new-declspec new-type? new-tyspecs 
        new-storspecs return-types new-table) 
    
    Arguments
    declspec — Guard (decl-specp declspec).
    type? — Guard (type-optionp type?).
    tyspecs — Guard (type-spec-listp tyspecs).
    storspecs — Guard (stor-spec-listp storspecs).
    table — Guard (valid-tablep table).
    ienv — Guard (ienvp ienv).
    Returns
    erp — Type (maybe-msgp erp).
    new-declspec — Type (decl-specp new-declspec).
    new-type? — Type (type-optionp new-type?).
    new-tyspecs — Type (type-spec-listp new-tyspecs).
    new-storspecs — Type (stor-spec-listp new-storspecs).
    return-types — Type (type-setp return-types).
    new-table — Type (valid-tablep new-table).

    For now we ignore type qualifiers, function specifiers, and attributes. We validate alignment specifiers but we do not make any use of them in our currently approximate type system. We handle type specifiers similarly to valid-spec/qual. In addition, we collect all the storage class specifiers encountered as we go through the declaration specifiers.

    Definitions and Theorems

    Theorem: type-spec-list-unambp-of-valid-decl-spec

    (defthm type-spec-list-unambp-of-valid-decl-spec
      (implies
           (type-spec-list-unambp tyspecs)
           (b* (((mv acl2::?erp
                     ?new-declspec ?new-type? ?new-tyspecs
                     ?new-storspecs ?return-types ?new-table)
                 (valid-decl-spec declspec
                                  type? tyspecs storspecs table ienv)))
             (type-spec-list-unambp new-tyspecs))))

    Theorem: not-type-and-type-specs-of-valid-decl-spec

    (defthm not-type-and-type-specs-of-valid-decl-spec
      (implies
           (not (and type? tyspecs))
           (b* (((mv acl2::?erp
                     ?new-declspec ?new-type? ?new-tyspecs
                     ?new-storspecs ?return-types ?new-table)
                 (valid-decl-spec declspec
                                  type? tyspecs storspecs table ienv)))
             (not (and new-type? new-tyspecs)))))

    Theorem: not-type-specs-of-valid-decl-spec-when-type

    (defthm not-type-specs-of-valid-decl-spec-when-type
      (implies
           (not (and type? tyspecs))
           (b* (((mv acl2::?erp
                     ?new-declspec ?new-type? ?new-tyspecs
                     ?new-storspecs ?return-types ?new-table)
                 (valid-decl-spec declspec
                                  type? tyspecs storspecs table ienv)))
             (implies new-type? (not new-tyspecs)))))

    Theorem: valid-decl-spec.new-storspecs-type-prescription

    (defthm valid-decl-spec.new-storspecs-type-prescription
      (b* (((mv acl2::?erp
                ?new-declspec ?new-type? ?new-tyspecs
                ?new-storspecs ?return-types ?new-table)
            (valid-decl-spec declspec
                             type? tyspecs storspecs table ienv)))
        (true-listp new-storspecs))
      :rule-classes :type-prescription)