CA 208 Logic Ex8 - PowerPoint PPT Presentation

1 / 2
About This Presentation
Title:

CA 208 Logic Ex8

Description:

... a parent of Lucy. Tom is a parent of Lucy. Lucy is a parent of ... Lucy is female. Tom is male. Sean is male. Charles is male. Tracy is female. Conor is male. ... – PowerPoint PPT presentation

Number of Views:42
Avg rating:3.0/5.0
Slides: 3
Provided by: Josefvan6
Category:
Tags: ex8 | logic | lucy

less

Transcript and Presenter's Notes

Title: CA 208 Logic Ex8


1
CA 208 Logic Ex8
  • Describe (i.e. axiomatise, define) the following
    situation as a Prolog programme (use parent/2 and
    john, mary etc. as your vocabulary)
  • John is a parent of Kate. Mary is a parent of
    Kate. John is a parent of Mike. Mary is a parent
    of Mike. Kate is a parent of Lucy. Tom is a
    parent of Lucy. Lucy is a parent of Sean. Charles
    is a parent of Sean. Sean is a parent of Tracy.
    Fiona is a parent of Tracy.
  • Given this, add information (use male/1 and
    female/1 predicates) to express that
  • John is male. Mary is female. Kate is female.
    Mike is male. Lucy is female. Tom is male. Sean
    is male. Charles is male. Tracy is female. Conor
    is male.
  • Given your Prolog programme, add clauses defining
    the following relations
  • child(X,Y) if X is a child of Y
  • father(X,Y) if X is a father of Y
  • mother(X,Y) if X is a mother of Y
  • grandfather(X,Y) if X is a grandfather of Y
  • grandmother(X,Y) if X is a grandmother of Y
  • ancestor(X,Y) if X is an ancestor of Y
    (define recursively)
  • relative(X,Y) if X is a relative of Y
  • sibling(X,Y) if X is a sibling of Y

2
CA 208 Logic Ex8
  • Which of the following (sequences of)
    unifications/matches succeed? (use Prolog to
    check ...)
  • a a.
  • a b.
  • a X.
  • X a.
  • X Y.
  • X Y, X a.
  • X a, X Y, Y b.
  • like(john,mary) like(john,X).
  • like(john,mary) like(Y,X).
  • like(john,mary) like(X,X).
  • like(john,mary) like(Y,X,Z).
  • like(john,mary) like(X).
  • line(point(2,2),point(2,5)) line(point(X,X),poin
    t(X,5)).
  • line(point(2,2),point(2,5)) line(point(X,Y),poin
    t(Z,5)).
  • line(X,point(2,5)) line(point(2,2),point(2,5)).
  • line(X,Y) line(point(2,2),point(2,5)).
Write a Comment
User Comments (0)
About PowerShow.com