<<

3/25/2017

Lo Lo Logic Outline

Inference Using •Review of propositional logic terminology •Notation, , rules of Propositional Logic •Proof by perfect induction CSE 415: Introduction to Artificial Intelligence •Clause form University of Washington •Proof by Spring 2017

© S. Tanimoto and University of Washington, 2017

Univ. of Wash. Inference with Propositional Logic 2

Lo Lo Logic Readings for Logic Logic Role of Logical Inference in AI

For basics of logic as a means of knowledge The single most important inference method. representation, consult the textbook material in: Section 4.8. “Propositional and Logic” But: (in EAIP, Part 2). •Doesn't handle uncertain information well. Propositional logic is covered in 4.8.1-4.8.6. (optional: Predicate logic is covered in 4.8.7-4.8.10.) •Needs algorithmic help – prone to the combinatorial explosion. For methods of inference with logic, see Chapter 6 (in EAIP, Part 4).

Univ. of Wash. Inference with Propositional Logic 3 Univ. of Wash. Inference with Propositional Logic 4

Lo Lo Logic Propositional Logic A Logical Syllogism

A formal mathematical system of notation and evaluation rules for representing and processing If it is raining, then I am doing my homework. true- statements involving logical relationships. It is raining.

An important foundation for knowledge Therefore, I am doing my homework. representation in artificial intelligence.

Several modern techniques combine logic and probability (e.g., Markov Logic Networks).

Univ. of Wash. Inference with Propositional Logic 5 Univ. of Wash. Inference with Propositional Logic 6

1 3/25/2017

Lo Lo Logic Another Syllogism Logic Terminology of the

Proposition symbols:

P, Q, R, P1, P2, ... , Q1, Q2, ..., R1, R2, ...

Atomic : a statement that does not specifically contain substatements. It is not the case that steel cannot float. P: “It is raining.” Therefore, steel can float. Q: “Neither did Jack eat nor did he drink.”

Compound proposition: A statement formed from one or more atomic using logical connectives.

P v Q: Either it is raining, or neither did Jack eat nor did he drink.

Univ. of Wash. Inference with Propositional Logic 7 Univ. of Wash. Inference with Propositional Logic 8

Lo Lo Logic Logical Connectives Logic Logical Connectives (Cont)

Negation: P not P

NAND: (P  Q) P nand Q Conjunction: P  Q P and Q

NOR: (P v Q) P nor Q Disjunction: P v Q P or Q Implies: P  Q if P then Q : P <> Q P exclusive-or Q P v Q

Univ. of Wash. Inference with Propositional Logic 9 Univ. of Wash. Inference with Propositional Logic 10

Lo Logically Complete Sets of Lo Logic Connectives Logic Syllogism: General Form

{, v} form a logically complete . 1 P  Q = (P v Q) Premise 2 ... {, } form a logically complete set Premise n P  Q = (P Q) ------Conclusion {, } form a logically complete set P v Q = (P  Q)

P1  P2  ...  Pn  C

Univ. of Wash. Inference with Propositional Logic 11 Univ. of Wash. Inference with Propositional Logic 12

2 3/25/2017

Lo : Lo : Logic Logic An important (modus ponens in reverse)

P  Q conditional P  Q conditional P antecedent Q consequent denied ------Q consequent P antecedent denied Can be proved using “” – taking the contrapositive of the conditional: aka the “cut rule” P  Q  Q P Q therefore, by modus ponens, P

Univ. of Wash. Inference with Propositional Logic 13 Univ. of Wash. Inference with Propositional Logic 14

Lo Lo Logic for Logical Inference Logic Proof by Perfect Induction

Prove that P, P v Q  Q

Issues: P Q P v Q P  (P v Q) (P  (P v Q))  Q

Goal-directed or not? T T T T T

Always exponential in time? Space? T F F F T

Intelligible to users? F T T F T

Readily applicable to problem solving? F F T F T

Univ. of Wash. Inference with Propositional Logic 15 Univ. of Wash. Inference with Propositional Logic 16

Lo Lo Logic Perfect Induction Logic Perfect Induction: Characteristics

• Given formulas: G0, G1, …, Gn-1, prove conclusion C. • Goal directed (compute only columns of interest) • Create a table with a column for each • Always exponential in time AND space (as a propositional , each premise, and the of the number of propositional variables) conclusion. • Somewhat understandable to non-technical users • Find all rows in which G0 through Gn-1 are all True. • Straightforward algorithmically • See if C is True in all those rows. • Not considered appropriate for general problem • If so, the syllogism is proven; otherwise, it’s not valid. solving.

Univ. of Wash. Inference with Propositional Logic 17 Univ. of Wash. Inference with Propositional Logic 18

3 3/25/2017

Lo Lo Logic Getting Ready for Resolution Logic Clause Form

Expressions such as P, P, Q and Q are called literals. They are atomic formulas to which a may be prefixed.

• Resolution is a general proof technique that supports A clause is an of the form L1 v L2 v ... v Lq logical reasoning. where each Li is a literal. Here q is any non-negative integer. • It underlies the language. Any propositional calculus formula can be represented as a set of clauses. • It requires that formulas be in a restricted form (“clause form”). (P  (Q  R)) starting formula • PROLOG imposes a further constraint that the clauses be (P  (Q v R)) eliminate  “Horn clauses.” ((P Q) v (P  R)) distribute  over v. (P  Q)  (P  R) DeMorgan’s law (P v Q)  (P v R) “ “ P v Q, P v R Double neg. and break into clauses

Univ. of Wash. Inference with Propositional Logic 19 Univ. of Wash. Inference with Propositional Logic 20

Lo Lo Logic Propositional Resolution Logic Why Does Resolution Work?

Two clauses having a pair of complementary literals can be Consider four examples: resolved to produce a new clause that is logically implied by its parent clauses. P, P  [] (the clause) e.g., (a ) Q v R v S, R v P  Q v S v P P, P v R  R P v Q, Q v R  P v R (modus ponens, since P  R P v R )

P, P v R  R

P, P  [] (the null clause)

Univ. of Wash. Inference with Propositional Logic 21 Univ. of Wash. Inference with Propositional Logic 22

Lo Lo Logic Why Does Resolution Work? Logic Proof Using Resolution

To Prove: (P  Q)  (Q  R)  (P  R) P v Q, Q v R  P v R (Suppose Q is false, then P must be true; Negate the conclusion: If Q is not false, then Q is false and R must be true. (P  Q)  (Q  R)  (P  R) One way or the other, either P or R must be true. Obtain clause form: P1 v … v Pn v Q,  Q v R1 v … v Rm  P1 v … v Pn v R1 v … v Rm P v Q, Q v R, P, R (We get this from the previous version by letting P = P1 v … v Pn and R = R1 v … v Rm .) Derive the null clause (F) using resolution: Q by resolving P with P v Q. This last example is the general case. R by resolving Q with Q v R. F by resolving R with R.

Univ. of Wash. Inference with Propositional Logic 23 Univ. of Wash. Inference with Propositional Logic 24

4 3/25/2017

Lo Lo Logic Reductio ad Absurdum Logic Resolution: Characteristics

A proof by resolution uses RAA (). • Not necessarily goal directed (can be used in either forward-chaining or backward-chaining systems). Original syllogism: Syllogism for RAA: • Time and space requirements depend on the Premise 1 Premise 1 in which resolution is embedded. Premise 2 Premise 2 • Can be made understandable to non-technical users ...... • Needs to be combined with a search algorithm. Premise n Premise n • Can be very appropriate for general problem solving ------Conclusion (e.g., using PROLOG) Conclusion ------[]

Univ. of Wash. Inference with Propositional Logic 25 Univ. of Wash. Inference with Propositional Logic 26

5