• 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-gensel

    Validate a generic selection expression, given the types for the components.

    Signature
    (valid-gensel expr type type-alist) → (mv erp type)
    Arguments
    expr — Guard (exprp expr).
    type — Guard (typep type).
    type-alist — Guard (type-option-type-alistp type-alist).
    Returns
    erp — Type (maybe-msgp erp).
    type — Type (typep type).

    For now we do not perform any of the checks prescribed in [C17:6.5.1.1/2]. We will perform them later, when we refine our validator. We return the unknown type.

    Definitions and Theorems

    Function: valid-gensel

    (defun valid-gensel (expr type type-alist)
     (declare (xargs :guard (and (exprp expr)
                                 (typep type)
                                 (type-option-type-alistp type-alist))))
     (declare (ignore expr type type-alist))
     (declare (xargs :guard (expr-case expr :gensel)))
     (retok (type-unknown)))

    Theorem: maybe-msgp-of-valid-gensel.erp

    (defthm maybe-msgp-of-valid-gensel.erp
      (b* (((mv acl2::?erp ?type)
            (valid-gensel expr type type-alist)))
        (maybe-msgp erp))
      :rule-classes :rewrite)

    Theorem: typep-of-valid-gensel.type

    (defthm typep-of-valid-gensel.type
      (b* (((mv acl2::?erp ?type)
            (valid-gensel expr type type-alist)))
        (typep type))
      :rule-classes :rewrite)

    Theorem: valid-gensel-of-expr-fix-expr

    (defthm valid-gensel-of-expr-fix-expr
      (equal (valid-gensel (expr-fix expr)
                           type type-alist)
             (valid-gensel expr type type-alist)))

    Theorem: valid-gensel-expr-equiv-congruence-on-expr

    (defthm valid-gensel-expr-equiv-congruence-on-expr
      (implies (expr-equiv expr expr-equiv)
               (equal (valid-gensel expr type type-alist)
                      (valid-gensel expr-equiv type type-alist)))
      :rule-classes :congruence)

    Theorem: valid-gensel-of-type-fix-type

    (defthm valid-gensel-of-type-fix-type
      (equal (valid-gensel expr (type-fix type)
                           type-alist)
             (valid-gensel expr type type-alist)))

    Theorem: valid-gensel-type-equiv-congruence-on-type

    (defthm valid-gensel-type-equiv-congruence-on-type
      (implies (type-equiv type type-equiv)
               (equal (valid-gensel expr type type-alist)
                      (valid-gensel expr type-equiv type-alist)))
      :rule-classes :congruence)

    Theorem: valid-gensel-of-type-option-type-alist-fix-type-alist

    (defthm valid-gensel-of-type-option-type-alist-fix-type-alist
      (equal (valid-gensel expr type
                           (type-option-type-alist-fix type-alist))
             (valid-gensel expr type type-alist)))

    Theorem: valid-gensel-type-option-type-alist-equiv-congruence-on-type-alist

    (defthm
     valid-gensel-type-option-type-alist-equiv-congruence-on-type-alist
     (implies (type-option-type-alist-equiv type-alist type-alist-equiv)
              (equal (valid-gensel expr type type-alist)
                     (valid-gensel expr type type-alist-equiv)))
     :rule-classes :congruence)