Abstract an
(abs-integer tree) → int
Function:
(defun abs-integer (tree) (declare (xargs :guard (abnf::treep tree))) (let ((__function__ 'abs-integer)) (declare (ignorable __function__)) (b* (((okf (abnf::tree-list-tuple2 sub)) (check-tree-nonleaf-2 tree "integer")) ((okf optional-minus-tree) (check-tree-list-1 sub.1st)) ((okf has-minus-sign?) (check-optional-minus-sign-p optional-minus-tree)) ((okf numeral-tree) (check-tree-list-1 sub.2nd)) ((okf nat-value) (abs-numeral numeral-tree))) (if has-minus-sign? (- nat-value) nat-value))))
Theorem:
(defthm integer-resultp-of-abs-integer (b* ((int (abs-integer tree))) (integer-resultp int)) :rule-classes :rewrite)
Theorem:
(defthm abs-integer-of-tree-fix-tree (equal (abs-integer (abnf::tree-fix tree)) (abs-integer tree)))
Theorem:
(defthm abs-integer-tree-equiv-congruence-on-tree (implies (abnf::tree-equiv tree tree-equiv) (equal (abs-integer tree) (abs-integer tree-equiv))) :rule-classes :congruence)