And you get the classic associativity problem. If, by swapping things, we would have gotten the same expression, it would have been a contradiction, proving that addition was not commutative, but it is not the case here.
It means that if addition is not associative, which we know is the case, then your example doesn't prove that addition is not commutative.
Of course, I didn't prove that in general, addition is commutative, but it has no reason not to be.
I may be overlooking your point. x-x+1 is evaluated left to right like any other additive expression, and after the x-x part is evaluated, the intermediate result is zero. This would be the case with any numeric type, wouldn't it?
Subtraction is obviously not commutative, so let's rewrite as an addition.
Now write the implicit parenthesis Now since we assumed addition is commutative, let swap a few things And you get the classic associativity problem. If, by swapping things, we would have gotten the same expression, it would have been a contradiction, proving that addition was not commutative, but it is not the case here.It means that if addition is not associative, which we know is the case, then your example doesn't prove that addition is not commutative.
Of course, I didn't prove that in general, addition is commutative, but it has no reason not to be.