Discrete Structures 1

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 18

1

Mathematical reasoning: introduction to logic,


propositional and predicate

Logic:The term "logic" came from the Greek word logos, which is sometimes translated as
"sentence", "discourse", "reason", "rule", and "ratio".we might define logic as the study of the
principles of correct reasoning.Logic examines the general forms which arguments may
take,which forms are valid and which are not.

Logic is divided into two parts

i) Inductive reasoning ii) deductive reasoning


The first is drawin general conclusion from specific example,the second drawing
logical conclusions from definitions and axioms.

Proposition:A proposition is a statement that is either true or false, but not both.

Example: All the following statements are propositions

1. Washington D.C. is the capital of the United States of America.

2. Toronto is the capital of Canada

3. 1+1=2

4. 2+2=3

Proposition 1 and 3 are true,whereas 2 and 4 are false.

Example: Consider the following sentences,

1. What time is it?


2. Read this Carefully.
3. x+1=2
4. x+y=z
2

sentences 1 and 2 are not propositions because they are only statements.Sentences 3 and
4 are not propositions because they are neither true nor false,since the variables in these
sentences have not been assigned values.

Negation:Let p be a proposition.The statement

“it is not the case p”

Is another proposition ,called the negation of p.The negation of p is denoted by ⇁ p.The


prposition ⇁ p is read “not p”.

Example: Find the negation of the proposition

“Today is Friday”

And express in simple english

Solution: The negation is

“It is not the case that today is Friday”

This negation can be more simply expressed by

“Today is not Friday”

Table 1:The truth table


for the negation of a
proposition
p ⇁p
T F
F T
3

Compound Proposition: Combination of two or more propositions

Conjunction: Let p and q be propositions.The proposition “p and q” denoted by p∧q is the


proposition that is true when both p and q are true and is false otherwise.The proposition p∧q is
called the conjunction of p and q.

The truth table for the conjunction of


two propositions
p q p∧q
T T T
T F F
F T F
F F F

Disjunction: Let p and q be propositions.The proposition “p or q” denoted by p∨q is the


prposition that is false when both p and q are false and is true otherwise.The proposition p∨q is
called the disjunction of p and q (also called inclusive or).

The truth table for the disjunction of


two propositions
p q p∨q
T T T
T F T
F T T
F F F
4

Exclusive OR: Let p and q be propositions.Theexclusive or of p and q denoted by p⊕q is the


prposition that is true when exactly one of p and q and is false otherwise.

The truth table for the exclusive or


of two propositions
p q p⊕q
T T F
T F T
F T T
F F F

Implication: Let p and q be propositions.The implication p→q is the proposition that is


false when p is true and q is false and is true otherwise.In this implication p is called the
hypothesis(or antecedent or premise) and q is called the conclusion(or consequence).

The truth table for the implication


p→q
p q p→q
T T T
T F F
F T T
F F T
Some of the ways of expressing implication are

 if p then q  p is sufficient for q


 p implies q  q if p
 if p,q  q whenever p
 p only if q  q is necessary for p
 whenever p,q

Converse:The proposition q→p is called the converse of p→q


5

Contrapositive: The proposition ⇁q→⇁p is called the contrapositive of p→q.

Example : Find the converse and the contrapositive of the implication

“If today is Thursday,then I have a test today”

Solution: The converse is

”If I have a test today, then today is Thursday”

And the contrapositive of this implication is

” If I do not have a test today,then today is not Thursday”

Definition:Let p and q be propositions.Thebiconditional p⟷q is the prposition that is true


when p and q have the same truth values and is false otherwise.

Note that thebiconditional p⟷q is true precisely when both the implications p→q and q→p
are true .Because of this the terminology

“p if and only if q” is used for biconditional.Other common ways of expressing the proposition p
⟷q are “p is necessary and sufficient for q” and “if p then q and conversely”

The truth table for the biconditional


p⟷q
p q p⟷q
T T T
T F F
F T F
F F T

Bits: Computers represent information using bits. A bit has two possible values,namely 0 and 1.
A variable is called a Boolean Variable if its value is either true or false
6

Bit Strings:A bit string is a sequence of zero or more bits.The length of this string is the
number of bits in the string.

Tables for the Bit Operators OR,AND,and XOR


x y x∨y x∧y x⊕y
0 0 0 0 0
0 1 1 0 1
1 0 1 0 1
1 1 1 1 0

Note: x∨y=bitwise OR

x∧y=bitwise AND

x⊕y=bitwise XOR

Example: Find the bitwise OR,bitwise AND and bitwise XOR of the bit strings 01 1011 0110
and 11 0001 1101.

Solution: 01 1011 0110

11 0001 1101.

11 1011 1111 bitwise OR

01 0001 0100 bitwise AND

10 1010 1011 bitwise XOR

Exercise 1.1:

Q1:Which of the following sentences are propositions?What are the truth values of thosethat are
propositions?
7

a) Boston is the capital of Massachusetts


b) Miami is the capital of Florida
c) 2+3=5
d) 5+7=12
e) x+2=11
f) Answer this question
g) x+y=y+x for every pair of real numbers x and y

Answer: a) proposition,True b) proposition,False

c) proposition,True d) proposition,False

e)No f)No g) proposition,True

Q2: Which of the following sentences are propositions?What are the truth values of those that
are propositions?

a) Do not pass go
b) What time is it?
c) There are no black flies in Maine.
d) 4+x=5
e) x+1=5 if x=1
f) x+y=y+z if x=z

Answer: a) No b) No c)yes

d)Noe)No f) No

Q3:What are the negations of each of the following propositions?

a) Today is Thursday
Negation :Today is not Thursday
8

b) There is no pollution in New Jersey


Negation: There is pollution in New Jersey

c) 2+1=3
Negation:2+1≠ 3

d) The summer in Maine is hot and sunny


Negation: The summer in Maine is neither hot nor sunny

Q4: Let p and q be propositions

p: I bought a lottery ticket this week

q: I won a million dollar jackpot on Friday

Express each of the following propositions as an english sentence

a)⇁p b) p∨q c) p→q d)p∧q e) p⟷q

f)⇁p→⇁q g)⇁p∧⇁q h)⇁p∨(p∧q)

Answers: a) I did not buy a lottery ticket this week

b) : I bought a lottery ticket this week or I won a million dollar jackpot on Friday

c): If I would have bought a lottery ticket this week I might have won a million dollar jackpot on
Friday

d) : I bought a lottery ticket this week and I won a million dollar jackpot on Friday

e) That I buy a lottery ticket this week is necessary and sufficient for me to win a million dollar
jackpot on Friday

f) If I have not bought a lottery ticket this week I would not have won a million dollar jackpot on
Friday

g) I did not buy a lottery ticket this week and I have not won a million dollar jackpot on Friday
9

h)I did not buy a lottery ticket this week or I bought a lottery ticket this week and I won a million
dollar jackpot on Friday

Q5: Let p and q be propositions

p: it is below freezing

q: it is snowing

Write the following propositions using p and q and logical connectives

a) It is below freezing and snowing


Ans: p⋀q
b) It is below freezing but not snowing
Ans: p⋀ ⇁q
c) It is not below freezing and it is not snowing
Ans: ⇁p⋀ ⇁q
d) It is either snowing or below freezing(or both)
Ans: q∨p
e) If it is below freezing it is also snowing
Ans: p→q
f) It is either below freezing or it is snowing, but It is not snowing if it is below freezing
Ans: p⊕q
g) That it is below freezing is necessary and sufficient for it to be snowing
Ans: p⟷q

Q6: Let p,q,r be the propositions

p: you have the flu

q:you miss the final exam


10

r: you pass the course

Express eaach of the following as english sentence

a) p→q

Ans: If you have the flu then you’ll miss the final exam

b) ⇁q⟷ r

Ans:you do not miss the final exam if and only if you pass the course

c) q→ ⇁r
Ans: if you miss the final exam then you’ll not pass the course
d) p∨q∨r

Ans: : you have the flu or you miss the final exam or you pass the course

e) (p→ ⇁r)∨ (q→ ⇁r)


Ans: If you have the flu then you ‘ll not pass the course or if you miss the final exam then
you’ll not pass the course
f) (p⋀q)∨¿q⋀r)
Ans: you have the flu and you miss the final exam or you do not miss the final exam and
you pass the course

Q7:Letp,q be the propositions

p: you drive over 65 miles per hour

q: you get a speeding ticket

Write the following propositions into logical connectives

a) you do not drive over 65 miles per hour


Ans: ⇁p
b) you drive over 65 miles per hour but you do not get a speeding ticket
Ans: p⋀ ⇁q
c) you’ll get a speeding ticket if you drive over 65 miles per hour
11

Ans:p→q
d) If you do not drive over 65 miles per hour then you’ll not get a speeding ticket
Ans: ⇁p→⇁q
e) Driving over 65 miles per hour is sufficient for getting a speeding ticket
Ans: p→q
f) you get a speeding ticket but you do not drive over 65 miles per hour
Ans: q⋀ ⇁p
g) Whenever you get a speeding ticket you are driving over 65 miles per hour
Ans: p→q

Q9: Determine whether each of the following implication is true or false

a) If 1+1=2 then 2+2=5


Ans:F
b) If 1+1=3 then 2+2=4
Ans:T
c) If 1+1=3 then 2+2=5
Ans:T
d) If pigs can fly then 1+1=3
Ans:T
e) If 1+1=3 then God exists
Ans:T
f) If 1+1=3 then pigs can fly
Ans:T
g) If 1+1=2 then pigs can fly
Ans:F
h) If 2+2=4 then 1+2=3
Ans:T

Q19:State the converse and contrapositive of each of the following implications.

a)If it snows today ,I will ski tomorrow.


12

Converse:if I will ski tomorrow then it snows today

Contrapositive:if I will not ski tomorrow then it does not snow today.

b) I come to the class whenever there is going to be a quiz.

Converse: There is going to be a quiz whenever I come to the class

Contrapositive: There is not going to be a quiz whenever I do not come to the class

c)A positive integer is prime only if it has no divisor other than 1 and itself

Converse: A positive integer has no divisor other than 1 and itself only if it is prime

Contrapositive: A positive integer has divisors other than 1 and itself only if it is not prime

Q21:Construct a truth table for each of the following

a) p⋀ ⇁q

p q ⇁q p⋀ ⇁q
T T F F
T F T T
F T F F
F F T F

b) p∨⇁p

p ⇁p p∨⇁p
T F T
F T T

c) (p∨⇁q) →q

p q ⇁q p∨⇁q (p∨⇁q)
→q
13

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

e) (p∨q) → (p⋀q)

p q (p∨q) (p⋀q) (p∨q) →(p⋀q)

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

f) (p→q)⟷ (⇁ q →⇁p)

p q ⇁p ⇁q (p→q) (⇁ q →⇁p) (p→q)⟷(⇁ q →⇁p)


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

f) (p→q)→(q →p)

p q (p→q) (q →p) (p→q)→(q →p)


T T T T T
T F F T T
F T T F F
F F T T T
14

Q22: Construct a truth table for each of the following compound propositions

a) p⊕p

p p p⊕p
T T F
F F F

b)p⊕ ⇁p

p ⇁p p⊕ ⇁p
T F T
F T T

c) p⊕ ⇁q

p q ⇁q p⊕ ⇁q
T T F T
T F T F
F T F F
F F T T

d) ⇁p⊕ ⇁q

p q ⇁p ⇁q ⇁p⊕ ⇁q
15

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

e) (p⊕q)∨(p⊕ ⇁q)

P q ⇁q p⊕q p⊕ ⇁q (p⊕q)∨(p⊕ ⇁q)

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

a) (p⊕q)∧(p⊕ ⇁q)

P q ⇁q p⊕q p⊕ ⇁q (p⊕q)∧ (p⊕ ⇁q)

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

Q26: construct truth table for ((p→q)→r ¿ →s

p q r s p→q (p→q)→r ((p→q)→r ¿ →s


16

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

Q29:Find the bitwise OR,bitwiseAND,bitwiseXORof each of the following pairs of bit strings

a) 1011110
0100001
bitwise OR 1111111
bitwise AND 0000000
bitwise XOR 1111111

b) 1011110
0100001
bitwise OR 1111111
bitwise AND 0000000
bitwise XOR 1111111
17

c) 0001110001
1001001000
bitwise OR 1001111001
bitwise AND 0001000000
bitwise XOR 1000111001

d) 1111111111
0000000000
bitwise OR 1111111111
bitwise AND 0001000000
bitwise XOR 1111111111

Q30:Evaluate each of the following

a) 11000 ∧(01011∨11011)
Solution:first we find (01011∨11011)
01011
∨11011
11011
then 11000 ∧(01011∨11011)= 11011
∧11000
11000

b) (01111∧10101)∨01000
Solution:first we find (01111 ∧ 10101)
01111
∧10101
00101
18

then(01111∧10101)∨01000= 00101
∨01000
01101

c) (01010⊕11011)⊕01000
Solution:first we find (01010⊕11011)
01010
⊕11011
10001
Then(01010⊕11011)⊕ 01000 = 10001
⊕01000
11001

d)(11011∨ 01010)∧ (10001∨11011)


Solution:first we find (11011∨ 01010)
11011
∨01010
11011

and (10001∨11011)
10001
∨11011
11011

Then(11011∨ 01010)∧ (10001∨11011)= 11011


∧11011
11011

You might also like