discrete structure chapter 2.0 logic 88

Upload: rockers91

Post on 02-Jun-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    1/89

    1

    Chapter 2: The Fundamentals of Logic

    Logic is commonly known as the science ofreasoning.

    Logic as a working tool in proving theoremsor solving problems, creativity and insight

    are needed, which cannot be taught. Reason to study logic:

    Hardware level the design of logic

    circuits to implement instruction Software level a knowledge of logic ishelpful in the design of programs.

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    2/89

    2

    Chapter 2:Fundamentals of Logic-Outline

    2.1: Logical Form2.2: Truth Tables

    2.3: The Law of Logic2.4: Valid and Invalid Arguments2.5: Rule of Inference

    2.6: Quantified Statements

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    3/89

    3

    2.1: Logical Form

    Basic connectives:Primitive statements(propositions): declarative

    sentences that are either True or False ; but not both.

    Eg: Susanna wrote Discrete Mathematics book.Eg: 2 + 3 = 5Not statements:

    Eg: What a beautiful morning!Eg: Get up and do your exercises.

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    4/89

    4

    2.1: Logical Form

    use lowercase letters, such as p, q, r,. torepresent propositions.

    Eg: p : It is raining

    The truth value of a proposition is true, denoted by

    T or 1 whereas the truth value of a proposition isfalse, denoted by F or 0.

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    5/89

    5

    2.1: Logical Form

    2 + 3 = 7 X + 1 = 5

    3 + 1 Go away! SSK3003 is course code for Discrete Structures

    I wear a red shirt 2 + 2 = 4

    Proposition with truth value (F)

    Not a proposition

    Not a proposition

    Not a proposition

    Proposition with truth value (T)

    Proposition with truth value (F)

    Proposition with truth value (T)

    Exercise:

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    6/89

    6

    2.1: Logical Form

    Proposition represented by p, q, r. areconsidered as primitive proposition no way to

    break to anything simpler.

    Two ways to obtain new proposition:-1.Transform proposition p that is given to p,which denotes its negation and is read NOT

    p.

    2.Combine two or more propositions intocompound proposition using logicalconnectives.

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    7/89

    7

    2.1: Logical Form

    Compound statements: combined primitivestatements by logical connectives or bynegation.

    Logical connectives:a) conjunction(AND): p qb) Disjunction(inclusive OR): p q

    c) Exclusive OR:d) Implication: p q (if p then q)e) Biconditional: p q (p if only if q , or p iff q)

    Logical connectives:

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    8/89

    8

    2.1: Logical Form

    Let p and q be propositions. The conjunction of pand q is denoted by p ^ q, which is read p and q

    True only both p and q are true and false otherwise.Eg: x : I am a many : I have five children

    I am a man and I have five children

    conjunction(AND): p q

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    9/89

    9

    2.1: Logical Form

    Disjunction(inclusive OR): p q

    Disjunction of p and q, is denoted by p v q whichis read p or q.

    or is used in inclusive way The proposition is

    false only when both p and q are false, otherwise itis true. Sometimes write and/or to point this out. The exclusive or is denoted by p v q.

    The compound proposition is true only p or q istrue but not both are true or false.

    p : I am a girlq : I am a boy

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    10/89

    10

    2.1: Logical Form

    We say p implies q p q Alternatively

    If p, then q p is sufficient for q p is a sufficient condition for q

    q is necessary for p q is necessary condition for p p only if q

    Implication: p q (if p then q)

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    11/89

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    12/89

    12

    2.1: Logical Form

    Is denoted by p q or p iff q : which is read if and only if p q (p q) ^ ( q p) Example:

    y : I go to school everyday.q : I score A

    y q I go to school everyday if and only if I score A

    Biconditional: p q (p if only if q , or p iff q)

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    13/89

    13

    2.1: Logical FormEg 1: Negation

    p: Combinatorics is a required course for sophomores. p: Combinatorics is not a required course for sophomores.

    Eg 2: conjunction(AND)

    p: Combinatorics is a required course for sophomores.q: Susanna wrote Discrete Mathematics book.

    p q: Combinatorics is a required course for sophomores and Susanna wrote Discrete Mathematics book.

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    14/89

    14

    2.1: Logical FormEg 3: Disjunction(inclusive OR)

    p: Combinatorics is a required course for sophomores.

    q: Susanna wrote Discrete Mathematics book.

    p q: Combinatorics is a required course for sophomores orSusanna wrote Discrete Mathematics book.

    Eg 4:Implication(if p then q) p: Combinatorics is a required course for sophomores.q: Susanna wrote Discrete Mathematics book.p q: If Combinatorics is a required course for sophomores

    then Susanna wrote Discrete Mathematics book.Note: p is the hypothesis of the implication.Note: q is the conclusion.

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    15/89

    15

    2.1: Logical Form

    Eg 3: Biconditional (p if only if q , or p iff q) p:Combinatorics is a required course for sophomores.q: Susanna wrote Discrete Mathematics book.

    p q: Combinatorics is a required course forsophomores if and only if Susanna wroteDiscrete Mathematics book.

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    16/89

    16

    2.1: Logical Form

    The number x is an integer

    Is not a statement because its truth value cannot bedetermined until a numerical value is assignedfor x.

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    17/89

    17

    2.1: Logical Form

    Ex 1:

    s: David goes out for a walk.t: The moon is out.u: It is snowing.

    (t u) s :

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    18/89

    18

    2.1: Logical Form

    Ex 2:

    s: David goes out for a walk.t: The moon is out.u: It is snowing.

    (u t) s :

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    19/89

    19

    2.1: Logical Form

    Ex 3:

    s: David goes out for a walk.t: The moon is out.u: It is snowing.

    t ( u s) :

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    20/89

    20

    2.1: Logical Form

    Ex 4:

    s: David goes out for a walk.t: The moon is out.u: It is snowing.

    (s (u t)) :

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    21/89

    21

    2.1: Logical Form

    Translating English Sentences to logicalexpression:

    Why?Reasons:a. English (and every other human language) is often

    ambiguous. Translating removes the ambiguity. b. Easy to analyze logical expressions to determine their truth

    values, easy to manipulate.

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    22/89

    22

    2.1: Logical Form

    Ex 5: Translating from English to logicalexpression

    Write each of the following sentences symbolically:a. It is not hot but it is sunny.

    b. It is neither hot nor sunny.Answer:Let h: It is hot.

    s: It is sunny.a. h s

    b. h s

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    23/89

    23

    2.1: Logical Form

    Ex 6: Searching on the InternetInternet search engines allow you to use some form ofand , or , not to refine the search process.

    If you want to find web pages about careers in mathematics orcomputer science but not finance or marketing, how youwant to quote your search?

    Ans: Careers AND (mathematics OR computer science) AND NOT (finance OR marketing)

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    24/89

    24

    2.1: Logical Form

    Ex 7: And, or and InequalitiesSuppose x is a particular real number. Let p, q and r

    symbolize as 0 < x , x < 3 and x = 3respectively.

    Write the following inequalities symbolically:

    a. x < 3b. 0 < x < 3

    c. 0 < x < 3

    Ans:

    a. q r b. p q c. p (q r)

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    25/89

    25

    2.1: Logical Form

    Ex 8: Translate English sentence into a logical

    expressionYou can access the Internet from campus only if you are a

    computer science major or you are not a freshman. Ans:Let a: You can access the Internet from campus.

    c: You are a computer science major.f: You are a freshman

    a (c f)

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    26/89

    26

    2.1: Logical Form

    Ex 9: Translate English sentence into a logical

    expressionYou cannot ride the roller coaster if you are under 4 feet tall

    unless you are older than 16 years old. Ans:Let r: You cannot ride the roller coaster.

    s: You are under 4 feet tall.q: You are older than 16 years old.

    (r s) q

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    27/89

    27

    2.1: Logical Form

    Converse, contrapositive and inverse:

    p q

    The converse of p q is q p

    The contrapositive of p q is q p

    The inverse of p q is p q

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    28/89

    28

    2.1: Logical Form

    Eg: Converse, contrapositive and inverse:

    What are the contrapositive, the converse and the inverse ofthe implication

    The home team wins whenever it is raining. ? Contrapositive:

    If the home team does not win, then it is not raining. Converse: If the home team wins, then it is raining. Inverse: If it is not raining, then the home team does not win.

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    29/89

    29

    2.1: Logical Form

    Precedence of Logical operator:

    Operator Precedence

    1

    23

    4

    5

    h bl

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    30/89

    30

    2.2: Truth Tables

    p q p q p q p q p q p q

    0 0 0 0 0 1 1

    0 1 0 1 1 1 0

    1 0 0 1 1 0 0

    1 1 1 1 0 1 1

    A truth table displays the relationship between the

    truth values of propositions

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    31/89

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    32/89

    32

    2.2: Truth Tables

    Def: A compound statement is called atautology (T 0) if it is true for all truth valueassignments for its component statements.

    If a compound statement is false for all such

    assignments, then it is called acontradiction(F 0).

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    33/89

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    34/89

    34

    A compound statement is called a tautology if it is true for all truth value assignmentsfor its component statements.

    If all false --- contradiction .

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

    0 0 0 1 1 0 0

    0 1 1 1 1 1 0

    1 0 1 1 0 0 0

    1 1 1 1 0 0 0

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    35/89

    35

    2.2: Truth Tables

    Logical Equivalence:Def: Two statements forms are called logically equivalent if,

    and only if, they have identical truth values for each possible substitution of statements for their statementvariables.

    P logically equivalent to Q is denoted by P = Q .

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    36/89

    36

    2.2: Truth Tables

    Logical Equivalence:

    Eg 1: Show that the propositions p q and p q arelogically equivalent.

    p q p p q p q

    TTF

    F

    TFT

    F

    FFT

    T

    TFT

    T

    TFT

    T

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    37/89

    37

    2.2: Truth Tables

    Logical Equivalence:

    Eg 2: Show that the propositions p (q r) and (p q) (p r) arelogically equivalent.

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

    00

    00

    01

    0 0 0 0 0

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    38/89

    38

    Exercise

    1. Verify that [p (q r)] [(p q) (p r)] is atautology.

    2. Show that (p ( p q)) and p q are logically

    equivalent.

    3. Show that (p q) ( p q) is a tautology.

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    39/89

    39

    2.3: Law of Logic

    Two propositions p 1 and p 2 are said to be logicallyequivalent and we write p 1 p2 when the

    proposition p 1 is true if and only if the p 2 is true.

    Logical Equivalence:

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    40/89

    2 3 L f L i

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    41/89

    41

    2.3: Law of Logic

    De Morgan's Laws:

    ( )

    ( ) p q p q

    p q p q

    Note: p and q can be any compound statements.

    Augustus De Morgan

    1806-1871

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    42/89

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    43/89

    2 3 L f L i

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    44/89

    44

    2.3: Law of Logic

    Exercise:

    Negate and simplify the compound statement ( ) p q r

    [( ) ] [ ( ) ]

    [( ) ] ( )

    ( )

    p q r p q r

    p q r p q r

    p q r

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    45/89

    45

    2.3: Law of Logic

    0011

    1101

    1101

    1011

    1011

    0101

    contrapositive of p q

    converseinverse

    p q p q q p q p p q

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    46/89

    46

    2.3: Law of Logic

    Ex: simplification of compound statement

    p F pqq p

    q pq p

    q pq p

    q pq p

    0

    )(

    )()(

    )()(

    )()(

    Demorgan's Law

    Law of Double Negation

    Distributive Law

    Inverse Law andIdentity Law

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    47/89

    47

    Ex: Show that (p ( p q)) = ( p q) are logicallyequivalent.

    2.3: Law of Logic

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    48/89

    48

    Ex: Show that ( p q) ( p q) is a tautology.

    2.3: Law of Logic

    2 3 L f L i

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    49/89

    49

    2.3: Law of Logic

    Ex: statements : p: Roger studies. q: Roger plays tennis.

    r : Roger passes discrete mathematics.premises : p1: If Roger studies, then he will pass discrete math.

    p2: If Roger doesn't play tennis, then he'll study. p3: Roger failed discrete mathematics.

    Determine whether the argument below is valid

    p p r p q p p r

    p p p q

    p r q p r q

    1 2 3

    1 2 3

    : , : , :

    ( )

    [( ) ( ) ]

    which is a tautology,the original argumentis true

    ( ) p p p q1 2 3

    2 3 L f L gi

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    50/89

    50

    2.3: Law of Logic

    Def. : If p, q are any arbitrary statements such thatis a tautology, then we say that p logically implies q and we

    p q to denote this situation.write

    p q means p q is a tautology.

    p q means p q is a tautology.

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    51/89

    51

    2.4: Valid & Invalid Arguments

    An argument a sequence of statements and are called premises.

    Testing an argument for validity:

    1. Identify the premises and conclusion of the argument form.2. Construct a truth table showing the truth values of all the premises

    and the conclusion.

    3. Identify the critical rows:

    If all the premises are true and the conclusion is false . Therefore,the argument is invalid .

    If all the premises are true and the conclusion is true . Therefore,the argument is valid .

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    52/89

    52

    2.4: Valid & Invalid Arguments

    An Invalid Argument Form:

    Eg: Show that the following argument form is invalid.

    p q r

    q p r

    p r

    2 4: Valid & Invalid Arguments

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    53/89

    53

    2.4: Valid & Invalid Arguments

    p q r r q r p r p q r

    q p r p r

    T T T

    T T FT F TT F FF T T

    F T FF F TF F F

    F

    TFTF

    TFT

    T

    TFTT

    TFT

    T

    FTFF

    FFF

    T

    TFTT

    TTT

    T

    FTTF

    FTT

    T

    FTFT

    TTT

    premisesconclusion

    From the table, we conclude that this argument form(p q r) ( q p r) ( p r) is invalid .

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    54/89

    54

    Alternatively, from the table below, we conclude that this(p q r) ( q p r) ( p r) is NOT a tautology and

    therefore the argument form is invalid

    p q r pq r

    qp

    r

    (p q r) ( q

    p r)

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

    T T TT T FT F TT F FF T TF T FF F TF F F

    TTFTTTTT

    TFTTFFTT

    TFFTFFTT

    TFTFTTTT

    TTTFTTTT

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    55/89

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    56/89

    2 5: Rule of Inference

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    57/89

    57

    2.5: Rule of Inference

    M odus Ponens :

    Syllogism An argument form consisting of two premises and a conclusion.The first and second premises are called the major and minor premises,respectively.

    M odus Ponens The most famous form of syllogism in logic.

    -(the method of affirming) or the Rule of Detachment

    rule of inference - use to validate or invalidate a logical implication withoutresorting to truth table (which will be prohibitively large if the number ofvariables are large).- a form of argument that is valid.- Modus Ponens & modus Tollens are both rule of inference.

    [ ( )] p p q q p p q

    q

    2 5: Rule of Inference

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    58/89

    58

    2.5: Rule of Inference

    [ ( )] p p q q p

    p q

    q

    p q p q p q

    T TT FF TF F

    TFTT

    TTFF

    TFTF

    premisesconclusion

    M odus Ponens:

    2 5: Rule of Inference

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    59/89

    59

    2.5: Rule of Inference

    Eg: M odus Ponens

    If the sum of the digits of 371,487 is divisible by 3, then371,487 is divisible by 3.

    The sum of the digits of 371,487 is divisible by 3.

    371,487 is divisible by 3.

    [ ( )] p p q q

    p

    p q

    q

    2 5: Rule of Inference

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    60/89

    60

    [( ) ] p q q p

    p q

    q

    p

    2.5: Rule of Inference

    M odus Tollens - (method of denying) the conclusionis a denial.

    2 5: Rule of Inference

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    61/89

    61

    2.5: Rule of Inference

    Eg: M odus Tollens

    If Zeus is human, the Zeus is mortal.

    Zeus is not mortal.

    Zeus is not human.

    [( ) ] p q q p p q

    q

    p

    2 5: Rule of Inference

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    62/89

    62

    2.5: Rule of Inference

    Eg: M odus Ponens

    a. Lydia wins a ten million dollar lottery.If Lydia wins a ten million dollar lottery, then Kay willquit her job.

    b. If Ali vacations in Paris, then she will have to win a

    scholarship.

    Ali vacations in Paris.

    2.5: Rule of Inference

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    63/89

    63

    2.5: Rule of Inference

    Eg: M odus Tollens

    a. Lydia wins a ten million dollar lottery.If Lydia wins a ten million dollar lottery, then Kay willquit her job.

    b. If Ali vacations in Paris, then he will have to win ascholarship.

    Ali vacations in Paris.

    2.5: Rule of Inference

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    64/89

    64

    2.5: Rule of Inference

    Recognizing M odus Ponens and M odus Tollens:

    Use Modus Ponens or modus Tollens to fill in the blanks:-a. If there are more pigeons than there are pigeonholes, then

    two pigeons roost in the same hole.

    There are more pigeons than there are pigeonholes.

    b. If 870,232 is divisible by 6, then it is divisible by 3.870,232 is not divisible by 3.

    2 5: Rule of Inference

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    65/89

    65

    2.5: Rule of Inference

    Law of the Syllogism:

    [( ) ( )] ( ) p q q r p r

    p q

    q r

    p r

    Eg:1) If the integer 35244 is divisible by 396, then the integer35244 is divisible by 66.

    2) If the integer 35244 is divisible by 66, then the integer35244 is divisible by 3.

    3) Therefore, if the integer 35244 is divisible by 396, then theinteger 35244 is divisible by 3.

    2.5: Rule of Inference

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    66/89

    66

    p p q

    q r

    r

    2.5: Rule of Inference Law of the Syllogism:

    Eg:

    1) Rita is baking a cake.

    2) If Rita is baking a cake, then she is not practicing herflute.

    3) If Rita is not practicing her flute, then her father willnot buy her a car.

    4) Therefore Ritas father will not buy her a car.

    2.5: Rule of Inference

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    67/89

    67

    p

    p q

    q r

    r

    Law of the Syllogism: How to establish the validity of theargument?

    Steps: Reasons

    1) p q Premise

    2) q r Premise

    3) p r steps 1 and 2 and the Law of syllogism

    4) p Premise

    5) r steps 4 and 3 and the Rule of Detachment

    Law of the Syllogism: How to establish the validity of the

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    68/89

    68

    p

    p q

    q r

    r

    y g yargument?

    Steps: Reasons

    1) p Premise

    2) p q Premise

    3) q steps 1 and 2 and the Rule of Detachment

    4) q r Premise

    5) r steps 3 and 4 and the Rule of Detachment

    2 5 R l f I f

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    69/89

    69

    p r r s

    t s

    t u

    u

    p

    p s

    p

    Eg: Modus Tollens

    s u

    p u s t

    t u

    2.5: Rule of Inference

    2 5 R l f I f

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    70/89

    70

    p r r s

    t s

    t u

    u

    p

    p s

    Eg: Modus Tollens(Another reasoning)

    2.5: Rule of Inference

    t

    s p

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    71/89

    71

    Ex : Rule of Conjunction p

    q

    p q

    Ex : Rule of Disjunctive Syllogism

    p q

    p

    q

    2.5: Rule of Inference

    2.5: Rule of Inference

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    72/89

    72

    2.5: Rule of Inference

    Exercise: Establish the validity of the given argument

    p q

    q (r s)

    r ( t u)

    p t

    u

    Steps Reason

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    73/89

    73

    1) p q Premise

    2) q (r s) Premise

    3) p (r s) Steps 1 and 2 and the Law of Syllogism4) p t Premise

    5) p Step 4 and the Rule of Conjunctive Simplification

    6) r s Step 5 and 3 and the Rule of Detachment

    7) r Step 6 and the Rule of Conjunctive Simplification

    8) r ( t u) Premise

    9) ( r t) u Step 8, the associative Law of , De Morgans Law

    10) t Step 4 and the Rule of Conjunctive Simplification11) r t Step 7 and 10 and the Rule of Conjunction

    12) u Steps 9 and 11, the Law of Double Negation,

    and the Rule of Disjunctive Syllogism

    2.5: Rule of Inference

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    74/89

    74

    2.5: Rule of Inference

    Exercise: Establish the validity of the given argument:

    If the band could not play rock music or the refreshments werenot delivered on time, then the New Years party would have

    been canceled and Alicia would have been angry. If the partywere cancelled, then refunds would have had to be made. Norefunds were made.

    Therefore the band could play rock music.

    ( p q) (r s)

    r t

    t

    u

    Steps Reason

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    75/89

    75

    1) r t Premise

    2) t Premise

    3) r Step 1 and 2 and Modus Tollens4) r s Step 3 and the Rule of Disjunctive

    Amplification

    5) (r s) Step 4 and De Morgans Law

    6) ( p q) (r s) Premise

    7) ( p q) Steps 6 and 5 and Modus Tollens

    8) p q Step 7, De Morgans Law, the Law ofDouble Negation

    9) p Step 8 and the Rule of ConjunctiveSimplification

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    76/89

    76

    The Use of QuantifiersDef. : A declarative sentence is an open statement if(1) it contains one or more variables , and(2) it is not a statement, but(3) it becomes a statement when the variables in it are replaced

    by certain allowable choices .

    examples: The number x+2 is an even integer. x= y, x> y, x< y, ...

    universe

    2.6: Quantified Statements

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    77/89

    77

    The Use of Quantifiers

    notations: p( x): The number x+2 is an even integer.

    q( x, y): The numbers y+2, x- y, and x+2 y are even integers.

    p(5): FALSE, p( )7 : TRUE, q(4,2): TRUE

    p(6): TRUE, p( )8 : FALSE, q(3,4): FALSE

    For some x, p( x) is true.For some x, y, q( x, y) is true.

    For some x, is true.For some x, y, is true.

    p x( )q x y( , )

    Therefore,

    2.5: Quantified Statements2.6: Quantified Statements

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    78/89

    78

    The Use of Quantifiers

    existential quantifier : For some x: universal quantifier : For all x:

    x

    x

    x in p( x): free variable x in : bound variable x p x, ( ) x p x, ( ) is either

    true or false.

    2.6: Quantified Statements

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    79/89

    79

    The Use of Quantifiers

    Ex :

    p x x

    q x x

    r x x x

    s x x

    ( ):

    ( ):

    ( ):

    ( ):

    0

    0

    3 4 0

    3 0

    2

    2

    2

    x p x r x TRUE

    x p x q x TRUE

    x p x q x TRUE

    x q x s x FALSE

    x r x s x FALSE x r x p x FALSE

    [ ( ) ( )]:

    [ ( ) ( )]:

    [ ( ) ( )]:

    [ ( ) ( )]:

    [ ( ) ( )]:[ ( ) ( )]:

    x=4

    x=1

    x=5,6,... x=-1

    universe: real numbers

    2.6: Quantified Statements

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    80/89

    80

    The Use of Quantifiers

    Ex : implicit quantification

    sin cos2 2 1 x x x x x(sin cos )2 2 1is

    "The integer 41 is equal to the sum of two perfect squares."is m n m n[ ]41 2 2

    2.6: Quantified Statements

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    81/89

    81

    The Use of QuantifiersDef.: logically equivalent for open statement p( x) and q( x)

    x p x q x[ ( ) ( )]

    p( x) logically implies q ( x)

    x p x q x[ ( ) ( )]

    , i.e., p x q x( ) ( ) for any x

    2.6: Quantified Statements

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    82/89

    82

    The Use of QuantifiersEx.: Universe: all integers

    r x x

    s x x

    ( ):

    ( ):

    2 1 5

    92

    then x r x s x[ ( ) ( )] is false

    but xr x xs x( ) ( ) is true

    Therefore, x r x s x[ ( ) ( )] xr x xs x( ) ( )

    but x p x q x xp x xq x[ ( ) ( )] [ ( ) ( )]

    for any p( x), q( x) and universe

    2.6: Quantified Statements

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    83/89

    83

    The Use of QuantifiersFor a prescribed universe and any open statements p( x), q( x):

    x p x q x xp x xq x x p x q x xp x xq x

    x p x q x xp x xq x

    xp x xq x x p x q x

    [ ( ) ( )] [ ( ) ( )][ ( ) ( )] [ ( ) ( )]

    [ ( ) ( )] [ ( ) ( )]

    [ ( ) ( )] [ ( ) ( )] Note this!

    2.6: Quantified Statements

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    84/89

    84

    The Use of Quantifiers

    How do we negate quantified statements that involve a singlevariable?

    [ ( )] ( )

    [ ( )] ( )

    [ ( )] ( )

    [ ( )] ( )

    xp x x p x

    xp x x p x

    x p x xp x

    x p x xp x

    2.6: Quantified Statements

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    85/89

    85

    The Use of Quantifiers

    Ex. p( x): x is odd.q( x): x2-1 is even.

    Negate x p x q x[ ( ) ( )] (If x is odd, then x2-1 is even.)

    [ ( ( ) ( )] [ ( ( ) ( ))]

    [ ( ( ) ( ))] [ ( ) ( )]

    x p x q x x p x q x

    x p x q x x p x q xThere exists an integer x such that x is odd and x2-1 is odd.(a false statement, the original is true)

    2.6: Quantified Statements

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    86/89

    86

    The Use of Quantifiers

    multiple variables

    x yp x y y xp x y x yp x y y xp x y

    ( , ) ( , )( , ) ( , )

    2.6: Quantified Statements

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    87/89

    87

    The Use of Quantifiers

    BUT

    Ex. 2.48 p( x, y): x+ y=17. x yp x y( , ) : For every integer x, there exists an integer y such

    that x+ y=17. (TRUE)

    y xp x y( , ) : There exists an integer y so that for all integer x, x+ y=17. (FALSE)

    ),(),( y x xp y y x yp x Therefore,

    2.6: Quantified Statements

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    88/89

    88

    The Use of Quantifiers

    Ex

    [ [( ( , ) ( , )) ( , )]]

    [ [( ( , ) ( , )) ( , )]]

    [( ( , ) ( , )) ( , )]

    [ [ ( , ) ( , )] ( , )]

    [( ( , ) ( , )) ( , )]

    x y p x y q x y r x y

    x y p x y q x y r x y

    x y p x y q x y r x y

    x y p x y q x y r x y

    x y p x y q x y r x y

    2.6: Quantified Statements

  • 8/10/2019 Discrete Structure Chapter 2.0 Logic 88

    89/89

    End of Part 1 of Chapter 1

    Next Predicate Calculus n Logic Circuits