Lecture 02: Propositional Logic CSCI 358 Discrete Mathematics, Spring 2016 Hua Wang, Ph.D. Department of Electrical Engineering and Computer Science January 19, 2015
Propositional logic Propositional logic The simplest logic Definition: A proposition is a statement that is either true or false. Examples: Mines is located Golden, Colorado. (T) 5 + 2 = 8. (F) It is raining today. (either T or F) 2 of 16 CS 441 Discrete mathematics for CS
Composite statements Composite statements More complex propositional statements can be build from elementary statements using logical connectives. Example: Proposition A: It rains outside Proposition B: We will see a movie A new (combined) proposition: If it rains outside then we will see a movie 3 of 16 CS 441 Discrete mathematics for CS
CS 441 Discrete mathematics for CS Composite statements Composite statements More complex propositional statements can be build from elementary statements using logical connectives. Logical connectives: Negation Conjunction Disjunction Exclusive or Implication Biconditional 3 of 16
Negation Negation Definition: Let p be a proposition. The statement "It is not the case that p." is another proposition, called the negation of p. The negation of p is denoted by p and read as "not p." Example: Golden is located at west of Denver. It is not the case that Golden is located at west of Denver. Other examples: 5 + 2 8. 10 is not a prime number. It is not the case that buses stop running at 9:00pm. 4 of 16 CS 441 Discrete mathematics for CS
Negation Negation A truth table displays the relationships between truth values (T or F) of different propositions. p p T F F T Rows: all possible values of elementary propositions: 4 of 16 CS 441 Discrete mathematics for CS
Conjunction Conjunction Definition: Let p and q be propositions. The proposition "p and q" denoted by p q, is true when both p and q are true and is false otherwise. The proposition p q is called the conjunction of p and q. Examples: Colorado School of Mines is located at west of Denver and 5 + 2 = 8. It is raining today and 2 is a prime number. 2 is a prime number and 5 + 2 8. 13 is a perfect square and 9 is a prime. 5 of 16 CS 441 Discrete mathematics for CS
Disjunction Disjunction Definition: Let p and q be propositions. The proposition "p or q" denoted by p q, is false when both p and q are false and is true otherwise. The proposition p q is called the disjunction of p and q. Examples: Colorado School of Mines is located at west of Denver or 5 + 2 = 8. It is raining today or 2 is a prime number. 2 is a prime number or 5 + 2 8. 13 is a perfect square or 9 is a prime. 6 of 16 CS 441 Discrete mathematics for CS
Truth tables of conjunction Truth tables and disjunction Conjunction and disjunction Four different combinations of values for p and q p q p q p q T T T F F T F F Rows: all possible combinations of values for elementary propositions: 2 n values 7 of 16 CS 441 Discrete mathematics for CS
Truth tables of conjunction Truth tables and disjunction Conjunction and disjunction Four different combinations of values for p and q p q p q p q T T T T F F F T F F F F NB: p q (the or is used inclusively, i.e., p q is true when either p or q or both are true). 7 of 16 CS 441 Discrete mathematics for CS
Truth tables of conjunction Truth tables and disjunction Conjunction and disjunction Four different combinations of values for p and q p q p q p q T T T T T F F T F T F T F F F F NB: p q (the or is used inclusively, i.e., p q is true when either p or q or both are true). 7 of 16 CS 441 Discrete mathematics for CS
Exclusive or Exclusive or Definition: Let p and q be propositions. The proposition "p exclusive or q" denoted by p q, is true when exactly one of p and q is true and it is false otherwise. p q p q T T F T F T F T T F F F 8 of 16 CS 441 Discrete mathematics for CS
CS 441 Discrete mathematics for CS Implication Implication Definition: Let p and q be propositions. The proposition "p implies q" denoted by p q is called implication. It is false when p is true and q is false and is true otherwise. In p q, p is called the hypothesis and q is called the conclusion. 9 of 16 p q p q T T T T F F F T T F F T
Implication Implication p q is read in a variety of equivalent ways: if p then q p only if q p is sufficient for q q whenever p Examples: if Paris is a city of U.S. then 2 is a prime. If F then T? 9 of 16 CS 441 Discrete mathematics for CS
CS 441 Discrete mathematics for CS Implication Implication p q is read in a variety of equivalent ways: if p then q p only if q p is sufficient for q q whenever p Examples: if Paris is a city of U.S. then 2 is a prime. T if today is Tuesday then 2 * 3 = 8. What is the truth value? 9 of 16
Implication Implication p q is read in a variety of equivalent ways: if p then q p only if q p is sufficient for q q whenever p Examples: if Paris is a city of U.S. then 2 is a prime. T if today is Tuesday then 2 * 3 = 8. If T then F 9 of 16 CS 441 Discrete mathematics for CS
CS 441 Discrete mathematics for CS Implication Implication p q is read in a variety of equivalent ways: if p then q p only if q p is sufficient for q q whenever p Examples: if Paris is a city of U.S. in 2013 then 2 is a prime. T if today is Thursday then 2 * 3 = 8. F 9 of 16
Implication Implication The converse of p q is q p. The contrapositive of p q is q p The inverse of p q is p q 9 of 16 CS 441 Discrete mathematics for CS
Implication Implication The converse of p q is q p. The contrapositive of p q is q p The inverse of p q is p q Examples: If it snows, the traffic moves slowly. p: it snows q: traffic moves slowly. p q The converse: q p 9 of 16 CS 441 Discrete mathematics for CS
Implication Implication The converse of p q is q p. The contrapositive of p q is q p The inverse of p q is p q Examples: If it snows, the traffic moves slowly. p: it snows q: traffic moves slowly. p q The converse: If the traffic moves slowly then it snows. q p 9 of 16 CS 441 Discrete mathematics for CS
CS 441 Discrete mathematics for CS Implication Implication The contrapositive of p q is q p The inverse of p q is p q Examples: If it snows, the traffic moves slowly. The contrapositive: q p The inverse: p q 9 of 16
CS 441 Discrete mathematics for CS Implication Implication The contrapositive of p q is q p The inverse of p q is p q Examples: If it snows, the traffic moves slowly. The contrapositive: If the traffic does not move slowly then it does not snow. q p The inverse: p q 9 of 16
CS 441 Discrete mathematics for CS Implication Implication The contrapositive of p q is q p The inverse of p q is p q Examples: If it snows, the traffic moves slowly. The contrapositive: If the traffic does not move slowly then it does not snow. q p The inverse: If it does not snow the traffic moves quickly. p q 9 of 16
Biconditional Biconditional Definition: Let p and q be propositions. The biconditional p q (read p if and only if q), is true when p and q have the same truth values and is false otherwise. p q p q T T T T F F F T F F F T Note: two truth values always agree. 10 of 16 CS 441 Discrete mathematics for CS
Propositional logic: review Propositional logic: 11 of 16
Propositional logic: review Propositional logic: a formal language for representing knowledge and for making logical inferences. 11 of 16
Propositional logic: review Propositional logic: a formal language for representing knowledge and for making logical inferences. A proposition 11 of 16
Propositional logic: review Propositional logic: a formal language for representing knowledge and for making logical inferences. A proposition is a statement that is either True or False. 11 of 16
Propositional logic: review Propositional logic: a formal language for representing knowledge and for making logical inferences. A proposition is a statement that is either True or False. A compound proposition can be created from other propositions using logical connectives. The truth of a compound proposition is defined by truth values of elementary propositions and the meaning of connectives. The truth table for a compound proposition: table with entries (rows) for all possible combinations of truth values of elementary propositions. 11 of 16
Propositional logic: review compound propositions Given the following two propositions: p: 2 is a prime. True q: 6 is a prime. False Determine the truth value of the following statements: p: p q: p q: p q: p q: p q: q p: 12 of 16
Propositional logic: review compound propositions Given the following two propositions: p: 2 is a prime. True q: 6 is a prime. False Determine the truth value of the following statements: p: False p q: p q: p q: p q: p q: q p: 12 of 16
Propositional logic: review compound propositions Given the following two propositions: p: 2 is a prime. True q: 6 is a prime. False Determine the truth value of the following statements: p: False p q: False p q: p q: p q: p q: q p: 12 of 16
Propositional logic: review compound propositions Given the following two propositions: p: 2 is a prime. True q: 6 is a prime. False Determine the truth value of the following statements: p: False p q: False p q: True p q: p q: p q: q p: 12 of 16
Propositional logic: review compound propositions Given the following two propositions: p: 2 is a prime. True q: 6 is a prime. False Determine the truth value of the following statements: p: False p q: False p q: True p q: True p q: p q: q p: 12 of 16
Propositional logic: review compound propositions Given the following two propositions: p: 2 is a prime. True q: 6 is a prime. False Determine the truth value of the following statements: p: False p q: False p q: True p q: True p q: True p q: q p: 12 of 16
Propositional logic: review compound propositions Given the following two propositions: p: 2 is a prime. True q: 6 is a prime. False Determine the truth value of the following statements: p: False p q: False p q: True p q: True p q: True p q: False q p: 12 of 16
Propositional logic: review compound propositions Given the following two propositions: p: 2 is a prime. True q: 6 is a prime. False Determine the truth value of the following statements: p: False p q: False p q: True p q: True p q: True p q: False q p: True 12 of 16
Propositional logic: review binary logic connectives We have defined five binary logical connectives between two propositions p and q, including,,,,. Are there any others that might be useful? How many binary connectives can there be? Why are some of them not very useful? 13 of 16
Propositional logic: review binary logic connectives We have defined five binary logical connectives between two propositions p and q, including,,,,. Are there any others that might be useful? Yes. How many binary connectives can there be? Why are some of them not very useful? 13 of 16
Propositional logic: review binary logic connectives We have defined five binary logical connectives between two propositions p and q, including,,,,. Are there any others that might be useful? Yes. How many binary connectives can there be? A binary logical connective is defined by a truth table with 4 rows. Each of the four rows may be True or False, so there are 2 4 = 16 possible truth tables, and thus 16 possible connectives. Why are some of them not very useful? 13 of 16
Propositional logic: review binary logic connectives We have defined five binary logical connectives between two propositions p and q, including,,,,. Are there any others that might be useful? Yes. How many binary connectives can there be? A binary logical connective is defined by a truth table with 4 rows. Each of the four rows may be True or False, so there are 2 4 = 16 possible truth tables, and thus 16 possible connectives. Why are some of them not very useful? Six of these are trivial ones that ignore one or both inputs; they correspond to True, False, p, q, p and q. Five of them we have already studied:,,,,. The remaining five are potentially useful: One of them is reverse implication ( instead of ). And the other four are the negations of,,,, the first two of which are sometimes called nand and nor. 13 of 16
Propositional logic: review constructing truth table Constructing the truth table Example: Construct the truth table for Example: constructing the truth table for (p q) ( p q) (p q) ( p q) Rows: all possible combinations of values p q p for p elementary q p q (pq) propositions: ( pq) T T 2 n values T F F T F F 14 of 16 CS 441 Discrete mathematics for CS
Propositional logic: review constructing truth table Constructing the truth table Example: constructing the truth table for (p q) ( p q) p q p p q p q (pq) ( pq) T T F F T F T F Typically the target (unknown) compound proposition and its values Auxiliary compound propositions and their values 14 of 16 CS 441 Discrete mathematics for CS
Propositional logic: review constructing truth table Constructing the truth table Examples: Construct a truth table for Example: constructing the truth table for (p q) ( p q) (p q) ( p q) p q p p q p q (pq) ( pq) T T F T F F T F F F T F F T T T T T F F T T F F 14 of 16 CS 441 Discrete mathematics for CS
Precedence of logic connectives Precedence of Logical Operators Precedence of Logical Operators. Operator 15 of 16 Precedence 1 2 3 4 5 We can construct compound propositions using the negation defined so far. We will generally use parentheses to specify t in a compound proposition are to be applied. For instance, of p q and r. However, to reduce the number of parent operator is applied before all other logical operators. This m of p and q, namely, ( p) q, not the negation of the conjun Another general rule of precedence is that the conjunct the disjunction operator, so that p q r means (p q) this rule may be difficult to remember, we will continue to u the disjunction and conjunction operators is clear. Finally, it is an accepted rule that the conditional and have lower precedence than the conjunction and disjunction p q r is the same as (p q) r. We will use paren ditional operator and biconditional operator is at issue, alth precedence over the biconditional operator. Table 8 displays operators,,,,, and.
Precedence of logic connectives Precedence of Logical Operators. Operator 15 of 16 Precedence 1 2 3 4 5 Precedence of Logical Operators Examples We can construct compound propositions using the negation defined so far. iswe applied will generally before use other parentheses connectives: to specify t in a compound proposition are to be applied. For instance, of p q and r. However, to reduce the number of parent operator is applied before all other logical operators. This m of p and q, namely, is applied ( p) before q, : not the negation of the conjun Another general rule of precedence is that the conjunct the disjunction operator, so that p q r means (p q) this rule may be difficult to remember, we will continue to u and have lower precedence than the disjunction and conjunction operators is clear. and : Finally, it is an accepted rule that the conditional and have lower precedence than the conjunction and disjunction p q r is the same as (p q) r. We will use paren ditional operator and biconditional operator is at issue, alth precedence over the biconditional operator. Table 8 displays operators,,,,, and.
Precedence of logic connectives Precedence of Logical Operators. Operator 15 of 16 Precedence 1 2 3 4 5 Precedence of Logical Operators Examples We can construct compound propositions using the negation defined so far. iswe applied will generally before use other parentheses connectives: to specify t in a compound proposition are to be applied. For instance, p q is same as p ( q). of p q and r. However, to reduce the number of parent operator is applied before all other logical operators. This m of p and q, namely, is applied ( p) before q, : not the negation of the conjun Another general rule of precedence is that the conjunct the disjunction operator, so that p q r means (p q) this rule may be difficult to remember, we will continue to u and have lower precedence than the disjunction and conjunction operators is clear. and : Finally, it is an accepted rule that the conditional and have lower precedence than the conjunction and disjunction p q r is the same as (p q) r. We will use paren ditional operator and biconditional operator is at issue, alth precedence over the biconditional operator. Table 8 displays operators,,,,, and.
Precedence of logic connectives Precedence of Logical Operators. Operator 15 of 16 Precedence 1 2 3 4 5 Precedence of Logical Operators Examples We can construct compound propositions using the negation defined so far. iswe applied will generally before use other parentheses connectives: to specify t in a compound proposition are to be applied. For instance, p q is same as p ( q). of p q and r. However, to reduce the number of parent operator is applied before all other logical operators. This m of p and q, namely, is applied ( p) before q, : not the negation of the conjun Another general p q rule r isofsame precedence as (p isq) that r. the conjunct the disjunction operator, so that p q r means (p q) this rule may be difficult to remember, we will continue to u and have lower precedence than the disjunction and conjunction operators is clear. and : Finally, it is an accepted rule that the conditional and have lower precedence than the conjunction and disjunction p q r is the same as (p q) r. We will use paren ditional operator and biconditional operator is at issue, alth precedence over the biconditional operator. Table 8 displays operators,,,,, and.
Precedence of logic connectives Precedence of Logical Operators. Operator 15 of 16 Precedence 1 2 3 4 5 Precedence of Logical Operators Examples We can construct compound propositions using the negation defined so far. iswe applied will generally before use other parentheses connectives: to specify t in a compound proposition are to be applied. For instance, p q is same as p ( q). of p q and r. However, to reduce the number of parent operator is applied before all other logical operators. This m of p and q, namely, is applied ( p) before q, : not the negation of the conjun Another general p q rule r isofsame precedence as (p isq) that r. the conjunct the disjunction operator, so that p q r means (p q) this rule may be difficult to remember, we will continue to u and have lower precedence than the disjunction and conjunction operators is clear. and : Finally, it is an accepted rule that the conditional and have lower precedence p q than r is the same conjunction as (p q) and disjunction r. p q r is the same as (p q) r. We will use paren ditional operator and biconditional operator is at issue, alth precedence over the biconditional operator. Table 8 displays operators,,,,, and.
Copyright statement This slide set is designed only for academic use for the course of CSCI-358 Discrete Mathematics at the Department of Electrical Engineering and Computer Science of Colorado School of Mines. Some contents in this slide set are obtained from Internet and maybe copyright sensitive. Copyright and all rights therein are retained by the respective authors or by other copyright holders. Distributing or reposting the whole or part of this slide set not for academic purpose is HIGHLY prohibited without the explicit permissions of all copyright holders. 16 of 16