본문 바로가기
AI

prolog 연습

by 자동차생각_모듈러설계 2021. 9. 4.
728x90

https://swish.swi-prolog.org/

/* 사실 */

male(허생원).
male(동이).
female(분이).

parent(분이, 동이).

married(허생원, 분이).
married(분이, 허생원).


mother(X,Y) :- female(X),parent(X,Y).
father(X,Y) :- male(X), parent(X,Y).
father(X,Y) :- male(X), married(X,Z), mother(Z,Y).