source: CIVL/mods/dev.civl.sarl/doc/ideasAndExamplesOfIntDivTranslation@ 1aaefd4

main test-branch
Last change on this file since 1aaefd4 was aad342c, checked in by Stephen Siegel <siegel@…>, 3 years ago

Performing huge refactor to incorporate ABC, GMC, and SARL into CIVL repo and use Java modules.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5664 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[aad342c]1In the examples, those examples will be translating into same thing no matter their vars are quantified or not.
2
3example 1:
4
5a/b=3
6will be translated to
7Exists q1, r1 : (b * q1 + r1 = a and |r1| < |b| and (sign(a) = sign(r1) || r1 = 0) and q1 = 3)
8
9example2:
10
11a/b + c%d = 5
12will be translated into
13
14Exists q1, r1, q2, r2: (
15q1*b+r1 = a and |r1| < |b| and ( sign(a) = sign(r1) || r1 = 0 ) //this is the translation of a/b
16and q2*d + r2 = c and |r2| < |d| and ( sign(c) = sign(r2) || r2 = 0) // this is the translation of c%d
17and q1 + r2 = 5 // this is the translation of the whole boolean expression
18)
19
20
21________________________________________________________________
22my basic idea is that:
231. when encounter a divide or modulo (a/b), you will get two things: constraints (b*q + r =a) and value of the expression (q).
242. when encounter a '+' or '-' or '*' or ..., the result the which is not a boolean expression (like the result of a+b is not a boolean), you will just merge the constraints and pop the value of the expression and the constraints up to the stack.
253.when you encounter a '=' or '<' or '<=', the result of which is a booleanExpression. you will generate a Exists expression just like those examples. Because we only conside expression within Forall and Exist, so finally we will reach to a BooleanExpression.
Note: See TracBrowser for help on using the repository browser.