GC is now eager in the cleanup of watchlists and more elaborate.
It starts by marking all clauses justifying literals on the trail,
because we cannot remove them yet (they might be used in resolution
steps during clause analysis).
Then, we sort set of learnt clauses by decreasing activity, and pop them
one by one until the target size is reached. Clauses that are marked,
because they are on the trail, are kept on the side so we can push them
back at the end.
For each clause we want to remove, we start by marking it "dead".
Then we mark its two watch literals are "dirty", which means we will
need to purge their watchlists from dead clauses.
Then we purge watchlists (remove deadclauses entirely). At this point
the dead clauses are unreachable from both trail and watchlists.
We can remove all data for each such clause, and put their index for
recycling so another new clause can reuse their slot.
Finally we unmark dirty literals and saved-by-trail-explanation
explanation clauses.
the idea is that most changes should be undone upon backtracking,
using the global `on_backtrack` command and `at_level_0` to
know when something is going to be permanent.
In particular, should be (possibly optionally) undone on backtracking:
- addition of clauses (clauses being attached)
- propagations of atoms
- addition of literals to the heap
- internalization of literals (tbd)
clauses should also be added immediately, not pushed into a queue