Case macro for the different kinds of binop 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 binop structure, or to split into cases based on its type.
In its short form,
(binop-case x :and)
is essentially just a safer alternative to writing:
(equal (binop-kind x) :and)
Why is using binop-case safer? When we directly inspect the
kind with
In its longer form,
(binop-case x :and ... :or ... :eq ... :ne ... :ge ... :gt ... :le ... :lt ... :bitxor ... :bitior ... :bitand ... :shl ... :shr ... :add ... :sub ... :mul ... :div ... :rem ... :pow ... :nand ... :nor ... :shl-wrapped ... :shr-wrapped ... :add-wrapped ... :sub-wrapped ... :mul-wrapped ... :div-wrapped ... :rem-wrapped ... :pow-wrapped ...)
It is also possible to consolidate ``uninteresting'' cases using
For convenience, the case macro automatically binds the fields of