With the recently added reaching definitions analysis, it is straightforward to implement a program transformation that performs
constant folding.To ensure soundness in concurrent settings, it should be combined with the existing is_threaded analysis.
(A concurrency-aware version of reaching definitions now exists and is awaiting a merge.) Along the way, assertions that become
trivially true should be eliminated.