Using previously defined relations of being a man or woman and being a parent. The following rules define the relations being a father and being a mother Each rule has its head - name of the defined relation, and its body While facts state the relation explicitely, rules define Till now, we added only facts to our program but the % means adam is parent of peter parent(eve,peter). Use Copy&Paste function of the browser to move the code directly into the PROLOG environment.įirst, we express the property of being a man or womanīy following PROLOG facts : man(adam). The program demonstratesįeatures of Prolog like using facts, rules, variables or recursion. In this lesson, we present a simple Prolog program that captures basic family relations. A genealogy database seems to be a good introductory to Prolog.
0 Comments
Leave a Reply. |