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__)) (b* (((when (vl-fast-atom-p x)) nil) ((vl-nonatom x)) ((unless (and (eq x.op :vl-syscall) (consp x.args) (consp (cdr x.args)) (atom (cddr x.args)))) nil) (fn (first x.args)) ((unless (vl-sysfunexpr-p fn)) nil)) (equal (vl-sysfunexpr->name fn) (string-fix name)))))
Theorem:
(defthm arity-stuff-about-vl-unary-syscall-p (implies (vl-unary-syscall-p name x) (and (not (equal (vl-expr-kind x) :atom)) (equal (vl-nonatom->op x) :vl-syscall) (consp (vl-nonatom->args x)) (consp (cdr (vl-nonatom->args x))) (vl-expr-p (cadr (vl-nonatom->args x))))) :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)