forked from conjure-cp/conjure-oxide
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add modulo expressions, parsing, and conversion rules to Minion. The undefinedness semantics for modulo are similar to those for division: it requires a bubble rule, asserting that for x % y, y!=0, to make it safe. Due to their similarity, the test cases for modulo in this patch are based on the division ones. See also: conjure-cp#454 (implementation of division rules) Closes: conjure-cp#456
- Loading branch information
1 parent
0ca861f
commit 7579a40
Showing
56 changed files
with
5,324 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
find a,b : int(0..3) | ||
such that a % b = 1 |
14 changes: 14 additions & 0 deletions
14
conjure_oxide/tests/integration/basic/mod/01/input.expected-minion.solutions.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[ | ||
{ | ||
"a": 1, | ||
"b": 2 | ||
}, | ||
{ | ||
"a": 1, | ||
"b": 3 | ||
}, | ||
{ | ||
"a": 3, | ||
"b": 2 | ||
} | ||
] |
94 changes: 94 additions & 0 deletions
94
conjure_oxide/tests/integration/basic/mod/01/input.expected-parse.serialised.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
{ | ||
"constraints": { | ||
"Eq": [ | ||
{ | ||
"clean": false, | ||
"etype": null | ||
}, | ||
{ | ||
"UnsafeMod": [ | ||
{ | ||
"clean": false, | ||
"etype": null | ||
}, | ||
{ | ||
"Atomic": [ | ||
{ | ||
"clean": false, | ||
"etype": null | ||
}, | ||
{ | ||
"Reference": { | ||
"UserName": "a" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"Atomic": [ | ||
{ | ||
"clean": false, | ||
"etype": null | ||
}, | ||
{ | ||
"Reference": { | ||
"UserName": "b" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"Atomic": [ | ||
{ | ||
"clean": false, | ||
"etype": null | ||
}, | ||
{ | ||
"Literal": { | ||
"Int": 1 | ||
} | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"next_var": 0, | ||
"variables": [ | ||
[ | ||
{ | ||
"UserName": "a" | ||
}, | ||
{ | ||
"domain": { | ||
"IntDomain": [ | ||
{ | ||
"Bounded": [ | ||
0, | ||
3 | ||
] | ||
} | ||
] | ||
} | ||
} | ||
], | ||
[ | ||
{ | ||
"UserName": "b" | ||
}, | ||
{ | ||
"domain": { | ||
"IntDomain": [ | ||
{ | ||
"Bounded": [ | ||
0, | ||
3 | ||
] | ||
} | ||
] | ||
} | ||
} | ||
] | ||
] | ||
} |
106 changes: 106 additions & 0 deletions
106
conjure_oxide/tests/integration/basic/mod/01/input.expected-rewrite.serialised.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
{ | ||
"constraints": { | ||
"And": [ | ||
{ | ||
"clean": false, | ||
"etype": null | ||
}, | ||
[ | ||
{ | ||
"ModEq": [ | ||
{ | ||
"clean": false, | ||
"etype": null | ||
}, | ||
{ | ||
"Reference": { | ||
"UserName": "a" | ||
} | ||
}, | ||
{ | ||
"Reference": { | ||
"UserName": "b" | ||
} | ||
}, | ||
{ | ||
"Literal": { | ||
"Int": 1 | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"Neq": [ | ||
{ | ||
"clean": false, | ||
"etype": null | ||
}, | ||
{ | ||
"Atomic": [ | ||
{ | ||
"clean": false, | ||
"etype": null | ||
}, | ||
{ | ||
"Reference": { | ||
"UserName": "b" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"Atomic": [ | ||
{ | ||
"clean": false, | ||
"etype": null | ||
}, | ||
{ | ||
"Literal": { | ||
"Int": 0 | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
] | ||
}, | ||
"next_var": 0, | ||
"variables": [ | ||
[ | ||
{ | ||
"UserName": "a" | ||
}, | ||
{ | ||
"domain": { | ||
"IntDomain": [ | ||
{ | ||
"Bounded": [ | ||
0, | ||
3 | ||
] | ||
} | ||
] | ||
} | ||
} | ||
], | ||
[ | ||
{ | ||
"UserName": "b" | ||
}, | ||
{ | ||
"domain": { | ||
"IntDomain": [ | ||
{ | ||
"Bounded": [ | ||
0, | ||
3 | ||
] | ||
} | ||
] | ||
} | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
find a : int(0..3) | ||
such that a >= 4 % 2 $ should be simplified to constant |
14 changes: 14 additions & 0 deletions
14
conjure_oxide/tests/integration/basic/mod/02/input.expected-minion.solutions.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[ | ||
{ | ||
"a": 0 | ||
}, | ||
{ | ||
"a": 1 | ||
}, | ||
{ | ||
"a": 2 | ||
}, | ||
{ | ||
"a": 3 | ||
} | ||
] |
77 changes: 77 additions & 0 deletions
77
conjure_oxide/tests/integration/basic/mod/02/input.expected-parse.serialised.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{ | ||
"constraints": { | ||
"Geq": [ | ||
{ | ||
"clean": false, | ||
"etype": null | ||
}, | ||
{ | ||
"Atomic": [ | ||
{ | ||
"clean": false, | ||
"etype": null | ||
}, | ||
{ | ||
"Reference": { | ||
"UserName": "a" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"UnsafeMod": [ | ||
{ | ||
"clean": false, | ||
"etype": null | ||
}, | ||
{ | ||
"Atomic": [ | ||
{ | ||
"clean": false, | ||
"etype": null | ||
}, | ||
{ | ||
"Literal": { | ||
"Int": 4 | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"Atomic": [ | ||
{ | ||
"clean": false, | ||
"etype": null | ||
}, | ||
{ | ||
"Literal": { | ||
"Int": 2 | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"next_var": 0, | ||
"variables": [ | ||
[ | ||
{ | ||
"UserName": "a" | ||
}, | ||
{ | ||
"domain": { | ||
"IntDomain": [ | ||
{ | ||
"Bounded": [ | ||
0, | ||
3 | ||
] | ||
} | ||
] | ||
} | ||
} | ||
] | ||
] | ||
} |
Oops, something went wrong.