Hello! Not to be nitpicking, but mod expression actually performs rem operation :)
(https://i.imgur.com/6KC2rQk.png)
Mod and Rem are not the same
- https://stackoverflow.com/questions/5891140/difference-between-mod-and-rem-in-haskell/28027235#28027235
- https://www.quora.com/I-am-a-beginner-in-MATLAB-programming-What-is-the-difference-between-the-two-operations-rem-and-mod-How-are-both-functionally-different
At the moment mod performs "remainder" operation, not "modulo". This might cause problems.
Concern
Mod rule implemented using the internal %Int operation:
rule <k> #exec REG = mod W0 , W1 => #load REG W0 %Int W1 ... </k> requires W1 =/=Int 0
(https://github.com/runtimeverification/iele-semantics/blob/master/iele.md#expressions)
The % operation is not obvious in the history of languages, e.g.:
- In Python
% is Mod
- In Java
% is Rem
The concern is that if %Int operation is implemented in K using the % in an underlying language - IELE might return different results for mod operation on different backends. Imo, there need to be strict guarantees on the mod operation contract, describing how exactly mod should work, backend-agnostic.
Hello! Not to be nitpicking, but
modexpression actually performsremoperation :)(https://i.imgur.com/6KC2rQk.png)
ModandRemare not the sameAt the moment
modperforms "remainder" operation, not "modulo". This might cause problems.Concern
Modrule implemented using the internal%Intoperation:(https://github.com/runtimeverification/iele-semantics/blob/master/iele.md#expressions)
The
%operation is not obvious in the history of languages, e.g.:%isMod%isRemThe concern is that if
%Intoperation is implemented in K using the%in an underlying language - IELE might return different results formodoperation on different backends. Imo, there need to be strict guarantees on themodoperation contract, describing how exactlymodshould work, backend-agnostic.