other
(in-package "LRAT")
other
(defconst *2^0* (expt 2 0))
other
(defconst *2^1* (expt 2 1))
other
(defconst *2^2* (expt 2 2))
other
(defconst *2^3* (expt 2 3))
other
(defconst *2^4* (expt 2 4))
other
(defconst *2^5* (expt 2 5))
other
(defconst *2^6* (expt 2 6))
other
(defconst *2^8* (expt 2 8))
other
(defconst *2^10* (expt 2 10))
other
(defconst *2^16* (expt 2 16))
other
(defconst *2^24* (expt 2 24))
other
(defconst *2^28* (expt 2 28))
other
(defconst *2^32* (expt 2 32))
other
(defconst *2^40* (expt 2 40))
other
(defconst *2^48* (expt 2 48))
other
(defconst *2^56* (expt 2 56))
other
(defconst *2^57* (expt 2 57))
other
(defconst *2^58* (expt 2 58))
other
(defconst *2^59* (expt 2 59))
other
(defconst *2^60* (expt 2 60))
other
(defconst *2^64* (expt 2 64))
other
(defconst *nmax* *2^59*)
i01macro
(defmacro i01 (x) `(let ((sx (logand ,LRAT::X ,(1- LRAT::*2^1*)))) (if (>= sx *2^0*) (+ sx (- *2^1*)) sx)))
i02macro
(defmacro i02 (x) `(let ((sx (logand ,LRAT::X ,(1- LRAT::*2^2*)))) (if (>= sx *2^1*) (+ sx (- *2^2*)) sx)))
i03macro
(defmacro i03 (x) `(let ((sx (logand ,LRAT::X ,(1- LRAT::*2^3*)))) (if (>= sx *2^2*) (+ sx (- *2^3*)) sx)))
i04macro
(defmacro i04 (x) `(let ((sx (logand ,LRAT::X ,(1- LRAT::*2^4*)))) (if (>= sx *2^3*) (+ sx (- *2^4*)) sx)))
i05macro
(defmacro i05 (x) `(let ((sx (logand ,LRAT::X ,(1- LRAT::*2^5*)))) (if (>= sx *2^4*) (+ sx (- *2^5*)) sx)))
i06macro
(defmacro i06 (x) `(let ((sx (logand ,LRAT::X ,(1- LRAT::*2^6*)))) (if (>= sx *2^5*) (+ sx (- *2^6*)) sx)))
i08macro
(defmacro i08 (x) `(let ((sx (logand ,LRAT::X ,(1- LRAT::*2^8*)))) (if (>= sx *2^7*) (+ sx (- *2^8*)) sx)))
i10macro
(defmacro i10 (x) `(let ((sx (logand ,LRAT::X ,(1- LRAT::*2^10*)))) (if (>= sx *2^9*) (+ sx (- *2^10*)) sx)))
i16macro
(defmacro i16 (x) `(let ((sx (logand ,LRAT::X ,(1- LRAT::*2^16*)))) (if (>= sx *2^15*) (+ sx (- *2^16*)) sx)))
i24macro
(defmacro i24 (x) `(let ((sx (logand ,LRAT::X ,(1- LRAT::*2^24*)))) (if (>= sx *2^23*) (+ sx (- *2^24*)) sx)))
i32macro
(defmacro i32 (x) `(let ((sx (logand ,LRAT::X ,(1- LRAT::*2^32*)))) (if (>= sx *2^31*) (+ sx (- *2^32*)) sx)))
i40macro
(defmacro i40 (x) `(let ((sx (logand ,LRAT::X ,(1- LRAT::*2^40*)))) (if (>= sx *2^39*) (+ sx (- *2^40*)) sx)))
i48macro
(defmacro i48 (x) `(let ((sx (logand ,LRAT::X ,(1- LRAT::*2^48*)))) (if (>= sx *2^47*) (+ sx (- *2^48*)) sx)))
i56macro
(defmacro i56 (x) `(let ((sx (logand ,LRAT::X ,(1- LRAT::*2^56*)))) (if (>= sx *2^55*) (+ sx (- *2^56*)) sx)))
i57macro
(defmacro i57 (x) `(let ((sx (logand ,LRAT::X ,(1- LRAT::*2^57*)))) (if (>= sx *2^56*) (+ sx (- *2^57*)) sx)))
i58macro
(defmacro i58 (x) `(let ((sx (logand ,LRAT::X ,(1- LRAT::*2^58*)))) (if (>= sx *2^57*) (+ sx (- *2^58*)) sx)))
i60macro
(defmacro i60 (x) `(let ((sx (logand ,LRAT::X ,(1- LRAT::*2^60*)))) (if (>= sx *2^59*) (+ sx (- *2^60*)) sx)))
i64macro
(defmacro i64 (x) `(let ((sx (logand ,LRAT::X ,(1- LRAT::*2^64*)))) (if (>= sx *2^63*) (+ sx (- *2^64*)) sx)))
i16pmacro
(defmacro i16p (x) `(let ((x ,LRAT::X)) (and (integerp x) (<= (- *2^15*) x) (< x *2^15*))))
i24pmacro
(defmacro i24p (x) `(let ((x ,LRAT::X)) (and (integerp x) (<= (- *2^23*) x) (< x *2^23*))))
i28pmacro
(defmacro i28p (x) `(let ((x ,LRAT::X)) (and (integerp x) (<= (- *2^27*) x) (< x *2^27*))))
i32pmacro
(defmacro i32p (x) `(let ((x ,LRAT::X)) (and (integerp x) (<= (- *2^31*) x) (< x *2^31*))))
i40pmacro
(defmacro i40p (x) `(let ((x ,LRAT::X)) (and (integerp x) (<= (- *2^39*) x) (< x *2^39*))))
i48pmacro
(defmacro i48p (x) `(let ((x ,LRAT::X)) (and (integerp x) (<= (- *2^47*) x) (< x *2^47*))))
i56pmacro
(defmacro i56p (x) `(let ((x ,LRAT::X)) (and (integerp x) (<= (- *2^55*) x) (< x *2^55*))))
i57pmacro
(defmacro i57p (x) `(let ((x ,LRAT::X)) (and (integerp x) (<= (- *2^56*) x) (< x *2^56*))))
i58pmacro
(defmacro i58p (x) `(let ((x ,LRAT::X)) (and (integerp x) (<= (- *2^57*) x) (< x *2^57*))))
i60pmacro
(defmacro i60p (x) `(let ((x ,LRAT::X)) (and (integerp x) (<= (- *2^59*) x) (< x *2^59*))))
i64pmacro
(defmacro i64p (x) `(let ((x ,LRAT::X)) (and (integerp x) (<= (- *2^63*) x) (< x *2^63*))))
n59-listpfunction
(defun n59-listp (xs) (declare (xargs :guard t)) (if (atom xs) (null xs) (and (n59p (car xs)) (n59-listp (cdr xs)))))
other
(defthm n59-listp-forward (implies (n59-listp x) (true-listp x)) :rule-classes (:forward-chaining :rewrite))
other
(defthm nth-n59-listp (implies (and (n59-listp xs) (natp i) (< i (len xs))) (n59p (nth i xs))) :rule-classes ((:type-prescription :corollary (implies (and (n59-listp xs) (natp i) (< i (len xs))) (natp (nth i xs)))) (:linear :corollary (implies (and (n59-listp xs) (natp i) (< i (len xs))) (and (<= 0 (nth i xs)) (< (nth i xs) *2^59*))))))
i60-listpfunction
(defun i60-listp (xs) (declare (xargs :guard t)) (if (atom xs) (null xs) (and (i60p (car xs)) (i60-listp (cdr xs)))))
other
(defthm i60-listp-forward (implies (i60-listp x) (true-listp x)) :rule-classes (:forward-chaining :rewrite))
other
(defthm nth-i60-listp (implies (and (i60-listp xs) (natp i) (< i (len xs))) (i60p (nth i xs))) :rule-classes ((:type-prescription :corollary (implies (and (i60-listp xs) (natp i) (< i (len xs))) (integerp (nth i xs)))) (:linear :corollary (implies (and (i60-listp xs) (natp i) (< i (len xs))) (and (<= (- *2^59*) (nth i xs)) (< (nth i xs) *2^59*))))))