Вы находитесь на странице: 1из 27

Discrete Structure

(CS2L001)
Dr. P. L. Bera
Assistant Professor
School of Electrical Sciences and Computer Engineering
IIT Bhubaneswar
plb@iitbbs.ac.in

Syllabus
Foundation of Logic: Propositional Logic, Translating english specification in Logic, Applications, Propositional
equivalence, Tautology, Propositional satisfiability, Predicate Logic, Quantifiers, Validity of predicates, Logic
Programming Prolog, Rule of Inference[7L+3T]
Proof Techniques: Introduction to proofs, Proof methods and strategies

[2L + 1T]

Set Theory: Paradoxes in set theory, Inductive definition of sets and proof by induction, Peanos postulates,
Size of a set, Finite and Infinite sets, Countable and uncountable sets, Cantors diagonal argument, Power set
theorem. [3L + 1T]
Functions: Definition, Injections, Surjections, and Bijections, Composition of functions, Inverse functions,
Examples. [2L +1T]
Relations: Properties of relations, Representation of relations, Equivalence relations and partitions, Partial
orderings, posets, Linear and Well-ordered sets. [3L + 1T]

==Mid-Semester===
Graph Theory: Basic properties of graph, degree, path, cycle, subgraphs, directed graphs, isomorphism,
Eulerian and Hamiltonian cycle, connectivity, graph colouring, planner graphs, trees, matching problems,
network flows. [10L +2T]
Induction and Recurrences: Mathematical induction, strong induction and well ordering principle, recursion
and structural induction [3L +1T]
Algebraic Structures and Morphisms: Algebraic structures with one and two binary operations, semigroups,
monoids, groups, rings, fields, lattices, Boolean algebra [4L + 2T]
Probability and Stochastic Processes:

Padmalochan Bera, SES, IIT Bhubaneswar


Discrete Mathematics

Admin Information
Instructor: Dr. P. L. Bera (plb@iitbbs.ac.in)
Teaching Assistant: Madhukrishna Priyadarshini

(mp18@iitbbs.ac.in)
Grading Scheme
Homework/Assignments: 4 (5 points each)
Attendance: 5 points
Minor (mid-sem): 25 points
Major (end-sem): 50 points
Policy on late submission of homework
To be submitted at the beginning of lecture on the deadline
You will loose 25% points per day for late submission of
homework
You must write homework solution by your own
Padmalochan Bera, SES, IIT Bhubaneswar
Discrete Mathematics

Admin Information
Textbook(s):
Discrete Mathematics and Its Applications by K.
H. Rosen (softcopy will be shared)
Introduction to Graph Theory by Douglus B.
West
Reference Book(s):
Elements of Discrete Mathematics by Liu and
Mohapatra
Introduction to Discrete Mathematics by V. K.
Balkrishnan
Lecture slides will be shared
Padmalochan Bera, SES, IIT Bhubaneswar
Discrete Mathematics

Lecture 1: Introduction
Discrete: separate or distinct, not continuous
Ex: Integers or real numbers encoded to integers
Structure: objects that built from some simpler

objects following some rules


Discrete Mathematics: Study of discrete
mathematical structures (sets, propositions,
functions, relations, graphs, etc)
Why study discrete mathematics?
Information processing and computations may be

interpreted as manipulations of discrete structures


To logically reason about the correctness of
computer programs and analyze them
Padmalochan Bera, SES, IIT Bhubaneswar
Discrete Mathematics

Introduction
How to analyze the correctness of the following
program segment:
Swap(int *x, int *y)
f(int x, int y)
{
{ while (x<y) x++;}
t= *x;
*x = *y;
*y = t;
}

Padmalochan Bera, SES, IIT Bhubaneswar


Discrete Mathematics

Introduction
How to analyze the correctness of the following
program segment:
multiply(int left, int right)
{
If (left<0 || right<0) return -1;
else
{int a =left; int b = right; int p=0;
while (a!=0)
{ p+ = (a%2) * b; a/= 2; b*= 2;}
return p;
}
Padmalochan Bera, SES, IIT Bhubaneswar
Discrete Mathematics

Lecture1: Foundation of Logic


Coverage:

Propositional logic, predicate logic,


satisfiability, logic programming prolog, proof
techniques, etc.

Why study logic in computer science?


Proving correctness of a program
Automatic verification
Checking

various properties
system specification

of

protocols

and

Definition: A proposition is a declarative statement

(i.e., a sentence that declares a fact) that is either


true (T) or false (F) but not both
Padmalochan Bera, SES, IIT Bhubaneswar
Discrete Mathematics

Lecture 1: Foundation of
Logic
Are these statements proposition?
Washington D. C is the capital of USA
What time is it?
2+2 =5
1+1 = 2
X+1 = 7
Propositional or statement variables to represent

proposition letters p, q, r, s,..


Truth values true (T) or false (F)
Compound proposition formed of existing
proposition using logical operators/connectives
(
,,, ,
)
Padmalochan Bera, SES, IIT Bhubaneswar
Discrete Mathematics

Lecture 1: Foundation of Logic


Negation (): Let p be a proposition. The negation

of p (denoted by p), is the statement it is not


the case that p.
The proposition p is read as not p. The truth
value of the p is the opposite of the truth value
of p.
Find the negation of the following propositions
Susanths PC runs Linux
Swapnils Smartphone
p
p has at least 32 GB memory

Padmalochan Bera, SES, IIT Bhubaneswar


Discrete Mathematics

10

Lecture 1: Foundation of Logic


Conjunction (): Let p and q be propositions.
The conjunction of p and q (denoted by p q)
is the proposition p and q. The conjunction p
q is true when both p and q are true and is
false otherwise.
p

pq

Padmalochan Bera, SES, IIT Bhubaneswar


Discrete Mathematics

11

Lecture 1: Foundation of Logic


Disjunction (): Let p and q be propositions.

The disjunction of p and q (denoted by p q)


is the proposition p or q. The disjunction p
q is false when both p and q are false and is
true otherwise.
p

pq

Padmalochan Bera, SES, IIT Bhubaneswar


Discrete Mathematics

12

Lecture 1: Foundation of Logic


Exclusive or (): Let p and q be propositions.

The exclusive or of p and q (denoted by p q)


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

pq

Padmalochan Bera, SES, IIT Bhubaneswar


Discrete Mathematics

13

Logic
Implication ( ): Let p and q be propositions. The

conditional statement p q is the proposition that is false


when p is true and q is false, and true otherwise.
q is true on the condition that p is true. This is also called
an implication.
There are various ways to express/read p q:
p is sucient for q or a sucient condition for q is p
q if p
q when p
q is necessary for p or a necessary condition for p is q
q unless p
p implies q
p only if q
q whenever p
q follows from p
Padmalochan Bera, SES, IIT Bhubaneswar
Discrete Mathematics

14

Lecture 1: Foundation of Logic


Definition (Converse): The converse of a

proposition p q is the proposition q p.


Definition (Contrapositive): The contrapositive
of a proposition p q is the proposition q
p.
Definition (Inverse): The inverse of a
proposition p q is the proposition p q.
Show that the contrapositive of p q always

has the same truth value as p q.


Show that, neither converse nor inverse of p
q has the same truth value as p q for all truth
values of p and q.
Padmalochan Bera, SES, IIT Bhubaneswar
Discrete Mathematics

15

Lecture 1: Foundation of Logic


Biconditional Statement: Let p and q be

propositions. The bi-conditional statement p


q is the proposition, p if and only if q. The biconditional statement p q is true if p and q
both having the same truth value and false
otherwise.
You can take the flight iff you buy a ticket

Compound proposition

Padmalochan Bera, SES, IIT Bhubaneswar


Discrete Mathematics

16

Lecture1: Foundation of Logic


Application of Propositional Logic:
Translating English Sentences in logical form
You can access the Internet from campus only if you
are a computer science major or you are not a
freshman.
You can access the internet from the campus
proposition a
You are a computer science major proposition c
You are a freshman proposition f
a (c f )

System requirement specification


System specification should be consistent
Padmalochan Bera, SES, IIT Bhubaneswar
Discrete Mathematics

17

Lecture1: Foundation of
Logic
Determine whether the following system

specification is 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.

Boolean Searches
Logic Puzzles
Designing digital circuit
Padmalochan Bera, SES, IIT Bhubaneswar
Discrete Mathematics

18

Lecture1: Propositional Equivalence


and Tautology
Definition [Tautology]: A compound proposition that is

always true, no matter what the truth values of the


proposition that occurs in it, is called a tautology.
Definition [Contradiction]: A compound proposition that
is always false is called a contradiction. A compound
proposition that is neither a tautology nor a
contradiction is called a contingency.
Examples:
(p p) is a tautology.
(p p) is a contradiction.

Definition

[Logical equivalence]:
A compound
proposition p and q are called logically equivalent if p
q is a tautology. The notation p q denotes that p and
q are logically equivalent.
Padmalochan Bera, SES, IIT Bhubaneswar
Discrete Mathematics

19

Lecture1: Propositional Equivalence


and Tautology

Show that p and q are logically equivalent if

and only if the columns giving their truth


values match
Show that (p q) p q.
Show that (p (p q)) and p q are
logically equivalent by developing a series of
logical equivalences.
Padmalochan Bera, SES, IIT Bhubaneswar
Discrete Mathematics

20

Lecture1: Propositional Equivalence


and Tautology

Padmalochan Bera, SES, IIT Bhubaneswar


Discrete Mathematics

21

Lecture1: Propositional Equivalence


and Tautology

Padmalochan Bera, SES, IIT Bhubaneswar


Discrete Mathematics

22

Lecture1: Satisfiability
A compound proposition is satisfiable if there

is an assignment of truth values to its


variables that makes it true.
When no such assignments exists, that is, when
the compound proposition is false for all
assignments of truth values to its variables, the
compound proposition is unsatisfiable.
NB: a compound proposition is unsatisfiable if
and only if its negation is true for all assignments
of truth values to the variables, that is, if and
only if its negation is a tautology.
Padmalochan Bera, SES, IIT Bhubaneswar
Discrete Mathematics

23

Lecture1: Satisfiability
Ex: Determine whether each of the compound propositions
(p q) (q r) (r p), (p q r) (p q
r), and (p q) (q r) (r p) (p q r)
(p q r) is satisfiable.
Application of Satisfiability: many problems in digital circuit
property verification, robotics, software testing, network
security can be modelled as propositional satisfiability
Ex: Solve sudoku puzzle for 9x9 grid made up of 9 3x3
subgrids called blocks. Write the propositions for
modelling sudoku puzzle problem as propositional
satisfiability.
Padmalochan Bera, SES, IIT Bhubaneswar
Discrete Mathematics

24

Lecture1: Application of Satisfiability


# Solving Sudoku Puzzle

Padmalochan Bera, SES, IIT Bhubaneswar


Discrete Mathematics

25

Lecture1: Solving Sudoku


puzzle
For each cell with a given value, assert p(i, j,

n) when the cell in row i and column j has the


given value n.
9 contains
9 9
Assert every row
every number

p(i, j, n)
i 1 n 1 j 1

9
9
9contains every number
Assert every column

p(i, j , n)
j 1 n 1 i 1

Padmalochan Bera, SES, IIT Bhubaneswar


Discrete Mathematics

26

Lecture1: Solving Sudoku


puzzle
Assert each of the 9 3x3 blocks contains

every number.
2

p(3r i,3s j, n)

r 0 s 0 n 1 j 1 i 1

No cell contains more than one number


9

( p(i, j, n) p(i, j, n' ))[ n n' ]


i 1 j 1 n 1 n '1

Padmalochan Bera, SES, IIT Bhubaneswar


Discrete Mathematics

27

Вам также может понравиться