Turn an identifier and a type into a type specifier sequence and an object declarator.
(ident+type-to-tyspec+declor id type) → (mv tyspec declor)
This function provides the consituents to construct a declaration of an identifier with a given type. The type specifier sequence and the object declarator can be used to construct various kinds of declarations (see our C abstract syntax).
Note that we pick a specific type specifier sequence for each type, out of possibly multiple ones possible, via the use of type-to-tyname.
Function:
(defun ident+type-to-tyspec+declor (id type) (declare (xargs :guard (and (identp id) (typep type)))) (let ((__function__ 'ident+type-to-tyspec+declor)) (declare (ignorable __function__)) (ident+tyname-to-tyspec+declor id (type-to-tyname type))))
Theorem:
(defthm tyspecseqp-of-ident+type-to-tyspec+declor.tyspec (b* (((mv ?tyspec ?declor) (ident+type-to-tyspec+declor id type))) (tyspecseqp tyspec)) :rule-classes :rewrite)
Theorem:
(defthm obj-declorp-of-ident+type-to-tyspec+declor.declor (b* (((mv ?tyspec ?declor) (ident+type-to-tyspec+declor id type))) (obj-declorp declor)) :rule-classes :rewrite)
Theorem:
(defthm ident+type-to-tyspec+declor-of-ident-fix-id (equal (ident+type-to-tyspec+declor (ident-fix id) type) (ident+type-to-tyspec+declor id type)))
Theorem:
(defthm ident+type-to-tyspec+declor-ident-equiv-congruence-on-id (implies (ident-equiv id id-equiv) (equal (ident+type-to-tyspec+declor id type) (ident+type-to-tyspec+declor id-equiv type))) :rule-classes :congruence)
Theorem:
(defthm ident+type-to-tyspec+declor-of-type-fix-type (equal (ident+type-to-tyspec+declor id (type-fix type)) (ident+type-to-tyspec+declor id type)))
Theorem:
(defthm ident+type-to-tyspec+declor-type-equiv-congruence-on-type (implies (type-equiv type type-equiv) (equal (ident+type-to-tyspec+declor id type) (ident+type-to-tyspec+declor id type-equiv))) :rule-classes :congruence)