SAT encoding of product types is easy: just concatenate encodings of components. Ersatz already has this. For sum types like Either a b, Maybe a, we can encode the discriminant (the number of the constructor) and can overlay the encodings of the components. For programs on such data, we want to encode pattern matching.
SAT encoding of product types is easy: just concatenate encodings of components. Ersatz already has this. For sum types like
Either a b
,Maybe a
, we can encode the discriminant (the number of the constructor) and can overlay the encodings of the components. For programs on such data, we want to encode pattern matching.My student did this via template Haskell (https://nbn-resolving.org/urn:nbn:de:bsz:14-qucosa-221884). Perhaps we can have a simple variant in plain Haskell, perhaps similar to https://mail.haskell.org/pipermail/haskell-cafe/2020-September/132650.html .
I am not implying that their implementation is simple, but it certainly looks simple to use in the given example.