Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- parent(ojciec, syn1).
- parent(matka, corka1).
- parent(matka, corka2).
- parent(matka, syn1).
- parent(dziadek, matka).
- man(ojciec).
- man(dziadek).
- man(syn1).
- woman(matka).
- woman(corka1).
- woman(corka2).
- ismother(X) :-
- woman(X), parent(X, _).
- isfather(X) :-
- man(X), parent(X, _).
- isson(X) :-
- man(X), parent(_, X).
- aresisters(X, Y) :-
- woman(X), woman(Y), X \= Y, parent(Z, X), parent(Z, Y).
- isgrandpaof(X, Y) :-
- man(X), parent(X, Z), parent(Z, Y).
- aresiblings(X, Y) :-
- X \= Y, parent(Z, X), parent(Z, Y).
- on(b1, b4).
- on(b4, b3).
- above(X, Y) :- on(X, Y).
- above(X, Y) :-
- on(X, Z),
- above(Z, Y).
- onleft(eggtimer, pencil).
- onleft(butterfly, eggtimer).
- onleft(fish, butterfly).
- ontop(pencil, bicycle).
- ontop(butterfly, camera).
- moreleftedfrom(X, Y) :- onleft(X, Y).
- moreleftedfrom(X, Y) :-
- onleft(X, Z),
- moreleftedfrom(Z, Y).
- morerightedfrom(X, Y) :- moreleftedfrom(Y, X).
- higherthan(X, Y) :- ontop(X, Y).
- higherthan(X, Y) :-
- ontop(X, Z),
- higherthan(Z, Y).
- belowthan(X, Y) :- higherthan(Y, X).
- higher(X, Y) :-
- higherthan(Z, Y),
- (moreleftedfrom(X, Z); morerightedfrom(X, Z)).
- le(1,5).
- le(1,7).
- le(5,35).
- le(7,35).
- le(7,14).
- wiekszyod(X,Y) :- le(X,Y).
- wiekszyod(X, Y) :-
- le(X, Z),
- wiekszyod(Z, Y).
- maksymalny(X) :-
- \+ le(X,A),
- le(B,X).
- najw(X) :-
- maksymalny(X),
- le(Y, X),
- ((le(Y,Z), (\+ najw(Z))); true).
- minimalny(X) :-
- \+ le(A,X),
- le(X,B).
- divisible(X,Y) :- X mod Y =:= 0.
- divisible(X,Y) :- sqrt(X) >= Y+2, divisible(X, Y+2).
- isPrime(X) :- X =:= 2; X =:= 3; (X > 3, X mod 2 =:= 1, \+ divisible(X, 3)).
- prime(LO, HI, N) :-
- between(LO, HI, N),
- isPrime(N).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement