Check if a token is a given keyword.
(token-keywordp token keyword) → yes/no
This operates on an optional token, since we normally call this function on an optional token.
Function:
(defun token-keywordp (token keyword) (declare (xargs :guard (and (token-optionp token) (stringp keyword)))) (let ((__function__ 'token-keywordp)) (declare (ignorable __function__)) (and token (token-case token :keyword) (equal (token-keyword->unwrap token) keyword))))
Theorem:
(defthm booleanp-of-token-keywordp (b* ((yes/no (token-keywordp token keyword))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm non-nil-when-token-keywordp (implies (token-keywordp token keyword) token) :rule-classes :forward-chaining)