0% found this document useful (0 votes)
32 views25 pages

Lecture 3 - Logic Equivalences and Soundness

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views25 pages

Lecture 3 - Logic Equivalences and Soundness

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 25

CSC510

DISCRETE STRUCTURES

Logic Equivalences and Soundness


Lecture 3: Logical Equivalences and Equality
SECTION SUMMARY

o Tautologies, Contradictions, and Contingencies.


o Logical Equivalence
o Important Logical Equivalences
o Showing Logical Equivalence
o Logic Equivalences (Laws)
o Normal Forms
o Disjunctive Normal Form
o Conjunctive Normal Form
Tautologies, Contradictions, and
Contingencies
A tautology is a proposition which is always true.
Example: p ∨¬p
A contradiction is a proposition which is always false.
Example: p ∧¬p
A contingency is a proposition which is neither a tautology nor
a contradiction, such as p

P ¬p p ∨¬p p ∧¬p
T F T F
F T T F
Logically Equivalent

o Two compound propositions p and q are equivalent if and only if


the columns in a truth table giving their truth values agree.

o This truth table show ¬p ∨ q is equivalent to p → q.

p q ¬p ¬p ∨ q p→ q
T T F T T
T F F F F
F T T T T
F F T T T
Logically Equivalent

Another example: p → q is equivalent to ¬q → ¬p (contrapositive)

p q ¬p ¬q p→q ¬q → ¬p
1 1 0 0 1 1
1 0 0 1 0 0
0 1 1 0 1 1
0 0 1 1 1 1

Equivalent statements are important for logical reasoning since they can
be substituted and can help us to make a logical argument.
De Morgan’s Laws

Augustus De Morgan

1806-1871

This truth table shows that De Morgan’s Second Law holds.

p q ¬p ¬q (p∨q) ¬(p∨q) ¬p∧¬q


T T F F T F F
T F F T T F F
F T T F T F F
F F T T F T T
Key Logical Equivalences
Key Logical Equivalences
Using logical equivalences: Proofs

Equivalences can be used in proofs. A proposition or its part can be transformed using
equivalences and some conclusion can be reached.

Example: Show that (p ∧ q) → p is a tautology

Two ways to solve this!


Using logical equivalences: Proofs
1. Using Truth table:

p q p∧q (p ∧ q) → p

1 1 1 1
1 0 0 1
0 1 0 1
0 0 0 1
Using logical equivalences: Proofs

2. Using logical equivalences:

Therefore, proven
Using logical equivalences: Proofs

Example 2: Show that (p → q) ≡ (¬q → ¬p) using Logical Laws:

(p → q) ≡ ¬p ∨ q) Useful / Remove implication


≡ q ∨ ¬p Commutative Law
≡ ¬q → ¬p Definition of Implication

Therefore, proven (p → q) ≡ (¬q → ¬p)


Exercise (Proof)

1. Show that is a tautology using Logical Equivalence L


Exercise (Proof)

2. Show that (p  q) ∨ (p  r) are logically equivalent to p  (q ∨ r) by using series of


logical equivalence rules.
Exercise (Proof)

3. Show that (p  q) ∨ (p  r) are logically equivalent to p  (q ∨ r) by using series of


logical equivalence rules.
Exercise (Proof)

4. Show that (¬q ∧ (p → q)) → ¬ p is a tautology by using series of logical equivalence


rules.
Normal Forms
o Logical expression is said to be in disjunctive normal form (DNF) if it is written as a
disjunction, in which all terms are conjunctions of literals – disjunction of conjunction

o Logical expression is said to be in conjunctive normal form (CNF) if it is written as a


conjunction of disjunctions of literals – conjunction of disjunction

o Example

o DNF : (p ∧q) ∨ (p ∧ ¬q)

o CNF : p ∧ (q ∨ r)
How to obtain DNF?
Using Logical Laws

o Three steps to obtain a DNF through algebraic manipulations:


o Remove all → and ⇔
o If the expression contains any negated compound subexpressions, either remove the
negation by using the double-negation law or use De Morgan’s laws to reduce the scope of
the negation
o Once an expression with no negated compound subexpression is found, use the following
two laws to reduce the scope of the ^.

o A ∧ (B ∨ C) ≡ (A ∧ B) ∨ (A ∧ C) Rule I
o (A ∨ B ) ∧ C ≡ (A ∧ C) ∨ (B ∧ C) Rule II
DNF: Using Logical Laws
Example: Convert the following expression into DNF

(P → (Q ∧ R)) ∨ ¬(P ∨ ¬(R∨S))

≡ (¬P ∨ (Q ∧ R)) ∨ ¬(P ∨ ¬(R∨S)) Useful


≡ (¬P ∨ (Q ∧ R)) ∨ (¬P ∧ ¬¬(R∨S)) De Morgan
≡ (¬P ∨ (Q ∧ R)) ∨ (¬P ∧ (R∨S)) Double negation
≡ (¬P ∨ (Q ∧ R)) ∨ ((¬P ∧ R) ∨(¬P ∧ S)) Rule I
DNF: Using Truth Table
P Q R Output 1. Identify the rows with T value from the
1 T T T T table
2 T T F T
3 T F T F 2. Identify the truth value for P,Q and R for
4 T F F F each row and write in disjunctive form (put
negation sign if the truth value is F)
5 F T T T
6 F T F T
Row 1: P ∧ Q ∧ R
7
F F T F
Row 2: P ∧ Q ∧ ¬R
8
F F F T
Row 5: ¬ P ∧ Q ∧ R
3. DNF = [ (P ∧ Q ∧ R) v (P ∧ Q ∧ ¬R) v (¬ P ∧ Q ∧ R) v Row 6: ¬P ∧ Q ∧ ¬ R
(¬P ∧ Q ∧ ¬ R) v ( ¬P ∧ ¬ Q ∧ ¬ R)] Row 8: ¬P ∧ ¬ Q ∧ ¬ R
How to obtain CNF?

Using Logical Laws


Three steps to obtain a CNF through algebraic manipulations:
? Remove all → and ⇔
? If the expression contains any negated compound subexpressions, either remove the negation
by using the double-negation law or use De Morgan’s laws to reduce the scope of the negation
? Once an expression with no negated compound subexpression is found, use the following two
laws to reduce the scope of the ∨.

? A ∨ (B ∧ C) ≡ (A ∨ B) ∧ (A ∨ C) Rule I
? (A ∧ B ) ∨ C ≡ (A ∨ C) ∧ (B ∨ C) Rule II
CNF: Using Logical Laws
Example: Convert the following expression into CNF

¬((P ∨ ¬Q) ∧ ¬R)

¬((P ∨ ¬Q) ∧ ¬R) ≡ ¬(P ∨ ¬Q) ∨ ¬¬R De Morgan


≡ ¬(P ∨ ¬Q) ∨ R Double negation
≡ (¬P ∧ ¬¬Q) ∨ R De Morgan
≡ (¬P ∧ Q) ∨ R Double negation
≡ (¬P ∨ R) ∧ (Q ∨ R) Distributive Law
conjunction of disjunction
CNF: Using Truth Table
P Q R Output 1. Identify the rows with F value
1 T T T T from the table
2 T T F T
3 T F T F 2. Identify the truth value for P,Q and R for
4 T F F F each row and write in disjunctive form (put
negation sign if the truth value is F)
5 F T T T
6 F T F T Row 3: P ∧ ¬Q ∧ R
7
F F T F
Row 4: P ∧ ¬Q ∧ ¬R
F F F T
8 Row 7: ¬P ∧ ¬Q ∧ R

3. Write in disjunctive normal form


Input = [(P ∧ ¬Q ∧ R) ∨ (P ∧ ¬Q ∧ ¬R) ∨ (¬P ∧ ¬Q ∧ R)]

4. Complement the whole expressions


Input = (¬P ∨ Q ∨ ¬R) ∧ (¬P ∨ Q ∨ R) ∧ (P ∨ Q ∨ ¬R)
CNF = (¬P ∨ Q ∨ ¬R) ∧ (¬P ∨ Q ∨ R) ∧ (P ∨ Q ∨ ¬R)
Exercise (DNF)
1. Find the DNF of (p ∧ q)→¬r

p q r (p ∧ q) ¬r (p ∧ q)→¬r

T T T
T T F
T F T
T F F
F T T
F T F
F F T
F F F
Exercise (DNF)
2 With the aid of a truth table, convert the expression (¬p  q) ∧ (¬q ∨ r) into
Disjunction Normal Form (DNF)

p q r ¬p ¬q ¬p → q ¬qvr f

1 1 1
1 1 0
1 0 1
1 0 0
0 1 1
0 1 0
0 0 1
0 0 0

You might also like