Recognize calls of a particular unary system function call.
For instance, to see if
(vl-unary-syscall-p "$bits" x)
Function:
(defun vl-unary-syscall-p (name x) (declare (xargs :guard (and (stringp name) (vl-expr-p x)))) (let ((__function__ 'vl-unary-syscall-p)) (declare (ignorable __function__)) (vl-expr-case x :vl-call (and x.systemp (equal (vl-simple-id-name x.name) (string-fix name)) (eql (len x.plainargs) 1) (car x.plainargs) (atom x.namedargs)) :otherwise nil)))
Theorem:
(defthm arity-stuff-about-vl-unary-syscall-p (implies (vl-unary-syscall-p name x) (vl-expr-case x :vl-call (and x.systemp (equal (vl-simple-id-name x.name) (string-fix name)) (eql (len x.plainargs) 1) (consp x.plainargs) (car x.plainargs) (atom x.namedargs)) :otherwise nil)) :rule-classes :forward-chaining)
Theorem:
(defthm vl-unary-syscall-p-of-str-fix-name (equal (vl-unary-syscall-p (str-fix name) x) (vl-unary-syscall-p name x)))
Theorem:
(defthm vl-unary-syscall-p-streqv-congruence-on-name (implies (streqv name name-equiv) (equal (vl-unary-syscall-p name x) (vl-unary-syscall-p name-equiv x))) :rule-classes :congruence)
Theorem:
(defthm vl-unary-syscall-p-of-vl-expr-fix-x (equal (vl-unary-syscall-p name (vl-expr-fix x)) (vl-unary-syscall-p name x)))
Theorem:
(defthm vl-unary-syscall-p-vl-expr-equiv-congruence-on-x (implies (vl-expr-equiv x x-equiv) (equal (vl-unary-syscall-p name x) (vl-unary-syscall-p name x-equiv))) :rule-classes :congruence)