(abs-integer-alt tree) → int
Function:
(defun abs-integer-alt (tree) (declare (xargs :guard (abnf::treep tree))) (declare (xargs :guard (cst-matchp tree "integer"))) (let ((__function__ 'abs-integer-alt)) (declare (ignorable __function__)) (let ((int-or-err (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)))) (b* (((when (integerp int-or-err)) int-or-err) (- (er hard? 'top-level "problem in abs-integer-alt: ~x0" tree))) 0))))
Theorem:
(defthm integerp-of-abs-integer-alt (b* ((int (abs-integer-alt tree))) (integerp int)) :rule-classes :rewrite)
Theorem:
(defthm abs-integer-alt-of-tree-fix-tree (equal (abs-integer-alt (abnf::tree-fix tree)) (abs-integer-alt tree)))
Theorem:
(defthm abs-integer-alt-tree-equiv-congruence-on-tree (implies (abnf::tree-equiv tree tree-equiv) (equal (abs-integer-alt tree) (abs-integer-alt tree-equiv))) :rule-classes :congruence)