=1=discrete mathematics and its applicationsfaculty.washington.edu/.../discretemathematics/... ·...

31
Discrete Mathematics and its Applications Ngày 14 tháng 9 năm 2011 () Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 1/6

Upload: dinhkiet

Post on 16-Aug-2018

234 views

Category:

Documents


0 download

TRANSCRIPT

Discrete Mathematicsand its Applications

Ngày 14 tháng 9 năm 2011

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 1 / 6

Logic-2

(Applications)

Applications of logic are abundent. Systems specifications wherecomplex systems are designed use logic. Chips, web searches,programming languages, puzzle solving all use logic.For instance, Sudoku puzzles can be solved using logic. Just introduce729 propositions p(m,n, k) which will mean “the number k goes in rowm column n” then construct compound propositions that state that inevery row, in every column and in the nine 3× 3 blocks every integerfrom 1 to 9 must appear.

One of the most important development that had a profound impact onour life, is our ability to implement logical operations by electronicdevices. The generic name of electronic devices that implement logicoperations is logic gates. Imagine, withoout logic gates there would beno Facebook. Can you imagine living in a world without facebook?

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 1 / 6

Logic-2

(Applications)

Applications of logic are abundent. Systems specifications wherecomplex systems are designed use logic. Chips, web searches,programming languages, puzzle solving all use logic.For instance, Sudoku puzzles can be solved using logic. Just introduce729 propositions p(m,n, k) which will mean “the number k goes in rowm column n” then construct compound propositions that state that inevery row, in every column and in the nine 3× 3 blocks every integerfrom 1 to 9 must appear.

One of the most important development that had a profound impact onour life, is our ability to implement logical operations by electronicdevices. The generic name of electronic devices that implement logicoperations is logic gates. Imagine, withoout logic gates there would beno Facebook. Can you imagine living in a world without facebook?

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 1 / 6

Logic-2

(Applications)

Applications of logic are abundent. Systems specifications wherecomplex systems are designed use logic. Chips, web searches,programming languages, puzzle solving all use logic.For instance, Sudoku puzzles can be solved using logic. Just introduce729 propositions p(m,n, k) which will mean “the number k goes in rowm column n” then construct compound propositions that state that inevery row, in every column and in the nine 3× 3 blocks every integerfrom 1 to 9 must appear.One of the most important development that had a profound impact onour life, is our ability to implement logical operations by electronicdevices. The generic name of electronic devices that implement logicoperations is logic gates. Imagine, withoout logic gates there would beno Facebook. Can you imagine living in a world without facebook?

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 1 / 6

How important are logic gates? Walther Bothe received the NobelPrice in physics in 1954 for his development of the first electronicdevice that implemented the ∧ gate.

Today, we know how to implement logic gates at the molecular level.

Most programming languages implement four logical operators:

1 not2 and3 or4 implies (usually through the reserved word if)

DefinitionTwo propositions are logically equivalent if they have the same truthtable.

Example

p ∨ (q ∧ r) and (p ∨ q) ∧ (p ∨ r) are logically equivalent.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 2 / 6

How important are logic gates? Walther Bothe received the NobelPrice in physics in 1954 for his development of the first electronicdevice that implemented the ∧ gate.

Today, we know how to implement logic gates at the molecular level.

Most programming languages implement four logical operators:

1 not2 and3 or4 implies (usually through the reserved word if)

DefinitionTwo propositions are logically equivalent if they have the same truthtable.

Example

p ∨ (q ∧ r) and (p ∨ q) ∧ (p ∨ r) are logically equivalent.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 2 / 6

How important are logic gates? Walther Bothe received the NobelPrice in physics in 1954 for his development of the first electronicdevice that implemented the ∧ gate.

Today, we know how to implement logic gates at the molecular level.

Most programming languages implement four logical operators:1 not

2 and3 or4 implies (usually through the reserved word if)

DefinitionTwo propositions are logically equivalent if they have the same truthtable.

Example

p ∨ (q ∧ r) and (p ∨ q) ∧ (p ∨ r) are logically equivalent.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 2 / 6

How important are logic gates? Walther Bothe received the NobelPrice in physics in 1954 for his development of the first electronicdevice that implemented the ∧ gate.

Today, we know how to implement logic gates at the molecular level.

Most programming languages implement four logical operators:1 not2 and

3 or4 implies (usually through the reserved word if)

DefinitionTwo propositions are logically equivalent if they have the same truthtable.

Example

p ∨ (q ∧ r) and (p ∨ q) ∧ (p ∨ r) are logically equivalent.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 2 / 6

How important are logic gates? Walther Bothe received the NobelPrice in physics in 1954 for his development of the first electronicdevice that implemented the ∧ gate.

Today, we know how to implement logic gates at the molecular level.

Most programming languages implement four logical operators:1 not2 and3 or

4 implies (usually through the reserved word if)

DefinitionTwo propositions are logically equivalent if they have the same truthtable.

Example

p ∨ (q ∧ r) and (p ∨ q) ∧ (p ∨ r) are logically equivalent.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 2 / 6

How important are logic gates? Walther Bothe received the NobelPrice in physics in 1954 for his development of the first electronicdevice that implemented the ∧ gate.

Today, we know how to implement logic gates at the molecular level.

Most programming languages implement four logical operators:1 not2 and3 or4 implies (usually through the reserved word if)

DefinitionTwo propositions are logically equivalent if they have the same truthtable.

Example

p ∨ (q ∧ r) and (p ∨ q) ∧ (p ∨ r) are logically equivalent.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 2 / 6

How important are logic gates? Walther Bothe received the NobelPrice in physics in 1954 for his development of the first electronicdevice that implemented the ∧ gate.

Today, we know how to implement logic gates at the molecular level.

Most programming languages implement four logical operators:1 not2 and3 or4 implies (usually through the reserved word if)

DefinitionTwo propositions are logically equivalent if they have the same truthtable.

Example

p ∨ (q ∧ r) and (p ∨ q) ∧ (p ∨ r) are logically equivalent.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 2 / 6

How important are logic gates? Walther Bothe received the NobelPrice in physics in 1954 for his development of the first electronicdevice that implemented the ∧ gate.

Today, we know how to implement logic gates at the molecular level.

Most programming languages implement four logical operators:1 not2 and3 or4 implies (usually through the reserved word if)

DefinitionTwo propositions are logically equivalent if they have the same truthtable.

Example

p ∨ (q ∧ r) and (p ∨ q) ∧ (p ∨ r) are logically equivalent.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 2 / 6

There are a few surprises when considering equivalence ofpropositions. Here is a list of some of them:

1 Are (p → q)→ s and p → (q → s) equivalent?

2 Are p | q and q | p equivalent?3 What about p | (q | s) and (p | q) | s?

DefinitionA set of logical operators is a functionally complete collection ifevery truth table has an equivalent proposition using only operatorsfrom this set.

CommentIn the next slide we shall see some examples of functionally completecollections. A bit surprising is that the | and ↓ each by itself is afunctionally complete collection. It is also noteworthy that the nandgate is the cheapest to build.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 3 / 6

There are a few surprises when considering equivalence ofpropositions. Here is a list of some of them:

1 Are (p → q)→ s and p → (q → s) equivalent?2 Are p | q and q | p equivalent?

3 What about p | (q | s) and (p | q) | s?

DefinitionA set of logical operators is a functionally complete collection ifevery truth table has an equivalent proposition using only operatorsfrom this set.

CommentIn the next slide we shall see some examples of functionally completecollections. A bit surprising is that the | and ↓ each by itself is afunctionally complete collection. It is also noteworthy that the nandgate is the cheapest to build.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 3 / 6

There are a few surprises when considering equivalence ofpropositions. Here is a list of some of them:

1 Are (p → q)→ s and p → (q → s) equivalent?2 Are p | q and q | p equivalent?3 What about p | (q | s) and (p | q) | s?

DefinitionA set of logical operators is a functionally complete collection ifevery truth table has an equivalent proposition using only operatorsfrom this set.

CommentIn the next slide we shall see some examples of functionally completecollections. A bit surprising is that the | and ↓ each by itself is afunctionally complete collection. It is also noteworthy that the nandgate is the cheapest to build.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 3 / 6

There are a few surprises when considering equivalence ofpropositions. Here is a list of some of them:

1 Are (p → q)→ s and p → (q → s) equivalent?2 Are p | q and q | p equivalent?3 What about p | (q | s) and (p | q) | s?

DefinitionA set of logical operators is a functionally complete collection ifevery truth table has an equivalent proposition using only operatorsfrom this set.

CommentIn the next slide we shall see some examples of functionally completecollections. A bit surprising is that the | and ↓ each by itself is afunctionally complete collection. It is also noteworthy that the nandgate is the cheapest to build.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 3 / 6

There are a few surprises when considering equivalence ofpropositions. Here is a list of some of them:

1 Are (p → q)→ s and p → (q → s) equivalent?2 Are p | q and q | p equivalent?3 What about p | (q | s) and (p | q) | s?

DefinitionA set of logical operators is a functionally complete collection ifevery truth table has an equivalent proposition using only operatorsfrom this set.

CommentIn the next slide we shall see some examples of functionally completecollections. A bit surprising is that the | and ↓ each by itself is afunctionally complete collection. It is also noteworthy that the nandgate is the cheapest to build.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 3 / 6

The proposition (p ∨ q ∨ r ∨ s ∨ t) is false only if the five propositionsinside it are all false. In all other cases it will be true. Alternatively, itstruth table has 32 entries, 31 of them are true and only one is false.

Similary, the proposition (p ∧ q ∧ ¬r ∧ s ∧ ¬t) is true if and only if thefive propositions inside are all true. In all other cases it will be false.Alternatively, its truth table has 32 entries, 31 of them are false andonlyone is true.

Definition

1 A proposition of the form (p1 ∨ p2 ∨ . . . ∨ pk) is called adisjunction.

2 A proposition of the form (p1 ∧ p2 ∧ . . . ∧ pk) is called aconjunction.

3 A proposition of the form (D1 ∧ D2 ∧ . . .Dm) where each Di is adisjunction is called a conjunction of disjunctions.

4 Similarly, a proposition of the form (C1 ∨ C2 ∨ . . .Ck) where eachCi is a conjunction is called a disjunction of conjunctions.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 4 / 6

The proposition (p ∨ q ∨ r ∨ s ∨ t) is false only if the five propositionsinside it are all false. In all other cases it will be true. Alternatively, itstruth table has 32 entries, 31 of them are true and only one is false.

Similary, the proposition (p ∧ q ∧ ¬r ∧ s ∧ ¬t) is true if and only if thefive propositions inside are all true. In all other cases it will be false.Alternatively, its truth table has 32 entries, 31 of them are false andonlyone is true.

Definition

1 A proposition of the form (p1 ∨ p2 ∨ . . . ∨ pk) is called adisjunction.

2 A proposition of the form (p1 ∧ p2 ∧ . . . ∧ pk) is called aconjunction.

3 A proposition of the form (D1 ∧ D2 ∧ . . .Dm) where each Di is adisjunction is called a conjunction of disjunctions.

4 Similarly, a proposition of the form (C1 ∨ C2 ∨ . . .Ck) where eachCi is a conjunction is called a disjunction of conjunctions.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 4 / 6

The proposition (p ∨ q ∨ r ∨ s ∨ t) is false only if the five propositionsinside it are all false. In all other cases it will be true. Alternatively, itstruth table has 32 entries, 31 of them are true and only one is false.

Similary, the proposition (p ∧ q ∧ ¬r ∧ s ∧ ¬t) is true if and only if thefive propositions inside are all true. In all other cases it will be false.Alternatively, its truth table has 32 entries, 31 of them are false andonlyone is true.

Definition1 A proposition of the form (p1 ∨ p2 ∨ . . . ∨ pk) is called a

disjunction.

2 A proposition of the form (p1 ∧ p2 ∧ . . . ∧ pk) is called aconjunction.

3 A proposition of the form (D1 ∧ D2 ∧ . . .Dm) where each Di is adisjunction is called a conjunction of disjunctions.

4 Similarly, a proposition of the form (C1 ∨ C2 ∨ . . .Ck) where eachCi is a conjunction is called a disjunction of conjunctions.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 4 / 6

The proposition (p ∨ q ∨ r ∨ s ∨ t) is false only if the five propositionsinside it are all false. In all other cases it will be true. Alternatively, itstruth table has 32 entries, 31 of them are true and only one is false.

Similary, the proposition (p ∧ q ∧ ¬r ∧ s ∧ ¬t) is true if and only if thefive propositions inside are all true. In all other cases it will be false.Alternatively, its truth table has 32 entries, 31 of them are false andonlyone is true.

Definition1 A proposition of the form (p1 ∨ p2 ∨ . . . ∨ pk) is called a

disjunction.2 A proposition of the form (p1 ∧ p2 ∧ . . . ∧ pk) is called a

conjunction.

3 A proposition of the form (D1 ∧ D2 ∧ . . .Dm) where each Di is adisjunction is called a conjunction of disjunctions.

4 Similarly, a proposition of the form (C1 ∨ C2 ∨ . . .Ck) where eachCi is a conjunction is called a disjunction of conjunctions.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 4 / 6

The proposition (p ∨ q ∨ r ∨ s ∨ t) is false only if the five propositionsinside it are all false. In all other cases it will be true. Alternatively, itstruth table has 32 entries, 31 of them are true and only one is false.

Similary, the proposition (p ∧ q ∧ ¬r ∧ s ∧ ¬t) is true if and only if thefive propositions inside are all true. In all other cases it will be false.Alternatively, its truth table has 32 entries, 31 of them are false andonlyone is true.

Definition1 A proposition of the form (p1 ∨ p2 ∨ . . . ∨ pk) is called a

disjunction.2 A proposition of the form (p1 ∧ p2 ∧ . . . ∧ pk) is called a

conjunction.3 A proposition of the form (D1 ∧ D2 ∧ . . .Dm) where each Di is a

disjunction is called a conjunction of disjunctions.

4 Similarly, a proposition of the form (C1 ∨ C2 ∨ . . .Ck) where eachCi is a conjunction is called a disjunction of conjunctions.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 4 / 6

The proposition (p ∨ q ∨ r ∨ s ∨ t) is false only if the five propositionsinside it are all false. In all other cases it will be true. Alternatively, itstruth table has 32 entries, 31 of them are true and only one is false.

Similary, the proposition (p ∧ q ∧ ¬r ∧ s ∧ ¬t) is true if and only if thefive propositions inside are all true. In all other cases it will be false.Alternatively, its truth table has 32 entries, 31 of them are false andonlyone is true.

Definition1 A proposition of the form (p1 ∨ p2 ∨ . . . ∨ pk) is called a

disjunction.2 A proposition of the form (p1 ∧ p2 ∧ . . . ∧ pk) is called a

conjunction.3 A proposition of the form (D1 ∧ D2 ∧ . . .Dm) where each Di is a

disjunction is called a conjunction of disjunctions.4 Similarly, a proposition of the form (C1 ∨ C2 ∨ . . .Ck) where each

Ci is a conjunction is called a disjunction of conjunctions.() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 4 / 6

TheoremEvery truth table represents a proposition which has an equivalentconjunction of disjunctions.This implies that ¬,∨,∧ is a functionally complete collection of logicoperators.

Every truth table represents a proposition which has an equivalentdisjunction of conjunctions.

Chứng minh.

Start writing...

CommentThis explains why programming languages implement only four logicaloperators. All others can be easily implemented using them. See forexample the Sage example. Even though as we shall soon see, we canuse less operators, the choice to implement those is to make it moreconvenient for the programmer.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 5 / 6

TheoremEvery truth table represents a proposition which has an equivalentconjunction of disjunctions.This implies that ¬,∨,∧ is a functionally complete collection of logicoperators.

Every truth table represents a proposition which has an equivalentdisjunction of conjunctions.

Chứng minh.

Start writing...

CommentThis explains why programming languages implement only four logicaloperators. All others can be easily implemented using them. See forexample the Sage example. Even though as we shall soon see, we canuse less operators, the choice to implement those is to make it moreconvenient for the programmer.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 5 / 6

TheoremEvery truth table represents a proposition which has an equivalentconjunction of disjunctions.This implies that ¬,∨,∧ is a functionally complete collection of logicoperators.Every truth table represents a proposition which has an equivalentdisjunction of conjunctions.

Chứng minh.

Start writing...

CommentThis explains why programming languages implement only four logicaloperators. All others can be easily implemented using them. See forexample the Sage example. Even though as we shall soon see, we canuse less operators, the choice to implement those is to make it moreconvenient for the programmer.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 5 / 6

TheoremEvery truth table represents a proposition which has an equivalentconjunction of disjunctions.This implies that ¬,∨,∧ is a functionally complete collection of logicoperators.Every truth table represents a proposition which has an equivalentdisjunction of conjunctions.

Chứng minh.

Start writing...

CommentThis explains why programming languages implement only four logicaloperators. All others can be easily implemented using them. See forexample the Sage example. Even though as we shall soon see, we canuse less operators, the choice to implement those is to make it moreconvenient for the programmer.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 5 / 6

DefinitionA proposition which is true for every assertion (assigning truth valuesto the variables) is called a tautology.

ExampleThe simplest example is the proposition p ∨ ¬p. We will see other,more complicated examples in the exercises and drills.

DefinitionA proposition which is false for all possible assertions is called acontradiction.

ExampleAgain, the simplest example is the proposition p ∧ ¬p.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 6 / 6

DefinitionA proposition which is true for every assertion (assigning truth valuesto the variables) is called a tautology.

ExampleThe simplest example is the proposition p ∨ ¬p. We will see other,more complicated examples in the exercises and drills.

DefinitionA proposition which is false for all possible assertions is called acontradiction.

ExampleAgain, the simplest example is the proposition p ∧ ¬p.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 6 / 6

DefinitionA proposition which is true for every assertion (assigning truth valuesto the variables) is called a tautology.

ExampleThe simplest example is the proposition p ∨ ¬p. We will see other,more complicated examples in the exercises and drills.

DefinitionA proposition which is false for all possible assertions is called acontradiction.

ExampleAgain, the simplest example is the proposition p ∧ ¬p.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 6 / 6

DefinitionA proposition which is true for every assertion (assigning truth valuesto the variables) is called a tautology.

ExampleThe simplest example is the proposition p ∨ ¬p. We will see other,more complicated examples in the exercises and drills.

DefinitionA proposition which is false for all possible assertions is called acontradiction.

ExampleAgain, the simplest example is the proposition p ∧ ¬p.

() Discrete Mathematicsand its Applications Ngày 14 tháng 9 năm 2011 6 / 6