Top Banner
Discrete Mathematics Jeremy Siek Spring 2010 Jeremy Siek Discrete Mathematics 1 / 12
29

Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Jun 29, 2018

Download

Documents

hakiet
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Discrete Mathematics

Jeremy Siek

Spring 2010

Jeremy Siek Discrete Mathematics 1 / 12

Page 2: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Jeremy Siek Discrete Mathematics 2 / 12

Page 3: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Outline of Lecture 2

1. Propositional Logic

2. Syntax and Meaning of Propositional Logic

Jeremy Siek Discrete Mathematics 2 / 12

Page 4: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Logic

I Logic defines the ground rules for establishing truths.I Mathematical logic spells out these rules in complete detail,

defining what constitutes a formal proof.I Learning mathematical logic is a good way to learn logic because

it puts you on a firm foundation.I Writing formal proofs in mathematical logic is a lot like computer

programming. The rules of the game are clearly defined.

Jeremy Siek Discrete Mathematics 3 / 12

Page 5: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Propositional Logic

I Propositional logic is a language that abstracts away from contentand focuses on the logical connectives.

I Uppercase letters like P and Q are meta-variables that areplaceholders for propositions.

I The following rules define what is a proposition.

I A propositional variable (lowercase letters p, q, r) is aproposition. These variables model true/false statements.

I The negation of a proposition P, written ¬ P, is a proposition.I The conjunction (and) of two propositions, written P ∧ Q, is a

proposition.I The disjunction (or) of two propositions, written P ∨ Q, is a

proposition.I The conditional statement (implies), written P −→ Q, is a

proposition.I The Boolean values True and False are propositions.

Jeremy Siek Discrete Mathematics 4 / 12

Page 6: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Propositional Logic

I Propositional logic is a language that abstracts away from contentand focuses on the logical connectives.

I Uppercase letters like P and Q are meta-variables that areplaceholders for propositions.

I The following rules define what is a proposition.I A propositional variable (lowercase letters p, q, r) is a

proposition. These variables model true/false statements.

I The negation of a proposition P, written ¬ P, is a proposition.I The conjunction (and) of two propositions, written P ∧ Q, is a

proposition.I The disjunction (or) of two propositions, written P ∨ Q, is a

proposition.I The conditional statement (implies), written P −→ Q, is a

proposition.I The Boolean values True and False are propositions.

Jeremy Siek Discrete Mathematics 4 / 12

Page 7: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Propositional Logic

I Propositional logic is a language that abstracts away from contentand focuses on the logical connectives.

I Uppercase letters like P and Q are meta-variables that areplaceholders for propositions.

I The following rules define what is a proposition.I A propositional variable (lowercase letters p, q, r) is a

proposition. These variables model true/false statements.I The negation of a proposition P, written ¬ P, is a proposition.

I The conjunction (and) of two propositions, written P ∧ Q, is aproposition.

I The disjunction (or) of two propositions, written P ∨ Q, is aproposition.

I The conditional statement (implies), written P −→ Q, is aproposition.

I The Boolean values True and False are propositions.

Jeremy Siek Discrete Mathematics 4 / 12

Page 8: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Propositional Logic

I Propositional logic is a language that abstracts away from contentand focuses on the logical connectives.

I Uppercase letters like P and Q are meta-variables that areplaceholders for propositions.

I The following rules define what is a proposition.I A propositional variable (lowercase letters p, q, r) is a

proposition. These variables model true/false statements.I The negation of a proposition P, written ¬ P, is a proposition.I The conjunction (and) of two propositions, written P ∧ Q, is a

proposition.

I The disjunction (or) of two propositions, written P ∨ Q, is aproposition.

I The conditional statement (implies), written P −→ Q, is aproposition.

I The Boolean values True and False are propositions.

Jeremy Siek Discrete Mathematics 4 / 12

Page 9: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Propositional Logic

I Propositional logic is a language that abstracts away from contentand focuses on the logical connectives.

I Uppercase letters like P and Q are meta-variables that areplaceholders for propositions.

I The following rules define what is a proposition.I A propositional variable (lowercase letters p, q, r) is a

proposition. These variables model true/false statements.I The negation of a proposition P, written ¬ P, is a proposition.I The conjunction (and) of two propositions, written P ∧ Q, is a

proposition.I The disjunction (or) of two propositions, written P ∨ Q, is a

proposition.

I The conditional statement (implies), written P −→ Q, is aproposition.

I The Boolean values True and False are propositions.

Jeremy Siek Discrete Mathematics 4 / 12

Page 10: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Propositional Logic

I Propositional logic is a language that abstracts away from contentand focuses on the logical connectives.

I Uppercase letters like P and Q are meta-variables that areplaceholders for propositions.

I The following rules define what is a proposition.I A propositional variable (lowercase letters p, q, r) is a

proposition. These variables model true/false statements.I The negation of a proposition P, written ¬ P, is a proposition.I The conjunction (and) of two propositions, written P ∧ Q, is a

proposition.I The disjunction (or) of two propositions, written P ∨ Q, is a

proposition.I The conditional statement (implies), written P −→ Q, is a

proposition.

I The Boolean values True and False are propositions.

Jeremy Siek Discrete Mathematics 4 / 12

Page 11: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Propositional Logic

I Propositional logic is a language that abstracts away from contentand focuses on the logical connectives.

I Uppercase letters like P and Q are meta-variables that areplaceholders for propositions.

I The following rules define what is a proposition.I A propositional variable (lowercase letters p, q, r) is a

proposition. These variables model true/false statements.I The negation of a proposition P, written ¬ P, is a proposition.I The conjunction (and) of two propositions, written P ∧ Q, is a

proposition.I The disjunction (or) of two propositions, written P ∨ Q, is a

proposition.I The conditional statement (implies), written P −→ Q, is a

proposition.I The Boolean values True and False are propositions.

Jeremy Siek Discrete Mathematics 4 / 12

Page 12: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Propositional Logic

I Different authors include different logical connectives in theirdefinitions of Propositional Logic. However, these differences arenot important.

I In each case, the missing connectives can be defined in terms ofthe connectives that are present.

I For example, I left out exclusive or, P ⊕ Q, but

P ⊕ Q = (P ∧ ¬ Q) ∨ ¬ P ∧ Q

Jeremy Siek Discrete Mathematics 5 / 12

Page 13: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Propositional Logic

I How expressive is Propositional Logic?I Can you write down the rules for Sudoku in Propositional Logic?

I It’s rather difficult if not impossible to express the rules of Sudokuin Propositional Logic.

I But Propositional Logic is a good first step towards more powerfullogics.

Jeremy Siek Discrete Mathematics 6 / 12

Page 14: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Propositional Logic

I How expressive is Propositional Logic?I Can you write down the rules for Sudoku in Propositional Logic?I It’s rather difficult if not impossible to express the rules of Sudoku

in Propositional Logic.I But Propositional Logic is a good first step towards more powerful

logics.

Jeremy Siek Discrete Mathematics 6 / 12

Page 15: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Meaning of Propositions

I A truth assignment maps propositional variables to True or False.The following is an example:

A ≡ {p 7→ True, q 7→ False, r 7→ True}A(p) = True A(q) = False A(r) = True

I The meaning of a proposition is a function from truthassignments to True or False. We use the notation JP K for themeaning of proposition P .

JpK(A) = A(p)

J¬P K(A) =

{True if JP K(A) = False

False otherwise

Jeremy Siek Discrete Mathematics 7 / 12

Page 16: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Meaning of Propositions, cont’d

JP ∧QK(A) =

{True if JP K(A) = True, JQK(A) = True

False otherwise

JP ∨QK(A) =

{False if JP K(A) = False, JQK(A) = False

True otherwise

JP −→ QK(A) =

{False if JP K(A) = True, JQK(A) = False

True otherwise

Jeremy Siek Discrete Mathematics 8 / 12

Page 17: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Example Propositions

Suppose A = {p 7→ True, q 7→ False}.

I JpK(A) = True

I JqK(A) = False

I Jp ∧ pK(A) = True

I Jp ∧ qK(A) = False

I Jp ∨ qK(A) = True

I Jp −→ pK(A) = True

I Jq −→ pK(A) = True

I Jp −→ qK(A) = False

I J(p ∨ q) −→ qK(A) = False

Jeremy Siek Discrete Mathematics 9 / 12

Page 18: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Example Propositions

Suppose A = {p 7→ True, q 7→ False}.

I JpK(A) = True

I JqK(A) = False

I Jp ∧ pK(A) = True

I Jp ∧ qK(A) = False

I Jp ∨ qK(A) = True

I Jp −→ pK(A) = True

I Jq −→ pK(A) = True

I Jp −→ qK(A) = False

I J(p ∨ q) −→ qK(A) = False

Jeremy Siek Discrete Mathematics 9 / 12

Page 19: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Example Propositions

Suppose A = {p 7→ True, q 7→ False}.

I JpK(A) = True

I JqK(A) = False

I Jp ∧ pK(A) = True

I Jp ∧ qK(A) = False

I Jp ∨ qK(A) = True

I Jp −→ pK(A) = True

I Jq −→ pK(A) = True

I Jp −→ qK(A) = False

I J(p ∨ q) −→ qK(A) = False

Jeremy Siek Discrete Mathematics 9 / 12

Page 20: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Example Propositions

Suppose A = {p 7→ True, q 7→ False}.

I JpK(A) = True

I JqK(A) = False

I Jp ∧ pK(A) = True

I Jp ∧ qK(A) = False

I Jp ∨ qK(A) = True

I Jp −→ pK(A) = True

I Jq −→ pK(A) = True

I Jp −→ qK(A) = False

I J(p ∨ q) −→ qK(A) = False

Jeremy Siek Discrete Mathematics 9 / 12

Page 21: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Example Propositions

Suppose A = {p 7→ True, q 7→ False}.

I JpK(A) = True

I JqK(A) = False

I Jp ∧ pK(A) = True

I Jp ∧ qK(A) = False

I Jp ∨ qK(A) = True

I Jp −→ pK(A) = True

I Jq −→ pK(A) = True

I Jp −→ qK(A) = False

I J(p ∨ q) −→ qK(A) = False

Jeremy Siek Discrete Mathematics 9 / 12

Page 22: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Example Propositions

Suppose A = {p 7→ True, q 7→ False}.

I JpK(A) = True

I JqK(A) = False

I Jp ∧ pK(A) = True

I Jp ∧ qK(A) = False

I Jp ∨ qK(A) = True

I Jp −→ pK(A) = True

I Jq −→ pK(A) = True

I Jp −→ qK(A) = False

I J(p ∨ q) −→ qK(A) = False

Jeremy Siek Discrete Mathematics 9 / 12

Page 23: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Example Propositions

Suppose A = {p 7→ True, q 7→ False}.

I JpK(A) = True

I JqK(A) = False

I Jp ∧ pK(A) = True

I Jp ∧ qK(A) = False

I Jp ∨ qK(A) = True

I Jp −→ pK(A) = True

I Jq −→ pK(A) = True

I Jp −→ qK(A) = False

I J(p ∨ q) −→ qK(A) = False

Jeremy Siek Discrete Mathematics 9 / 12

Page 24: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Example Propositions

Suppose A = {p 7→ True, q 7→ False}.

I JpK(A) = True

I JqK(A) = False

I Jp ∧ pK(A) = True

I Jp ∧ qK(A) = False

I Jp ∨ qK(A) = True

I Jp −→ pK(A) = True

I Jq −→ pK(A) = True

I Jp −→ qK(A) = False

I J(p ∨ q) −→ qK(A) = False

Jeremy Siek Discrete Mathematics 9 / 12

Page 25: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Example Propositions

Suppose A = {p 7→ True, q 7→ False}.

I JpK(A) = True

I JqK(A) = False

I Jp ∧ pK(A) = True

I Jp ∧ qK(A) = False

I Jp ∨ qK(A) = True

I Jp −→ pK(A) = True

I Jq −→ pK(A) = True

I Jp −→ qK(A) = False

I J(p ∨ q) −→ qK(A) = False

Jeremy Siek Discrete Mathematics 9 / 12

Page 26: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Example Propositions

Suppose A = {p 7→ True, q 7→ False}.

I JpK(A) = True

I JqK(A) = False

I Jp ∧ pK(A) = True

I Jp ∧ qK(A) = False

I Jp ∨ qK(A) = True

I Jp −→ pK(A) = True

I Jq −→ pK(A) = True

I Jp −→ qK(A) = False

I J(p ∨ q) −→ qK(A) = False

Jeremy Siek Discrete Mathematics 9 / 12

Page 27: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Tautologies

DefinitionA tautology is a proposition that is true in any truth assignment.

Examples:

I p −→ p

I q ∨ ¬q

I (p ∧ q) −→ (p ∨ q)

There are two ways to show that a proposition is a tautology:

1. Check the meaning of the proposition for every possible truthassignment. This is called model checking.

2. Contruct a proof that the proposition is a tautology.

Jeremy Siek Discrete Mathematics 10 / 12

Page 28: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Model Checking

I One way to simplify the checking is to only consider truthassignments that include the variables that matter. For example,to check p −→ p, we only need to consider two truth assignments.

1. A1 = {p 7→ True}, Jp −→ pK(A1) = True

2. A2 = {p 7→ False}Jp −→ pK(A2) = True

I However, in real systems there are many variables, and thenumber of possible truth assignments grows quickly: it is 2n for nvariables.

I There are many researchers dedicated to discovering algorithmsthat speed up model checking.

Jeremy Siek Discrete Mathematics 11 / 12

Page 29: Discrete Mathematics - University of Colorado Boulderecee.colorado.edu/~siek/ecen3703/spring10/lecture2.pdf · Outline of Lecture 2 1. Propositional Logic 2. Syntax and Meaning of

Stuff to Rememeber

Propositional Logic:

I The kinds of propositions.I The meaning of propositions.I How to check that a proposition is a tautology.

Jeremy Siek Discrete Mathematics 12 / 12