Maximum mathematical integer value of an integer type.
For now we exclude the plain
Function:
(defun integer-type-max (type) (declare (xargs :guard (typep type))) (declare (xargs :guard (type-nonchar-integerp type))) (let ((__function__ 'integer-type-max)) (declare (ignorable __function__)) (cond ((type-case type :schar) (schar-max)) ((type-case type :uchar) (uchar-max)) ((type-case type :sshort) (sshort-max)) ((type-case type :ushort) (ushort-max)) ((type-case type :sint) (sint-max)) ((type-case type :uint) (uint-max)) ((type-case type :slong) (slong-max)) ((type-case type :ulong) (ulong-max)) ((type-case type :sllong) (sllong-max)) ((type-case type :ullong) (ullong-max)) (t (prog2$ (impossible) 0)))))
Theorem:
(defthm integerp-of-integer-type-max (b* ((min (integer-type-max type))) (integerp min)) :rule-classes :rewrite)
Theorem:
(defthm integer-type-max-of-type-fix-type (equal (integer-type-max (type-fix type)) (integer-type-max type)))
Theorem:
(defthm integer-type-max-type-equiv-congruence-on-type (implies (type-equiv type type-equiv) (equal (integer-type-max type) (integer-type-max type-equiv))) :rule-classes :congruence)