Mathematical Logic Topic 2
Mathematical Logic Topic 2
Definition of logic
Logic are rules and techniques for determining whether an argument is valid or not.
Definitions
Sentence: -are words or groups of words that people use to express ideas or thoughts e.g.
Types of statements
1. Open statement.
Contains a variable and cannot be judged to be true or false unless the variable is defined or
assigned some value e.g.
(i) x 3
(ii) x 3x 6
2. Closed statement.
A statement whose true values can be determined i.e. can be judged to be either true or false e.g.
5 7 18 -False
3. Simple statement.
(i) 3x 2x 5x
(ii) 5 is an odd number.
(iii) 4 is a positive integer and 7 is an even integer-Not a simple statement since it carries two ideas.
4. Compound statement.
Statement variables
(i)
p : 2 is an integer.
(ii)
q : 3 is an integer.
(iii) r : Washington DC is the capital of United States.
(iv) s : Nairobi is the capital of Kenya.
NB: Simple statement is represented by statement variables while compound statements are formed by
combining simple statements using logical connectives.
Remark:
By definition, a statement is a declarative sentence that can be classified as true or false but not both.
Therefore, one of the values “Truth” or “Falsity” that is assigned to a statement is called its truth value.
We denote “truth” to “T” or 1 and “falsity” to “F” or 0. If a statement
p : is true, we say that the logical
truth value of
p is true and write p is T (or p is 1); otherwise we say that the logical truth value of p
is false and write
p is F (or p is 0).
Truth table
This is a table that displays the relationship between the truth values of propositions.
NB: The number of possibilities of “T” or “F” 2 , where n is the number of statement variables.
n
New statements can be constructed from existing statements using various logical connectives.
Conjunction
Example
Let
p : John is taking Finance .
Let
q : Susan is taking IT.
Then
p and q represents “John is taking Finance and Susan is taking IT” denoted by p q .
Disjunction
Example
Examples
1. Let
p q
be the statement “Susan’s dog is a poodle” and let be the statement “Jack has a black cat”.
Write the following statements.
(i)
pq
(ii)
q
(iii) p q
Solution
(i)
p q : Susan’s dog is a poodle or Jack has a black cat.
(ii)
q : Jack does not have a black cat.
(iii) p q : Susan’s dog is a poodle and Jack does not have a black cat.
2. Determine whether the following statements are true or false.
(i) 2 4 6 and 7 is a prime number.
(ii) Triangles have three sides or squares have three sides.
(iii) Two is even and four is odd.
Solution
(i) True
(ii) True
(iii) False
3. Let
p be the statement “he is tall” and q be the statement “he is handsome”. Write each of the
following statements in symbolic form using
p and q .
(i) He is tall and handsome.
(ii) He is tall but not handsome.
(iii) It is false that he is short or handsome.
(iv) He is neither tall nor handsome.
(v) He is tall or he is short and handsome.
(vi) It is not true that he is short or not handsome.
Solution
(i) pq
(ii) p q
(iii) p q
(iv) p q
(v) p q p
(vi) p q p q
4. Convert the following statements into symbolic form , letting p be 2 3 5 and q be 17 12 .
(i) 2 3 5 and 17 12 .
(ii) 2 3 5 and 17 12
Solution
(i)
pq
(ii)
p q
5. Let p represent the statement “I drink coffee at breakfast ”, let q be the statement “I eat salad for
lunch” and r represent “I like a dessert after dinner”. Write the following statements.
(i) pqr
(ii) p q r
(iii) p q r
(iv) p q p r
Solution
(i) p q r : I drink coffee at breakfast and I eat salad at lunch and I like a dessert after
dinner.
(ii) p q r : I drink coffee at breakfast or I eat salad at lunch and I like a dessert after
dinner.
(iii) p q r : I drink coffee at breakfast and I eat salad at lunch and I don’t like a
dessert after dinner.
(iv) p q p r : I drink coffee at breakfast and I eat salad at lunch or I drink coffee at
breakfast and I like a dessert after dinner.
Conditional /Implication
A conditional statement is a statement of the form “if p , then q ” is denoted by p q . In an
implication p q we call p the hypothesis or antecedent and q is the conclusion or
consequence.
A conditional statement is only false when the first statement is true and the second statement
is false otherwise true.
The truth table is given as
p q pq
T T T
T F F
F T T
F F T
Converse
The converse of a conditional statement “if p , then q ” is the statement “If q , then p ”.
Inverse
The inverse of a conditional statement “if p , then q ” is the statement “if p , then q ”.
Contrapositive
The contrapositive of a conditional statement “If p , then q ” is the statement “If q , then
p ”.
Examples
1. Write the converse, inverse and the contrapositive of “If ABC is a triangle, then
A B C 1800 ”.
Solution
Converse
If A B C 1800 , then ABC is a triangle.
Inverse
If ABC is not a triangle, then A B C 1800
Contrapositive
If A B C 1800 , then ABC is not a triangle.
Exercises.
1.Write the converse, inverse and the contrapositive of the following statements.
(i) If today is Friday, then 2 3 5 .
(ii) If it does not rain, then we will go on a picnic.
(iii) If ABCD is a triangle, then A C 1800 .
2. Determine the truth values of the following statements
(i) If 5 10 , then a penny is worth more than 1 dollar.
(ii) If 1 feet 12 inches, then z is the last letter of the alphabet.
(iii) California is on the west coast if and only if the year 2000 is a leap year.
(iv) p is a vowel of the English alphabet if and only if 2 divides 4 .
Bi-conditional or Bi-implication
Let p and q be the following statements, then ‘ p if and only if q ’, written p q , is called the
bi-implication or bi-conditional of statements p and q .
Only true if both statements are true or if both statements are false. Therefore, the truth table
value is
p q pq
T T T
T F F
F T F
F F T
Example
Determine the truth values of the following statements.
Highest
Second highest
Third highest
Fourth highest
Fifth highest
NB: first compute the truth value of the statement in the innermost parentheses, then determine the truth
value of the statement formula within the next innermost set of parentheses, and continue with the process
until we determine the truth value for the statement formula.
Example
Construct the truth table for each of the following statement formulas.
(i) p q q p
(ii) p q r
(iii) p q r p
(iv) p q q r
(v) p r q r
Solution
p q pq p q q p A
T T T F T T
T F T F F T
F T T F F T
F F F T F F
p q r qr p q r p A
T T T T T F T
T T F F F F F
T F T F F F F
T F F F F F F
F T T T T T T
F T F F T T T
F F T F T T T
F F F F T T T
p q r pq qr A
T T T T T T
T T F T F F
T F T T T T
T F F T T T
F T T T T T
F T F T F F
F F T F T F
F F F F T F
(v) Let A be the statement formula, A : p r q r
p q r pr qr A
T T T T T T
T T F F F T
T F T T T T
T F F F T F
F T T T T T
F T F T F F
F F T T T T
F F F T T T
Tautology
A statement formula A is said to be a tautology if the truth value of A is T for any assignment of the
truth values T and F to the statement variables occurring in A .
Contradiction
A statement formula A is said to be a contradiction if the truth value of A is F for any assignment of
the truth values T and F to the statement variables occurring in A .
Example 1
Let A be the statement formula p q q p . Construct the truth table for A .
Solution
p q p p q q p q p A
T T F F T F T
T F F F T F T
F T T T F T T
F F T F T F T
From the truth table, it follows that the truth value of A is T for any assignment of truth values T and
F to p and q. Hence a tautology.
Example 2
Solution
B : p p
p p A : p p
T F F
F T F
From the truth table, it follows that the truth value of B is F for any assignment of truth values T and
F to p .Hence a contradiction.
Example 3
Solution
Let A : p q p q
p q pq pq A
T T T T T
T F F T T
F T F T T
F F F F T
From the truth table, it follows that the truth value of A is T for any assignment of truth values T and
F to p and q. Hence a tautology.
Example 4
Solution
Let A : p q p q
p q pq pq A
T T T T T
T F T F F
F T T F F
F F F F T
From the table, it follows that A is not a tautology.
Exercise
A statement formula A is said to be logically imply a statement formula B if the statement formula
A B is a tautology.
If A logically implies B , then symbolically we write A B .
Logical equivalence
Example 1
Solution
Example 2
Solution
Let A : p q and B : p q
From the table follows that A B is a tautology and hence A is equivalent to B that is p q
p q .
Example 3
Show that the statement formula A : p q is logically equivalent to the statement formula
B : p q .
Solution
Exercises
Show that the following statement formula A logically implies statement formula B .
(i) A : p q , B : p q
(ii) A : p , B : p q
(iii) A : p p q , B : p
(iv) A:q ,B: pq
(v) A : p q p , B : q
Consider the following argument and conclusion. If Alex solved seven problems correctly, then Alex
obtained the grade A. Alex solved seven problems correctly. Therefore, Alex obtained the grade A.
In mathematics, we encounter arguments such as: If x is a positive even integer, it is divisible by 2 . x is
an even integer and x is not prime . Therefore , x is divisible by 4 . Such a set of statement is called a
proof.
Definition
conclusion and the statements A1 , A2 , A3 ,…., An 1 are called the premises of the argument.
A1
A2
A3
.....
An 1
An
To test the logical validity of an argument written in a natural language, we first write each of the
premises and the conclusion with the help of statement variables and logical connectives. Then we check
whether the conjunction A1 A2 A3 ..... An1 logically implies An . If it does, then the argument
is logically valid, otherwise not.
Example 1
If Alex solved seven problems correctly, then Alex obtained the grade A. Alex solved seven problems
correctly. Therefore, Alex obtained the grade A.
Solution
Example 2
If Alex solved seven problems correctly, then Alex obtained the grade A. Alex obtained the grade A.
Solution
Exercises
1.Use the truth table to determine whether the following argument is valid.
pq
pr
pqr
2.Use the truth table to determine whether the following argument is valid.
pq
p r
p
3. Use the truth table to determine whether the following argument is valid.
p q
r q
p r
(i) If it rains, the prices of vegetables go up. The prices of vegetables go up. So it rains.
(ii) If it snows, then the streets become slippery. If the streets become slippery, then accidents happen.
Accidents do not happen. Therefore, it does not snow.
(iii) If I save money, I will buy a house. I did not buy a house. Therefore, I did not save money.
(iv) If interest rates go up, then the prices of houses go down. The prices of houses did not go
down. Therefore, interest rates went up.
(v) Anne plays golf or Anne plays basketball. Therefore, Anne plays golf.
(vi) If Chris studies, then he will pass the class test. If Chris does not play cards, then he will
study. Chris did not pass in the class test. Therefore, Chris played cards.
(vii) If I do all exercises in this chapter, I will understand the material. If I understand the material,
I will do well on the exam. If I do well on the exam. I will pass. I passed the exam. Therefore,
I did all the exercises in the chapter.
(viii) Shelly is a computer science major or a chemistry major. If Shelly is a chemistry major, then
she must take the organic chemistry course. Therefore, Shelly is a computer science major or
she must take organic chemistry.
(ix) If it snows, then the streets become slippery. If the streets become slippery, then accidents
happen. Accidents do not happen. Therefore, it does not snow.
Predicates: refers to a property that the subject can have and is denoted by Px where P denotes
the predicate and x the variable.
Px is also said to be the value of the propositional function P at x . Once a value has been
assigned a variable x , the statement Px becomes a proposition and has a truth value.
Example 1
Let Px denote the statement “ x 3 ”. What is the truth value of P4 and P2 .
Solution
Example 2
Let Qx, y denote the statement x y 3. What are the truth values of the propositions Q1,2
and Q3,0 .
Solution
QUANTIFIERS
Types of quantifiers
Universal Quantifiers
Suppose Px is a propositional function then a universal quantifier of Px is the statement “for all
xPx is true”, written as xPx .
A universal quantifier for xPx has a truth value of true if Px is true for each x in the universe of
discourse.
To prove that a universal quantifier is false we only require at least one case in the universe of discourse
for which Px is false.
Example 1
Let Px be x 1 x . What is the truth value of xPx where the universe of discourse consists of all
real numbers.
Solution
Px : x 1 x
Let x 3 , then 3 1 3 i.e. 2 3
Since Px is true for all real numbers then xPx is true.
Example 2
Let Qx be ' x 2' . What is the truth value of xQx where the universe of discourse is the set of all
integers.
Solution
Let x be 4 , then 4 2 is false. Hence Qx is not true xQx since ‘ 4 2 ’ is false. Thus xQx is
false.
Example 3
What does the statement xT x mean if T x is’ x has two parents’ and the universe of discourse
consists of all people.
Solution
The statement for xT x means , every person has two parents. This is true for every person.
Example 4
Suppose M x is the statement “ x 0 ”. The universe set is the natural numbers. What is the truth value
of xM x .
Solution
Example 5
If M x is the statement “ x 0 ”. The universal set is the negative integers. What is the truth value of
xM x .
Solution
Exercise
1.What is the true value of x x 2 2 if the universe of discourse consists of
(ii) Px : x 1 x .
(iii) Px : x 2 5
(iv) P x : x 2 2 3
Existential quantifiers
Suppose Px is a propositional function , then an existential quantifier of Px is the statement “There
exists at least one x such that Px is true”, written xPx .
True if there exists at least one case in the universe of discourse of x for which Px is true.
Example 1
Symbolize the following statement” There is an integer such that it is odd and prime”.
Solution
xPx Qx
Example 2
Let Qx be ' x x ' . What is the truth value of xQx where the universe of discourse is the set of
2
real numbers.
Solution
Example 3
Let Px be ' x x ' . What is the truth value of xPx where the universe of discourse is the set of all
2
integers.
Solution
Because for all integers x , x 2 x is true, it follows that for integers x , x 2 x is false. Therefore, there
is no integer for which the predicate Px is true. Hence, it follows that the value xPx is false.
Exercise
Negation of predicates
Where the domain of discourse is the set of all students in the discrete structures course. The universal
quantification of Px is xPx ; i.e.
xPx : Every student in discrete structures has taken the programming course.
xPx : it is not the case that every student in discrete structures has taken the programming course.
This means that there exists at least one student in discrete structures who has taken the programming
course. In symbols, we write this as xPx . Thus,
xPx xPx .
Next let us consider the existential quantification Px , which is the statement
xPx : There exists a student in discrete structures who has taken the programming course.
Here we are saying that for all students x in discrete structures x has not taken the programming
course, i.e. xPx . It follows that
xPx xPx .
Negation of statement functions
Solution
(i) Let Ex represents the even values of x and S x represents x 2 x is even.
xEx S x
The negation becomes xEx S x .
(ii) x x 2
9
The negation becomes x x 2 9