0% found this document useful (0 votes)
36 views21 pages

Mathematical Logic Topic 2

Uploaded by

wanyoikejanen
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)
36 views21 pages

Mathematical Logic Topic 2

Uploaded by

wanyoikejanen
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/ 21

LOGIC

Definition of logic

Logic are rules and techniques for determining whether an argument is valid or not.

Logic rules are used in the design of:

 Design of computer circuits.


 Computer programmes.
 For verification of the correctness of a program.

Definitions

Sentence: -are words or groups of words that people use to express ideas or thoughts e.g.

(i) Two plus three is five.


(ii) Solve this equation.
(iii) x38
Proposition or statement: - is a declarative sentence that is either true or false but not both.

Consider the following sentences

(i) Solve this equation- not a statement.


(ii) How wonderful- not a statement.
(iii) 1  1  2 - a statement.
(iv) 2 is an integer- a statement.

(v) 3 is an integer- a statement.


(vi) The sun rises from the east-a statement.
(vii) Open your book- not a statement.
(viii) Nairobi is the capital of Kenya- a statement.
(ix) Washington DC is the capital of United states- a statement.

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.

A sentence that carries only one ideal fact e.g

(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.

A sentence that carries two or more ideas or sub-statements.

Combination of two or more simple statements. e.g

He is intelligent and studies every night.

Statement variables

These are symbols or lowercase letters with or without subscripts such as


p , q , r , s ,…. used to denote
statements or propositions.

For example, we might write

(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

Constructions of new statements

New statements can be constructed from existing statements using various logical connectives.

Types of logical connectives or operations


(i) Negation.
(ii) Conjunction.
(iii) Disjunction.
(iv) Implication or condition.
(v) Bi-implication or bi-conditional.

Conjunction

Is a compound statement formed by combining statements using “AND” written symbolically as p  q


and read as p and q .

Only true if both statements are True otherwise False.

The truth table is given by


p q pq
T T T
T F F
F T F
F F F

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

Is a compound statement formed by combining statements using “OR” written symbolically as


p  q and
read as
p or q .

Only False when both statements are False otherwise True.

The truth table is given by


p q pq
T T T
T F T
F T T
F F F
Negation
A statement meaning the opposite of the given statement, done by adding the word “NOT” ,written
symbolically as  p or ~ p and read as not p .

Example

Let p : James is tall.

Then p : James is not tall.

The truth table is given by


p p
T F
F T

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)
pq
(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) pq
(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)
pq
(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) pqr
(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 pq
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 pq
T T T
T F F
F T F
F F T

Example
Determine the truth values of the following statements.

(i) 2  2  4 if and only if 2  5  10 .


(ii) The English alphabet contains 36 letters if and only if Mexico is North of New York.
(iii) x  x  2x if and only if 2  1 .
(iv) 3 is a prime number if and only if a right angle contains exactly 60 0 .
Solution
(i) True since both statements are true.
(ii) True since both statements are false.
(iii) False since the first part is true but the second part is false.
(iv) False since the first part is true but the second part is false.
Statement formulas
Definition
A statement formula or formulas is defined as follows:
-A statement variable is a statement formula.

-If A and B are statements formulas, then the expressions  A ,  A  B  ,  A  B  ,  A  B  and


 A  B are statement formulas.
Precedence of logical connectives
In a statement formula without parentheses that contains logical connectives are evaluated in the
following order, that is, precedence of logical connectives is

 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

(i) Let A be the statement formula, A :  p  q   q  p 

p q pq  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

(ii) Let A be the statement formula, A : p  q   r .


p q r p p  q A
T T T F F T
T T F F F T
T F T F F T
T F F F F T
F T T T T T
F T F T T F
F F T T F T
F F F T F T

(iii) Let A be the statement formula, A :  p  q  r   p 

p q r qr 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

(iv) Let A be the statement formula, A :  p  q   q  r 

p q r pq qr 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 pr qr 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

Let A : p  q   q  p 

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

Let B be the statement formula p  p . Construct the truth table for B .

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

Prove or disapprove that  p  q    p  q  is a tautology.

Solution

Let A :  p  q    p  q 

p q pq pq 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

Prove or disapprove that  p  q    p  q  is a tautology.

Solution

Let A :  p  q    p  q 

p q pq pq 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

Determine whether the following statements are tautology or not.


(i) p   p  q 
(ii)  p  q   p  q
(iii)  p   p  q   q
(iv)  p  q  r
(v)  p  q    p  q 
(vi)  p  q  q  p
Logical implication

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

A statement formula A is said to be logically equivalent to a statement formula B if the statement


formula A  B is a tautology.

If A is logically equivalent to be B , then symbolically we write A  B or A  B .

Example 1

Let A denote statement formula p   p  q  and B be q . Show that A logically implies B .

Solution

We need to construct the truth table value for A  B :  p   p  q   q

p q pq A : p   p  q B:q AB


T T T T T T
T F F F F T
F T T F T T
F F T F F T
From the truth table it follows that A  B is a tautology and hence : A logically implies B .

Example 2

Show that the implication p  q is equivalent to p  q .

Solution

Let A : p  q and B : p  q

Then we construct the truth table value for A  B :  p  q   p  q  .


p q p A: p  q B p  q AB
T T F T T T
T F F F F T
F T T T T T
F F T T T T

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

We construct the truth table for A  B :  p  q   p   q 

p q pq p q A :  p  q  B : p   q  AB


T T T F F F F T
T F F F T T T T
F T F T F T T T
F F F T T T T T
From the truth table, it follows that A  B is a tautology and hence A is equivalent to B .

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: pq
(v) A : p  q  p  , B : q

Prove the following:

(i) p  q and q  p are logically equivalent.


(ii) p  q and q  q are logically equivalent.
Validity of arguments.

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.

In mathematics, an argument or a proof of a theorem consists of a finite sequence of statements ending in


a conclusion.

Definition

A finite sequence A1 , A2 , A3 ,…., An 1 , An of a statement is an argument. The final statement An is the

conclusion and the statements A1 , A2 , A3 ,…., An 1 are called the premises of the argument.

An argument A1 , A2 . A3 ,….., An 1 , An is logically valid if the statement formula

 A1  A2  A3  .....  An1   An is a tautology.


Sometimes we write an argument in the form

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  .....  An1  logically implies An . If it does, then the argument
is logically valid, otherwise not.

Example 1

Test the validity of the following arguments.

If Alex solved seven problems correctly, then Alex obtained the grade A. Alex solved seven problems
correctly. Therefore, Alex obtained the grade A.

Solution

We first write the arguments by statement variables and logical connectives.

Let p : Alex solved seven problems correctly

Let q : Alex obtained the grade A.

So the argument takes the form


pq
p
q

Next we construct the truth table for the statement formula  p  q   p  q


p q pq  p  q  p  p  q   p  q
T T T T T
T F F F T
F T T F T
F F T F T
Because  p  q   p  q is a tautology, it follows that the given argument is valid.

Example 2

Test the validity of the following arguments.

If Alex solved seven problems correctly, then Alex obtained the grade A. Alex obtained the grade A.

Therefore, Alex solved seven problems correctly.

Solution

We first write the arguments by statement variables and logical connectives.

Let p : Alex solved seven problems correctly

Let q : Alex obtained the grade A.

So the argument takes the form


pq
q
p

Next we construct the truth table for the statement formula  p  q   q  p


p q pq  p  q  q  p  q   q  p
T T T T T
T F F F T
F T T T F
F F T F T
Because  p  q   q  p is not a tautology, it follows that the given argument is not valid or invalid

Exercises

1.Use the truth table to determine whether the following argument is valid.
pq
pr
pqr

2.Use the truth table to determine whether the following argument is valid.
pq
 p  r 
 p

3. Use the truth table to determine whether the following argument is valid.
p  q
r  q
 p  r

4.Test the validity of the following arguments:

(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 and Quantifiers.

Predicates: refers to a property that the subject can have and is denoted by Px  where P denotes
the predicate and x the variable.

Px  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 Px  becomes a proposition and has a truth value.

Example 1
Let Px  denote the statement “ x  3 ”. What is the truth value of P4 and P2 .

Solution

(i) Px  : x  3 , P4 : 4  3 True.


(ii) Px  : x  3 , P2 : 2  3 False.

Example 2

Let Qx, y  denote the statement x  y  3. What are the truth values of the propositions Q1,2

and Q3,0 .

Solution

(i) Qx, y  : x  y  3 , Q1,2 : 1  2  3 , False.


(ii) Qx, y  : x  y  3 , Q3,0 : 3  3  0 , True.

QUANTIFIERS

Quantification is the creation of a proposition from a propositional function.

Quantifiers is a word that is used to imply quantity.

Types of quantifiers

Universal Quantifiers

The word “All” is called a Universal quantifier and is denoted by x .

Suppose Px  is a propositional function then a universal quantifier of Px  is the statement “for all
xPx is true”, written as xPx  .

A quantifier helps to assign a truth value to a propositional function.

A universal quantifier for xPx  has a truth value of true if Px  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 Px  is false.

Example 1

Let Px  be x 1  x . What is the truth value of xPx  where the universe of discourse consists of all
real numbers.

Solution

Px : x 1  x
Let x  3 , then  3  1  3 i.e.  2  3

Since Px  is true for all real numbers then xPx  is true.

Example 2

Let Qx  be ' x  2' . What is the truth value of xQx  where the universe of discourse is the set of all
integers.

Solution

Let x be 4 , then 4  2 is false. Hence Qx  is not true xQx  since ‘ 4  2 ’ is false. Thus xQx  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

This is false since every natural number is greater than zero.

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

xM x  is true since every x  0 .

Exercise

 
1.What is the true value of x x 2  2 if the universe of discourse consists of

(i) all real numbers.

(ii) all integers.


2.What is the truth value of the quantification xPx  ? The domain of the discourse is the set of all
positive integers.

(i) Px  : x  1x  2 is an even integer.

(ii) Px  : x 1  x .

(iii) Px  : x  2  5
(iv) P x  : x 2  2  3

Existential quantifiers

Suppose Px  is a propositional function , then an existential quantifier of Px  is the statement “There
exists at least one x such that Px  is true”, written xPx  .

True if there exists at least one case in the universe of discourse of x for which Px  is true.

Example 1

Symbolize the following statement” There is an integer such that it is odd and prime”.

Solution

Let Px  be ‘ x ’ is odd and Qx  be ‘ x is prime’

xPx   Qx 

Example 2

Let Qx  be ' x  x ' . What is the truth value of xQx  where the universe of discourse is the set of
2

real numbers.

Solution

Let x  2 , 2 2  4  2 is true , P2 is true. Thus, xPx  is true.

Example 3

Let Px  be ' x  x ' . What is the truth value of xPx  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 Px  is true. Hence, it follows that the value xPx  is false.

Exercise

1.Symbolize the following by using quantifiers, predicates and logical connectives.


(i) All integers are rational numbers.

(ii) Some rational numbers are integers.

(iii) All positive integers are multiples of 5.


(iv) Some rectangles are square.
(v) For all integers is either odd or even.
(vi) Every integer is a multiple of 6 if and only if it is a multiple of both 3 and 2 .
(vii) There is no integer n such that n 2 is 5 .

Negation of predicates

Let Px  be the following predicate;

Px  : x has taken the programming course,

Where the domain of discourse is the set of all students in the discrete structures course. The universal
quantification of Px  is xPx  ; i.e.

xPx  : Every student in discrete structures has taken the programming course.

Let us consider the negation of the above statement, which is:

xPx  : 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 xPx  . Thus,

xPx  xPx .

Next let us consider the existential quantification Px  , which is the statement

xPx : There exists a student in discrete structures who has taken the programming course.

The negation of above statement is:

xPx  : No student in discrete structures 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. xPx  . It follows that

xPx  xPx .
Negation of statement functions

Statement functions Negation


xF x  xF x 
xF x xF x 
xF x  xF x 
xF x  xF x
Example 1

Write the negation of the following statements:

(i) For each integer x if x is even then, x 2  x is even.


(ii) There is an integer such as x 2  9 .

Solution

(i) Let Ex  represents the even values of x and S  x  represents x 2  x is even.
xEx   S x 
The negation becomes xEx   S x  .
(ii) x  x 2
9 
 
The negation becomes x   x 2  9 

You might also like