29
Discrete Mathematics Jeremy Siek Spring 2010 Jeremy Siek Discrete Mathematics 1 / 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

  • Upload
    hakiet

  • View
    215

  • Download
    0

Embed Size (px)

Citation preview

Discrete Mathematics

Jeremy Siek

Spring 2010

Jeremy Siek Discrete Mathematics 1 / 12

Jeremy Siek Discrete Mathematics 2 / 12

Outline of Lecture 2

1. Propositional Logic

2. Syntax and Meaning of Propositional Logic

Jeremy Siek Discrete Mathematics 2 / 12

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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