0% found this document useful (0 votes)
222 views36 pages

Discrete Mathematics Concepts in Programming

Discrete mathematics is the study of mathematical concepts and notations that are useful in computer science fields like algorithms, programming languages, cryptography, and software development. The syllabus covers topics like logic, relations and functions, counting techniques, graphs and trees. Propositional logic involves logical connectives like conjunction, disjunction, implication, biconditional, and negation. Truth tables are used to determine the truth values of compound propositions formed using these logical connectives.

Uploaded by

Shakeb Rahman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
222 views36 pages

Discrete Mathematics Concepts in Programming

Discrete mathematics is the study of mathematical concepts and notations that are useful in computer science fields like algorithms, programming languages, cryptography, and software development. The syllabus covers topics like logic, relations and functions, counting techniques, graphs and trees. Propositional logic involves logical connectives like conjunction, disjunction, implication, biconditional, and negation. Truth tables are used to determine the truth values of compound propositions formed using these logical connectives.

Uploaded by

Shakeb Rahman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Discrete Mathematics

KLEF Dept. Of Mathematics


Importance
Discrete mathematics is the study of mathematics.  Concepts
and notations from discrete mathematics are useful in
studying and describing objects and problems in branches of
computer science, such as computer algorithms, programming
languages, cryptography, automated theorem proving, and
software development.

KLEF Dept. Of Mathematics


03/30/2023 Dr. S. Ragamayi, [Link] in Mathematics 2
Syllabus
Logic: Propositional Logic, Logical connectives , Propositional
Equivalences, Converse, Inverse, and contra positive; Rules of
Inference of Propositions, validity of arguments, Predicates and
Quantifiers, Rules of Inference of quantified statements.

Relation and Function: Definitions and Properties, Operations on


Relations, Equivalence Relations, Representation of relations by
binary matrices and digraphs, Partial Order, Partial ordered sets,
Lattices, Isomorphism of Lattices - Boolean Algebra and Boolean
Functions, Representations of Boolean functions.

KLEF Dept. Of Mathematics


03/30/2023 Dr. S. Ragamayi, [Link] in Mathematics 3
Syllabus
Basic and Advanced Counting Techniques: Pigeonhole Principle,
Recurrence Relation: Linear Homogeneous Recurrence Relations
with Constant Coefficients, Linear Nonhomogeneous Recurrence
Relations with Constant Coefficients, Generating functions,
Solution of Linear recurrence Relations using Generating
functions.
 
Graphs and Trees : Definition, Types of graphs, degree of
graph(Undirected and directed), Graph Isomorphism, Walk, path,
cycle, and circuit; cut-vertex, cut-edge, Euler graph, Hamiltonian
graph, planar graphs, chromatic number Graph Coloring,
Introduction to Trees, Applications of Trees, Spanning Tree,
Minimal Spanning Trees.
KLEF Dept. Of Mathematics
03/30/2023 Dr. S. Ragamayi, [Link] in Mathematics 4
5

Propositional Logic

Logical Equivalences
Main
Contents in Rules of Inference
Logic
Predicate Logic

Notion Of Proofs
K03/30/2023
LEF Dept. Of Mathematics
Dr. S. Ragamayi, [Link] in Mathematics
SESSION-1
Fundamentals of Logic

KLEF Dept. Of Mathematics


Dr. S. Ragamayi, [Link] in Mathematics 6
History and Use
 The development of propositional logic came only much later with
the advent of symbolic logic in the work of logicians developed by
Augustus and DeMorgan (in 1806-1871).
 Later, George Boole (in 1815-1864) was developed and replaced a
mathematical-style in “algebra” by Aristotelian syllogistic logic by
employing the numeral “1” for the universal class, the numeral “0”
for the empty class.
 Propositional Logic (statement Logic) is the branch of Logic
 It is used to understand and symbolized complicated statements
which can bear the truth values of natural languages.
 It is helpful in developing text in algorithms.
 It is helpful to deduct the classical truth-functional propositional logic
into Modal propositional logic in system understandable Languages.
KLEF Dept. Of Mathematics
03/30/2023 Dr. S. Ragamayi, [Link] in Mathematics 7
Propostional Logic
Sentence: A sentence is usually collection of words
Proposition: A proposition is usually a declarative sentence for which we
can assign truth values i.e. either “true” or “false” but not both.
The words Proposition/ statement / premise, all are having same meaning.
Note: all propositions are sentences but all sentences need not be a
proposition.

Examples – Propositions
1 Sachin is a cricket player. True Proposition
2 2+2=10 False Proposition
3 New Delhi is the capital of India True Proposition

KLEF Dept. Of Mathematics


03/30/2023 Dr. S. Ragamayi, [Link] in Mathematics 8
Examples – Non propositions (sentences):

1) 2+x=10
2) What a beautiful morning!
3) Get up and do your exercises
4) The number x is an integer.
5) Are you busy?
6) What is your name?
7) Read the paragraph carefully
8) X+5=7

KLEF Dept. Of Mathematics


03/30/2023 Dr. S. Ragamayi, [Link] in Mathematics 9
Logical connectives or operators
Operator Symbol General
Name usage
Conjuction ˄ “and”
Disjunction ˅ “Or”
Conditional → “If-then”
or
implication
Bi- ↔ “ If and only
conditional if”
Negation ˥ or ~ “Not”

KLEF Dept. Of Mathematics


03/30/2023 Dr. S. Ragamayi, [Link] in Mathematics 10
Compound statements
If one or more statements are connected with Logical
operators, then resultant statement is known as
compound statement.
Examples:
p: I study hard q: I get Grade A
pɅq = I study hard and I get Grade A
p V q = I study hard or I get Grade A
p→ q = If I study hard then I get Grade A
p↔q = (p→ q ) Ʌ (q → p)
(If I study hard then I get Grade A) and
(If I get Grade A then I study hard )
~p = I don’t study hard
KLEF Dept. Of Mathematics
03/30/2023 Dr. S. Ragamayi, [Link] in Mathematics 11
Truth tables of compound statements

Truth table for Negation of


a proposition

KLEF Dept. Of Mathematics


Dr. S. Ragamayi, [Link] in Mathematics 03/30/2023 12
Truth tables of compound statements

Truth table for conjunction of


two propositions

KLEF Dept. Of Mathematics


Dr. S. Ragamayi, [Link] in Mathematics 03/30/2023 13
Truth tables of compound statements

Truth table for Disjunction of


two propositions

KLEF Dept. Of Mathematics


Dr. S. Ragamayi, [Link] in Mathematics 03/30/2023 14
Truth tables of compound statements

Truth table for


Implication/Conditional of two
propositions

KLEF Dept. Of Mathematics


Dr. S. Ragamayi, [Link] in Mathematics 03/30/2023 15
Truth tables of compound statements

Truth table for Bi-Conditional


of two propositions

KLEF Dept. Of Mathematics


Dr. S. Ragamayi, [Link] in Mathematics 03/30/2023 16
Negation:
Example:
P: sachin is a batsman.
~P: sachin is not a batsman

KLEF Dept. Of Mathematics


03/30/2023 Dr. S. Ragamayi, [Link] in Mathematics 17
Conjunction:
Example:
P: sachin is a batsman.
Q: sachin is a bowler

P ^ Q: sachin is batsman and he is a bowler


~P ^ Q: sachin is not a batsman and he is a bowler
P ^ ~Q: sachin is a batsman and he is not a bowler
~P ^ ~Q: neither sachin is a batsman nor bowler
(or)
sachin is not batsman and not a bowler
KLEF Dept. Of Mathematics
03/30/2023 Dr. S. Ragamayi, [Link] in Mathematics 18
Conditional:
Example:
P: 2 sides of a triangle are equal
Q: triangle is isosceles

p →q: if 2 sides of a triangle are equal then it is isosceles


q→p: if triangle is isosceles then 2 sides of a triangle are equal
~p→q: if 2 sides of a ∆ are not equal then it is isosceles.
p →~q: if 2 sides of a ∆ are equal then it is not isosceles.
KLEF Dept. Of Mathematics
03/30/2023 Dr. S. Ragamayi, [Link] in Mathematics 19
Disjunction:
Example:
P: sachin is a foot ball player.
Q: sachin is a cricketer.

P VQ: sachin is a foot ball player or cricketer.


~PVQ: sachin is not a foot ball player or cricketer.
PV~Q: sachin is a foot ball player or he is not a cricketer
~PV~Q: sachin is not a foot ball player or not a cricketer
KLEF Dept. Of Mathematics
03/30/2023 Dr. S. Ragamayi, [Link] in Mathematics 20
Bi-Conditional:
Example:
P: 2 sides of a triangle are equal
Q: triangle is isosceles

p ↔q: 2 sides of a trianle are equal iff it is isosceles.


q ↔p: Triangle is isosceles if and only if 2 sides of ∆ are equal
~p ↔q: 2 sides of triangle are not equal if and only if it is isosceles

KLEF Dept. Of Mathematics


03/30/2023 Dr. S. Ragamayi, [Link] in Mathematics 21
Construct Truth table for (pV~q)→(pɅq)

KLEF Dept. Of Mathematics


03/30/2023Dr. S. Ragamayi, [Link] in Mathematics 22
Tautology:
If the truth value of a compound proposition is “TRUE” for all
possible truth values of the propositions present in the compound
proposition, then that compound proposition is known as a Tautology.

Example: PV~P

p ~p pV~p
T F T
F T T
KLEF Dept. Of Mathematics
03/30/2023 Dr. S. Ragamayi, [Link] in Mathematics 23
Contradiction:
If the truth value of a compound proposition is “FALSE” for all
possible truth values of the propositions present in the compound
proposition, then that compound proposition is known as a
Contradiction.
Example: PɅ~P

p ~p pɅ~p
T F F
F T F

KLEF Dept. Of Mathematics


03/30/2023 Dr. S. Ragamayi, [Link] in Mathematics 24
Contingency:
If the truth value of a compound proposition is either“TRUE” or
“FALSE” for all possible truth values of the propositions present in
the compound proposition then that compound proposition is
known as a Contingency.
p q pVq (pVq)→p

T T T T
Example: (pVq)→p
T F T T
F T T F
F F F T

KLEF Dept. Of Mathematics


03/30/2023 Dr. S. Ragamayi, [Link] in Mathematics 25
Problems
Q1: Identify which of the following are sentences or propositions?
a) Washington d.c. is the capital of United states of America.
b) for x=2, x + 7 = 5.
c) x + 3 = 5
d) Did you understand?

ANSWERS
a) Proposition
b) Proposition
c) Sentence
d) Sentence

KLEF Dept. Of Mathematics


03/30/2023 Dr. S. Ragamayi, [Link] in Mathematics 26
Problems
Q2:
Let p and q be the propositions
p : I bought a lottery ticket this week.
q : I won the million-dollar jackpot.
Express each of the following propositions in words.
1) ¬ p 2) p ∨ q 3) p → q
4) p ∧ q 5) p ↔ q 6) ¬ p → ¬ q
7) ¬ p ∧ ¬ q8) ¬ p ∨ (p ∧ q)

KLEF Dept. Of Mathematics


03/30/2023 Dr. S. Ragamayi, [Link] in Mathematics 27
Answers
1. ¬ p : I don't buy a lottery ticket this week.

2. p ∨ q: either I bought a lottery ticket this week or I won the million-dollar


jackpot.
3. p → q: If I bought a lottery ticket this week then I won the million-dollar
jackpot.
4. p ∧ q : I bought a lottery ticket this week and I won the million-dollar jackpot.

5. p ↔ q : If I bought a lottery ticket this week then I won the million-dollar jackpot
and If I won the million-dollar jackpot then I bought a lottery ticket this week .
6. ¬ p → ¬ q: If I don’t buy a lottery ticket this week then I don’t win the
million-dollar jackpot.

KLEF Dept. Of Mathematics


03/30/2023 Dr. S. Ragamayi, [Link] in Mathematics 28
Practice Problems:
Construct the truth tables for the following
1. [(pVq) Ʌ(~r)] ↔q
2. (pVq) Ʌ( (~p) V (~r) )
3. {(p Ʌ q)V(~p Ʌ r)} v (q Ʌ r)
4. [ (pVq) Ʌ (~r) ] ↔ (q→r)

Prove the following are tautologies


a) (p ∧ q) → p b) p → (p ∨ q)
c) ¬ p → (p → q) d) (p ∧ q) → (p → q)
e) ¬ (p → q) → p f ) ¬ (p → q)→ ¬ q

KLEF Dept. Of Mathematics


03/30/2023Dr. S. Ragamayi, [Link] in Mathematics 29
NPTEL links/youtube links

[Link]
[Link]
[Link]
[Link]
[Link]

KLEF Dept. Of Mathematics


03/30/2023 Dr. S. Ragamayi, [Link] in Mathematics 30
KLEF Dept. Of Mathematics
03/30/2023 Dr. S. Ragamayi, [Link] in Mathematics 31
KLEF Dept. Of Mathematics
03/30/2023 Dr. S. Ragamayi, [Link] in Mathematics 32
Polling Questions

K L E03/30/2023
F Dept. Of Mathematics
Dr. S. Ragamayi, [Link] in Mathematics
33
This Photo by Unknown Author is licensed under CC BY-ND
1. Which of the following are statements?

a) x + y > 5

b) x = 3
c) Are you leaving?
d) 4+6 = 9

Answer: d

KLEF Dept. Of Mathematics


03/30/2023Dr. S. Ragamayi, [Link] in Mathematics 34
2) Which of the following is not a proposition?

a) Where do you live?

b) Sachin is a cricket player.


c) There is at least one x such that x+2=5.
d) 2+3=6

Answer: a

KLEF Dept. Of Mathematics


03/30/2023Dr. S. Ragamayi, [Link] in Mathematics 35
3) If p: Ram is a teacher, q: Mohan is an honest boy, then
translate the following into logical sentences: p → ¬q

a) If Ram is a teacher then Mohan is not an honest boy.

b) Ram is not a teacher iff Mohan is an honest boy

c) If Ram is not a teacher then Mohan is an honest boy.

d) Ram is not a teacher and Mohan is an honest boy.

Answer: a

KLEF Dept. Of Mathematics


03/30/2023Dr. S. Ragamayi, [Link] in Mathematics 36

You might also like