Case macro for the different kinds of binary-op structures.
This is an ACL2::fty sum-type case macro, typically introduced by fty::defflexsum or fty::deftagsum. It allows you to safely check the type of a binary-op structure, or to split into cases based on its type.
In its short form,
(binary-op-case x :add)
is essentially just a safer alternative to writing:
(equal (binary-op-kind x) :add)
Why is using binary-op-case safer? When we directly inspect the
kind with
In its longer form,
(binary-op-case x :add ... :add.w ... :sub ... :sub.w ... :mul ... :mul.w ... :div ... :div.w ... :rem ... :rem.w ... :mod ... :pow ... :pow.w ... :shl ... :shl.w ... :shr ... :shr.w ... :and ... :or ... :xor ... :nand ... :nor ... :gt ... :gte ... :lt ... :lte ...)
It is also possible to consolidate ``uninteresting'' cases using
For convenience, the case macro automatically binds the fields of