Propositional Logic - PowerPoint PPT Presentation

1 / 42
About This Presentation
Title:

Propositional Logic

Description:

A formula that is always true is called a tautology ... Check that ((p q) p) q is a tautology. Resolution Proofs. The big question in reasoning: ... – PowerPoint PPT presentation

Number of Views:86
Avg rating:3.0/5.0
Slides: 43
Provided by: cse13
Category:

less

Transcript and Presenter's Notes

Title: Propositional Logic


1
Propositional Logic
2
Basic Tenets
  • Reasoning about the world
  • Start with atomic propositions, eg.
  • the sun rises in the east
  • the Nile river flows north
  • Law of excluded middle a proposition is either
    true or false
  • Law of contradiction a proposition can never be
    true and false

3
Building complexity
  • Natural language constructions
  • or
  • eg. the light switch is off or the light bulb
    has blown
  • and
  • eg. the grass is green and the sun is shining
  • not
  • eg. the car is not parked in the garage

4
Logical Connectives
  • Suppose that p and q are propositions. Construct
    formulae
  • p ? q is read p or q, ? is called the
    disjunction connective
  • p ? q is read p and q, ? is called the
    conjunction connective
  • ?p is read not p, ? is called negation

5
Other language constructions
  • either or
  • eg. either Harry or Cedric will win the
    Triwizard Tournament
  • if then
  • eg. if it starts to rain then the grass will get
    wet

6
More Connectives
  • Suppose that p and q are propositions
  • p ? q is read p exclusive or q, ? is the
    exclusive or connective
  • p ? q is read p implies q, ? is the implies
    connective

7
Meaning and Truth Tables
  • Denote
  • TRUE ? 1
  • FALSE ? 0
  • What is the meaning of a logical connective?
  • Recall that a proposition is either true or false
  • A formula is also true or false
  • The meaning of a formula is defined by the truth
    or falsity of a formula given the truth or
    falsity of the propositions it contains

8
?
1
0
9
?
0
1
1
1
10
?
0
0
0
1
11
?
1
1
0
1
12
Nesting
  • More complex expressions are formulated by
    repeated applications of logical connectives
  • eg. (p ? q) ? (?s ? q)
  • Such an expression is called a propositional
    formula
  • An individual proposition such as p is also a
    formula but is more often referred to as an
    atomic proposition
  • A convention ranks connectives in the following
    way ?, ?, ?, ?
  • eg. q ? ?s ? q is interpreted as (q ? ?s ) ? q
    and NOT q ? (?s ? q)
  • Generally, if there is any chance of ambiguity,
    then use brackets!

13
Propositional Formulae
  • The truth of a formula is evaluated from the
    inside out
  • A formula that is always true is called a
    tautology
  • A formula that is always false is called a
    contradiction

14
Truth tables
1
1
1
1
15
Truth tables
0
0
0
0
16
Truth tables
0
0
1
1
0
1
1
1
17
The heart of a computer
  • Below all the multimedia, a computer works with
    0s and 1s and logic
  • A half adder adds two bits together
  • c
  • s

s
c
x ? y
(x ? ?y) ? (?x ? y)
y
x
18
A full adder
  • A full adder has a third input, a carry bit
  • co ??
  • s ??

s
co
x
y
ci
19
Boolean Functions
  • A formula like (p ? q) ? (?s ? q) can be viewed
    as a function f0, 13 ? 0, 1
  • 0, 13 is short for 0, 1 ? 0, 1 ? 0, 1
  • 0, 13 (u, v, w) u, v, w ? 0, 1
  • there is an ordering on the arguments
  • ordering made explicit by saying
    f(p, q, s) (p ? q) ? (?s ? q)
  • eg. f(0, 0, 1) 0

20
Boolean functions
  • The logical connectives ?, ?, ? are all Boolean
    functions of two variables
  • There are 16 distinct Boolean functions of two
    variables
  • domain contains 4 elements, i.e., (0, 0), (0,
    1), (1, 0), (1, 1)
  • each domain element can be mapped to either 0 or
    1
  • there are therefore 2 x 2 x 2 x 2 24 distinct
    functions
  • In general, for finite sets X and Y, the number
    of functions fX ? Y are YX

21
Interesting facts
  • The connectives ?, ? form a complete set
  • Any Boolean function of two variables f(p, q) is
    equivalent to a formula involving p, q, ?, and ?
  • ?, ? also form a complete set

22
Clauses a type of formula
  • A literal is either an atomic proposition or the
    negation of an atomic proposition, ie., p or ?p
  • A clause is a disjunction of literals, ie.,
  • where each li is a literal
  • Brackets are unnecessary since there is no
    ambiguity

l1 ? l2 ? ? ln
23
Clauses - examples
  • p ? q
  • ? p ? ? q
  • p ? ? q ? r ? s
  • p ? q
  • ? p ? ? ? q

YES
YES
YES
NO
NO
24
Conjunctive Normal Form (CNF)
  • A propositional formula is in conjunctive normal
    form if it consists of a conjunction of clauses,
    ie.,
  • where each ci is a clause

c1 ? c2 ? ? cn
25
CNF - examples
  • (p ? q)
  • (? p ? ? q) ? (p ? s)
  • (p ? ? q ? r ? s) ? (? p) ? (q ? r)
  • (p ? q) ? s
  • (? p ? ? q) ? (r ? q)

YES
YES
YES
NO
NO
26
Converting a formula into CNF
  • Any propositional formula can be converted to an
    equivalent formula in CNF
  • 1. Eliminate connectives other than ?, ? and ?
  • 2. Push ? as far as possible into the formula
  • 3. Push ? as far as possible into the formula

27
1. Connective Elimination
  • All binary connectives are equivalent to a
    combination of ?, ?, and ?
  • For example p ? q is equivalent to ?p ? q

28
2. Pushing Negation
  • Three laws
  • ??p ? p double negation
  • ?(p ? q) ? ?p ? ?q De Morgans law
  • ?(p ? q) ? ?p ? ?q De Morgans law
  • denotes is equivalent to or
  • can be replaced by

29
Pushing Negation - example
?(p ? (q ? ?r))
(?p ? ?(q ? ?r))
(?p ? (?q ? ??r))
(?p ? (?q ? r))
30
3. Pushing Disjunction
  • One law
  • (p ? q) ? r ? (p ? r) ? (q ? r) distributive
    law
  • Note that r can be a complex formula
  • Like like mathematics!
  • (x 3)(y 2) x(y 2) 3(y 2)
  • xy 2x 3y 6

31
Pushing Disjunction - example
(p ? s) ? (q ? ?r))
(p ? (q ? ?r)) ? (s ? (q ? ?r))
(p ? q) ? (p ? ?r) ? (s ? q) ? (s ? ?r)
32
Reasoning
  • the light switch is off or the light bulb has
    blown
  • the light switch is on
  • What can you conclude?

the light bulb has blown
33
Reasoning
  • The process of reasoning involves taking two or
    more premises and generating a conclusion
  • In the previous example, the premises were of the
    form p ? q and ?p
  • The conclusion was q
  • This is an instance of a reasoning process called
    resolution
  • Is this reasonable? Check that ((p ? q) ? ?p) ?
    q is a tautology

34
Resolution Proofs
  • The big question in reasoning
  • If I suppose H,
  • can I then conclude C?
  • With resolution this question is equivalent to
  • Assuming H1, H2, , and Hn and ?C
  • can I derive false (the empty clause)?
  • H1 ? H2 ? ? Hn is the CNF equivalent of H
  • This is not trivial!

35
Resolution
  • A resolution step takes two clauses where an atom
    is positive in one clause and negative in the
    other
  • The derived conclusion is the combination of two
    clauses without the specified atom

p1 ? p2 ? ? pn ? p
?p ? q1 ? q2 ? ? qm
p1 ? p2 ? ? pn ? q1 ? q2 ? ? qm
36
Resolution Proof
  • The premises for a resolution step comes from two
    sources
  • 1. Any assumption Hi or ?C
  • 2. The conclusion from other resolution steps
  • Repeatedly use resolution until you can derive
    the empty clause then conclude C
  • The empty clause is also called false because
  • p ? p ? FALSE

37
Resolution Proofs - example
  • the light switch is off or the light bulb has
    blown
  • the light switch is on
  • Conclude
  • the light bulb has blown

38
Resolution Proofs - example
the light switch is off ? the light bulb has
blown
the light switch is on
?the light bulb has blown
the light bulb has blown

39
Putting it all together
  • Prove by resolution that
  • s ? (?s ? (r ? (p ? ?r))) ? (?r ? q)
  • implies
  • p ? q

40
Putting it all together
  • Firstly, convert to CNF
  • Let H s ? (?s ? (r ? (p ? ?r))) ? (?r ? q)
  • s ? (?s ? r) ? (?s ? p ? ?r)
  • ? (?r ? q)
  • Negate the conclusion and convert to CNF
  • Let C p ? q. Therefore ?C ?(p ? q)
  • (?p ? ?q)

41
The Proof
H s ? (?s ? r) ? (?s ? p ? ?r) ? (?r ?
q)
r
?C (?p ? ?q)
q
?p
?s ? ?r
?r

42
The End
  • Therefore
  • s ? (?s ? (r ? (p ? ?r))) ? (?r ? q)
  • implies
  • p ? q
Write a Comment
User Comments (0)
About PowerShow.com