Valid Logical Reasoning 2/41 If Alfred is a duck, then Alfred can - - PowerPoint PPT Presentation

valid logical reasoning
SMART_READER_LITE
LIVE PREVIEW

Valid Logical Reasoning 2/41 If Alfred is a duck, then Alfred can - - PowerPoint PPT Presentation

Valid Logical Reasoning 2/41 If Alfred is a duck, then Alfred can swim Alfred is a duck Alfred can swim Predicate Logic Lectures 23 (Chapters 8-10) a = Alfred is a duck b = Alfred can swim val a b a | = = b /


slide-1
SLIDE 1

/ department of mathematics and computer science

Predicate Logic

Lectures 2–3 (Chapters 8-10)

2/41 / department of mathematics and computer science

Valid Logical Reasoning

If Alfred is a duck, then Alfred can swim Alfred is a duck Alfred can swim a = ‘Alfred is a duck’ b = ‘Alfred can swim’ a ⇒ b ∧ a |

val

= = b

3/41 / department of mathematics and computer science

Invalid Logical Reasoning

If Alfred is a duck, then Alfred can swim Alfred can swim Alfred is a duck a = ‘Alfred is a duck’ b = ‘Alfred can swim’ a ⇒ b ∧ b |

val

= = a

4/41 / department of mathematics and computer science

Valid Logical Reasoning?

Every animal with feathers is a bird Alfred is an animal with feathers Alfred is a bird a = ‘Every animal with feathers is a bird’ b = ‘Alfred is an animal with feathers’ c = ‘Alfred is a bird’ a ∧ b |

val

= = c

slide-2
SLIDE 2

5/41 / department of mathematics and computer science

Predicate Logic

Propositional logic only describes how to reason about complete statements about things; it does not describe how to reason about things themselves. Predicate logic will extend propositional logical with:

◮ names for individuals; ◮ predicates to express properties of individuals; ◮ quantifiers to quantify over individuals. 6/41 / department of mathematics and computer science

Unary predicate (example)

Consider the statement 4m < 5. Whether the statement is true or false depends on the value of m:

4 3 2 1

  • n R

−4 −3 −2 −1

5 4

  • n Z

4m < 5 is a unary predicate

7/41 / department of mathematics and computer science

Equivalence of predicates

Predicates P(x) and Q(x) are equivalent if for all x we have that P(x) evaluates to true if, and only if, Q(x) evaluates to true.

Example

4m < 5

val

= = m < 5 4 (on R and Z)

val

= = m ≤ 1 (on Z, but not on R) .

8/41 / department of mathematics and computer science

Universal quantification

We express the statement “for all m ∈ Z it holds that 4m < 5” as ∀m[m ∈ Z : 4m < 5] Universal quantifier ∀m turns the predicate 4m < 5 into a proposition. (This proposition is false; take, e.g., m = 2, 3, . . . .)

slide-3
SLIDE 3

9/41 / department of mathematics and computer science

Universal quantification

In general, if P(x) and Q(x) are predicates, then we write ∀x[P(x)

domain

: Q(x)

predicate

] for “all x satisfying P satisfy Q.”

10/41 / department of mathematics and computer science

Existential quantification

We express the statement “there exists m ∈ Z such that 4m < 5” as ∃m[m ∈ Z : 4m < 5] Existential quantifier ∃m turns the predicate 4m < 5 into a proposition. (This proposition is true; take m = 1, 0, −1, . . . .)

11/41 / department of mathematics and computer science

Existential quantification

In general, if P(x) and Q(x) are predicates, then we write ∃x[P(x)

domain

: Q(x)

predicate

] for “there exists x satisfying P that also satisfies Q.”

12/41 / department of mathematics and computer science

Domain of Quantification

What are the truth values associated with the following propositions?

◮ ∃x[x ∈ R : x2 = 1]

val

= = True

◮ ∃x[x ∈ R ∧ x > 0 : x2 = 1]

val

= = True

◮ ∃x[x ∈ R ∧ x > 2 : x2 = 1]

val

= = False

◮ ∀x[x ∈ R : x2 > 1]

val

= = False

◮ ∀x[x ∈ R ∧ x > 0 : x2 > 1]

val

= = False

◮ ∀x[x ∈ R ∧ x > 2 : x2 > 1]

val

= = True

slide-4
SLIDE 4

13/41 / department of mathematics and computer science

One- or zero-element domains

Empty domain ∀x[False : P] val = = True ∃x[False : P] val = = False “All gnomes are green!” One-element domain ∀x[x = n : P] val = = P[n for x] ∃x[x = n : P] val = = P[n for x] Example: ∀m[m = 3 : 4 · m < 5]

val

= = 4 · 3 < 5.

14/41 / department of mathematics and computer science

Domain weakening

NB: P ∧ Q |

val

= = P (all x satisfying P ∧ Q also satisfy P). Examples: ∃x[x ∈ R ∧ x > 0 : x2 = 1]

val

= = ∃x[x ∈ R : x > 0 ∧ x2 = 1] ∀x[x ∈ Z ∧ x > 1 : x2 > 1]

val

= = ∀x[x ∈ Z : x > 1 ⇒ x2 > 1] Domain weakening ∀x[P ∧ Q : R] val = = ∀x[P : Q ⇒ R] ∃x[P ∧ Q : R] val = = ∃x[P : Q ∧ R]

15/41 / department of mathematics and computer science

Domain Splitting

∀x[x ≤ −2 ∨ x ≥ 1 : x2 > 1]

val

= = ∀x[x ≤ −2 : x2 > 1] ∧ ∀x[x ≥ 1 : x2 > 1] ∃x[x ≤ −2 ∨ x ≥ 1 : x2 = 1]

val

= = ∃x[x ≤ −2 : x2 = 1] ∨ ∃x[x ≥ 1 : x2 = 1] Domain Splitting ∀x[P ∨ Q : R] val = = ∀x[P : R] ∧ ∀x[Q : R] ∃x[P ∨ Q : R] val = = ∃x[P : R] ∨ ∃x[Q : R]

16/41 / department of mathematics and computer science

De Morgan for quantifiers

∀ is generalised ∧ ∃ is generalised ∨

  • see book

De Morgan ¬∀x[P : Q] val = = ∃x[P : ¬Q] ¬∃x[P : Q] val = = ∀x[P : ¬Q] not all = there exists one for which not not one = all not So: ¬∀ = ∃¬; and ¬∃ = ∀¬ . We also have: ¬∀¬ = ∃¬¬ = ∃ ; and ¬∃¬ = ∀¬¬ = ∀ .

slide-5
SLIDE 5

17/41 / department of mathematics and computer science

Substitution

The Substitution Rule is valid for (quantified) predicates.

Example:

We have the following valid equivalence: ∀x[ P ∧ Q : R ]

val

= = ∀x[ P : Q ⇒ R ] and hence, by the Substitution Rule, if we substitute Q for P, ¬P for Q, and R ⇒ S for R, then we get another valid equivalence: ∀x[ Q ∧ ¬P : R ⇒ S ]

val

= = ∀x[ Q : ¬P ⇒ ( R ⇒ S )] .

18/41 / department of mathematics and computer science

Leibniz

Leibniz’s Rule is valid for (quantified) predicates.

Example

We have the following valid equivalence: ∃y[y = 2 : x ≥ y]

val

= = x ≥ 2 , and hence, by Leibniz’s Rule, we make another valid equivalence by applying it in a bigger context: ∀x[x ∈ D : ∃y[y = 2 : x ≥ y] ]

val

= = ∀x[x ∈ D : x ≥ 2 ] .

19/41 / department of mathematics and computer science

Calculation with quantifiers (example)

We show with a calculation that ∀x[P ∧ R : S] ∧ ∀x[Q ∧ R : S]

val

= = ¬∃x[P ∨ Q : ¬(R ⇒ S)]: ¬∃x[P ∨ Q : ¬(R ⇒ S)]

val

= = { De Morgan } ∀x[P ∨ Q : ¬¬(R ⇒ S)]

val

= = { Double Negation } ∀x[P ∨ Q : R ⇒ S]

val

= = { Domain Splitting } ∀x[P : R ⇒ S] ∧ ∀x[Q : R ⇒ S]

val

= = { Domain Weakening (2×) } ∀x[P ∧ R : S] ∧ ∀x[Q ∧ R : S] .

21/41 / department of mathematics and computer science

Binary predicates (example)

The statement 3m + n > 3 is a binary predicate.

1 −1 1 n N R m 3m + n = 3

slide-6
SLIDE 6

22/41 / department of mathematics and computer science

Equivalence of binary predicates

Predicates P(x, y) and Q(x, y) are equivalent if for all x, y we have that P(x, y) evaluates to true if, and

  • nly if, Q(x, y) evaluates to true.

Example

Let x, y ∈ Z. The predicates ¬(x = 0 ⇒ y > 2) and x = 0 ∧ y ≤ 2 are equivalent. ¬(x = 0 ⇒ y > 2)

val

= = { Implication } ¬(¬(x = 0) ∨ y > 2)

val

= = { De Morgan } ¬¬(x = 0) ∧ ¬(y > 2)

val

= = { Double Negation, Mathematics } x = 0 ∧ y ≤ 2

23/41 / department of mathematics and computer science

Binary predicates (example)

The statement 3m + n > 3 is a binary predicate.

1 m R N n 1 −1 3m + n = 3 m=0, n=2 (false prop.) assignment

24/41 / department of mathematics and computer science

Binary predicates (example)

The statement 3m + n > 3 is a binary predicate.

1 m R N n 1 −1 3m + n = 3 assignment m=1, n=2 (true prop.)

25/41 / department of mathematics and computer science

Binary predicates (example)

The statement 3m + n > 3 is a binary predicate.

−1 1 n N R m 1 3m + n = 3

val

= = m > 1

3

3m + 2 > 3

val

= = 3m > 1

slide-7
SLIDE 7

26/41 / department of mathematics and computer science

Renaming bound variables

Example: ∀m [ m ∈ N : m + n > 6] (true if n > 6; false if n ≤ 6)

val

= = ∀k [ k ∈ N : k + n > 6] (true if n > 6; false if n ≤ 6)

val

= = = ∀n [ n ∈ N : n + n > 6] (always false) Bound variables may be renamed, but the binding structure may not change! Bound variable ∀x[P : Q] val = = ∀y[P[y for x] : Q[y for x]] ∃x[P : Q] val = = ∃y[P[y for x] : Q[y for x]] provided that y does not occur in P or Q (not even as part of ∀y or ∃y)

27/41 / department of mathematics and computer science

Quantifying many-place predicates

We can turn the binary predicate 3m + n > 3 into a proposition by quantification: ∀m[m ∈ R : ∃n[n ∈ N : 3m + n > 3

  • binary predicate

]

  • unary predicate

]

  • proposition

This proposition is true! Informal argument:

  • 1. Consider an arbitrary m0 ∈ R.
  • 2. Does there exist n ∈ N such that 3m0 + n > 3?
  • 3. Yes! We can, for instance, take n0 = ⌈3 − 3m0⌉ + 1.

28/41 / department of mathematics and computer science

Quantifying many-place predicates

1. ∀m[m ∈ R : ∀n[n ∈ N : 3m + n > 3]]

val

= = False 2. ∀m[m ∈ R : ∃n[n ∈ N : 3m + n > 3]]

val

= = True 3. ∃m[m ∈ R : ∀n[n ∈ N : 3m + n > 3]]

val

= = True 4. ∃m[m ∈ R : ∃n[n ∈ N : 3m + n > 3]]

val

= = True 5. ∀n[n ∈ N : ∀m[m ∈ R : 3m + n > 3]]

val

= = False 6. ∀n[n ∈ N : ∃m[m ∈ R : 3m + n > 3]]

val

= = True 7. ∃n[n ∈ N : ∀m[m ∈ R : 3m + n > 3]]

val

= = False 8. ∃n[n ∈ N : ∃m[m ∈ R : 3m + n > 3]]

val

= = True

29/41 / department of mathematics and computer science

∀m[m ∈ R : ∀n[n ∈ N : 3m + n > 3]]

val

= = False

1 −1 1 n N R m 3m + n = 3

Explanation: ‘Not all vertical lines through the m-axis are entirely green.”

slide-8
SLIDE 8

30/41 / department of mathematics and computer science

∀m[m ∈ R : ∃n[n ∈ N : 3m + n > 3]]

val

= = True

1 −1 1 n N R m 3m + n = 3

Explanation: “On every vertical line through the m-axis at least one point is green.”

31/41 / department of mathematics and computer science

∃m[m ∈ R : ∀n[n ∈ N : 3m + n > 3]]

val

= = True

1 −1 1 n N R m 3m + n = 3

Explanation: “There exists a vertical line through the m-axis (e.g., the line m = 2) such that all points are green.” NB: we only consider points whose n-coordinate is in N

32/41 / department of mathematics and computer science

∃m[m ∈ R : ∃n[n ∈ N : 3m + n > 3]]

val

= = True

1 −1 1 n N R m 3m + n = 3

Explanation: “There exists a vertical line through the m-axis with a green point.” (In fact, we have already seen that all vertical lines have this property.)

33/41 / department of mathematics and computer science

∀n[n ∈ N : ∀m[m ∈ R : 3m + n > 3]]

val

= = False

1 −1 1 n N R m 3m + n = 3

Explanation: “Not all horizontal lines through the n-axis are entirely green.”

slide-9
SLIDE 9

34/41 / department of mathematics and computer science

∀n[n ∈ N : ∃m[m ∈ R : 3m + n > 3]]

val

= = True

1 −1 1 n N R m 3m + n = 3

Explanation: “All horizontal lines through the n-axis have a green point.”

35/41 / department of mathematics and computer science

∃n[n ∈ N : ∀m[m ∈ R : 3m + n > 3]]

val

= = False

1 −1 1 n N R m 3m + n = 3

Explanation: “There is no horizontal line through the n-axis that is entirely green.”

36/41 / department of mathematics and computer science

∃n[n ∈ N : ∃m[m ∈ R : 3m + n > 3]]

val

= = True

1 −1 1 n N R m 3m + n = 3

Explanation: “There exists a horizontal line through the n-axis with a green point.”

37/41 / department of mathematics and computer science

A word on notation

We often write ∀x[P] for ∀x[True : P] (i.e., we omit the domain when it is True). Furthermore, we will often write ∀m∃n[(m, n) ∈ R × N : 3m + n > 3]] instead of ∀m[m ∈ R : ∃n[n ∈ N : 3m + n > 3]] ∀m,n[(m, n) ∈ R × N : 3m + n > 3] instead of ∀m∀n[(m, n) ∈ R × N : 3m + n > 3] NB: we only contract multiple occurrences of the same quantifier (i.e., ∀m∀n becomes ∀m,n, but ∀m∃n is not contracted).