implemented w for if-then-else and fix

Signed-off-by: Pepijn Kokke <pepijn.kokke@gmail.com>
I am wicked awesome, and also algorithm W is kinda failing.
fixed bug in inference rule of app, may still be bugs in other rules that use unify

Signed-off-by: Pepijn Kokke <pepijn.kokke@gmail.com>