64
Discrete Mathematics 離散數學 Lecture 01 Lecture 01 September 13, 2006 September 13, 2006 洪國寶 洪國寶

Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

Embed Size (px)

Citation preview

Page 1: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

Discrete Mathematics離散數學

Lecture 01 Lecture 01 September 13, 2006September 13, 2006

洪國寶洪國寶

Page 2: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 2

Outline

•• Course informationCourse information•• Overview of Discrete MathematicsOverview of Discrete Mathematics• Logic (chapter 1 ((§§1.1)1.1))

Page 3: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 3

Course information (1/3)

• Textbook Discrete Mathematics and its Applications, Discrete Mathematics and its Applications, 5th Edition,5th Edition, Kenneth H. Rosen, McGrawKenneth H. Rosen, McGraw--Hill, Inc., New York, 2003Hill, Inc., New York, 2003

http://wwwhttp://www.mhhe.mhhe.com/math.com/math/advmath/rosen/advmath/rosen/r5//r5/

歐亞書局

Page 4: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 4

Course information (2/3)

•• Grading Grading (Tentative)(Tentative)Quizzes 30%Quizzes 30%Midterm exam 30%Midterm exam 30%Final exam 30%Final exam 30%Class participation 10%Class participation 10%

Page 5: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 5

Course information (3/3)

•• The problems of the quizzes and exams are The problems of the quizzes and exams are allall from from examplesexamples and and exercisesexercises of the of the textbook.textbook.

Page 6: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 6

Outline

•• Course informationCourse information•• Overview of Discrete MathematicsOverview of Discrete Mathematics• Logic (chapter 1 ((§§1.1)1.1))

Page 7: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

Overview of Discrete Mathematics

•• What is Discrete Mathematics? What is Discrete Mathematics? •• What is Mathematics, really? What is Mathematics, really?

–– ItIt’’s s notnot just about numbers!just about numbers!–– Mathematics is much more than that:Mathematics is much more than that:

Mathematics is the study of any and all absolutely certain truths about any and all perfectly well-defined concepts.

Page 8: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

Overview of Discrete Mathematics

•• But, the concepts can relate to numbers, But, the concepts can relate to numbers, symbols, visual patterns, or symbols, visual patterns, or anythinganything!!

Mathemabsolutely certainperfectly well-defined

atics is the study of any and all truths about any and all

concepts.

Page 9: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

Overview of Discrete Mathematics

•• What is Discrete Mathematics? What is Discrete Mathematics? –– The study of The study of discretediscrete, mathematical objects , mathematical objects

and and structuresstructures..

Page 10: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

Overview of Discrete Mathematics

•• What are What are ““discrete structuresdiscrete structures”” anyway?anyway?–– ““DiscreteDiscrete”” -- Composed of distinct, separable Composed of distinct, separable

parts. (Opposite of parts. (Opposite of continuouscontinuous.).)discrete:continuous :: digital:analogdiscrete:continuous :: digital:analog

–– ““StructuresStructures”” -- objects built up from simpler objects built up from simpler objects according to a definite pattern.objects according to a definite pattern.

Page 11: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

Discrete Structures We’ll Study

•• PropositionsPropositions•• PredicatesPredicates•• SetsSets•• (Discrete) Functions(Discrete) Functions•• Orders of GrowthOrders of Growth•• AlgorithmsAlgorithms•• IntegersIntegers

•• ProofsProofs•• SummationsSummations•• Permutations Permutations •• CombinationsCombinations•• RelationsRelations•• GraphsGraphs•• TreesTrees

Page 12: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 12

Relationships Between Structures

Sets

Sequencesn-tuples

MatricesNaturalnumbers

Integers

Relations

Functions

GraphsReal numbers

Complex numbers

Strings

Propositions

ProofsTreesOperatorsPrograms

Infiniteordinals Vectors

Groups

Bits

•• ““→→”” ::≡≡ ““Can be defined in terms ofCan be defined in terms of””

Page 13: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

Some Notations We’ll Learn

)(deg][)|(),,;(

][)(

) (mod modlcmgcd,/|max min,,,

)(:

||

)(|,,,,)()(

1

][T0

1

1

1

1

vaRFEpnnnCrn

aaa

mbabaO

aaxgfxfBAf

AABASTS

SxxPxaaxPxxPxqpqpqpqpp

Rm

nijbk

n

ii

S

n

ii

n

+∗

=∈

=

≡ΘΩ

∪⊆∅

∉∴∃∀⇔→⊕∧¬

∏∑

L

L

o

L

I

ABAA

RNZ

Ο

αα

Page 14: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

Why Study Discrete Math?

•• The basis of all of digital information The basis of all of digital information processing: processing: Discrete manipulations of Discrete manipulations of discrete structures represented in memory.discrete structures represented in memory.

•• ItIt’’s the basic language and conceptual s the basic language and conceptual foundation of all of computer science.foundation of all of computer science.

•• Discrete concepts are also widely used Discrete concepts are also widely used throughout math, science, engineering, throughout math, science, engineering, economics, biology, economics, biology, etc.etc., , ……

•• A generally useful tool for rational thought!A generally useful tool for rational thought!

Page 15: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

Uses for Discrete Math in Computer Science

•• Algorithms & data Algorithms & data structuresstructures

•• Programming Programming language compilers & language compilers & interpreters.interpreters.

•• Computer networksComputer networks•• Operating systemsOperating systems•• Computer architectureComputer architecture

•• Database management Database management systemssystems

•• Computer securityComputer security•• Error correction codesError correction codes•• Graphics & animation Graphics & animation

algorithms, game algorithms, game enginesengines

•• Just about everything!Just about everything!

Page 16: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

Goals of a Discrete Math Course

•• Teach students how to think mathematicallyTeach students how to think mathematically•• Five important themes Five important themes

-- mathematical reasoningmathematical reasoning-- combinatorial analysiscombinatorial analysis-- discrete structuresdiscrete structures-- algorithmic thinkingalgorithmic thinking-- applications and modelingapplications and modeling

Page 17: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

Five Important Themes

-- mathematical reasoningmathematical reasoningto read, comprehend, and construct mathematical argumento read, comprehend, and construct mathematical argumentsts

-- combinatorial analysiscombinatorial analysisthe ability to count or enumerate objectsthe ability to count or enumerate objects

-- discrete structuresdiscrete structuresto work with discrete structures, which are the abstract to work with discrete structures, which are the abstract mathematical mathematical

structures used to represent discrete objects and relationships structures used to represent discrete objects and relationships between these between these objectsobjects

-- algorithmic thinkingalgorithmic thinkingthe specification of the algorithm, the verification thatthe specification of the algorithm, the verification that it works properly, and it works properly, and

the analysis of the computer memory and time required to performthe analysis of the computer memory and time required to perform itit

-- applications and modelingapplications and modeling

Page 18: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

•• Upon completion of this course, the student Upon completion of this course, the student should be able to:should be able to:–– Check the validity of simple logical arguments.Check the validity of simple logical arguments.–– Creatively construct simple valid logical arguments.Creatively construct simple valid logical arguments.–– Describe the definitions and properties of a variety of Describe the definitions and properties of a variety of

specific types discrete structures.specific types discrete structures.–– Correctly read, write and analyze various types of Correctly read, write and analyze various types of

structures using standard notations.structures using standard notations.

Course Objectives

Page 19: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 19

Course Outline (1/11)

•• 11 The Foundations: Logic, Sets, and The Foundations: Logic, Sets, and FunctionsFunctions–– 1.11.1 LogicLogic–– 1.21.2 Propositional EquivalencesPropositional Equivalences–– 1.31.3 Predicates and QuantifiersPredicates and Quantifiers–– 1.41.4 Nested QuantifiersNested Quantifiers–– 1.51.5 Methods of proofMethods of proof–– 1.61.6 SetsSets–– 1.71.7 Set OperationsSet Operations–– 1.81.8 FunctionsFunctions

Page 20: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 20

Course Outline (2/11)

•• 22 The Fundamentals: Algorithms, The Fundamentals: Algorithms, the Integers, and Matricesthe Integers, and Matrices–– 2.12.1 AlgorithmsAlgorithms–– 2.22.2 The Growth of FunctionsThe Growth of Functions–– 2.32.3 Complexity of AlgorithmsComplexity of Algorithms–– 2.42.4 The Integers and DivisionThe Integers and Division–– 2.52.5 Integers and AlgorithmsIntegers and Algorithms–– 2.62.6 Applications of Number TheoryApplications of Number Theory–– 2.72.7 MatricesMatrices

Page 21: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 21

Course Outline (3/11)

•• 33 Mathematical Reasoning, Mathematical Reasoning, Induction, and RecursionInduction, and Recursion–– 3.13.1 Art and Strategy of ProofArt and Strategy of Proof–– 3.23.2 Sequences and SumsSequences and Sums–– 3.33.3 Mathematical InductionMathematical Induction–– 3.43.4 Recursive Definitions and Recursive Definitions and

Structural DefinitionStructural Definition–– 3.53.5 Recursive AlgorithmsRecursive Algorithms–– 3.63.6 Program CorrectnessProgram Correctness

Page 22: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 22

Course Outline (4/11)

•• 44 CountingCounting–– 4.14.1 The Basics of CountingThe Basics of Counting–– 4.24.2 The Pigeonhole PrincipleThe Pigeonhole Principle–– 4.34.3 Permutations and CombinationsPermutations and Combinations–– 4.44.4 Binomial CoefficientsBinomial Coefficients–– 4.54.5 Generalized Permutations and Generalized Permutations and

CombinationsCombinations–– 4.64.6 Generating Permutations and Generating Permutations and

CombinationsCombinations

Page 23: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 23

Course Outline (5/11)

•• 55 Discrete ProbabilityDiscrete Probability––5.15.1 An Introduction to Discrete An Introduction to Discrete

ProbabilityProbability––5.25.2 Probability TheoryProbability Theory––5.35.3 Expected Value and Expected Value and

VarianceVariance

Page 24: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 24

Course Outline (6/11)

•• 66 Advanced Counting TechniquesAdvanced Counting Techniques–– 6.16.1 Recurrence RelationsRecurrence Relations–– 6.26.2 Solving Recurrence RelationsSolving Recurrence Relations–– 6.36.3 DivideDivide--andand--Conquer RelationsConquer Relations–– 6.46.4 Generating FunctionsGenerating Functions–– 6.56.5 InclusionInclusion--ExclusionExclusion–– 6.66.6 Applications of InclusionApplications of Inclusion--ExclusionExclusion

Page 25: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 25

Course Outline (7/11)

•• 77 RelationsRelations–– 7.17.1 Relations and Their PropertiesRelations and Their Properties–– 7.27.2 nn--aryary Relations and Their Relations and Their

ApplicationsApplications–– 7.37.3 Representing RelationsRepresenting Relations–– 7.47.4 Closures of RelationsClosures of Relations–– 7.57.5 Equivalence RelationsEquivalence Relations–– 7.67.6 Partial OrderingsPartial Orderings

Page 26: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 26

Course Outline (8/11)

•• 88 GraphsGraphs–– 8.18.1 Introduction to GraphsIntroduction to Graphs–– 8.28.2 Graph TerminologyGraph Terminology–– 8.38.3 Representing Graphs and Graph Representing Graphs and Graph

IsomorphismIsomorphism–– 8.48.4 ConnectivityConnectivity–– 8.58.5 Euler and Hamilton PathsEuler and Hamilton Paths–– 8.68.6 Shortest Path ProblemsShortest Path Problems–– 8.78.7 Planar GraphsPlanar Graphs–– 8.88.8 Graph ColoringGraph Coloring

Page 27: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 27

Course Outline (9/11)

•• 99 TreesTrees–– 9.19.1 Introduction to TreesIntroduction to Trees–– 9.29.2 Applications of TreesApplications of Trees–– 9.39.3 Tree TraversalTree Traversal–– 9.49.4 Spanning TreesSpanning Trees–– 9.59.5 Minimum Spanning TreesMinimum Spanning Trees

Page 28: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 28

Course Outline (10/11)

•• 1010 Boolean AlgebraBoolean Algebra–– 10.110.1 Boolean FunctionsBoolean Functions–– 10.210.2 Representing Boolean FunctionsRepresenting Boolean Functions–– 10.310.3 Logic GatesLogic Gates–– 10.410.4 Minimization of CircuitsMinimization of Circuits

Page 29: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 29

Course Outline (11/11)

•• 1111 Modeling ComputationModeling Computation–– 11.111.1 Languages and GrammarsLanguages and Grammars–– 11.211.2 FiniteFinite--State Machines with OutputState Machines with Output–– 11.311.3 FiniteFinite--State Machines with No OutputState Machines with No Output–– 11.411.4 Language RecognitionLanguage Recognition–– 11.511.5 Turing MachinesTuring Machines

Page 30: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 30

Some Advice

•• Take noteTake note•• Read in advanceRead in advance•• Do exercisesDo exercises•• Take advantages of the web resourcesTake advantages of the web resources

–– http://wwwhttp://www.mhhe.mhhe.com/math.com/math/advmath/rosen/advmath/rosen/r5//r5/–– MIT 6.042 MIT 6.042 Mathematics for Computer ScienceMathematics for Computer Science

http://theoryhttp://theory.lcs.mit.edu.lcs.mit.edu/classes/6.042/fall06//classes/6.042/fall06/

Page 31: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 31

Page 32: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 32

Outline

•• Course informationCourse information•• Overview of Discrete MathematicsOverview of Discrete Mathematics• Logic (chapter 1 ((§§1.1)1.1))

Page 33: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 33

Logic (1/2)

Mathematical Logic is a tool for working with complicated compound statements. It includes:

• A language for expressing them.• A concise notation for writing them.• A methodology for reasoning about their truth or

falsity.• It is the foundation for expressing formal proofs

in all branches of mathematics.

Page 34: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 34

Logic (2/2)

•• Propositional logic (Propositional logic (§§1.11.1--1.2):1.2):–– Basic definitions. (Basic definitions. (§§1.1)1.1)–– Equivalence rules & derivations. (Equivalence rules & derivations. (§§1.2)1.2)

•• Predicate logic (Predicate logic (§§1.31.3--1.4)1.4)–– Predicates.Predicates.–– Quantified predicate expressions.Quantified predicate expressions.–– Equivalences & derivations.Equivalences & derivations.

Page 35: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 35

Topic #1 – Propositional Logic

Propositional Logic (§1.1)

Propositional LogicPropositional Logic is the logic of compound is the logic of compound statements built from simpler statements statements built from simpler statements using sousing so--called called BooleanBoolean connectives.connectives.

Some applications in computer scienceSome applications in computer science::•• Design of digital electronic circuits.Design of digital electronic circuits.•• Expressing conditions in programs.Expressing conditions in programs.•• Queries to databases & search engines.Queries to databases & search engines.

Page 36: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 36

Topic #1 – Propositional Logic

Definition of a Proposition

A A propositionproposition ((pp, , qq, , rr, , ……) is simply a ) is simply a statement statement ((i.e.i.e., a declarative sentence), a declarative sentence) with with a definite meaninga definite meaning, having a , having a truth valuetruth valuethatthat’’s either s either truetrue (T) or (T) or falsefalse (F), but not (F), but not both.both.

(However, you might not (However, you might not knowknow the actual the actual truth value, and it might be situationtruth value, and it might be situation--dependent.)dependent.)

Page 37: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 37

Topic #1 – Propositional Logic

Examples of Propositions

•• ““It is raining.It is raining.”” (In a given situation.)(In a given situation.)•• ““Toronto is the capital of Canada.Toronto is the capital of Canada.””•• ““2 + 2 = 32 + 2 = 3””But, the following are But, the following are NOTNOT propositions:propositions:•• ““What time is it?What time is it?”” (interrogative, question)(interrogative, question)•• ““La la la la la.La la la la la.”” (meaningless interjection)(meaningless interjection)•• ““Just do it!Just do it!”” (imperative, command)(imperative, command)•• ““x+1=2x+1=2”” (neither true nor false)(neither true nor false)•• ““1 + 21 + 2”” (expression with a non(expression with a non--true/false value)true/false value)

Page 38: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 38

Topic #1.0 – Propositional Logic: Operators

An An operatoroperator or or connectiveconnective combines one or combines one or more more operand operand expressions into a larger expressions into a larger expression. (expression. (E.g.E.g., , ““++”” in numeric in numeric exprsexprs.).)

UnaryUnary operators take 1 operand (operators take 1 operand (e.g.,e.g., −−3); 3); binary binary operators take 2 operands (operators take 2 operands (egeg 3 3 ×× 4).4).

PropositionalPropositional or or BooleanBoolean operators operate operators operate on propositions or truth values instead of on on propositions or truth values instead of on numbers.numbers.

Operators / Connectives

Page 39: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 39

Some Popular Boolean Operators

↔↔BinaryBinaryIFFIFFBiconditionalBiconditional operatoroperator→→BinaryBinaryIMPLIESIMPLIESImplication operatorImplication operator⊕⊕BinaryBinaryXORXORExclusiveExclusive--OR operatorOR operator

Disjunction operatorDisjunction operatorConjunction operatorConjunction operatorNegation operatorNegation operator

Formal NameFormal Name

∨∨BinaryBinaryOROR∧∧BinaryBinaryANDAND¬¬UnaryUnaryNOTNOT

SymbolSymbolArityArityNicknameNickname

Page 40: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 40

Topic #1.0 – Propositional Logic: Operators

The Negation Operator

The unary The unary negation operatornegation operator “¬”“¬” ((NOTNOT) ) transforms a prop. into its logicaltransforms a prop. into its logical negationnegation..

E.g.E.g. If If pp = = ““Today is Friday.Today is Friday.””then then ¬¬pp = = ““Today is not Friday.Today is not Friday.””

Truth tableTruth table for NOT:for NOT: p ¬pT FF T

Operandcolumn

Resultcolumn

T :≡ True; F :≡ False“:≡” means “is defined as”

Page 41: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 41

Topic #1.0 – Propositional Logic: Operators

The Conjunction Operator

•• The binary The binary conjunction operatorconjunction operator ““∧∧””((ANDAND) combines two propositions to form ) combines two propositions to form their logical their logical conjunctionconjunction..

•• Example 4. If Example 4. If pp==““Today is Friday.Today is Friday.”” and and q=q=““It is raining today.It is raining today.””, then , then pp∧∧qq==““Today Today is Friday is Friday andand it is raining today.it is raining today.”

∧NDND∧

Remember: “∧∧”” points up like an points up like an ““AA””, and it means , and it means ““∧∧NDND””

Page 42: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 42

Topic #1.0 – Propositional Logic: Operators

•• Note that aNote that aconjunctionconjunctionpp11 ∧∧ pp2 2 ∧∧ …… ∧∧ ppnnof of nn propositionspropositionswill have 2will have 2nn rowsrowsin its truth table.in its truth table.

•• Also: Also: ¬¬ and and ∧∧ operations together are sufficient to express operations together are sufficient to express anyany Boolean truth table! (They are functionally complete.)Boolean truth table! (They are functionally complete.)

p q p∧qF F FF T FT F FT T T

Operand columns

Conjunction Truth Table

Page 43: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 43

Topic #1.0 – Propositional Logic: Operators

The Disjunction Operator

•• The binary The binary disjunction operatordisjunction operator ““∨∨”” ((OROR) ) combines two propositions to form their combines two propositions to form their logical logical disjunctiondisjunction..

•• Example 5.Example 5.pp==““Today is Friday.Today is Friday.””q=q=““It is raining today.It is raining today.””pp∨∨qq==““Today is Friday Today is Friday oror iit is raining today.t is raining today.””

Meaning is like “and/or” in English.

Page 44: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 44

Topic #1.0 – Propositional Logic: Operators

•• Note that Note that pp∨∨q q meansmeansthat that pp is true, or is true, or qq isistrue, true, or bothor both are true!are true!

•• So, this operation isSo, this operation isalso called also called inclusive or,inclusive or,because it because it includesincludes thethepossibility that both possibility that both pp and and qq are true.are true.

•• ““¬¬”” and and ““∨∨”” together are also universal.together are also universal.

p q p∨qF F FF T TT F TT T T

Notedifferencefrom AND

Disjunction Truth Table

Page 45: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 45

Topic #1.0 – Propositional Logic: Operators

The Exclusive Or Operator

The binary The binary exclusiveexclusive--or operatoror operator ““⊕⊕”” ((XORXOR) ) combines two propositions to form their combines two propositions to form their logical logical ““exclusive orexclusive or””..

pp = = ““I will earn an A in this course,I will earn an A in this course,””qq == ““I will drop this course,I will drop this course,””pp ⊕⊕ q q = = ““I will either earn an A for this I will either earn an A for this

course, or I will drop it (but not both!)course, or I will drop it (but not both!)””

Page 46: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 46

Topic #1.0 – Propositional Logic: Operators

•• Note that Note that pp⊕⊕q q meansmeansthat that pp is true, or is true, or qq isistrue, but true, but not bothnot both!!

•• This operation isThis operation iscalled called exclusive or,exclusive or,because it because it excludesexcludes thethepossibility that both possibility that both pp and and qq are true.are true.

•• ““¬¬”” and and ““⊕⊕”” together are together are notnot universal.universal.

p q p⊕qF F FF T TT F TT T F Note

differencefrom OR.

Exclusive-Or Truth Table

Page 47: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 47

Topic #1.0 – Propositional Logic: Operators

The Implication Operator

The The implicationimplication p p →→ qq states that states that pp implies implies q.q.I.e.I.e., If , If pp is true, then is true, then qq is true; but if is true; but if pp is not is not

true, then true, then qq could be either true or false.could be either true or false.E.g.E.g., let , let p p = = ““You study hard.You study hard.””

q q = = ““You will get a good grade.You will get a good grade.””p p →→ q = q = ““If you study hard, then you will get If you study hard, then you will get

a good grade.a good grade.”” (else, it could go either way)(else, it could go either way)

hypothesis conclusion

Page 48: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 48

Topic #1.0 – Propositional Logic: Operators

Implication Truth Table

•• p p →→ q q is is falsefalse onlyonly whenwhenpp is true but is true but qq is is notnot true.true.

•• p p →→ q q does does not not saysaythat that pp causescauses qq!!

•• p p →→ q q does does not not requirerequirethat that pp or or qq are ever trueare ever true!!

•• E.g.E.g. ““(1=0) (1=0) →→ pigs can flypigs can fly”” is TRUE!is TRUE!

p q p→qF F T F T T T F F T T T

The onlyFalsecase!

Page 49: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 49

Topic #1.0 – Propositional Logic: Operators

English Phrases Meaning p → q

•• ““pp implies implies qq””•• ““if if pp, then , then qq””•• ““if if pp, , qq””•• ““when when pp, , qq””•• ““whenever whenever pp, , qq””•• ““q q if if pp””•• ““qq when when pp””•• ““qq whenever whenever pp””

•• ““p p only if only if qq””•• ““p p is sufficient for is sufficient for qq””•• ““qq is necessary for is necessary for pp””•• ““qq follows from follows from pp””•• ““q q is implied by is implied by pp””We will see some equivalent We will see some equivalent

logic expressions later.logic expressions later.

Page 50: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 50

Topic #1.0 – Propositional Logic: Operators

Converse, Inverse, Contrapositive

Some terminology, for an implication Some terminology, for an implication p p →→ qq::•• Its Its converseconverse is: is: q q →→ pp..•• Its Its inverseinverse is: is: ¬¬pp →→ ¬¬qq..•• Its Its contrapositivecontrapositive:: ¬¬q q →→ ¬¬ p.p.•• One of these three has the One of these three has the same meaningsame meaning

(same truth table) as (same truth table) as pp →→ qq. Can you figure . Can you figure out which?out which?

Page 51: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 51

Topic #1.0 – Propositional Logic: Operators

The biconditional operator

•• The The biconditionalbiconditional p p ↔ q q states that states that pp is true is true if and if and only ifonly if (IFF) q(IFF) q is true.is true.

•• Example 8. (p. 9)Example 8. (p. 9)p p = = ““You can take the flight.You can take the flight.””qq == ““You buy a ticket.You buy a ticket.””p p ↔ q = q = ““You can take the flight if and only if You can take the flight if and only if you buy a ticket.you buy a ticket.””

Page 52: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 52

Topic #1.0 – Propositional Logic: Operators

Biconditional Truth Table

•• p p ↔ q q means that means that pp and and qqhave the have the samesame truth value.truth value.

•• Note this truth table is theNote this truth table is theexact exact oppositeopposite of of ⊕⊕’’s!s!–– p p ↔ q q means means ¬¬((p p ⊕⊕ qq))

•• p p ↔ q q does does not not implyimplypp and and qq are true, or cause each other.are true, or cause each other.

p q p ↔ qF F TF T FT F FT T T

Page 53: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 53

Topic #1.0 – Propositional Logic: Operators

Nested Propositional Expressions

•• Use parentheses to Use parentheses to group subgroup sub--expressionsexpressions::““I just saw my old I just saw my old ffriendriend, and either , and either hehe’’s s ggrownrown or or II’’ve ve sshrunkhrunk..”” = = ff ∧∧ ((gg ∨∨ ss))–– ((ff ∧∧ gg) ) ∨∨ ss would mean something differentwould mean something different–– ff ∧∧ gg ∨∨ ss would be ambiguouswould be ambiguous

•• By convention, By convention, ““¬”¬” takes takes precedenceprecedence over over both both ““∧∧”” and and ““∨∨””..–– ¬¬s s ∧∧ ff means (means (¬¬ss)) ∧∧ f f , , not not ¬¬ ((s s ∧∧ ff))

Page 54: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 54

Precedence of Logical Operators

Operator PrecedenceOperator Precedence¬¬ 11∧∧ 22∨∨ 33→→ 44↔↔ 55

Page 55: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 55

Topic #1.0 – Propositional Logic: Operators

Boolean Operations Summary

p q ¬p p∧q p∨q p⊕q p→q p↔qF F T F F F T TF T T F T T T FT F F F T T F FT T F T T F T T

•• We have seen 1 unary operator (out of the 4 We have seen 1 unary operator (out of the 4 possible) and 5 binary operators (out of the possible) and 5 binary operators (out of the 16 possible). Their truth tables are below.16 possible). Their truth tables are below.

Page 56: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 56

Topic #1.0 – Propositional Logic: Operators

Some Alternative Notations

Name: not and or xor implies iffPropositional logic: ¬ ∧ ∨ ⊕ → ↔Boolean algebra: p pq + ⊕C/C++/Java (wordwise): ! && || != ==C/C++/Java (bitwise): ~ & | ^Logic gates:

Page 57: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 57

Translating English Sentences

•• Example 9.Example 9.

Page 58: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 58

System Specifications

•• Propositional expressions are Propositional expressions are consistentconsistent if if there is an assignment of truth values to the there is an assignment of truth values to the variables in the expressions that makes all variables in the expressions that makes all the expressions true.the expressions true.

•• Example 12.Example 12.

Page 59: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 59

Logic puzzles

•• Puzzles that can be solved using logical Puzzles that can be solved using logical reasoning are known as reasoning are known as logic puzzles..

•• Example 15.Example 15.

Page 60: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 60

Topic #2 – Bits

Bits and Bit Operations

•• Why propositional logic can be applied in Why propositional logic can be applied in the design of digital circuit?the design of digital circuit?

Page 61: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 61

Topic #2 – Bits

Bits and Bit Operations

•• A A bitbit is a is a bibinary (base 2) dignary (base 2) digitit: 0 or 1.: 0 or 1.•• Bits may be used to represent truth values.Bits may be used to represent truth values.•• By convention: By convention:

0 represents 0 represents ““falsefalse””; 1 represents ; 1 represents ““truetrue””..•• Boolean algebraBoolean algebra is like ordinary algebra is like ordinary algebra

except that variables stand for bits, + means except that variables stand for bits, + means ““oror””, and multiplication means , and multiplication means ““andand””..–– See chapter 10 for more details.See chapter 10 for more details.

Page 62: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 62

Topic #2 – Bits

Bit Strings

•• AA Bit stringBit string is a sequence of zero or more bits. is a sequence of zero or more bits. The The length length of this string is the number of bits in of this string is the number of bits in the string.the string.–– More on sequences in More on sequences in §§3.2.3.2.

•• By convention, bit strings are written left to right: By convention, bit strings are written left to right: e.g.e.g. the first bit of the first bit of ““10011010101001101010”” is 1.is 1.

•• When a bit string represents a baseWhen a bit string represents a base--2 number, by 2 number, by convention the first bit is the convention the first bit is the most significantmost significant bit. bit. Ex. Ex. 1101110122=8+4+1=13.=8+4+1=13.

Page 63: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 63

Topic #2 – Bits

Bitwise Operations

•• Boolean operations can be extended to Boolean operations can be extended to operate on bit strings as well as single bits.operate on bit strings as well as single bits.

•• E.g.:E.g.:01 1011 011001 1011 011011 0001 110111 0001 110111 1011 1111 BitBit--wise ORwise OR01 0001 0100 BitBit--wise ANDwise AND10 1010 1011 BitBit--wise XORwise XOR

Page 64: Discrete Mathematics 싷뒲볆뻇 - AI LABailab.cs.nchu.edu.tw/course/DiscreteMath/95/lecture01.pdf · Overview of Discrete Mathematics • Logic ... 14 3. Course information (1/3)

2006/9/14 64

End of §1.1

You have learned about:You have learned about:•• Propositions: What Propositions: What

they are.they are.•• Propositional logic Propositional logic

operatorsoperators’’–– Symbolic notations.Symbolic notations.–– English equivalents.English equivalents.–– Logical meaning.Logical meaning.–– Truth tables.Truth tables.

•• Atomic vs. compound Atomic vs. compound propositions.propositions.

•• Alternative notations.Alternative notations.•• Bits and bitBits and bit--strings.strings.•• Next section: Next section: §§1.21.2

–– Propositional Propositional equivalences.equivalences.

–– How to prove them.How to prove them.