discrete mathematics structures slide 1

Upload: askari

Post on 28-Feb-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    1/34

    Discrete Mathematics Structures

    23 1391

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    2/34

    :

    16141816

    :

    :

    :

    :

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    3/34

    -

    +

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    4/34

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    5/34

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    6/34

    ) ) (30(%

    )50(%

    )20(%

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    7/34

    Expectations

    This is really a fun course!

    This class contains some of the most beautiful mathyoull ever learn.

    Its even useful, beyond giving you techniques to use

    solving the puzzles in Games Magazine.

    Hints for success Read the textbook.

    Lectures really do help! Do the homework.

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    8/34

    Propositional Logic

    Whats a proposition?

    + !

    +

    Apropositionis a declarative statement thats either TRUE or

    FALSE (but not both).

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    9/34

    Propositional Logic - negation

    Supposepis a proposition.

    The negationofpis written pand has meaning:It is not the case thatp.

    Ex. DM is NOT Bryans favorite class.

    Truth table for negation:

    p p

    T

    F

    F

    TNotice that

    p is aproposition!

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    10/34

    Propositional Logic - conjunction

    Conjunction corresponds to English and.

    p qis true exactly whenpand qare both true.

    Ex. Amy is curious AND clever.

    Truth table for conjunction:

    p q p

    q

    T

    T

    F

    F

    T

    F

    T

    F

    T

    F

    F

    F

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    11/34

    Propositional Logic - disjunction

    Disjunction corresponds to English or.

    p qis whenpor q(or both) are true.

    Ex. Michael is brave OR nuts.

    Truth table for disjunction:

    p q p q

    T

    T

    F

    F

    T

    F

    T

    F

    T

    T

    T

    F

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    12/34

    Propositional Logic - implication

    Implication:p qcorresponds to English ifpthen q, or p

    implies q. If it is raining then it is cloudy. If there are 200 people in the room, then I am the Easter

    Bunny. Ifpthen 2+2=4.

    Truth table for implication:

    p q p q

    T

    T

    F

    F

    T

    F

    T

    F

    T

    F

    T

    T

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    13/34

    Propositional Logic - logical equivalence

    How many different logical connectives could we define?

    To answer, we need the notion oflogical equivalence.

    16

    How many different logical connectives do we need???

    pis logically equivalentto qif their truth tables are the same. We

    writep q.

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    14/34

    Propositional Logic - logical equivalence

    Challenge: Try to find a proposition that is equivalent top q, but that

    uses only the connectives

    ,

    , and

    .

    p q p q

    T

    T

    FF

    T

    F

    TF

    T

    F

    TT

    p q p q p

    T

    T

    FF

    T

    F

    TF

    F

    F

    TT

    T

    F

    TT

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    15/34

    Propositional Logic - proof of 1 famous

    Distributivity: p (q r) (p q) (p r)

    p q r q r p (q r) p q p r (p q) (p r)

    T T T T T T T T

    T T F F T T T T

    T F T F T T T T

    T F F F T T T T

    F T T T T T T T

    F T F F F T F F

    F F T F F F T F

    F F F F F F F F

    All truthassignment

    s forp, q,

    and r.

    I could say

    prove a law of

    distributivity.

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    16/34

    Propositional Logic - special definitions

    Contrapositives: p q and q p

    Ex. If it is noon, then I am hungry.If I am not hungry, then it is not noon.

    Converses: p q and qp

    Ex. If it is noon, then I am hungry.

    If I am hungry, then it is noon.

    Inverses: p q and p q

    Ex. If it is noon, then I am hungry.

    If it is not noon, then I am not hungry.

    One of thesethings is not

    like the others.

    Hint: In oneinstance, the pairof propositions is

    equivalent.

    p q q p

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    17/34

    Propositional Logic - 2 more defn

    A tautologyis a proposition thats always TRUE.

    A contradictionis a proposition thats always FALSE.

    p p p p p p

    T F

    F T

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    18/34

    Propositional Logic - say a bit

    This session were using propositional logic as a foundation for

    formal proofs.

    Propositional logic is also the key to writing good codeyoucant do any kind of conditional (if) statement without

    understanding the condition youre testing.

    All the logical connectives weve discussed are also found inhardware and are called gates.

    Well talk about more applications.

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    19/34

    Propositional Logic - an infamous

    (p q) q p q

    if NOT (blue AND NOT red) OR red then

    (p q) q

    (p q) q

    (p q) q

    p (q q)

    p q

    DeMorgans

    Double negation

    Associativity

    Idempotent

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    20/34

    Propositional Logic - one last proof

    ( )

    ( )

    substitution for

    [p (p q)] q

    [(p p) (p q)] q

    [p (p q)] q

    [ F (p q)] q

    (p q) q

    (p q) q

    (p q) q p (q q )

    p T

    T

    distributive

    uniqueness

    identity

    substitution for

    DeMorgansassociative

    excluded middle

    domination

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    21/34

    Predicate Logic - everybody loves somebody

    Proposition, YES or NO?

    3 + 2 = 5

    X+ 2 = 5

    X+ 2 = 5 for any choice of Xin {1, 2, 3}X+ 2 = 5 for some Xin {1, 2, 3}

    YES

    NO

    YES

    YES

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    22/34

    Predicate Logic - everybody loves somebody

    Alicia eats pizza at least once a week.Garrett eats pizza at least once a week.Allison eats pizza at least once a week.Gregg eats pizza at least once a week.Ryan eats pizza at least once a week.Meera eats pizza at least once a week.

    Ariel eats pizza at least once a week.

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    23/34

    Predicates

    Alicia eats pizza at least once a week.

    Define:EP(x)= xeats pizza at least once a week.Universe of Discourse - x is a student in DM

    Apredicate, or propositional function, is afunction that takes some variable(s) asarguments and returns True or False.

    Note that EP(x)is not a proposition, EP(Ariel)is.

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    24/34

    Predicates

    Suppose Q(x,y)= x> y

    Proposition, YES or NO?

    Q(x,y)Q(3,4)Q(x,9)

    NO

    YES

    NO

    Predicate, YES or NO?

    Q(x,y)

    Q(3,4)

    Q(x,9)

    YES

    NO

    YES

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    25/34

    Predicates - the universal quantifier

    Another way of changing a predicate into a proposition.

    Suppose P(x) is a predicate on some universe of discourse.Ex. B(x) = x is carrying a backpack, x is set of DM students.

    The universal quantifier of P(x) is the proposition:

    P(x) is true for all x in the universe of discourse.

    We write it x P(x), and say for all x, P(x)

    x P(x) is TRUE if P(x) is true for every single x.x P(x) is FALSE if there is an x for which P(x) is false.

    x B(x)?

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    26/34

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    27/34

    Predicates - the existential quantifier

    Another way of changing a predicate into a proposition.

    Suppose P(x) is a predicate on some universe of discourse.Ex. C(x) = x has a candy bar, x is set of DM students.

    The existential quantifier of P(x) is the proposition:

    P(x) is true for some x in the universe of discourse.

    We write it x P(x), and say for some x, P(x)

    x P(x) is TRUE if there is an x for which P(x) is true.x P(x) is FALSE if P(x) is false for every single x.

    x C(x)? -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    28/34

    Predicates - the existential quantifier

    B(x) = x is wearing sneakers.

    L(x) = x is at least 21 years old.Y(x)= x is less than 24 years old.

    Are either of these propositions true?

    a) x B(x)b) x (Y(x) L(x))

    A: only a is true

    B: only b is true

    C: both are true

    D: neither is true

    Universe of discourseis people in this room.

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    29/34

    Predicates - more examples

    Universe of discourseis all creatures.

    L(x) = x is a lion.

    F(x) = x is fierce.C(x) = x drinks coffee.

    All lions are fierce.Some lions dont drink coffee.

    Some fierce creatures dont drink coffee.

    x (L(x) F(x))

    x (L(x) C(x))

    x (F(x) C(x))

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    30/34

    Predicates - more examples

    Universe of discourseis all creatures.

    B(x) = x is a hummingbird.

    L(x) = x is a large bird.H(x) = x lives on honey.R(x) = x is richly colored.

    All hummingbirds are richly colored.

    No large birds live on honey.

    Birds that do not live on honey are dully colored.

    x (B(x) R(x))

    x (L(x) H(x))

    x (H(x) R(x))

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    31/34

    Predicates - quantifier negation

    Not all large birds live on honey.

    x P(x) means P(x) is true for every x.What about x P(x) ?

    Not [P(x) is true for every x.]

    There is an x for which P(x) is not true.x P(x)

    So, x P(x) is the same as x P(x).

    x (L(x) H(x))

    x (L(x) H(x))

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    32/34

    Predicates - quantifier negation

    No large birds live on honey.

    x P(x) means P(x) is true for some x.What about x P(x) ?

    Not [P(x) is true for some x.]

    P(x) is not true for all x.x P(x)

    So, x P(x) is the same as x P(x).

    x (L(x) H(x))

    x (L(x) H(x))

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    33/34

    Predicates - quantifier negation

    So, x P(x) is the same as x P(x).So, x P(x) is the same as x P(x).

    General rule: to negate a quantifier, movenegation to the right, changing quantifiers asyou go.

    -

  • 7/25/2019 Discrete Mathematics Structures Slide 1

    34/34

    Predicates - quantifier negation

    No large birds live on honey.

    x (L(x) H(x)) x (L(x) H(x)) Negationrule

    x (L(x) H(x)) DeMorgans

    x (L(x) H(x)) Subst for

    Whats wrong with thisproof?

    -