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