Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger,...
-
Upload
emery-thompson -
Category
Documents
-
view
228 -
download
5
Transcript of Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger,...
![Page 1: Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.](https://reader035.fdocuments.in/reader035/viewer/2022081515/56649d0d5503460f949e29df/html5/thumbnails/1.jpg)
1
Logic programming
( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson .
![Page 2: Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.](https://reader035.fdocuments.in/reader035/viewer/2022081515/56649d0d5503460f949e29df/html5/thumbnails/2.jpg)
2
Gnu prolog program
http://gnu-prolog.soft112.com/download.html
![Page 3: Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.](https://reader035.fdocuments.in/reader035/viewer/2022081515/56649d0d5503460f949e29df/html5/thumbnails/3.jpg)
3
Instruction
• You should print slides before classes.• You will be Assessment like this:• 40% on exams• 10% attendant and activity during class.• 10% activity file and assignment.• Your file will be assessment with second exam.• Zero mark for absent student on exams.
![Page 4: Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.](https://reader035.fdocuments.in/reader035/viewer/2022081515/56649d0d5503460f949e29df/html5/thumbnails/4.jpg)
4
Objective:
• The aim of this course is to present the key concepts behind logic programming
• let you know about one of logic programming languages(prolog).
• how to write programs with logic.• how to make efficient implementations
(Queries).
![Page 5: Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.](https://reader035.fdocuments.in/reader035/viewer/2022081515/56649d0d5503460f949e29df/html5/thumbnails/5.jpg)
5
Logic..
• Logic– is the study of the logic relationships between objects and – forms the basis of all mathematical reasoning and all
automated reasoning• Propositional Logic (PL) • In Propositional Logic, the objects are called propositions• Definition: A proposition is a statement that is either
true or false, but not both• We usually denote a proposition by a letter: p, q, r, s, …
![Page 6: Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.](https://reader035.fdocuments.in/reader035/viewer/2022081515/56649d0d5503460f949e29df/html5/thumbnails/6.jpg)
6
Propositions: Examples
• The following are propositions– Today is Monday M– The grass is wet W– It is raining R
• The following are not propositions– C++ is the best language– What is your name?– Do your homework
![Page 7: Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.](https://reader035.fdocuments.in/reader035/viewer/2022081515/56649d0d5503460f949e29df/html5/thumbnails/7.jpg)
7
Are these propositions?
• 2+2=5• Every integer is divisible by 12• Microsoft is an excellent company
![Page 8: Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.](https://reader035.fdocuments.in/reader035/viewer/2022081515/56649d0d5503460f949e29df/html5/thumbnails/8.jpg)
8
Logical connectives• Connectives are used to create a compound
proposition from two or more propositions– Negation (e.g., a or !a or ā) $\neg$, $\bar$– And or logical conjunction (denoted ) $\wedge$– OR or logical disjunction (denoted ) $\vee$– XOR or exclusive or (denoted ) $\oplus$– Impli ion (denoted or )
$\Rightarrow$, $\rightarrow$ – Biconditional (denoted or )
$\LeftRightarrow$, $\leftrightarrow$• We define the meaning (semantics) of the logical
connectives using truth tables
![Page 9: Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.](https://reader035.fdocuments.in/reader035/viewer/2022081515/56649d0d5503460f949e29df/html5/thumbnails/9.jpg)
9
Logical Arguments
• Consider the following statements.1. if you study then you succeed2. you study3. you succeed
• These three statements create a logical argument.• Lines 1 and 2 are premises and line 3 is the conclusion.• This logical argument is sound.– Premises can be true or false.– If the premises are true, the conclusion must be true.– If one (or more than one) of the premises is false, the
argument is still sound, but we don’t know whether the conclusion is true or false.
![Page 10: Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.](https://reader035.fdocuments.in/reader035/viewer/2022081515/56649d0d5503460f949e29df/html5/thumbnails/10.jpg)
10
![Page 11: Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.](https://reader035.fdocuments.in/reader035/viewer/2022081515/56649d0d5503460f949e29df/html5/thumbnails/11.jpg)
11
Rule of inference
![Page 12: Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.](https://reader035.fdocuments.in/reader035/viewer/2022081515/56649d0d5503460f949e29df/html5/thumbnails/12.jpg)
12
Modus Ponens
if you study then you succeedyou studyyou succeed
Aristotle called this modus ponens:
if P then QP
Q
PremisesConclusion
(a rule of inference – one of the most important rules)
![Page 13: Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.](https://reader035.fdocuments.in/reader035/viewer/2022081515/56649d0d5503460f949e29df/html5/thumbnails/13.jpg)
13
Important!
• We are dealing with the validity of an argument, NOT with the validity of the result!
• In logic, it doesn’t matter if a logical statement makes sense or not.
• What does matter is that if the premises are correct, then so is the result.
![Page 14: Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.](https://reader035.fdocuments.in/reader035/viewer/2022081515/56649d0d5503460f949e29df/html5/thumbnails/14.jpg)
14
Modus Ponens Examples
• P: I study hardQ: I get an A
• P: cows give milkQ: doors open
Makes sense
Doesn’t make sense
if P then QP
Q
![Page 15: Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.](https://reader035.fdocuments.in/reader035/viewer/2022081515/56649d0d5503460f949e29df/html5/thumbnails/15.jpg)
15
if thinks(‘Jill’) then exists(‘Jill’)thinks(‘Jill’)exists(‘Jill’)
if P(‘Jill’) then Q(‘Jill’)P(‘Jill’)Q(‘Jill’)
Predicates and Arguments
if ‘Jill’ thinks then ‘Jill’ exists‘Jill’ thinks‘Jill’ exists
if thinks(X) then exists(X)thinks(X)exists(X)
![Page 16: Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.](https://reader035.fdocuments.in/reader035/viewer/2022081515/56649d0d5503460f949e29df/html5/thumbnails/16.jpg)
16
Predicates in arguments (continued…)
thinks(X) exists(X)thinks(X)exists(X)
thinks(X) -: exists(X)thinks(X)exists(X)
if thinks(X) then exists(X)thinks(X)exists(X)
![Page 17: Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.](https://reader035.fdocuments.in/reader035/viewer/2022081515/56649d0d5503460f949e29df/html5/thumbnails/17.jpg)
17
![Page 18: Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.](https://reader035.fdocuments.in/reader035/viewer/2022081515/56649d0d5503460f949e29df/html5/thumbnails/18.jpg)
18
![Page 19: Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.](https://reader035.fdocuments.in/reader035/viewer/2022081515/56649d0d5503460f949e29df/html5/thumbnails/19.jpg)
19
![Page 20: Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.](https://reader035.fdocuments.in/reader035/viewer/2022081515/56649d0d5503460f949e29df/html5/thumbnails/20.jpg)
20
![Page 21: Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.](https://reader035.fdocuments.in/reader035/viewer/2022081515/56649d0d5503460f949e29df/html5/thumbnails/21.jpg)
21
![Page 22: Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.](https://reader035.fdocuments.in/reader035/viewer/2022081515/56649d0d5503460f949e29df/html5/thumbnails/22.jpg)
22
![Page 23: Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.](https://reader035.fdocuments.in/reader035/viewer/2022081515/56649d0d5503460f949e29df/html5/thumbnails/23.jpg)
23
![Page 24: Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.](https://reader035.fdocuments.in/reader035/viewer/2022081515/56649d0d5503460f949e29df/html5/thumbnails/24.jpg)
24