You are on page 1of 18

# Propositional Logic

Definition: A proposition or statement is a sentence which is
either true or false.

Definition:If a proposition is true, then we say its truth value is
true, and if a proposition is false, we say its truth value is false.

Are these propositions?
1. The sun is shining.
2. The sum of two prime numbers is even.
3. 3+4=7
4. It rained in Austin, TX, on October 30, 1999.
5. x+y > 10
6. Is it raining?
7. Come to class!
8. n is a prime number.
9. The moon is made of green cheese.

Definition: A propositional variable represents an arbitrary
proposition. We represent propositional variables with uppercase let-
ters.

1

2 . My program does not produce a division by 0 error. Therefore my program will not compile. This is one example of an argument form that is called disjunctive syllogism. What is an Argument? Definition: An argument consists of a sequence of statements called premises and a statement called a conclusion. An argu- ment is valid if the conclusion is true whenever the premises are all true. Example: My program won’t compile or it produces a division by 0 error. Now: Rewrite this argument in its general form by defining appro- priate propositional variables.

3 . Therefore ladybugs are purple. Ladybugs are not green. but it isn’t very meaningful since P and Q are not true. Rewritten argument: P or Q not Q Therefore P This argument is valid. Let Q be: Ladybugs are green. Let P be: Ladybugs are purple.Example: Another disjunctive syllogism example Ladybugs are purple or green.

• ∧ denotes and. ¬P is the negation of P.LOGICAL CONNECTIVES • Use logical connectives to build complex propositions from sim- pler ones. • ∨ denotes or. Order of Operations • ¬ first • ∧/∨ second • implication and biconditionals last (more on these later) • parentheses can be used to change the order 4 . The First Three Logical Connectives • ¬ denotes not. P ∧ Q is the conjunction of P and Q. P ∨ Q is the disjunction of P and Q.

“but” is used instead of “and”. Example: Write each sentence in symbols. Because the second part of the sentence is a surprise. assigning propositional variables to statements as follows: P: It is hot. It is neither hot nor sunny. Q: It is sunny. Answers: (in class) 5 . Example: Today is is hot but it is not sunny. 2. 1. Translating English Into Logic Note: The word “but” in English is often translated as ∧. It is not hot but it is sunny.

¬P ? Example: P: Today it is raining. Example: P: Today is Friday. Truth Tables Truth tables represent the relationship between the truth values of propositions and compound propositions formed from those propo- sitions. P ∧ Q? P ∨ Q? 7 . Q: Today is it snowing. Examples: Give truth tables for the logical connectives not. or. What is ¬P ? Example: P: At least two inches of rain fell in Austin today. and.

Inclusive vs. Exclusive Or Note: The ∨ operation represents “inclusive” or. (But hopefully not both!). P ∨ Q is true if either P and Q are true. “Or” has two meanings in English: 1. (Possibly I will take both). 8 . Make sure you are interpreting “or” correctly when translating En- glish statements into logic!! Exercise: Write a truth table for exclusive or operation. Exclusive Or: I will order a steak or enchiladas for dinner tonight. or if both P and Q are true. some- times denoted ⊕ or ∨. Inclusive Or: I will take cs 305j or cs 313k this fall. 2.

Q if P. Q is necessary for P. Ways to read P → Q: If P then Q. the implication or condi- tional statement P → Q is false when P is true and Q is false. 10 . Implications For propositions P and Q. Q follows from P. P implies Q. P is sufficient for Q. and is true otherwise. P only if Q. and Q is called the conclusion. P is called the premise or hypothesis.

If P is true. Q is: You will get an A in cs 313k. you should not expect an A (though I could give you an A). 10 . so I have honored the commitment (P → Q is true). P → Q is true only if Q is also true. then you will get an A. Interpretation of P → Q: Think of P → Q being true as long as I do what I promised: If P is false. Rewritten in logical notation: P → Q. Implication Example Example: If you earn 90% of the possible points in cs 313k. ie if I give you an A. Example: Give the truth table for implication P → Q. where P is: You earn 90% of the possible points in cs 313k.

More on the Meaning of Implications Note: In English. Example: If 2 is prime. where P is “I finish my work early” and Q is “I will pick you up before lunch”. We would never say this in English. We are often implying more than simply that if A holds. a sentence of the form “if A then B” can have different meanings. 11 . But this is not implied by the logical implication P → Q. Example: If I finish my work early. English is not as precise as logic. Typically there is a causal relationship between A and B. Logical implication P → Q can be formed using propositions P and Q that are not related in any way. 1. which is not required in logic. 2. then B holds as well. then I will pick you up before lunch. The common-sense interpretation of this sentence is that the inverse statement is also true: If I do not finish my work early. then grape juice will pour from the sky today. then I will not pick you up before lunch.

then all dogs are black. then (-1)*(-1) = 1. If there are 100 students in class today. If it rains today.Examples: Are these implications true or false? 1. then 2 is a prime number. then we will order pizza. If 2+2=5. 3. 4. 12 . If 4*4 = 16. 2.

then P → Q and Q → P are true. Prove this claim using a truth table. Note: If P ↔ Q is true. and is true if P and Q have the same truth values. 13 . denoted P ↔ Q. Example: True or false? 2+2 = 5 if and only if 2 is prime. Example: Write down the truth table of P ↔ Q. Example: true or false? 2+2 = 5 if and only if 10 is prime. Conversely if both P → Q and Q → P are true. Biconditionals The biconditional of statements P and Q. is read “P if and only if Q” (or “P is necessary and sufficient for Q”). and false otherwise. then P ↔ Q is true.

Rewrite the statement using logical connectives. R: You are a freshman. Q: You are a cs major.Translating English into Logic Example: You can use the microlab only if you are a cs major or not a fresh- man. Example: If it snows or rains today. Rewrite this proposition using logical connectives and propositional variables. P: You can use the microlab. I will not go for a walk. 14 .

contrapositive and inverse statements are logically equivalent to P → Q. Note: As we saw in a previous example. Note that if R ↔ S is a tautology. and the inverse statement is ¬P → ¬Q. Note: ≡ is not a logical connective and R ≡ S is not a com- pound proposition. Example: Use a truth table to determine whether or not the con- verse. the contrapositive statement is ¬Q → ¬P . ie if they always have the same truth values. it is a tau- tology. 15 . we can use a truth table to determine if two compound propositions are logically equivalent. then R ≡ S. Definition: If a compound proposition is always true. the converse statement is Q → P . If two propositions R and S are logically equivalent. Alternate notation: R ⇔ S. we write R ≡ S. Rearrangements of an Implication Definition: For conditional statement P → Q. R ≡ S just means that R → S is a tautology.

LOGICAL IDENTITIES P ≡P ∧P idempotence of ∧ P ≡P ∨P idempotence of ∨ P ∨Q≡Q∨P commutativity of ∨ P ∧Q≡Q∧P commutativity of ∧ (P ∨ Q) ∨ R ≡ P ∨ (Q ∨ R) associativity of ∨ (P ∧ Q) ∧ R ≡ P ∧ (Q ∧ R) associativity of ∧ ¬(P ∨ Q) ≡ ¬P ∧ ¬Q DeMorgan’s Laws ¬(P ∧ Q) ≡ ¬P ∨ ¬Q P ∧ (Q ∨ R) ≡ (P ∧ Q) ∨ (P ∧ R) distributivity of ∧ over ∨ P ∨ (Q ∧ R) ≡ (P ∨ Q) ∧ (P ∨ R) distributivity of ∨ over ∧ P ∨T ≡T domination laws P ∧F ≡F P ∧T ≡P identity laws P ∨F ≡P P ∨ ¬P ≡ T negation laws P ∧ ¬P ≡ F ¬(¬P ) ≡ P double negation law P ∨ (P ∧ Q) ≡ P absorption laws P ∧ (P ∨ Q) ≡ P P → Q ≡ ¬P ∨ Q implication P → Q ≡ ¬Q → ¬P contrapositive P ↔ Q ≡ [(P → Q) ∧ (Q → P )] equivalence [(P ∧ Q) → R] ≡ [P → (Q → R)] exportation 17 .

Example: P: Ann will go to the movie. write down ¬(P ∨Q). Homework: Look at the table of logical equivalences and become familiar with the laws and their names. More on Propositional Equivalence Recall: A compound proposition that is always true is a tautol- ogy. Example: P ∧ ¬P . 20 . Using DeMorgan’s law. Definition: A compound proposition that is not a tautology or a contradiction is a contingency. ¬(P ∨Q) ≡ ¬P ∧¬Q. Example: P ∨ ¬P Definition: A compound proposition that is always false is a con- tradiction. Q: Scott will go to the movie.

Hint: You will need to use the fact that P → Q ≡ ¬P ∨ Q (we just proved this). 21 . Example: Show that (P ∧ Q) → P is a tautology. Equivalence Proofs using the Logical Identities Example . but this is only practical if the number of propo- sitional variables is small. Exercise: Show ¬P → (P → Q) is a tautology.our first step by step equivalence proof Show P ∧ ¬Q ≡ ¬(P → Q). first using a truth table and then with an equivalence proof. Note: We can also use a truth table to prove a compound proposi- tion is a tautology.

1 . For example. The proposition A ∨ B is false 3. Either A ∨ B is false 4. but even when we do this. onsider the rules of syntax to be as strict as in a programming language. Proposition A → that B is true. Grammar/Syntax It is very important to use logical connectives correctly. When writing out logical statements and formulas. the ∧ connective cannot always be used to replace the word “and” in a sentence. B¬C 7. A iff B 5. Exercise: Which statements are correctly formed propositions? Which are nonsense? 1. Remember that every logical symbol can only be used according to strict syntax rules. Do NOT simply plug in a symbol anywhere that the corresponding English word would fit. C implies D 2. then others will not know what you mean. A ∧ B 6. If your statements do not use correct gram- mar/syntax. Note: We will often mix logical notation and English. logical symbols must obey the same strict rules.