49
CSE 311 Lecture 03: Equivalence and Proofs Emina Torlak and Kevin Zatloukal 1

CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

CSE 311 Lecture 03:Equivalence and ProofsEmina Torlak and Kevin Zatloukal

1

Page 2: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

TopicsEquivalence and circuits

A brief review of .Checking equivalence

Applications and a basic brute-force algorithm.Logical proofs

A method for establishing equivalence that extends to richer logics.

Lecture 02

2

Page 4: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Logical equivalence is an assertion that two propositions and have the same

truth values in all possible cases.

and have the same meaning.

A ≡ B A B

A ≡ B (A ↔ B) ≡ # $%&$'(')*

p ∧ q ≡ q ∧ pp q p ∧ q q ∧ p p ∧ q ↔ q ∧ p, , , , #, # , , ## , , , ## # # # #

p ∧ q ≢ q ∨ p

When and , is false but is true!

p = # q = , p ∧ qp ∨ q

4

Page 5: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Important equivalencesDeMorgan’s laws

Law of implication

Contrapositive

Biconditional

Double negation

Identity

Domination

Idempotence

Commutativity

Associativity

Distributivity

Absorption

Negation

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

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ↔ q ≡ (p → q) ∧ (q → p)

p 𠪪p

p ∧ # ≡ pp ∨ , ≡ p

p ∧ , ≡ ,p ∨ # ≡ #

p ∧ p ≡ pp ∨ p ≡ p

p ∧ q ≡ q ∧ pp ∨ q ≡ q ∨ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (p ∨ q) ≡ pp ∨ (p ∧ q) ≡ p

p ∧ ¬p ≡ ,p ∨ ¬p ≡ #

We will always give you this list!

5

Page 6: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Digital circuitsDigital circuits implement propositional logic:

corresponds to 1 or high voltage. corresponds to 0 or low voltage.

Digital gates are functions that

take values 0/1 as inputs and produce 0/1 as output;correspond to logical connectives (many of them).

#,

6

Page 7: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

AND, OR, and NOT gates

ANDpq out 0 0 0

0 1 0

1 0 0

1 1 1

ORpq out 0 0 0

0 1 1

1 0 1

1 1 1

NOTp out 0 1

1 0

p q '&$ p q p ∧ q, , ,, # ,# , ,# # #

p q '&$ p q p ∨ q, , ,, # ## , ## # #

p '&$ p ¬p, ## ,

7

Page 8: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Combinational logic circuits: wiring up gates

NOTq

ORrs

AND

AND outNOTp

Values get sent along wires connecting gates.

¬p ∧ (¬q ∧ (r ∨ s))

8

Page 9: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Combinational logic circuits: wiring up gates

ANDp

ANDr

NOTq OR out

Wires can send one value to multiple gates.

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

9

Page 10: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Other useful gates

NAND gate

0 0 1

0 1 1

1 0 1

1 1 0

NOR gate

0 0 1

0 1 0

1 0 0

1 1 0

XOR gate

0 0 0

0 1 1

1 0 1

1 1 0

XNOR gate

0 0 1

0 1 0

1 0 0

1 1 1

¬(p ∧ q)

p q '&$

¬(p ∨ q)

p q '&$

p ⊕ q

p q '&$

p ↔ q

p q '&$

10

Page 11: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Checking equivalenceApplications and a basic brute-force algorithm.

11

Page 12: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Why do we care about checking equivalence?

Many practical problems are solved by logical equivalence checking!Hardware verification, program verification, query optimization andcaching, compiler optimization, …

12

Page 13: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Why do we care about checking equivalence?

Many practical problems are solved by logical equivalence checking!Hardware verification, program verification, query optimization andcaching, compiler optimization, …

Example: verifying compiler optimizationsGiven a sequence of instructions and an optimized sequence , we canconstruct logical formulas and that encode their meaning. To verifythat behaves exactly like , we check that .

S Ps p

P S p ↔ s ≡ #

12

Page 14: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Why do we care about checking equivalence?

Many practical problems are solved by logical equivalence checking!Hardware verification, program verification, query optimization andcaching, compiler optimization, …

Example: verifying compiler optimizationsGiven a sequence of instructions and an optimized sequence , we canconstruct logical formulas and that encode their meaning. To verifythat behaves exactly like , we check that .

Demo: verifying compiler with Is correct?

S Ps p

P S p ↔ s ≡ #peephole optimizations Alive

this optimization

; Original program (S)%a = xor %y, %x ; a = y ^ x%b = and %y, %x ; b = x & x%c = ashr %b, 1 ; c = b >> 1%d = add %c, %a ; d = c + a =>; Optimized program (P)%d = add %x, %y ; d = x + y

12

Page 15: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Why do we care about checking equivalence?

Many practical problems are solved by logical equivalence checking!Hardware verification, program verification, query optimization andcaching, compiler optimization, …

Example: verifying compiler optimizationsGiven a sequence of instructions and an optimized sequence , we canconstruct logical formulas and that encode their meaning. To verifythat behaves exactly like , we check that .

Demo: verifying compiler with Is correct?

S Ps p

P S p ↔ s ≡ #peephole optimizations Alive

this optimization

; Original program (S)%a = xor %y, %x ; a = y ^ x%b = and %y, %x ; b = x & x%c = ashr %b, 1 ; c = b >> 1%d = add %c, %a ; d = c + a =>; Optimized program (P)%d = add %x, %y ; d = x + y

No! The right shi! (ashr)should be replaced with a le!shi! (shl).

12

Page 16: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Checking logical (and circuit) equivalence

Can we write an algorithm to decide if two propositions are equivalent?

What is the run time of the algorithm?

In theory, the news are bad …

But in practice, the news are pretty good …

13

Page 17: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Checking logical (and circuit) equivalence

Can we write an algorithm to decide if two propositions are equivalent?Yes! Generate the truth tables for both propositions and check if they arethe same for every entry.

What is the run time of the algorithm?

In theory, the news are bad …

But in practice, the news are pretty good …

13

Page 18: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Checking logical (and circuit) equivalence

Can we write an algorithm to decide if two propositions are equivalent?Yes! Generate the truth tables for both propositions and check if they arethe same for every entry.

What is the run time of the algorithm?Every propositional variable has two possibilities ( , ). If there are variables, there are rows in the truth table. So the running time isexponential in the number of variables.

In theory, the news are bad …

But in practice, the news are pretty good …

# , n2n

13

Page 19: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Checking logical (and circuit) equivalence

Can we write an algorithm to decide if two propositions are equivalent?Yes! Generate the truth tables for both propositions and check if they arethe same for every entry.

What is the run time of the algorithm?Every propositional variable has two possibilities ( , ). If there are variables, there are rows in the truth table. So the running time isexponential in the number of variables.

In theory, the news are bad …We know of no algorithm that performs better in general. If you foundone, or proved that it doesn’t exist, you’d solve incomputer science and .

But in practice, the news are pretty good …

# , n2n

a famous open problemwin $1 million

13

Page 20: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Checking logical (and circuit) equivalence

Can we write an algorithm to decide if two propositions are equivalent?Yes! Generate the truth tables for both propositions and check if they arethe same for every entry.

What is the run time of the algorithm?Every propositional variable has two possibilities ( , ). If there are variables, there are rows in the truth table. So the running time isexponential in the number of variables.

In theory, the news are bad …We know of no algorithm that performs better in general. If you foundone, or proved that it doesn’t exist, you’d solve incomputer science and .

But in practice, the news are pretty good …Provers like can solve equivalence checking problems with millions ofvariables and formulas. And that’s enough for many real applications!

# , n2n

a famous open problemwin $1 million

Z3

13

Page 21: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Logical proofsA method for establishing equivalence that extends to richer logics.

14

Page 22: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Proof: use known equivalences to derive new ones

To show that is equivalent to Apply a series of logical equivalences tosubexpressions to convert to .

A B

A B

To show that is a tautologyApply a series of logical equivalences tosubexpressions to convert to .

A

A #

15

Page 23: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show that is equivalent to Let be , and let be .

DeMorgan’s laws

Law of implication

Contrapositive

Biconditional

Double negation

Identity

Domination

Idempotence

Commutativity

Associativity

Distributivity

Absorption

Negation

A BA p ∨ (p ∧ p) B p

p ∨ (p ∧ p) ≡≡ p

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

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ↔ q ≡ (p → q) ∧ (q → p)

p 𠪪p

p ∧ # ≡ pp ∨ , ≡ p

p ∧ , ≡ ,p ∨ # ≡ #

p ∧ p ≡ pp ∨ p ≡ p

p ∧ q ≡ q ∧ pp ∨ q ≡ q ∨ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (p ∨ q) ≡ pp ∨ (p ∧ q) ≡ p

p ∧ ¬p ≡ ,p ∨ ¬p ≡ #

16

Page 24: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show that is equivalent to Let be , and let be .

Idempotence

DeMorgan’s laws

Law of implication

Contrapositive

Biconditional

Double negation

Identity

Domination

Idempotence

Commutativity

Associativity

Distributivity

Absorption

Negation

A BA p ∨ (p ∧ p) B p

p ∨ (p ∧ p) ≡ p ∨ p≡ p

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

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ↔ q ≡ (p → q) ∧ (q → p)

p 𠪪p

p ∧ # ≡ pp ∨ , ≡ p

p ∧ , ≡ ,p ∨ # ≡ #

p ∧ p ≡ pp ∨ p ≡ p

p ∧ q ≡ q ∧ pp ∨ q ≡ q ∨ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (p ∨ q) ≡ pp ∨ (p ∧ q) ≡ p

p ∧ ¬p ≡ ,p ∨ ¬p ≡ #

16

Page 25: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show that is equivalent to Let be , and let be .

IdempotenceIdempotence

DeMorgan’s laws

Law of implication

Contrapositive

Biconditional

Double negation

Identity

Domination

Idempotence

Commutativity

Associativity

Distributivity

Absorption

Negation

A BA p ∨ (p ∧ p) B p

p ∨ (p ∧ p) ≡ p ∨ p≡ p

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

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ↔ q ≡ (p → q) ∧ (q → p)

p 𠪪p

p ∧ # ≡ pp ∨ , ≡ p

p ∧ , ≡ ,p ∨ # ≡ #

p ∧ p ≡ pp ∨ p ≡ p

p ∧ q ≡ q ∧ pp ∨ q ≡ q ∨ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (p ∨ q) ≡ pp ∨ (p ∧ q) ≡ p

p ∧ ¬p ≡ ,p ∨ ¬p ≡ #

16

Page 26: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show that is a tautologyLet be .

DeMorgan’s laws

Law of implication

Contrapositive

Biconditional

Double negation

Identity

Domination

Idempotence

Commutativity

Associativity

Distributivity

Absorption

Negation

AA ¬p ∨ (p ∨ p)

¬p ∨ (p ∨ p) ≡≡≡ #

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

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ↔ q ≡ (p → q) ∧ (q → p)

p 𠪪p

p ∧ # ≡ pp ∨ , ≡ p

p ∧ , ≡ ,p ∨ # ≡ #

p ∧ p ≡ pp ∨ p ≡ p

p ∧ q ≡ q ∧ pp ∨ q ≡ q ∨ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (p ∨ q) ≡ pp ∨ (p ∧ q) ≡ p

p ∧ ¬p ≡ ,p ∨ ¬p ≡ #

17

Page 27: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show that is a tautologyLet be .

Idempotence

DeMorgan’s laws

Law of implication

Contrapositive

Biconditional

Double negation

Identity

Domination

Idempotence

Commutativity

Associativity

Distributivity

Absorption

Negation

AA ¬p ∨ (p ∨ p)

¬p ∨ (p ∨ p) ≡ ¬p ∨ p≡≡ #

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

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ↔ q ≡ (p → q) ∧ (q → p)

p 𠪪p

p ∧ # ≡ pp ∨ , ≡ p

p ∧ , ≡ ,p ∨ # ≡ #

p ∧ p ≡ pp ∨ p ≡ p

p ∧ q ≡ q ∧ pp ∨ q ≡ q ∨ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (p ∨ q) ≡ pp ∨ (p ∧ q) ≡ p

p ∧ ¬p ≡ ,p ∨ ¬p ≡ #

17

Page 28: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show that is a tautologyLet be .

IdempotenceCommutativity

DeMorgan’s laws

Law of implication

Contrapositive

Biconditional

Double negation

Identity

Domination

Idempotence

Commutativity

Associativity

Distributivity

Absorption

Negation

AA ¬p ∨ (p ∨ p)

¬p ∨ (p ∨ p) ≡ ¬p ∨ p≡ p ∨ ¬p≡ #

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

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ↔ q ≡ (p → q) ∧ (q → p)

p 𠪪p

p ∧ # ≡ pp ∨ , ≡ p

p ∧ , ≡ ,p ∨ # ≡ #

p ∧ p ≡ pp ∨ p ≡ p

p ∧ q ≡ q ∧ pp ∨ q ≡ q ∨ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (p ∨ q) ≡ pp ∨ (p ∧ q) ≡ p

p ∧ ¬p ≡ ,p ∨ ¬p ≡ #

17

Page 29: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show that is a tautologyLet be .

IdempotenceCommutativityNegation

DeMorgan’s laws

Law of implication

Contrapositive

Biconditional

Double negation

Identity

Domination

Idempotence

Commutativity

Associativity

Distributivity

Absorption

Negation

AA ¬p ∨ (p ∨ p)

¬p ∨ (p ∨ p) ≡ ¬p ∨ p≡ p ∨ ¬p≡ #

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

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ↔ q ≡ (p → q) ∧ (q → p)

p 𠪪p

p ∧ # ≡ pp ∨ , ≡ p

p ∧ , ≡ ,p ∨ # ≡ #

p ∧ p ≡ pp ∨ p ≡ p

p ∧ q ≡ q ∧ pp ∨ q ≡ q ∨ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (p ∨ q) ≡ pp ∨ (p ∧ q) ≡ p

p ∧ ¬p ≡ ,p ∨ ¬p ≡ #

17

Page 30: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show equivalence with a truth table and proof

A truth table for .

p ∧ (p → q) ≡ p ∧ q

p ∧ (p → q) ↔ p ∧ q ≡ #p q p → q p ∧ (p → q) p ∧ q p ∧ (p → q) ↔ p ∧ q, , # , , #, # # , , ## , , , , ## # # # # #

18

Page 31: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show equivalence with a truth table and proof

DeMorgan’s laws

Law of implication

Contrapositive

Biconditional

Double negation

Identity

Domination

Idempotence

Commutativity

Associativity

Distributivity

Absorption

Negation

p ∧ (p → q) ≡ p ∧ qp ∧ (p → q) ≡

≡≡≡≡ p ∧ q

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

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ↔ q ≡ (p → q) ∧ (q → p)

p 𠪪p

p ∧ # ≡ pp ∨ , ≡ p

p ∧ , ≡ ,p ∨ # ≡ #

p ∧ p ≡ pp ∨ p ≡ p

p ∧ q ≡ q ∧ pp ∨ q ≡ q ∨ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (p ∨ q) ≡ pp ∨ (p ∧ q) ≡ p

p ∧ ¬p ≡ ,p ∨ ¬p ≡ #

19

Page 32: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show equivalence with a truth table and proof

Law of implication

DeMorgan’s laws

Law of implication

Contrapositive

Biconditional

Double negation

Identity

Domination

Idempotence

Commutativity

Associativity

Distributivity

Absorption

Negation

p ∧ (p → q) ≡ p ∧ qp ∧ (p → q) ≡ p ∧ (¬p ∨ q)

≡≡≡≡ p ∧ q

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

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ↔ q ≡ (p → q) ∧ (q → p)

p 𠪪p

p ∧ # ≡ pp ∨ , ≡ p

p ∧ , ≡ ,p ∨ # ≡ #

p ∧ p ≡ pp ∨ p ≡ p

p ∧ q ≡ q ∧ pp ∨ q ≡ q ∨ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (p ∨ q) ≡ pp ∨ (p ∧ q) ≡ p

p ∧ ¬p ≡ ,p ∨ ¬p ≡ #

19

Page 33: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show equivalence with a truth table and proof

Law of implicationDistributivity

DeMorgan’s laws

Law of implication

Contrapositive

Biconditional

Double negation

Identity

Domination

Idempotence

Commutativity

Associativity

Distributivity

Absorption

Negation

p ∧ (p → q) ≡ p ∧ qp ∧ (p → q) ≡ p ∧ (¬p ∨ q)

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

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

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ↔ q ≡ (p → q) ∧ (q → p)

p 𠪪p

p ∧ # ≡ pp ∨ , ≡ p

p ∧ , ≡ ,p ∨ # ≡ #

p ∧ p ≡ pp ∨ p ≡ p

p ∧ q ≡ q ∧ pp ∨ q ≡ q ∨ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (p ∨ q) ≡ pp ∨ (p ∧ q) ≡ p

p ∧ ¬p ≡ ,p ∨ ¬p ≡ #

19

Page 34: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show equivalence with a truth table and proof

Law of implicationDistributivityNegation

DeMorgan’s laws

Law of implication

Contrapositive

Biconditional

Double negation

Identity

Domination

Idempotence

Commutativity

Associativity

Distributivity

Absorption

Negation

p ∧ (p → q) ≡ p ∧ qp ∧ (p → q) ≡ p ∧ (¬p ∨ q)

≡ (p ∧ ¬p) ∨ (p ∧ q)≡ , ∨ (p ∧ q)≡≡ p ∧ q

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

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ↔ q ≡ (p → q) ∧ (q → p)

p 𠪪p

p ∧ # ≡ pp ∨ , ≡ p

p ∧ , ≡ ,p ∨ # ≡ #

p ∧ p ≡ pp ∨ p ≡ p

p ∧ q ≡ q ∧ pp ∨ q ≡ q ∨ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (p ∨ q) ≡ pp ∨ (p ∧ q) ≡ p

p ∧ ¬p ≡ ,p ∨ ¬p ≡ #

19

Page 35: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show equivalence with a truth table and proof

Law of implicationDistributivityNegationCommutativity

DeMorgan’s laws

Law of implication

Contrapositive

Biconditional

Double negation

Identity

Domination

Idempotence

Commutativity

Associativity

Distributivity

Absorption

Negation

p ∧ (p → q) ≡ p ∧ qp ∧ (p → q) ≡ p ∧ (¬p ∨ q)

≡ (p ∧ ¬p) ∨ (p ∧ q)≡ , ∨ (p ∧ q)≡ (p ∧ q) ∨ ,≡ p ∧ q

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

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ↔ q ≡ (p → q) ∧ (q → p)

p 𠪪p

p ∧ # ≡ pp ∨ , ≡ p

p ∧ , ≡ ,p ∨ # ≡ #

p ∧ p ≡ pp ∨ p ≡ p

p ∧ q ≡ q ∧ pp ∨ q ≡ q ∨ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (p ∨ q) ≡ pp ∨ (p ∧ q) ≡ p

p ∧ ¬p ≡ ,p ∨ ¬p ≡ #

19

Page 36: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show equivalence with a truth table and proof

Law of implicationDistributivityNegationCommutativityIdentity

DeMorgan’s laws

Law of implication

Contrapositive

Biconditional

Double negation

Identity

Domination

Idempotence

Commutativity

Associativity

Distributivity

Absorption

Negation

p ∧ (p → q) ≡ p ∧ qp ∧ (p → q) ≡ p ∧ (¬p ∨ q)

≡ (p ∧ ¬p) ∨ (p ∧ q)≡ , ∨ (p ∧ q)≡ (p ∧ q) ∨ ,≡ p ∧ q

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

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ↔ q ≡ (p → q) ∧ (q → p)

p 𠪪p

p ∧ # ≡ pp ∨ , ≡ p

p ∧ , ≡ ,p ∨ # ≡ #

p ∧ p ≡ pp ∨ p ≡ p

p ∧ q ≡ q ∧ pp ∨ q ≡ q ∨ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (p ∨ q) ≡ pp ∨ (p ∧ q) ≡ p

p ∧ ¬p ≡ ,p ∨ ¬p ≡ #

19

Page 37: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show tautology with a truth table and proof

A truth table for .

(p ∧ q) → (q ∨ p)

(p ∧ q) → (q ∨ p) ≡ #p q p ∧ q q ∨ p (p ∧ q) → (q ∨ p), , , , #, # , # ## , , # ## # # # #

20

Page 38: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show tautology with a truth table and proof

DeMorgan’s laws

Law of implication

Contrapositive

Biconditional

Double negation

Identity

Domination

Idempotence

Commutativity

Associativity

Distributivity

Absorption

Negation

(p ∧ q) → (q ∨ p)(p ∧ q) → (q ∨ p) ≡

≡≡≡≡≡≡≡≡ #

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

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ↔ q ≡ (p → q) ∧ (q → p)

p 𠪪p

p ∧ # ≡ pp ∨ , ≡ p

p ∧ , ≡ ,p ∨ # ≡ #

p ∧ p ≡ pp ∨ p ≡ p

p ∧ q ≡ q ∧ pp ∨ q ≡ q ∨ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (p ∨ q) ≡ pp ∨ (p ∧ q) ≡ p

p ∧ ¬p ≡ ,p ∨ ¬p ≡ #

21

Page 39: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show tautology with a truth table and proof

Law of implication

DeMorgan’s laws

Law of implication

Contrapositive

Biconditional

Double negation

Identity

Domination

Idempotence

Commutativity

Associativity

Distributivity

Absorption

Negation

(p ∧ q) → (q ∨ p)(p ∧ q) → (q ∨ p) ≡ ¬(p ∧ q) ∨ (q ∨ p)

≡≡≡≡≡≡≡≡ #

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

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ↔ q ≡ (p → q) ∧ (q → p)

p 𠪪p

p ∧ # ≡ pp ∨ , ≡ p

p ∧ , ≡ ,p ∨ # ≡ #

p ∧ p ≡ pp ∨ p ≡ p

p ∧ q ≡ q ∧ pp ∨ q ≡ q ∨ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (p ∨ q) ≡ pp ∨ (p ∧ q) ≡ p

p ∧ ¬p ≡ ,p ∨ ¬p ≡ #

21

Page 40: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show tautology with a truth table and proof

Law of implicationDeMorgan

DeMorgan’s laws

Law of implication

Contrapositive

Biconditional

Double negation

Identity

Domination

Idempotence

Commutativity

Associativity

Distributivity

Absorption

Negation

(p ∧ q) → (q ∨ p)(p ∧ q) → (q ∨ p) ≡ ¬(p ∧ q) ∨ (q ∨ p)

≡ (¬p ∨ ¬q) ∨ (q ∨ p)≡≡≡≡≡≡≡ #

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

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ↔ q ≡ (p → q) ∧ (q → p)

p 𠪪p

p ∧ # ≡ pp ∨ , ≡ p

p ∧ , ≡ ,p ∨ # ≡ #

p ∧ p ≡ pp ∨ p ≡ p

p ∧ q ≡ q ∧ pp ∨ q ≡ q ∨ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (p ∨ q) ≡ pp ∨ (p ∧ q) ≡ p

p ∧ ¬p ≡ ,p ∨ ¬p ≡ #

21

Page 41: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show tautology with a truth table and proof

Law of implicationDeMorganAssociativity

DeMorgan’s laws

Law of implication

Contrapositive

Biconditional

Double negation

Identity

Domination

Idempotence

Commutativity

Associativity

Distributivity

Absorption

Negation

(p ∧ q) → (q ∨ p)(p ∧ q) → (q ∨ p) ≡ ¬(p ∧ q) ∨ (q ∨ p)

≡ (¬p ∨ ¬q) ∨ (q ∨ p)≡ ¬p ∨ (¬q ∨ (q ∨ p))≡≡≡≡≡≡ #

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

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ↔ q ≡ (p → q) ∧ (q → p)

p 𠪪p

p ∧ # ≡ pp ∨ , ≡ p

p ∧ , ≡ ,p ∨ # ≡ #

p ∧ p ≡ pp ∨ p ≡ p

p ∧ q ≡ q ∧ pp ∨ q ≡ q ∨ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (p ∨ q) ≡ pp ∨ (p ∧ q) ≡ p

p ∧ ¬p ≡ ,p ∨ ¬p ≡ #

21

Page 42: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show tautology with a truth table and proof

Law of implicationDeMorganAssociativityAssociativity

DeMorgan’s laws

Law of implication

Contrapositive

Biconditional

Double negation

Identity

Domination

Idempotence

Commutativity

Associativity

Distributivity

Absorption

Negation

(p ∧ q) → (q ∨ p)(p ∧ q) → (q ∨ p) ≡ ¬(p ∧ q) ∨ (q ∨ p)

≡ (¬p ∨ ¬q) ∨ (q ∨ p)≡ ¬p ∨ (¬q ∨ (q ∨ p))≡ ¬p ∨ ((¬q ∨ q) ∨ p)≡≡≡≡≡ #

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

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ↔ q ≡ (p → q) ∧ (q → p)

p 𠪪p

p ∧ # ≡ pp ∨ , ≡ p

p ∧ , ≡ ,p ∨ # ≡ #

p ∧ p ≡ pp ∨ p ≡ p

p ∧ q ≡ q ∧ pp ∨ q ≡ q ∨ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (p ∨ q) ≡ pp ∨ (p ∧ q) ≡ p

p ∧ ¬p ≡ ,p ∨ ¬p ≡ #

21

Page 43: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show tautology with a truth table and proof

Law of implicationDeMorganAssociativityAssociativityCommutativity

DeMorgan’s laws

Law of implication

Contrapositive

Biconditional

Double negation

Identity

Domination

Idempotence

Commutativity

Associativity

Distributivity

Absorption

Negation

(p ∧ q) → (q ∨ p)(p ∧ q) → (q ∨ p) ≡ ¬(p ∧ q) ∨ (q ∨ p)

≡ (¬p ∨ ¬q) ∨ (q ∨ p)≡ ¬p ∨ (¬q ∨ (q ∨ p))≡ ¬p ∨ ((¬q ∨ q) ∨ p)≡ ¬p ∨ (p ∨ (¬q ∨ q))≡≡≡≡ #

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

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ↔ q ≡ (p → q) ∧ (q → p)

p 𠪪p

p ∧ # ≡ pp ∨ , ≡ p

p ∧ , ≡ ,p ∨ # ≡ #

p ∧ p ≡ pp ∨ p ≡ p

p ∧ q ≡ q ∧ pp ∨ q ≡ q ∨ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (p ∨ q) ≡ pp ∨ (p ∧ q) ≡ p

p ∧ ¬p ≡ ,p ∨ ¬p ≡ #

21

Page 44: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show tautology with a truth table and proof

Law of implicationDeMorganAssociativityAssociativityCommutativityAssociativity

DeMorgan’s laws

Law of implication

Contrapositive

Biconditional

Double negation

Identity

Domination

Idempotence

Commutativity

Associativity

Distributivity

Absorption

Negation

(p ∧ q) → (q ∨ p)(p ∧ q) → (q ∨ p) ≡ ¬(p ∧ q) ∨ (q ∨ p)

≡ (¬p ∨ ¬q) ∨ (q ∨ p)≡ ¬p ∨ (¬q ∨ (q ∨ p))≡ ¬p ∨ ((¬q ∨ q) ∨ p)≡ ¬p ∨ (p ∨ (¬q ∨ q))≡ (¬p ∨ p) ∨ (¬q ∨ q)≡≡≡ #

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

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ↔ q ≡ (p → q) ∧ (q → p)

p 𠪪p

p ∧ # ≡ pp ∨ , ≡ p

p ∧ , ≡ ,p ∨ # ≡ #

p ∧ p ≡ pp ∨ p ≡ p

p ∧ q ≡ q ∧ pp ∨ q ≡ q ∨ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (p ∨ q) ≡ pp ∨ (p ∧ q) ≡ p

p ∧ ¬p ≡ ,p ∨ ¬p ≡ #

21

Page 45: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show tautology with a truth table and proof

Law of implicationDeMorganAssociativityAssociativityCommutativityAssociativityCommutativity (twice)

DeMorgan’s laws

Law of implication

Contrapositive

Biconditional

Double negation

Identity

Domination

Idempotence

Commutativity

Associativity

Distributivity

Absorption

Negation

(p ∧ q) → (q ∨ p)(p ∧ q) → (q ∨ p) ≡ ¬(p ∧ q) ∨ (q ∨ p)

≡ (¬p ∨ ¬q) ∨ (q ∨ p)≡ ¬p ∨ (¬q ∨ (q ∨ p))≡ ¬p ∨ ((¬q ∨ q) ∨ p)≡ ¬p ∨ (p ∨ (¬q ∨ q))≡ (¬p ∨ p) ∨ (¬q ∨ q)≡ (p ∨ ¬p) ∨ (q ∨ ¬q)≡≡ #

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

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ↔ q ≡ (p → q) ∧ (q → p)

p 𠪪p

p ∧ # ≡ pp ∨ , ≡ p

p ∧ , ≡ ,p ∨ # ≡ #

p ∧ p ≡ pp ∨ p ≡ p

p ∧ q ≡ q ∧ pp ∨ q ≡ q ∨ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (p ∨ q) ≡ pp ∨ (p ∧ q) ≡ p

p ∧ ¬p ≡ ,p ∨ ¬p ≡ #

21

Page 46: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show tautology with a truth table and proof

Law of implicationDeMorganAssociativityAssociativityCommutativityAssociativityCommutativity (twice)Negation (twice)

DeMorgan’s laws

Law of implication

Contrapositive

Biconditional

Double negation

Identity

Domination

Idempotence

Commutativity

Associativity

Distributivity

Absorption

Negation

(p ∧ q) → (q ∨ p)(p ∧ q) → (q ∨ p) ≡ ¬(p ∧ q) ∨ (q ∨ p)

≡ (¬p ∨ ¬q) ∨ (q ∨ p)≡ ¬p ∨ (¬q ∨ (q ∨ p))≡ ¬p ∨ ((¬q ∨ q) ∨ p)≡ ¬p ∨ (p ∨ (¬q ∨ q))≡ (¬p ∨ p) ∨ (¬q ∨ q)≡ (p ∨ ¬p) ∨ (q ∨ ¬q)≡ # ∨ #≡ #

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

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ↔ q ≡ (p → q) ∧ (q → p)

p 𠪪p

p ∧ # ≡ pp ∨ , ≡ p

p ∧ , ≡ ,p ∨ # ≡ #

p ∧ p ≡ pp ∨ p ≡ p

p ∧ q ≡ q ∧ pp ∨ q ≡ q ∨ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (p ∨ q) ≡ pp ∨ (p ∧ q) ≡ p

p ∧ ¬p ≡ ,p ∨ ¬p ≡ #

21

Page 47: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Example: show tautology with a truth table and proof

Law of implicationDeMorganAssociativityAssociativityCommutativityAssociativityCommutativity (twice)Negation (twice)Idempotence

DeMorgan’s laws

Law of implication

Contrapositive

Biconditional

Double negation

Identity

Domination

Idempotence

Commutativity

Associativity

Distributivity

Absorption

Negation

(p ∧ q) → (q ∨ p)(p ∧ q) → (q ∨ p) ≡ ¬(p ∧ q) ∨ (q ∨ p)

≡ (¬p ∨ ¬q) ∨ (q ∨ p)≡ ¬p ∨ (¬q ∨ (q ∨ p))≡ ¬p ∨ ((¬q ∨ q) ∨ p)≡ ¬p ∨ (p ∨ (¬q ∨ q))≡ (¬p ∨ p) ∨ (¬q ∨ q)≡ (p ∨ ¬p) ∨ (q ∨ ¬q)≡ # ∨ #≡ #

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

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ↔ q ≡ (p → q) ∧ (q → p)

p 𠪪p

p ∧ # ≡ pp ∨ , ≡ p

p ∧ , ≡ ,p ∨ # ≡ #

p ∧ p ≡ pp ∨ p ≡ p

p ∧ q ≡ q ∧ pp ∨ q ≡ q ∨ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (p ∨ q) ≡ pp ∨ (p ∧ q) ≡ p

p ∧ ¬p ≡ ,p ∨ ¬p ≡ #

21

Page 48: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

Truth tables versus proofsProofs are not smaller than truth tables where there are a fewpropositional variables.

But proofs are usually much smaller when there are many variables.

We can extend the proof method to reason about richer logics for whichtruth tables don’t apply.

Theorem provers use a combination of search (truth tables) anddeduction (proofs) to automate equivalence checking.

22

Page 49: CSE 311 Lecture 03: Equivalence and Proofs€¦ · Logical proofs A method for establishing equivalence that extends to richer logics. Lecture 02 2. Equivalence and circuits A brief

SummaryChecking equivalence has many real-world applications.

Verification, optimization, and more!There are two ways to check equivalence of propositional formulas.

Brute-force: compare their truth tables.Proof-based: apply equivalences to transform one into the other.

23