Download presentation

Presentation is loading. Please wait.

Published byChase Harrison Modified over 2 years ago

1
Simply Logical – Chapter 2© Peter Flach, 2000 Clausal logic Propositional clausal logic Propositional clausal logic expressions that can be true or false expressions that can be true or false Relational clausal logic Relational clausal logic constants and variables refer to objects constants and variables refer to objects Full clausal logic Full clausal logic functors aggregate objects functors aggregate objects Definite clause logic = pure Prolog Definite clause logic = pure Prolog no disjunctive heads no disjunctive heads

2
Simply Logical – Chapter 2© Peter Flach, 2000 Propositional clausal logic: syntax married;bachelor:-man,adult. Somebody is married or a bachelor if he is a man and an adult.clause married bachelor man adult atoms head = positive literals body = negative literals p.18

3
Simply Logical – Chapter 2© Peter Flach, 2000 Exercise 2.1 Persons are happy or sad Persons are happy or sad happy;sad:-person. No person is both happy and sad No person is both happy and sad :-person,happy,sad. Sad persons are not happy Sad persons are not happy :-person,sad,happy. Non-happy persons are sad Non-happy persons are sad sad;happy:-person. p.18

4
Simply Logical – Chapter 2© Peter Flach, 2000 Propositional clausal logic: semantics Herbrand base: set of atoms Herbrand base: set of atoms{married,bachelor,man,adult} Herbrand interpretation: set of true atoms Herbrand interpretation: set of true atoms {married,man,adult} A clause is false in an interpretation if all body-literals are true and all head-literals are false… A clause is false in an interpretation if all body-literals are true and all head-literals are false… bachelor:-man,adult. …and true otherwise: the interpretation is a model of the clause. …and true otherwise: the interpretation is a model of the clause. :-married,bachelor. p.19

5
Simply Logical – Chapter 2© Peter Flach, 2000 Exercise 2.2 A clause C is a logical consequence of a program (set of clauses) P iff every model of P is a model of C. A clause C is a logical consequence of a program (set of clauses) P iff every model of P is a model of C. Let P be Let P be married;bachelor:-man,adult. man. :-bachelor. married:-adult is a logical consequence of P; married:-adult is a logical consequence of P; married:-bachelor is a logical consequence of P; married:-bachelor is a logical consequence of P; bachelor:-man is not a logical consequence of P; bachelor:-man is not a logical consequence of P; bachelor:-bachelor is a logical consequence of P. bachelor:-bachelor is a logical consequence of P. p.20

6
Simply Logical – Chapter 2© Peter Flach, 2000 Propositional resolution square:-rectangle,equal_sidesrectangle:-parallelogram,right_angles has_wife:-man,marriedmarried;bachelor:-man,adult p.22 has_wife;bachelor:-man,adult square:-parallelogram,right_angles,equal_sides

7
Simply Logical – Chapter 2© Peter Flach, 2000 Propositional clausal logic: meta-theory Propositional resolution is Propositional resolution is sound: it derives only logical consequences. sound: it derives only logical consequences. incomplete: it cannot derive arbitrary tautologies like a:-a… incomplete: it cannot derive arbitrary tautologies like a:-a… …but refutation-complete: it derives the empty clause from any inconsistent set of clauses. …but refutation-complete: it derives the empty clause from any inconsistent set of clauses. Proof by refutation: add the negation of the assumed logical consequence to the program, and prove inconsistency by deriving the empty clause. Proof by refutation: add the negation of the assumed logical consequence to the program, and prove inconsistency by deriving the empty clause. p.23

8
Simply Logical – Chapter 2© Peter Flach, 2000 Exercise 2.4 teacher;wise teacher:-wise happy;friendly:-teacherfriendly:-teacher,happy friendly:-teacher teacher friendly p.23

9
Simply Logical – Chapter 2© Peter Flach, 2000 Exercise 2.5 friendly:-happyhappy:-has_friends p.24 :-friendlyfriendly:-happy happy:-has_friends has_friends :-happy :-has_friends [] friendly:-has_friends Direct proof: Proof by refutation: ÿ(friendly:-has_friends) ÿ(friendly ÿhas_friends) (ÿfriendly) (has_friends) :-friendly and has_friends

10
Simply Logical – Chapter 2© Peter Flach, 2000 Relational clausal logic: syntax likes(peter,S):-student_of(S,peter). Peter likes anybody who is his student. clause atoms constantvariable terms p.25

11
Simply Logical – Chapter 2© Peter Flach, 2000Substitutions A substitution maps variables to terms: A substitution maps variables to terms: {S->maria} A substitution can be applied to a clause: A substitution can be applied to a clause: likes(peter,maria):-student_of(maria,peter). The resulting clause is said to be an instance of the original clause, and a ground instance if it does not contain variables. The resulting clause is said to be an instance of the original clause, and a ground instance if it does not contain variables. Each instance of a clause is among its logical consequences. Each instance of a clause is among its logical consequences. p.26

12
Simply Logical – Chapter 2© Peter Flach, 2000 Relational clausal logic: semantics Herbrand universe: set of ground terms (i.e. constants) Herbrand universe: set of ground terms (i.e. constants){peter,maria} Herbrand base: set of ground atoms Herbrand base: set of ground atoms {likes(peter,peter),likes(peter,maria),likes(maria,peter), likes(maria,maria),student_of(peter,peter),student_of(peter,maria), student_of(maria,peter),student_of(maria,maria)} Herbrand interpretation: set of true ground atoms Herbrand interpretation: set of true ground atoms {likes(peter,maria),student_of(maria,peter)} An interpretation is a model for a clause if it makes all of its ground instances true An interpretation is a model for a clause if it makes all of its ground instances true likes(peter,maria):-student_of(maria,peter). likes(peter,peter):-student_of(peter,peter). p.26

13
Simply Logical – Chapter 2© Peter Flach, 2000 Relational resolution :-likes(peter,N)likes(peter,S):-student_of(S,peter) student_of(S,T):-follows(S,C),teaches(T,C) follows(maria,ai_techniques) teaches(peter,ai_techniques) :-student_of(N,peter) :-follows(N,C),teaches(peter,C) :-teaches(peter,ai_techniques) [] {S->N} {S->N,T->peter} {N->maria,C->ai_techniques} p.29

14
Simply Logical – Chapter 2© Peter Flach, 2000 Full clausal logic: syntax loves(X,person_loved_by(X)). Everybody loves somebody. termfunctor complex term loves(peter,person_loved_by(peter)). loves(anna,person_loved_by(anna)). loves(paul,person_loved_by(paul)). … p.30

15
Simply Logical – Chapter 2© Peter Flach, 2000 Exercise 2.9 Every mouse has a tail Every mouse has a tail tail_of(tail(X),X):-mouse(X). Somebody loves everybody Somebody loves everybody loves(person_who_loves_everybody,X). Every two numbers have a maximum Every two numbers have a maximum maximum_of(X,Y,max(X,Y)):-number(X),number(Y). p.31

16
Simply Logical – Chapter 2© Peter Flach, 2000 Full clausal logic: semantics Herbrand universe: set of ground terms Herbrand universe: set of ground terms{0,s(0),s(s(0)),s(s(s(0))),…} Herbrand base: set of ground atoms Herbrand base: set of ground atoms {plus(0,0,0), plus(s(0),0,0), …, plus(0,s(0),0), plus(s(0),s(0),0), …, …, plus(s(0),s(s(0)),s(s(s(0)))), …} Herbrand interpretation: set of true ground atoms Herbrand interpretation: set of true ground atoms {plus(0,0,0), plus(s(0),0,s(0)), plus(0,s(0),s(0))} Some programs have only infinite models Some programs have only infinite modelsplus(0,X,X). plus(s(X),Y,s(Z)):-plus(X,Y,Z). p.31-3

17
Simply Logical – Chapter 2© Peter Flach, 2000 Exercise 2.11 plus(X,Y,s(Y)) and plus(s(V),W,s(s(V))) unify to plus(s(V),s(V),s(s(V))) plus(X,Y,s(Y)) and plus(s(V),W,s(s(V))) unify to plus(s(V),s(V),s(s(V))) length([X|Y],s(0)) and length([V],V) unify to length([s(0)],s(0)) length([X|Y],s(0)) and length([V],V) unify to length([s(0)],s(0)) larger(s(s(X),X) and larger(V,s(V)) do not unify (occur check!) larger(s(s(X),X) and larger(V,s(V)) do not unify (occur check!) p.35

18
Simply Logical – Chapter 2© Peter Flach, 2000Summary Propositional Relational Full clausal logic {a, b}{a, f(a), f(f(a)),…} (finite)(infinite) {a, b}{a, f(a), f(f(a)),…} (finite)(infinite) {p, q}{p(a,a), p(b,a),…}{p(a,f(a)), p(f(a), f(f(a))),…} (finite)(infinite) p:-q.p(X,Z):-q(X,Y),p(Y,Z).p(X,f(X)):-q(X). {p}{p(a,a)}{p(a,f(a)), q(a)} {p, q}{p(a,a), p(b,a), q(b,a)}{p(f(a), f(f(a))), q(f(a))} …… (finite number of(infinite number of finite models) finite or infinite models) {p}{p(a,a)}{p(a,f(a)), q(a)} {p, q}{p(a,a), p(b,a), q(b,a)}{p(f(a), f(f(a))), q(f(a))} …… (finite number of(infinite number of finite models) finite or infinite models) soundsoundsound (if unifying with occur check) refutation-completerefutation-completerefutation-complete decidabledecidablesemi-decidable Herbrand universe Herbrand base clause Herbrand models Meta- theory

19
Simply Logical – Chapter 2© Peter Flach, 2000 Exercise 2.12 man(peter) adult(peter)married(peter);bachelor(peter):-adult(peter) married(peter);bachelor(peter) married(X);bachelor(X):-man(X),adult(X):-married(maria) :-bachelor(maria)bachelor(maria):-man(maria),adult(maria) :-man(maria),adult(maria) married(X);bachelor(X):-man(X),adult(X)man(paul) :-bachelor(paul)married(paul);bachelor(paul):-adult(paul) married(paul):-adult(paul) married(X);bachelor(X):-man(X),adult(X) married(X);bachelor(X):-man(X),adult(X) p.36

20
Simply Logical – Chapter 2© Peter Flach, 2000 From indefinite to general clauses am,m,b am,m m,b am,b m m am b b am,m,b am,b m,b am,m b b am m m married;bachelor:-adult_man. adult_man. married:-adult_man,not bachelor.bachelor:-adult_man,not married. p.37

21
Simply Logical – Chapter 2© Peter Flach, 2000 From first-order logic to clausal logic Everyone has a mother, but not every woman has a child. Everyone has a mother, but not every woman has a child. Y X:mother_of(X,Y) Z W:woman(Z) mother_of(Z,W) Y X:mother_of(X,Y) Z W:woman(Z) mother_of(Z,W) push negation inside push negation inside Y X:mother_of(X,Y) Z W:woman(Z) mother_of(Z,W) Y X:mother_of(X,Y) Z W:woman(Z) mother_of(Z,W) drop quantifiers (Skolemisation) drop quantifiers (Skolemisation) mother_of(mother(Y),Y) woman(childless_woman) mother_of(childless_woman,W) (convert to CNF and) rewrite as clauses (convert to CNF and) rewrite as clauses mother_of(mother(Y),Y). woman(childless_woman). :-mother_of(childless_woman,W). p.40-1

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google