0% found this document useful (0 votes)
23 views22 pages

03_Propositional_Logic

Uploaded by

usj.dcs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views22 pages

03_Propositional_Logic

Uploaded by

usj.dcs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Propositional Logic

Dr. TGI Fernando 1 2

Department of Statistics and Computer Science,


University of Sri Jayewardenepura
Nugegoda, Sri Lanka

1
Email: [email protected]
2
URL: http://tgifernando.wordpress.com/
Dr. TGI Fernando (DSCS) Propositional Logic 1 / 22
Introduction (1)

Propositional logic is a formalization of some simple forms of reasoning.

E.g.
Suppose we know the following sentences (the premises) to be true:
“If I swim, then I will get wet.”
“If I take a shower, then I will get wet.”
From these sentences, we are justified to conclude:
“If I swim or I take a shower, then I will get wet.”
Propositional logic is able to capture the form of this argument

Dr. TGI Fernando (DSCS) Propositional Logic 2 / 22


Introduction (2)

Let P - I swim, Q - I take a shower and R - I will get wet.


Each of these statements either TRUE or FALSE.
Premises Conclusion
If P , then R If P or Q, then R
If Q, then R

This is a valid argument (i.e., if the premises are true, the conclusion
must also be true)
This can be explained in propositional logic.
George Boole is regarded as the founder of propositional logic
although it can be found some traces of propositional logic in stoic
philosophy.

Dr. TGI Fernando (DSCS) Propositional Logic 3 / 22


Statement (Proposition)[1]

A statement (or proposition) is a sentence that is TRUE (T) or


FALSE (F) but not both.
E.g.
a. 2 + 2 = 4
b. 2 + 2 = 5
c. China is in Europe.
d. Where are you going?
e. Do your homework.
f. He is a university student

a, b, and c are statements but d, e, and f are not.


d - question, e - instruction
In f) the pronoun he is not clearly defined.

Dr. TGI Fernando (DSCS) Propositional Logic 4 / 22


Statement (Proposition)[2]

Another example
x + y > 0 is not a statement.
For some values of x and y the sentence is true (e.g. x = 3, y = 4).
For some values of x and y the sentence is false (e.g. x = −1, and
y = −5)
Ex. 1 Indicate which of the following sentences are statements.
1 For all x and y, x + y > 0
2 There exists x and y, x + y > 0
3 1,024 is the smallest four-digit number that is a perfect square.
4 She is a mathematics special student.
5 128 = 26
6 x = 26

Dr. TGI Fernando (DSCS) Propositional Logic 5 / 22


Compound Statements (or Composite Formula)

Statements that composed of sub-propositions and various


connectivities.
E.g.
1 Roses are red and violets are blue.
2 John is smart or he studies every night.

Primitive (Atom) - a statement is said to be primitive if it cannot be


broken down into simpler propositions.
E.g. China is in Asia.
Connectivities
1 ¬P (not P , not the case that P ) is called the negation of P .
2 P ∧ Q (P and Q) is called the conjunction of P and Q.
3 P ∨ Q (P or Q) is called the disjunction of P and Q.

Dr. TGI Fernando (DSCS) Propositional Logic 6 / 22


English Words [1]

Variety of English words translate into logic as ¬, ∧ or ∨.


P but Q means P and Q
Neither P nor Q means ¬P ∧ ¬Q

E.g. Let P = “It is hot.” and Q = “It is sunny.”


1 It is not hot but it is sunny (¬P ∧ Q).
2 It is neither hot nor sunny (¬P ∧ ¬Q).

Ex. 2 Let P = “stocks are increasing.” and Q = “interest rates are


steady.”
1 Stocks are increasing but interest rates are steady.
2 Neither stocks are increasing nor interest rates are steady.

Dr. TGI Fernando (DSCS) Propositional Logic 7 / 22


English Words [2]

Ex. 3 Let P = “Juan is math major.”, Q = “Juan is a computer


science major.”
(i) Juan is a math major but not a computer science major.
(ii) Juan is neither math major nor computer science major.

Ex. 4 Let H = “John is healthy.”, W = “John is wealthy.” and S =


“John is wise.”
(i) John is healthy and wealthy but not wise.
(ii) John is not wealthy but he is healthy and wise.
(iii) John is neither healthy, wealthy, nor wise.
(iv) John is neither wealthy nor wise, but he is healthy.
(v) John is wealthy, but he is not both healthy and wise.

Dr. TGI Fernando (DSCS) Propositional Logic 8 / 22


Inequalities

Let x, a, and b are particular real numbers.


x ≤ a means x < a or x = a.
a ≤ x ≤ b means a ≤ x and x ≤ b.

E.g. Suppose x is a particular real number. Let P : 0 < x, Q : x < 3


and R : x = 3. Write the following inequalities symbolically:
(i) x ≤ 3
(ii) 0 < x < 3
(iii) 0 < x ≤ 3

Sol
(i) Q ∨ R
(ii) P ∧ Q
(iii) P ∧ (Q ∨ R)

Dr. TGI Fernando (DSCS) Propositional Logic 9 / 22


Truth values of compound statements [1]

If P is a statement variable, the negation of P is “not P ” or “It is


not the case that P ” and is denoted ¬P .
It has opposite truth value from P : if P is true, ¬P is false; if P is
false, ¬P is true.

P ¬P
T F
F T
Truth Table for ¬P

Dr. TGI Fernando (DSCS) Propositional Logic 10 / 22


Truth values of compound statements [2]

If P and Q are statement variables, the conjunction of P and Q is “P


and Q”, denoted P ∧ Q.
It is true when, and only when, both P and Q are true. If either P or
Q is false, or if both are false, P ∧ Q is false.

P Q P ∧Q
T T T
T F F
F T F
F F F
Truth Table for P ∧ Q

Dr. TGI Fernando (DSCS) Propositional Logic 11 / 22


Truth values of compound statements [3]

If P and Q are statement variables, the disjunction of P and Q is “P


or Q” denoted P ∨ Q.
It is true when either P is true, or Q is true, or both P and Q are true;
it is false only when both P and Q are false.

P Q P ∨Q
T T T
T F T
F T T
F F F
Truth Table for P ∨ Q

Dr. TGI Fernando (DSCS) Propositional Logic 12 / 22


Exclusive OR vs. Inclusive OR

In ordinary English “or” is used in


1 exclusive sense (P or Q, but not both)
2 inclusive sense (P or Q or both)
E.g.
A waiter asks you “tea or coffee” (exclusive)
A waiter offers you “cream or sugar” (inclusive)

P Q P XOR Q
T T F
T F T
F T T
F F F
Truth Table for Exclusive OR (P XOR Q)

Dr. TGI Fernando (DSCS) Propositional Logic 13 / 22


Conditional Statement [1]

A statement of the form “If P then Q” or “P implies Q” where P and


Q statements.
Symbolically P → Q
P hypothesis (antecedent), Q conclusion (consequent)
E.g. If 4,686 is divisible by 6, then 4,686 is divisible by 3.
hypothesis = 4,686 is divisible by 6
conclusion = 4,686 is divisible by 3
→ also a connective like ∧ and ∨

Dr. TGI Fernando (DSCS) Propositional Logic 14 / 22


Conditional Statement [2]

P → Q is false if P is true and Q is false; otherwise true.

P Q P →Q
T T T
T F F
F T T
F F T
Truth Table for P → Q

Ex. 5 Translate the sentence “If the humidity is high and the
temperature is high, then one does not feel comfortable” into
propositional logic.

Dr. TGI Fernando (DSCS) Propositional Logic 15 / 22


Biconditional Statement

Given statement variables P and Q, the biconditional of P and Q is “P


if, and only if, Q” and is denoted as P ↔ Q.
It is true if both P and Q have the same truth values and is false if P
and Q have opposite truth values.

P Q P ↔Q
T T T
T F F
F T F
F F T
Truth Table for P ↔ Q

The words if and only if are sometimes abbreviated as iff.

Dr. TGI Fernando (DSCS) Propositional Logic 16 / 22


Order of operations for logical connectivities

1. ¬
2. ∧, ∨
3. →, ↔

1. Evaluate negation (¬) first.


2. Evaluate ∧ and ∨ second. When both are present parentheses may
be needed.
3. Evaluate → and ↔ third. When both are present parentheses may
be needed.

Dr. TGI Fernando (DSCS) Propositional Logic 17 / 22


Laws of Propositional Logic [1]

Let P, Q, R are formulas, T is a tautology and F is a contradiction.


Then the following logical equivalences hold:
1. P ∧ Q ≡ Q ∧ P
P ∨ Q ≡ Q ∨ P (Commutative laws)
2. P ∧ (Q ∧ R) ≡ (P ∧ Q) ∧ R
P ∨ (Q ∨ R) ≡ (P ∨ Q) ∨ R (Associative laws)
3. P ∧ (Q ∨ R) ≡ (P ∧ Q) ∨ (P ∧ R)
P ∨ (Q ∧ R) ≡ (P ∨ Q) ∧ (P ∨ R) (Distributive laws)
4. P ∧ T ≡ P
P ∨ F ≡ P (Identity laws)
5. P ∨ ¬P ≡ T
P ∧ ¬P ≡ F (Negation laws)
6. ¬(¬P ) ≡ P (Double negation law)

Dr. TGI Fernando (DSCS) Propositional Logic 18 / 22


Laws of Propositional Logic [2]

7. P ∧ P ≡ P
P ∨ P ≡ P (Idempotent laws)
8. P ∨ T ≡ T
P ∧ F ≡ F (Universal bound laws/Domination laws)
9. ¬(P ∧ Q) ≡ ¬P ∨ ¬Q
¬(P ∨ Q) ≡ ¬P ∧ ¬Q (De Morgan’s laws)
10. P ∨ (P ∧ Q) ≡ P
P ∧ (P ∨ Q) ≡ P (Absorption laws)
11. ¬T ≡ F
¬F ≡ T (Negations of T and F )
12. (P → Q) ≡ (¬P ∨ Q) (Implication law)
13. (P → Q) ≡ (¬Q → ¬P ) (Contrapositive law)
14. (P ↔ Q) ≡ (P → Q) ∧ (Q → P ) (Equivalence)

Dr. TGI Fernando (DSCS) Propositional Logic 19 / 22


Simplifying Formulas

E.g. Use propositional logic laws to verify the logical equivalence:


¬(¬P ∧ Q) ∧ (P ∨ Q) ≡ P
Sol:

¬(¬P ∧ Q) ∧ (P ∨ Q)
≡ (¬(¬P ) ∨ ¬Q) ∧ (P ∨ Q) (De Morgan’s law)
≡ (P ∨ ¬Q) ∧ (P ∨ Q) (Double negation law)
≡ P ∨ (¬Q ∧ Q) (Distributive law)
≡ P ∨ F (Negation law)
≡ P (Identity law)

Ex. 7 Show that


¬(P ∨ ¬Q) ∨ (¬P ∧ ¬Q) ≡ ¬P

Dr. TGI Fernando (DSCS) Propositional Logic 20 / 22


Exercises

Ex. 8 Write negations for the following statements


(i) Hal is a math major and Hal’s sister is a computer science major.
(ii) Sam is an orange belt and Kate is a red belt.
(iii) The connector is loose or the machine is unplugged.
(iv) This computer program has a logical error in the first ten lines or
it is being run with an incomplete data set.
(v) The dollar is at an all-time high and the stock market is at a
record low.
(vi) The train is late or my watch is fast.
Ex. 9 Assume x is a particular real number. Write negations for the
following inequalities
(i) −2 < x < 7
(ii) 0 > x ≥ −7

Dr. TGI Fernando (DSCS) Propositional Logic 21 / 22


Exercises

Ex. 10 Rewrite the statement “Either you get to work on time or you
are fired.” in if-then form.
Ex. 11 Write the negations for each of the following statements:
(i) If my car is in the repair shop, then I cannot get to the class.
(ii) If Sara lives in Athens, then she lives in Greece.

Ex. 12 Write the statement “If Howard can swim across the lake, then
Howard can swim to the island.” in its equivalent contrapositive form.

Dr. TGI Fernando (DSCS) Propositional Logic 22 / 22

You might also like