CSNB143 – Discrete Structure Topic 4 – Logic
Learning Outcomes Students should be able to define statement. Students should be able to identify connectives and compound statements. Students should be able to use the Truth Table without difficulties
Topic 4 – Logic Logic - explanation Statements are the basic building block of logic Statements or propositions is a declarative sentence with the value of true or false but not both. Which one is a statement? The world is round = 5 Have you taken your lunch? 3 - x = 5 The temperature on the surface of Mars is 800F. Tomorrow is a bright day. Read this!
Topic 4 – Logic Logical Connectives and Compound Statements Many mathematical statements are constructed by combining one or more statements Statement usually will be replaced by variables such as p, q, r or s. Example : p: The sun will shine today q: It is a cold weather. Statements can be combined by logical connectives to obtain compound statements. Example : AND (p and q): The sun will shine today and it is a cold weather.
Topic 4 – Logic Logical Connectives - Conjunction Connectives AND is what we called conjunction for p and q, written p q. The compound statement is true if both statements are true. To prove the value of any statement (or compound statements), we need to use the Truth Table. pq p q TT TF FT FF
Topic 4 – Logic Logical Connectives – Disjunction Connectives OR is what we called disjunction for p and q, written p q. The compound statement is false if both statements are false. To prove the value of any statement (or compound statements), we need to use the Truth Table. pq p q TT TF FT FF
Topic 4 – Logic Logical Connectives - Negation Negation for any statement p is not p, written as ~p or p. The Truth Table for negation is: p~p TF FT
Topic 4 – Logic Truth Table – work this out: Find the value of the following compound statements using Truth Table. – p ~ q – (~ p q) p – ~ p ~ q
Topic 4 – Logic Conditional Statements If p and q are statements, the compound statement if p then q, denoted by p q is called a conditional statement or implication. Statement p is called the antecedent or hypothesis (let say); and statement q is called consequent or conclusion. The connective if … then is denoted by the symbol . Example a) p : I am hungryq : I will eat b) p : It is cold q : = 8 The implication would be: a) If I am hungry, then I will eat. b) If it is cold, then = 8.
Topic 4 – Logic Truth table for Conditional Statements pq p q TTT TFF FTT FFT Note that whenever p is false, p q is always true, whenever p and q are both true, p q is true. If p is true and q is false, p q is false. Remember that p is hypothesis and q is the conclusion. A little help: To remember the layout of the conditional statement truth table, imagine you are dealing with the statements if it is raining (as the hypothesis), I use an umbrella (as the conclusion)
Topic 4 – Logic Biconditional statements If p and q are statements, compound statement p if and only if q, denoted by p q, is called an equivalence or biconditional. Its Truth Table is as below: pq p q TTT TFF FTF FFT Note that p q is True in two conditions: both p and q are True, or both p and q are false.
Topic 4 – Logic Work this out: Find the truth value for the statement(p q) (~q ~p)
Topic 4 – Logic A statement that is true for all possible values of its propositional variables is called a tautology. A statement that is always false for all possible values of its propositional variables is called a contradiction. A statement that can be either true or false, depending on the truth values of its propositional variables is called a contingency pq p q (A) ~q~p ~q ~p (B) (A) (B) TT T FF T T TF F TF F T FT T FT T T FF T TT T T
Topic 4 – Logic Logically Equivalent Two statements p and q are said to be logically equivalent if p q is a tautology. Example : Show that statements p q and (~p) q are logically equivalent. pq p q (A) ~p (~p) q (B) (A) (B) TT T F T TF F F F FT T T T FF T T T
Topic 4 – Logic Quantifier Quantifier is used to define about all elements that have something in common. Such as in set, one way of writing it is {x | P(x)} where P(x) is called predicate or propositional function, in which each choice of x will produces a proposition P(x) that is either true or false. There are two types of quantifier being used: Universal Quantification ( ) of a predicate P(x) is the statement “For all values of x, P(x) is true” In other words: for every x every x for any x Example: For the propositional function P(x) : - (-x) = x, where x is a positive integer determine if x P(x) is a true or false statement
Topic 4 – Logic Quantifier (continued) Existential Quantification ( ) of a predicate P(x) is the statement “There exists a value of x for which P(x) is true” In other words: – there is an x – there is some x – there exists an x – there is at least one x Example: For the propositional function Q(x) : x + 1 < 4, find out if x Q(x) is a true or false statement
Topic 4 – Logic Work this out (Universal Quantifier), where x is a positive integer larger than 0 Let Q(x): x + 1 < 4. Determine the truth value of x Q(x) Let P(x) : x + 1 > 4. Determine the truth value of x P(x) Let R(x) : x < 2. Determine the truth value of x R(x) Work this out (Existential Quantifier) Let P(x): x > 3. Determine the truth value of x P(x) Let R(x) : x= x + 1. Determine the truth value of x R(x), where x is a positive integer. Let S(x) : x 2 > 10, where x is a positive integer not exceeding 3, determine the truth value of x S(x),