@@ -96,6 +96,11 @@ module INT-SIMPLIFICATION-HASKELL [symbolic]
9696 rule { A +Int B #Equals C +Int B } => { A #Equals C } [simplification(40)]
9797 rule { A +Int B #Equals C +Int D } => { A -Int C #Equals D -Int B } [simplification(45), symbolic(A, C), concrete(B, D)]
9898
99+ rule 0 <Int A -Int B => B <Int A [simplification, symbolic(A, B)]
100+ rule 0 <=Int A -Int B => B <=Int A [simplification, symbolic(A, B)]
101+ rule 0 >Int A -Int B => B >Int A [simplification, symbolic(A, B)]
102+ rule 0 >=Int A -Int B => B >=Int A [simplification, symbolic(A, B)]
103+
99104endmodule
100105
101106module INT-SIMPLIFICATION-COMMON
@@ -148,6 +153,24 @@ module INT-SIMPLIFICATION-COMMON
148153
149154 rule (E *Int A) +Int B +Int C +Int D +Int (F *Int A) => ((E +Int F) *Int A) +Int B +Int C +Int D [simplification]
150155
156+ // Simplification of concrete multiplication
157+
158+ rule A *Int B <Int C => B <Int C /Int A
159+ requires 0 <Int A andBool 0 <=Int C andBool C modInt A ==Int 0
160+ [simplification(40 ), concrete(A, C), preserves-definedness]
161+
162+ rule A *Int B <=Int C => B <=Int C /Int A
163+ requires 0 <Int A andBool 0 <=Int C andBool C modInt A ==Int 0
164+ [simplification(40 ), concrete(A, C), preserves-definedness]
165+
166+ rule C <=Int A *Int B => C /Int A <=Int B
167+ requires 0 <Int A andBool 0 <=Int C andBool C modInt A ==Int 0
168+ [simplification(40 ), concrete(A, C), preserves-definedness]
169+
170+ rule C <Int A *Int B => C /Int A <Int B
171+ requires 0 <Int A andBool 0 <=Int C andBool C modInt A ==Int 0
172+ [simplification(40 ), concrete(A, C), preserves-definedness]
173+
151174 // ###########################################################################
152175 // div
153176 // ###########################################################################
@@ -169,6 +192,13 @@ module INT-SIMPLIFICATION-COMMON
169192 requires 0 <=Int A andBool 0 <=Int B andBool 0 <Int C andBool A <=Int D andBool B <=Int C
170193 [simplification, preserves-definedness]
171194
195+ rule ( A /Int B ) /Int C => 0
196+ requires 0 <=Int A
197+ andBool 0 <Int B
198+ andBool 0 <Int C
199+ andBool A <Int ( C *Int B )
200+ [simplification, symbolic(A, B), concrete(C), preserves-definedness]
201+
172202 // ###########################################################################
173203 // mod
174204 // ###########################################################################
@@ -223,4 +253,10 @@ module INT-SIMPLIFICATION-COMMON
223253
224254 rule A -Int B +Int C <=Int D => false requires D <Int A -Int B andBool 0 <=Int C [simplification]
225255
256+ rule A ==Int B => false requires 0 <=Int A andBool B <Int 0 [simplification, concrete(B)]
257+
258+ rule 0 <Int X => true requires 0 <=Int X andBool notBool (X ==Int 0) [simplification(60 )]
259+
260+ rule X <=Int maxUInt256 => X <Int pow256 [simplification]
261+
226262endmodule
0 commit comments