Case macro for the different kinds of expression 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 expression structure, or to split into cases based on its type.
In its short form,
(expression-case x :literal)
is essentially just a safer alternative to writing:
(equal (expression-kind x) :literal)
Why is using expression-case safer? When we directly inspect the
kind with
In its longer form,
(expression-case x :literal ... :var/const ... :assoc-const ... :unary ... :binary ... :cond ... :unit ... :tuple ... :tuple-component ... :struct ... :struct-component ... :internal-call ... :external-call ... :static-call ...)
It is also possible to consolidate ``uninteresting'' cases using
For convenience, the case macro automatically binds the fields of