Removes the redundant weakenings and contractions.
Traverses the proof top down, keeping track of the weakened formulas in ws.
When processing each rule, checks whether the auxiliary formulas are in ws.
If all were previously weakened, remove them from ws and adds the main formula.
I am aware the code is really really hard to read. I am sorry for that.
In order to get it properly optimized, I had to use continuation-passing-style
and the TailCall library from scala. This makes it particularly exotic.
If you are going through the trouble of reading it (so brave of you ;),
it's good to keep the following in mind:
1. Ignore tailcalls and everything associated with it
2. Treat the continuation call not as a function call but as if its arguments
were the return value of the function.
The answer to the optimization was found here:
http://stackoverflow.com/questions/20164061/how-to-acheive-tail-call-optimization-while-traversing-tree-like-structure-using
Removes the redundant weakenings and contractions. Traverses the proof top down, keeping track of the weakened formulas in ws. When processing each rule, checks whether the auxiliary formulas are in ws. If all were previously weakened, remove them from ws and adds the main formula.
I am aware the code is really really hard to read. I am sorry for that. In order to get it properly optimized, I had to use continuation-passing-style and the TailCall library from scala. This makes it particularly exotic. If you are going through the trouble of reading it (so brave of you ;), it's good to keep the following in mind: 1. Ignore tailcalls and everything associated with it 2. Treat the continuation call not as a function call but as if its arguments were the return value of the function.
The answer to the optimization was found here: http://stackoverflow.com/questions/20164061/how-to-acheive-tail-call-optimization-while-traversing-tree-like-structure-using