• 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
          • Atc
          • Transformation-tools
          • Language
            • Abstract-syntax
              • Tyspecseq
              • Expr
              • Binop
              • Fileset
              • Obj-declor
              • Abstract-syntax-operations
                • Stmts/blocks-nocallsp
                • Tyspec+declor-to-ident+params+tyname
                • Fundef-list-to-fun-declon-list
                • Fundef-list->name-list
                • Ident+tyname-to-tyspec+declor
                  • Tyspec+declor-to-ident+tyname
                  • Obj-declon-to-ident+scspec+tyname+init
                  • Ident+adeclor-to-obj-declor
                  • Ident+adeclor-to-fun-declor
                  • Fun-adeclor-to-params+declor
                  • Param-declon-list-to-ident+tyname-lists
                  • Obj-declor-to-ident+adeclor
                  • Fun-declor-to-ident+adeclor
                  • Expr-constp
                  • Fundef-to-fun-declon
                  • Param-declon-to-ident+tyname
                  • Ext-declon-list->fundef-list
                  • Struct-declon-to-ident+tyname
                  • Unop-nonpointerp
                  • Initer-option-nocallsp
                  • Expr-nocallsp
                  • Expr-list-nocallsp
                  • Binop-strictp
                  • Expr-purep
                  • Expr-option-nocallsp
                  • Expr-list-constp
                  • Binop-purep
                  • Obj-declon-nocallsp
                  • Initer-nocallsp
                  • Label-nocallsp
                  • Fundef->name
                  • Expr-list-purep
                  • Block-item-nocallsp
                  • Block-item-list-nocallsp
                  • Stmt-nocallsp
                • Iconst
                • Obj-adeclor
                • Const
                • Fundef
                • Unop
                • File
                • Tag-declon
                • Fun-declor
                • Obj-declon
                • Iconst-length
                • Label
                • Struct-declon
                • Initer
                • Ext-declon
                • Fun-adeclor
                • Expr-option
                • Iconst-base
                • Initer-option
                • Iconst-option
                • Tyspecseq-option
                • Stmt-option
                • Scspecseq
                • Param-declon
                • Obj-declon-option
                • File-option
                • Tyname
                • Transunit
                • Fun-declon
                • Transunit-result
                • Param-declon-list
                • Struct-declon-list
                • Expr-list
                • Tyspecseq-list
                • Identifiers
                • Ext-declon-list
                • Unop-list
                • Tyname-list
                • Fundef-list
                • Fun-declon-list
                • Binop-list
                • Stmt-fixtypes
                • Expr-fixtypes
              • Integer-ranges
              • Implementation-environments
              • Dynamic-semantics
              • Static-semantics
              • Grammar
              • Types
              • Integer-formats-definitions
              • Computation-states
              • Portable-ascii-identifiers
              • Values
              • Integer-operations
              • Object-designators
              • Operations
              • Errors
              • Tag-environments
              • Function-environments
              • Character-sets
              • Flexible-array-member-removal
              • Arithmetic-operations
              • Pointer-operations
              • Real-operations
              • Array-operations
              • Scalar-operations
              • Structure-operations
            • 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
    • Abstract-syntax-operations

    Ident+tyname-to-tyspec+declor

    Turn an identifier and a type name into a type specifier sequence and an object declarator.

    Signature
    (ident+tyname-to-tyspec+declor id tyname) → (mv tyspec declor)
    Arguments
    id — Guard (identp id).
    tyname — Guard (tynamep tyname).
    Returns
    tyspec — Type (tyspecseqp tyspec).
    declor — Type (obj-declorp declor).

    We decompose the type name into a type specifier sequence and an abstract object declarator, and we compose the latter with the identifier into an object declarator.

    Given an identifier and a type (name), this function provides the constituents for declaring it.

    This is the inverse of tyspec+declor-to-ident+tyname.

    Definitions and Theorems

    Function: ident+tyname-to-tyspec+declor

    (defun ident+tyname-to-tyspec+declor (id tyname)
      (declare (xargs :guard (and (identp id) (tynamep tyname))))
      (b* (((tyname tyname) tyname))
        (mv tyname.tyspec
            (ident+adeclor-to-obj-declor id tyname.declor))))

    Theorem: tyspecseqp-of-ident+tyname-to-tyspec+declor.tyspec

    (defthm tyspecseqp-of-ident+tyname-to-tyspec+declor.tyspec
      (b* (((mv ?tyspec ?declor)
            (ident+tyname-to-tyspec+declor id tyname)))
        (tyspecseqp tyspec))
      :rule-classes :rewrite)

    Theorem: obj-declorp-of-ident+tyname-to-tyspec+declor.declor

    (defthm obj-declorp-of-ident+tyname-to-tyspec+declor.declor
      (b* (((mv ?tyspec ?declor)
            (ident+tyname-to-tyspec+declor id tyname)))
        (obj-declorp declor))
      :rule-classes :rewrite)

    Theorem: ident+tyname-to-tyspec+declor-of-tyspec+declor-to-ident+tyname

    (defthm
         ident+tyname-to-tyspec+declor-of-tyspec+declor-to-ident+tyname
      (b* (((mv id tyname)
            (tyspec+declor-to-ident+tyname tyspec declor)))
        (equal (ident+tyname-to-tyspec+declor id tyname)
               (mv (tyspecseq-fix tyspec)
                   (obj-declor-fix declor)))))

    Theorem: tyspec+declor-to-ident+tyname-of-ident+tyname-to-tyspec+declor

    (defthm
         tyspec+declor-to-ident+tyname-of-ident+tyname-to-tyspec+declor
      (b* (((mv tyspec declor)
            (ident+tyname-to-tyspec+declor id tyname)))
        (equal (tyspec+declor-to-ident+tyname tyspec declor)
               (mv (ident-fix id)
                   (tyname-fix tyname)))))

    Theorem: ident+tyname-to-tyspec+declor-of-ident-fix-id

    (defthm ident+tyname-to-tyspec+declor-of-ident-fix-id
      (equal (ident+tyname-to-tyspec+declor (ident-fix id)
                                            tyname)
             (ident+tyname-to-tyspec+declor id tyname)))

    Theorem: ident+tyname-to-tyspec+declor-ident-equiv-congruence-on-id

    (defthm ident+tyname-to-tyspec+declor-ident-equiv-congruence-on-id
      (implies (ident-equiv id id-equiv)
               (equal (ident+tyname-to-tyspec+declor id tyname)
                      (ident+tyname-to-tyspec+declor id-equiv tyname)))
      :rule-classes :congruence)

    Theorem: ident+tyname-to-tyspec+declor-of-tyname-fix-tyname

    (defthm ident+tyname-to-tyspec+declor-of-tyname-fix-tyname
      (equal (ident+tyname-to-tyspec+declor id (tyname-fix tyname))
             (ident+tyname-to-tyspec+declor id tyname)))

    Theorem: ident+tyname-to-tyspec+declor-tyname-equiv-congruence-on-tyname

    (defthm
        ident+tyname-to-tyspec+declor-tyname-equiv-congruence-on-tyname
      (implies (tyname-equiv tyname tyname-equiv)
               (equal (ident+tyname-to-tyspec+declor id tyname)
                      (ident+tyname-to-tyspec+declor id tyname-equiv)))
      :rule-classes :congruence)