Try to explode a match-expression into a vl-bitlist-p.
(vl-intliteral-msb-bits x) → (mv okp msb-bits)
For now we just support simple weirdints and constints. We could probably easily extend this to arbitrary concatenations of weirdints and constints, but that's probably overkill.
Function:
(defun vl-intliteral-msb-bits (x) (declare (xargs :guard (vl-expr-p x))) (declare (xargs :guard (vl-expr-welltyped-p x))) (let ((__function__ 'vl-intliteral-msb-bits)) (declare (ignorable __function__)) (b* (((unless (vl-fast-atom-p x)) (mv nil nil)) (guts (vl-atom->guts x)) ((when (vl-fast-weirdint-p guts)) (mv t (vl-weirdint->bits guts))) ((unless (vl-constint-p guts)) (mv nil nil))) (mv t (vl-constint->msb-bits x)))))
Theorem:
(defthm booleanp-of-vl-intliteral-msb-bits.okp (b* (((mv ?okp ?msb-bits) (vl-intliteral-msb-bits x))) (booleanp okp)) :rule-classes :type-prescription)
Theorem:
(defthm vl-bitlist-p-of-vl-intliteral-msb-bits.msb-bits (b* (((mv ?okp ?msb-bits) (vl-intliteral-msb-bits x))) (vl-bitlist-p msb-bits)) :rule-classes :rewrite)
Theorem:
(defthm len-of-vl-intliteral-msb-bits (b* (((mv okp msb-bits) (vl-intliteral-msb-bits x))) (implies (and okp (vl-expr-welltyped-p x)) (equal (len msb-bits) (vl-expr->finalwidth x)))))
Theorem:
(defthm consp-of-vl-intliteral-msb-bits (b* (((mv okp msb-bits) (vl-intliteral-msb-bits x))) (implies (and okp (vl-expr-welltyped-p x)) (equal (consp msb-bits) (posp (vl-expr->finalwidth x))))))
Theorem:
(defthm vl-intliteral-msb-bits-of-vl-expr-fix-x (equal (vl-intliteral-msb-bits (vl-expr-fix x)) (vl-intliteral-msb-bits x)))
Theorem:
(defthm vl-intliteral-msb-bits-vl-expr-equiv-congruence-on-x (implies (vl-expr-equiv x x-equiv) (equal (vl-intliteral-msb-bits x) (vl-intliteral-msb-bits x-equiv))) :rule-classes :congruence)