Download x - Homepages | The University of Aberdeen

Document related concepts

Structure (mathematical logic) wikipedia , lookup

Inquiry wikipedia , lookup

Ramism wikipedia , lookup

Argument wikipedia , lookup

Foundations of mathematics wikipedia , lookup

Fuzzy logic wikipedia , lookup

Willard Van Orman Quine wikipedia , lookup

Propositional formula wikipedia , lookup

Lorenzo Peña wikipedia , lookup

Jesús Mosterín wikipedia , lookup

Catuṣkoṭi wikipedia , lookup

Truth-bearer wikipedia , lookup

Natural deduction wikipedia , lookup

Mathematical logic wikipedia , lookup

Quantum logic wikipedia , lookup

Modal logic wikipedia , lookup

First-order logic wikipedia , lookup

History of logic wikipedia , lookup

Curry–Howard correspondence wikipedia , lookup

Combinatory logic wikipedia , lookup

Propositional calculus wikipedia , lookup

Intuitionistic logic wikipedia , lookup

Laws of Form wikipedia , lookup

Law of thought wikipedia , lookup

Transcript
Module #1 - Logic
University of Aberdeen, Computing Science
CS3511
Discrete Methods
Kees van Deemter
Slides adapted from Michael P. Frank’s
Course Based on the Text
Discrete Mathematics & Its Applications
(5th Edition)
by Kenneth H. Rosen
5/6/2017
Michael Frank / Kees van Deemter
1
Module #1 - Logic
Module #1:
Part 2: Predicate Logic
Rosen 5th ed., §§1.3-1.4 (but much extended)
~135 slides, ~5 lectures
5/6/2017
Michael Frank / Kees van Deemter
2
Topic #3 – Predicate Logic
Module #1 - Logic
Predicate Logic (§1.3)
• We can use propositional logic to prove that
certain real-life inferences are valid.
–
–
–
–
If it’s cold then it snows.
If it snows there are accidents
There are no accidents. Therefore:
It’s not cold
• In propositional logic:
((cs sa a) c) is a tautology
5/6/2017
Michael Frank / Kees van Deemter
3
Topic #3 – Predicate Logic
Module #1 - Logic
Predicate Logic (§1.3)
• In propositional logic:
(((cs) (sa) a) c) is a tautology
• Saying this differently,
It follows by propositional logic from
(cs) (sa) a (premisse) that
c (conclusion)
5/6/2017
Michael Frank / Kees van Deemter
4
Topic #3 – Predicate Logic
Module #1 - Logic
Predicate Logic (§1.3)
• But other valid inferences cannot be proven
valid by propositional logic
– Some girl is adored by everyone. Therefore:
– Everyone adores someone
• For inferences like this, we need a more
expressive logic
• Needed: treatment of `some’ and `every’
(a bit analogous to `or’ and `and’)
5/6/2017
Michael Frank / Kees van Deemter
5
Topic #3 – Predicate Logic
Module #1 - Logic
Predicate Logic (§1.3)
• Predicate logic is an extension of
propositional logic that permits
quantification over classes of entities.
• Propositional logic (recall) treats simple
propositions (sentences) as atomic entities.
• In contrast, predicate logic distinguishes the
subject of a sentence from its predicate.
5/6/2017
Michael Frank / Kees van Deemter
6
Topic #3 – Predicate Logic
Module #1 - Logic
Applications of Predicate Logic
It is one of the most-used formal notations for
writing mathematical definitions, axioms,
and theorems.
For example, in linear algebra, a partial
order is introduced saying that a relation R
is reflexive and transitive – and these
notions are defined using predicate logic.
5/6/2017
Michael Frank / Kees van Deemter
7
Topic #3 – Predicate Logic
Module #1 - Logic
Practical Applications
of Predicate Logic
• Basis for many Artificial Intelligence systems.
– E.g. automatic program verification systems.
• Predicate-logic like statements are supported by
some of the more sophisticated database query
engines
• There are also limitations associated with using
predicate logic. – More about that later
5/6/2017
Michael Frank / Kees van Deemter
8
Topic #3 – Predicate Logic
Module #1 - Logic
First: A bit of grammar
• In the sentence “The dog is sleeping”:
– The phrase “the dog” denotes the subject which the sentence is about.
– The phrase “is sleeping” denotes the predicatea property that is true of the subject.
• Predicate logic will follow the same pattern.
5/6/2017
Michael Frank / Kees van Deemter
9
Topic #3 – Predicate Logic
Module #1 - Logic
Formulas of predicate logic
(informal)
• We will use various kinds of individual constants
that denote individuals/objects: a,b,c,…
Constants are a bit like names
• Individual variables over objects: x, y, z , …
• The result of applying a predicate P to a
constant a is the proposition P(a)
Meaning: the object denoted by a has the property
denoted by P.
5/6/2017
Michael Frank / Kees van Deemter
10
Topic #3 – Predicate Logic
Module #1 - Logic
Formulas of predicate logic
(informal)
• The result of applying a predicate P to a
variable x is the propositional form P(x).
– E.g. if P = “is a prime number”, then
P(x) is the propositional form
“x is a prime number”.
5/6/2017
Michael Frank / Kees van Deemter
11
Topic #3 – Predicate Logic
Module #1 - Logic
Predicates/relations with n places
• Predicate logic generalises the notion of a
predicate to include propositional functions
of any number of arguments. E.g.:
R(x,y) = “x adores y”
P(x,y,z) = “x gave y the grade z”
Q(x,y,z,u)= “ x*(y+z)=u ”
5/6/2017
Michael Frank / Kees van Deemter
12
Topic #3 – Predicate Logic
Module #1 - Logic
Universes of Discourse (U.D.s)
• Predicate Logic lets you state things about many
objects at once.
• E.g., let P(x) = “ (x*2)  x ”. We can then say,
“For any number x, P(x) is true” instead of
(0*2  0)  (1*2  1)  (2*2  2)  ...
• The collection of values that a variable x can take
is called x’s universe of discourse.
(u.d. is something outside the formula that helps
giving it its intended interpretation.)
5/6/2017
Michael Frank / Kees van Deemter
13
Topic #3 – Predicate Logic
Module #1 - Logic
Universes of Discourse (U.D.s)
• E.g., let P(x)=“x*2  x”. We can then say,
“For any number x, P(x) is true” instead of
(0*2  0)  (1*2  1)  (2*2  2)  ...
• Applying the notion of an u.d.:
– “For any number x, P(x) is true” is true
when u.d. = N
– “For any number x, P(x) is true” is false
when u.d. = Z
5/6/2017
Michael Frank / Kees van Deemter
14
Module #1 - Logic
Back to propositional logic
• In propositional logic, we could not simply
say whether a formula is TRUE; what we
could say is whether it is TRUE with
respect to a given assignment of
TRUE/FALSE to the Atoms in the formula
• E.g., pq is TRUE with respect to the
assignment p=TRUE, q=TRUE
5/6/2017
Michael Frank / Kees van Deemter
15
Module #1 - Logic
Predicate logic
• In predicate logic, we say that a formula is TRUE
(FALSE) with respect to a model
• Model = u.d. plus specification of the “meanings”
of the predicates. This can be done e.g.
– by giving an English equivalent of a predicate
– by listing explicitly which objects
the predicate is true of
• ... as long the extension of the predicate is clear.
(By definition, this is the set of objects in the u.d.
for which the predicate holds.)
5/6/2017
Michael Frank / Kees van Deemter
16
Topic #3 – Predicate Logic
Module #1 - Logic
Quantifier Expressions
• Quantifiers provide a notation that allows
us to quantify (count) how many objects in
the u.d. satisfy a given predicate.
• “” is the FORLL or universal quantifier.
“” is the XISTS or existential quantifier.
• For example, x P(x) and x P(x) are
propositions
5/6/2017
Michael Frank / Kees van Deemter
17
Topic #3 – Predicate Logic
Module #1 - Logic
Meaning of Quantified Expressions
First, informally:
• x P(x) means for all x in the u.d., P holds.
• x P(x) means there exist x in the u.d. (that
is, 1 or more) such that P(x) is true.
5/6/2017
Michael Frank / Kees van Deemter
18
Topic #3 – Predicate Logic
Module #1 - Logic
Example: 
Let the u.d. be the parking spaces at UF.
Let P(x) mean “x is full.”
Then the existential quantification of P(x),
x P(x), is the proposition saying that
– “Some parking spaces at UF are full.”
– “There is a parking space at UF that is full.”
– “At least one parking space at UF is full.”
5/6/2017
Michael Frank / Kees van Deemter
19
Topic #3 – Predicate Logic
Module #1 - Logic
Example: 
Let the u.d. be parking spaces at UF.
Let P(x) be the prop. form “x is occupied”
Then the universal quantification of P(x),
x P(x), is the proposition:
– “All parking spaces at UF are occupied.”
– “For each parking space at UF, that space is full.”
5/6/2017
Michael Frank / Kees van Deemter
20
Module #1 - Logic
Syntax of predicate logic
(for 1- and 2-place predicates)
•
•
•
•
5/6/2017
Variable: x,y,z,… Constants: a,b,c,…
1-place predicates: P,Q,…
2-place predicates: R,S,…
Atomic formulas:
If  is a 1-pace predicate and  a variable or
constant then () is an atomic formula.
If  is a 2-pace predicate and  and  are
variables or constants then (,) is an atomic
formula.
Michael Frank / Kees van Deemter
21
Module #1 - Logic
Syntax of predicate logic
(for 1- and 2-place predicates)
(Wellformed) Formulas:
• All atomic formulas are formulas
• If  and  are formulas then ,
( ), (), ( ) are formulas.
• If  is a formula then x  and x 
are formulas. (Likewise, y  and y ,
and so on.)
This could be seen as “overgenerating”
wellformed formulas somewhat
5/6/2017
Michael Frank / Kees van Deemter
22
Module #1 - Logic
Syntax of predicate logic
(for 1- and 2-place predicates)
Show that these are wellformed formulas:
xP(x) yQ(x) xy R(x,y) xP(b)
5/6/2017
Michael Frank / Kees van Deemter
23
Module #1 - Logic
Syntax of predicate logic
(for 1- and 2-place predicates)
xP(x)
yQ(x)
xy R(x,y)
xP(b)
• P(x) is a (atomic) formula, hence xP(x) is a formula
• Q(x) is a (atomic) formula, hence yQ(x) is a formula
• R(x,y) is a (atomic) formula, hence y R(x,y) is a
formula, hence xy R(x,y) is a formula
• P(b) is a (atomic) formula, hence xP(b) is a formula
5/6/2017
Michael Frank / Kees van Deemter
24
Module #1 - Logic
Syntax of predicate logic
(for 1- and 2-place predicates)
• Examples: xP(x) and yQ(x),
x(y R(x,y)), x(x R(x,y)), xP(b) etc.
• Lots of pathological cases. For example,
– It will follow from the meaning of these
formulas that xP(b) is true iff P(b) is true
– Rule of thumb: a quantifier that does not bind
any variables can be ignored
5/6/2017
Michael Frank / Kees van Deemter
25
Topic #3 – Predicate Logic
Module #1 - Logic
Free and Bound Variables
• An expression like P(x) is said to have a
free variable x (i.e., x is not “defined”).
• A quantifier (either  or ) operates on an
expression having one or more free
variables, and binds one or more of those
variables, to produce an expression having
one or more bound variables.
5/6/2017
Michael Frank / Kees van Deemter
26
Topic #3 – Predicate Logic
Module #1 - Logic
Example of Binding
• P(x,y) has 2 free variables, x and y.
• x P(x,y) has 1 free variable, and one bound
variable. [Which is which?]
• An expression with zero free variables is a
bona-fide (actual) proposition.
• An expression with one or more free
variables is similar to a predicate:
e.g. let Q(y) = x Adore(x,y)
5/6/2017
Michael Frank / Kees van Deemter
27
Topic #3 – Predicate Logic
Module #1 - Logic
Free variables, defined formally
• The free-variable occurrences in an Atom are: all
the variable occurrences in that Atom
• The free-variable occurrences in  are: the freevariable occurrences in 
• The free-variable occurrences in
( connective ) are: the free-variable occurrences
in  plus the free-variable occurrences in 
• The free-variable occurrences in x and x
are: the free-variable occurrences in  except for
all/any occurrences of x.
5/6/2017
Michael Frank / Kees van Deemter
28
Module #1 - Logic
• Occurrences of variables that are not free are
bound.
• Test your understanding: Which (if any) variables
are free in
x P(x)
x P(x)
yQ(x)
xP(b) (NB, b is a constant)
x(y R(x,y))
5/6/2017
Michael Frank / Kees van Deemter
29
Module #1 - Logic
• Occurrences of variables that are not free
are bound.
• Check your understanding: Which (if any)
variables are free in
x P(x) [no free variables]
x P(x) [no free variables]
yQ(x) [x is free]
xP(b) (NB, b is a constant) [no free var.]
x(y R(x,y)) [no free variables]
5/6/2017
Michael Frank / Kees van Deemter
30
Topic #3 – Predicate Logic
Module #1 - Logic
A more precise definition of the
truth/falsity of quantified formulas
• (Formulation is simplified somewhat because
we assume that every object in the u.d. D has
a `name` (i.e., a constant referring to it)).
• First some notation: (x:=a) is the result of
substituting all free occurrences of the
variable x in  by the constant a
5/6/2017
Michael Frank / Kees van Deemter
31
Topic #3 – Predicate Logic
Module #1 - Logic
Exercise
Say what (x:=a) is, if  =
1.
2.
3.
4.
5.
5/6/2017
P(x)
R(x,y)
P(b)
x P(x)
yQ(x)
Michael Frank / Kees van Deemter
32
Topic #3 – Predicate Logic
Module #1 - Logic
Exercise
Say what (x:=a) is, if  =
1.
2.
3.
4.
5.
5/6/2017
P(x) ..... P(a)
R(x,y) .... R(a,y)
P(b) ..... P(b)
x P(x) ...... x P(x)
yQ(x) ...... yQ(a)
Michael Frank / Kees van Deemter
33
Topic #3 – Predicate Logic
Module #1 - Logic
A more precise definition of the
truth/falsity of quantified formulas
• (Formulation is simplified somewhat because
we assume that every object in the u.d. has
a `name` (i.e., a constant referring to it)).
• Let  be a formula. Then x is true in D if
at least one expression of the form (x:=a)
is true in D, and false otherwise.
(a can be any constant)
5/6/2017
Michael Frank / Kees van Deemter
34
Topic #3 – Predicate Logic
Module #1 - Logic
A more precise definition
• Let  be a formula. Then x is true in D if
at least one expression (x:=a) is true in D,
and false otherwise.
• A simple example:  = P(x)
P(x) is a formula, hence x P(x) is true in D
if at least one expression of the form P(a) is
true in D, and false otherwise.
5/6/2017
Michael Frank / Kees van Deemter
35
Topic #3 – Predicate Logic
Module #1 - Logic
Similarly for 
• Let  be a formula. Then the proposition
x is true in D if every expression of the
form (x:=a) is true in D, and false
otherwise.
• A simple example:  = P(x)
P(x) is a formula, hence x P(x) is true in
D if every expression P(a) is true in D, and
false otherwise.
5/6/2017
Michael Frank / Kees van Deemter
36
Topic #3 – Predicate Logic
Module #1 - Logic
Complex formulas
Example: Let the u.d. of x and y be people.
Let L(x,y)=“x likes y” (a predicate w. 2 f.v.’s)
Then y L(x,y) = “There is someone whom x
likes.” (A predicate w. 1 free variable, x)
Then x (y L(x,y)) =
“Everyone has someone whom they like.”
(a real proposition; no free variables left)
5/6/2017
Michael Frank / Kees van Deemter
37
Topic #3 – Predicate Logic
Module #1 - Logic
Consequences of Binding (work out for yourself by
checking when each formula is true)
• x x P(x) - x is not a free variable in
x P(x), therefore the x binding isn’t used,
as it were.
• (x P(x))  Q(x) - The variable x is outside
of the scope of the x quantifier, and is
therefore free. Not a complete proposition!
• (x P(x))  (x Q(x)) – A complete
proposition, and no superfluous quantifiers
5/6/2017
Michael Frank / Kees van Deemter
38
Module #1 - Logic
Nested quantifiers
Assume S(x,y) means “x sees y”
u.d.=all people
What does the following formula mean?
xS(x,a)
5/6/2017
Michael Frank / Kees van Deemter
39
Module #1 - Logic
Nested quantifiers
Assume S(x,y) means “x sees y”.
u.d.=all people
xS(x,a) means
“For every x, x sees a”
In other words,
“Everyone sees a”
5/6/2017
Michael Frank / Kees van Deemter
40
Module #1 - Logic
Nested quantifiers
What does the following formula mean?
x(y S(x,y))
5/6/2017
Michael Frank / Kees van Deemter
41
Module #1 - Logic
Nested quantifiers
x(y S(x,y)) means “For every x, there exists
a y such that x sees y”
In other words:
“Everyone sees someone”
5/6/2017
Michael Frank / Kees van Deemter
42
Topic #3 – Predicate Logic
Module #1 - Logic
Quantifier Exercise
If R(x,y)=“x relies upon y,” express the
following in unambiguous English:
Everyone has someone to rely on.
x(y R(x,y))=
There’s a poor overburdened soul whom
y(x R(x,y))= everyone relies upon (including himself)!
x(y R(x,y))= There’s some needy person who relies
upon everybody (including himself).
y(x R(x,y))=Everyone has someone who relies upon them.
x(y R(x,y))= Everyone relies upon everybody,
(including themselves)!
5/6/2017
Michael Frank / Kees van Deemter
43
Topic #3 – Predicate Logic
Module #1 - Logic
Quantifier Exercise
R(x,y)=“x relies upon y”. Suppose the u.d. is
not empty. Now consider these formulas:
1. x(y R(x,y))
2. y(x R(x,y))
3. x(y R(x,y))
Which of them is most informative?
Which of them is least informative?
5/6/2017
Michael Frank / Kees van Deemter
44
Topic #3 – Predicate Logic
Module #1 - Logic
Quantifier Exercise
(Recall: the u.d. is not empty. Empty u.d.’s are
discussed later.)
1. x(y R(x,y)) Least informative
2. y(x R(x,y))
3. x(y R(x,y)) Most informative
If 3 is true then 2 must also be true.
If 2 is true then 1 must also be true.
We say: 3 is logically stronger than 2 than 1
5/6/2017
Michael Frank / Kees van Deemter
45
Module #1 - Logic
“logically stronger than”
• General:  is logically stronger than  iff
– it is not possible for  to be true and  false
– it is possible for  to be true and  false
• E.g.  = John is older than 30,
 = John is older than 20.
• We write ‘iff’ for ‘if and only if’
5/6/2017
Michael Frank / Kees van Deemter
46
Topic #3 – Predicate Logic
Module #1 - Logic
Natural language is ambiguous!
• “Everybody likes somebody.”
– For everybody, there is somebody they like,
• x y Likes(x,y)
[Probably more likely.]
– or, there is somebody (a popular person) whom
everyone likes?
• y x Likes(x,y)
5/6/2017
Michael Frank / Kees van Deemter
47
Module #1 - Logic
Interactions between
quantifiers and connectives
Let the u.d. be parking spaces at UF.
Let P(x) be “x is occupied.”
Let Q(x) be “x is free of charge.”
1. x (Q(x)  P(x))
2. x (Q(x)  P(x))
3. x (Q(x) P(x))
4. x (Q(x)  P(x))
5/6/2017
Michael Frank / Kees van Deemter
48
Module #1 - Logic
I. Construct English paraphrases
Let the u.d. be parking spaces at UF.
Let P(x) be “x is occupied.”
Let Q(x) be “x is free of charge.”
1. x (Q(x)  P(x))
2. x (Q(x)  P(x))
3. x (Q(x) P(x))
4. x (Q(x)  P(x))
5/6/2017
Michael Frank / Kees van Deemter
49
Module #1 - Logic
I. Construct English paraphrases
1. x (Q(x)  P(x)) Some places are free of
charge and occupied
2. x (Q(x)  P(x)) All places are free of
charge and occupied
3. x (Q(x) P(x)) All places that are free
of charge are occupied
4. x (Q(x)  P(x)) For some places x, if x
is free of charge then x is occupied
5/6/2017
Michael Frank / Kees van Deemter
50
Module #1 - Logic
About the last of these
4. x (Q(x)  P(x)) “For some x, if x is free of
charge then x is occupied”
x (Q(x)  P(x)) is true iff, for some place a,
Q(a)  P(a) is true.
Q(a)  P(a) is true iff
Q(a) is false and/or P(a) is true
(conditional is only false in one row of table!)
“Some places are either (not free of charge)
and/or occupied”
5/6/2017
Michael Frank / Kees van Deemter
51
Module #1 - Logic
About the last of these
4. x (Q(x)  P(x)) When confused by a
conditional: re-write it using negation and
disjunction:
x (Q(x)  P(x))  (p. 67)
x Q(x)  x P(x) “Some places are
not free of charge or some places are
occupied”
5/6/2017
Michael Frank / Kees van Deemter
52
Module #1 - Logic
• Combinations to remember:
1. x (Q(x)  P(x))
2. x (Q(x) P(x))
5/6/2017
Michael Frank / Kees van Deemter
53
Module #1 - Logic
II. Construct a model where 1 and 4
are true, while 2 and 3 are false
Let the u.d. be parking spaces at UF.
Let P(x) be “x is occupied.”
Let Q(x) be “x is free of charge.”
1. x (Q(x)  P(x))
2. x (Q(x)  P(x))
3. x (Q(x) P(x))
4. x (Q(x)  P(x))
5/6/2017
Michael Frank / Kees van Deemter
54
Module #1 - Logic
II. Construct a model where 1 and 4
are true, while 2 and 3 are false
1. x (Q(x)  P(x)) (true for place a below)
2. x (Q(x)  P(x)) (false for places b below)
3. x (Q(x) P(x)) (false for place b below)
4. x (Q(x)  P(x)) (true for place a below)
One solution: a model with exactly two objects in it.
One object has the property Q and the property
P; the other object has the property Q but not the
property P. In a diagram:
a: Q P
5/6/2017
b: Q not-P
Michael Frank / Kees van Deemter
55
Module #1 - Logic
III. Construct a model where 1 and 3
and 4 are true, but 2 is false
1.
2.
3.
4.
x (Q(x)  P(x))
x (Q(x)  P(x))
x (Q(x) P(x))
x (Q(x)  P(x))
Here is such a model (using a diagram). It has just
two objects in its u.d., called a and b:
a: Q P
5/6/2017
b: not-Q P
Michael Frank / Kees van Deemter
56
Topic #3 – Predicate Logic
Module #1 - Logic
Quantifier Equivalence Laws
• Expanding quantifiers: If u.d.=a,b,c,…
x P(x)  P(a)  P(b)  P(c)  …
x P(x)  P(a)  P(b)  P(c)  …
• From those, we can “prove” the laws:
x P(x)  x P(x)
x P(x)  x P(x)
• Which propositional equivalence laws can
be used to prove this?
5/6/2017
Michael Frank / Kees van Deemter
57
Module #1 - Logic
Remember
• In propositional logic, we can strictly
speaking only build formulas of finite size.
• E.g., we can write
P(a)  P(b)
P(a)  P(b)  P(c)
P(a)  P(b)  P(c)  P(d) , etc.
• But this way, we could never say that all
natural numbers have P
5/6/2017
Michael Frank / Kees van Deemter
58
Module #1 - Logic
Formulas of infinite length?
• In predicate logic, you can say this easily:
xP(x)
• It’s sometimes useful to pretend that
propositional logic allows infinitely long
formulas, but in the “official” version this is
not possible.
5/6/2017
Michael Frank / Kees van Deemter
59
Topic #3 – Predicate Logic
Module #1 - Logic
More Equivalence Laws
• x y P(x,y)  y x P(x,y)
x y P(x,y)  y x P(x,y)
• x (P(x)  Q(x))  (x P(x))  (x Q(x))
x (P(x)  Q(x))  (x P(x))  (x Q(x))
5/6/2017
Michael Frank / Kees van Deemter
60
Topic #3 – Predicate Logic
Module #1 - Logic
More Equivalence Laws
• x y P(x,y)  y x P(x,y)
x y P(x,y)  y x P(x,y)
• x (P(x)  Q(x))  (x P(x))  (x Q(x))
x (P(x)  Q(x))  (x P(x))  (x Q(x))
• Let’s prove the last of these equivalences
using the definition of the truth of a formula
of the form x φ
5/6/2017
Michael Frank / Kees van Deemter
61
Topic #3 – Predicate Logic
Module #1 - Logic
A Pred. Log. equivalence proven
• x (P(x)  Q(x))  (x P(x))  (x Q(x))
Proof:
 Suppose x (P(x)  Q(x)) is true. So, there is a
constant a such that (P(x)  Q(x)) (x:=a) is true.
So, for that a, the formula P(a)  Q(a) is true. One
possibility is that P(a) is true. In this case,
P(x)(x:=a) is true. So, x P(x) is true, so (x P(x))
 (x Q(x)) is true. The other possibility is that
Q(a) is true. In this case, Q(x)(x:=a) is true.
So, x Q(x) is true, so (x P(x))  (x Q(x))
is true.
5/6/2017
Michael Frank / Kees van Deemter
62
Topic #3 – Predicate Logic
Module #1 - Logic
A Pred. Log. equivalence proven
• x (P(x)  Q(x))  (x P(x))  (x Q(x))
Proof:
 Suppose (x P(x))  (x Q(x)) is true. One
possibility is that x P(x) is true. This would mean
that there is an a such that P(x) (x:=a) is true. So,
for that constant a, P(a) is true.Therefore,
P(a)  Q(a) would also be true. Hence,
(P(x)  Q(x))(x:=a) would be true. Hence,
x (P(x)  Q(x)) would be true. The other
possibility is that x Q(x). From this, x (P(x) 
Q(x)) is proven in the same way QED
5/6/2017
Michael Frank / Kees van Deemter
63
Topic #3 – Predicate Logic
Module #1 - Logic
More Equivalence Laws
• x y P(x,y)  y x P(x,y)
x y P(x,y)  y x P(x,y)
• x (P(x)  Q(x))  (x P(x))  (x Q(x))
x (P(x)  Q(x))  (x P(x))  (x Q(x))
• How about this one?
x (P(x)  Q(x))  (x P(x))  (x Q(x))?
5/6/2017
Michael Frank / Kees van Deemter
64
Topic #3 – Predicate Logic
Module #1 - Logic
More Equivalence Laws
• How about this one?
x (P(x)  Q(x))  (x P(x))  (x Q(x)) ?
• This equivalence statement is false.
Counterexample (i.e. model making this false):
• P(x): x’s birthday is on 30 April
Q(x): x’s birthday is on 20 December
5/6/2017
Michael Frank / Kees van Deemter
65
Module #1 - Logic
Cases to think carefully about
Let’s discuss some specific cases
These might seem unusual, but it’s
important not to loose your way when
they occur
1. Quantifiers that don’t bind any variables
2. Quantification in an empty u.d.
3. x (Q(x) P(x)) when yQ(y)
5/6/2017
Michael Frank / Kees van Deemter
66
Module #1 - Logic
1. Quantifiers that do not bind:
xP(b)
• Recall definition: Let  be a formula.
Then x is true in D if every expression
(x:=a) is true in D, and false otherwise.
• xP(b) is true in D if every expression of
the form P(b)(x:=a) is true in D, and false
otherwise.
• What is the set of all the expression of the
form P(b)(x:=a)?
5/6/2017
Michael Frank / Kees van Deemter
67
Module #1 - Logic
Consider xP(b)
• What is the set of all the expression of the
form P(b)(x:=a)?
• That’s the singleton set {P(b)} ! So,
• xP(b) is true in D if P(b) is true,
and false otherwise.
• So, xP(b) means just P(b)
5/6/2017
Michael Frank / Kees van Deemter
68
Module #1 - Logic
2. Empty u.d.: We defined
• Let  be a formula. Then the proposition
x is true in D if every expression (x:=a)
is true in D, and false otherwise.
This is read as follows:
• Let  be a formula. Then the proposition
x is false in D if at least one expression
(x:=a) is false in D, and true otherwise.
5/6/2017
Michael Frank / Kees van Deemter
69
Module #1 - Logic
 could have been defined
differently. For example,
• Let  be a formula. Then the proposition
x is true in D if D is nonempty and every
expression (x:=a) is true in D, and false
otherwise.
– Under this definition, x P(x) would have been
false whenever D is empty (e.g., when there are
no parking spaces at U.F., and P = “occupied”)
– But that’s not how it’s done!
5/6/2017
Michael Frank / Kees van Deemter
70
Module #1 - Logic
Suppose D is empty
Suppose the u.d. is empty. Consider
x P(x) (e.g., P(x) means “x is occupied.”)
This counts as true. (Sometimes called
“vacuously true”)
For the same reason,
x P(x) is also true
5/6/2017
Michael Frank / Kees van Deemter
71
Module #1 - Logic
Consequences of the standard
position
Two logical equivalences in Predicate Logic:
x P(x)  x P(x) (“no counterexample against P”)
x P(x)  x P(x)
So, one of the two quantifiers suffices
(cf., functional completeness of a set of
connectives in propositional logic)
We’ll return to these equivalences later.
5/6/2017
Michael Frank / Kees van Deemter
72
Module #1 - Logic
3. x (Q(x) P(x)) when yQ(y)
5/6/2017
Michael Frank / Kees van Deemter
73
Module #1 - Logic
When many implications
are combined
•
•
•
•
5/6/2017
Consider the formula r = x (Q(x) P(x))
with respect to a nonempty u.d.
Suppose yQ(y)
(For example, Q might mean “being more
than 4 meters tall”)
Can you work out whether r is true?
Michael Frank / Kees van Deemter
74
Module #1 - Logic
When many implications
are combined
•
•
•
•
•
5/6/2017
Consider x (Q(x) P(x)) in a nonempty u.d.
Suppose, however, yQ(y)
Then Q(a) P(a) is true for every a
(since Q(a) is false for every a)
Consequently x (Q(x) P(x)) is true
Once again, we sometimes say: it is vacuously
true (because the antecedent is always false, so
you can never use the formula to conclude that P
holds of something).
Michael Frank / Kees van Deemter
75
Module #1 - Logic
Vacuous truth
•
•
5/6/2017
Example 1: Think of a tax form: “Have you sent
us details about all your children?” No children
 You’ve complied (without doing anything)
Example 2: Think of our definition of (x:=a) as
“the result of substituting all
free occurrences of x in  by a”
No occurrences  don’t do anything (after
which it’s true that all occurrences have been
substituted)
Michael Frank / Kees van Deemter
76
Module #1 - Logic
Some consequences
of these definitions
• Sometimes, predicate logic is taught very
informally
• This makes it easy to understand simple formulas
• But each more complex case has to be explained
separately, as if it was an exception
• By defining things properly once, complex
formulas fall out as special cases
• One example: quantifier nesting
5/6/2017
Michael Frank / Kees van Deemter
77
Topic #3 – Predicate Logic
Module #1 - Logic
Back to Quantifier Exercise
R(x,y)=“x relies upon y”. Suppose the u.d. is
empty. Now consider these formulas:
1. x(y R(x,y))
2. y(x R(x,y))
3. x(y R(x,y))
Which of them is most informative?
Which of them is least informative?
5/6/2017
Michael Frank / Kees van Deemter
78
Topic #3 – Predicate Logic
Module #1 - Logic
Back to our Quantifier Exercise
Now that the u.d. is empty,
1. x(y R(x,y)) is uninformative
2. y(x R(x,y)) is false!
3. x(y R(x,y)) is uninformative
x(P(x)) is true if P(a) is true for all a.
If no x exist then this makes x(P(x))
(“vacuously”) true
x(P(x)) is true if P(a) is true for some a.
If no x exist then this makes x(P(x)) false.
5/6/2017
Michael Frank / Kees van Deemter
79
Module #1 - Logic
Back to models: Look at the old
formula 3 again
3. x (Q(x) P(x)) Consider this model:
a: Q P
c:Q P
b: QP
d: QP
Is the proposition true or false in the model?
5/6/2017
Michael Frank / Kees van Deemter
80
Module #1 - Logic
Look at formula number 3 again
3. x (Q(x) P(x)) is true in this model:
a: Q P
c:Q P
b: QP
d: QP
(3) Is true iff each of these is true:
x (Q(a) P(a))
x (Q(b) P(b))
x (Q(c) P(c))
x (Q(d) P(d))
5/6/2017
Michael Frank / Kees van Deemter
81
Module #1 - Logic
Look at formula number 3 again
3. x (Q(x) P(x)) is true in this model:
a: Q P
c:Q P
b: QP
d: QP
(3) Is true because each of these is true:
Q(a) P(a) … F T, hence T
Q(b) P(b) … F F, hence T
Q(c) P(c) … F T, hence T
Q(d) P(d) … F F, hence T
5/6/2017
Michael Frank / Kees van Deemter
82
Module #1 - Logic
Predicate Logic essentials
• Predicates of different arity (one-place, twoplace, etc.)
• Quantifiers: [x P(x)] :≡ “For all x, P(x).”
[x P(x)] :≡ “There is/are x such that P(x).”
• Universes of discourse, bound & free vars.
• The rest follows: empty domains, quantified
implications, quantifier nesting
5/6/2017
Michael Frank / Kees van Deemter
83
Topic #3 – Predicate Logic
Module #1 - Logic
Some common shorthands
• Sometimes the universe of discourse is
restricted within the quantification, e.g.,
– x>0 P(x) is shorthand for
“For all x that are greater than zero, P(x).”
• How would you write this in formal
notation?
5/6/2017
Michael Frank / Kees van Deemter
84
Topic #3 – Predicate Logic
Module #1 - Logic
Some common shorthands
• Sometimes the universe of discourse is
restricted within the quantification, e.g.,
– x>0 P(x) is shorthand for
“For all x that are greater than zero, P(x).”
=x (x>0  P(x))
5/6/2017
Michael Frank / Kees van Deemter
85
Topic #3 – Predicate Logic
Module #1 - Logic
Some common shorthands
• Sometimes the universe of discourse is
restricted within the quantification, e.g.,
– x>0 P(x) is shorthand for
“For all x that are greater than zero, P(x).”
=x (x>0  P(x))
– x>0 P(x) is shorthand for
“There is an x greater than zero such that P(x).”
=x (x>0  P(x))
5/6/2017
Michael Frank / Kees van Deemter
86
Topic #3 – Predicate Logic
Module #1 - Logic
Some common shorthands
• Consecutive quantifiers of the same type
can be combined:
xyz P(x,y,z) def x y z P(x,y,z)
xyz P(x,y,z) def  x  y  z P(x,y,z)
5/6/2017
Michael Frank / Kees van Deemter
87
Module #1 - Logic
Theorems about logic
• We are studying logical languages/calculi to
allow you to use them (better)
• Logicians study logical languages/calculi to
understand their limitations
• Meta-theorems can, e.g., say things like “…
cannot be expressed in predicate logic”
5/6/2017
Michael Frank / Kees van Deemter
88
Module #1 - Logic
Theorems about logic
• About propositional logic, we asked “What types
of things can we express?” How many connectives
do we need?
• About predicate logic, logicians ask similar
questions. For example, are these two quantifiers
enough to be able to ‘say everything’?
• This is a question about the expressive power of
predicate logic
5/6/2017
Michael Frank / Kees van Deemter
89
Module #1 - Logic
Example: one
• As per their name, quantifiers can be used
to express that a predicate is true of a given
quantity (number) of objects.
• Example: Can predicate logic say “there
exists at most one object with property P”?
5/6/2017
Michael Frank / Kees van Deemter
90
Module #1 - Logic
Example: at most one
• Example: Can predicate logic say “there
exists at most one object with property P”?
Yes (provided we have equality):
xy ((P(x)  P(y))  x= y)
5/6/2017
Michael Frank / Kees van Deemter
91
Module #1 - Logic
Example: one
• Can predicate logic say “there exists exactly
one object with property P”?
5/6/2017
Michael Frank / Kees van Deemter
92
Module #1 - Logic
Example: one
• Can predicate logic say “there exists exactly
one object with property P”?
xP(x)  xy((P(x) P(y))x= y)
• “There exist x such that P(x)” and
“There exists at most one x such that P(x)”
• Abbreviation: !x P(x)
(“there exists exactly one x such that P(x)”)
5/6/2017
Michael Frank / Kees van Deemter
93
Module #1 - Logic
Example: one
• Another way to write this:
• x (P(x)  y (P(y)  y x))
“There is an x such that P(x), such that there
is no y such that P(y) and y x.”
• x binds x throughout the conjunction:
x (P(x)  y (P(y)  y x))
5/6/2017
Michael Frank / Kees van Deemter
94
Module #1 - Logic
At least two
• Can predicate logic say “there exist at least
two objects with property P”?
5/6/2017
Michael Frank / Kees van Deemter
95
Module #1 - Logic
At least two
• Can predicate logic say “there exist at least
two objects with property P”?
• Yes:
x y ((P(x)  P(y))  x y)
• Incorrect would be
xP(x)  y(P(y)  x y),
(where x occurs free, and which
therefore does not express a proposition)
5/6/2017
Michael Frank / Kees van Deemter
96
Module #1 - Logic
Exactly two
• Can predicate logic say “there exist exactly
two objects with property P”?
5/6/2017
Michael Frank / Kees van Deemter
97
Module #1 - Logic
Exactly wo
• Can predicate logic say “there exist exactly
two objects with property P”?
• Yes:
• x y (P(x)  P(y)  x y 
z (P(z)  (z= x  z= y) ))
5/6/2017
Michael Frank / Kees van Deemter
98
Module #1 - Logic
What’s wrong with
• x y (P(x)  P(y)  x y) 
z (P(z)  (z= x  z= y ))
as a formalisation of ‘exactly two’?
5/6/2017
Michael Frank / Kees van Deemter
99
Module #1 - Logic
What’s wrong with
• x y (P(x)  P(y)  x y) 
z (P(z)  (z= x  z= y ))
as a formalisation of ‘exactly two’?
• This is a conjunction of two separate
propositions. As a result, x and y are not
bound, so this is not even a proposition
5/6/2017
Michael Frank / Kees van Deemter
100
Module #1 - Logic
infinitely many
• Can predicate logic say “there exist
infinitely many objects with property P”?
• No! [This follows from the so-called
Compactness Theorem: “An infinite set S of
formulas has a model iff every finite subset
of S has a model”]
• How about finitely many?
5/6/2017
Michael Frank / Kees van Deemter
101
Module #1 - Logic
finitely many
• How about finitely many?
• Suppose there existed a formula  =
“there exist only finitely many x such that
so and so”
• Then  = “there exist infinitely many x
such that so and so”
• We know that such a formula does not exist
• So, also  does not exist
5/6/2017
Michael Frank / Kees van Deemter
102
Module #1 - Logic
(Of course if we allow infinite conjunctions
then all this can be expressed:
!x P(x)  2!x P(x)  3!x P(x)  …
5/6/2017
Michael Frank / Kees van Deemter
)
103
Module #1 - Logic
• Can predicate logic say “most objects have
property P”?
• No! [This follows from the Compactness
Theorem as well. Again, this is unless we
allow infinitely long disjunctions.]
• Can predicate logic say “many objects have
property P”?
• No, only precisely defined quantities
5/6/2017
Michael Frank / Kees van Deemter
104
Module #1 - Logic
Decidability
•
We’ve shown you two ways of checking
propositional-logic equivalencies:
1. Checking truth tables
2. Using equivalence laws
•
•
5/6/2017
You’ve seen how (1) can be done
algorithmically.
This shows that checking propositional
logic equivalence is decidable
Michael Frank / Kees van Deemter
105
Module #1 - Logic
Decidability
•
•
•
5/6/2017
Checking proplog equivalence is decidable
Checking predlog equivalence is not decidable
Therefore, theorem proving will always remain
an art (for both computers and humans)
Some “fragments” of predlog are decidable. One
application: PROLOG
Michael Frank / Kees van Deemter
106
Module #1 - Logic
Bonus Topic: Logic Programming
• Some programming languages are based entirely
on (a part of) predicate logic
• The most famous one is called Prolog.
• A Prolog program is a set of propositions (“facts”)
and (“rules”) in predicate logic.
• The input to the program is a “query” proposition.
– Want to know if it is true or false.
• The Prolog interpreter does some automated
deduction to determine whether the query follows
from the facts.
5/6/2017
Michael Frank / Kees van Deemter
107
Module #1 - Logic
Facts in Prolog
• A fact in Prolog represents a simple, noncompound proposition in predicate logic.
– E.g.,
likes(john,mary)
– Lowercase symbols are used for constants and
predicates, uppercase is used for variables.
5/6/2017
Michael Frank / Kees van Deemter
108
Module #1 - Logic
Rules in Prolog
• A rule in Prolog represents a universally
quantified proposition of the general form
xy (P(x,y)→Q(x)),
where x and y are variables, P a possibly
compound predicate, and Q an atomic proposition.
• In Prolog:
q(X) :- p(X,Y).
i.e., the , quantifiers are implicit.
• Example: likable(X) :- likes(Y,X).
5/6/2017
Michael Frank / Kees van Deemter
109
Module #1 - Logic
Rules in Prolog
• Note that xy (P(x,y)→Q(x))
is equivalent to x((y P(x,y)→Q(x))
• In other words,
Q(x) holds if you can find a y
such that P(x,y)
5/6/2017
Michael Frank / Kees van Deemter
110
Module #1 - Logic
Conjunction and Disjunction
• Logical conjunction is encoded using
multiple comma-separated terms in a rule.
• Logical disjunction is encoded using
multiple rules.
• E.g., x ((P(x)Q(x))R(x))→S(x)
can be rendered in Prolog as:
s(X) :- p(X),q(X)
s(X) :- r(X)
5/6/2017
Michael Frank / Kees van Deemter
111
Module #1 - Logic
Deduction in Prolog
• When a query is input to the Prolog
interpreter,
– it searches its database to determine if the query
can be proven true from the available facts.
– if so, it returns “yes”, if not, “no” (!)
– If the query contains any variables, all values
that make the query true are printed.
5/6/2017
Michael Frank / Kees van Deemter
112
Module #1 - Logic
Simple Prolog Example
• An example input program:
likes(john,mary).
likes(mary,fred).
likes(fred,mary).
likable(X) :- likes(Y,X).
• An example query: ? likable(Z)
returns: ...
5/6/2017
Michael Frank / Kees van Deemter
113
Module #1 - Logic
Simple Prolog Example
• An example input program:
likes(john,mary).
likes(mary,fred).
likes(fred,mary).
likable(X) :- likes(Y,X).
• An example query: ? likable(Z)
returns:
mary fred
5/6/2017
Michael Frank / Kees van Deemter
114
Module #1 - Logic
Relation between PROLOG and
Predicate Logic
• PROLOG cannot use all predicate logic
formulas. (It covers a decidable “fragment”
of predicate logic.)
• It uses ‘negation as failure’
• Based on these limitations, PROLOG-based
deduction is decidable.
• PROLOG is more than just logic
(I/O, cut!), but logic is its hard core.
5/6/2017
Michael Frank / Kees van Deemter
115
Topic #3 – Predicate Logic
Module #1 - Logic
Deduction Example
(as appetiser for the next lecture)
•
Premises:
1. x H(x)  M(x) (e.g. “Humans are mortal”)
2. x G(x)  M(x) (“Gods are immortal”).
•
5/6/2017
Suppose you need to prove the Conclusion
x (H(x)  G(x))
(“No human is a god.”)
Michael Frank / Kees van Deemter
116
Topic #3 – Predicate Logic
Module #1 - Logic
A ‘semantic’ proof
in informal style
x (H(x)  M(x)) (“Humans are mortal”) and
x (G(x)  M(x)) (“Gods are immortal”).
Suppose x (H(x)  G(x)). For example,
H(a)  G(a). Then
By the first premisse, we have M(a).
By the second premisse, we have M(a).
Contradiction! Therefore, it follows that
x (H(x)  G(x)) (“No human is a god.”)
5/6/2017
Michael Frank / Kees van Deemter
117
Topic #3 – Predicate Logic
Module #1 - Logic
Alternative proof, using
equivalences
•
•
•
•
•
•
•
5/6/2017
x (H(x)M(x)) and x (G(x)M(x)).
x (M(x)H(x)) [Contrapositive.]
x ([G(x)M(x)]  [M(x)H(x)])
x (G(x)H(x))
[Transitivity of .]
x (G(x)  H(x)) [Definition of .]
x (G(x)  H(x)) [DeMorgan’s law.]
x (G(x)  H(x)) [An equivalence law.]
Michael Frank / Kees van Deemter
118
Topic #3 – Predicate Logic
Module #1 - Logic
Bonus:
Number Theory Examples
Let u.d. = the natural numbers 0, 1, 2, …
What do the following mean?
• x (E(x)  (y x=2y))
• x (P(x) 
(x>1  yz x=yz  y1  z1))
5/6/2017
Michael Frank / Kees van Deemter
119
Topic #3 – Predicate Logic
Module #1 - Logic
Bonus:
more Number Theory Examples
• Let u.d. = the natural numbers 0, 1, 2, …
• “A number x has the property E if and only if it is
equal to 2 times some other number.” (even!)
x (E(x)  (y x=2y))
• “A number has P, iff it’s greater than 1 and it isn’t
the product of any non-unity numbers.” (prime!)
x (P(x)  (x>1  yz x=yz  y1  z1))
5/6/2017
Michael Frank / Kees van Deemter
120
Topic #3 – Predicate Logic
Module #1 - Logic
Goldbach’s Conjecture (unproven)
Using E(x) and P(x) from previous slide,
x( [x>2  E(x)] →
p q P(p)  P(q)  p+q = x).
5/6/2017
Michael Frank / Kees van Deemter
121
Topic #3 – Predicate Logic
Module #1 - Logic
Goldbach’s Conjecture (unproven)
Using E(x) and P(x) from previous slide,
x( [x>2  E(x)] →
p q P(p)  P(q)  p+q = x).
“Every even number greater than 2
is the sum of two primes.”
5/6/2017
Michael Frank / Kees van Deemter
122
Topic #3 – Predicate Logic
Module #1 - Logic
Game Theoretic Semantics
• Thinking in terms of a competitive game can help you tell
whether a proposition with nested quantifiers is true.
• The game has two players, both with the same knowledge:
– Verifier: Wants to demonstrate that the proposition is true.
– Falsifier: Wants to demonstrate that the proposition is false.
• The Rules of the Game “Verify or Falsify”:
– Read the quantifiers from left to right, picking values of variables.
– When you see “”, the falsifier gets to select the value.
– When you see “”, the verifier gets to select the value.
• If the verifier can always win, then the proposition is true.
• Otherwise it is false.
5/6/2017
Michael Frank / Kees van Deemter
123
Topic #3 – Predicate Logic
Module #1 - Logic
Let’s Play, “Verify or Falsify!”
Let B(x,y) :≡ “x’s birthday is followed within 14 days
by y’s birthday.”
Suppose I claim that among you:
x y B(x,y)
Your turn, as falsifier:
You pick any x → (so-and-so)
y B(so-and-so,y)
My turn, as verifier:
I pick any y → (such-and-such)
B(so-and-so,such-and-such)
5/6/2017
Michael Frank / Kees van Deemter
124
Topic #3 – Predicate Logic
Module #1 - Logic
Summing up ‘strict’ Predicate Logic
without extensions and simplified notations
Syntax definition
• Variable: x,y,z,… Constants: a,b,c,…
• 1-place predicates: P,Q,…
• 2-place predicates: R,S,…
Atomic formulas:
If  is a 1-pace predicate and  a variable or
constant then () is an atomic formula.
If  is a 2-pace predicate and  and  are
variables or constants then (,) is an atomic
formula. [and so on for 3-place, etc.]
5/6/2017
Michael Frank / Kees van Deemter
125
Module #1 - Logic
Syntax of predicate logic
(for 1- and 2-place predicates)
(Wellformed) Formulas:
– All atomic formulas are formulas
– If  and  are formulas then ,
( ), (), ( ) are formulas.
– If  is a formula then x  and y 
are formulas.
5/6/2017
Michael Frank / Kees van Deemter
126
Module #1 - Logic
Semantics of predicate logic
(this time using models)
• The truth conditions for propositional logic
connectives are as specified in their truth-table
definitions
• x is true with respect to a model if at least one
expression (x:=a) is true with respect to the
model, and false otherwise.
• x is true with respect to a model if every
expression (x:=a) is true with respect to the
model, and false otherwise
5/6/2017
Michael Frank / Kees van Deemter
127
Module #1 - Logic
Semantics of predicate logic
(using models in a more precise way)
• Observe: Effectively, the meaning of
formulas is defined via rules of the form
“... is true iff ...”. This is called a truth
definition.
• For those of you who like a formal
treatment of truth definitions, in which the
role of models is made mathematically
more explicit, here goes ...
5/6/2017
Michael Frank / Kees van Deemter
128
Module #1 - Logic
Formally
what is a model?
• A model M is a pair <D,I> where D is a set (an
u.d.), and I is a suitable ‘interpretation’ function.
Informally speaking, a given M defines one way
of giving a concrete ‘meaning’ to the symbols
(other than ) in your formulas.
• If a is an individual constant then I(a)D
• If P is a 1-place predicate then I(P)D
• If R is a 2-place predicate then I(P) is a set
of pairs (,) such that  D, and  D
5/6/2017
Michael Frank / Kees van Deemter
129
Module #1 - Logic
(This way to specify the meaning of a 2-place
predicate will become clearer after the lectures
about relations. An example might help: )
5/6/2017
Michael Frank / Kees van Deemter
130
Module #1 - Logic
An example of a model
• Suppose M = (D,I) where D={John,Mary,Bill} and
I(j)=John, I(m)=Mary, I(b)=Bill,
I(B)={John,Bill}
I(G)={Mary}
I(A)={(John,Mary),(Bill,Mary)}
• Note: John is a person (i.e., a part of the world)
j is an individual constant (i.e., a part of the
language of predicate logic). j “names” John.
5/6/2017
Michael Frank / Kees van Deemter
131
Module #1 - Logic
Formally (where M = <D,I>)
atomic formulas
Here is the start of the new truth definition:
• A formula of the form P(a) is true
with respect to M iff I(a)  I(P).
• A formula of the form R(a,b) is true
with respect to M iff (I(a),I(b))  I(R).
5/6/2017
Michael Frank / Kees van Deemter
132
Module #1 - Logic
Formally (where M = <D,I>)
formulas with propositional connectives
• A formula of the form  is true wrt M iff
 is false wrt M
• A formula of the form  is true wrt M iff
 is true wrt M or  is true wrt M or both
• A formula of the form  is true wrt M iff
 is true wrt M and  is true wrt M
• A formula of the form    is true wrt M iff
 is false wrt M or  is true wrt M or both
5/6/2017
Michael Frank / Kees van Deemter
133
Module #1 - Logic
Formally (where M = <D,I>)
quantified formulas
• A formula of the form x is true wrt M
iff at least one expression (x:=a)
is true wrt M. (More precisely: there is an a such that ...)
• A formula of the form x is true wrt M
iff all expressions (x:=a)
are true wrt M. (More precisely: for all a, ...)
• (End of truth definition.)
5/6/2017
Michael Frank / Kees van Deemter
134
Module #1 - Logic
models: some illustrations
• Suppose M= (D,I) , where D={John,Mary,Bill}, and
I(j)=John, I(m)=Mary, I(b)=Bill, and
I(B)={John,Bill}
I(G)={Mary}
I(A)={(John,Mary),(Bill,Mary)}
• Is B(j) true wrt M?
5/6/2017
Michael Frank / Kees van Deemter
135
Module #1 - Logic
models: some illustrations
• Suppose M=( D,I) , where D={John,Mary,Bill}, and
I(j)=John, I(m)=Mary, I(b)=Bill, and
I(B)={John,Bill}
I(G)={Mary}
I(A)={(John,Mary),(Bill,Mary)}
• Is B(j) true wrt M? Yes
5/6/2017
Michael Frank / Kees van Deemter
136
Module #1 - Logic
models: some illustrations
• Suppose M=(D,I), where D={John,Mary,Bill}, and
I(j)=John, I(m)=Mary, I(b)=Bill, and
I(B)={John,Bill}
I(G)={Mary}
I(A)={(John,Mary),(Bill,Mary)}
• Is B(j) true wrt M? Yes
• Is B(j)B(b)A(m,m) true wrt M?
5/6/2017
Michael Frank / Kees van Deemter
137
Module #1 - Logic
models: some illustrations
• Suppose M=(D,I), where D={John,Mary,Bill}, and
I(j)=John, I(m)=Mary, I(b)=Bill, and
I(B)={John,Bill}
I(G)={Mary}
I(A)={(John,Mary),(Bill,Mary)}
• Is B(j) true wrt M? Yes
• Is B(j)B(b)A(m,m) true wrt M? No
5/6/2017
Michael Frank / Kees van Deemter
138
Module #1 - Logic
models: some illustrations
• Suppose M=(D,I), where D={John,Mary,Bill}, and
I(j)=John, I(m)=Mary, I(b)=Bill, and
I(B)={John,Bill}
I(G)={Mary}
I(A)={(John,Mary),(Bill,Mary)}
• Is B(j) true wrt M? Yes
• Is B(j)B(b)A(m,m) true wrt M? No
• Is x(B(x)A(x,m)) true wrt M?
5/6/2017
Michael Frank / Kees van Deemter
139
Module #1 - Logic
models: some illustrations
• Suppose M=(D,I), where D={John,Mary,Bill}, and
I(j)=John, I(m)=Mary, I(b)=Bill, and
I(B)={John,Bill}
I(G)={Mary}
I(A)={(John,Mary),(Bill,Mary)}
• Is B(j) true wrt M? Yes
• Is B(j)B(b)A(m,m) true wrt M? No
• Is x(B(x)A(x,m)) true wrt M? Yes
5/6/2017
Michael Frank / Kees van Deemter
140
Module #1 - Logic
models: some illustrations
x(B(x)A(x,m)) true wrt M iff
all expressions B(a) A(a,m) are true wrt M.
These are the following:
B(j) A(j,m)
B(b) A(b,m)
B(m) A(m,m)
5/6/2017
Michael Frank / Kees van Deemter
141
Module #1 - Logic
why is the latter formula true?
x(B(x)A(x,m)) true wrt M iff
all expressions B(a) A(a,m) are true wrt M.
These are the following:
B(j) A(j,m) true wrt M
B(b) A(b,m) true wrt M
B(m) A(m,m)
5/6/2017
Michael Frank / Kees van Deemter
142
Module #1 - Logic
why is the latter formula true?
x(B(x)A(x,m)) true wrt M iff
all expressions B(a) A(a,m) are true wrt M.
These are the following:
B(j) A(j,m) true wrt M
B(b) A(b,m) true wrt M
B(m) A(m,m) true wrt M (antecedent false!)
Consequently x(B(x)A(x,m)) is true wrt M
5/6/2017
Michael Frank / Kees van Deemter
143
Module #1 - Logic
Predicate logic: optional extensions
• This completes the strict version of predicate logic
• In addition, we have introduced a number of
simplifications and extensions:
• Brackets
– all outermost brackets can be omitted
– brackets that are superfluous because of associativity
can be omitted, e.g., pqr instead of (pq)r
– we sometimes add extra brackets for clarity, or [..]
rather than (..), to show which brackets match
5/6/2017
Michael Frank / Kees van Deemter
144
Module #1 - Logic
Predicate logic: optional extensions
• Quantifiers
– we sometimes write xyz instead of
xyz, or xyz instead of xyz
– !x P(x), 2!x P(x), etc. for exact numbers
– restricted quantification: e.g., x>0 instead of
x(x>0) or x>0 instead of x(x>0)
• Other
– we sometimes write  instead of 
– we sometimes allow ourselves to suggest infinitely long
formulas using dots, e.g. p1  p2  ...
5/6/2017
Michael Frank / Kees van Deemter
145