Check a constant.
(check-const c) → etype
For now we only accept integer constants.
We return an expression type. A constant is never an lvalue.
This is the static counterpart of exec-const.
Function:
(defun check-const (c) (declare (xargs :guard (constp c))) (let ((__function__ 'check-const)) (declare (ignorable __function__)) (const-case c :int (b* (((okf type) (check-iconst c.get))) (make-expr-type :type type :lvalue nil)) :float (reserrf (list :unsupported-float-const (const-fix c))) :enum (reserrf (list :unsupported-enum-const (const-fix c))) :char (reserrf (list :unsupported-char-const (const-fix c))))))
Theorem:
(defthm expr-type-resultp-of-check-const (b* ((etype (check-const c))) (expr-type-resultp etype)) :rule-classes :rewrite)
Theorem:
(defthm check-const-of-const-fix-c (equal (check-const (const-fix c)) (check-const c)))
Theorem:
(defthm check-const-const-equiv-congruence-on-c (implies (const-equiv c c-equiv) (equal (check-const c) (check-const c-equiv))) :rule-classes :congruence)