_restore;


_type	Person	==	Type;

_value	Albert ==	Person;
_value	Andrew ==	Person;
_value	Charles ==	Person;
_value	Edward ==	Person;
_value	Edward7 ==	Person;
_value	Edward8 ==	Person;
_value	George5 ==	Person;
_value	George6 ==	Person;
_value	Harry ==	Person;
_value	Philip ==	Person;
_value	William ==	Person;

_value	Victoria ==	Person;
_value	Alice ==	Person;
_value	ElizabethQM ==	Person;
_value	Elizabeth2 ==	Person;
_value	Margaret ==	Person;
_value	Anne ==		Person;
_value	Diana ==	Person;


_extsel	|mother == (Person,Person);
_extsel	|father == (Person,Person);

_include |mother (Victoria,Alice);
_include |mother (Victoria,George5);
_include |father (Albert,Alice);
_include |father (Albert,George5);
_include |father (George5,Edward7);
_include |father (Edward7,Edward8);
_include |father (Edward7,George6);
_include |father (George6,Elizabeth2);
_include |father (George6,Margaret);
_include |father (Philip,Charles);
_include |father (Philip,Anne);
_include |father (Philip,Andrew);
_include |father (Philip,Edward);
_include |mother (ElizabethQM,Elizabeth2);
_include |mother (ElizabethQM,Margaret);
_include |mother (Elizabeth2,Charles);
_include |mother (Elizabeth2,Anne);
_include |mother (Elizabeth2,Andrew);
_include |mother (Elizabeth2,Edward);
_include |father (Charles,Harry);
_include |father (Charles,William);
_include |mother (Diana,Harry);
_include |mother (Diana,William);

_define	parent (x,y)	==	(|father (x,y)) ++ (|mother (x,y));

_define grandparent (x,z) ==	[(x,z) | (x,y) <- parent (x,Any); (y,z) <- parent (y,z)];

_define ancestor (x,z) ==	parent (x,z) ++
				[(x,z) | (x,y) <- parent (x,Any); (y,z) <- ancestor (y,z)];

//	FDL style functions:

_value	Unknown ==	type0;		// used so that we can simulate FDLs behaviour

_define father y	==	head ([x | (x,y) <- |father (Any,y)] ++ [Unknown]);
_define father_inv x	==	[y | (x,y) <- |father (x,Any)];

_define mother y	==	head ([x | (x,y) <- |mother (Any,y)] ++ [Unknown]);
_define mother_inv x	==	[y | (x,y) <- |mother (x,Any)];

_define parents y	==	[x | (x,y) <- parent (Any,y)];
_define children x	==	[y | (x,y) <- parent (x,Any)];

_define grandchildren x	==	[y | (x,y) <- grandparent (x,Any)];
_define grandparents y	==	[x | (x,y) <- grandparent (Any,y)];

_define descendants x	==	[y | (x,y) <- ancestor (x,Any)];
_define ancestors x	==	[y | (x,y) <- ancestor (x,Any)];
