Predicate Logic Aritra Hazra Department of Computer Science and - - PowerPoint PPT Presentation

predicate logic
SMART_READER_LITE
LIVE PREVIEW

Predicate Logic Aritra Hazra Department of Computer Science and - - PowerPoint PPT Presentation

Predicate Logic Aritra Hazra Department of Computer Science and Engineering, Indian Institute of Technology Kharagpur, Paschim Medinipur, West Bengal, India - 721302. Email: aritrah@cse.iitkgp.ac.in Autumn 2020 Aritra Hazra (CSE, IITKGP)


slide-1
SLIDE 1

Predicate Logic

Aritra Hazra

Department of Computer Science and Engineering, Indian Institute of Technology Kharagpur, Paschim Medinipur, West Bengal, India - 721302. Email: aritrah@cse.iitkgp.ac.in

Autumn 2020

Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 1 / 18

slide-2
SLIDE 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 passenger is in second class if and only if he or she is not wealthy. Some passengers are

  • wealthy. Not all passengers are wealthy. Therefore, some passengers travel

in second class.

Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 2 / 18

slide-3
SLIDE 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 passenger is in second class if and only if he or she is not wealthy. Some passengers are

  • wealthy. Not all passengers are wealthy. Therefore, some passengers travel

in 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

slide-4
SLIDE 4

Predicate Logic Argument Formulation

Example

Wherever Ankush goes, so does the pet dog. Ankush goes to school. So, the dog goes to school.

Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 3 / 18

slide-5
SLIDE 5

Predicate Logic Argument Formulation

Example

Wherever Ankush goes, so does the pet dog. Ankush goes to school. So, the dog goes 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

slide-6
SLIDE 6

Predicate Logic Argument Formulation

Example

Wherever Ankush goes, so does the pet dog. Ankush goes to school. So, the dog goes 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

slide-7
SLIDE 7

Predicate Logic Argument Formulation

Example

Wherever Ankush goes, so does the pet dog. Ankush goes to school. So, the dog goes 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

slide-8
SLIDE 8

Predicate Logic Argument Formulation

Example

Wherever Ankush goes, so does the pet dog. Ankush goes to school. So, the dog goes 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

slide-9
SLIDE 9

Predicate Logic Argument Formulation

Example

Wherever Ankush goes, so does the pet dog. Ankush goes to school. So, the dog goes 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

slide-10
SLIDE 10

Predicate Logic Argument Formulation

Example

Wherever Ankush goes, so does the pet dog. Ankush goes to school. So, the dog goes 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

slide-11
SLIDE 11

Predicate Logic Argument Formulation: Example-1

Example

Wherever Ankush goes, so does the pet dog. Ankush goes to school. So, the dog goes to school.

Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 4 / 18

slide-12
SLIDE 12

Predicate Logic Argument Formulation: Example-1

Example

Wherever Ankush goes, so does the pet dog. Ankush goes to school. So, the dog goes 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

slide-13
SLIDE 13

Predicate Logic Argument Formulation: Example-1

Example

Wherever Ankush goes, so does the pet dog. Ankush goes to school. So, the dog goes 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

slide-14
SLIDE 14

Predicate Logic Argument Formulation: Example-2

Example

No contractors are dependable. Some engineers are contractors. Therefore, some engineers are not dependable.

Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 5 / 18

slide-15
SLIDE 15

Predicate Logic Argument Formulation: Example-2

Example

No contractors are dependable. Some engineers are contractors. Therefore, some engineers are not dependable.

Logical Formulation

Predicates: Assuming the variable as x. contractor(x) : x is a contractor dependable(x) : x is dependable engineer(x) : x is an engineer

Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 5 / 18

slide-16
SLIDE 16

Predicate Logic Argument Formulation: Example-2

Example

No contractors are dependable. Some engineers are contractors. Therefore, some engineers are not dependable.

Logical Formulation

Predicates: Assuming the variable as x. contractor(x) : x is a contractor dependable(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 valid

Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 5 / 18

slide-17
SLIDE 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

slide-18
SLIDE 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 actress graceful(x) : x is graceful dancer(x) : x is a dancer

Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 6 / 18

slide-19
SLIDE 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 actress graceful(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

slide-20
SLIDE 20

Predicate Logic Argument Formulation: Example-4

Example

Every passenger either travels in first class or second class. Each passenger is in second class if and only if he or she is not wealthy. Some passengers are wealthy. Not all passengers are wealthy. Therefore, some passengers travel in second class.

Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 7 / 18

slide-21
SLIDE 21

Predicate Logic Argument Formulation: Example-4

Example

Every passenger either travels in first class or second class. Each passenger is in second class if and only if he or she is not wealthy. Some passengers are wealthy. Not all passengers are wealthy. Therefore, some passengers travel in second class.

Logical Formulation

Predicates: Assuming the variable as x. pass(x) : x is a passenger frst(x) : x travels in first class scnd(x) : x travels in second class wlty(x) : x is wealthy

Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 7 / 18

slide-22
SLIDE 22

Predicate Logic Argument Formulation: Example-4

Example

Every passenger either travels in first class or second class. Each passenger is in second class if and only if he or she is not wealthy. Some passengers are wealthy. Not all passengers are wealthy. Therefore, some passengers travel in second class.

Logical Formulation

Predicates: Assuming the variable as x. pass(x) : x is a passenger frst(x) : x travels in first class scnd(x) : x travels in second class wlty(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

slide-23
SLIDE 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

slide-24
SLIDE 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

slide-25
SLIDE 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

slide-26
SLIDE 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

slide-27
SLIDE 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

slide-28
SLIDE 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

slide-29
SLIDE 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

slide-30
SLIDE 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

slide-31
SLIDE 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

slide-32
SLIDE 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 ages

  • f 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

slide-33
SLIDE 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, we express it as, ∀x (p(x) ⇔ q(x)).

Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 11 / 18

slide-34
SLIDE 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, we express 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, we express it as, ∀x (p(x) ⇒ q(x)).

Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 11 / 18

slide-35
SLIDE 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, we express 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, we express 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)
  • ⇒ ∃x
  • p(x) ∧ q(x)
  • Aritra Hazra (CSE, IITKGP)

CS21001 : Discrete Structures Autumn 2020 11 / 18

slide-36
SLIDE 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, we express 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, we express 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)
  • ⇒ ∃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

slide-37
SLIDE 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, we express 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, we express 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)
  • ⇒ ∃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)
  • ∀x p(x) ∨ ∀x q(x)
  • Aritra Hazra (CSE, IITKGP)

CS21001 : Discrete Structures Autumn 2020 11 / 18

slide-38
SLIDE 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

slide-39
SLIDE 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 − → Predicate Symbols (Boolean outcomes) Constant Symbols − → Function Symbols (Value based outcomes)

Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 12 / 18

slide-40
SLIDE 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 − → Predicate Symbols (Boolean outcomes) Constant Symbols − → 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)]

  • r

∃Age ∀x ∃y [gt(Age(x), Age(y))]

Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 12 / 18

slide-41
SLIDE 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

slide-42
SLIDE 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 Function Symbol, then F(t1, t2, . . . , tk) is a Term.

Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 13 / 18

slide-43
SLIDE 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 Function Symbol, 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 Predicate Symbol, 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

slide-44
SLIDE 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) → D

(For e.g., ‘sum of x and y’ = sum(x, y) : Int × Int → Int)

Predicates, P(x1, x2, . . . , xn): Mapping defined as, (D1 × · · · × Dn) → {True, False}

(For e.g., ‘x is greater than y’ = gt(x, y) : Int × Int → {True, False})

Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 14 / 18

slide-45
SLIDE 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) → D

(For e.g., ‘sum of x and y’ = sum(x, y) : Int × Int → Int)

Predicates, P(x1, x2, . . . , xn): Mapping defined as, (D1 × · · · × Dn) → {True, False}

(For e.g., ‘x is greater than y’ = gt(x, y) : Int × Int → {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

slide-46
SLIDE 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

slide-47
SLIDE 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

slide-48
SLIDE 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 ′

1

F2 ∴ 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

slide-49
SLIDE 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 ′

1

F2 ∴ 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

slide-50
SLIDE 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 ′

1

F2 ∴ 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

slide-51
SLIDE 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 ′

1

F2 ∴ 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 ′

1

F ′

2

∴ G′ ,

because

contractor(A)→¬dependable(A) engineer(A)∧contractor(A) ∴ ¬dependable(A)

and

engineer(A)∧contractor(A) ¬dependable(A) ∴ engineer(A)∧¬dependable(A) . Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 15 / 18

slide-52
SLIDE 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

slide-53
SLIDE 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

slide-54
SLIDE 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 from the domain of x.

Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 16 / 18

slide-55
SLIDE 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 from the 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

slide-56
SLIDE 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

slide-57
SLIDE 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, such as, next, future, always, until.

Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 17 / 18

slide-58
SLIDE 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, such as, next, future, always, until.

Unsolvable Problem Specifications

Russell’s Paradox: The barber shaves all those who do not shave themselves. Does the barber shaves himself?

Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 17 / 18

slide-59
SLIDE 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, such as, next, future, always, until.

Unsolvable Problem Specifications

Russell’s Paradox: The barber shaves all those who do not shave themselves. Does the barber 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

slide-60
SLIDE 60

Thank You!

Aritra Hazra (CSE, IITKGP) CS21001 : Discrete Structures Autumn 2020 18 / 18