You are on page 1of 27

CNF and Resolution Introduction

Discrete Mathematics - Logic Inference

6-2

Previous Lecture
Rules of substitution Logic inference Inference and tautologies Rules of inference

Discrete Mathematics - Logic Inference

6-3

Logic Puzzles
A prisoner must choose between two rooms each of which contains either a lady, or a tiger. If he chooses a room with a lady, he marries her, if he chooses a room with a tiger, he gets eaten by the tiger. he rooms have signs on them! I at least one of these rooms contains a lady II a tiger is in the other room

It is "nown that either both signs are true or both are false

6-4

Logic Puzzles (cntd)

#otation! p \$ the first room contains a lady % \$ the second room contains a lady

6-5

Logic Puzzles (cntd)

Argument .tep *. p p % ,. p % /. p 0. % Reason ). p 'p %( premise e+pression for implication idempotent law modus ponens rule of dis1unctive syllogism to , and /
'p %( p, p 'p %(

-. 'p %( p premise

7-6

Conjunctive Normal Form

A literal is a primitive statement 'propositional variable( or its negation p, p, %, % A clause is a dis1unction of one or more literals p %, p % r, %, s s r % A statement is said to be a 2on1unctive #ormal 3orm '2#3( if it is a con1unction of clauses p 'p %( 'r p( p % 'r p( 'r %( 'p % s r( 'r p( r

Discrete Mathematics - Predicates and Quantifiers

7-7

CNF Theorem
Theorem 4very statement is logically e%uivalent to a certain 2#3. Proof 's"etch( Let be a 'compound( statement. .tep ). 4+press all logic connectives in through negation, con1unction, and dis1unction. Let be the obtained statement. .tep *. 5sing DeMorgan6s laws move all the negations in to individual primitive statements. Let denote the updated statement .tep ,. 5sing distributive laws transform into a 2#3.

Discrete Mathematics - Predicates and Quantifiers

7-8

Example
3ind a 2#3 logically e%uivalent to .tep ). .tep *. .tep ,. 'p %( r 'p %( r 'p r( '% r( 'p %( r

Discrete Mathematics - Predicates and Quantifiers

7-9

ule of esolution
p% p r %r he corresponding tautology ''p %( 'p r(( '% r( 778asmine is s"iing or it is not snowing. It is snowing or Bart is playing hoc"ey.66 p \$ 7it is snowing6 % \$ 78asmine is s"iing6 r \$ 7Bart is playing hoc"ey6 77 herefore, 8asmine is s"iing or Bart is playing hoc"ey66 % r is called resolvent

7-10

Computerized Logic !nference

2onvert the premises into 2#3 2onvert the negation of the conclusion into 2#3 2onsider the collection consisting of all the clauses that occur in the obtained 2#3s 5se the rule of resolution to obtain the empty clause '(. If it is possible, then the argument is valid. 9therwise, it is not. :hy empty clause; he only way to produce the empty clause is to apply the resolution rule to a pair of clauses of the form p and p. herefore, the collection of clauses is contradictory. In other words, for any choice of truth values for the primitive statements, if premises are true, the conclusion cannot be false.

Discrete Mathematics - Logic Inference

6-11

Logic Puzzles
A prisoner must choose between two rooms each of which contains either a lady, or a tiger. If he chooses a room with a lady, he marries her, if he chooses a room with a tiger, he gets eaten by the tiger. he rooms have signs on them! I at least one of these rooms contains a lady II a tiger is in the other room

It is "nown that either both signs are true or both are false 'p %( p, p 'p %(

Discrete Mathematics - Predicates and Quantifiers

7-12

Example
A lady and a tiger &remises! p 'p %(, 'p %( p #egation of the conclusion! 2lauses! p, p %, % Argument! p% % p p premise premise resolvent premise resolvent %

7-14

"hat Propositional Logic Cannot #o

:e saw that some declarative sentences are not statements without specifying the value of 7indeterminates6 77x < * is an even number66 77If + < ) = >, then + = >66 77A man has a brother66 .ome valid arguments cannot be e+pressed with all our machinery of tautologies, e%uivalences, and rules of inference 4very man is mortal. .ocrates is a man. .ocrates is mortal

7-15

\$pen %tatements or Predicates

.entences li"e 7+ is greater than ,6 or 7person + has a brother6 are not true or false unless the variable is assigned some particular value. .entence 7+ is greater than ,6 consists of * parts. he first part, +, is called the variable or the sub1ect of the sentence. he second part ? the predicate, 7is greater than ,6 ? refers to a property the sub1ect can have. .entences that have such structure are called open statements or predicates :e write &'+( to denote a predicate with variable +

7-16

&nar'( )inar'( and so on

7+ is greater than ,6 7+ is my brother6 7+ is a human being6

contain only ) variable, unary predicates &'+(

7+ is greater than y6 7+ is the mother of y6 7car + has colour y6 7+ divides y < @6 7+ sits between y and @6 7+ is a son of y and @6 contain * variables, binary predicates A'+,y(

Discrete Mathematics Predicates and Quantifiers

7-17

*ssigning a +alue
:hen a variable is assigned a value, the predicates turns into a statement, whose truth value can be evaluated.
+B*

false true

+B-

false

+Bmy car yBgrey

Discrete Mathematics Predicates and Quantifiers

7-18

&niverse
:e cannot assign a variable of a predicate A#C value. :e need to obtain a meaningful statementD 7+ is greater than ,6
*, > a cat a big red truc"

4very variable of a predicate is associated with a universe or universe of discourse, and its values are ta"en from this universe 7+ is greater than ,6 7+ is my brother6 7+ is an animal6 7car + has colour y6 + + + + y is a number is a human is a ;;; is a car is a colour

Discrete Mathematics Predicates and Quantifiers

7-19

elational #ata,ases
A relational database is a collection of tables li"e
#o. ). #ame Bradley 2oleman .tudent ID .upervisor ,>)>)*, hesis title &etra Algebraic graph Berenbrin" theory

A table consists of a schema and an instance. A schema is a collection of attributes, where each attribute has an associated universe of possible values. An instance is a collection of rows, where each row is a mapping that associates with each attribute of the schema a value in its universe. 4very table is a predicate that is true on the rows of the instance and false otherwise.

Discrete Mathematics Predicates and Quantifiers

7-20

-uantifiers
9ne way to obtain a statement from a predicate is to assign all its variables some values Another way to do that is to use e+pressions li"e 73or every E6 7 here is E such that E6 7A E can be found E6 7Any E is E6 74very man is mortal6 7 here is + such that + is greater than ,6 7 here is a person who is my father6 2 73or any x, x 0 F

%uantification

Discrete Mathematics Predicates and Quantifiers

7-21

&niversal -uantifiers
Abbreviates constructions li"e 3or all E 3or any E 4very E 4ach E Asserts that a predicate is true for all values from the universe 74very man is mortal6 7All lions are fierce6 2 73or any x, x 0 F #otation! + &'+( means that for every value a from the universe &'a( is true

7-22

&niversal -uantifiers (cntd)

73or any x, x 0 F
2

74very car is redF

+ &'+( is false if and only if there is at least one value a from the universe such that &'a( is false .uch a value a is called a countere+ample hus to disprove that 74very man is mortal6 it suffices to recall the movie 7Gighlander6

Discrete Mathematics Predicates and Quantifiers

7-23

Existential -uantifiers
Abbreviates constructions li"e 3or some E 3or at least one E here is E here e+ists E Asserts that a predicate is true for at least one value from the universe 7 here is a living "ing6 7.ome people are fierce6 2 7 here is x such that x 10 F #otation! + &'+( means that there is a value a from the universe such that &'a( is true

7-24

Existential -uantifiers (cntd)

7 here is a red carF 2 73or some x, x < 0 F trueD my friend6s car is red falseD

+ &'+( is false if and only if for all a from the universe &'a( is false Disproving an e+istential statement is difficultD

7-25

-uantifiers and Negations

.ummari@ing true false

here is a countere+ample ? + &'+( 3or every value a from a value a from the universe the universe &'a( is true such that &'a( is false here is a value a from + &'+( the universe such that &'a( is true 3or all values a from the universe &'a( is false

9bserve that + &'+( is false if and only if + &'+( is true + &'+( is false if and only if + &'+( is true

Discrete Mathematics Predicates and Quantifiers

7-26

Example
:hat is the negation of each of the following statements; .tatement All lions are fierce + &'+( 4veryone has two legs + &'+( #egation here is a peaceful lion here is a person having more than two legs, one leg, or no legs at all All people hate coffee here is a tiger in every room

.ome people li"e + &'+( coffee here is a lady in + &'+( one of these rooms '.ome rooms contain a lady(

Discrete Mathematics Predicates and Quantifiers

7-27

.ome/or0
4+ercises from the Boo"! #o. ), *, -aci1, Ha'i,iv(, )*'vii,viii( 'page )>>\$)>*(