use a fresh result cache for each subformula

Usually, not many (if any) results can be shared between subformulae,
so this improves the library's performance for many benchmarks.