chap01 propos logic

Download Chap01 Propos Logic

Post on 26-Nov-2015

4 views

Category:

Documents

1 download

Embed Size (px)

DESCRIPTION

Chap01 Propos Logic

TRANSCRIPT

  • Propositional Logic (Outline)

    The Language of Propositions

    Logical operators (connectives):

    NegationConjunctionDisjunctionImplication (contrapositive, inverse, converse)Biconditional

    Truth ValuesTruth Tables

    Application Examples:

    Translating English SentencesSystem SpecificationsLogic Puzzles

    Logical Equivalences

    Important EquivalencesShowing Equivalence

    Teresa Leyk (CSCE 222) Discrete Structures The Foundations (Part 1): Propositional Logic Fall 2012 1/37

  • Propositions

    Definition

    A proposition is a declarative sentence that is either true or false,but not both.

    Examples of propositions

    It rained yesterday in College Station.

    Houston is the capital of Texas.

    1 + 0 = 1

    0 + 0 = 2

    Examples that are not propositions

    Sit down!

    What time is it?

    x + 1 = 2

    x + y = z

    Teresa Leyk (CSCE 222) Discrete Structures The Foundations (Part 1): Propositional Logic Fall 2012 2/37

  • Propositional Logic

    The area of logic that deals with propositions is calledpropositional logic.

    Constructing propositions

    Propositional variables represent propositions: p, q, r , s , . . .(Similar to variables in algebra.)The proposition that is always true is denoted by T and theproposition that is always false is denoted by F . They arecalled truth values.

    Examples

    1 p=The sky was blue in College Station today at 10am.

    2 q=2+2=4

    3 r=All students in this classroom are freshmen.

    Teresa Leyk (CSCE 222) Discrete Structures The Foundations (Part 1): Propositional Logic Fall 2012 3/37

  • Compound Propositions

    Compound propositions: constructed from logical operatorsand propositional variables

    Negation (not)Conjunction (and)Disjunction (or)Implication (conditional)Biconditional

    Teresa Leyk (CSCE 222) Discrete Structures The Foundations (Part 1): Propositional Logic Fall 2012 4/37

  • Negation

    The negation of a proposition p is denoted by p and has thistruth table:

    p p

    T F

    F T

    Negation reverses a truth value.

    Negation is a unary operation. All other logical operations arebinary.

    Example

    If p denotes The earth is round., then p denotes It is not thecase that the earth is round., or more simply, The earth is notround.

    Teresa Leyk (CSCE 222) Discrete Structures The Foundations (Part 1): Propositional Logic Fall 2012 5/37

  • Conjunction

    The conjunction of propositions p and q is denoted by p qand has this truth table:

    p q p q

    T T T

    T F F

    F T F

    F F F

    Example

    If p denotes I am at home. and q denotes It is raining. thenp q denotes I am at home and it is raining.

    Teresa Leyk (CSCE 222) Discrete Structures The Foundations (Part 1): Propositional Logic Fall 2012 6/37

  • Disjunction (Inclusive or)

    The disjunction of propositions p and q is denoted by p qand has this truth table:

    p q p q

    T T T

    T F T

    F T T

    F F F

    Example

    If p denotes I am at home. and q denotes It is raining. thenp q denotes I am at home or it is raining.

    Teresa Leyk (CSCE 222) Discrete Structures The Foundations (Part 1): Propositional Logic Fall 2012 7/37

  • The Connective Or in English

    In English the conjunction or has two distinct meanings:

    Inclusive Or In the sentence Students who have takenCSCE222 or Math302 may take CSCE221, we assume thatstudents need to have taken one of the prerequisites, but mayhave taken both. This is the meaning of disjunction. For p qto be true, either one or both of p and q must be true.Exclusive Or When reading the sentence Soup or saladcomes with this entre, we do not expect to be able to getboth soup and salad. This is the meaning of Exclusive Or(Xor). In p q , one of p and q must be true, but not both.The truth table for is:

    p q p q

    T T F

    T F T

    F T T

    F F F

    Teresa Leyk (CSCE 222) Discrete Structures The Foundations (Part 1): Propositional Logic Fall 2012 8/37

  • ImplicationIf p and q are propositions, then p q is a conditionalstatement or implication which is read as if p, then q andhas this truth table:

    p q p q

    T T T

    T F F

    F T T

    F F T

    In p q , p is the hypothesis (antecedent or premise) and qis the conclusion (or consequence).The first two rows are easy to understand.The last two rows are not so obvious: One can deriveanything from a false hypothesis.

    Example

    If p denotes I am at home. and q denotes It is raining. thenp q denotes If I am at home then it is raining.

    Teresa Leyk (CSCE 222) Discrete Structures The Foundations (Part 1): Propositional Logic Fall 2012 9/37

  • Understanding Implication

    In p q there does not need to be any connection betweenthe hypothesis or the conclusion. The meaning of p qdepends only on the truth values of p and q.

    These implications are perfectly fine, but would not be used inordinary English.

    Examples

    1 If the moon is made of green cheese, then I have moremoney than Bill Gates.

    2 If the moon is made of green cheese then Im on welfare.

    3 If 1 + 1 = 3, then your grandma wears combat boots.

    Teresa Leyk (CSCE 222) Discrete Structures The Foundations (Part 1): Propositional Logic Fall 2012 10/37

  • Understanding Implication (cont)

    One way to view the logical conditional is to think of anobligation or contract.

    If I am elected, then I will lower taxes.If you get 100% on the final, then you will get an A.

    If the politician is elected and does not lower taxes, then thevoters can say that he or she has broken the campaign pledge.Something similar holds for the professor. This corresponds tothe case where p is true and q is false.

    Teresa Leyk (CSCE 222) Discrete Structures The Foundations (Part 1): Propositional Logic Fall 2012 11/37

  • Different Ways of Expressing p q

    if p, then q p implies qif p, q p only if qq unless p q when pq if p p is sufficient for qq whenever p q is necessary for pq follows from p

    a necessary condition for p is q

    a sufficient condition for q is p

    Teresa Leyk (CSCE 222) Discrete Structures The Foundations (Part 1): Propositional Logic Fall 2012 12/37

  • Converse, Contrapositive, and Inverse

    From p q we can form new conditional statements.

    q p is the converse of p qq p is the contrapositive of p qp q is the inverse of p q

    Example

    Find the converse, inverse, and contrapositive of If it is rainingthen I do not go to town.converse:

    Teresa Leyk (CSCE 222) Discrete Structures The Foundations (Part 1): Propositional Logic Fall 2012 13/37

  • Converse, Contrapositive, and Inverse

    From p q we can form new conditional statements.

    q p is the converse of p qq p is the contrapositive of p qp q is the inverse of p q

    Example

    Find the converse, inverse, and contrapositive of If it is rainingthen I do not go to town.converse:

    If I do not go to town, then it is raining.inverse:

    Teresa Leyk (CSCE 222) Discrete Structures The Foundations (Part 1): Propositional Logic Fall 2012 13/37

  • Converse, Contrapositive, and Inverse

    From p q we can form new conditional statements.

    q p is the converse of p qq p is the contrapositive of p qp q is the inverse of p q

    Example

    Find the converse, inverse, and contrapositive of If it is rainingthen I do not go to town.converse:

    If I do not go to town, then it is raining.inverse:

    If it is not raining, then I go to town.contrapositive:

    Teresa Leyk (CSCE 222) Discrete Structures The Foundations (Part 1): Propositional Logic Fall 2012 13/37

  • Converse, Contrapositive, and Inverse

    From p q we can form new conditional statements.

    q p is the converse of p qq p is the contrapositive of p qp q is the inverse of p q

    Example

    Find the converse, inverse, and contrapositive of If it is rainingthen I do not go to town.converse:

    If I do not go to town, then it is raining.inverse:

    If it is not raining, then I go to town.contrapositive:

    If I go to town, then it is not raining.

    Teresa Leyk (CSCE 222) Discrete Structures The Foundations (Part 1): Propositional Logic Fall 2012 13/37

  • Biconditional

    If p and q are propositions, then we can form thebiconditional proposition p q, read as p if and only if q.The biconditional p q denotes the proposition with thistruth table:

    p q p q

    T T T

    T F F

    F T F

    F F T

    If p denotes I am at home. and q denotes It is raining.then p q denotes I am at home if and only if it is raining.

    Teresa Leyk (CSCE 222) Discrete Structures The Foundations (Part 1): Propositional Logic Fall 2012 14/37

  • Expressing the Biconditional

    Some alternative ways p if and only if q is expressed inEnglish:

    p is necessary and sufficient for qif p then q, and, if q then pp iff q (iff means if and only if)

    Teresa Leyk (CSCE 222) Discrete Structures The Foundations (Part 1): Propositional Logic Fall 2012 15/37

  • Truth Tables For Compound Propositions

    Construction of a truth table:

    Rows

    Need a row for every possible combination of values for theatomic propositions.

    Columns

    Need a column for the compound proposition (usually at farright)Need a column for the truth values of each expression thatoccurs in the compound proposition as it is built up. (Thisincludes the atomic propositions.)

    Teresa Leyk (CSCE 222) Discrete Structures The Foundations (Part 1): Propositional Logic Fall 2012 16/37

  • Example Truth Table

    Con