1 cmsc 250 discrete structures cmsc 250 lecture 1

44
1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

Upload: christiana-perkins

Post on 13-Jan-2016

253 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

1CMSC 250

Discrete StructuresCMSC 250Lecture 1

Page 2: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

2CMSC 250

Administrative Syllabus Lecture section: MWF 10-11 Lab/discussion section Every week (mostly):

– Worksheet– Quiz – Homework

Class webpage Three midterms, as noted on the syllabus (on the class

webpage) Academic integrity

Page 3: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

3CMSC 250

Motivation

Why learn this material? Some things can be directly applied Some things are good to know Some things just teach a way of thinking and

expressing yourself

Page 4: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

4CMSC 250

Examples

Directly applied- circuits to do addition Conditionals in if statements Things which are good to know- for example that the

square root of 2 can’t be stored Way of thinking- the number of primes is infinite

Page 5: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

5CMSC 250

Overall theme

Proofs of theorems Examples of theorems

Page 6: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

6CMSC 250

Course topics Propositional logic (and circuits) Predicate calculus - quantification Elementary number theory Mathematical induction Sets Counting - combinations and probability Functions Relations Graph theory

Page 7: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

7CMSC 250

Chapter 1, Propositional Logic

Page 8: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

8CMSC 250

Statement/proposition

Declarative (true or false) Symbolized by a letter Examples:

– Today is Monday.– 5 + 2 = 7– 3 * 6 > 18 – The sky is blue.– Why is the sky blue?– Barack Obama.– Two students in the class have a GPA of 3.275.– This sentence is false.– The current king of France is bald.

Page 9: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

9CMSC 250

Other symbols and definitionsfor constructing compound statements

Conjunction"and" is symbolized by

Disjunction"or" is symbolized by

Negation"not" is symbolized by ~ (or sometimes )

Page 10: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

10CMSC 250

Truth table for

p q p q

1 1

1 0

0 1

0 0

1

0

0

0

Page 11: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

11CMSC 250

Truth table for

p q p q

1 1

1 0

0 1

0 0

1

1

1

0

Page 12: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

12CMSC 250

Truth table for

p p

1

0

0

1

Page 13: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

13CMSC 250

Translation of English to symbolic logic statements

The sky is blue.– one simple (atomic) statement- assign a letter or name to it, i.e., b

The sky is blue and the grass is green.– one statement– conjunction of two atomic statements– each single statement gets a letter or name, i.e., b, g– and join with ^ i.e., b ^ g

The sky is blue or the sky is purple.– one statement– disjunction of two atomic statements– each single statement gets a name, i.e., b, p– and join with i.e., b p

Page 14: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

14CMSC 250

Translation #1 The sky is blue or purple.

– two statements• "the sky is blue"- name this b• "the sky is purple"- name this p

– it's still a disjunction• "the sky is blue" or "the sky is purple"• b p

Page 15: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

15CMSC 250

Translation #2

The sky is blue but not dark.– two statements

• "the sky is blue"- name this b• "the sky is dark"- name this d

– conjunction with negation• "the sky is blue" and "the sky is not dark"• the sky is blue and it is not the case that the sky is dark • "it is not the case that the sky is dark" is ~d• b ^ ~ d

Page 16: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

16CMSC 250

Translation #3

2 x 6 English: x is greater than or equal to 2 and less than

or equal to 6 Two statements:

– "x is greater than or equal to 2"- name this p– "x is less than or equal to 6"- name this q

Becomes p ^ q

Page 17: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

17CMSC 250

#3 continued- 2 x 6

p is actually a compound statement– x is greater than 2 or x is equal to 2 r s– "x is greater than 2" is symbolized by r– "x is equal to 2" is symbolized by s

q is actually a compound statement– x is less than 6 or x is equal to 6 m n– "x is less than 6" is symbolized by m– "x is equal to 6" is symbolized by n

p ^ q becomes (r s) ^ (m n)

Page 18: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

18CMSC 250

The exclusive or

The exclusive or of p and q is p or q, but not both It’s indicated using It’s the same as (p q) (p q)

p q p q

1 1

1 0

0 1

0 0

0

1

1

0

Page 19: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

19CMSC 250

Precedence between the operators

~ (not) has highest precedence ^ (and) / (or) have equal precedence use parentheses to override the operators' default

precedence, or when a statement has operators with the same precedence, or just for clarity

a ^ b c

Page 20: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

20CMSC 250

Other "more advanced" truth tables

(p ^ r) (q ^ r)

(p ^ ~r) (p ^ r)

(p ^ q) (~q ~p)

(p ^ ~r) (q ~r)

Page 21: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

21CMSC 250

Discrete StructuresCMSC 250Lecture 2

Page 22: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

22CMSC 250

Special truth tables

p ~p

p ^ ~p

(p ^ ~q) vs. (~q ^ p)

(p ^ q) vs. ~ (~q ~p)

Page 23: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

23CMSC 250

Special results in the truth table

Tautological proposition– a tautology is a statement that can never be false– all of the lines of the truth table have the result "true"

Contradictory proposition– a contradiction is a statement that can never be true– all of the lines of the truth table have the result "false"

Logical equivalence of two propositions– two statements are logically equivalent if they will be true in

exactly the same cases and false in exactly the same cases– all of the lines of one column of the truth table have all of the

same truth values as the corresponding lines from another column of the truth table

– it's indicated using

Page 24: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

24CMSC 250

Logical equivalences Theorem 1.1.1 - page 14

Double negative:~(~p) p

Commutative:

p q q p and p ^ q q ^ p Associative:

(p q) r p (q r) and (p ^ q) ^ r p ^ (q ^ r)

Distributive:p ^ (q r) (p ^ q) (p ^ r) and p (q ^ r) (p q) ^ (p r)

Page 25: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

25CMSC 250

Further logical equivalences

Idempotent:

p ^ p p and p p p

Absorption: p (p ^ q) p and p ^ (p q) p

Identity:

p ^ t p and p c p

Negation:

p ~p t and p ^ ~p c Universal bound:

p ^ c c and p t t

Negations of t and c:~t c and ~c t

Page 26: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

26CMSC 250

DeMorgan's laws

~(p q) ~p ^ ~q– Example in English: It is not the case that Pete or Quincy went

to the store. Pete did not go to the store and Quincy did not go to the store.

~(p ^ q) ~p ~q– Example in English: It is not the case that both Pete and

Quincy went to the store. Pete did not go to the store or Quincy did not go to the store.

Page 27: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

27CMSC 250

Prove by truth table and by rules

~(p ~q) (~q ^ ~p) ~p

~((~p ^ q) (~p ^ ~q)) (p ^ q) p

(p q) ^ ~(p ^ q) (p ^ ~q) (q ^ ~p)

Page 28: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

28CMSC 250

Discrete StructuresCMSC 250Lecture 3

Page 29: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

29CMSC 250

Conditional statements

Hypothesis conclusion If this, then that. The hypothesis implies the conclusion. has lowest precedence (~ / ^ / ) Examples in English:

– If it is raining, I will carry my umbrella.– If you don’t eat your dinner, you will not get dessert.

p q p q

1 1

1 0

0 1

0 0

1

0

1

1

Page 30: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

30CMSC 250

Converting to

p q ~p q

Show with truth table

~(p q) p ^ ~q

Show with truth table and rules

Page 31: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

31CMSC 250

Contrapositive

Given a conditional statement p q, form its contrapositive by:– negating the conclusion and negating the hypothesis

– using the negated conclusion as the new hypothesis and the

negated hypothesis as the conclusion, e.g., ~q ~p p q ~q ~p Examples in English:

– "If Paula is here, then Quincy is here."– The contrapositive is "If Quincy is not here, then Paula is not

here."

Page 32: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

32CMSC 250

Converse and inverse

Given p q, for example, "If Paula is here, then Quincy is here."

To form its converse: – swap the hypothesis and the conclusion– q p– If Quincy is here, then Paula is here.

To form its inverse: – negate the hypothesis and negate the conclusion– ~p ~q– If Paula is not here, then Quincy is not here.

Page 33: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

33CMSC 250

Only if Translation to if-then form

– p only if q– p can be true only if q is true– if q is not true then p can't be true – if not q then not p (~q ~p)– if p then q (p q)

Translation in English– You will graduate is CS only if you pass this course.

• G only if P– If you do not pass this course then you will not graduate in CS.

• ~P ~G– If you graduate in CS then you passed this course.

• G P

Page 34: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

34CMSC 250

Biconditional

p if and only if q p q p iff q

p q p q

1 1

1 0

0 1

0 0

1

0

0

1

Page 35: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

35CMSC 250

Other English words for implication

Sufficient condition– "if r, then s" r s– means r is a sufficient condition for s– the truth of r is sufficient to ensure the truth of s

Necessary condition– "if not x, then not y" ~x ~y– means x is a necessary condition for y– the truth of x is necessary if y is true

Sufficient and necessary condition– p if, and only if q p q– the truth of p is enough to ensure the truth of q and vice versa

Page 36: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

36CMSC 250

Argument A sequence of statements where

– the last in the sequence is the conclusion– all others are premises (assumptions, hypotheses)

(premise1 ^ premise2 ^ …premisen) conclusion The critical rows of the truth table are those where all of

the premises are true– only one premise being false makes the above conjunction false– but a false hypothesis for a conditional can never make the

conditional's result be false

The validity of an argument can be determined from the truth value of the conclusion in the critical rows– it's a valid argument if and only if the conclusion is true in all of

the critical rows– it's an invalid argument if the conclusion is false in any of the

critical rows

Page 37: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

37CMSC 250

Discrete StructuresCMSC 250Lecture 4

Page 38: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

38CMSC 250

Rules of Inference (Table 1.3.1- Page 39)

Modus Ponens p q

p

q

Modus Tollens p q

~q

~p

Elimination

p q p q~q ~p

p q

Generalization

p q

p q p q

Specialization

p ^ q p ^ q

p q

Contradiction rule ~p c

p

Transitivity p q

q r

p r

Conjunction

p

q

p ^ q

Proof by division into cases

p qp r

q r

r

Page 39: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

39CMSC 250

Proofs using rules of inference

P1 p q

P2 ~(q r)P3 p (m r)

~m

P1 p ^ q

P2 p s

P3 ~r ~q

s ^ r

P1 p qP2 q r

P3 ~p

r

Page 40: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

40CMSC 250

Conditional worlds

Making assumptions are only allowed if you go into a "conditional world"

Two types of results can be derived when an assumption is made: an implication and a negation

list of statements that are true in all worldsassume anything

a list of statements which are true in the situations where the assumption is true

conclusion: the assumption anything from the conditional world

We'll call this "conditional world without contradiction"

Page 41: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

41CMSC 250

Conditional world assumption leads to contradiction

If you make an assumption, and that assumption leads to a contradiction in the conditional world, what can be concluded?

list of statements that are true in all worlds assume anything

a list of statements which are true in the situations where the assumption is true

a contradiction with something else known to be true

conclusion: the assumption must be false in all possible worlds

We'll call this "conditional world with contradiction"

Page 42: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

42CMSC 250

Prove using the conditional world methods

P1 (p q) s

P2 r p

r s

P1 m s

P2 s (q ^ r)

P3 q ~r

~(m ^ p)

Page 43: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

43CMSC 250

Discrete StructuresCMSC 250Lecture 5

Page 44: 1 CMSC 250 Discrete Structures CMSC 250 Lecture 1

44CMSC 250

Use both conditional world methods

P1 ~ m pP2 p (q s)

P3 ~(s ~x)

P4 q ~r

~(m ^ r)