Sei sulla pagina 1di 29

Discrete Mathematical

Structure
Wednesday 6.45 pm to 9.45pm

Foundations
Logic
Sets and

Functions

Logic

Rules of Logic :

specify the meaning of mathematical


statements.

(ie) it helps us to understand statement like


there exist an integer that is not the sum of
two square numbers
For every positive integer n the sum of the
positive integers not exceeding n is
n(n+1)/2

Logic
Proposition:

A declarative statement
(ie) either true or false
Example: 1+1 = 2 ; 7-1 = 6;
Capital of Pakistan is Islamabad
Capital of UAE is Dubai; 5+2 = 8
Note: The first three statements are True the
last two are false.

Logic
Consider the following sentences

What is the time ?


Read this carefully.

These sentences are neither true nor false.


So they cannot be clamed as propositions

Logic
Area of logic that deals with propositions is

called propositional calculus or


propositional Logic.

Mathematical Statements are


combinations of one or more propositions
(ie) Compound Propositions.

Logic
Some instances of propositions and their
representations:
It is raining to day
Say p : raining to day
Opposite of this statement (negation)
It is not the case that it is raining to day
Symbolized as ~p

Logic
Today is Friday
negation of this statement
It is not the case that today is Friday
or simply
Today is not Friday

Logic
Connectives

Conjunction
Examples: Its raining today and college declared
holiday
Two ideas: raining ; holiday connected by
conjunction and
Symbolically:
Raining = r ; holiday = h
then can be symbolized as
r^h

Logic

Truth table: Conjunction


p

p^q

Logic

Connectives

Disjunction

Example:
Get me cool drink or water

Two ideas: get me cool drink ; get me water


connected by disjunction or
Symbolically:
cool drink = c ; water = w
then can be symbolized as

cvw

Logic

Truth Table: Disjunction


p

pvq

Negation :

Truth table
p

Implications
Implications: Conditional Statements
If it rains then its a holiday
Two ideas: raining = p ; holiday = q
(ie) p implies q
symbolizing

pq

If p then q

Logic: other forms of if then

If p then q
If p,q
p is sufficient for q
q if p
q when p
a necessary condition for p is q
p implies q
p only if q
a sufficient condition for q is p
q whenever p
q is necessary for p
q follows from p

Logic

Truth table:
p

pq

Logic
If p then q

Converse

Contra positive

Inverse

pq

q p

~ q ~ p

~ p ~ q

Logic
Home team wins whenever it is raining
If it is raining then the home team wins

Converse

Contra positive

If home team wins then it is raining

If the home team doe not win then it is not raining

Inverse

If it is not raining then the home team does not win

Logic

Bi conditional

pq

p if and only if q
Truth Table
p
T
T
F
F

q
T
F
T
F

pq
T
F
F
T

Logic: Precedence
Like in arithmetic it important

to put :

brackets and parentheses;


2X32
Can have any of the following interpretation:
2 X (3 2)
(2 X 3 ) 2

Logic
Example: Precedence of logical operators

You can access the internet from the campus


only if you are a computer science major or you
are not a freshman.
In symbol form

a c ~ f

Logic
Example: Precedence of logical operators

You cannot ride the roller coaster if you are under


4 feet tall and older than 16 years.
3 ideas
You can ride the roller coaster = q
You are under 4 feet tall =r
You are older than 16 years = s
In symbol form
( r ^ s ) ~ q

Logic- System Specifications

Another example from the field of computer science


The automated reply cannot be sent when the file system is
full.
q denotes the file system is full
p denotes the automated reply can be sent
Finally symbolized as

q ~ p

Logic- System Specifications


Determine whether the system specifications are
consistent.
The diagnostic message is stored in the buffer or
it is retransmitted
The diagnostic message is not stored in the
buffer
if the diagnostic message is stored in the buffer,
then it is retransmitted

Logic- System Specifications


Solution:
For consistency system specification should not
conflict
(ie) there must be a true value assigned to all the
variables in the expression should result in a true
out put from each of the specification
p denotes : the diagnostic message is stored in the
buffer
q denotes the diagnostic message is retransmitted
Then we can symbolize these ides as

pvq

~p

pq

Logic- System Specifications

Solution

pvq

~p

pq

To get a true out put from each of the


specification
p must be false and q must be true
Recall the truth table

Boolean Searches
Search university in new Mexico

Search 1 : NEW and MEXICO and UNIVERSITY


Result : this will include all the pages of interest
together with the list of new universities in Mexico.

Search university in New Mexico or Arizona

Search 2 : (NEW and MEXICO or ARIZONA)


and UNIVERSITY
Result: all the page that contains the word university
and either both the words NEW and MEXICO or the
word ARIZONA.

Logic Puzzles
In an island that has two kinds of inhabitants,

knights who always tell the truth, and their


opposites, knaves, who always lie. You
encounter two people A and B.

What are A and B if A says B is a knight and B


says the two of us are opposite type ?

Logic Puzzles
In a flight crew, the position of pilot, copilot

and the flight engineer are held by three


persons Allen, Brown and Carr not
necessarily in that order. The copilot who
is an only child earns the least. Carr who
married Browns sister earns more than
the pilot. What position does each of the
three hold?

Potrebbero piacerti anche