• 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
            • Atc-implementation
              • Atc-abstract-syntax
              • Atc-pretty-printer
              • Atc-event-and-code-generation
              • Fty-pseudo-term-utilities
              • Atc-term-recognizers
              • Atc-input-processing
              • Atc-shallow-embedding
              • Atc-process-inputs-and-gen-everything
              • Atc-table
              • Atc-fn
              • Atc-pretty-printing-options
              • Atc-types
                • Type-to-tyname
                • Ident+type-to-tyspec+declor
                • Positive-to-iconst
                • Type-to-maker
                  • Irr-type
                • Atc-macro-definition
              • Atc-tutorial
              • Pure-expression-execution
            • 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
    • Atc-types

    Type-to-maker

    Turn a type into a term that makes (evaluates to) it.

    Signature
    (type-to-maker type) → term
    Arguments
    type — Guard (typep type).
    Returns
    term — A term.

    This is somewhat meta.

    Definitions and Theorems

    Function: type-to-maker

    (defun type-to-maker (type)
     (declare (xargs :guard (typep type)))
     (let ((__function__ 'type-to-maker))
      (declare (ignorable __function__))
      (type-case
          type
          :void '(type-void)
          :char '(type-char)
          :schar '(type-schar)
          :uchar '(type-uchar)
          :sshort '(type-sshort)
          :ushort '(type-ushort)
          :sint '(type-sint)
          :uint '(type-uint)
          :slong '(type-slong)
          :ulong '(type-ulong)
          :sllong '(type-sllong)
          :ullong '(type-ullong)
          :struct
          (cons 'type-struct
                (cons (cons 'ident
                            (cons (ident->name (type-struct->tag type))
                                  'nil))
                      'nil))
          :pointer
          (cons 'make-type-pointer
                (cons ':to
                      (cons (type-to-maker (type-pointer->to type))
                            'nil)))
          :array (cons 'make-type-array
                       (cons ':of
                             (cons (type-to-maker (type-array->of type))
                                   (cons ':size
                                         (cons (type-array->size type)
                                               'nil))))))))

    Theorem: type-to-maker-of-type-fix-type

    (defthm type-to-maker-of-type-fix-type
      (equal (type-to-maker (type-fix type))
             (type-to-maker type)))

    Theorem: type-to-maker-type-equiv-congruence-on-type

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