# Applications of Predicate Logic

(述語論理の応用)

## Discrete Mathematics I

### 7th lecture, Nov. 10, 2017

http://www.sw.it.aoyama.ac.jp/2017/Math1/lecture7.html

### Martin J. Dürst # Today's Schedule

• Summary and homework from last lecture
• Applications of predicate logic
• Examples for various laws
• Quantifiers and variables
• Quantifiers and sums/products

# Announcement

There will be a minitest (ca. 30minutes) next week. Please prepare well!

# Summary of Last Lecture

• There are many different kinds of symbolic logic: Propositional logic, predicate logic,...
• Predicates take arguments (propositions do not take arguments)
• Predicate logic allows more general statements and inferences than propositional logic
• Predicate logic uses universal quantifiers (∀) and existential quantifiers (∃)

# The use of Variables with Quantifiers

Bound variable:
Variable quantified by a quantifier
Example: the x in: ∀x: (P(x)∧Q(y))
Free variable:
Variable not quantified by a quantifier
Example: the y in: ∀x: (P(x)∧Q(y))
Closed formula:
A formula without free variables.
Scope:
The part of a formula where a bound variable (or a quantifier) is active.
All occurrences of a bound variable within its scope can be exchanged by another variable.
Example: ∀s: (age(s)≤30 ∧ college(s)=CSE) ⇔ ∀u: (age(u)≤30 ∧ college(u)=CSE)
Using a bound variable outside its scope is an error.
Example: (∀x: P(x))∧Q(x)

# Manipulation of Bound Variables

s: age(s)≤30) ∧ (∀t: college(t)=CSE) = ∀u: (age(u)≤30∧college(u)=CSE)

is the same as

s: age(s)≤30) ∧ (∀s: college(s)=CSE) = ∀s: (age(s)≤30∧college(s)=CSE)

There are three different variables s in the last statement.

Advice:

• It is better to use different variable names with each quantifier, but
• You have to understand formuæ that repeatedly used the same variable name.
• Bound variables are similar to local variables in programming languages.

# Combination of Quantifiers

(∃y: ∀x: P(x, y)) → (∀x: ∃y: P(x, y))

(∀x: ∃y: P(x, y)) ↛ (∃y: ∀x: P(x, y))

The number of prime numbers is infinite.

(This means that whatever big number x we choose, there will always be a bigger prime number y.)

x: ∃y: (y > x ∧ prime(y))

Reversing the order of the quantifiers changes the meaning:

y: ∀x: (y > x ∧ prime(y))

(There is a prime number y that is bigger than any (natural number) x. This statement is obviously false.)

# Proof that the Number of Prime Numbers is Infinite

• Assume there is a largest prime number z:
z: prime(z) ∧ ∀y: prime(y) → yz
• Calculate a new number t = 1 + zp=2(prime(p)) p
Example: z=7; t = 1 + 2·3·5·7 = 211
• xz: prime(x)→t mod x =1 ⇒

s: (z<st ∧ prime(s)) ⇒

y: (y > x ∧ prime(y))

# Factorial

Notation: n!

Definition: n! = 1 · 2 · ... (n-1) · n = ∏ni=1 i

(∏ is called product)

Question:

1! = 1

0! = 1

# Neutral Element of an Operation

(also unit element, identity element, identity)

For an operation △, the neutral element e satisfies
x: ex = x = xe

• Neutral element of addition: 0
• Neutral element of multiplication: 1
• Neutral element of conjunction: true
(this is the reason why ∀x∈{}: R(x) = true)
• Neutral element of disjunction: false
• Neutral element of substraction:
does not exist, but 0 is a rigth identity (satisfying only ∀x: x = xe)

# Structure of a Program to Calculate Sums, ...

Concrete example (sum):

```int sum = 0;
for (i=0; i<end; i++)
sum += array[i];```

## General Structure

In programming language C:

```type result = neutral element;
for (i=0; i<end; i++)
result = result operator array[i];```

In programming language Ruby:

```array.inject(neutral element) do |memo, next|
memo operator next
end```

# Relation between Sums/Products and Quantifiers

Sum: i=1 1/i2 = 1 + 1/4 + 1/9 + 1/16 + 1/25 + ...

Product: i=1 1+1/(-2)i = ...

Universal quantification: (∀i ∈ℕ+: i>0) = i=1 i>0 = 1>0 ∧ 2>0 ∧ 3>0 ∧...

Existential quantification: (∃i ∈ℕ+: odd(i)) = i=1 odd(i) = odd(1)∨odd(2)∨odd(3)∨...

Quantification is a generalization of conjunction/disjunction to more than two operands in the same way that sum and product are a generalization of addition/multiplication to more than two operands.

two operands many operands
name symbol name symbol(s)
addition + sum
multiplication * product
conjunction universal quantification ∀/
disjunction existential quantification ∃/

# Quantifiers for Empty Sets

i (i<0⋀i>5): odd(i) = T (because the unit element of conjunction is T)

i (i<0⋀i>5): odd(i) = F (because the unit element of disjunction is F)

# Extension of DeMorgans' Laws

Laws 1 and 2 introduced in the last lecture are generalizations of DeMorgans' laws:

• ¬∀x: P(x)
= ¬(P(x1)∧P(x2)∧P(x3)∧P(x4)∧...)
= (¬P(x1)∨¬P(x2)∨¬P(x3)∨¬P(x4)∨...)
= ∃x: ¬P(x)
• ¬∃x: P(x)
= ¬(P(x1)∨P(x2)∨P(x3)∨P(x4)∨...)
= (¬P(x1)∧¬P(x2)∧¬P(x3)∧¬P(x4)∧...)
= ∀x: ¬P(x)

# Formula Manipulation with Quantifiers

Simplify ¬(∃x: P(x) → ∀y: ¬Q(y))

¬(∃x: P(x) → ∀y: ¬Q(y)) [removing implication]

= ¬(¬∃x: P(x) ∨ ∀y: ¬Q(y)) [deMorgan's law]

= ¬¬∃x: P(x) ∧ ¬∀y: ¬Q(y) [law 1 of last lecture]

= ¬¬∃x: P(x) ∧ ∃y: ¬¬Q(y) [double negation]

= ∃x: P(x) ∧ ∃y: Q(y)

Actual example:

Let P(x) mean "it is raining in x", and Q(y) "it is snowing y"

Then the original formula says "It's wrong that if it rains somewhere, then it snows nowhere". The final formula says "There is a place where it rains and there is a place where it snows".

# Knowledge about Field of Application

• Propositional logic does not need application knowledge except for the truth value of each proposition.
• Predicate logic combines axioms/theorems/knowledge of logic with the axioms/theorems/knowledge of one or more application areas.
• Example: Predicate logic on natural numbers: Peano axioms,...
• Example: Predicate logic for sets: Laws for operations on sets,...
• Example: Size of sets: Knowledge about set operations and arithmetic with natural numbers
• Concrete example:

s: (male(s) ∨ female(s)) [all students are either male or female]

s: ¬(male(s) ∧ female(s)) [no student is both male and female]

sS: (∃kK: native(s, k) ∧(∀hK: h=k ∨¬native(s, h))) [all students are native of exactly one prefecture]

# This Week's Homework 1

Deadline: November 16, 2017 (Thursday), 19:00.

Format: Handout, easily readable handwriting

Where to submit: Box in front of room O-529 (building O, 5th floor)

Problems: See handout

# This Week's Homework 2

(no need to submit)

In preparation for next week's lecture, using your high school books/materials or other sources, research the following terms related to sets, and write a definition and short explanation for each of them:

• Set
• Element
• Set union
• Set intersection
• Set difference
• Subset
• Proper subset
• Empty set
• Universal set
• Power set

(高校の本・資料や他の情報を活用して、上記の集合に関連する概念を調査し、定義と簡単な説明を書きなさい。)

# Glossary

inference

College of Science and Engineering

native of ...
...出身
bound variable

free variable

local variable

closed formula

scope

sum

product

prime number

infinite

set

element

(set) union

(set) intersection

(set) difference

subset

proper subset

empty set

power set
べき (冪) 集合