350 likes | 571 Views
Discrete Mathematics. Logic. Propositions. A proposition is a statement or sentence that can be determined to be either true or false (but no both). Examples: The only positive integers that divide 7 are 1 and 7 itself. Buy two tickets for Friday concert.
E N D
Discrete Mathematics Logic
Propositions • A proposition is a statement or sentence that can be determined to be either true or false (but no both). • Examples: • The only positive integers that divide 7 are 1 and 7 itself. • Buy two tickets for Friday concert. • Earth is the only planet in the universe that contains life.
Example • Use variable to represent propositions • P: 1+1=3 • P: It is raining outside • P: Today is Tuesday
Connectives If p and q are propositions, new compound propositions can be formed by using connectives • Most common connectives: • Conjunction ^ • Disjunction • Negation ~ • Exclusive-OR v • Condition • Bi-Condition
Example • P: It is raining • Q: It is cold • Form a new compound statement by combining these two statements • P Q : It is raining and it is cold • P Q : It is raining or it is cold
The truth values of compound propositions can be described by truth tables. Truth table of conjunction P Q is true only when both Pp and Q are true. Truth table of conjunction
Example • Let P = “A decade is 10 years” • Let Q = “A millennium is 100 years” • P Q = “A decade is 10 years” and “A millennium is 100 years” • If P is true and Q is false then conjunction is false
Truth table of disjunction • The truth table of disjunction is • 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"
Negation • Negation of P: in symbols ~P • ~P is false when P is true, ~P is true when P is false • Example, P : "John is a programmer" • ~P = "John is not a programmer"
E.g • P: Paris is the capital of England • ~P: Paris is not capital of England
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"
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…
Conditional propositions • A conditional proposition is of the form “If P then Q” • In symbols: P Q • Example: • P = " A bottle contains acid" • Q = “A bottle has a label” • P Q = “If a bottle contains acid then it has a label "
Truth table of P Q • P Q is true when both p and q are true or when P is false
Example • If the mathematics department gets an additional $40,000 then it will hire one new faculty member. • Let P: The Mathematics Department gets an additional $40,000 and Q: The mathematics Department will hire one new faculty member.
Hypothesis and conclusion • In a conditional proposition P Q, P is called the hypothesis Q is called the conclusion
Example • For all real number x if x > 0 then x2 > 0 • For example x=3 , 3 > 0 then 32 > 0 both are true. • x=-2 , -2 > 0 is false but -22 > 0
Logical equivalence • Two propositions are said to be logically equivalent if their truth tables are identical. • Example: ~P Q is logically equivalent to P Q
Converse • The converse of p q is q p These two propositions are not logically equivalent
Contrapositive • The contrapositive of the proposition p q is ~q ~p. They are logically equivalent.
Bi-Conditional • The double implication “p if and only if q” is defined in symbols as p q p q is logically equivalent to (p q)^(q p)
Tautology • A proposition is a tautology if its truth table contains only true values for every case • Example: p p v q
Contradiction • A proposition is a tautology if its truth table contains only false values for every case • Example: p ^ ~p
De Morgan’s laws for logic • The following pairs of propositions are logically equivalent: • ~ (p q) and (~p)^(~q) • ~ (p ^ q) and (~p) (~q)
Quantifiers • A propositional function P(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 domain of P(x)
For every and for some • Most statements in mathematics and computer science use terms such as for every and for some. • For example: • For every triangle T, the sum of the angles of T is 180 degrees. • For every integer n, n is less than p, for some prime number p.
Universal quantifier • One can write P(x) for every x in a domain D • In symbols: x P(x) • is called the universal quantifier
Inference Or Deduction • An argument is a sequence of propositions written as below : • p1, p2 ,p3 ,p4 ,p5 ,,…, ,pn, therefore q. (if p1v p2v,.., pn then q) or (if p1 ^p2 ^,.., pn then q) • the propositions p1, .., pn, are called hypotheses (premises) and proposition q is called conclusion (consequent). • The above argument is valid if the consequent can be proven from the premises. • Validity can be shown using truth table or by using theorems / rules.
Rules of Inference • Addition p , therefore p v q (read as if we know p is true, therefore we know p or q is true) • Simplification p ^ q , therefore p • Conjunction p , q , therefore p ^ q
Rules of Inference (contd..) • Modus Ponens p q , p, therefore q • Modus Tollens ~ q, p q , therefore ~p • Hypothetical Syllogism p q, q r, therefore p r • Disjunctive Syllogism p v q , ~ p, therefore q • Resolution p v q, ~ p v r , therefore q v r
Example State which rule of inference is the basis of the following argument : “ It is below freezing now. Therefore it is either below freezing or raining now.” - addition rule “It is below freezing and raining now. Therefore, it is below freezing now. “ - simplification rule “Rules : If it snows today, then we will go skiing” Fact : it snows today. Conclude: We will go skiing” - modus ponens
Problem Show that the hypotheses : “ It is not sunny this afternoon and it is colder than yesterday.” Will conclude : “We will be home by sunset “ Given the following fact : “We will go swimming only if it is sunny. If we do not go swimming, then we will take a canoe trip. If we take a canoe trip we will be home by sunset”