1. Propositions Logic and Predicates
1. Propositions Logic and Predicates
Propositional Logic
Note:
Introduction: y Factual statements are part of the
It has a large amount of applications in “set of all English statements” which
mathematics. It is used to prove theorems. is used to conclude something. These
Every theorem consists of various statements factual statements in mathematical
which ultimately reach a conclusion. To logic are called proportional logic.
check the validation of these statements, y Factual statements are facts which
logic is required. Mathematical logic tells us have only two cases yes(true)/no(false)
whether the statement is valid or not. Now, y Any question, command exclamation,
the question that may arise is, from where vague reference will never be a
do all these statements come from? So, all proposition.
these statements come from a set of all
English statements.
1. Which of the following is/are not
proposition?
(A) x + 2 = 5
Factual statement
(B) He is tall
(C) Today is Monday
Set of all
English statement (D) Tomorrow will be rain
Fig. 1.1 Solution: (A), (B), (C), (D)
Definition
Rack Your Brain
Proposition: Proposition is a logical
statement which can be true or false but Is “Read this carefully” a proposition?
not both.
e.g: 1. 2 + 2 = 4 Atomic and compound proposition:
2. 'C' is a vowel The Propositional statement is of two types
1. Compound propositional statement
2. Atomic propositional statement
Breakable Non-breakable
p
T
Compound propositional
propositional sta
statemen
statement
tementt
Connectives
Fig. 1.3
Note: F F F
A unary operation is an operation which Table 2 The Truth Table for Conjunction of
can be implemented on single proposition. Proposition
Note:
Definition
In the truth table, we mention the cases.
Negation: Let p be a proposition. The As we all know, the compound statement
“negation of p”, denoted by ¬ p (also by is nothing but a group of some atomic/
p ), simple statements. We generate cases out
of these atomic statements to reach the
is the statement “It is not the case that
conclusion of the compound statement.
p”. The proposition p is read as “not p”.
The truth value of p is the opposite of
the truth value of p.
e.g: Let a proposition p = I am Michel.
The negation of p( p ) = I am not Michel. Rack Your Brain
Definition
Note:
Conjunction: Conjunction is similar to
In mathematics, we always use (v) inclusive
performing AND operation between two
OR, until and unless it is mentioned as ⊕
variables. Conjunction between two
proposition will be true only when both
the propositions are true otherwise it
will always be false.
F T T
hypothesis/ conclusion/
F F F
antecedent/ consequence
Table 3 Table for Disjunction Using Inclusive OR
premisea
For example,
“Students who have taken calculus or
computer science can take this class”.
p q p→q
With this statement, we mean that those
students who have taken either calculus or T T T
computer science can take the class also,
the students who have taken both can take T F F
the class.
F T T
Exclusive OR:
F F T
Using exclusive OR, we can reframe the
sentence as Table 5 The Truth Table for the Conditional
Statement p → q
“Students who have taken calculus or
computer science, but not both can take the Differents form of Implication (→):
class”.
p ® q can be written as:
y p implies q
q q p⊕q y if p then q
y if p, q
T T F y q if p
y q when p
T F T y q whenever p
y q unless p
F T T
y p only if q
F F F y a sufficient condition for q is p
y q whenever p
Table 4 Table for Disjunction Using Exclusive OR y q is necessary for p
y q follows from p
Convert the given statement into Let p be the statement “Maria learns
propositional logic form discrete mathematics” and q be the
p: I stay statement “Maria will find a good
q: you go job”. Express the statement p → q as a
1. I stay if you go statement in English.
2. I stay only if you go
3. I stay unless you go Converse, contrapositive, and inverse:
4. you go when I stay These are different types of conditional
statements.
Let us consider an implication p → q
1. If you win, I will give you pizza.
y Contrapositive ~q → ~p
Solution: y Converse q → p
The statement can be interpreted as: if you y Inverse ~p → ~q
win the match, then I will give you pizza. Law of contrapositive:
Implication and its contrapositive are
Case 1: Let p be the proposition “ If you win”
equivalent
(hypotheses) and q be conclusion “I will give
you pizza”. p → q ≡~ q →~ p
Case 1 says p and q both are true, means “If Converse and Inverse are equivalent.
you win, I will give you pizza” which is true. q → p ≡ ~ p →~ q
∴ p → q = True.
→ 4
↔ 5
Rack Your Brain
Table 7 Precedence of Logical Operators
Translation to
English Sentences
Boolean System
Searches Specifications
Applications of
Propositional Logic
Fig. 1.4
Mathematical logic has a vast number of in the hardware, we use basic circuits
applications. Some of them we have already called gates to form the combinational
mentioned. But we will limit our discussion circuit.
to only two applications i.e.
(A) AND gate: It takes two signals as input
(i) Translating English sentences
and produces (p ∧ q) signal as output.
(ii) Logic circuits
y Translating English sentences: p
English is very ambiguous; to resolve p q
v
q
that ambiguity, we translate these
sentences into compound statements. Fig. 1.5
y Example: (B)
Or gate: It takes two signals as input and
Convert given sentence into a logical gives (p ∨ q) signal as output.
form:
p
“You can not ride the roller coaster if pv q
you are under 4 feet tall unless you are q
Fig. 1.6
older than 16 years old.”
y Solution: (C) Not gate/inverters:
Let p, q, r represent “You can ride the It takes p as input and produces ( p ) as
roller coaster,” “you are under 4 feet output.
tall”; and “you are older than 16 years
p p
old”.
Fig. 1.7
∴ The sentence can be translated to
(q ∧ Ø r) → p y Combinatorial circuit:
p q
y Logic circuits: Logic is also used to p
v
q
design hardware, which takes the input q
signal and produces output signals. As (p v q) v r
we use connectives negation etc., to
r
form compound statements, similarly, r
Fig. 1.8
p q p→q Øp ∨ q
0 0 1 1 Note:
0 1 1 1 Contradiction is also known as fallacy or
invalid.
1 0 0 0
1 1 1 1 Satisfiable:
Table 1.10
A proposition that is either a tautology or a
Now, p → q and Ø p ∨ q are precisely same.
contingency is called satisfiable.
∴B oth boolean expressions are logically
Example:
equivalent.
(p q r) s
Tautology:
If a given proposition turns out to be always
true, then it is called a tautology. q r s (p Ù q Ù r)→s
Example:
T T T F
pÚ~p
T T F T
p ~q p ∨ ~p Contingency so
satisfiable
T F F Proposition
F T T
Satisfiable Unsatisfiable
Contradiction / fallacy
Contradiction: Tautology
(valid)
Contingency
(some time true and (always false)
(Always true) some time false)
If a given proposition turns out to be always
Fig. 1.9
false, then that proposition is a contradiction.
Example:
pÙ~p
Rack Your Brain
p ~p p Ù ~p Choose the correct option:
1. All valids are satisfiable
T F F 2. All contingency are satisfiable
F T T 3. All satisfiable are contingency
4. None
Applications of satisfiability:
Sudoku
Robotics Genetics Puzzles
Applications of
Satisfiability
Fig. 1.10
Double f↔s ≡ (f → s) ∧ (s → f)
Ø(ØF) ≡ F
negation law f↔s ≡ Øf↔ Øs
F∨s≡s∨F Commutative f↔s ≡ (f ∧ s) ∨ (Ø f ∨ Ø s)
F∧s≡s∧F laws Ø (f ↔ s) ≡ f↔ Øs
4.
Use De Morgan’s law to express the p
negation of “Maya will go to fare or Abdul Addition p → (p ∨ q)
∴p ∨ q
will go to fare”.
p
Solution:
q ([p] ∧ [q])
⇒ Let p = Maya will go to fare Conjunction
∴p ∧ q → (p ∧ q)
q = Abdul will go to fare
Can be represented by p ∨ q
Now, the negation of p ∨ q = Ø (p ∨ q) p∧q
Simplification (p ∧ q) → p
According to De Morgan’s law Ø (p ∨ q) = Ø ∴p
p ∧ Øq
Which states that Maya will not go to fare p→q
and Abdul will not go to the fare. Modus p (p ∧ [P →
ponens q]) → q
∴q
5. Use De-Morgan’s law, to show Ø (p ∨ ( Ø p
∧ q)) and Ø p ∧ Ø q are logical equivalent. p→q
Solution: ([p → q) ∧
Hypothetical q→r
(q → r]) →
Ø (p ∨ (Ø p ∧ q)) [using De Morgan law] syllogism ∴p →r (p → r)
Ø p ∧ Ø (Ø p ∧ q)
p∨q
Ø p ∧ [Ø (Ø p) ∨ Ø q] Disjunctive ¬p ([p ∨ q) Ø
Ø P ∧ (p ∨ Ø q) [Using distributive law] syllogism p] → q
∴q
(Ø p ∧ p) ∨ (Ø p ∧ Ø q)
p→q (Ø q ∧ [p
F ∨ (Ø p ∧ Ø q) ( Ø p ∧ p ≡ F) Modus ¬q → q]) →
tollens
Ø p ∧ Øq [using commutative law of ∴ ¬p Øp
disjunction]
p∨q ([p ∨ q) ∧
Hence, proved, Ø (p ∨ (Ø p ∧ q)) is logically
Resolution ¬p ∨ r (Ø p ∨ r])
equivalent to Ø p ∧ Ø q.
∴q∨ r → (q ∨ r)
The general form of an argument: (Inference)
The process of deriving the conclusion based Table 14 Rules of Inference
on assumption is called an argument.
The conjunction of premises implies a 6. “If Vinay comes to the ceremony, Atul
conclusion. will not come to the ceremony. If Atul
(p1 Ù p2 Ù ...pn) ® q doesn’t come to the ceremony, Siddhu
An inference which is tautology called valid will come to the ceremony.”
inference otherwise invalid inference. Solution:
Rule of inference: Let the propositions be as follows:
Any valid inference is the rule of inference. p: Vinay comes to the ceremony.
Note:
Normal forms: The method of reducing a
With n variable, 2( ) boolean functions
2n
given formula to an equivalent form is called
can be represented. ‘normal form’.
There are two types of standard normal
y The set {∧, Ø} is said to be functionally forms:
complete or minimal functionally
complete set. 1. PDNF (Principal disjunctive normal form)
y The set {∨, Ø} is also functionally complete. 2. PCNF (Principal conjuctive normal form)
Considering m for minterm and M for
y The set {∧, ∨} is not functionally complete
maxterm.
as we can not generate “not” with the of
“AND” and "OR".
Note:
Note: Number of terms in PDNF + Number of
A set is said to be functionally complete terms in PCNF = 2n
if we can derive a set which is already
functionally complete. After solving the boolean function.
If the conclusion is ‘1’ then it’ll be considered
Minimally functionally complete set: A set is in minterms maxterm otherwise.
said to be minimally functionally complete PDNF: Disjunction of min terms
if:
PCNF: Conjunction of max terms
y It is functionally complete
0 = False
E.g., p ↔ (q ® r’)
1 = True
0 0 0 1 0 m0 M0 = p ∨ q ∨ r
0 0 1 1 0 m1 M1 = p ∨ q ∨ r'
0 1 0 1 0 m2 M2 = p ∨ q' ∨ r
1 0 0 1 1 m4 = p ∧ q' ∧ r' M4
1 0 1 1 1 m5 = p ∧ q' ∧ r' M5
1 1 0 1 1 m6 = p ∧ q ∧ r' M6
Place where propositional logic can not work, Statements that describe valid input are
predicate logic comes into the picture. To known as pre-conditions, and the condition
understand predicate logic, let’s first learn that the output should satisfy when the
about predicate properly. program has run is called post-conditions.
Predicates: Quantifiers:
Consider statement, “ x is greater than 5". Quantification is a way to create a proposition
from a propositional function.
y The subject part: Variable itself
y The predicate part: Is greater than 5
so we can denote this statement as P(x), Note:
where P is the predicate part and x is variable. The area of logic that deals with predicate
When the value is assigned to the variable and quantifiers is called predicate logic.
predicate is converted to propositional logic.
Fig. 1.11
Equivalent
Negation Why True Why False
Statement
Aristotle form:
1. All p’s are Q’s x[p(x) Q(x)]
2. Some p’s are Q’s x[p(x) Q(x)] Rack Your Brain
3. Not all p’s are Q’s ~ x[p(x) Q(x)]
x[p(x) ~ Q(x)] Some real no’s are not rational.
Some p’s are not Q’s
1. x[real(x) ∨ rational (x)]
4. No p’s are Q’s ~x[p(x) Q(x)] 2. x(real(x) rational (x)]
x[p(x) ~ Q(x)] 3. ~x[real(x) ∧ ~rational (x)]
All p’s are not Q’s 4. x[rational(x) real (x)]
Note:
follow implication ()
follow and (∨).
∀x∀y P(x, y) P(x, y) is true for every pair x, y. There is a pair x, y for which P(x,
y) is false.
∀y∀x P(x, y)
∀x∃y P(x, y) For every x, there is a y for There is an x such that P(x, y) is
which P(x, y) is true. false for every y.
∃x ∀y P(x, y) There is an x for which P(x, y) For every x, there is a y for which
is true for every y. P(x, y) is false.
∃x∃y P(x, y) There is a pair x, y for which P(x, y) is false for every pair x, y.
P(x, y) is true.
∃y∃x P(x, y)
Table 1.22 Quantification of Two Variables
1. x y p(x,y) y x p(x,y)
Previous Years’ Questions
2. x y p(x,y) x y p(x,y)
3. x y p(x,y) y x p(x,y)
Which of the following is negation of:
4. x y p(x,y) y x p(x,y)
[GATE CSE 2008]
[∀ x, α (∃y, β (∀u, ∃v, y))] 5. y x p(x,y) x y p(x,y)
(A) [∃x, α (∀y, β (∃u, ∀v, y))] 6. x y p(x,y) y x p(x,y)
(B) [∃ x, α (∀y, β (∃u, ∀v, ¬y))] 7. y x xp(x,y) x y p(x,y)
(C) [∀x, ¬ α (∃y, ¬ β (∀u, ∃v, ¬y))] 8. y x p(x,y) y x p(x,y)
(D) [∃x, α∧ (∀y, β ∧(∃u, ∀v, ¬y))] 9. y x p(x,y) x y p(x,y)
Solution: (D) 10. y x p(x,y) x y p(x,y)
Quantifiers property:
Previous Years’ Questions
1. x [p(x) Q(x)] x p(x) x Q(x)
Consider the following formula and its 2. x[p(x) Q(x)] x p(x) x Q(x)
two interpretations I1 and I2. 3. x p(x) x Q(x) x[p(x) Q(x)]
[GATE CSE 2003] 4. x[p(x) Q(x)] x p(x) x Q(x)
α: (∀x) [Px ↔ (∀y) [Qxy ↔ Qyy]] (∀x) [¬ Px]
5. x[p(x) Q] x p(x) Q
l1: Domain: The set of natural numbers.
6. x[p(x) Q] x p(x) Q
Px ≡ xis a prime number
Qxy ≡ ydivides x 7. x[p(x) Q] x p(x) Q
l2: same as l1 except that px= x is a 8. x[p(x) Q] x p(x) Q
composite number. 9. x[pQ(x)] px Q(x)
Which of the following is true? 10. x[p Q(x)] p x Q(x)
(A) l satisfies , l does not 11. x[p(x) Q] p(x) Q
(B) l satisfies , l does not 12. x[p(x) Q] x p(x) Q
(C) Neither l nor l satisfies
(D) Both l and l satisfies
Solution: (D)
y OR gate: p p vq
q
p
y NOT gate: p