Function:
(defun vl-structmemberlist-shift-bits (x field) (declare (xargs :guard (and (vl-structmemberlist-p x) (stringp field)))) (declare (xargs :guard (vl-structmemberlist-resolved-p x))) (let ((__function__ 'vl-structmemberlist-shift-bits)) (declare (ignorable __function__)) (b* ((field (string-fix field)) ((when (atom x)) (mv (vmsg "Field not found: ~s0" field) nil)) ((vl-structmember x1) (car x)) ((when (equal x1.name field)) (mv nil 0)) ((mv err size) (vl-datatype-size x1.type)) ((when err) (mv err nil)) ((unless size) (mv (vmsg "Couldn't size struct member type: ~a0" x1.type) nil)) ((mv err rest) (vl-structmemberlist-shift-bits (cdr x) field)) ((when err) (mv err nil))) (mv nil (+ size rest)))))
Theorem:
(defthm return-type-of-vl-structmemberlist-shift-bits.err (b* (((mv ?err ?shift) (vl-structmemberlist-shift-bits x field))) (iff (vl-msg-p err) err)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-vl-structmemberlist-shift-bits.shift (b* (((mv ?err ?shift) (vl-structmemberlist-shift-bits x field))) (implies (not err) (natp shift))) :rule-classes :type-prescription)
Theorem:
(defthm vl-structmemberlist-shift-bits-of-vl-structmemberlist-fix-x (equal (vl-structmemberlist-shift-bits (vl-structmemberlist-fix x) field) (vl-structmemberlist-shift-bits x field)))
Theorem:
(defthm vl-structmemberlist-shift-bits-vl-structmemberlist-equiv-congruence-on-x (implies (vl-structmemberlist-equiv x x-equiv) (equal (vl-structmemberlist-shift-bits x field) (vl-structmemberlist-shift-bits x-equiv field))) :rule-classes :congruence)
Theorem:
(defthm vl-structmemberlist-shift-bits-of-str-fix-field (equal (vl-structmemberlist-shift-bits x (str-fix field)) (vl-structmemberlist-shift-bits x field)))
Theorem:
(defthm vl-structmemberlist-shift-bits-streqv-congruence-on-field (implies (streqv field field-equiv) (equal (vl-structmemberlist-shift-bits x field) (vl-structmemberlist-shift-bits x field-equiv))) :rule-classes :congruence)