Enhanced variant of ruler-extenders.
This returns the same result as ruler-extenders,
but it is guard-verified
and includes a run-time check (which should always succeed) on the result
that allows us to prove the return type theorem
without strengthening the guard on
(defun ruler-extenders+ (fn wrld) (declare (xargs :guard (and (symbolp fn) (plist-worldp wrld)))) (let ((__function__ 'ruler-extenders+)) (declare (ignorable __function__)) (if (not (irecursivep+ fn wrld)) (raise "The function ~x0 is not recursive." fn) (b* ((justification (getpropc fn 'justification nil wrld)) ((unless (weak-justification-p justification)) (raise "Internal error: ~ the 'JUSTIFICATION property ~x0 of ~x1 is not well-formed." justification fn)) (ruler-extenders (access justification justification :ruler-extenders)) ((unless (or (symbol-listp ruler-extenders) (eq ruler-extenders :all))) (raise "Internal error: ~ the well-founded relation ~x0 of ~x1 ~ is neither a true list of symbols nor :ALL." ruler-extenders fn))) ruler-extenders))))
(defthm return-type-of-ruler-extenders+ (b* ((ruler-extenders (ruler-extenders+ fn wrld))) (or (symbol-listp ruler-extenders) (equal ruler-extenders :all))) :rule-classes :rewrite)