/* Example database of monarchs since 1700 */

:- op(34,xfx,#).

person(X) :- man(X); woman(X).
object(X) :- person(X).

man(george#i).
man(george#ii).
man(george#iii).
man(george#iv).
man(william#iv).
man(edward#vii).
man(george#v).
man(edward#viii).
man(george#vi).
man(frederick#'prince of wales').
man(william#'duke of cumberland').
man(edward#'duke of kent').
man(alfred#'son of victoria').
man(arthur#'son of victoria').
man(leopold#'son of victoria').
man(albert#'son of edward vii').
man(henry#'son of georgev').
man(george#'son of georgev').
man(john#'son of georgev').
man(charles#'windsor').
man(andrew#'windsor').
man(edward#'windsor').
man(albert#'of saxe-coburg').
man(philip#mountbatten).
man(george#'prince of denmark').

woman(elizabeth#ii).
woman(victoria#i).
woman(victoria#'daughter of victoria').
woman(alice#'daughter of victoria').
woman(helena#'daughter of victoria').
woman(louise#'daughter of victoria').
woman(beatrice#'daughter of victoria').
woman(louise#'daughter of edwardvii').
woman(victoria#'daughter of edwardvii').
woman(maud#'daughter of edwardvii').
woman(mary#'daughter of georgev').
woman(margaret#'rose').
woman(anne#snowdon).
woman(anne#i).
woman(sophia#'of brunswick').
woman(caroline#'of anspach').
woman(charlotte-sophia#'of mecklenburg-strelitz').
woman(caroline#'of brunswick').
woman(alexandra#'of denmark').
woman(victoria-mary#'of teck').
woman(elizabeth#'bowes-lyon').
woman(adelaide#'of saxe-meiningen').       

reigned(anne#i,1702,1714).
reigned(george#i,1714,1727).
reigned(george#ii,1727,1760).
reigned(george#iii,1760,1820).
reigned(george#iv,1820,1830).
reigned(william#iv,1830,1837).
reigned(victoria#i,1837,1901).
reigned(edward#vii,1901,1910).
reigned(george#v,1910,1936).
reigned(edward#viii,1936,1936).
reigned(george#vi,1936,1952).
reigned(elizabeth#ii,1952,2000).

monarch(X) :- reigned(X,Y,Z).

replaced(X,Y) :-
   reigned(Y,A,B),
   reigned(X,B,C).

father(george#i,george#ii).
father(george#ii,frederick#'prince of wales').
father(george#ii,william#'duke of cumberland').
father(george#iii,george#iv).
father(george#iii,william#iv).
father(george#iii,edward#'duke of kent').
father(albert#'of saxe-coburg',edward#vii).
father(albert#'of saxe-coburg',alfred#'son of victoria').
father(albert#'of saxe-coburg',arthur#'son of victoria').
father(albert#'of saxe-coburg',leopold#'son of victoria').
father(albert#'of saxe-coburg',victoria#'daughter of victoria').
father(albert#'of saxe-coburg',alice#'daughter of victoria').
father(albert#'of saxe-coburg',helena#'daughter of victoria').
father(albert#'of saxe-coburg',louise#'daughter of victoria').
father(albert#'of saxe-coburg',beatrice#'daughter of victoria').
father(edward#vii,albert#'son of edwardvii').
father(edward#vii,george#v).
father(edward#vii,louise#'daughter of edwardvii').
father(edward#vii,victoria#'daughter of edwardvii').
father(edward#vii,maud#'daughter of edwardvii').
father(george#v,edward#viii).
father(george#v,george#vi).
father(george#v,mary#'daughter of georgev').
father(george#v,henry#'son of georgev').
father(george#v,george#'son of georgev').
father(george#v,john#'son of georgev').
father(george#vi,elizabeth#ii).
father(george#vi,margaret#'rose').
father(philip#mountbatten,charles#'windsor').
father(philip#mountbatten,anne#'snowdon').
father(philip#mountbatten,andrew#'windsor').
father(philip#mountbatten,edward#'windsor').

child(A,B) :- father(A,B).
child(A,B) :- husband(A1,A), father(A1,B).

husband(george#'prince of denmark',anne#i).
husband(george#i,sophia#'of brunswick').
husband(george#ii,caroline#'of anspach').
husband(george#iii,charlotte-sophia#'of mecklenburg-strelitz').
husband(george#iv,caroline#'of brunswick').
husband(william#iv,adelaide#'of saxe-meiningen').
husband(albert#'of saxe-coburg',victoria#i).
husband(edward#vii,alexandra#'of denmark').
husband(george#v,victoria-mary#'of teck').
husband(george#vi,elizabeth#'bowes-lyon').
husband(philip#mountbatten,elizabeth#ii).

married(X,Y) :- husband(X,Y).
married(X,Y) :- husband(Y,X).

christian_name(Z,X) :- person(Z), Z=(X#_).
