Turn a C integer value into a mathematical (i.e. ACL2) integer.
Function:
(defun value-integer->get (val) (declare (xargs :guard (valuep val))) (declare (xargs :guard (value-integerp val))) (let ((__function__ 'value-integer->get)) (declare (ignorable __function__)) (value-case val :uchar val.get :schar val.get :ushort val.get :sshort val.get :uint val.get :sint val.get :ulong val.get :slong val.get :ullong val.get :sllong val.get :pointer (ifix (impossible)) :array (ifix (impossible)) :struct (ifix (impossible)))))
Theorem:
(defthm integerp-of-value-integer->get (b* ((int (value-integer->get val))) (integerp int)) :rule-classes :rewrite)
Theorem:
(defthm value-integer->get-bounds (and (<= (integer-type-min (type-of-value val)) (value-integer->get val)) (<= (value-integer->get val) (integer-type-max (type-of-value val)))) :rule-classes ((:linear :trigger-terms ((value-integer->get val)))))
Theorem:
(defthm value-integer->get-of-value-fix-val (equal (value-integer->get (value-fix val)) (value-integer->get val)))
Theorem:
(defthm value-integer->get-value-equiv-congruence-on-val (implies (value-equiv val val-equiv) (equal (value-integer->get val) (value-integer->get val-equiv))) :rule-classes :congruence)