1
0
Fork 0
This commit is contained in:
Arti Zirk 2018-10-03 12:18:17 +03:00
parent 98e604d891
commit 7b4e5719f0
1 changed files with 63 additions and 0 deletions

63
PR03/prax03.pl Executable file
View File

@ -0,0 +1,63 @@
#!/usr/bin/swipl
married(marta, mart).
married(liisa, joosep).
married(anne, vello).
mother(evelin,anne).
mother(mikk, anne).
mother(juku, anne).
mother(anne, liisa).
mother(mart, liisa).
female(marta).
female(anne).
female(evelin).
female(liisa).
male(vello).
male(mikk).
male(juku).
male(mart).
father(Laps, Isa):-
mother(Laps, Ema),
married(Ema, Isa),
male(Isa).
brother(Laps, Vend):-
mother(Laps, Ema),
mother(Vend, Ema),
Laps \= Vend,
male(Vend).
sister(Laps, Ode):-
mother(Laps, Ema),
mother(Ode, Ema),
Laps \= Ode,
female(Ode).
uncle(Laps, Uncle):-
(mother(Laps, Vanem); father(Laps, Vanem)),
brother(Vanem, Uncle).
aunt(Laps, Aunt):-
(mother(Laps, Vanem); father(Laps, Vanem)),
sister(Vanem, Aunt).
grandmother(Laps, GM):-
(mother(Laps, Vanem); father(Laps, Vanem)),
mother(Vanem, GM).
grandfather(Laps, GF):-
(mother(Laps, Vanem); father(Laps, Vanem)),
father(Vanem, GF).
ancestor(C, G):- mother(C, G).
ancestor(C, F):- father(C, F).
ancestor(C, G):-
(mother(C, Anc);father(C, Anc)),
ancestor(Anc, G).
male_ancestor(C, A):- ancestor(C, A), male(A).
female_ancestor(C, A):- ancestor(C, A), female(A).