# Heuristic Search Techniques

Logic Use mathematical deduction to derive new knowledge. Predicate Logic is a powerful representation scheme used by many AI programs. Propositional logic is much simpler (less powerful). 1 Propositional Logic Symbols represent propositions (facts). A proposition is either TRUE or FALSE. Boolean connectives can join propositions together into complex sentences. Sentences are statements that are either TRUE or FALSE.

2 Propositional Logic Syntax The constants TRUE and FALSE. Symbols such as P or Q that represent propositions. Logical connectives: AND, conjunction OR, disjunction Implication , conditional (If then) Equivalence , biconditional Negation (unary) ( ) parentheses (grouping) 3 Truth Tables

P Q P P Q P Q P Q P Q False False

True False False True True False True True

False True True False True False False False True

False False True True False True True True

True 4 Sentences True, False or any proposition symbol is a sentence. Any sentence surrounded by parentheses is a sentence. The disjunction, conjunction, implication or equivalence of 2 sentences is a sentence. The negation of a sentence is a sentence. 5 Examples (P Q) R

If P or Q is true, then R is true P (Q R) If Q and R are both true, P must be true AND if Q or R is false then P must be false. P (Q R) If P is false, then If Q is true R must be true. 6 Sentence Validity A propositional sentence is valid (TRUE) if and only if it is true under all possible

interpretations in all possible domains. For example: If Today_Is_Tuesday Then We_Have_Class The truth does not depend on whether today is Tuesday but on whether the relationship is true. 7 Inference Rules There are many patterns that can be formally called rules of inference for propositional logic. These patterns describe how new knowledge can be derived from existing knowledge, both in the form of propositional logic sentences. Some patterns are common and have fancy names. 8

Inference Rule Notation When describing an inference rule, the premise specifies the pattern that must match our knowledge base and the conclusion is the new knowledge inferred. We will use the notation premise conclusion 9 Inference Rules Modus Ponens: x y, x y And-Elimination:

x1 x2 xn xi And-Introduction: x1, x2,,xn x1x2xn Or-Introduction: x x y z Double-Negation Elimination: x x Unit Resolution: x y, x y 10

Resolution Inference Rule x y, y z x z -or x y, y z x z 11 Logic & Finding a Proof Given a knowledge base represented as a set of propositional sentences. a goal stated as a propositional sentence a list of inference rules We can write a program to repeatedly apply inference rules to the knowledge base in the hope of deriving the goal. 12

Example It will snow OR there will be a test. Dave is Darth Vader OR it will not snow. Dave is not Darth Vader. Will there be a test? 13 Solution Snow = a Test = b Dave is Vader = c Knowledge Base (these are all true): a b,

c a, c By Resolution we know b c is true. By Unit Resolution we know b is true. 14 Developing a Proof Procedure Deriving (or refuting) a goal from a collection of logic facts corresponds to a very large search tree. A large number of rules of inference could be utilized. The selection of which rules to apply and when would itself be non-trivial. 15

Resolution & CNF Resolution is a single rule of inference that can operate efficiently on a special form of sentences. The special form is called clause form or conjunctive normal form (CNF), and has these properties: Every sentence is a disjunction (or) of literals All sentences are implicitly conjuncted (anded). 16 Propositional Logic and CNF Any propositional logic sentence can be converted to CNF. We need to remove all connectives other than OR (without modifying the meaning of a sentence)

17 Converting to CNF Eliminate implications and equivalence. Reduce scope of all negations to single term. Use associative and distributive laws to convert to a conjunct of disjuncts. Create a separate sentence for each conjunct. 18 Eliminate Implications and Equivalence x y becomes x y x y becomes ( x y) ( y x)

19 Reduce Scope of Negations ( x) becomes x (x y) becomes ( y x) (x y) becomes ( y x) ws a L s n a g deMor 20

Convert to conjunct of disjuncts Associative property: (A v B) v C = A v (B v C) Distributive property: (A ^ B) v C = (A v C) ^ (B v C) 21 Using Resolution to Prove Convert all propositional sentences that are in the knowledge base to CNF. Add the contradiction of the goal to the knowledge base (in CNF). Use resolution as a rule of inference to prove that the combined facts can not all be true. 22

Proof by contradiction We assume that all original facts are TRUE. We add a new fact (the contradiction of sentence we are trying to prove is TRUE). If we can infer that FALSE is TRUE we know the knowledgebase is corrupt. The only thing that might not be TRUE is the negation of the goal that we added, so if must be FALSE. Therefore the goal is true. 23 Propositional Example: The Mechanics of Proof Knowledge Base: P (P Q) R

(S T) Q T Goal: R e h t t n e s e r p e e

r b e o s t w o The n k e w s t fa c .

e u r t o t t n a w e w t a h w s

i s . Thi e u r t s i e v pr o 24 Conversion to CNF Sentence

P CNF P (P Q) R (S T) Q P Q R SQ TQ T T 25

Add Contradiction of Goal The goal is R, so we add R to the list of facts, the new set is: 1. P 2. P Q R 3. SQ 4. TQ 5. T 6. R 26

Resolution Rule of Inference Recall the general form of resolution: x1 x2 ... xn z, y1 y2 ym z x1 x2 ... xn y1 y2 ym 27 Applying Resolution Fact 2 can be resolved with fact 6, yielding a new fact: P Q R R P Q

A ne 7. t c a f t i call , t c a f w 28

2. P Q R 6. R 7. P Q 4. T Q 1. P 8. Q 9. T There is no way all the clauses can be true!

5. T Null Clause 29 A more intuitive look at the same example. P: Joe is smart Q: Joe likes hockey R: Joe goes to RPI S: Joe is Canadian T: Joe skates. 30

Original Sentences: Joe is smart If Joe is smart and Joe likes hockey, Joe goes to RPI If Joe is Canadian or Joe skates, Joe likes hockey. Joe skates. After conversion to CNF: Fact 2: Joe is not smart, or Joe does not like hockey, or Joe goes to RPI. Fact 3: Joe is not Canadian or Joe likes hockey. Fact 4: Joe does not skate, or Joe likes hockey.

31 Joe is not smart, or Joe does not like hockey, or Joe goes to RPI Joe does not go to RPI Joe is not smart or Joe does not like hockey Joe does not skate, or Joe likes hockey Joe is smart Joe does not like hockey Joe skates

Joe does not skate Null Clause 32 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts. It is much easier to model real world objects using properties and relations. Predicate Logic provides these capabilites more formally and is used in many AI domains to represent knowledge. 33

Propositional Logic Problem If the unicorn is mythical, then it is immortal, but if it is not mythical then it is a mortal mammal. If the unicorn is either immortal or a mammal, then it is horned. The unicorn is magical if it is horned. Q: Is the unicorn mythical? Magical? Horned? 34

## Recently Viewed Presentations

• UK-based pharma major is conducting 13 drug trials in India for the treatment of diseases such as cancer,arthritis,heart disease and constipation. Johnson & Johnson, Eli Lilly are conducting respectively eight studies in India. Suven Life Sciences & Sipra Labs are...
• Medication for Connor not sleeping - shutters built - sitting on stairs/samaritans. What was it like running a home programme for almost four years. The Pros. People in your house all the time. ... Consider language -avoid jargon or unnecessary...
• Constructivists: Two Schools of Thought Cognitive Constructivist Jean Piaget (1896-1980) Swiss Learning is adaptation accomplished by: Acculturation Assimilation Equilibrium Information is organized into interrelated ideas or schemas Cognitive Constructivist Ernst von Glasersfeld Radical Constructivism Our subjective experiences interact with ...
• There was, for instance, Mobile Matrix, which consisted of the enormous skeleton of a gray whale, inscribed with a series of radiating lines and suspended from the ceiling of the José Vasconcelos Library in Mexico City. ... And this time,...
• Presidential Advisors and Executive Agencies Chapter 7, Section 4 Organization of the Federal Branch Executive Office/White House Office People who work directly for the President (about 500) 10-12 of the President's closest advisors Chief of Staff is most powerful advisor...
• Developed by TACT: Pamela E. Aeppel, M.A. Shawna L. Thomas, B.A. Chief Visual Designer: Kayvrie Vega. Child Welfare Training Consortium. University of South Florida
• Walt Whitman (1819-1892) And the Universal Litterature By José Antonio García Introduction: Why Universal Litterature? Why I have choosen this topic? Because I want to speak English in class, in front of my students Because it was a challenge for...
• Lecture 1: Attitudes (Chapter 5; Hogg & Vaughan) At the end of the lecture … ''How is attitude formation considered/conceptualised within Social Psychology' Structure and function of attitudes Forming attitudes Concepts related to attitudes Attitudes in terms of behaviour?