Collect all the alternatives associated to a rule name from some rules.
(lookup-rulename rulename rules) → alternation
For well-formed rules, this function is an appropriate way to test whether
Function:
(defun lookup-rulename (rulename rules) (declare (xargs :guard (and (rulenamep rulename) (rulelistp rules)))) (b* ((rulename (mbe :logic (rulename-fix rulename) :exec rulename))) (cond ((endp rules) nil) (t (let ((rule (car rules))) (if (equal (rule->name rule) rulename) (append (rule->definiens rule) (lookup-rulename rulename (cdr rules))) (lookup-rulename rulename (cdr rules))))))))
Theorem:
(defthm alternationp-of-lookup-rulename (b* ((alternation (lookup-rulename rulename rules))) (alternationp alternation)) :rule-classes :rewrite)
Theorem:
(defthm lookup-rulename-of-rulename-fix-rulename (equal (lookup-rulename (rulename-fix rulename) rules) (lookup-rulename rulename rules)))
Theorem:
(defthm lookup-rulename-rulename-equiv-congruence-on-rulename (implies (rulename-equiv rulename rulename-equiv) (equal (lookup-rulename rulename rules) (lookup-rulename rulename-equiv rules))) :rule-classes :congruence)
Theorem:
(defthm lookup-rulename-of-rulelist-fix-rules (equal (lookup-rulename rulename (rulelist-fix rules)) (lookup-rulename rulename rules)))
Theorem:
(defthm lookup-rulename-rulelist-equiv-congruence-on-rules (implies (rulelist-equiv rules rules-equiv) (equal (lookup-rulename rulename rules) (lookup-rulename rulename rules-equiv))) :rule-classes :congruence)