discrete mathematics ch1

Upload: mohammad-gulam-ahamad

Post on 04-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 Discrete Mathematics ch1

    1/48

    Discrete Mathematics

    5th edition, 2001

    Chapter 1

    Logic and proofs

    2/9/2013 Prof. Mohammed Gulam Ahamad 1

  • 7/29/2019 Discrete Mathematics ch1

    2/48

    Logic

    Logic = the study of correct reasoning

    Use of logic In mathematics:

    to prove theorems

    In computer science:

    to prove that programs do what they are

    supposed to do

    2/9/2013 Prof. Mohammed Gulam Ahamad 2

  • 7/29/2019 Discrete Mathematics ch1

    3/48

    Section 1.1 Propositions

    A propositionis a statement or sentence

    that can be determined to be either true orfalse.

    Examples:

    John is a programmer" is a proposition I wish I were wise is not a proposition

    2/9/2013 Prof. Mohammed Gulam Ahamad 3

  • 7/29/2019 Discrete Mathematics ch1

    4/48

    Connectives

    If p and q are propositions, new compound

    propositions can be formed by using

    connectives

    Most common connectives: Conjunction AND. Symbol ^

    Inclusive disjunction OR Symbol v

    Exclusive disjunction OR Symbol v

    Negation Symbol ~

    Implication Symbol

    Double implication Symbol

    2/9/2013 Prof. Mohammed Gulam Ahamad 4

  • 7/29/2019 Discrete Mathematics ch1

    5/48

    Truth table of conjunction

    The truth values of compound propositionscan be described by truth tables.

    Truth table ofconjunction

    p ^ q is true only when both p and q are true.

    p q p ^ q

    T T T

    T F F

    F T F

    F F F

    2/9/2013 Prof. Mohammed Gulam Ahamad 5

  • 7/29/2019 Discrete Mathematics ch1

    6/48

    Example

    Let p = Tigers are wild animals

    Let q = Chicago is the capital of Illinois p ^ q = "Tigers are wild animals and

    Chicago is the capital of Illinois"

    p ^ q is false. Why?

    2/9/2013 Prof. Mohammed Gulam Ahamad 6

  • 7/29/2019 Discrete Mathematics ch1

    7/48

    Truth table of disjunction

    The truth table of (inclusive) disjunctionis

    p q is false only when both p and q are false Example: p = "John is a programmer", q = "Mary is a lawyer"

    p v q = "John is a programmer or Mary is a lawyer"

    p q p v q

    T T T

    T F T

    F T T

    F F F

    2/9/2013 Prof. Mohammed Gulam Ahamad 7

  • 7/29/2019 Discrete Mathematics ch1

    8/48

    Exclusive disjunction

    Either p or q (but not both), in symbols p q

    p q is true only when p is true and q is false,or p is false and q is true. Example: p = "John is programmer, q = "Mary is a lawyer"

    p v q = "Either John is a programmer or Mary is a lawyer"

    p q p v q

    T T F

    T F T

    F T T

    F F F

    2/9/2013 Prof. Mohammed Gulam Ahamad 8

  • 7/29/2019 Discrete Mathematics ch1

    9/48

    Negation

    Negation of p: in symbols ~p

    ~p is false when p is true, ~p is true when p isfalse Example: p = "John is a programmer"

    ~p = "It is not true that John is a programmer"

    p ~p

    T F

    F T

    2/9/2013 Prof. Mohammed Gulam Ahamad 9

  • 7/29/2019 Discrete Mathematics ch1

    10/48

    More compound statements

    Let p, q, r be simple statements

    We can form other compound statements,

    such as (pq)^r

    p(q^r)

    (~p)

    (~q) (pq)^(~r)

    and many others

    2/9/2013 Prof. Mohammed Gulam Ahamad 10

  • 7/29/2019 Discrete Mathematics ch1

    11/48

    Example: truth table of (pq)^r

    p q r (p q) ^ r

    T T T T

    T T F F

    T F T T

    T F F F

    F T T T

    F T F FF F T F

    F F F F

    2/9/2013 Prof. Mohammed Gulam Ahamad 11

  • 7/29/2019 Discrete Mathematics ch1

    12/48

    1.2 Conditional propositions

    and logical equivalence

    A conditionalproposition is of the form

    If p then q In symbols: p q

    Example: p = " John is a programmer"

    q = " Mary is a lawyer "

    p q = If John is a programmer then Mary isa lawyer"

    2/9/2013 Prof. Mohammed Gulam Ahamad 12

  • 7/29/2019 Discrete Mathematics ch1

    13/48

    Truth table of p q

    p q is true when both p and q are true

    or when p is false

    p q p q

    T T T

    T F F

    F T T

    F F T

    2/9/2013 Prof. Mohammed Gulam Ahamad 13

  • 7/29/2019 Discrete Mathematics ch1

    14/48

    Hypothesis and conclusion

    In a conditional proposition p

    q,p is called the antecedentorhypothesis

    q is called the consequentorconclusion

    If "p then q" is considered logically the

    same as "p only if q"

    2/9/2013 Prof. Mohammed Gulam Ahamad 14

  • 7/29/2019 Discrete Mathematics ch1

    15/48

    Necessary and sufficient

    A necessarycondition is expressed by the

    conclusion.

    A sufficientcondition is expressed by the

    hypothesis.

    Example:

    IfJohn is a programmerthenMary is a lawyer"

    Necessary condition: Mary is a lawyer Sufficient condition: John is a programmer

    2/9/2013 Prof. Mohammed Gulam Ahamad 15

  • 7/29/2019 Discrete Mathematics ch1

    16/48

    Logical equivalence

    Two propositions are said to be logically

    equivalentif their truth tables are identical.

    Example: ~p q is logically equivalentto p q

    p q ~p q p q

    T T T T

    T F F F

    F T T TF F T T

    2/9/2013 Prof. Mohammed Gulam Ahamad 16

  • 7/29/2019 Discrete Mathematics ch1

    17/48

    Converse

    The converseof p q is q p

    These two propositions

    are not logically equivalent

    p q p q q p

    T T T T

    T F F T

    F T T F

    F F T T

    2/9/2013 Prof. Mohammed Gulam Ahamad 17

  • 7/29/2019 Discrete Mathematics ch1

    18/48

    Contrapositive

    The contrapositiveof the proposition p q is

    ~q ~p.

    They are logically equivalent.

    p q p q ~q ~p

    T T T T

    T F F F

    F T T T

    F F T T

    2/9/2013 Prof. Mohammed Gulam Ahamad 18

  • 7/29/2019 Discrete Mathematics ch1

    19/48

    Double implication

    The double implicationp if and only if q isdefined in symbols as p q

    p q is logically equivalent to (p q)^(q p)

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

    T T T T

    T F F F

    F T F F

    F F T T

    2/9/2013 Prof. Mohammed Gulam Ahamad 19

  • 7/29/2019 Discrete Mathematics ch1

    20/48

    Tautology

    A proposition is a tautologyif its truth table

    contains only true values for every case

    Example: p p v q

    p q p p v q

    T T T

    T F T

    F T T

    F F T

    2/9/2013 Prof. Mohammed Gulam Ahamad 20

  • 7/29/2019 Discrete Mathematics ch1

    21/48

    Contradiction

    A proposition is a tautologyif its truth table

    contains only false values for every case

    Example: p ^ ~p

    p p ^ (~p)

    T F

    F F

    2/9/2013 Prof. Mohammed Gulam Ahamad 21

  • 7/29/2019 Discrete Mathematics ch1

    22/48

    De Morgans laws for logic

    The following pairs of propositions are

    logically equivalent:

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

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

    2/9/2013 Prof. Mohammed Gulam Ahamad 22

  • 7/29/2019 Discrete Mathematics ch1

    23/48

    1.3 Quantifiers

    A propositional functionP(x) is a statement

    involving a variable x

    For example: P(x): 2x is an even integer

    x is an element of a set D

    For example, x is an element of the set of integers

    D is called the domainof P(x)

    2/9/2013 Prof. Mohammed Gulam Ahamad 23

  • 7/29/2019 Discrete Mathematics ch1

    24/48

    Domain of a propositional function

    In the propositional function

    P(x): 2x is an even integer,the domain D of P(x) must be defined, for

    instance D = {integers}.

    D is the set where the x's come from.

    2/9/2013 Prof. Mohammed Gulam Ahamad 24

  • 7/29/2019 Discrete Mathematics ch1

    25/48

    For everyand for some

    Most statements in mathematics and

    computer science use terms such as for

    everyand for some.

    For example:

    For everytriangle T, the sum of the angles of T

    is 180 degrees.

    For everyinteger n, n is less than p, for someprime number p.

    2/9/2013 Prof. Mohammed Gulam Ahamad 25

  • 7/29/2019 Discrete Mathematics ch1

    26/48

    Universal quantifier

    One can write P(x) for everyx in a domain D

    In symbols: x P(x)

    is called the universal quantifier

    2/9/2013 Prof. Mohammed Gulam Ahamad 26

  • 7/29/2019 Discrete Mathematics ch1

    27/48

    Truth of as propositional function

    The statement x P(x) is

    True if P(x) is true for every x D

    False if P(x) is not true for some x

    D Example: Let P(n) be the propositional

    function n2 + 2n is an odd integer

    n D = {all integers}

    P(n) is true only when n is an odd integer,

    false if n is an even integer.

    2/9/2013 Prof. Mohammed Gulam Ahamad 27

  • 7/29/2019 Discrete Mathematics ch1

    28/48

    Existential quantifier

    For somex D, P(x) is true ifthere exists

    an element x in the domain D for which P(x) is

    true. In symbols: x, P(x)

    The symbol is called the existential

    quantifier.

    2/9/2013 Prof. Mohammed Gulam Ahamad 28

  • 7/29/2019 Discrete Mathematics ch1

    29/48

    Counterexample

    The universal statement x P(x) is false ifx D such that P(x) is false.

    The value x that makes P(x) false is called acounterexampleto the statement x P(x). Example: P(x) = "every x is a prime number", for

    every integer x.

    But if x = 4 (an integer) this x is not a primernumber. Then 4 is a counterexample to P(x)being true.

    2/9/2013 Prof. Mohammed Gulam Ahamad 29

  • 7/29/2019 Discrete Mathematics ch1

    30/48

    Generalized De Morgans

    laws for Logic If P(x) is a propositional function, then each

    pair of propositions in a) and b) below have

    the same truth values:a) ~(x P(x)) and x: ~P(x)

    "It is not true that for every x, P(x) holds" is equivalentto "There exists an x for which P(x) is not true"

    b) ~(x P(x)) and x: ~P(x)"It is not true that there exists an x for which P(x) istrue" is equivalent to "For all x, P(x) is not true"

    2/9/2013 Prof. Mohammed Gulam Ahamad 30

  • 7/29/2019 Discrete Mathematics ch1

    31/48

    Summary of propositional logic

    In order to prove the

    universally quantified

    statement x P(x) is

    true It is not enough to

    show P(x) true for

    some x D

    You must show P(x) istrue for every x D

    In order to prove the

    universally quantified

    statement x P(x) is

    false It is enough to exhibit

    some x D for which

    P(x) is false

    This x is called thecounterexample to

    the statement x P(x)

    is true

    2/9/2013 Prof. Mohammed Gulam Ahamad 31

  • 7/29/2019 Discrete Mathematics ch1

    32/48

    1.4 Proofs

    A mathematical systemconsists of

    Undefined terms Definitions

    Axioms

    2/9/2013 Prof. Mohammed Gulam Ahamad 32

  • 7/29/2019 Discrete Mathematics ch1

    33/48

    Undefined terms

    Undefined termsare the basic building blocks of

    a mathematical system. These are words that

    are accepted as starting concepts of amathematical system.

    Example: in Euclidean geometry we have undefined

    terms such as

    Point

    Line

    2/9/2013 Prof. Mohammed Gulam Ahamad 33

  • 7/29/2019 Discrete Mathematics ch1

    34/48

    Definitions

    A definitionis a proposition constructed from

    undefined terms and previously accepted

    concepts in order to create a new concept.

    Example. In Euclidean geometry the followingare definitions:

    Two triangles are congruentif their vertices can

    be paired so that the corresponding sides are

    equal and so are the corresponding angles. Two angles are supplementaryif the sum of their

    measures is 180 degrees.

    2/9/2013 Prof. Mohammed Gulam Ahamad 34

  • 7/29/2019 Discrete Mathematics ch1

    35/48

    Axioms

    An axiomis a proposition accepted as true

    without proof within the mathematical system.

    There are many examples of axioms in

    mathematics:

    Example: In Euclidean geometry the following are

    axioms

    Given two distinct points, there is exactly one line that

    contains them.

    Given a line and a point not on the line, there is exactly one

    line through the point which is parallel to the line.

    2/9/2013 Prof. Mohammed Gulam Ahamad 35

  • 7/29/2019 Discrete Mathematics ch1

    36/48

    Theorems

    A theoremis a proposition of the form p q

    which must be shown to be true by asequence of logical steps that assume that p

    is true, and use definitions, axioms and

    previously proven theorems.

    2/9/2013 Prof. Mohammed Gulam Ahamad 36

  • 7/29/2019 Discrete Mathematics ch1

    37/48

    Lemmas and corollaries

    A lemmais a small theorem which is

    used to prove a bigger theorem.

    A corollaryis a theorem that can be

    proven to be a logical consequence of

    another theorem.

    Example from Euclidean geometry: "If the

    three sides of a triangle have equal length,

    then its angles also have equal measure."

    2/9/2013 Prof. Mohammed Gulam Ahamad 37

  • 7/29/2019 Discrete Mathematics ch1

    38/48

    Types of proof

    A proofis a logical argument that consists of a

    series of steps using propositions in such a

    way that the truth of the theorem isestablished.

    Directproof: p q

    A direct method of attack that assumes the truth of

    proposition p, axioms and proven theorems so that

    the truth of proposition q is obtained.

    2/9/2013 Prof. Mohammed Gulam Ahamad 38

  • 7/29/2019 Discrete Mathematics ch1

    39/48

    Indirect proof

    The method of proofby contradictionof atheorem p q consists of the followingsteps:

    1. Assume p is true and q is false

    2. Show that ~p is also true.

    3. Then we have that p ^ (~p) is true.

    4. But this is impossible, since the statement p ^ (~p) isalways false. There is a contradiction!

    5. So, q cannot be false and therefore it is true.

    OR: show that the contrapositive(~q)(~p)is true. Since (~q) (~p) is logically equivalent to p q, then the

    theorem is proved.2/9/2013 Prof. Mohammed Gulam Ahamad 39

  • 7/29/2019 Discrete Mathematics ch1

    40/48

    Valid arguments

    Deductive reasoning: the process of reaching a

    conclusion q from a sequence of propositions p1,

    p2, , pn. The propositions p1, p2, , pn are called

    premisesorhypothesis.

    The proposition q that is logically obtainedthrough the process is called the conclusion.

    2/9/2013 Prof. Mohammed Gulam Ahamad 40

  • 7/29/2019 Discrete Mathematics ch1

    41/48

    Rules of inference (1)

    1. Law ofdetachmentor

    modus ponens p q

    p

    Therefore, q

    2. Modus tollens

    p q ~q

    Therefore, ~p

    2/9/2013 Prof. Mohammed Gulam Ahamad 41

  • 7/29/2019 Discrete Mathematics ch1

    42/48

    Rules of inference (2)

    3. Rule ofAddition

    p

    Therefore, p q

    4. Rule ofsimplification

    p ^ q

    Therefore, p

    5. Rule ofconjunction

    p

    q

    Therefore, p ^ q

    2/9/2013 Prof. Mohammed Gulam Ahamad 42

  • 7/29/2019 Discrete Mathematics ch1

    43/48

    Rules of inference (3)

    6. Rule ofhypothetical syllogism

    p q

    q r

    Therefore, p r

    7. Rule ofdisjunctive syllogism

    p q

    ~p

    Therefore, q

    2/9/2013 Prof. Mohammed Gulam Ahamad 43

  • 7/29/2019 Discrete Mathematics ch1

    44/48

    Rules of inference for

    quantified statements

    1. Universal instantiation

    xD, P(x) d D

    Therefore P(d)

    2. Universal generalization

    P(d) for any d D

    Therefore x, P(x)

    3. Existential instantiation

    x D, P(x) Therefore P(d) for some

    d D

    4. Existential generalization

    P(d) for some d D Therefore x, P(x)

    2/9/2013 Prof. Mohammed Gulam Ahamad 44

  • 7/29/2019 Discrete Mathematics ch1

    45/48

    1.5 Resolution proofs

    Due to J. A. Robinson (1965)

    A clauseis a compound statement with terms separated

    by or, and each term is a single variable or the

    negation of a single variable

    Example: p q (~r) is a clause

    (p ^ q) r (~s) is not a clause

    Hypothesis and conclusion are written as clauses

    Only one rule:

    p q

    ~p r

    Therefore, q r

    2/9/2013 Prof. Mohammed Gulam Ahamad 45

  • 7/29/2019 Discrete Mathematics ch1

    46/48

    1.6 Mathematical induction

    Useful for proving statements of the form

    n A S(n)

    where N is the set of positive integers or naturalnumbers,

    A is an infinite subset of N

    S(n) is a propositional function

    2/9/2013 Prof. Mohammed Gulam Ahamad 46

  • 7/29/2019 Discrete Mathematics ch1

    47/48

    Mathematical Induction:

    strong form Suppose we want to show that for each positive

    integer n the statement S(n) is either true or

    false. 1. Verify that S(1) is true.

    2. Let n be an arbitrary positive integer. Let i be a

    positive integer such that i < n.

    3. Show that S(i) true implies that S(i+1) is true, i.e.

    show S(i) S(i+1).

    4. Then conclude that S(n) is true for all positive

    integers n.2/9/2013 Prof. Mohammed Gulam Ahamad 47

  • 7/29/2019 Discrete Mathematics ch1

    48/48

    Mathematical induction:

    terminology

    Basis step: Verify that S(1) is true.

    Inductive step: Assume S(i) is true.

    Prove S(i) S(i+1).

    Conclusion: Therefore S(n) is true for all

    positive integers n.

    2/9/2013 Prof. Mohammed Gulam Ahamad 48