-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib-function.mzn
57 lines (38 loc) · 1.18 KB
/
lib-function.mzn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
% Use this editor as a MiniZinc scratch book
% Use this editor as a MiniZinc scratch book
% Use this editor as a MiniZinc scratch book
%NAME:test1
int: n=10;
var -n..n:x;
var -n..n:y;
var -n..n:z;
var -n..n:u;
array[1..2] of int : comp_cont;
comp_cont=[1,2];
% c1
function var int: c1(var int:y,var int:z, var int:x) =
y !=0 -> z= x div y;
% c2
function var int: c2(var int:u, var int:x) =
true -> x>u ;
% compatibility
function var int: c1_compatibility(var int:y,var int:z, var int:x) =
y !=0 \/ x!=0 -> true;
% consistency
function var int: c1_consistency(var int:y,var int:z, var int:x) =
(y !=0 -> z= x div y)/\
z !=0 -> true;
% composition
function var int: c1_composition_c2(var int:y,var int:z, var int:x, var int:u) =
(y !=0 -> z= x div y) /\
true -> x>u ;
% c3 (timing contract)
function var int: c3( var int:tx,var int:ty,var int:tz ) =
true -> tz= max(tx ,ty) + 1;
%conjunction
function var int: c1_conjunction_c3(var int:y,var int:z, var int:x,
var int:tx,var int:ty,var int:tz ) =
y !=0 -> tz= max(tx ,ty) + 1;
% c1_refinement
function var int: c1_refinement(var int:y,var int:z, var int:x) =
y !=0 /\ y>0 -> z=true;