-
Notifications
You must be signed in to change notification settings - Fork 1
/
grandpa.raz
43 lines (29 loc) · 1.24 KB
/
grandpa.raz
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
// Source: Alloy Analyzer Examples
Man(p) implies Person(p);
Woman(p) implies Person(p);
Man(p) and Woman(p) implies false;
mother(p) = w implies Person(p) and Woman(w);
father(p) = m implies Person(p) and Man(m);
wife(m) = w implies Man(m) and Woman(w);
husband(w) = m implies Man(m) and Woman(w);
mother(p) = m implies Ancestor(p, m);
father(p) = f implies Ancestor(p, f);
// Biology:
Ancestor(p, a) and father(a) = f implies Ancestor(p, f);
Ancestor(p, a) and mother(a) = m implies Ancestor(p, m);
Ancestor(p, p) implies false;
// Terminology:
wife(m) = w implies husband(w) = m;
husband(w) = m implies wife(m) = w;
// Social Convention:
wife(p) = w and Ancestor(p, w) implies false;
husband(p) = h and Ancestor(p, h) implies false;
father(p) = f implies Parent(p, f);
mother(p) = m implies Parent(p, m);
father(p) = f and wife(f) = w implies Parent(p, w);
mother(p) = m and husband(m) = h implies Parent(p, h);
Grandpas(p, g) implies exists p_ . Parent(p_, g) and Parent(p, p_) and Man(g);
Parent(p, p_) and Parent(p_, g) and Man(g) implies Grandpas(p, g);
Parent(p, p_) implies father(p) = p_ or mother(p) = p_ or (exists f . father(p) = f and wife(f) = p_) or (exists m . mother(p) = m and husband(m) = p_);
// Own Grandpa
exists p. Grandpas(p, p);