Fix var type inference2

Giving it another try.
Probably @andreistefanescu would be able to explain better how this goes, but here is how I view it.
In regard to defining functions, there are a few rules:
 a) the function must be at the top
 b) the rewrite must have a decreasing sort (right hand side of rewrite must have sort <= left hand side sort)
From what Andrei told me, if the rewrite is not at the top, then the compilation process will bring it at the top at one point, so I will end up rewriting myFunction to myFunction. So, yes, this would be safe.
Does this explanation seem reasonable?