Presentation is loading. Please wait.

Presentation is loading. Please wait.

KNOWLEDGE REASONING & INFERENCE KNOWLEDGE REASONING & INFERENCE 1 Dr. Abbas Fadhil M. A. AL-Juboori Computer Science Dept. – Kerbala University

Similar presentations


Presentation on theme: "KNOWLEDGE REASONING & INFERENCE KNOWLEDGE REASONING & INFERENCE 1 Dr. Abbas Fadhil M. A. AL-Juboori Computer Science Dept. – Kerbala University"— Presentation transcript:

1 KNOWLEDGE REASONING & INFERENCE KNOWLEDGE REASONING & INFERENCE 1 Dr. Abbas Fadhil M. A. AL-Juboori Computer Science Dept. – Kerbala University

2 perceive object interpretation action REASONING

3  Definition  A process of applying knowledge to arrive at solution  Requires the ability to infer conclusions from the available facts  To reason is to think clearly and logically, to draw reasonable inference or conclusion from known or assumed facts  It works through interaction of rules and data

4 Process of working with knowledge, facts and problem solving strategies to draw conclusions

5 Reasoning mechanisms that are used to relate between facts and rules to derive new conclusion or facts

6  5 types:  Deductive  Inductive  Abductive  Analogical  Common-Sense

7  Deductive reasoning  A process in which general premises are used to obtain specific inference.  E.g. 1: (1). rainy_day  wet_grass (2). wet_grass rainy_day  E.g. 2: (1). mother(X)  female(X) (2). mother(lily) female(lily)

8  Inductive Reasoning  Human use to arrive new conclusion from a limited set of facts by the process of generalization.  E.g: P1: Monkeys in the National Zoo eats bananas P2: Monkeys in Taiping Zoo eats bananas All monkeys eat bananas

9  Abductive reasoning  A form of deduction that allows for plausible inference, meaning that, the conclusion might follow from available information, but it might be wrong.  Given B is true, if A  B is true, then the conclusion A is true might be deduced, but it can be false.  E.g.: P1: rainy_day  wet_grass P2: wet_grass rainy_day? … or maybe someone watered the grass.

10  Analogical Reasoning  Mapping of a mental model (developed from experience) to situation or objects.  E.g.: Q: “What are the working hours of engineers in the company” ▪ Mental model : Engineers are white-collar employees White collar employees work from 8am-5p Working hours for the engineers is from 8am-5pm.

11  Common-Sense Reasoning  Based on heuristic knowledge gained through experience.  Relies more on good judgment than on exact logic.  E.g.: ▪ A loose fan usually causes strange noises.  Valuable for quick solutions.

12 CConcept 1 : Pattern matching AA process of matching between symbols, and between predicates, to determine whether they are identical and therefore, match to each other. CConcept 2 : Instantiation AA process of substituting or replacing a variable with another variable or a constant. OOnly applicable when dealing with FOPL statements. CConcept 3 : Unification AA process of matching identical predicates and instantiating the variables (if any) with another variables or constants. CCombine pattern matching with instantiation. OOnly applicable when dealing with FOPL statements.

13  Two symbols/predicates are matched if they are identical  E.g.  tweety  tweety (match)  tweety  tweaty (doesn’t match)  fly  flies (doesn’t match)  man  men (doesn’t match)  teach(X, math)  teach(she, math) ▪ identical predicate name/functor ▪ identical # of arguments Pattern 1 Pattern 2 Pattern 4 Mismatch because unequal with Pattern 1 Pattern 3

14  A variable can be instantiated with  Another variable (normally represent object) ▪ E.g.: X/Y; X/Z  Constant ▪ E.g.: X/math; Y/adam  E.g.: man(X), man(Y)..... X/Y or Y/X man(X), man(adam)..... X/adam teach(X, math), teach(joe,Y)..... X/joe; Y/math

15 IInstantiation involving rules TThe same variable in the same rule must be instantiated with the same value (can be either another variable or constant). EE.g.: R1 : have(X, wings)  flies(X)  isa(X, Y) flies(tweety) X/tweety R1 : have(tweety,wings)  flies(tweety)  isa(tweety,Y)

16 TTwo predicates unify when they pass pattern matching and instantiation test. EE.g.: 1.isa(X,mammal) and isa(whale,mammal )..... X/whale; mammal  mammal 2.isa(X,mammal) and isa(Y,Z)..... X/Y or Y/X; Z/mammal 3.isa(X,Y) and isa(whale,mammal)..... X/whale; Y/mammal 4.isa(X,Y) and isa(whale,fish)..... X/whale; Y/fish 5.isa(X,Y) and isa(P,Q)..... X/P or P/X; Y/Q or Q/Y 6.isa(X,Mammal) and isa(Whale,mammal)..... X/Whale or Whale/X; Mammal/mammal 7.isa(X,Y) and isa(whale,X)..... X/whale; Y/whale

17  Two predicates cannot unify if they failed pattern matching and/or instantiation test.  E.g.: 1.isa(X,mammal) and isa(whale,fish )..... mammal  fish 2.isa(X,mammal) and is(Y,Z)..... isa  is 3.isa(X,Y) and isa(whale,mammal,animal)..... different # of arguments 4.isa(X,X) and isa(whale,mammal)..... whale  mammal 5.isa(X,mammal) and isa(whale,X)..... X/whale; X/mammal

18  4 techniques:  Besides, there are also 2 control strategies:  Forward chaining  Backward chaining … will be discussed further in ES topic. Modus Ponens Modus Tollens Hypothetical Syllogism Resolution

19  Definition: Rule of logic that asserts IF A and (A  B) are known to be true, then one can infer that B is true.  E.g. 1.It is sunny day (A) 2.If it is sunny (A), then we will go to the beach (B) 3.We will go to the beach (B) or (in PL) 1.A 2.A  B 3. B

20 Basic form: ABAB A B ((A  B)  A)  B..... a tautology

21 Example with rules with >1 propositions: A  B  C A B C ((((A  B)  C)  A)  B)  C

22 DDefinition: Rule of logic that asserts IF (a  b), and b is known to be not true, then one can infer that a is not true. BBasic form: A  B  B  A ((A  B)   B)   A

23  Definition: Rule of logic that asserts IF (a  b) and (b  c) are true, (a  c) is also true.  Antecedent of the 1 st rule (b) is a premise of the 2 nd rule. The 3 rd rule concluded consists of:  the antecedent of the first rule (a) and  the consequent of the second rule (c).

24  Basic form: ABAB BCBC A  C ((A  B)  (B  C))  (A  C)

25  Definition  An inference strategy that is used to determine the truth of an insertion (new fact)  Structure:  (A v B)  (  B v C) = (A v C) * since B   B can be resolved.

26  New insertion should contradict with original insertion.  A contradiction is simply two axioms that are logically contradictory (Eg: B and  B). ▪ If B is true, saying that B is false is definitely contradict.  Known as “proof by refutation”  Resolvent ▪ New expression from the resolution of existing axioms.

27  Algorithm 1. Assume  P is TRUE 2.Show that the axioms and  P lead to a contradiction 3.Conclude that  P is FALSE since it leads to a contradiction. 4.Conclude that P is TRUE since  P is FALSE This process continues until a contradiction is produced.

28  Steps: 1.Negate the goal (proof by refutation) 2.Transform rules into clausal forms 3.Produce a resolvent from contradict axioms P PP  A  BA  B  A  B  B  C  A  C resolvent

29  Steps (c0ntinued): 4.Repeat Step 3 until P is obtained 5.Cancel both P and  P to procude [] to establish the goal. P PP [] ::::

30  Equivalence rules 1. P  (Q  R)  (P  Q)  R 2. P  Q  Q  P 3. P  Q  Q  P 4.  (P  Q)  P   Q De Morgan 5.  (P  Q)  P   Q De Morgan 6. P  Q  Q   P 7.  P  P Double negation elimination 8. P  Q  P  Q Implication elimination 9. P  Q  (P  Q)  (Q  P) 10. P  Q  (P  Q)  (  P   Q) 11. P   P  False

31 1. IF temperature > 100 (A) THEN patient has high temperature (B). 2. IF patient has high temperature (B) THEN advise two aspirin (C). 3. temperature > 100 (A). STATE 1 1.A  B 2.B  C 3.A

32 STATE 2 1.A  B 2.B  C 3.A 4.B STATE 3 1.A  B 2.B  C 3.A 4.B 5.C Perform a resolution to prove C. Step 1: Proof by refutation... obtain  C (by negating the goal C)

33 Step 2: Convert rules into clausal forms 1.  A  B 2.  B  C 3.A..... The existing axiom 4.  C.... The new insertion, contradict with the goal Step 3: Produce resolvents  A  B  B  C  A  C Rules are converted using equivalence rules P  Q   P  Q 1.  A  B 2.  B  C 3.A 4.  C 5.  A  C

34 Step 4: Repeat Step 3 to produce another resolvents A  A  C C C is obtained. 1.  A  B 2.  B  C 3.A 4.  C 5.  A  C 6.C

35 Step 5: Cancel C and  C to establish []. C  C [] [] is established. 1.  A  B 2.  B  C 3.A 4.  C 5.  A  C 6.C 7.[]

36 A complete resolution process is shown as below:  A  B  B  C C A  A  C CC []

37 E.g.: All cats are animal. By nature, animal will die. Using resolution, prove that if Chico is a cat, then Chico will die. 1.  X cat(X)  animal(X). 2.  Y animal(Y)  will_die(Y). 3.cat(chico). 1.  X cat(X)  animal(X). 2.  Y animal(Y)  will_die(Y). 3.cat(chico).

38  X cat(X)  animal(X) cat(chico) animal(chico)  Y animal(Y)  will_die(Y) will_die(chico) 1.  X cat(X)  animal(X). 2.  Y animal(Y)  will_die(Y). 3.cat(chico). 4.animal(chico). 5.  will_die(chico). 1.  X cat(X)  animal(X). 2.  Y animal(Y)  will_die(Y). 3.cat(chico). 4.animal(chico). 5.  will_die(chico). Step 1

39 Step 2 1.  X cat(X)  animal(X). 2.  Y animal(Y)  will_die(Y). 3.cat(chico). 4.animal(chico). 5.  will_die(chico). 1.  cat(X)  animal(X). 2.  animal(Y)  will_die(Y). 3.cat(chico). 4.animal(chico). 5.  will_die(chico). 1.  cat(X)  animal(X). 2.  animal(Y)  will_die(Y). 3.cat(chico). 4.animal(chico). 5.  will_die(chico). P  Q   P  Q

40 Proven! Contradiction between the goal will_die(ciko) and ¬wil_die(ciko). X/Y (note: Y/X is also true) Y/chico  cat(X)  animal(X)  animal(Y)  will_die(Y)  cat(Y)  will_die(Y) cat(chico)  will_die(chico) will_die(chico)

41 Q6: Use Modus Ponens to determine whether a cup supports a book or a book supports a cup. 1.ontopof(X,Y)  supports(X,Y). 2.isabove(X,Y)  (istouching(X,Y)  istouching(Y,X))  ontopof(X,Y). 3.isabove(cup,book). 4.istouching(cup,book).

42 ontopof(X,Y)  supports(Y,X) isabove(X,Y)  (istouching(X,Y)  istouching(Y,X))  ontopof(X,Y) isabove(cup,book) X/cup; Y/book isabove(cup, book)  (istouching(cup, book)  istouching(book, cup))  ontopof(cup, book) istouching(cup,book) ontopof(cup, book) X/cup; Y/book supports(book,cup) The answer for Q6

43 Q7: Use Resolution to prove hates(marcus,caesar). 1.man(marcus). 2.pompeians(marcus). 3.  X pompeians(X)  romans(X). 4.ruler(caesar). 5.  X romans(X)  loyalto(X,caesar)  hates(X,caesar). 6.  X loyalto(X,Y). 7.  X  Y man(X)  ruler(Y)  trytoassassinate(X,Y)   loyalto(X,Y). 8.trytoassassinate(marcus,caesar).

44 Q7: Use Resolution to prove hates(marcus,caesar). 1.man(marcus). 2.pompeians(marcus). 3.  X pompeians(X)  romans(X). 4.ruler(caesar). 5.  X romans(X)  loyalto(X,caesar)  hates(X,caesar). 6.  X loyalto(X,Y). 7.  X  Y man(X)  ruler(Y)  trytoassassinate(X,Y)   loyalto(X,Y). 8.trytoassassinate(marcus,caesar).

45 X/marcus (3)  pompeians(X)  romans(X) (2) pompeians(marcus) romans(marcus) (5)  romans(X)  loyalto(X,caesar)  hates(X,caesar). (7)  man(X)  ruler(Y)   trytoassassinate(X,Y)   loyalto(X,Y) loyalto(marcus,caesar)  hates(marcus,caesar) X/marcus; Y/caesar  man(marcus)   ruler(caesar)   trytoassassinate(marcus,caesar)  hates(marcus,caesar) hates(marcus,caesar) (4) ruler(caesar) (1) man(marcus)  ruler(caesar)   trytoassassinate(marcus,caesar)  hates(marcus,caesar)  trytoassassinate(marcus,caesar)  hates(marcus,caesar) (8)  trytoassassinate(marcus,caesar) (9)  hates(marcus,caesar) []


Download ppt "KNOWLEDGE REASONING & INFERENCE KNOWLEDGE REASONING & INFERENCE 1 Dr. Abbas Fadhil M. A. AL-Juboori Computer Science Dept. – Kerbala University"

Similar presentations


Ads by Google