Presentation is loading. Please wait.

Presentation is loading. Please wait.

Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1.

Similar presentations


Presentation on theme: "Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1."— Presentation transcript:

1 Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1

2 Gnu prolog program http://gnu-prolog.soft112.com/download.html 2

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. 3

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). 4

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, … 5

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 6

7 Are these propositions? 2+2=5 Every integer is divisible by 12 Microsoft is an excellent company 7

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 8

9 Logical Arguments Consider the following statements. 1.if you study then you succeed 2.you study 3.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. 9

10 10

11 Rule of inference 11

12 Modus Ponens if you study then you succeed you study you succeed Aristotle called this modus ponens: if P then Q P Q Premises Conclusion (a rule of inference – one of the most important rules) 12

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. 13

14 Modus Ponens Examples P:I study hard Q:I get an A P:cows give milk Q:doors open Makes sense Doesn’t make sense if P then Q P Q 14

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) 15

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) 16

17 17

18 18

19 19

20 20

21 21

22 22

23 23

24 24


Download ppt "Logic programming ( Handbook of Logic in Artificial Intelligence, Vol) by D. M. Gabbay, C. Hogger, J.A. Robinson. 1."

Similar presentations


Ads by Google