• 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
              • Validation-information
                • Abstract-syntax-annop
                • Types
                  • Type-compatiblep
                  • Type-uaconvert-signed-unsigned
                  • Type-uaconvert
                  • Type-integer-promote
                  • Type-params-compatiblep
                  • Type-option
                  • Type-formalp
                  • Ldm-type
                    • Make-pointers-to
                    • Type-list-default-arg-promote
                    • Type-uaconvert-unsigned
                    • Type-uaconvert-signed
                    • Type-default-arg-promote
                    • Type-default-arg-promotedp
                    • Type-params-composite
                    • Type-integer-promotedp
                    • Ldm-type-option-set
                    • Type-unsigned-integerp
                    • Type-standard-unsigned-integerp
                    • Type-signed-integerp
                    • Type-to-value-kind
                    • Type-standard-signed-integerp
                    • Ildm-type
                    • Type-arithmeticp
                    • Ldm-type-set
                    • Ldm-type-option
                    • Type-standard-integerp
                    • Type-option-set-formalp
                    • Type-real-floatingp
                    • Type-option-formalp
                    • Type-integerp
                    • Type-characterp
                    • Type-basicp
                    • Type-aggregatep
                    • Type-scalarp
                    • Type-realp
                    • Type-fpconvert
                    • Type-floatingp
                    • Type-complexp
                    • Type-set-formalp
                    • Type-apconvert
                    • Type-composite
                    • Ident-type-map
                    • Type-set
                    • Type-option-type-alist
                    • Type-option-set
                    • Type-list-compatiblep
                    • Irr-type-params
                    • Irr-type
                    • Type-list-composite
                    • Type/type-params/type-list
                  • Abstract-syntax-anno-additional-theroems
                  • Valid-ext-info
                  • Valid-table
                  • Valid-ord-info
                  • Uid
                  • Stmts-types
                  • Lifetime
                  • Initdeclor-info
                  • Fundef-types
                  • Expr-type
                  • Valid-defstatus
                  • Var-info
                  • Valid-ord-info-option
                  • Valid-ext-info-option
                  • Uid-option
                  • Linkage-option
                  • Linkage
                  • Lifetime-option
                  • Valid-table-option
                  • Iconst-info
                  • Param-declor-nonabstract-info
                  • Fundef-info
                  • Expr-null-pointer-constp
                  • Valid-scope
                  • Const-expr-null-pointer-constp
                  • Expr-string-info
                  • Expr-funcall-info
                  • Expr-arrsub-info
                  • Tyname-info
                  • Transunit-info
                  • Expr-unary-info
                  • Expr-const-info
                  • Expr-binary-info
                  • Stmt-types
                  • Block-item-list-types
                  • Initer-type
                  • Valid-ord-scope
                  • Uid-increment
                  • Uid-equal
                  • Coerce-var-info
                  • Valid-externals
                  • Irr-var-info
                  • Valid-scope-list
                  • Irr-valid-table
                  • Irr-lifetime
                  • Irr-uid
                  • Irr-linkage
                  • Block-item-types
                  • Comp-stmt-types
              • 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
    • Types

    Ldm-type

    Map a type in type to a type in the language definition.

    Signature
    (ldm-type type) → (mv erp type1)
    Arguments
    type — Guard (typep type).
    Returns
    type1 — Type (c::typep type1).

    This function can be regarded as an extension of the collection of ldm- functions in mapping-to-language-definition. The supported types are the same as discussed in type-formalp.

    Definitions and Theorems

    Function: ldm-type

    (defun ldm-type (type)
      (declare (xargs :guard (typep type)))
      (b* (((reterr) (c::type-void)))
        (type-case type :void (retok (c::type-void))
                   :char (retok (c::type-char))
                   :schar (retok (c::type-schar))
                   :uchar (retok (c::type-uchar))
                   :sshort (retok (c::type-sshort))
                   :ushort (retok (c::type-ushort))
                   :sint (retok (c::type-sint))
                   :uint (retok (c::type-uint))
                   :slong (retok (c::type-slong))
                   :ulong (retok (c::type-ulong))
                   :sllong (retok (c::type-sllong))
                   :ullong (retok (c::type-ullong))
                   :float
                   (reterr (msg "Type ~x0 not supported."
                                (type-fix type)))
                   :double
                   (reterr (msg "Type ~x0 not supported."
                                (type-fix type)))
                   :ldouble
                   (reterr (msg "Type ~x0 not supported."
                                (type-fix type)))
                   :floatc
                   (reterr (msg "Type ~x0 not supported."
                                (type-fix type)))
                   :doublec
                   (reterr (msg "Type ~x0 not supported."
                                (type-fix type)))
                   :ldoublec
                   (reterr (msg "Type ~x0 not supported."
                                (type-fix type)))
                   :bool
                   (reterr (msg "Type ~x0 not supported."
                                (type-fix type)))
                   :struct
                   (if type.tag? (b* (((erp tag) (ldm-ident type.tag?)))
                                   (retok (c::type-struct tag)))
                     (reterr (msg "Type ~x0 not supported."
                                  (type-fix type))))
                   :union
                   (reterr (msg "Type ~x0 not supported."
                                (type-fix type)))
                   :enum
                   (reterr (msg "Type ~x0 not supported."
                                (type-fix type)))
                   :array
                   (reterr (msg "Type ~x0 not supported."
                                (type-fix type)))
                   :pointer
                   (b* (((erp refd-type) (ldm-type type.to)))
                     (retok (c::make-type-pointer :to refd-type)))
                   :function (reterr (msg "Type ~x0 not supported."
                                          (type-fix type)))
                   :unknown (reterr (msg "Type ~x0 not supported."
                                         (type-fix type))))))

    Theorem: typep-of-ldm-type.type1

    (defthm typep-of-ldm-type.type1
      (b* (((mv acl2::?erp ?type1)
            (ldm-type type)))
        (c::typep type1))
      :rule-classes :rewrite)

    Theorem: ldm-type-when-type-formalp

    (defthm ldm-type-when-type-formalp
      (implies (type-formalp type)
               (b* (((mv acl2::?erp ?type1)
                     (ldm-type type)))
                 (not erp))))

    Theorem: ldm-type-of-type-fix-type

    (defthm ldm-type-of-type-fix-type
      (equal (ldm-type (type-fix type))
             (ldm-type type)))

    Theorem: ldm-type-type-equiv-congruence-on-type

    (defthm ldm-type-type-equiv-congruence-on-type
      (implies (type-equiv type type-equiv)
               (equal (ldm-type type)
                      (ldm-type type-equiv)))
      :rule-classes :congruence)