Unit 4
Unit 4
Noida
Propositional Logic
UNIT-4
Discrete Structures
ANAMIKA TIWARI
B.Tech (CS, DS)
Assistant Professor
IIIrd Sem
B.Tech AIML
INTRODUCTION
ANAMIKA TIWARI
End
Sl. Subject Codes Periods Evaluation Schemes
Subject Name Semester Total Credit
No.
L T P CT TA TOTAL PS TE PE
1. Discrete Structures are useful in studying and describing objects and problems in branches
of computer science such as computer algorithms, programming languages.
2. Computer implementations are significant in applying ideas from discrete mathematics to real-
world problems, such as in operations research.
3. It is a very good tool for improving reasoning and problem-solving capabilities.
4. Discrete mathematics is used to include theoretical computer science, which is relevant to
computing.
5. Discrete structures in computer science with the help of process algebras.
PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO1 PO1 PO1
0 1 2
20CS304.1 3 2 2 - - 1 - - - 1 1 3
20CS304.2 3 3 2 2 1 - - - - - 2 1
20CS304.3 3 3 2 1 - - 3 - 2 2 2 2
20CS304.4 3 3 2 1 - - 1 - - 3 2 2
20CS304.5 3 3 2 1 - - 3 - - 1 3 3
PSO1 PSO2 PSO3 PSO4
20CS304.1 1 2 3 -
20CS304.2 1 2 3 1
20CS304.3 3 2 3 1
20CS304.4 2 3 3 -
20CS304.5 2 3 2
09/18/22 ANAMIKA TIWARI Discrete Structures Unit 4 11
End Semester Question Paper Templates (Offline
Pattern/Online Pattern
Prerequisite
•Basic Understanding of class 10 mathematics NCERT.
•Basic Knowledge of sets and algebraic rules
•Basic Understanding of Set Theory, Relations and Functions &
Algebraic Structures.
•Basic Understanding of Lattices & Boolean Algebra
Recap
Now students are able to develop there logical thinking by
using Sets, Relations, Functions and Mathematical Induction, Algebraic
Structures, Lattices & Boolean Algebra concepts and use in upcoming
topic. i.e. Propositions.
•https://www.youtube.com/watch?
v=Ib5njCwNMdk&list=PLBlnK6fEyqRhqJPDXcvYlLfXPh37L89g3&index=3
•https://www.youtube.com/watch?
v=6kYngPvoGxU&list=PLBlnK6fEyqRhqJPDXcvYlLfXPh37L89g3&index=4
•https://www.youtube.com/watch?v=m2mf6I3g2-
c&list=PLBlnK6fEyqRhqJPDXcvYlLfXPh37L89g3&index=5
•https://www.youtube.com/watch?
v=tACXuzfXzSI&list=PLBlnK6fEyqRhqJPDXcvYlLfXPh37L89g3&index=6
2+2=5 F
1+2=3 T
Example
• Who’s there?
• Just do it!
• La la la la la
• 1+2
• x+2=5
“y > 5”
Is this a proposition? No
Its truth value depends on the value of y, but this value is not
Specified. We call this type of statement a propositional
function or open sentence
• Propositional logic (PL) is the simplest form of logic where all the
statements are made by propositions. A proposition is a
declarative statement which is either true or false. It is a
technique of knowledge representation in logical and
mathematical form.
Example:
• a) It is Sunday.
• b) The Sun rises from West (False proposition)
• c) 3+3= 7(False proposition)
• d) 5 is a prime number.
Example:
P P
P Q P Q
T T T
T F F
F T F
F F F
P Q P Q
T T T
T F T
F T T
F F F
P Q PQ
T T F
T F T
F T T
F F F
P Q PQ
T T T
T F F
F T T
F F T
P Q P Q
T T T
T F F
F T F
F F T
P Q P Q (P)(Q)
T T F F F
T F F T T
F T T F T
F F T T T
P Q P Q (PQ) (P)(Q)
T T T F F
T F F T T
F T F T T
F F F T T
Logical equivalence:
• Logical equivalence is one of the features of propositional
logic. Two propositions are said to be logically equivalent if
and only if the columns in the truth table are identical to each
other.
• Let's take two propositions A and B, so for logical equivalence,
we can write it as A⇔B. In below truth table we can see that
column for ¬A∨ B and A→B, are identical hence A is
Equivalent to B
T T F F T
T F T T T
F T T T T
F F T T T
Properties of Operators:
• Commutativity:
– P∧ Q= Q ∧ P, or
– P ∨ Q = Q ∨ P.
• Associativity:
– (P ∧ Q) ∧ R= P ∧ (Q ∧ R),
– (P ∨ Q) ∨ R= P ∨ (Q ∨ R)
• Identity element:
– P ∧ True = P,
– P ∨ True= True.
• Distributive:
– P∧ (Q ∨ R) = (P ∧ Q) ∨ (P ∧ R).
– P ∨ (Q ∧ R) = (P ∨ Q) ∧ (P ∨ R).
• DE Morgan's Law:
– ¬ (P ∧ Q) = (¬P) ∨ (¬Q)
– ¬ (P ∨ Q) = (¬ P) ∧ (¬Q).
• Double-negation elimination:
– ¬ (¬P) = P.
Rules of Inference
Inference:
• In we need intelligent computers which can create new logic from old
logic or by evidence, so generating the conclusions from evidence and
facts is termed as Inference.
Inference rules:
• Inference rules are the templates for generating valid arguments.
Inference rules are applied to derive proofs in artificial intelligence, and
the proof is a sequence of the conclusion that leads to the desired goal.
• In inference rules, the implication among all the connectives plays an
important role. Following are some terminologies related to inference
rules:
2. Modus Tollens:
• The Modus Tollens rule state that if P→ Q is true and ¬ Q is
true, then ¬ P will also true. It can be represented as:
3. Hypothetical Syllogism:
• The Hypothetical Syllogism rule state that if P→R is true
whenever P→Q is true, and Q→R is true. It can be
represented as the following notation:
• Example:
Statement-1: If you have my home key then you can unlock
my home. P→Q
Statement-2: If you can unlock my home then you can take
my money. Q→R
Conclusion: If you have my home key then you can take my
money. P→R
Proof by truth table:
4. Disjunctive Syllogism:
• The Disjunctive syllogism rule state that if P∨Q is true, and ¬P
is true, then Q will be true. It can be represented as:
Example:
Statement-1: Today is Sunday or Monday. ==>P∨Q
Statement-2: Today is not Sunday. ==> ¬P
Conclusion: Today is Monday. ==> Q
• Proof by truth-table:
5. Addition:
• The Addition rule is one the common inference rule, and it
states that If P is true, then P∨Q will be true.
Example:
• Statement: I have a vanilla ice-cream. ==> P
Statement-2: I have Chocolate ice-cream.
Conclusion: I have vanilla or chocolate ice-cream. ==> (P∨Q)
Proof by Truth-Table:
6. Simplification:
• The simplification rule state that if P∧ Q is true, then Q or
P will also be true. It can be represented as:
• Proof by Truth-Table:
7. Resolution:
• The Resolution rule state that if P∨Q and ¬ P∧R is true, then
Q∨R will also be true. It can be represented as
• Proof by Truth-Table:
– Function: Father of, best friend, third inning of, end of, ......
• Constant
1, 2, A, John, Mumbai, cat,....
• Variables
x, y, z, a, b,....
• Predicates
Brother, Father, >,....
• Function
sqrt, LeftLegOf, ....
• Connectives
∧, ∨, ¬, ⇒, ⇔
• Equality ==
• Quantifier ∀, ∃
Atomic sentences:
• Atomic sentences are the most basic sentences of first-order logic. These
sentences are formed from a predicate symbol followed by a parenthesis
with a sequence of terms.
• We can represent atomic sentences as Predicate (term1, term2, ......,
term n).
Complex Sentences:
• Complex sentences are made by combining atomic sentences using
connectives.
Universal Quantifier:
• Universal quantifier is a symbol of logical representation,
which specifies that the statement within its range is true for
everything or every instance of a particular thing.
• The Universal quantifier is represented by a symbol ∀, which
resembles an inverted A.
• Note: In universal quantifier we use implication "→".
• If x is a variable, then ∀x is read as:
For all x
For each x
For every x
Points to remember:
• The main connective for universal quantifier ∀ is
implication →.
• The main connective for existential quantifier ∃ is and ∧.
Properties of Quantifiers:
• In universal quantifier, ∀x∀y is similar to ∀y∀x.
• In Existential quantifier, ∃x∃y is similar to ∃y∃x.
• ∃x∀y is not similar to ∀y∃x.
Equality:
• First-Order logic does not only use predicate and terms for
making atomic sentences but also uses another way, which is
equality in FOL. For this, we can use equality symbols which
specify that the two terms refer to the same object.
Example: Brother (John) = Smith.
• As in the above example, the object referred by the Brother
(John) is similar to the object referred by Smith. The equality
symbol can also be used with negation to represent that two
terms are not the same objects.
Example: ¬ (x=y) which is equivalent to x ≠y.
1. Universal Generalization:
• Universal generalization is a valid inference rule which states
that if premise P(c) is true for any arbitrary element c in the
universe of discourse, then we can have a conclusion as ∀ x
P(x).
• It can be represented as:
• This rule can be used if we want to show that every element
has a similar property.
• In this rule, x must not appear as a free variable.
• Example: Let's represent, P(c): "A byte contains 8 bits", so
for ∀ x P(x) "All bytes contain 8 bits.", it will also be true.
4. Existential introduction
• An existential introduction is also known as an existential
generalization, which is a valid inference rule in first-order
logic.
• This rule states that if there is some element c in the universe
of discourse which has a property P, then we can infer that
there exists something in the universe which has the property
P.
• It can be represented as:
• Example: Let's say that,
"Priyanka got good marks in English."
"Therefore, someone got good marks in English.
Q11 What is the value of x after this statement, assuming initial value of x is 5?‘If x
equals to one then x=x+2 else x=0’.
a) 1 b) 3
c) 0 d) 2
Q12 Let P: I am in Bangalore. , Q: I love cricket. ; then q -> p(q implies p) is:
a) If I love cricket then I am in Bangalore
b) If I am in Bangalore then I love cricket
c) I am not in Bangalore
d) I love cricket
Q13. Let P:If Sahil bowls, Saurabh hits a century. ,Q: If Raju bowls , Sahil gets out
on first ball. Now if P is true and Q is false then which of the following can be
true?
a) Raju bowled and Sahil got out on first ball
b) Raju did not bowled
c) Sahil bowled and Saurabh hits a century
d) Sahil bowled and Saurabh got out
3. Let p be “Kailash reads Newsweek” , let “Kailash reads the New Yorker”
and let r be “Kailash reads Times”. Write each of following in symbolic
form:
(a) Kailash reads Newsweeks or The New Yorker, but not Times.
(b) Kailash reads Newsweeks and The New Yorker or he does not
read Newsweeks and Times.
(c) It is not true that Kailash reads Newsweek but not Times.
10.Show that the premises “It is not sunny this afternoon and it is
colder than yesterday,” “We will go swimming only if it is sunny,” “If
we do not go swimming, then we will take a canoe trip,” and “If we
take a canoe trip, then we will be home by sunset” lead to the
conclusion “We will be home by sunset.”