-
Notifications
You must be signed in to change notification settings - Fork 0
/
1(i).als
114 lines (80 loc) · 1.84 KB
/
1(i).als
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// load fm signatures
open fm
one sig FM1, FM2, FMUnion, FMIntersection extends FM{}
one sig Fp, Fi extends Name{}
// == FM1
fact FM1Features {
FM1.features = Fp + Fi
}
pred FM1Semantics[config:set Name] {
--fixed
config in FM1.features
root[Fp, config]
--relations
nonselectable[Fp, Fi, config]
--formulas
}
// == FM2
fact FM2Features {
FM2.features = Fp + Fi
}
pred FM2Semantics[config:set Name] {
--fixed
config in FM2.features
root[Fp, config]
--relations
mandatory[Fp, Fi, config]
--formulas
}
// == FMUnion
fact FMUnion{
FMUnion.features = Fp + Fi
}
pred FMUnionSemantics[config:set Name] {
--fixed
config in FMUnion.features
root[Fp, config]
--relations
optional[Fp, Fi, config]
--formulas
}
// == FMIntersection
fact FMIntersection{
FMIntersection.features = Fp + Fi
}
pred FMIntersectionSemantics[config:set Name] {
// empty set
config not in FMIntersection.features
}
// == Hints to generate configurations
fact configurationHints {
some c: set Name | Fp + Fi in c
some c: set Name | Fp in c
some c: set Name | Fp not in c
some c: set Name | Fi in c
some c: set Name | Fi not in c
}
// == verifications
assert isUnion1{
all c:set Name | FMUnionSemantics[c] =>
(FM1Semantics[c] or FM2Semantics[c])
}
assert isUnion2 {
no c:set Name | FM1Semantics[c] and not FMUnionSemantics[c]
}
assert isUnion3 {
no c:set Name | FM2Semantics[c] and not FMUnionSemantics[c]
}
assert isIntersection1{
all c:set Name | FMIntersectionSemantics[c] =>
(FM1Semantics[c] and FM2Semantics[c])
}
assert isIntersection2{
no c:set Name | (FM1Semantics[c] and FM2Semantics[c])
and not FMIntersectionSemantics[c]
}
check isUnion1 for 8 FM, 2 Name
check isUnion2 for 8 FM, 2 Name
check isUnion3 for 8 FM, 2 Name
check isIntersection1 for 8 FM, 2 Name
check isIntersection2 for 8 FM, 2 Name