0% found this document useful (0 votes)
51 views

Propositional Logic & Reasoning: Vikram Pudi IIIT Hyderabad

This document discusses propositional logic and reasoning. It introduces knowledge representation using formal languages like logic. Propositional logic uses letters to represent basic propositions and operators like "not", "and", "or" to represent complex sentences. Semantics are defined using truth tables to determine if a sentence is valid, satisfiable or unsatisfiable. Various inference rules like modus ponens and modus tollens are discussed. Formal proofs can be constructed using these rules to show logical arguments are valid. Complete proof systems like resolution are also covered.

Uploaded by

Harshit Karwal
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views

Propositional Logic & Reasoning: Vikram Pudi IIIT Hyderabad

This document discusses propositional logic and reasoning. It introduces knowledge representation using formal languages like logic. Propositional logic uses letters to represent basic propositions and operators like "not", "and", "or" to represent complex sentences. Semantics are defined using truth tables to determine if a sentence is valid, satisfiable or unsatisfiable. Various inference rules like modus ponens and modus tollens are discussed. Formal proofs can be constructed using these rules to show logical arguments are valid. Complete proof systems like resolution are also covered.

Uploaded by

Harshit Karwal
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 40

Propositional Logic & Reasoning

Vikram Pudi
IIIT Hyderabad
Knowledge Representation

 Knowledge Representation: expressing


knowledge explicitly in a computer-
tractable way
 Knowledge Base: set of facts (or sentences)
about the domain in which the agent finds
itself
 These sentences are expressed in a (formal)
language such as logic

2
Why is it important?
 Reasoning: draw inferences from knowledge
 answer queries
 discover facts that follow from the knowledge base
 decide what to do
 etc.

3
Logic in General
 Logics are formal languages for representing
information such that conclusions can be drawn
 Syntax: Describes how to make sentences
 Semantics: How sentences relate to reality.
The meaning of a sentence is not intrinsic to that
sentence.
 Proof Theory: A set of rules for drawing
conclusions (inferences, deductions).

4
Logical Arguments
 All humans have 2 eyes.
 Kishore is a human.
 Therefore Kishore has 2 eyes.
 All humans have 4 eyes.
 Kishore is a human.
 Therefore Kishore has 4 eyes.
 Both are (logically) valid arguments.
 Which statements are true / false ?

5
Logical Arguments (contd)
 All humans have 2 eyes.
 Kishore has 2 eyes.
 Therefore Kishore is a human.
 No human has 4 eyes.
 Kishore has 2 eyes.
 Therefore Kishore is not human.
 Both are (logically) invalid arguments.
 Which statements are true / false ?

6
From English to Propositional
Formulae
 “it is not the case that the lectures are dull”: D
(alternatively “the lectures are not dull”)
 “the lectures are dull and the text is readable”: D  R
 “either the lectures are dull or the text is readable”:
DR
 “if the lectures are dull, then the text is not readable”:
DR
 “the lectures are dull if and only if (iif) the text is
readable”: D  R
 “if the lectures are dull, then if the text is not readable,
Kishore will not pass”: D  (R  P )

7
Why formal languages?
 Natural languages exhibit ambiguity.
 Examples:
 The boy saw a girl with a telescope
 Our shoes are guaranteed to give you a fit
 Ambiguity makes reasoning difficult / incomplete
 Formal languages promote rigour and thereby reduce
possibility of human error.
 Formal languages help reduce implicit / unstated
assumptions by removing familiarity with subject matter
 Formal languages help achieve generality due to
possibility of finding alternative interpretations for
sentences and arguments.

8
Propositional Logic
 Use letters to stand for “basic” propositions
 Complex sentences use operators for not, and, or,
implies, iff.
 Brackets ( ) for grouping
(P  (Q ((R))) vs. P  (Q  R)
 Omitting brackets
 precedence from highest to lowest is: , ,,, 
 Binary operators are left associative
(so P  Q  R is (P  Q)  R)
 Questions:
 Is (P  Q)  R same as P  (Q  R) ?
 Is (P  Q)  R same as P  (Q  R) ?

9
Semantics (Truth Tables)
P Q P PQ PQ PQ PQ
True True False True True True True
True False False False True False False
False True True False True True False
False False True False False True True

 One row for each possible assignment of True/False to


propositional variables
 Important: Above P and Q can be any sentence,
including complex sentences

10
Terminology
 A sentence is valid if it is True under all possible
assignments of True/False to its propositional
variables (e.g. P  P).
 Valid sentences are also referred to as
tautologies
 A sentence is satisfiable if and only if there is
some assignment of True/False to its
propositional variables for which the sentence is
True
 A sentence is unsatisfiable if and only if it is not
satisfiable (e.g. P  P).

11
Semantics (Complex Sentences)

R S (RS)(RS)
True True

True False

False True

False False

12
Semantics (Complex Sentences)

R S R RS RS (RS)(RS)


True True False True True True

True False False False False True

False True True False True True

False False True False True True

13
Material Implication
 The only time PQ evaluates to False is when P is True
and Q is False

 This is known as a conditional statement or material


implication

 English usage often suggests a causal connection


between antecedent (P) and consequent (Q) – this is not
reflected in the truth table

 So (P  P)  anything is a tautology!

14
Exercises
Given: A and B are true; X and Y are false,
determine truth values of:
 (AX)

 A(XY)

 A(X  (BY))

 [(AX)  B]  [(AX)  B]

 (PQ)  (AX)

 [(XY)  A]  [X  (YA)]

15
Entailment
 S  P — whenever all the formulae in the set S are
True, P is True

 This is a semantic notion; it concerns the notion of Truth

 To determine if S  P construct a truth table for S, P


 S  P if, in any row of the truth table where all formulae of S are
true, P is also true

 A tautology is just the special case when S is the empty


set.

16
Entailment Example
P PQ Q

True True True Modus Ponens

True False False Therefore, P, PQ  Q


False True True

False True False

17
Exercises
Use truth tables to determine validity of:

 If it rains, Raju carries an umbrella. Raju is


carrying an umbrella, therefore it will rain.

 If the weather is warm and the sky is clear, then


either we go swimming or we go boating. It is
not the case that if we do not go swimming, then
the sky is not clear. Therefore, either the
weather is warm or we go boating.

18
Formal Proofs
 Intend to formally capture the notion of proof that is
commonly applied in other fields (e.g. mathematics).
 A proof of a formula from a set of premises is a
sequence of steps in which any step of the proof is:
1. An axiom or premise
2. A formula deduced from previous steps of the proof
using some rule of inference
 The last step of the proof should deduce the formula
we wish to prove.
 We say that S follows from (premises) P to denote that
the set of formulae P “prove” the formula S.

19
Soundness and Completeness
 A logic is sound if it preserves truth (i.e. if a set
of premises are all true, any conclusion drawn
from those premises must also be true).
 A logic is complete if it is capable of proving any
valid consequence.
 A logic is decidable if there is a mechanical
procedure (computer program) to prove any
given consequence.

20
Inference Rules
 Modus Ponens: P, PQ  Q
 Modus Tollens: PQ, Q  P
 Hypothetical Syllogism: PQ, QR  PR
 And-Elimination: P1P2 … Pn  Pi
 And-Introduction: P1, P2, … , Pn  P1P2 … Pn
 Or-Introduction: Pi  P1P2 … Pn
 Double-Negation Elimination: P  P
 Unit Resolution: PQ, Q  P
 Resolution: PQ, QR  PR

21
Example Formal Proof
1. A(B  D)
2. C  (D E)
3. AC
4. C / B  E
5. A 3,4 (Modus Tollens)
6. BD 1,5 (Unit Resolution)
7. DE 2,4 (Modus Ponens)
8. BE 6,7 (Hypothetical Syllogism)

22
Exercises
Construct formal proof of validity for:
 If the investigation continues, then new evidence is
brought to light. If new evidence is brought to light, then
several leading citizens are implicated. If several leading
citizens are implicated, then the newspapers stop
publicizing the case. If continuation of the investigation
implies that the newspapers stop publicizing the case,
then the bringing to light of new evidence implies that the
investigation continues. The investigation does not
continue. Therefore, new evidence is not brought to light.
 C: The investigation continues. N: New evidence is
brought to light. I: Several leading citizens are
implicated. S: The newspapers stop publicizing the case.

23
Solution
1. CN
2. NI
3. IS
4. (C  S)  (N  C)
5. C / N
6. CI 1,2 (Hypothetical Syllogism)
7. CS 6,3 (Hypothetical Syllogism)
8. NC 7,4 (Modus Ponens)
9. N 8,5 (Modus Tollens)

24
Exercises (contd.)
 If I study, I make good grades. If I do not
study, I enjoy myself. Therefore, either I
make good grades or I enjoy myself.
 S, G, E

25
Solution
1. SG
2. S  E / G  E
3. S  G 1
4. S  E 2
5. SE 4
(DoubleNegationEliminate)
6. GE 3,5 (Resolution)

26
Complete Proof Systems
 Truth Tables
 Inference Rules
 19 rules + Conditional Proof + Indirect Proof
 Method of Resolution

27
Resolution
 Better suited to computer implementation
 Generalizes to first-order logic
 The basis of Prolog’s inference method
 To apply resolution, all formulae in the
knowledge base and the query must be in
clausal form

28
Normal Forms
 A literal is a propositional letter or the negation of a
propositional letter
 A clause is a disjunction of literals
 Conjunctive Normal Form (CNF) – a conjunction of
clauses
e.g. (PQR) (SR)
 Disjunctive Normal Form (DNF) – a disjunction of
conjunctions of literals
e.g. (PQR)  (SR)
 Every propositional logic formula can be converted to
CNF and DNF

29
Conversion to CNF
 Eliminate  rewriting PQ as (PQ) (QP)
 Eliminate  rewriting PQ as PQ
 Use De Morgan’s laws to push  inwards:
 Rewrite (P  Q) as P  Q
 Rewrite (P  Q) as P  Q
 Eliminate double negations: rewrite P as P
 Use the distributive laws to get CNF:
 Rewrite (P  Q)  R as (P  R)  (Q  R)
 Rewrite (P  Q)  R as (P  R)  (Q  R)
 Exercise: Convert (P(QR)) to CNF

30
Solution
 (P(QR))
 (P(QR))
 P  (Q  R)
 P  (Q  R)
 P  (Q  R)
 Two clauses: P, Q  R

31
Resolution Rule of Inference
AB BC

AC

 where B is a propositional letter and A and


C are clauses (possibly empty).
 AC is the resolvent of the two clauses.

32
Applying Resolution
 How can we use the resolution rule?
One way:
 Convert knowledge base into clausal form
 Repeatedly apply resolution rule to the
resulting clauses
 A query A follows from the knowledge base if
and only if each of the clauses in the CNF of
A can be derived using resolution
 There is a better way . . .
33
Refutation Systems
 To show that P follows from S (i.e. S  P) using
refutation, start with S and P in clausal form and derive
a contradiction using resolution.
 The “empty clause ” (a clause with no literals) is
unsatisfiable (always False) – a contradiction.
 So if the empty clause is derived using resolution, the
original set of clauses is unsatisfiable.
 That is, if we can derive  from the clausal forms of S and
P, these clauses can never be all True together.
 Hence whenever the clauses of S are all True, at least
one clause from P must be False, i.e. P must be
False and P must be True.
 Hence, by definition, S  P
34
Applying Resolution Refutation
 Negate query to be proven.
 Convert knowledge base and negated
conclusion into CNF and extract clauses.
 Repeatedly apply resolution until either the
empty clause (contradiction) is derived or no
more clauses can be derived.
 If the empty clause is derived, answer ‘yes’
(query follows from knowledge base), otherwise
answer ‘no’ (query does not follow from
knowledge base)

35
Resolution: Example 1
(GH)(JK), G  J
Clausal form of (GH)(JK) is
{GJ, HJ, GK, HK}
1. GJ [Premise]
2. HJ [Premise]
3. GK [Premise]
4. HK [Premise]
5. G [Premise]
6. J [Conclusion]
7. G [1,6. Resolution]
8.  [5,7. Resolution]

36
Problems

 P  Q, Q  R  P  R

  ((P  Q)  P)  Q

37
Soundness and Completeness
 Resolution refutation is sound, i.e. it preserves
truth (if a set of premises are all true, any
conclusion drawn from those premises will also
be true).
 Resolution refutation is complete, i.e. it is
capable of proving all valid consequences of any
knowledge base.
 Resolution refutation is decidable, i.e. there is an
algorithm implementing resolution, which when
asked whether P  S, can always answer ‘yes’
or ‘no’ (correctly).

38
Heuristics in Applying Resolution
 Clause elimination — can disregard certain
types of clauses
 Pure clauses: contain literal L where L doesn’t
appear elsewhere
 Tautologies: clauses containing both L and L
 Subsumed clauses: another clause exists containing
a subset of the literals
 Ordering strategies
 Resolve unit clauses (only one literal) first
 Start with query clauses
 Aim to shorten clauses

39
Conclusion
 We have now investigated one knowledge
representation and reasoning formalism
 This means we can draw new conclusions from the
knowledge we have: we can reason
 Have enough to build a knowledge-based agent
 However, propositional logic is a weak language; there
are many things that cannot be expressed
 To express knowledge about objects, their properties
and the relationships that exist between objects, we
need a more expressive language: first-order logic

40

You might also like