1-disc math spring 2014-1

29
3/10/2014 1 Welcome to 2013 - 2014 Spring Discrete Mathematics Week 1: The Foundations - Logic 1 Şeref Naci Engin, PhD EE Yildiz Technical University Faculty of Electrical & Electronics Instructor: Şeref Naci Engin Office: Office Hours: Phone: E-Mail: Website: 2013 - 2014 Spring Discrete Mathematics Week 1: The Foundations - Logic 2

Upload: x

Post on 27-Sep-2015

215 views

Category:

Documents


3 download

DESCRIPTION

Disc Math

TRANSCRIPT

  • 3/10/2014

    1

    Welcome to

    2013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic1

    eref Naci Engin, PhD EE

    Yildiz Technical University

    Faculty of Electrical & Electronics

    Instructor: eref Naci Engin

    Office:

    Office Hours:

    Phone:

    E-Mail:

    Website:

    2013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic2

  • 3/10/2014

    2

    Textbook for 0122232 Discrete Mathematics :

    2013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic3

    Evaluation

    up to 20% (bonus)

    2 x 30%

    40%

    42013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

  • 3/10/2014

    3

    Grading

    5

    For the exams and

    course evaluations the

    following scheme will be

    used to convert marks

    into letter grades:

    2013-2014 Spring Discrete Mathematics - Week 1: The Foundations - Logic

    Letter Grade 100

    AA 4.00 90-100

    BA 3.50 80-89

    BB 3.00 70-79

    BB 3.00 60-69

    BB 3.00 53-59

    CB 2.50 48-52

    CC 2.00 40-47

    DC 1.50 30-39

    DC 1.50 0-29

    DD 1.00 No attendance

    FF 0.00

    F0 0.00 50: DD

    Attendance: min. 70% (FF)

    Warning:

    Why Care about Discrete Math?

    structure (circuits) operations (execution of algorithms)

    62013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

  • 3/10/2014

    4

    Syllabus

    The order of the topics may change

    72013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    Propositional Logic

    propositions

    truefalse

    truth valueT F

    1 0

    82013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

  • 3/10/2014

    5

    The Statement/Proposition

    9

    Is this a statement? yes

    Is this a proposition? yes

    What is the truth value

    of the proposition? true (T)

    2013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    The Statement/Proposition

    10

    Is this a statement? yes

    Is this a proposition? yes

    What is the truth value

    of the proposition? False (F)

    2013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

  • 3/10/2014

    6

    The Statement/Proposition

    11

    Is this a statement? yes

    Is this a proposition? no

    Its truth value depends on the value of y, but

    this value is not specified.

    We call this type of statement a propositional

    function or open sentence.

    2013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    The Statement/Proposition

    12

    Is this a statement? yes

    Is this a proposition? yes

    What is the truth value

    of the proposition? false

    2013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

  • 3/10/2014

    7

    The Statement/Proposition

    13

    Is this a statement? no

    Is this a proposition? no

    Only statements can be

    propositions.

    Its a request.

    2013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    Examples

    Propositions 1 and 3 are true, whereas 2 and 4 are false.

    Sentences 1 and 2 are not propositions because they are not declarative sentences.

    Sentences 3 and 4 are not propositions because they are neither true nor false.

    Spring, 2014Discrete Mathematics

    Week 1: The Foundations: Logic and Proofs14

  • 3/10/2014

    8

    Conditional Statements / Propositions

    15

    Is this a statement? yes

    Is this a proposition? yes

    What is the truth value

    of the proposition? probably false

    2013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    The Statement/Proposition

    16

    Is this a statement? yes

    Is this a proposition? yes

    What is the truth value

    of the proposition? true

    because its truth value does not depend on

    specific values of x and y.

    2013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

  • 3/10/2014

    9

    Combining Propositions

    compound proposition

    p q r slogical operators

    172013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    Logical Operators (Connectives)

    (NOT)

    (AND)

    (OR)

    (XOR)

    (if then)

    (if and only if)

    182013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

  • 3/10/2014

    10

    Negation (NOT)

    19

    P P

    true false

    false true

    2013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    Examples

    202013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

  • 3/10/2014

    11

    Examples

    Janes smartphone has at least 32GB of memory

    It is not the case that Janes smartphone has at least 32GB of memory.

    Janes smartphone does not have at least 32GB of memory

    Janes smartphone has less than 32GB of memory.

    212013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    Conjunction (AND)

    22

    P Q PQ

    true true true

    true false false

    false true false

    false false false

    2013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

  • 3/10/2014

    12

    Disjunction (OR)

    23

    P Q PQ

    true true true

    true false true

    false true true

    false false false

    2013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    Exclusive Or (XOR)

    24

    P Q PQ

    true true false

    true false true

    false true true

    false false false

    2013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

  • 3/10/2014

    13

    Conditional Statements:Implication (if - then)

    25

    P Q PQ

    true true true

    true false false

    false true true

    false false true

    2013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    Implication (if - then), p q

    262013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

  • 3/10/2014

    14

    Example -1

    27

    P Q PQ

    T T T

    T F F

    F T T

    F F T

    2013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    Example -2

    28

    P Q PQ

    T T T

    T F F

    F T T

    F F T

    2013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

  • 3/10/2014

    15

    Clearing up the two confusions

    29

    P Q PQ

    T T T

    T F F

    F T T

    F F T

    2013-2014 Spring Discrete Mathematics Week 1: The Foundations - Logic

    p only if q (for pq):

    q unless p (for pq):

    Example -3

    30

    P Q PQ

    T T T

    T F F

    F T T

    F F T

    2013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    Solution:

  • 3/10/2014

    16

    Biconditional (if and only if)

    31

    P Q PQ

    true true true

    true false false

    false true false

    false false true

    2013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    Biconditional (if and only if)

    p is necessary and sufcient for qif p then q, and converselyp iff q

    322013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

  • 3/10/2014

    17

    Example for if and only if statements

    332013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    P Q PQ

    T T T

    T F F

    F T F

    F F T

    This statement is true if p and q are either both true or both false, that is,

    if you buy a ticket and can take the ight or

    if you do not buy a ticket and you cannot take the ight.

    It is false when p and q have opposite truth values, that is,

    when you do not buy a ticket, but you can take the ight (such as when you get a free trip) and

    when you buy a ticket but you cannot take the ight (such as when the airline bumps you).

    Statements and Operators

    34

    P Q P Q (P)(Q)

    true true false false false

    true false false true true

    false true true false true

    false false true true true

    2013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

  • 3/10/2014

    18

    Statements and Operations

    35

    P Q PQ (PQ) (P)(Q)

    true true true false false

    true false false true true

    false true false true true

    false false false true true

    2013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    Equivalent Statements

    logically equivalent

    36

    P Q (PQ) (P)(Q) (PQ)(P)(Q)

    true true false false true

    true false true true true

    false true true true true

    false false true true true

    2013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

  • 3/10/2014

    19

    Tautologies and Contradictions

    Examples:

    R(R)

    (PQ)(P)(Q)

    372013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    Tautologies and Contradictions

    Examples:

    The negation of any tautology is a contradiction, and

    the negation of any contradiction is a tautology.

    382013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

  • 3/10/2014

    20

    Exercises

    (PQ) (P)(Q)

    1.Show that (PQ) (P)(Q).

    De Morgans laws

    2. Show that p q and pq are logically equivalent

    3. Show that (p q) and pq are logically equivalent

    392013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    402013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    logically equivalent

    P Q (PQ) (P)(Q) (PQ)(P)(Q)

    true true false false true

    true false false false true

    false true false false true

    false false true true true

  • 3/10/2014

    21

    412013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    Operator Precedence

    1

    2

    3

    4

    5

    422013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    Truth

    ValueBit

    True 1

    False 0

    Table for the Bit Operators

    OR, AND, and XOR.

    x y x y x y x y

    0 0 0 0 0

    0 1 1 0 1

    1 0 1 0 1

    1 1 1 1 0

  • 3/10/2014

    22

    432013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    Making Not Gates

    442013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

  • 3/10/2014

    23

    452013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    462013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

  • 3/10/2014

    24

    47

    2013-2014 Spring

    Discrete Mathematics

    Week 1: The Foundations - Logic

    482013-2014 Spring Discrete Mathematics

    Week 1: The Foundations - Logic

    AB

    A BA

    A B

    Y

    BInputs Output

    A B C Y

    0 0 0 0

    0 0 1 0

    0 1 0 1

    0 1 1 0

    1 0 0 0

    1 0 1 0

    1 1 0 0

    1 1 1 0

  • 3/10/2014

    25

    Examples

    492013-2014 Spring Discrete Mathematics

    Week 1: The Foundations - Logic

    502013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

  • 3/10/2014

    26

    Predicates and Quantiers -1

    cannot adequately express the meaning of all statements in mathematics and in natural language

    Every computer connected to the university network is functioning properly.

    MATH3 is functioning properly,

    512013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    Predicates and Quantiers -2

    CS2 is under attack by an intruder,

    There is a computer on the university network that is under attack by an intruder.

    predicate logic

    Quantiers: all, some, many, none, and few.

    all of, for each, given any, for arbitrary, for each and for any.

    522013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

  • 3/10/2014

    27

    Predicates and Quantiers -3

    532013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    The meaning of the universal quantiers

    Statement When True? When False?

    true

    false

    true

    false

    Examples -1

    Solution:

    true

    Solution:

    falsefalse

    542013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

  • 3/10/2014

    28

    Predicates -1

    true false

    552013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    Predicates -2

    rst part, the variable x

    second part - the predicate, is greater than 3

    Once a value has been assigned to the variable x, the statement P(x) becomes a proposition and has a truth value

    562013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

  • 3/10/2014

    29

    Examples -1

    Solution:

    true

    false

    A(x) Computer x is under attack by an intruder.

    Solution:

    false true true

    572013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic

    Examples -2

    Solution:

    false

    true

    A(c,n) Computer c is connected to network n

    MATH1 is connected to network CAMPUS2, but not to network CAMPUS1.

    Solution:

    F

    T

    582013-2014 SpringDiscrete Mathematics

    Week 1: The Foundations - Logic