2 Logic and inferencingVisionNLPSearchReasoningLearningKnowledgeRoboticsExpert SystemsPlanningObtaining implication of given facts and rules -- Hallmark of intelligence
3 Inferencing through Deduction Induction Deduction (General to specific)Induction (Specific to General)Abduction (Conclusion to hypothesis in absence of any other evidence to contrary)DeductionGiven: All men are mortal (rule)Shakespeare is a man (fact)To prove: Shakespeare is mortal (inference)InductionGiven: Shakespeare is mortalNewton is mortal (Observation)Dijkstra is mortalTo prove: All men are mortal (Generalization)
4 If there is rain, then there will be no picnic Fact1: There was rainConclude: There was no picnicDeductionFact2: There was no picnicConclude: There was no rain (?)Induction and abduction are fallible forms of reasoning. Their conclusions are susceptible to retractionTwo systems of logic1) Propositional calculus2) Predicate calculus
5 PropositionsStand for facts/assertionsDeclarative statementsAs opposed to interrogative statements (questions) or imperative statements (request, order)Operators=> and ¬ form a minimal set (can express other operations)- Prove it.Tautologies are formulae whose truth value is always T, whatever the assignment is
6 ModelIn propositional calculus any formula with n propositions has 2n models (assignments)- Tautologies evaluate to T in all models.Examples:1)2)e Morgan with AND
7 Semantic Tree/Tableau method of proving tautology Start with the negation of the formula- α - formulaα-formulaβ-formula- β - formulaα-formula- α - formula
8 Example 2: Contradictions in all paths X (α - formula) (α - formulae) BCContradictions in all pathsBC
9 Exercise:Prove the backward implication in the previous example
10 Inferencing in PCBackward chainingResolutionForward chaining
11 KnowledgeProceduralDeclarativeDeclarative knowledge deals with factoid questions (what is the capital of India? Who won the Wimbledon in 2005? Etc.)Procedural knowledge deals with “How”Procedural knowledge can be embedded in declarative knowledge
12 Example: Employee knowledge base Employee recordEmp id : 1124Age : 27Salary : 10L / annumTax : Procedure to calculate tax from basic salary, Loans, medical factors, and # of children
14 A Semantic Graph bought student June computer new past tense agent in: modifiera: indefinitethe: definitestudentpast tenseagentboughtobjecttimecomputernewJunemodifierThe student bought a new computer in June.
15 Representation of Knowledge UNL representationRepresentation of KnowledgeRam is reading the newspaper
16 UNL: a United Nations project Dave, Parikh and Bhattacharyya, Journal of Machine Translation, 2002Started in 199610 year program15 research groups across continentsFirst goal: generatorsNext goal: analysers (needs solving various ambiguity problems)Current active language groupsUNL_French (GETA-CLIPS, IMAG)UNL_Hindi (IIT Bombay with additional work on UNL_English)UNL_Italian (Univ. of Pisa)UNL_Portugese (Univ of Sao Paolo, Brazil)UNL_Russian (Institute of Linguistics, Moscow)UNL_Spanish (UPM, Madrid)
28 Search in resolution Heuristics for Resolution Search Goal Supported StrategyAlways start with the negated goalSet of support strategyAlways one of the resolvents is the most recently produced resolute
29 Inferencing in Predicate Calculus Forward chainingGiven P, , to infer QP, match L.H.S ofAssert Q from R.H.SBackward chainingQ, Match R.H.S ofassert PCheck if P existsResolution – RefutationNegate goalConvert all pieces of knowledge into clausal form (disjunction of literals)See if contradiction indicated by null clause can be derived
30 Pconverted toDraw the resolution tree (actually an inverted tree). Every node is a clausal form and branches are intermediate inference steps.
31 TerminologyPair of clauses being resolved is called the Resolvents. The resulting clause is called the Resolute.Choosing the correct pair of resolvents is a matter of search.
32 Predicate Calculus Rules Introduction through an example (Zohar Manna, 1974):Problem: A, B and C belong to the Himalayan club. Every member in the club is either a mountain climber or a skier or both. A likes whatever B dislikes and dislikes whatever B likes. A likes rain and snow. No mountain climber likes rain. Every skier likes snow. Is there a member who is a mountain climber and not a skier?Given knowledge has:FactsRules
33 Predicate Calculus: Example contd. Let mc denote mountain climber and sk denotes skier. Knowledge representation in the given problem is as follows:member(A)member(B)member(C)∀x[member(x) → (mc(x) ∨ sk(x))]∀x[mc(x) → ~like(x,rain)]∀x[sk(x) → like(x, snow)]∀x[like(B, x) → ~like(A, x)]∀x[~like(B, x) → like(A, x)]like(A, rain)like(A, snow)Question: ∃x[member(x) ∧ mc(x) ∧ ~sk(x)]We have to infer the 11th expression from the given 10.Done through Resolution Refutation.
34 Club example: Inferencing member(A)member(B)member(C)Can be written as
38 AssignmentProve the inferencing in the Himalayan club example with different starting points, producing different resolution trees.Think of a Prolog implementation of the problemProlog Reference (Prolog by Chockshin & Melish)
39 From predicate calculus Problem-2From predicate calculus
40 A “department” environment Dr. X is the HoD of CSEY and Z work in CSEDr. P is the HoD of MEQ and R work in MEY is married to QBy Institute policy staffs of the same department cannot marryAll married staff of CSE are insured by LICHoD is the boss of all staff in the department
42 Questions on “department” Who works in CSE?Is there a married person in ME?Is there somebody insured by LIC?
43 Problem-3 (Zohar Manna, Mathematical Theory of Computation, 1974) From Propositional Calculus
44 Tourist in a country of truth-sayers and liers Facts and Rules: In a certain country, people either always speak the truth or always lie. A tourist T comes to a junction in the country and finds an inhabitant S of the country standing there. One of the roads at the junction leads to the capital of the country and the other does not. S can be asked only yes/no questions.Question: What single yes/no question can T ask of S, so that the direction of the capital is revealed?
46 Deciding the Propositions: a very difficult step- needs human intelligence P: Left road leads to capitalQ: S always speaks the truth
47 Meta Question: What question should the tourist ask The form of the questionVery difficult: needs human intelligenceThe tourist should askIs R true?The answer is “yes” if and only if the left road leads to the capitalThe structure of R to be found as a function of P and Q
48 A more mechanical part: use of truth table QS’s AnswerRTYesFNo
49 Get form of R: quite mechanical From the truth tableR is of the form (P x-nor Q) or (P ≡ Q)
50 Get R in English/Hindi/Hebrew… Natural Language Generation: non-trivialThe question the tourist will ask isIs it true that the left road leads to the capital if and only if you speak the truth?Exercise: A more well known form of this question asked by the tourist uses the X-OR operator instead of the X-Nor. What changes do you have to incorporate to the solution, to get that answer?
51 From Propositional Calculus Problem-4From Propositional Calculus
52 Another tourist example: this time in a restaurant setting in a different country (Manna, 1974) Facts: A tourist is in a restaurant in a country when the waiter tells him:“do you see the three men in the table yonder? One of them is X who always speaks the truth, another is Y who always lies and the third is Z who sometimes speaks the truth and sometimes lies, i.e., answers yes/no randomly without regard to the question.Question: Can you (the tourist) ask three yes/no questions to these men, always indicating who should answer the question, and determine who of them is X, who y and who Z?
53 Solution: Most of the steps are doable by humans only Number the persons: 1, 2, 31 can be X/Y/Z2 can be X/Y/Z3 can be X/Y/ZLet the first question be to 1One of 2 and 3 has to be NOT Z.Critical step in the solution: only humans can do?
54 Now cast the problem in the same setting as the tourist and the capital example Solving by analogyUse of previously solved problemsHallmark of intelligence
55 Analogy with the tourist and the capital problem Find the direction to the capital Find Z; who amongst 1, 2 and 3 is Z?Ask a single yes/no question to S (the person standing at the junction) Ask a single yes/no question to 1Answer forced to reveal the direction of the capital Answer forced to reveal who from 1,2,3 is Z
56 Question to 1Ask “Is R true” and the answer is yes if and only if 2 is not ZPropositionsP: 2 is not ZQ: 1 always speaks the truth, i.e., 1 is X
57 Use of truth table as before PQ1’s AnswerRTYesFNo
58 Question to 1: the first question Is it true that 2 is not Z if and only if you are X?
59 Analysis of 1’s answer Ans= yes Case 1: 1 is X/Y (always speaks the truth or always lies)2 is indeed not Z (we can trust 1’s answer)Case 2: 1 is Z2 is indeed not Z (we cannot trust 1’s answer; but that does not affect us)
60 Analysis of 1’s answer (contd) Ans= noCase 1: 1 is X/Y (always speaks the truth or always lies)2 is Z; hence 3 is not ZCase 2: 1 is Z3 is not ZNote carefully: how cleverly Z is identified.Can a machine do it?
61 Next steps: ask the 2nd question to determine X/Y Once “Not Z” is identified- say 2, ask him a tautologyIs P≡PIf yes, 2 is XIf no, 2 is Y
62 Ask the 3rd Question Ask 2 “is 1 Z” If 2 is X If 2 is Y (always lies) Ans=yes, 1 is ZAns=no, 1 is YIf 2 is Y (always lies)Ans=yes, 1 is XAns=no, 1 is Z3 is the remaining person
63 What do these examples show? Logic systematizes the reasoning processHelps identify what is mechanical/routine/automatableBrings to light the steps that only human intelligence can performThese are especially of foundational and structural nature (e.g., deciding what propositions to start with)Algorithmizing reasoning is not trivial