-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathToyProblem.als
executable file
·89 lines (73 loc) · 1.71 KB
/
ToyProblem.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
module schedule
abstract sig Node{
// parent: lone Node
// children: set Node
nextSet: set Node
}
sig Intermediate extends Node{
childrenof: set Node,
child: one SeqChild
}
sig Choice extends Node{
children: set Leaf,
refInt: set Intermediate
}
sig Sequential extends Node{
child: one SeqChild
}
sig SeqChild extends Node{
nextChild, prevChild: lone SeqChild
}
abstract sig Leaf extends Node{
parent: one Node
}
one sig Sched {
header: one SchedEl
}
sig SchedEl {
nextEl: lone SchedEl,
ref: one Leaf//,
//reftwo: one Choice
}
fact NoCycles{
// all n, n': Node | n' in n.*next => n !in n'.*next
all n:Sched.header.*nextEl|n !in n.^nextEl
}
fact DistinctLeaves {
all t, t': SchedEl | t.ref = t'.ref => t = t'
}
fact scheduleConnected{
SchedEl = Sched.header.*nextEl
all n:SchedEl | no n.nextEl || n in Sched.header.*nextEl
}
fact scheduleConsistent{
all n, n':SchedEl | n' = n.nextEl => n'.ref in n.ref.nextSet
}
fact allNodesInSched{
// Node = SchedEl.ref
SeqChild = SchedEl.ref.parent || Intermediate = SchedEl.ref.parent
}
fact noSelfNext{
all n:Node | n !in n.nextSet
}
fact enforcePrecedence{
// all s: SchedEl | s.ref in M2 => s.^nextEl.ref !in M1
SchedEl = Sched.header.*nextEl
all n,m:SchedEl | (n.ref.parent = SeqChild and m.ref.parent = SeqChild and m.ref.parent in n.ref.parent.^nextChild) =>
m in n.^nextEl
}
fact enforceChoice{
SchedEl = Sched.header.*nextEl
all n:SchedEl, m:Choice, c:Node | n.ref in m.children and c in m.children and n.ref != c => n.^nextEl.ref != c
}
fact noLeafNext{
all n:Leaf | no n.nextSet
}
sig M1, M2 extends Intermediate{}
sig M extends Choice{
// M.children = {M1,M2}
}
//one sig A1, A2 extends M1{}
//one sig A3, A4 extends M2{}
pred empty(){}
run empty for 4