ln024 - Homework Assignment #10 (see website) Prolog Rules...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework Assignment #10 (see website)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Prolog Rules Prolog rules are Horn clauses, but they are written “backwards”, consider: X,Y[female(X) parent(X,Y) mother(X,Y)] is written in Prolog as mother(X,Y) :- female(X) , parent(X,Y) . Implies (“think of ”) “and” head body You can think of a rule as introducing a new “fact” (the head), but the fact is defined in terms of a compound goal (the body). That is, predicates defined as rules are only true if the associated compound goal can be shown to be true. Prolog rules a implicitly universally quantified!
Background image of page 2
% a simple prolog program female(pam). female(liz). female(ann). female(pat). male(tom). male(bob). male(jim). parent(pam,bob). parent(tom,bob). parent(tom,liz). parent(bob,ann). parent(bob,pat). parent(pat,jim). mother(X,Y) :- female(X),parent(X,Y). ! Queries: ?- mother(pam,bob). ?- mother(Z,jim). ?- mother(P,Q).
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/03/2011 for the course CSC 301 taught by Professor Hamel during the Spring '08 term at Rhode Island.

Page1 / 13

ln024 - Homework Assignment #10 (see website) Prolog Rules...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online