Page 1
Predicate Logic
Aritra Hazra
Department of Computer Science and Engineering,Indian Institute of Technology Kharagpur,
Paschim Medinipur, West Bengal, India - 721302.
Email: [email protected]
Autumn 2020
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 1 / 18
Page 2
From Propositional Logic to Predicate Logic
Example
1 Wherever Ankush goes, so does the pet dog. Ankush goes to school. So,the dog goes to school.
2 No contractors are dependable. Some engineers are contractors. Therefore,some engineers are not dependable.
3 All actresses are graceful. Anushka is a dancer. Anushka is an actress.Therefore, some dancers are graceful.
4 Every passenger either travels in first class or second class. Each passengeris in second class if and only if he or she is not wealthy. Some passengers arewealthy. Not all passengers are wealthy. Therefore, some passengers travelin second class.
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 2 / 18
Page 3
From Propositional Logic to Predicate Logic
Example
1 Wherever Ankush goes, so does the pet dog. Ankush goes to school. So,the dog goes to school.
2 No contractors are dependable. Some engineers are contractors. Therefore,some engineers are not dependable.
3 All actresses are graceful. Anushka is a dancer. Anushka is an actress.Therefore, some dancers are graceful.
4 Every passenger either travels in first class or second class. Each passengeris in second class if and only if he or she is not wealthy. Some passengers arewealthy. Not all passengers are wealthy. Therefore, some passengers travelin second class.
Propositional Logic Insufficiency
Quantifications: ‘some’, ‘none’, ‘all’, ‘every’, ‘wherever’ etc.
Associations: ‘x goes to some place y’, ‘z travels in first class’ etc.
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 2 / 18
Page 4
Predicate Logic Argument Formulation
Example
Wherever Ankush goes, so does the pet dog. Ankush goes to school. So, the doggoes to school.
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 3 / 18
Page 5
Predicate Logic Argument Formulation
Example
Wherever Ankush goes, so does the pet dog. Ankush goes to school. So, the doggoes to school.
Formal Constructs and Fundamentals
Following are the representational extensions made in First-Order Logic(Predicate Logic) over Propositional Logic constructs:
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 3 / 18
Page 6
Predicate Logic Argument Formulation
Example
Wherever Ankush goes, so does the pet dog. Ankush goes to school. So, the doggoes to school.
Formal Constructs and Fundamentals
Following are the representational extensions made in First-Order Logic(Predicate Logic) over Propositional Logic constructs:
New Additions: Variables (for e.g., x, y) and Constants (for e.g., Ankush, Dog)
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 3 / 18
Page 7
Predicate Logic Argument Formulation
Example
Wherever Ankush goes, so does the pet dog. Ankush goes to school. So, the doggoes to school.
Formal Constructs and Fundamentals
Following are the representational extensions made in First-Order Logic(Predicate Logic) over Propositional Logic constructs:
New Additions: Variables (for e.g., x, y) and Constants (for e.g., Ankush, Dog)
Functional Symbols: Functional constructs returning Non-Boolean values(for e.g., Age(x) indicates ‘the age of x’)
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 3 / 18
Page 8
Predicate Logic Argument Formulation
Example
Wherever Ankush goes, so does the pet dog. Ankush goes to school. So, the doggoes to school.
Formal Constructs and Fundamentals
Following are the representational extensions made in First-Order Logic(Predicate Logic) over Propositional Logic constructs:
New Additions: Variables (for e.g., x, y) and Constants (for e.g., Ankush, Dog)
Functional Symbols: Functional constructs returning Non-Boolean values(for e.g., Age(x) indicates ‘the age of x’)
Predicate Symbols: Constructs indicating associations having Boolean outcomes(for e.g., goes(x, y) indicates ‘x goes to the place y’)
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 3 / 18
Page 9
Predicate Logic Argument Formulation
Example
Wherever Ankush goes, so does the pet dog. Ankush goes to school. So, the doggoes to school.
Formal Constructs and Fundamentals
Following are the representational extensions made in First-Order Logic(Predicate Logic) over Propositional Logic constructs:
New Additions: Variables (for e.g., x, y) and Constants (for e.g., Ankush, Dog)
Functional Symbols: Functional constructs returning Non-Boolean values(for e.g., Age(x) indicates ‘the age of x’)
Predicate Symbols: Constructs indicating associations having Boolean outcomes(for e.g., goes(x, y) indicates ‘x goes to the place y’)
Connectors: Well-defined connectors, such as, ¬ (negation), ∧ (conjunction), ∨(disjunction), → (implication), ↔ (if and only if) etc.
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 3 / 18
Page 10
Predicate Logic Argument Formulation
Example
Wherever Ankush goes, so does the pet dog. Ankush goes to school. So, the doggoes to school.
Formal Constructs and Fundamentals
Following are the representational extensions made in First-Order Logic(Predicate Logic) over Propositional Logic constructs:
New Additions: Variables (for e.g., x, y) and Constants (for e.g., Ankush, Dog)
Functional Symbols: Functional constructs returning Non-Boolean values(for e.g., Age(x) indicates ‘the age of x’)
Predicate Symbols: Constructs indicating associations having Boolean outcomes(for e.g., goes(x, y) indicates ‘x goes to the place y’)
Connectors: Well-defined connectors, such as, ¬ (negation), ∧ (conjunction), ∨(disjunction), → (implication), ↔ (if and only if) etc.
Quantifiers: Existantial (∃, i.e. there exists) and Universal (∀, i.e. for all)
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 3 / 18
Page 11
Predicate Logic Argument Formulation: Example-1
Example
Wherever Ankush goes, so does the pet dog. Ankush goes to school. So, the doggoes to school.
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 4 / 18
Page 12
Predicate Logic Argument Formulation: Example-1
Example
Wherever Ankush goes, so does the pet dog. Ankush goes to school. So, the doggoes to school.
Logical Formulation
Variables: x and y
Constants: Ankush, Dog and School
Predicate: goes(x, y): x goes to y
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 4 / 18
Page 13
Predicate Logic Argument Formulation: Example-1
Example
Wherever Ankush goes, so does the pet dog. Ankush goes to school. So, the doggoes to school.
Logical Formulation
Variables: x and y
Constants: Ankush, Dog and School
Predicate: goes(x, y): x goes to y
Formula:F1 : ∀x (goes(Ankush, x)→ goes(Dog, x))F2 : goes(Ankush, School)G : goes(Dog, School)
Requirement: To prove whether (F1 ∧ F2) → G is valid
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 4 / 18
Page 14
Predicate Logic Argument Formulation: Example-2
Example
No contractors are dependable. Some engineers are contractors. Therefore, someengineers are not dependable.
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 5 / 18
Page 15
Predicate Logic Argument Formulation: Example-2
Example
No contractors are dependable. Some engineers are contractors. Therefore, someengineers are not dependable.
Logical Formulation
Predicates: Assuming the variable as x.
contractor(x) : x is a contractordependable(x) : x is dependable
engineer(x) : x is an engineer
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 5 / 18
Page 16
Predicate Logic Argument Formulation: Example-2
Example
No contractors are dependable. Some engineers are contractors. Therefore, someengineers are not dependable.
Logical Formulation
Predicates: Assuming the variable as x.
contractor(x) : x is a contractordependable(x) : x is dependable
engineer(x) : x is an engineer
Formula:
F1 : ∀x (contractor(x) → ¬dependable(x))(Alt.) : ¬∃x (contractor(x) ∧ dependable(x))
F2 : ∃x (engineer(x) ∧ contractor(x))(Alt.) : ∃x (engineer(x) → contractor(x)) ∧ ∃x engineer(x)
G : ∃x (engineer(x) ∧ ¬dependable(x))
Requirement: To prove whether (F1 ∧ F2) → G is validAritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 5 / 18
Page 17
Predicate Logic Argument Formulation: Example-3
Example
All actresses are graceful. Anushka is a dancer. Anushka is an actress. Therefore,some dancers are graceful.
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 6 / 18
Page 18
Predicate Logic Argument Formulation: Example-3
Example
All actresses are graceful. Anushka is a dancer. Anushka is an actress. Therefore,some dancers are graceful.
Logical Formulation
Predicates: Assuming the variable as x.
actress(x) : x is an actressgraceful(x) : x is graceful
dancer(x) : x is a dancer
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 6 / 18
Page 19
Predicate Logic Argument Formulation: Example-3
Example
All actresses are graceful. Anushka is a dancer. Anushka is an actress. Therefore,some dancers are graceful.
Logical Formulation
Predicates: Assuming the variable as x.
actress(x) : x is an actressgraceful(x) : x is graceful
dancer(x) : x is a dancer
Formula:F1 : ∀x (actress(x) → graceful(x))F2 : dacncer(Anushka)F3 : actress(Anushka)G : ∃x (dancer(x) ∧ graceful(x))
Requirement: To prove whether (F1 ∧ F2 ∧ F3) → G is valid
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 6 / 18
Page 20
Predicate Logic Argument Formulation: Example-4
Example
Every passenger either travels in first class or second class. Each passenger is in secondclass if and only if he or she is not wealthy. Some passengers are wealthy. Not allpassengers are wealthy. Therefore, some passengers travel in second class.
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 7 / 18
Page 21
Predicate Logic Argument Formulation: Example-4
Example
Every passenger either travels in first class or second class. Each passenger is in secondclass if and only if he or she is not wealthy. Some passengers are wealthy. Not allpassengers are wealthy. Therefore, some passengers travel in second class.
Logical Formulation
Predicates: Assuming the variable as x.
pass(x) : x is a passengerfrst(x) : x travels in first classscnd(x) : x travels in second classwlty(x) : x is wealthy
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 7 / 18
Page 22
Predicate Logic Argument Formulation: Example-4
Example
Every passenger either travels in first class or second class. Each passenger is in secondclass if and only if he or she is not wealthy. Some passengers are wealthy. Not allpassengers are wealthy. Therefore, some passengers travel in second class.
Logical Formulation
Predicates: Assuming the variable as x.
pass(x) : x is a passengerfrst(x) : x travels in first classscnd(x) : x travels in second classwlty(x) : x is wealthy
Formula: To prove whether (F1 ∧ F2 ∧ F3 ∧ F4) → G is valid.
F1 : ∀x [pass(x) → (frst(x) ∨ scnd(x))]F1 : ∀x [pass(x) →
(
(frst(x) ∧ ¬scnd(x)) ∨ (¬frst(x) ∧ scnd(x)))
]F2 : ∀x [pass(x) →
(
(scnd(x) → ¬wlty(x)) ∧ (¬wlty(x) → scnd(x)))
]F3 : ∃x [pass(x) ∧ wlty(x)] F4 : ¬∀x [pass(x) → wlty(x)]G : ∃x [pass(x) ∧ scnd(x)] (Alt.) ∃x [pass(x) ∧ ¬wlty(x)]
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 7 / 18
Page 23
Predicate Logic Constructs: Use of Quantifiers
Example
A Everyone likes everyone. ∀x ∀y likes(x, y)
B Someone likes someone. ∃x ∃y likes(x, y)
C Everyone likes someone. ∀x(
∃y likes(x, y))
D Someone likes everyone. ∃x(
∀y likes(x, y))
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 8 / 18
Page 24
Predicate Logic Constructs: Use of Quantifiers
Example
A Everyone likes everyone. ∀x ∀y likes(x, y)
B Someone likes someone. ∃x ∃y likes(x, y)
C Everyone likes someone. ∀x(
∃y likes(x, y))
D Someone likes everyone. ∃x(
∀y likes(x, y))
Example
I Everyone is liked by everyone. ∀y(
∀x likes(x, y))
II Someone is liked by someone. ∃y(
∃x likes(x, y))
III Someone is liked by everyone. ∃y(
∀x likes(x, y))
IV Everyone is liked by someone. ∀y(
∃x likes(x, y))
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 8 / 18
Page 25
Predicate Logic Constructs: Use of Quantifiers
Example
A Everyone likes everyone. ∀x ∀y likes(x, y)
B Someone likes someone. ∃x ∃y likes(x, y)
C Everyone likes someone. ∀x(
∃y likes(x, y))
D Someone likes everyone. ∃x(
∀y likes(x, y))
Example
I Everyone is liked by everyone. ∀y(
∀x likes(x, y))
II Someone is liked by someone. ∃y(
∃x likes(x, y))
III Someone is liked by everyone. ∃y(
∀x likes(x, y))
IV Everyone is liked by someone. ∀y(
∃x likes(x, y))
Note: Active and Passive Voice statements in English are NOT logically similar!
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 8 / 18
Page 26
Predicate Logic Constructs: Use of Quantifiers
Example
1 If everyone likes everyone, then someone likes everyone.(
∀x (∀y likes(x, y)))
→(
∃x (∀y likes(x, y)))
2 If some person is liked by everyone, then that person likes himself/herself.∃y
(
(∀x likes(x, y)) → likes(y, y))
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 9 / 18
Page 27
Predicate Logic Constructs: Use of Quantifiers
Example
1 If everyone likes everyone, then someone likes everyone.(
∀x (∀y likes(x, y)))
→(
∃x (∀y likes(x, y)))
2 If some person is liked by everyone, then that person likes himself/herself.∃y
(
(∀x likes(x, y)) → likes(y, y))
Some Notions over Quantifiers
Contrapositive of ∀x(
p(x) → q(x))
: ∀x(
¬q(x) → ¬p(x))
Converse of ∀x(
p(x) → q(x))
: ∀x(
q(x) → p(x))
Inverse of ∀x(
p(x) → q(x))
: ∀x(
¬p(x) → ¬q(x))
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 9 / 18
Page 28
Predicate Logic Constructs: Use of Quantifiers
Example
1 If everyone likes everyone, then someone likes everyone.(
∀x (∀y likes(x, y)))
→(
∃x (∀y likes(x, y)))
2 If some person is liked by everyone, then that person likes himself/herself.∃y
(
(∀x likes(x, y)) → likes(y, y))
Some Notions over Quantifiers
Contrapositive of ∀x(
p(x) → q(x))
: ∀x(
¬q(x) → ¬p(x))
Converse of ∀x(
p(x) → q(x))
: ∀x(
q(x) → p(x))
Inverse of ∀x(
p(x) → q(x))
: ∀x(
¬p(x) → ¬q(x))
Negation Law : (DeMorgan’s Principle)
¬∀x p(x) ≡ ∃x ¬p(x) [also written as, ¬∀x p(x) ⇔ ∃x ¬p(x)]¬∃x p(x) ≡ ∀x ¬p(x) [also written as, ¬∃x p(x) ⇔ ∀x ¬p(x)]
(Intuitively, ∀x indicates ∧∞
i=0xi and ∃x indicates ∨∞
i=0xi)
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 9 / 18
Page 29
Predicate Logic Constructs: Use of Function Symbols
Example
1 If x is greater than y and y is greater than z, then x is greater than z.
Predicate: gt(x, y) denotes ‘x is greater than y’
Formula: ∀x ∀y ∀z(
gt(x, y) ∧ gt(y, z) → gt(x, z))
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 10 / 18
Page 30
Predicate Logic Constructs: Use of Function Symbols
Example
1 If x is greater than y and y is greater than z, then x is greater than z.
Predicate: gt(x, y) denotes ‘x is greater than y’
Formula: ∀x ∀y ∀z(
gt(x, y) ∧ gt(y, z) → gt(x, z))
2 The age of a person is greater than the age of his/her child.
Function Symbol: Age(x) denotes ‘age of the person x’
Predicate: child(x, y) denotes ‘x is a child of y’
Formula: ∀x ∀y(
child(x, y) → gt(Age(y), Age(x)))
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 10 / 18
Page 31
Predicate Logic Constructs: Use of Function Symbols
Example
1 If x is greater than y and y is greater than z, then x is greater than z.
Predicate: gt(x, y) denotes ‘x is greater than y’
Formula: ∀x ∀y ∀z(
gt(x, y) ∧ gt(y, z) → gt(x, z))
2 The age of a person is greater than the age of his/her child.
Function Symbol: Age(x) denotes ‘age of the person x’
Predicate: child(x, y) denotes ‘x is a child of y’
Formula: ∀x ∀y(
child(x, y) → gt(Age(y), Age(x)))
3 The age of a person is greater than the age of his/her grandchild.
Formula: ∀x ∀y ∀z(
(child(x, y) ∧ child(y, z)) → gt(Age(z), Age(x)))
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 10 / 18
Page 32
Predicate Logic Constructs: Use of Function Symbols
Example
1 If x is greater than y and y is greater than z, then x is greater than z.
Predicate: gt(x, y) denotes ‘x is greater than y’
Formula: ∀x ∀y ∀z(
gt(x, y) ∧ gt(y, z) → gt(x, z))
2 The age of a person is greater than the age of his/her child.
Function Symbol: Age(x) denotes ‘age of the person x’
Predicate: child(x, y) denotes ‘x is a child of y’
Formula: ∀x ∀y(
child(x, y) → gt(Age(y), Age(x)))
3 The age of a person is greater than the age of his/her grandchild.
Formula: ∀x ∀y ∀z(
(child(x, y) ∧ child(y, z)) → gt(Age(z), Age(x)))
4 The sum of ages of two children are never more than or equal to the sum of agesof their parents.
Function Symbol: sum(x, y) denotes ‘sum of x and y, i.e. (x+y)’
Formula: ∀w ∀x ∀y ∀z(
(child(w, y) ∧ child(w, z) ∧ child(x, y) ∧ child(x, z))→ (gt(sum(Age(y), Age(z)), sum(Age(w), Age(x))))
)
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 10 / 18
Page 33
Predicate Logic Constructs: Equivalence and Implications
Definitions
Logical Equivalence: Two predicates, p(x) and q(x) are said to be logically equivalent
when for each x = A in the universe, (p(A) ↔ q(A)) holds. Formally, weexpress it as, ∀x (p(x) ⇔ q(x)).
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 11 / 18
Page 34
Predicate Logic Constructs: Equivalence and Implications
Definitions
Logical Equivalence: Two predicates, p(x) and q(x) are said to be logically equivalent
when for each x = A in the universe, (p(A) ↔ q(A)) holds. Formally, weexpress it as, ∀x (p(x) ⇔ q(x)).
Logical Implication: A predicate, p(x) is said to logically imply another predicate q(x)when for each x = A in the universe, (p(A) → q(A)) holds. Formally, weexpress it as, ∀x (p(x) ⇒ q(x)).
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 11 / 18
Page 35
Predicate Logic Constructs: Equivalence and Implications
Definitions
Logical Equivalence: Two predicates, p(x) and q(x) are said to be logically equivalent
when for each x = A in the universe, (p(A) ↔ q(A)) holds. Formally, weexpress it as, ∀x (p(x) ⇔ q(x)).
Logical Implication: A predicate, p(x) is said to logically imply another predicate q(x)when for each x = A in the universe, (p(A) → q(A)) holds. Formally, weexpress it as, ∀x (p(x) ⇒ q(x)).
Some Logical Rules
∃x(
p(x) ∧ q(x))
⇒(
∃x p(x) ∧ ∃x q(x))
(
∃x p(x) ∧ ∃x q(x))
6⇒ ∃x(
p(x) ∧ q(x))
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 11 / 18
Page 36
Predicate Logic Constructs: Equivalence and Implications
Definitions
Logical Equivalence: Two predicates, p(x) and q(x) are said to be logically equivalent
when for each x = A in the universe, (p(A) ↔ q(A)) holds. Formally, weexpress it as, ∀x (p(x) ⇔ q(x)).
Logical Implication: A predicate, p(x) is said to logically imply another predicate q(x)when for each x = A in the universe, (p(A) → q(A)) holds. Formally, weexpress it as, ∀x (p(x) ⇒ q(x)).
Some Logical Rules
∃x(
p(x) ∧ q(x))
⇒(
∃x p(x) ∧ ∃x q(x))
(
∃x p(x) ∧ ∃x q(x))
6⇒ ∃x(
p(x) ∧ q(x))
∃x(
p(x) ∨ q(x))
⇔(
∃x p(x) ∨ ∃x q(x))
[distributed property of ∃ over ∨]
∀x(
p(x) ∧ q(x))
⇔(
∀x p(x) ∧ ∀x q(x))
[distributed property of ∀ over ∧]
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 11 / 18
Page 37
Predicate Logic Constructs: Equivalence and Implications
Definitions
Logical Equivalence: Two predicates, p(x) and q(x) are said to be logically equivalent
when for each x = A in the universe, (p(A) ↔ q(A)) holds. Formally, weexpress it as, ∀x (p(x) ⇔ q(x)).
Logical Implication: A predicate, p(x) is said to logically imply another predicate q(x)when for each x = A in the universe, (p(A) → q(A)) holds. Formally, weexpress it as, ∀x (p(x) ⇒ q(x)).
Some Logical Rules
∃x(
p(x) ∧ q(x))
⇒(
∃x p(x) ∧ ∃x q(x))
(
∃x p(x) ∧ ∃x q(x))
6⇒ ∃x(
p(x) ∧ q(x))
∃x(
p(x) ∨ q(x))
⇔(
∃x p(x) ∨ ∃x q(x))
[distributed property of ∃ over ∨]
∀x(
p(x) ∧ q(x))
⇔(
∀x p(x) ∧ ∀x q(x))
[distributed property of ∀ over ∧](
∀x p(x) ∨ ∀x q(x))
⇒ ∀x(
p(x) ∨ q(x))
∀x(
p(x) ∨ q(x))
6⇒(
∀x p(x) ∨ ∀x q(x))
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 11 / 18
Page 38
Predicate Logic Constructs: Syntax and Semantics
Variables – Free / Bound (Scopes)
Variables are bounded under the scope of its immediately nested quantifier.
∀x pred(x, y) : x is a bound variable and y is a free variable.
∀x(
p(x, y) ∧ ∃z q(x, y, z, w))
: x and z are bounded by ∀x and ∃z, respectively,whereas y and w in q(x, y, z, w) are free variables.
∀x(
p(x, y) ∧ ∃y ∃z q(x, y, z, w))
: x is bounded by ∀x, whereas y in p(x, y) is free. But,both y and z in q(x, y, z, w) is bounded by ∃y and ∃z, respectively,whereas w in q(x, y, z, w) is a free variable.
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 12 / 18
Page 39
Predicate Logic Constructs: Syntax and Semantics
Variables – Free / Bound (Scopes)
Variables are bounded under the scope of its immediately nested quantifier.
∀x pred(x, y) : x is a bound variable and y is a free variable.
∀x(
p(x, y) ∧ ∃z q(x, y, z, w))
: x and z are bounded by ∀x and ∃z, respectively,whereas y and w in q(x, y, z, w) are free variables.
∀x(
p(x, y) ∧ ∃y ∃z q(x, y, z, w))
: x is bounded by ∀x, whereas y in p(x, y) is free. But,both y and z in q(x, y, z, w) is bounded by ∃y and ∃z, respectively,whereas w in q(x, y, z, w) is a free variable.
Symbols – Functions / Predicates
Propositional Symbols 7−→ Predicate Symbols (Boolean outcomes)
Constant Symbols 7−→ Function Symbols (Value based outcomes)
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 12 / 18
Page 40
Predicate Logic Constructs: Syntax and Semantics
Variables – Free / Bound (Scopes)
Variables are bounded under the scope of its immediately nested quantifier.
∀x pred(x, y) : x is a bound variable and y is a free variable.
∀x(
p(x, y) ∧ ∃z q(x, y, z, w))
: x and z are bounded by ∀x and ∃z, respectively,whereas y and w in q(x, y, z, w) are free variables.
∀x(
p(x, y) ∧ ∃y ∃z q(x, y, z, w))
: x is bounded by ∀x, whereas y in p(x, y) is free. But,both y and z in q(x, y, z, w) is bounded by ∃y and ∃z, respectively,whereas w in q(x, y, z, w) is a free variable.
Symbols – Functions / Predicates
Propositional Symbols 7−→ Predicate Symbols (Boolean outcomes)
Constant Symbols 7−→ Function Symbols (Value based outcomes)
Quantification Eligibility of Variables and Symbols
Variables can be, but Symbols cannot be quantified in First-Order / Predicate Logic.
Incorrect: ∃p ∀x [p(x)] or ∃Age ∀x ∃y [gt(Age(x), Age(y))]
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 12 / 18
Page 41
Predicate Logic: Terminalogies
Constant Symbols: M, N, O, P, . . .
Variable Symbols: x, y, z, w, . . .
Function Symbols: F(x), G(x, y), H(x, y, z), . . .
Predicate Symbols: p(x), q(x, y), r(x, y, z), . . .
Connectors/Quantifiers: ¬,∧,∨,→ and ∃, ∀
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 13 / 18
Page 42
Predicate Logic: Terminalogies
Constant Symbols: M, N, O, P, . . .
Variable Symbols: x, y, z, w, . . .
Function Symbols: F(x), G(x, y), H(x, y, z), . . .
Predicate Symbols: p(x), q(x, y), r(x, y, z), . . .
Connectors/Quantifiers: ¬,∧,∨,→ and ∃, ∀
Terms: Variables and Constant Symbols are Terms.If t1, t2, . . . , tk are Terms and F(x1, x2, . . . , xk) is a FunctionSymbol, then F(t1, t2, . . . , tk) is a Term.
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 13 / 18
Page 43
Predicate Logic: Terminalogies
Constant Symbols: M, N, O, P, . . .
Variable Symbols: x, y, z, w, . . .
Function Symbols: F(x), G(x, y), H(x, y, z), . . .
Predicate Symbols: p(x), q(x, y), r(x, y, z), . . .
Connectors/Quantifiers: ¬,∧,∨,→ and ∃, ∀
Terms: Variables and Constant Symbols are Terms.If t1, t2, . . . , tk are Terms and F(x1, x2, . . . , xk) is a FunctionSymbol, then F(t1, t2, . . . , tk) is a Term.
Well-Formed Formula: The WFF (or, simply formula) is recursively defined as:
A proposition is a WFF.If t1, t2, . . . , tk are Terms and P(x1, x2, . . . , xk) is a PredicateSymbol, then P(t1, t2, . . . , tk) is a WFF.If F1, F2 are WFFs, then ¬F1, (F1 ∧ F2), (F1 ∨ F2) and(F1 → F2) are WFFs.If P(x, . . .) is a Predicate where x is a free variable, then∀x P(x, . . .) and ∃x P(x, . . .) are WFFs.
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 13 / 18
Page 44
Predicate Logic: Interpretations and Inferencing
Structures and Notions
Domain, D: Set of elements/values specified for every interpretation
Constants, C: Get assigned values from given domains
Functions, F(x1, x2, . . . , xn): Mapping defined as, (D1 × · · · × Dn) 7→ D
(For e.g., ‘sum of x and y’ = sum(x, y) : Int× Int 7→ Int)
Predicates, P(x1, x2, . . . , xn): Mapping defined as, (D1 × · · · × Dn) 7→ {True, False}
(For e.g., ‘x is greater than y’ = gt(x, y) : Int× Int 7→ {True, False})
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 14 / 18
Page 45
Predicate Logic: Interpretations and Inferencing
Structures and Notions
Domain, D: Set of elements/values specified for every interpretation
Constants, C: Get assigned values from given domains
Functions, F(x1, x2, . . . , xn): Mapping defined as, (D1 × · · · × Dn) 7→ D
(For e.g., ‘sum of x and y’ = sum(x, y) : Int× Int 7→ Int)
Predicates, P(x1, x2, . . . , xn): Mapping defined as, (D1 × · · · × Dn) 7→ {True, False}
(For e.g., ‘x is greater than y’ = gt(x, y) : Int× Int 7→ {True, False})
Formal Interpretations of a Formula
Valid: A valid formula is true for all interpretations.
Invalid: An invalid formula is false under at least one interpretation.
Satisfiable: A satisfiable formula is true under at least one interpretation.
Unsatisfiable: An unsatisfiable formula is false for all interpretations.
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 14 / 18
Page 46
Predicate Logic Deductions: Few Examples
Example-1
F1 : ∀x (goes(Ankush, x) → goes(Dog, x)) F2 : goes(Ankush, School)G : goes(Dog, School) Query : Is (F1 ∧ F2) → G valid?
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 15 / 18
Page 47
Predicate Logic Deductions: Few Examples
Example-1
F1 : ∀x (goes(Ankush, x) → goes(Dog, x)) F2 : goes(Ankush, School)G : goes(Dog, School) Query : Is (F1 ∧ F2) → G valid?
Let, the doamin of variable x be D = {School, Ground, Library, . . .}.Hence, for x = School, we have, F′1 : goes(Ankush, School) → goes(Dog, School).
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 15 / 18
Page 48
Predicate Logic Deductions: Few Examples
Example-1
F1 : ∀x (goes(Ankush, x) → goes(Dog, x)) F2 : goes(Ankush, School)G : goes(Dog, School) Query : Is (F1 ∧ F2) → G valid?
Let, the doamin of variable x be D = {School, Ground, Library, . . .}.Hence, for x = School, we have, F′1 : goes(Ankush, School) → goes(Dog, School).
Inferencing:
F ′
1F2∴ G
, i.e.goes(Ankush,School)→goes(Dog,School)
goes(Ankush,School)∴ goes(Dog,School)
(implying (F1 ∧ F2) → G as valid)
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 15 / 18
Page 49
Predicate Logic Deductions: Few Examples
Example-1
F1 : ∀x (goes(Ankush, x) → goes(Dog, x)) F2 : goes(Ankush, School)G : goes(Dog, School) Query : Is (F1 ∧ F2) → G valid?
Let, the doamin of variable x be D = {School, Ground, Library, . . .}.Hence, for x = School, we have, F′1 : goes(Ankush, School) → goes(Dog, School).
Inferencing:
F ′
1F2∴ G
, i.e.goes(Ankush,School)→goes(Dog,School)
goes(Ankush,School)∴ goes(Dog,School)
(implying (F1 ∧ F2) → G as valid)
Example-2
F1 : ∀x (contractor(x) → ¬dependable(x))F2 : ∃x (engineer(x) ∧ contractor(x))G : ∃x (engineer(x) ∧ ¬dependable(x)) Query : Is (F1 ∧ F2) → G valid?
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 15 / 18
Page 50
Predicate Logic Deductions: Few Examples
Example-1
F1 : ∀x (goes(Ankush, x) → goes(Dog, x)) F2 : goes(Ankush, School)G : goes(Dog, School) Query : Is (F1 ∧ F2) → G valid?
Let, the doamin of variable x be D = {School, Ground, Library, . . .}.Hence, for x = School, we have, F′1 : goes(Ankush, School) → goes(Dog, School).
Inferencing:
F ′
1F2∴ G
, i.e.goes(Ankush,School)→goes(Dog,School)
goes(Ankush,School)∴ goes(Dog,School)
(implying (F1 ∧ F2) → G as valid)
Example-2
F1 : ∀x (contractor(x) → ¬dependable(x))F2 : ∃x (engineer(x) ∧ contractor(x))G : ∃x (engineer(x) ∧ ¬dependable(x)) Query : Is (F1 ∧ F2) → G valid?
Here, let for x = A, we can produce,F ′
1 : contractor(A)→¬dependable(A)
F ′
2 : engineer(A)∧contractor(A).
We can prove, G′ : engineer(A) ∧ ¬dependable(A), implying (F1 ∧ F2) → G as valid.
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 15 / 18
Page 51
Predicate Logic Deductions: Few Examples
Example-1
F1 : ∀x (goes(Ankush, x) → goes(Dog, x)) F2 : goes(Ankush, School)G : goes(Dog, School) Query : Is (F1 ∧ F2) → G valid?
Let, the doamin of variable x be D = {School, Ground, Library, . . .}.Hence, for x = School, we have, F′1 : goes(Ankush, School) → goes(Dog, School).
Inferencing:
F ′
1F2∴ G
, i.e.goes(Ankush,School)→goes(Dog,School)
goes(Ankush,School)∴ goes(Dog,School)
(implying (F1 ∧ F2) → G as valid)
Example-2
F1 : ∀x (contractor(x) → ¬dependable(x))F2 : ∃x (engineer(x) ∧ contractor(x))G : ∃x (engineer(x) ∧ ¬dependable(x)) Query : Is (F1 ∧ F2) → G valid?
Here, let for x = A, we can produce,F ′
1 : contractor(A)→¬dependable(A)
F ′
2 : engineer(A)∧contractor(A).
We can prove, G′ : engineer(A) ∧ ¬dependable(A), implying (F1 ∧ F2) → G as valid.
Inferencing:
F ′
1F ′
2∴ G′
, becausecontractor(A)→¬dependable(A)
engineer(A)∧contractor(A)∴ ¬dependable(A)
andengineer(A)∧contractor(A)
¬dependable(A)∴ engineer(A)∧¬dependable(A)
.
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 15 / 18
Page 52
Predicate Logic: Inferencing and Deduction Rules
Rule of Universal Specification
Base Rule:
If ∀x p(x) is true, then p(A) is true for each element A from the domain of x.
If ∃x p(x) is true, then p(A) is true for at least one element A from the domain of x.
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 16 / 18
Page 53
Predicate Logic: Inferencing and Deduction Rules
Rule of Universal Specification
Base Rule:
If ∀x p(x) is true, then p(A) is true for each element A from the domain of x.
If ∃x p(x) is true, then p(A) is true for at least one element A from the domain of x.
Few Derived Rules:
∀x [p(x)→q(x)]p(A)
∴ q(A)(Modus Ponens)
∀x [p(x)→q(x)]¬q(A)
∴ ¬p(A)(Modus Tollens)
∀x [(p(x)∨q(x))→¬r(x)]r(A)
∴ ¬p(A)
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 16 / 18
Page 54
Predicate Logic: Inferencing and Deduction Rules
Rule of Universal Specification
Base Rule:
If ∀x p(x) is true, then p(A) is true for each element A from the domain of x.
If ∃x p(x) is true, then p(A) is true for at least one element A from the domain of x.
Few Derived Rules:
∀x [p(x)→q(x)]p(A)
∴ q(A)(Modus Ponens)
∀x [p(x)→q(x)]¬q(A)
∴ ¬p(A)(Modus Tollens)
∀x [(p(x)∨q(x))→¬r(x)]r(A)
∴ ¬p(A)
Rule of Universal Generalization
Base Rule: If ∀x p(x) is true, then p(c) is true for an arbitrarily chosen element c fromthe domain of x.
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 16 / 18
Page 55
Predicate Logic: Inferencing and Deduction Rules
Rule of Universal Specification
Base Rule:
If ∀x p(x) is true, then p(A) is true for each element A from the domain of x.
If ∃x p(x) is true, then p(A) is true for at least one element A from the domain of x.
Few Derived Rules:
∀x [p(x)→q(x)]p(A)
∴ q(A)(Modus Ponens)
∀x [p(x)→q(x)]¬q(A)
∴ ¬p(A)(Modus Tollens)
∀x [(p(x)∨q(x))→¬r(x)]r(A)
∴ ¬p(A)
Rule of Universal Generalization
Base Rule: If ∀x p(x) is true, then p(c) is true for an arbitrarily chosen element c fromthe domain of x.
Few Derived Rules:
∀x [p(x)→q(x)]∀x [q(x)→r(x)]
∴ ∀x [p(x)→r(x)](Universal Syllogism)
∀x [p(x)∨q(x)]∀x [(¬p(x)∧q(x))→r(x)]
∴ ∀x [¬r(x)→p(x)]
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 16 / 18
Page 56
Limitations of Predicate Logic
Note: Predicate Logic can model any computable function.
Extensions to Predicate Logic
Higher-Order Logics: Can also quantify symbols along with quantifying variables.
∀p(
(p(0) ∧ (∀x (p(x) → p(S(x)))) → ∀y (p(y)))
[ Guess what this formula expresses? Hint: A Math Theorem! ]
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 17 / 18
Page 57
Limitations of Predicate Logic
Note: Predicate Logic can model any computable function.
Extensions to Predicate Logic
Higher-Order Logics: Can also quantify symbols along with quantifying variables.
∀p(
(p(0) ∧ (∀x (p(x) → p(S(x)))) → ∀y (p(y)))
[ Guess what this formula expresses? Hint: A Math Theorem! ]
Temporal Logics: Can also relate two time universes using additional constructs, suchas, next, future, always, until.
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 17 / 18
Page 58
Limitations of Predicate Logic
Note: Predicate Logic can model any computable function.
Extensions to Predicate Logic
Higher-Order Logics: Can also quantify symbols along with quantifying variables.
∀p(
(p(0) ∧ (∀x (p(x) → p(S(x)))) → ∀y (p(y)))
[ Guess what this formula expresses? Hint: A Math Theorem! ]
Temporal Logics: Can also relate two time universes using additional constructs, suchas, next, future, always, until.
Unsolvable Problem Specifications
Russell’s Paradox: The barber shaves all those who do not shave themselves. Does thebarber shaves himself?
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 17 / 18
Page 59
Limitations of Predicate Logic
Note: Predicate Logic can model any computable function.
Extensions to Predicate Logic
Higher-Order Logics: Can also quantify symbols along with quantifying variables.
∀p(
(p(0) ∧ (∀x (p(x) → p(S(x)))) → ∀y (p(y)))
[ Guess what this formula expresses? Hint: A Math Theorem! ]
Temporal Logics: Can also relate two time universes using additional constructs, suchas, next, future, always, until.
Unsolvable Problem Specifications
Russell’s Paradox: The barber shaves all those who do not shave themselves. Does thebarber shaves himself?
There is a single barber in the town.
Those and only those who do not shave themselves are shaved by the barber.
Then, who shaves the barber? Undecidable!
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 17 / 18
Page 60
Thank You!
Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 18 / 18