21
CS128 – Discrete Mathematics for Computer Science Dr. Daniel Tauritz (Dr. T) Department of Computer Science [email protected] http://web.mst.edu/~tauri CS128 course website: http://web.mst.edu/~tauritzd/cour ses/cs128/fs2009

CS128 – Discrete Mathematics for Computer Science Dr. Daniel Tauritz (Dr. T) Department of Computer Science [email protected] tauritzd

Embed Size (px)

Citation preview

Page 1: CS128 – Discrete Mathematics for Computer Science Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd

CS128 – Discrete Mathematics for Computer Science

Dr. Daniel Tauritz (Dr. T)Department of Computer Science

[email protected]://web.mst.edu/~tauritzd/

CS128 course website: http://web.mst.edu/~tauritzd/courses/cs128/fs2009

Page 2: CS128 – Discrete Mathematics for Computer Science Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd

Propositional Logic

Definition

A statement (or proposition) is a sentence that is true or false but not both.

Page 3: CS128 – Discrete Mathematics for Computer Science Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd

• Truth values

• Logical connectives

• Negation, conjunction, disjunction

• or vs. xor

• Order of operations

• Compound statements

• Statements vs. statement forms

• Truth Tables

Page 4: CS128 – Discrete Mathematics for Computer Science Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd

Definition

Two statement forms are called logically equivalent if, and only if, they have identical truth values for each possible substitution of statements for their statement variables.

Page 5: CS128 – Discrete Mathematics for Computer Science Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd

Definition

Two statements are called logically equivalent if, and only if, they have logically equivalent forms when identical component statement variables are used to replace identical component statements.

Page 6: CS128 – Discrete Mathematics for Computer Science Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd

De Morgan’s Laws

The negation of an and statement is logically equivalent to the or statement in which each component is negated.

The negation of an or statement is logically equivalent to the and statement in which each component is negated.

Page 7: CS128 – Discrete Mathematics for Computer Science Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd

Definition

A tautology is a statement form that is always true regardless of the truth values of the individual statements substituted for its statement variables. A statement whose form is a tautology is a tautological statement.

Page 8: CS128 – Discrete Mathematics for Computer Science Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd

Definition

A contradiction is a statement form that is always false regardless of the truth values of the individual statements substituted for its statement variables. A statement whose form is a contradiction is a contradictory statement.

Page 9: CS128 – Discrete Mathematics for Computer Science Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd

Definition

If p and q are statement variables, the conditional of q by p is “If p then q” or “p implies q”. It is false when p is true and q is false; otherwise it’s true. We call p the hypothesis (or antecedent) of the conditional and q the conclusion (or consequent).

Page 10: CS128 – Discrete Mathematics for Computer Science Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd

Definition

The contrapositive of a conditional statement of the form “If p then q” is

“If ~q then ~p”

Symbolically: The contrapositive of p→q is ~q →~p

Page 11: CS128 – Discrete Mathematics for Computer Science Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd

Definition

An argument is a sequence of statements and an argument form is a sequence of statement forms. All argument statements, except for the final one, are called premises (or assumptions or hypotheses); the final statement is called the conclusion.

Page 12: CS128 – Discrete Mathematics for Computer Science Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd

Definition

To say that an argument form is valid means that regardless of the substituted statements, if the resulting premises are true, then the conclusion is also true.

To say that an argument is valid means that its form is valid.

Page 13: CS128 – Discrete Mathematics for Computer Science Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd

Testing the validity of an argument form

1.Identify premises and conclusion

2.Construct truth table

3.If there is any row in which all the premises are true and the conclusion false, then the form is invalid; otherwise it’s valid

Tip: you only need to complete critical rows (rows whose premises are all true)

Page 14: CS128 – Discrete Mathematics for Computer Science Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd

Definition

A syllogism is an argument form consisting of two premises and a conclusion.

Modus PonensIf p then q

p

tf q

Page 15: CS128 – Discrete Mathematics for Computer Science Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd

Modus TollensIf p then q

~q

tf ~p

Page 16: CS128 – Discrete Mathematics for Computer Science Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd

Additional rules of inference

Generalizationp q

tf p v q tf p v q

Specializationp ^ q p ^ q

tf p tf q

Page 17: CS128 – Discrete Mathematics for Computer Science Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd

Predicate Logic

Definition

A predicate is a sentence that contains a finite number of variables and becomes a statement when specific values are substituted for the variables. The domain of a predicate variable is the set of all values that may be substituted.

Page 18: CS128 – Discrete Mathematics for Computer Science Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd

Example

Let P(x) be the predicate “x3 > x” with domain the set R of all real numbers.

P(1): 1>1 False

P(-1): -1>-1 False

P(2): 8>2 True

Page 19: CS128 – Discrete Mathematics for Computer Science Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd
Page 20: CS128 – Discrete Mathematics for Computer Science Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd
Page 21: CS128 – Discrete Mathematics for Computer Science Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd