50 lines
932 B
Prolog
Executable File
50 lines
932 B
Prolog
Executable File
#!/usr/bin/swipl
|
|
married(liisa, joosep).
|
|
married(anne, vello).
|
|
mother(evelin,anne).
|
|
mother(mikk, anne).
|
|
mother(juku, anne).
|
|
mother(anne, liisa).
|
|
mother(mart, liisa).
|
|
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).
|
|
|