Reduce recursion in term formula removal (#5052)
This reduces the use of recursion in term formula removal module. The recursion depth is now limited to the number of term positions on a path where a formula must be removed, instead of being limited to the overall formula depth. This PR also fixes some documentation.
Notice for its main cache d_tfCache, this class uses a CDInsertHashMap (instead of a CDHashMap) which does not allow inserting more than once, hence an auxliary "processedChildren" vector had to be introduced to track whether we have processed children. It's not clear to me whether we should just use the more standard CDHashMap, which would simplify this.
One non-linear arithmetic regression went unsat -> unknown, I added --nl-ext-tplanes to fix this.
This should fix #4889. It is possible to further reduce the recursion in this pass, which can be done on a followup PR if needed.