EM214_Logic_part 2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 25

EM 214: Discrete Mathematics

Class Notes

Propositional logic : Part 2

Dr. R. Palamakumbura
Propositional Logic
• In the part 1 of the lecture notes, we studied symbols, syntax
and semantic on propositional logic.

• In this part 2 of the lecture first we will look more into


conditional statements and we will learn propositional
resolution, an inference rule to prove the validity of an
argument.
Propositional Logic
• Converse, Contrapositive and Inverse:
Given a conditional statement, it is possible to form new
conditional statements.

Definitions: Suppose we have a conditional statement p → q .

1. Converse: This is the proposition q → p .

2. Contrapositive: This is the proposition ⌝q → ⌝p .

3. Inverse: This is the proposition ⌝p → ⌝q .

Next we will evaluate the truth values of these and see which
of them are logically equivalent to p → q .
Propositional Logic

• Examples:

1.

2. Write the inverse , converse, contrapositive of the statement, “If a


number is divisible by 9 then number is divisible by 3”.
Converse: If a number is divisible by 3 then number is divisible
by 9.
Inverse: If a number is not divisible by 9 then number is not divisible
by 3.
Contrapositive: If a number is not divisible by 3 then number is not
divisible by 9.
Propositional Logic
3. Write the inverse , converse, contrapositive of the statement, “If a
figure is a square then it is a quadrilateral”.
Converse: If a figure is a quadrilateral then it is a square.
Inverse: If a figure is not a square then it is not a quadrilateral.
Contrapositive: If a figure is not a quadrilateral then it is not a
square.
Propositional Logic

• Thus we have the following.


- Conditional statement and the contrapositive are logically
equivalent.
- Inverse and converse are logically equivalent.

• Propositional satisfiability:
- A compound proposition is satisfiable if there is an assignment of
the truth values to its variables that makes it true. When no such
assignment exist then it is unsatisfiable.

- Determining whether or not a compound proposition is satisfiable is


not easy.

- One approach is construct a truth table and check T appears in the


column. But this approach is not very efficient since with n
variables, the truth table contains 2n lines.

- The general problem of deciding whether a proposition is


satisfiable is called SAT.
Propositional Logic

• Normal Forms:
It is easier to work with the logical connectives ∨ , ∧ , ⌝
and such wffs are called Normal forms.
There are two such normal forms.

- Conjunctive normal form: CNF


- Disjunctive normal form: DNF

Literals: Literals are simple propositions or a negation. p, ⌝p

Conjunctive normal form: CNF


This is obtained by ANDing together Ors of one or more
literals.
Examples:
p ∨ r, (p ∨ q) ∧ r, (p ∨ q) ∧ ⌝r, p ∧ ⌝q etc .
Propositional Logic
Disjuctive normal form: DNF
This consists of OR of ANDs.
Examples:
p ∧ r, (p ∧ q) ∨ r, (p ∧ q) ∨ ⌝r etc .

• Note:
Using the following logical equivalences it is possible to transform
any compound proposition to CNF or DNF.
1.Remove the implication:
p ↔ q ≡ (p → q) ∧ (q → p)
p → q ≡ ⌝p ∨ q

2. Move negation inward using De Morgan’s Laws.


3. Distributive law.
Propositional Logic

• Converting to CNF: We will do examples only to CNF. Converting


to DNF can be done in a similar fashion.
Examples:
1. (p ∨ q) → (r → s)
≡ (p ∨ q) → (⌝r ∨ s) Eliminate implication
≡ ⌝(p ∨ q) ∨ (⌝r ∨ s) Eliminate implication
≡ (⌝p ∧ ⌝q) ∨ (⌝r ∨ s) De Morgan′s
≡ (⌝p ∨ ⌝r ∨ s) ∧ (⌝q ∨ ⌝r ∨ s) Distributive law

2. (q ∨ (p ∧ r)) → (q ∨ ⌝p)
≡ ⌝(q ∨ (p ∧ r)) ∨ (q ∨ ⌝p) Eliminate implication
≡ ⌝q ∧ ⌝(p ∧ r)) ∨ (q ∨ ⌝p) De Morgan′s
≡ (⌝q ∧ (⌝p ∨ ⌝r)) ∨ (q ∨ ⌝p) De Morgan′s
≡ (⌝q ∨ (q ∨ ⌝p)) ∧ ((⌝p ∨ ⌝r) ∨ (q ∨ ⌝p)) Distributive law
≡ (⌝q ∨ q ∨ ⌝p) ∧ (⌝p ∨ ⌝r ∨ q ∨ ⌝p) Flatten the disjunction
≡ T ∧ (⌝p ∨ ⌝r ∨ q)
≡ ⌝p ∨ ⌝r ∨ q
Propositional Logic

• Validity of an Argument:

• Definition: Argument in Propositional logic


An argument in propositional logic is a sequence of propositions.
The final proposition is called the conclusion and others are called
premises.

Validity:
The argument is valid if the conclusion ( final statement) follows
from the truth of the preceding statements (premises). That is an
argument is valid if the premises are all true then the conclusion is
true.
Suppose p1, ⋯, pn are premises and q is the conclusion. Then the
argument is valid when p1 ∧ ⋯ ∧ pn → q is a tautology.
Propositional Logic

• Validity of an Argument:

Examples:
1.If you have a valid password then you can log onto the network.
p: You have a valid password
q: You can log onto the network
Therefore the argument is, p→q
p
q
2. It will be sunny or cloudy today. It isn’t sunny. Therefore it will be cloudy.

p: It will be sunny today.


q: It will be cloudy today

Therefore the argument is, p∨q


⌝p
q
Propositional Logic

• Tests to check the validity of an Argument:

There are two methods to check validity of an argument.

- Truth table test and Inference rules

Truth table test:

1. Identify the premises and the conclusion and express them


symbolically.

2.Construct a truth table showing the truth values of premises


and conclusion.

3.Look for all the rows where the premises are true. These are
called critical rows. If the conclusion is false in a critical row
then the argument is invalid otherwise valid.
Propositional Logic

• Note: Instead of 2-3 above we can proceed as follows.

Form the conditional statement p1 ∧ p2 ∧ ⋯ ∧ pn → q . Create a truth


table and if it is a tautology then the argument is valid.

Example: Consider the sunny example. The argument in symbolic


form.
p∨q
⌝p
q

The conditional statement (p ∨ q) ∧ ⌝p → q .

As a homework construct the truth table and show that this is a


tautology.
Propositional Logic

Inference Rules:

Inference rules are simple argument forms. These are templates


for building valid arguments.

Here we will consider the inference rule, Propositional


resolution.

Clausal Form:

Propositional resolution works when the premises and conclusion


are in the clausal form. Therefore they must be converted to this
form prior to applying the inference rule.
Propositional Logic

A clause is either a literal or disjunction of literals.

Ex: {p}, {q}, {⌝p, q} , {} etc . Here{⌝p, q} = ⌝p ∨ q .

• Note:

1.The empty clause {} means it is unsatisfiable.

2. Thus the clauses are the terms appearing in a proposition in


CNF. Thus convert the premises and the conclusion to CNF and
identify the clauses in the sentence.

Example: p ∧ (q → r) ≡ p ∧ (⌝q ∨ r) .

Therefore clauses are {p}, {⌝q, r} .


Propositional Logic

• Propositional resolution:

- In the field of Artificial Intelligence, there have been many


attempts to construct programs that could prove theorems
automatically.

- Given a set of axioms and a technique for deriving new theorems


from old theorems and axioms, would such a program be able to
prove a particular theorem?

- 1965: J.A.Robinson at Syracuse University discovered the


technique called resolution.
Propositional Logic

• Propositional resolution:
{p, q}
The Rule: {p, q}, {⌝q, r} or {⌝q, r}
{p, r} {p, r}
Idea:

Suppose we have {p, q} . This gives p is true or q is true.

Suppose we also have {⌝q, r} . This gives q is false or r is true.

Thus one clause contains q and other clause contains not q.

If q is false then {p, q} says p is true.

If q is true then {⌝q, r} says r is true.

Since q must be either true or false then it must be the case that either p is true or r
is true. That is {p, r} .
Propositional Logic

• Note:

1. We say two opposing literals q, ⌝q are resolved, they are


removed when the disjunctions are merged.

2. In drawing a conclusion from two clauses that have a same


literal, we merge the two occurrences into one.
{⌝p, q}, {p, q}
{q}

3.If either clause is a singleton: {p, q, r}, {⌝p}


{q, r}
4. Resolving two singleton clauses leads to empty clause which is
a contradiction. {p}, {⌝p}
{}
Propositional Logic

• Note:

5. If two clauses resolve, they may have more than one


resolvent. In this case only one pair of literals is resolved at
a time, not both at once.

{p, q}, {⌝p, ⌝q} {p, q,}, {⌝p, ⌝q}


or
{p, ⌝p} {q, ⌝q}

• Resolution reasoning:

Example: Prove the following is a valid argument.


{⌝p, r}
{⌝q, r}
{p, q}
{r}
Propositional Logic
Example: We will prove this using propositional resolution.
1. {⌝p, r} premise
2. {⌝q, r} premise
3. {p, q} premise
4. {q, r} resolution 1,3
5. {r} resolution 2,4
Note: Resolution is not complete. That is it is not possible to find
resolution derivations for all clauses that are logically valid.
{p}
For example consider {q}
{p, q}
This is a valid argument, but there is no resolution derivation.

So the rule can be modified as follows so that the resolution


derivation is complete.
Propositional Logic
Negate the conclusion, add it to the premises and show that it is
invalid using propositional resolution. This is called resolution
proof.

• Resolution Proof:

Let Δ = {p1, ⋯, pn}, q be the set of premises and the conclusion


respectively. Then the resolution proof is a resolution derivation of
the empty clause from the clausal form of Δ ∪ {⌝q} . Remember an
empty clause is a contradiction.

So Δ ∪ {⌝q} is invalid means Δ → q is valid.


Propositional Logic
Examples:
{p}
1. Consider {q} .
{p, q}
Proof: First you need to negate the conclusion: {p, q} = p ∨ q
⌝(p ∨ q) = ⌝p ∧ ⌝q
= {⌝p}, {⌝q}

Now we can apply the rule. 1. {p} premise


2. {q} premise
3. {⌝p} premise
4. {⌝q} premise
4. {} resolution 1,3
5. {} resolution 2,4
Thus we have a contradiction. Therefore the argument is valid.
Propositional Logic
Examples:

2. Determine validity of the argument: The meeting can take place if all members
are informed in advance and there is quorum (a minimum number of members
are present). There is a quorum if at least 15 members are present. Members
would have been informed in advance if there was no postal strike.Therefore, if
the meeting was canceled, then either there were fewer than 15 members present
or there was a postal strike.

Step 1: Identify the propositions.

m: the meeting takes place;

a: all members are informed;

f: at least fifteen members are present;

q: the meeting had quorum;

p: there was a postal strike.


Propositional Logic
Step 2: Write down the premises and conclusion in symbolic form:
q ∧ a → m premise
f → q premise
⌝p → a premise
⌝m → (⌝f ∨ p) conclusion

Step 3: Negate the conclusion and add it to premises.

⌝(⌝m → (⌝f ∨ p)) ≡ ⌝(⌝(⌝m) ∨ (⌝f ∨ p)) Remove implication


≡ ⌝(m ∨ (⌝f ∨ p))
≡ ⌝m ∧ ⌝(⌝f ∨ p))
≡ ⌝m ∧ f ∧ ⌝p
Propositional Logic
Step 3: Convert to CNF and write in clausal form:
q ∧ a → m ≡ ⌝(q ∧ a) ∨ m ≡ ⌝q ∨ ⌝a ∨ m ≡ {⌝q, ⌝a, m}
f → q ≡ ⌝f ∨ q ≡ {⌝f, q}
⌝p → a ≡ ⌝(⌝p) ∨ a ≡ {p, a}
⌝m ∧ f ∧ ⌝p ≡ {⌝m}, {f}, {⌝p}

Step 4: Apply the inference rule


1.{⌝q, ⌝a, m} premise
7.{⌝f, ⌝a, m} resolution 1,2
2.{⌝f, q} premise
8.{⌝f, p, m} resolution 3,7
3.{p, a} premise
9.{⌝f, p} resolution 4,8
4.{⌝m} premise
10.{p} resolution 5,9
5.{f} premise
11.{ } resolution 6,10
6.{⌝p} premise
So we have the empty clause which is a contradiction. Hence the
argument is true.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy