Computing weakest precondition of Imp programs directly in Z3. Requires reflection of smtlib expressions into expression datatypes and representing the variable store as an array. In principle, smtlib is it's own macro system.
Typically people use python or some other language to generate smtlib. Boogie and Why3 are frameworks that generate smtlib (among other things) from imperative code. We can remove one level of indirection by directly programming in Z3. There are so many other good abstractions that smtlib is just barely able to express in this style.
Upside:
- All in one system. Custom DSLs and logics that embed in the super power that is Z3
Downside:
- More for solver to do. There is no way to express everything can be done at compile time. The behavior of define-fun-rec is a bit finicky
- My encoding for WP of loops didn't seem to be playing very nice with define-fun-rec unfolding. Loops are kind of a big deal
- Verbose. Lots of boiler plate. Lack of higher order functions makes shallow embedding difficult / impossible. Some calculations in WP play with binding structures, so we have to go deep embedding