0% found this document useful (0 votes)
40 views

Chapter 1: The Foundations: Logic and Proofs: Discrete Mathematics and Its Applications

This document provides an overview of discrete mathematics and its applications. It defines discrete mathematics as the study of mathematical structures that are distinct and separate rather than continuous. Examples of discrete objects include integers, graphs, and computers which use discrete structures to represent and manipulate data. The document then discusses several examples of problems in areas like cryptography, map coloring, exam scheduling, and logic that can be modeled and solved using discrete mathematical concepts and techniques. It emphasizes that discrete mathematics provides the theoretical foundations for computer science and a way to approach problems rigorously and solve them with optimal algorithms.

Uploaded by

Musawar Ali
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

Chapter 1: The Foundations: Logic and Proofs: Discrete Mathematics and Its Applications

This document provides an overview of discrete mathematics and its applications. It defines discrete mathematics as the study of mathematical structures that are distinct and separate rather than continuous. Examples of discrete objects include integers, graphs, and computers which use discrete structures to represent and manipulate data. The document then discusses several examples of problems in areas like cryptography, map coloring, exam scheduling, and logic that can be modeled and solved using discrete mathematical concepts and techniques. It emphasizes that discrete mathematics provides the theoretical foundations for computer science and a way to approach problems rigorously and solve them with optimal algorithms.

Uploaded by

Musawar Ali
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 26

Discrete Mathematics and Its Applications

Chapter 1: The Foundations:


Logic and Proofs

Department of Computer Science, FAST NUCES, KHI

1
Some Rules

 Attend classes regularly.


 Ask questions, if you are un-clear.
 Submit assignments on time.
 Appear in Exams on time, avoid to appear in
retake.
 Don’t ask for increasing grades.

2
Discrete Structures
 Discrete mathematics is the part of mathematics devoted to the
study of discrete objects (Kenneth H. Rosen, 7th edition).
 Discrete mathematics is the mathematical study of properties,
and relationships among discrete objects.
 Discrete mathematics is the study of mathematical structures
that are fundamentally discrete rather than continuous.
o Discrete objects are those which are separated from (distinct
from) each other, such as integers, rational numbers, houses,
people, etc.
o Real numbers are not discrete.
o Computers use discrete structures to represent and manipulate
data.
3
Discrete Mathematics
Discrete Data: A set of data is said to be
discrete if the values belonging to the set are
distinct and separate. It is counted e.g.,
{1,2,3,4,5,6}
In this course:
•We’ll be concerned with objects such as integers, propositions,
sets, relations and functions, which are all discrete.
•We’ll learn concepts associated with them, their properties, and
relationships among them.
•We’ll learn mathematical facts and their applications.

Discrete structures are:


– Theoretical basis of computer science
– A mathematical foundation that makes you think logically
Discrete Vs Continuous
 Continuous Data: A set of data is said to be continuous if the values belonging to the set can take on any value within
a finite or infinite interval.
 Continuous data is information that can be measured on a continuum or scale. , e.g., [ 0, 70].
 Continuous data can have almost any numeric value and can be meaningfully subdivided into finer and finer
increments, depending upon the precision of the measurement system.

 Discrete Data: A set of data is said to be discrete if the values belonging to the set are distinct and
separate. It is counted e.g., {1,2,3,4,5,6}

5
6
Why Discrete Structures -- Applications
 How many ways are there to choose a valid password on a computer
system?
 What is the probability of winning a lottery?
 Is there a link between two computers in a network?
 How can I identify spam e-mail messages?
 How can I encrypt a message so that no unintended recipient can read it?
 What is the shortest path between two cities using a transportation
system?
 How can a list of integers be sorted so that the integers are in increasing
order?
 How many steps are required to do such a sorting?
 How many valid Internet addresses are there?
7
Why Discrete Structures -- Applications

• Digital computers are based on discrete “atoms” (bits).


• Computers use discrete structures to represent and manipulate
data.

• Therefore, both a computer’s


structure (circuits) and
operations (execution of algorithms)
can be described by discrete mathematics.
Applications: Number Theory
RSA and Public-key Cryptography

Alice and Bob have never met but they would like to
exchange a message. Eve would like to eavesdrop.
E.g. between you and the Bank of America.
They could come up with a good encryption
algorithm and exchange the encryption key –
but how to do it without
Eve getting it? (If Eve gets it, all security
is lost.)

CS folks found the solution:


public key encryption. Quite remarkable
that is feasible.

9
Applications: Coloring a Map

How to color this map so that no two


adjacent regions have the same color?
10
Applications: Graph representation

Coloring the nodes of the graph:


What’s the minimum number of colors such that any two nodes
connected by an edge have different colors?
11
Applications: Scheduling of Final Exams

 How can the final exams at FAST be scheduled so


that no student has two exams at the same time?

Graph:
A vertex correspond to a course.
An edge between two vertices denotes that there is at least one common
student in the courses they represent.
Each time slot for a final exam is represented by a different color.

A coloring of the graph corresponds to a valid schedule of the exams.


12
Applications: Scheduling of Final Exams

1 1
Time Courses
Period
2 7 2 I 1,6
7
II 2
III 3,5
IV 4,7
6 3 6 3

5 4 5 4

What are the constraints between courses?


13 Find a valid coloring
Applications: Index Registers

 The execution of loops can be speeded up by storing frequently used


variables temporarily in registers in the central processing unit,
instead in the regular memory. For a given loop, how many index
registers are needed?

• Each vertex corresponds to a variable in the loop.


• An edge between two vertices denotes the fact that the corresponding variables
must be stored in registers at the same time during the execution of the loop.
• Chromatic number of the graph gives the number of index registers needed.

14
Applications: Logic
Hardware and software specifications

Formal: Input_wire_A
value in {0, 1}

Example 1: Adder
One-bit Full Adder with

Carry-In and Carry-Out

4-bit full adder

Example 2: System Specification:


–The router can send packets to the edge system only if it supports the new address space.
–For the router to support the new address space it’s necessary that the latest software release be
installed.
–The router can send packets to the edge system if the latest software release is installed.
–The router does not support the new address space.
15
How to write these specifications in a rigorous / formal way? Use Logic
Problem Solving requires mathematical rigor

 Your boss is not going to ask you to solve


an MST (Minimal Spanning Tree) or
a TSP (Travelling Salesperson Problem)
 Rarely will you encounter a problem in an abstract
setting
 However, he/she may ask you to build a rotation
of the company’s delivery trucks to minimize fuel
usage
 It is up to you to determine
a proper model for representing the problem and
a correct or efficient algorithm for solving it
Scenario I
 A limo company has hired you/your company to write a
computer program to automate the following tasks for a
large event
 Task1: In the first scenario, businesses request
 limos and drivers
 for a fixed period of time, specifying a start date/time and end
date/time and
 a flat charge rate
 The program must generate a schedule that
accommodates the maximum number of customers
Scenario II
 Task 2: In the second scenario
the limo service allows customers to bid on a ride
so that the highest bidder get a limo when there
aren’t enough limos available
 The program should make a schedule that
Is feasible (no limo is assigned to two or more
customers at the same time)
While maximizing the total profit
Scenario III

 Task 3: Here each customer


is allowed to specify a set of various times and
bid an amount for the entire event.
The limo service must choose to accept the entire set
of times or reject it
 The program must again maximize the profit.
What’s your job?
 Build a mathematical model for each scenario
 Develop an algorithm for solving each task
 Justify that your solutions work
 Prove that your algorithms terminate. Termination
 Prove that your algorithms find a solution when there is
one. Completeness
 Prove that the solution of your algorithms is correct
Soundness
 Prove that your algorithms find the best solution (i.e.,
maximize profit). Optimality (of the solution)
 Prove that your algorithms finish before the end of life on
earth. Efficiency, time & space complexity
The goal of this course
 Give you the foundations that you will use to
eventually solve these problems.
Task1 is easily (i.e., efficiently) solved by a greedy
algorithm
Task2 can also be (almost) easily solved, but requires
a more involved technique, dynamic programming
Task3 is not efficiently solvable (it is NP-hard) by any
known technique. It is believed today that to
guarantee an optimal solution, one needs to look at all
(exponentially many) possibilities
Course Description:
 This class teaches students
 how to think logically and mathematically.
 It stresses mathematical reasoning and different ways to solve
problems.
It enhance your ability to formulate and solve applied problems, to
analyze and interpret algorithms and functions and to use them
effectively.
 It helps you form a logical basis to decompose a given problem into
statements that make sense.

22
Course Outline

 Logic and Proofs


 Sets and Functions
 Relations
 Counting and Recurrence Relations
 Graphs
 Trees
 Number Theory
 Discrete Probability and Finite State Automata

23
TEXT Book:
Discrete Mathematics & its Applications, 7th
edition. By Kenneth H. Rosen.

References Book:
Invitation to Discrete Maths, 2nd edition. By
Matousek and Nesetril.
Discrete Mathematics. By Lovasz, Pelikan and
Vesztergombi.
24
Marks Distribution
Assignments 20%
Mid – I 15%
Mid – II 15%
Final Exam 50%

25
26

You might also like