perf: avoid exponential traversal in smart unfolding

This PR fixes a performance issue where smart unfolding could take exponential time on function arguments with shared subterms. The new regression tests expose the slowdown. The `loop` and `acc` proofs now take about 21 and 42 heartbeats, respectively.
3 files changed