-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhealth-track.als
55 lines (39 loc) · 1.06 KB
/
health-track.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
module HealthTrack
one sig HealthTrack {
usuarios: set Usuario,
}
sig Usuario {
exames: set Exame
}
abstract sig Exame{
}
sig ExameHemograma, ExamePressao, ExameGlicemia, ExameFezes, ExameUrina, ExameColesterol, Pdf extends Exame {}
----Predicados
-- O usuário pertence ao Health Track
pred usuarioNoHealthTrack[u: Usuario, h: HealthTrack]{
u in h.usuarios
}
-- O Exame pertence ao Usuário
pred exameNoUsuario[e: Exame, u: Usuario] {
e in u.exames
}
----Fatos
-- Todo usuário está no Health Track
fact todosOsUsuariosEstaoNoHealthTrack {
all u: Usuario | one h: HealthTrack | usuarioNoHealthTrack[u,h]
}
-- O exame pertence a apenas um usuario
fact todosOsExamesEstaoNoUsuario {
all e: Exame | one u: Usuario | exameNoUsuario[e,u]
}
----Asserts
assert todosOsUsuariosEstaoNoHealthTrack {
all u: Usuario | one h: HealthTrack | usuarioNoHealthTrack[u,h]
}
assert todosOsExamesEstaoNoUsuario {
all e: Exame | one u: Usuario | exameNoUsuario[e,u]
}
pred show[]{}
run show for 3
check todosOsUsuariosEstaoNoHealthTrack for 10
check todosOsExamesEstaoNoUsuario for 10