Turn a type into a type name.
We pick a particular choice of type specifier sequence, and thus of type name, for each integer type.
Function:
(defun type-to-tyname-aux (type) (declare (xargs :guard (typep type))) (let ((__function__ 'type-to-tyname-aux)) (declare (ignorable __function__)) (type-case type :void (mv (tyspecseq-void) (obj-adeclor-none)) :char (mv (tyspecseq-char) (obj-adeclor-none)) :schar (mv (tyspecseq-schar) (obj-adeclor-none)) :uchar (mv (tyspecseq-uchar) (obj-adeclor-none)) :sshort (mv (tyspecseq-sshort nil nil) (obj-adeclor-none)) :ushort (mv (tyspecseq-ushort nil) (obj-adeclor-none)) :sint (mv (tyspecseq-sint nil t) (obj-adeclor-none)) :uint (mv (tyspecseq-uint t) (obj-adeclor-none)) :slong (mv (tyspecseq-slong nil nil) (obj-adeclor-none)) :ulong (mv (tyspecseq-ulong nil) (obj-adeclor-none)) :sllong (mv (tyspecseq-sllong nil nil) (obj-adeclor-none)) :ullong (mv (tyspecseq-ullong nil) (obj-adeclor-none)) :struct (mv (tyspecseq-struct type.tag) (obj-adeclor-none)) :pointer (b* (((mv tyspec declor) (type-to-tyname-aux type.to))) (mv tyspec (make-obj-adeclor-pointer :decl declor))) :array (b* (((mv tyspec declor) (type-to-tyname-aux type.of)) (size (if type.size (positive-to-iconst type.size) nil))) (mv tyspec (make-obj-adeclor-array :decl declor :size size))))))
Theorem:
(defthm tyspecseqp-of-type-to-tyname-aux.tyspec (b* (((mv ?tyspec ?declor) (type-to-tyname-aux type))) (tyspecseqp tyspec)) :rule-classes :rewrite)
Theorem:
(defthm obj-adeclorp-of-type-to-tyname-aux.declor (b* (((mv ?tyspec ?declor) (type-to-tyname-aux type))) (obj-adeclorp declor)) :rule-classes :rewrite)
Theorem:
(defthm type-to-tyname-aux-of-type-fix-type (equal (type-to-tyname-aux (type-fix type)) (type-to-tyname-aux type)))
Theorem:
(defthm type-to-tyname-aux-type-equiv-congruence-on-type (implies (type-equiv type type-equiv) (equal (type-to-tyname-aux type) (type-to-tyname-aux type-equiv))) :rule-classes :congruence)
Function:
(defun type-to-tyname (type) (declare (xargs :guard (typep type))) (let ((__function__ 'type-to-tyname)) (declare (ignorable __function__)) (b* (((mv tyspec declor) (type-to-tyname-aux type))) (make-tyname :tyspec tyspec :declor declor))))
Theorem:
(defthm tynamep-of-type-to-tyname (b* ((tyname (type-to-tyname type))) (tynamep tyname)) :rule-classes :rewrite)
Theorem:
(defthm type-to-tyname-of-type-fix-type (equal (type-to-tyname (type-fix type)) (type-to-tyname type)))
Theorem:
(defthm type-to-tyname-type-equiv-congruence-on-type (implies (type-equiv type type-equiv) (equal (type-to-tyname type) (type-to-tyname type-equiv))) :rule-classes :congruence)