Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Logic of Compound Statements

Similar presentations


Presentation on theme: "The Logic of Compound Statements"— Presentation transcript:

1 The Logic of Compound Statements

2 Mathematical Logic In order to study discrete mathematics and understand computer programming, one must have some basic knowledge of mathematical logic. Hence in any beginning course of discrete mathematics, about 50% of the time is spent on mathematical logic.

3 Mathematical Logic A set of precise rules that governs the operations of computers (and our mind). Propositional Calculus Predicate Calculus A proposition is a sentence that is either true or false but not both.(In particular, it cannot be a question.) Examples: 2 + 2 = 5 sin(π/6) = 0.5 A predicate is a sentence that contains variables, and when the variables are substituted by numbers or actual objects, it becomes a proposition. Examples: x > 4 a2 + b2 = c2

4 Predicate Calculus Propositional Calculus A proposition cannot have free variables. Propositional calculus is analogous to Arithmetic where we do not deal with variables Predicate calculus on the other hand is analogous to Algebra, which is more complex than arithmetic but it requires the knowledge of arithmetic. Note: a proposition is also called a statement.

5 More examples of Propositions
Determine whether each of the following is a proposition: 1. Washington, D.C., is the capital of USA. Yes. 2. Please read this carefully. No. 3. All Martians like pepperoni on their pizza. Yes. 4. Jane forgot to bring her umbrella. Yes. 5. Would you please pass me the salt? No.

6 Section 2.1 Logical Form and Logical Equivalence

7 Compound Propositions
A compound proposition is a proposition constructed by connecting several propositions together with the following connectives: negation p means “not p” conjunction p  q means “p and q” disjunction p  q means “p or q” Implication (conditional) p  q means “if p then q”

8 p Truth values for compound propositions
best summarized by truth tables Negation Example: I live on the top of a mountain. Negation: I do not live on the top of a mountain. p p T F

9 Conjunction p q p  q T T T F F T F F T F Example: To register to vote, you have to be a citizen and at least years old. It is hot and humid today.

10 Disjunction p q p  q T T T F F T F F T F Example: Either the train is late or my watch is fast. You can find me in the office or the library. (in normal English, the “or” may be exclusive in certain context such as: you can have cheese cake or fruit tart for desert.)

11 Implication (or conditional)
p q p  q T T T F F T F F Note: p → q is often translated as “If p then q.” T F T T Examples: If I win the super lotto, I will quit my job. If the waves are good, we go surfing.

12 Biconditional p q p  q T T T F F T F F Note: p  q is often translated as “p if and only if q.” T F F T Examples: A differentiable function is non-decreasing if and only if its derivative is always non-negative.

13 Order of operations In the absence of parenthesis, the decreasing order of priority is negation  conjunction  disjunction  implication (conditional) → biconditional  Examples: p  q →  r actually means … [p  ( q)] → ( r) “the prerequisites for math125 are math90 and math97 or equivalent” actually means … “don’t drink and drive” actually means …

14 Logical equivalences Two compound statement P and Q are said to be logically equivalent if they have identical truth tables. In this case, we write P ↔ Q. Example: ~ (pq), (~ p)  (~ q). Are they equivalent? p q ~ (p  q) (~ p)  (~q) T T T F F T F F F F F F F F T T

15 De Morgan’s Laws ~ (p  q)  (~ p)  (~ q) ~ (p  q)  (~ p)  (~ q) Example: The baby is either hungry or tired. negation: The baby is not hungry and not tired. Example: The food in this restaurant is inexpensive and delicious. negation: This food in this restaurant is either expensive or not delicious.

16 Conditional Statements
Section 2.2 Conditional Statements

17 An important equivalence for p → q
Consider the sentence: If you play with fire, you will get burnt p ≡ play with fire q ≡ get burnt We can rephrase this as: Either you or you don’t play with fire will get burnt. We therefore conjecture that p → q is equivalent to ~p  q p q p →q T T T F F T F F T F ~p  q T F T T

18 p → q is equivalent to ~ p  q
More practice exercises: If you finish your homework, you can watch TV. Either you don’t finish your homework or you can watch TV. If you go to Las Vegas, you will see what money can do. Either you don’t go to Las Vegas, or you will see what money can do. If you don’t give me a raise, I will quit. Either you give me a raise or I will quit. If you don’t open that window, you won’t get any fresh air. Either you open that window or you won’t get any fresh air. Please check your textbook (p.14) for a complete list of logical equivalences.

19 F The negation of a conditional statement p q p → q T T T F F T F F T
Example: Suppose mom promised you that “If you finish dinner, you can have ice-cream.” Under what circumstances is the promise considered to be broken? It is exactly when you finished dinner but you could not have ice-cream.

20 F The negation of a conditional statement p q p → q T T T F F T F F T
(Note: when we translate English to mathematical logic, “but” is equivalent to “and”.) The negation of p → q should then be p(~q)

21 The negation of p → q is p  (q)
More exercises: If I wash my car, it rains afterwards. negation: I washed my car but it did not rain afterwards. If you hand in all assignments, you will pass this class. negation: You handed in all assignments but still failed the class. If you don’t know where you want to go, then you are already there. negation: If you want to live like a republican, you better vote for the democrats. If x > y then x2 > y2. negation: x > y but x2 ≤ y2

22 Another equivalence for p → q : contrapositive: q → p
Examples: If you want to get there faster, you need to take a plane. contrapositive: If you don’t take a plane, you cannot get there faster. If you eat too much turkey, you will feel sleepy. If you do not want to feel sleepy, you better not eat that much turkey. If you want to see sunrise, you have to get up early. If you do not get up early, you cannot see sunrise.

23  p →  q Warning! The followings are not equivalent to p → q.
converse: q → p inverse:  p →  q Example: Original: If you finish dinner, you can have dessert. Converse: If you are eating dessert, you must have finished dinner. Inverse: If you do not finish dinner, you cannot have dessert. p q p → q T T T F F T F F T F q → p T F  p →  q T F

24 Remark: Most people believe that a conditional statement is biconditional, i.e. p → q is the same as p ↔ q. We have to pay extra attention to this, e.g. If you do not buy lotto, you will never win. True If you buy lotto, you will eventually win. False This example shows that p → q is very different from ~p → ~q.

25 Conclusion: Conditional: p  q Contrapositive: q  p Converse: q  p Inverse: p  q These two groups are not equivalent, but the statements inside a group are.

26 Only If – statements. If p and q are propositions, “p only if q” means “if not q then not p” which is equivalent to “if p then q.” Example: “You can play in this golf course only if you are a member of our country club.” which means, “If you are not a member, you cannot play in this golf course.”

27 Necessary conditions, Sufficient conditions
Definition: If p → q then p is called the sufficient condition for q q is called the necessary condition for p. Example: If you are in Times Square, then you are in NYC. Being in Times Square will guarantee that you are already in New York city because Times Square is a part of NYC. Being in NYC is a necessary condition because if you are not in NYC, then you cannot be in Times Square.

28 Necessary conditions, Sufficient conditions
More examples: If a whole number n is divisible by 6, then it is divisible by 2. If p is a prime number, then 2p – 2 is divisible by p. In mathematics, we usually have the situation that p → q → r . If so, we say that p is sufficient for q and r is necessary for q. Example: f(x) is a polynomial → f(x) is differentiable → f(x) is continuous.


Download ppt "The Logic of Compound Statements"

Similar presentations


Ads by Google