Separate from some rules the ones that define a rule name.
We scan
Function:
(defun rules-of-name (rulename rules) (declare (xargs :guard (and (rulenamep rulename) (rulelistp rules)))) (b* (((when (endp rules)) (mv nil nil)) (rule (rule-fix (car rules))) ((mv rulename-rules other-rules) (rules-of-name rulename (cdr rules)))) (if (equal (rule->name rule) rulename) (mv (cons rule rulename-rules) other-rules) (mv rulename-rules (cons rule other-rules)))))
Theorem:
(defthm rulelistp-of-rules-of-name.rulename-rules (b* (((mv ?rulename-rules ?other-rules) (rules-of-name rulename rules))) (rulelistp rulename-rules)) :rule-classes :rewrite)
Theorem:
(defthm rulelistp-of-rules-of-name.other-rules (b* (((mv ?rulename-rules ?other-rules) (rules-of-name rulename rules))) (rulelistp other-rules)) :rule-classes :rewrite)
Theorem:
(defthm len-of-other-rules-of-rules-of-name-< (b* (((mv rulename-rules other-rules) (rules-of-name rulename rules))) (implies rulename-rules (< (len other-rules) (len rules)))) :rule-classes :linear)