You are on page 1of 52

MZUMBE UNIVERSITY

MSS 111/CSS 216


CALCULUS & FOUNDATION ANALYSIS
BAED-AM I, BAED-EM I, BSC-EDU (MICT) I, BSC-
ICTB II, BSC-ICTM II & BSC-ITS II

TOPIC 2: LOGIC
Outline

• Propositions
• Truth tables
• Logical connectives
• Tautologies, contradictions, logical equivalences
• Algebra of propositions
• Arguments
• Quantifiers.
INTRODUCTION

• Definition: Mathematical Logic is a branch of Mathematics


that deals with the study of the truth and systematic reasoning
through mathematical deduction.

• It is a tool where hypothesis and assumptions are made to


simplify things or complicated statements.

• It includes a methodology for objectively reasoning about


3
their truth or falsity.
2021-11-24 Dr.Eng. Mohammed Alhanjouri
INTRODUCTION CONT…

• Definition: Statement (Proposition): This is something


that you say or write that gives information or an opinion.

• Two types of statements,

i) Mathematical statements/propositions

ii) Non mathematical statements/propositions.


MATHEMATICAL STATEMENTS

• Definition: A mathematical statement is a declarative sentence


(a sentence that declares a fact) that it is either true or false, but
not both.
Example: -John is sick (Yes)
−4 + 6 = 3 (No)
• Any mathematical statement can be represented/denoted by
using letter/letters
• The truth value of a mathematical statement is determined by
true or false denoted as T or F respectively.
MATHEMATICAL STATEMENTS
There are two types of mathematical statements, namely
(a) Simple mathematical statement:
This is the one which give only one meaning.
Examples: -John is sick
-4 + 6 = 3
(b) Compound/complex mathematical statement :
This is the one which give more than one meaning.
Examples: -Amina is beautiful and attractive
-If you study hardly then you will pass
NON-MATHEMATICAL STATEMENTS

• Definition : A Non mathematical statement is any statement


which is neither true nor false.

• Examples:

-Go away

-Come here
TRUTH TABLE

• Definition: Truth Table is a table which is used to show the


truth values of a given mathematical statement.

• It is used to combine more than one statement in summary.

• They are Venn diagrams for logic.

• In general, 2n rows are required if a proposition involves n


propositional variables in order to get the combination of all
truth values.
TRUTH TABLE CONT…

• Example: Let P=John is sick, Truth table for P

is
P
T
F
LOGICAL OPERATORS/CONNECTIVES

• Logical operators/connectives are used to form new


propositions from two or more existing propositions.
• Operators/connectives to be discussed here are
i. Negation operator
ii. Conjunction operator
iii. Disjunction operator
iv. Exclusive or operator
v. Implication operator
vi. Biconditional operator
Topic #1.0 – Propositional Logic: Operators
LOGICAL OPERATORS/CONNECTIVES

The Negation Operator

• The negation operator “¬ or ~” (NOT) transforms a


proposition into its logical negation.

• Example: If p = “I have brown hair.” then ¬p = “I do not


have brown hair.”

• Truth table for NOT: p p


T F
2021-11-24T :≡ True; F :≡ False F T
Dr.Eng. Mohammed Alhanjouri 11
Topic #1.0 – Propositional Logic: Operators

LOGICAL OPERATORS/CONNECTIVES

• The Conjunction Operator

The conjunction operator “” or “AND” combines two

propositions to form their logical conjunction.

• Example: If 𝑝 = “I will have salad for lunch.” and 𝑞 = “I will


have steak for dinner.”, then 𝑝𝑞 = “I will have salad for lunch
and I will have steak for dinner.”
2021-11-24 Dr.Eng. Mohammed Alhanjouri 12
Topic #1.0 – Propositional Logic: Operators

Conjunction Truth Table

• The proposition “p and q,” denoted by pq is true when both


p and q are true otherwise it is false.

• Note that a conjunction p q pq


p1  p2  …  pn of F F F
F T F
n propositions will have
T F F
2 n rows in its truth table.
2021-11-24
T
Dr.Eng. Mohammed Alhanjouri
T T 13
Topic #1.0 – Propositional Logic: Operators
LOGICAL OPERATORS/CONNECTIVES

• The Disjunction Operator

The disjunction operator “” or “OR” combines two

propositions to form their logical disjunction.


• Example: 𝑝 = “My car has a bad engine.”
𝑞 = “My car has a bad carburetor.”
𝑝𝑞 = “Either my car has a bad engine, or
my car has a bad carburetor.”
2021-11-24 Dr.Eng. Mohammed Alhanjouri 14
Topic #1.0 – Propositional Logic: Operators
LOGICAL OPERATORS/CONNECTIVES

• The Disjunction Operator

The disjunction operator “” or “OR” combines two

propositions to form their logical disjunction.


• Example: 𝑝 = “My car has a bad engine.”
𝑞 = “My car has a bad carburetor.”
𝑝𝑞 = “Either my car has a bad engine, or
my car has a bad carburetor.”
2021-11-25 Dr.Eng. Mohammed Alhanjouri 15
Topic #1.0 – Propositional Logic: Operators

DISJUNCTION TRUTH TABLE

• The proposition “p or q,” denoted by pq, is the proposition


that is false when p and q are both false and true otherwise.

• Note that pq means that p is true,


p q pq
or q is true, or both are true! F F F
• So, this operation is also called F T T Note
difference
T F T from AND
inclusive or, because it includes the
T T T
2021-11-24 Dr.Eng. Mohammed Alhanjouri 16
possibility that both p and q are true.
Topic #1.0 – Propositional Logic: Operators
The Exclusive Or Operator

• The exclusive-or operator “” or XOR combines two


propositions to form their logical “exclusive or” (exjunction).

• Example: p = “I will earn an A in this course,”

q = “I will drop this course,”

p  q = “I will either earn an A for this course, or I will

drop it (but not both)”


2021-11-24 Dr.Eng. Mohammed Alhanjouri 17
Topic #1.0 – Propositional Logic: Operators

Exclusive-Or Truth Table

• Note that pq means that p is

true, or q is true, but not both! p q pq


F F F
• This operation is called F T T
T F T
exclusive or, because it excludes Note
T T F difference
from OR.
the possibility that both p and q

are true.
2021-11-24 Dr.Eng. Mohammed Alhanjouri 18
Topic #1.0 – Propositional Logic: Operators
LOGICAL OPERATORS/CONNECTIVES

The Implication Operator (→)

• The implication p → q read as p implies q. That is, If p is true,


then q is true; but if p is not true, then q could be either true
or false.

• Example: Let p = “You study hard.” and q = “You will get a


good grade.” Then p → q = “If you study hard, then you will
get a good grade.” (else,Dr.Eng.
2021-11-24 it Mohammed
couldAlhanjouri
go either way) 19
Topic #1.0 – Propositional Logic: Operators
LOGICAL OPERATORS/CONNECTIVES

• The implication statement is false when p is true and q is


false, and true otherwise.

• In the conditional statement p → q, p is called the hypothesis


(or antecedent or premise) and q is called the conclusion (or
consequence).

• An implication statement is also called a conditional.


2021-11-25 Dr.Eng. Mohammed Alhanjouri 20
Topic #1.0 – Propositional Logic: Operators
Implication Truth Table

• p → q is false only when


p is true but q is not true. p q p→q
F F T
• p → q does not require
F T T The
that p or q are ever true! T F F only
False
T T T case!
• Example. “(1=0) → pigs can fly”

is TRUE!
2021-11-24 Dr.Eng. Mohammed Alhanjouri 21
Topic #1.0 – Propositional Logic: Operators

CONVERSE, INVERSE, CONTRAPOSITIVE

Some terminology, for an implication p → q:

• Its converse is: q → p.

• Its inverse is: ¬p → ¬q.

• Its contrapositive: ¬q → ¬ p.

• One of these three has the same meaning (same truth table)
as p → q.
2021-11-24 Dr.Eng. Mohammed Alhanjouri 22
Topic #1.0 – Propositional Logic: Operators

CONVERSE, INVERSE, CONTRAPOSITIVE

• Example 1: Find the converse of the contrapositive of

(i) P→Q (ii) (PQ) →P

• Example 2: Find the inverse of the converse of

(i) (P Q) →R (ii) Q→(P Q)

• Example 3: Write the converse, inverse and contrapositive of

(i) If it is cloudy, then it will rain.

(ii) You will pass only if you


2021-11-25
study hardly.
Dr.Eng. Mohammed Alhanjouri 23
Topic #1.0 – Propositional Logic: Operators

CONVERSE, INVERSE, CONTRAPOSITIVE

• Check!!, Use the truth table


Proving the equivalence of p → q and its contrapositive
using truth tables:

p q q p p→q q →p
F F T T T T
F T F T T T
T F T F F F
T T F F T T
2021-11-24 Dr.Eng. Mohammed Alhanjouri 24
Topic #1.0 – Propositional Logic: Operators
The biconditional operator

• The biconditional p  q states that p is true if and only if (IFF)


q is true and vice versa.
• Example: p = “Obama wins the 2008 election.”
q = “Obama will be president for all of 2009.”
p  q = “If and only if, Obama wins the 2008 election,
Obama will be president for all of 2009.”

I’m still
here!

2008 2009 25
2021-11-24 Dr.Eng. Mohammed Alhanjouri
Topic #1.0 – Propositional Logic: Operators

Biconditional Truth Table

• The biconditional statement p  q


is true when p and q have the same p q pq
truth values, and is false otherwise. F F T
• Biconditional statements are also called F T F
T F F
bi-implications.
T T T
• p ↔ q has the same truth value as
(p → q) Λ (q → p)
• Also, “if and only if” can be expressed by “iff”
2021-11-24 Dr.Eng. Mohammed Alhanjouri 26
TRUTH TABLES OF COMPOUND PROPOSITIONS

• We can use connectives to build up complicated compound


propositions involving any number of propositional variables, then
use truth tables to determine the truth value of these compound
propositions.

• Example: Construct the truth table of the compound proposition

(p ν ¬q) → (p Λ q).

27
TRUTH TABLES OF COMPOUND PROPOSITIONS

The Truth Table of (p ν ¬q) → (p Λ q).

p q ¬q p ν ¬q pΛq (p ν ¬q) → (p Λ q)

T T F T T T
T F T T F F
F T F F F T
F F T T F F

28
Topic #1.1 – Propositional Logic: Equivalences
EQUIVALENCE

• Propositional Equivalence: This means two textually


different propositions having the same meaning.

• Logical equivalence: propositions p and q are logically


equivalent to each other, IFF p and q contain the same truth
values as each other in all rows of their truth tables.

• Symbols used for equivalence are  or ≡

2021-11-25 Dr.Eng. Mohammed Alhanjouri 29


Topic #1.1 – Propositional Logic: Equivalences
EQUIVALENCE

• Equivalences are proved using:


(i) Truth tables.
(ii) Symbolic derivations(equivalence laws).

2021-11-25 Dr.Eng. Mohammed Alhanjouri 30


Topic #1.1 – Propositional Logic: Equivalences
EQUIVALENCE LAWS OF ALGEBRA

1. Identity law: pT  p

pF  p

2. Domination law: pT  T

pF  F

3. Idempotent law: pp  p

pp  p
2021-11-24 Dr.Eng. Mohammed Alhanjouri 31
Topic #1.1 – Propositional Logic: Equivalences
EQUIVALENCE LAWS OF ALGEBRA

4. Commutative law: pq  qp


pq  qp

5. Double Negation ~(~𝑝)p

6. Associative law: (pq)r  p(qr)


(pq)r  p(qr)

2021-11-25 Dr.Eng. Mohammed Alhanjouri 32


EQUIVALENCE LAWS OF ALGEBRA CONT…

7. Distributive law : p (q  r) (p  q) (p  r)

p (q  r) (p  q) (p  r)

8. Complement law: p ~p  F p~p  T

~p  F ~p  T

9. De morgan’s law: ~(p  q) ~p  ~𝐪

~(p  q) ~p  ~𝐪
2021-11-24 Dr.Eng. Mohammed Alhanjouri 33
EQUIVALENCE LAWS OF ALGEBRA CONT…

Example: Use equivalence laws to simplify the following


propositions:

i. ~(p  q)  (~p  𝐪)

ii. (p  q) ↔(p  ~q)

iii. [ p (q p) ] [q (p q) ]

2021-11-25 Dr.Eng. Mohammed Alhanjouri 34


Topic #1.1 – Propositional Logic: Equivalences

PROVING EQUIVALENCE

Example: Prove that pq and (p  q) are logically


equivalent, i.e., pq  (p  q)..
• Using the truth table:

p q pq p q p  q (p  q)


F F F T T T F
F T T T F F T
T F T F T F T
T T T F F F T
2021-11-24 Dr.Eng. Mohammed Alhanjouri 35
Topic #1.1 – Propositional Logic: Equivalences

TAUTOLOGIES

• Definition: A tautology is a proposition that is true no matter


what the truth values of its atomic propositions are!

• Example: p  ~p

Truth table: p ~p p  ~p

T F T
F T T
2021-11-24 Dr.Eng. Mohammed Alhanjouri 36
CONTRADICTIONS

• Definition: A contradiction is a proposition that is false no

matter what!

• Example: p  ~p

Truth table: p ~p p  ~p

T F F
F T F
CONTINGENCY

• A compound proposition that is neither a tautology or a

contradiction is called a Contingency.


EXAMPLE

• Determine whether the proposition, (p  q) →(p  q) is a


tautology or contradictions or contingency (use both, truth
table and equivalence laws of algebra)
ARGUMENTS
• Definition: An argument is the one which consists of a
sequence of statements called the premises and a final
statement which is a conclusion.

• Example of an argument:

“If 6 is even then 2 does not divide 7.Either 5 is not prime or 2


divide 7.But 5 is prime. Therefore 6 is odd.”
ARGUMENTS
• Notation: 𝑃1 , 𝑃2 , 𝑃3 ,……, 𝑃𝑛 ͰC or

𝑃1 , 𝑃2 , 𝑃3 ,……, 𝑃𝑛 ; C or

𝑃1 , 𝑃2 , 𝑃3 ,……, 𝑃𝑛 : C or

𝑃1 , 𝑃2 , 𝑃3 ,……, 𝑃𝑛 , 𝐶

• Where in each case, 𝑃1 , 𝑃2 , 𝑃3 ,……, 𝑃𝑛 is the sequence of


statements (premises) and C is a conclusion statement.
ARGUMENTS
• Definition: Validity:
An argument 𝑃1 , 𝑃2 , 𝑃3 ,……, 𝑃𝑛 ├ C is valid if and only if
𝑃1  𝑃2 𝑃3  ……,  𝑃𝑛 → 𝐶 is a tautology, otherwise it is
invalid.

• Definition: Fallacy:
An argument 𝑃1 , 𝑃2 , 𝑃3 ,……, 𝑃𝑛 ├ C is fallacy if and only if
𝑃1  𝑃2 𝑃3  ……,  𝑃𝑛 → 𝐶 consist of all values being
false (i.e., contradiction).
ARGUMENTS

• Example: Test the validity of the following argument

i) (p  q) →(p  q)

ii) If I like logic then I will study. Either I study or fail.


Therefore if I fail then I do not like logic.

iii) If 6 is even then 2 does not divide 7.Either 5 is not prime or


2 divide 7.But 5 is prime. Therefore 6 is odd.
Topic #3 – Predicate Logic
QUANTIFIERS

• A quantifier is “an operator that limits the variables of a


proposition”

• Quantifiers provide a notation that allows us to quantify (count)


how many objects in the universes satisfy given predicate.

• There are two types of quantifier, namely


(i) Universal quantifier
(ii) Existential quantifier.
2021-11-24 Dr.Eng. Mohammed Alhanjouri 51
Universal quantifiers

• It is represented by an upside-down A: 

It means “for all” or “for every” or “for ever ”

• Example: Let P(x) = x+1 > x

• We can state the following from the proposition P(x):


-x P(x)
-English translation: “for all values of x, P(x) is true”
-English translation: “for all values of x, 𝑥 + 1>𝑥 is true”
52
Universal quantifiers cont…

Question: Is 𝑥 𝑃(𝑥) in example above always true?

• Check!

-Let x = the character ‘a’. Is ‘a’+1 > ‘a’?

-Let x = the state of Virginia. Is Virginia+1 > Virginia?

• You need to specify your universe, (i.e., What values x can


represent). This is Called the “domain” or “universe of
discourse” 53
Universal quantifiers cont…

• In example above, let the universe be the real numbers.

Then, x P(x) is true always.

• Note: - Given some propositional function P(x)

- And values in the universe x1 .. xn

- The universal quantification x P(x) implies:

P(x1)  P(x2)  …  P(xn) 54


Existential quantification

• Represented by an backwards E: 
It means “there exists”
Example: Let P(x) = 𝑥 + 1 > x

• We can state the following from the proposition P(x):


-x P(x)
-English translation: “there exists (a value of) x such that
P(x) is true” 56
Existential quantification

• Note that you still have to specify your universe

-If the universe we are talking about is all the states in the
US, then x P(x) is not true, this is because when P(x) =
x+1 < x there is no numerical value x for which x+1<x

-Thus, x P(x) is false


Existential quantification

• Note:

- Given some propositional function P(x)

- And values in the universe x1 .. xn

- The universal quantification ∃𝑥𝑃(𝑥) implies:

P(x1)  P(x2)  …  P(xn)

58
Existential quantification

• Example : Let P(x) denote the statement “ x=x+1”. What is

the truth value of the quantification ∃𝑥𝑃(𝑥) , where the

universe of discourse is the set of all real numbers?

• Solution: Since P(x) is false for every real number x , the

existential quantification of P(x) is false. That is ∃𝑥𝑃(𝑥) is

false.
THE END OF THE TOPIC

You might also like