Turn a list of initializers into a variable substitution.
(initializers-to-variable-substitution inits) → subst
Each field name is regarded as a variable and the corresponding expression is associated to the variable, and will replace the variable when the substitution is applied.
Function:
(defun initializers-to-variable-substitution (inits) (declare (xargs :guard (initializer-listp inits))) (let ((__function__ 'initializers-to-variable-substitution)) (declare (ignorable __function__)) (cond ((endp inits) nil) (t (omap::update (initializer->field (car inits)) (initializer->value (car inits)) (initializers-to-variable-substitution (cdr inits)))))))
Theorem:
(defthm variable-substitutionp-of-initializers-to-variable-substitution (b* ((subst (initializers-to-variable-substitution inits))) (variable-substitutionp subst)) :rule-classes :rewrite)
Theorem:
(defthm initializers-to-variable-substitution-of-initializer-list-fix-inits (equal (initializers-to-variable-substitution (initializer-list-fix inits)) (initializers-to-variable-substitution inits)))
Theorem:
(defthm initializers-to-variable-substitution-initializer-list-equiv-congruence-on-inits (implies (initializer-list-equiv inits inits-equiv) (equal (initializers-to-variable-substitution inits) (initializers-to-variable-substitution inits-equiv))) :rule-classes :congruence)