abstract
Person
name
:
string
civstat
:
string
gender
:
string
alive
?
husband
->
Person
?
[
parent
in
this
.
wife
]
wife
->
Person
?
[
parent
in
this
.
husband
]
[
civstat
= "single" ||
civstat
= "married" ||
civstat
= "divorced" ||
civstat
= "widowed"
]
[
gender
= "female" ||
gender
= "male"
]
[
all p
:
Person
|
this
!=
p
=>
this
.
name
.
ref
!=
p
.
name
.
ref
]
[
one
p
:
Person
|
p
.
name
.
ref
=
this
.
name
.
ref
]
ada
:
Person
[
name
= "Ada"
]
[
civstat
= "widowed"
]
[
gender
= "female"
]
[
alive
]
[
no
husband
]
[
no
wife
]
cyd
:
Person
[
name
= "Cyd"
]
[
civstat
= "married"
]
[
gender
= "male"
]
[
no
alive
]
[
no
husband
]
[
no
wife
]
eve
:
Person
[
name
= "Eve"
]
[
civstat
= "married"
]
[
gender
= "female"
]
[
alive
]
[
husband
=
dan
]
[
no
wife
]
bob
:
Person
[
name
= "Bob"
]
[
civstat
= "divorced"
]
[
gender
= "male"
]
[
alive
]
[
no
husband
]
[
no
wife
]
dan
:
Person
[
name
= "Dan"
]
[
civstat
= "married"
]
[
gender
= "male"
]
[
alive
]
[
no
husband
]
[
wife
=
eve
]
[
adaBobCyd
.
name
=
stringSet1
]
[
personWithUndefinedHusband1
.
name
=
stringSet2
]
[
personWithUndefinedHusband2
.
name
=
stringSet2
]
[
possiblePairs
.
first
.
name
= "Ada" &&
possiblePairs
.
second
.
name
= "Bob"
]
adaBobCyd
->
Person
*
[
this
.
name
in
stringSet1
]
[
all p
:
Person
|
p
.
name
in
stringSet1
=>
p
in
adaBobCyd
]
personWithUndefinedHusband1
->
Person
*
[
this
.
husband
=
emptyPersonSet1
]
[
all p
:
Person
|
p
.
husband
=
emptyPersonSet1
=>
p
in
personWithUndefinedHusband1
]
personWithUndefinedHusband2
->
Person
*
[
this
.
husband
=
emptyPersonSet2
]
[
all p
:
Person
|
p
.
husband
=
emptyPersonSet2
=>
p
in
personWithUndefinedHusband2
]
personWithNoWife
->
Person
*
[
no
this
.
wife
]
[
all p
:
Person
|
no
p
.
wife
=>
p
in
personWithNoWife
]
emptyPersonSet1
->
Person
*
[
emptyPersonSet1
=
personWithNoWife
.
wife
]
emptyPersonSet2
->
Person
*
[
1 > 2
]
personPair
*
first
->
Person
second
->
Person
possiblePairs
->
personPair
*
[
this
.
first
.
gender
= "female" &&
this
.
first
.
alive
&&
this
.
first
.
civstat
!= "married"
]
[
this
.
second
.
gender
= "male" &&
this
.
second
.
alive
&&
this
.
second
.
civstat
!= "married"
]
[
all p; q
:
Person
|
p
.
gender
= "female" &&
p
.
alive
&&
p
.
civstat
!= "married" &&
q
.
gender
= "male" &&
q
.
alive
&&
q
.
civstat
!= "married" =>
one
pair
:
personPair
|
pair
.
first
=
p
&&
pair
.
second
=
q
&&
pair
in
possiblePairs
]
stringSet1
->
string
3
[
this
= "Ada" ||
this
= "Bob" ||
this
= "Cyd"
]
stringSet2
->
string
4
[
this
= "Ada" ||
this
= "Bob" ||
this
= "Cyd" ||
this
= "Dan"
]