For example: given a ranged enum item like
(vl-enumname-range-declarations name top bottom nextval basetype atts loc) → (mv params new-nextval)
Function:
(defun vl-enumname-range-declarations (name top bottom nextval basetype atts loc) (declare (xargs :guard (and (stringp name) (integerp top) (integerp bottom) (vl-expr-p nextval) (vl-datatype-p basetype) (vl-atts-p atts) (vl-location-p loc)))) (let ((__function__ 'vl-enumname-range-declarations)) (declare (ignorable __function__)) (b* ((top (lifix top)) (bottom (lifix bottom)) (name1 (cat name (if (< top 0) "-" "") (natstr (abs top)))) (first (make-vl-paramdecl :name name1 :localp t :type (make-vl-explicitvalueparam :type basetype :default (vl-expr-fix nextval)) :atts atts :loc loc)) (nextval (make-vl-binary :op :vl-binary-plus :left (vl-idexpr name1) :right (vl-make-index 1))) ((when (eql top bottom)) (mv (list first) nextval)) ((mv decls nextval) (vl-enumname-range-declarations name (if (< top bottom) (1+ top) (1- top)) bottom nextval basetype atts loc))) (mv (cons first decls) nextval))))
Theorem:
(defthm vl-paramdecllist-p-of-vl-enumname-range-declarations.params (b* (((mv ?params ?new-nextval) (vl-enumname-range-declarations name top bottom nextval basetype atts loc))) (vl-paramdecllist-p params)) :rule-classes :rewrite)
Theorem:
(defthm vl-expr-p-of-vl-enumname-range-declarations.new-nextval (b* (((mv ?params ?new-nextval) (vl-enumname-range-declarations name top bottom nextval basetype atts loc))) (vl-expr-p new-nextval)) :rule-classes :rewrite)
Theorem:
(defthm vl-enumname-range-declarations-of-str-fix-name (equal (vl-enumname-range-declarations (str-fix name) top bottom nextval basetype atts loc) (vl-enumname-range-declarations name top bottom nextval basetype atts loc)))
Theorem:
(defthm vl-enumname-range-declarations-streqv-congruence-on-name (implies (streqv name name-equiv) (equal (vl-enumname-range-declarations name top bottom nextval basetype atts loc) (vl-enumname-range-declarations name-equiv top bottom nextval basetype atts loc))) :rule-classes :congruence)
Theorem:
(defthm vl-enumname-range-declarations-of-ifix-top (equal (vl-enumname-range-declarations name (ifix top) bottom nextval basetype atts loc) (vl-enumname-range-declarations name top bottom nextval basetype atts loc)))
Theorem:
(defthm vl-enumname-range-declarations-int-equiv-congruence-on-top (implies (acl2::int-equiv top top-equiv) (equal (vl-enumname-range-declarations name top bottom nextval basetype atts loc) (vl-enumname-range-declarations name top-equiv bottom nextval basetype atts loc))) :rule-classes :congruence)
Theorem:
(defthm vl-enumname-range-declarations-of-ifix-bottom (equal (vl-enumname-range-declarations name top (ifix bottom) nextval basetype atts loc) (vl-enumname-range-declarations name top bottom nextval basetype atts loc)))
Theorem:
(defthm vl-enumname-range-declarations-int-equiv-congruence-on-bottom (implies (acl2::int-equiv bottom bottom-equiv) (equal (vl-enumname-range-declarations name top bottom nextval basetype atts loc) (vl-enumname-range-declarations name top bottom-equiv nextval basetype atts loc))) :rule-classes :congruence)
Theorem:
(defthm vl-enumname-range-declarations-of-vl-expr-fix-nextval (equal (vl-enumname-range-declarations name top bottom (vl-expr-fix nextval) basetype atts loc) (vl-enumname-range-declarations name top bottom nextval basetype atts loc)))
Theorem:
(defthm vl-enumname-range-declarations-vl-expr-equiv-congruence-on-nextval (implies (vl-expr-equiv nextval nextval-equiv) (equal (vl-enumname-range-declarations name top bottom nextval basetype atts loc) (vl-enumname-range-declarations name top bottom nextval-equiv basetype atts loc))) :rule-classes :congruence)
Theorem:
(defthm vl-enumname-range-declarations-of-vl-datatype-fix-basetype (equal (vl-enumname-range-declarations name top bottom nextval (vl-datatype-fix basetype) atts loc) (vl-enumname-range-declarations name top bottom nextval basetype atts loc)))
Theorem:
(defthm vl-enumname-range-declarations-vl-datatype-equiv-congruence-on-basetype (implies (vl-datatype-equiv basetype basetype-equiv) (equal (vl-enumname-range-declarations name top bottom nextval basetype atts loc) (vl-enumname-range-declarations name top bottom nextval basetype-equiv atts loc))) :rule-classes :congruence)
Theorem:
(defthm vl-enumname-range-declarations-of-vl-atts-fix-atts (equal (vl-enumname-range-declarations name top bottom nextval basetype (vl-atts-fix atts) loc) (vl-enumname-range-declarations name top bottom nextval basetype atts loc)))
Theorem:
(defthm vl-enumname-range-declarations-vl-atts-equiv-congruence-on-atts (implies (vl-atts-equiv atts atts-equiv) (equal (vl-enumname-range-declarations name top bottom nextval basetype atts loc) (vl-enumname-range-declarations name top bottom nextval basetype atts-equiv loc))) :rule-classes :congruence)
Theorem:
(defthm vl-enumname-range-declarations-of-vl-location-fix-loc (equal (vl-enumname-range-declarations name top bottom nextval basetype atts (vl-location-fix loc)) (vl-enumname-range-declarations name top bottom nextval basetype atts loc)))
Theorem:
(defthm vl-enumname-range-declarations-vl-location-equiv-congruence-on-loc (implies (vl-location-equiv loc loc-equiv) (equal (vl-enumname-range-declarations name top bottom nextval basetype atts loc) (vl-enumname-range-declarations name top bottom nextval basetype atts loc-equiv))) :rule-classes :congruence)