Do basic string mashing to allow the user to refer to warnings in
either upper or lower case, treating - and _ as equivalent, and with or without
Function:
(defun vl-mash-warning-string (x) (declare (xargs :guard (stringp x))) (let ((__function__ 'vl-mash-warning-string)) (declare (ignorable __function__)) (b* ((x (str::upcase-string x)) (x (str::strsubst "-" "_" x)) (x (if (str::strprefixp "_" x) (subseq x 1 nil) x)) (x (if (str::strprefixp "VL_" x) (ec-call (subseq x 3 nil)) x)) (x (if (str::strprefixp "WARN_" x) (ec-call (subseq x 5 nil)) x))) x)))
Theorem:
(defthm stringp-of-vl-mash-warning-string (b* ((new-x (vl-mash-warning-string x))) (stringp new-x)) :rule-classes :type-prescription)
Theorem:
(defthm vl-mash-warning-string-of-str-fix-x (equal (vl-mash-warning-string (str-fix x)) (vl-mash-warning-string x)))
Theorem:
(defthm vl-mash-warning-string-streqv-congruence-on-x (implies (streqv x x-equiv) (equal (vl-mash-warning-string x) (vl-mash-warning-string x-equiv))) :rule-classes :congruence)