Title: First-Order Logic
1First-Order Logic
2Conceptualization
- The formalization of knowledge begins with a
conceptualization. - This includes the objects presumed or
hypothesized to exist in the world and their
relationships. - An object can be anything about we want to say
something. - Objects can be concrete (book, earth, sun, etc)
- Objects can be abstract (the number 2, the set of
all integers, the justice etc) - Objects can be primitive or composite (a circuit
that contains many circuits) - Objects can be fictional (Sherlock Holmes, Miss
Right) - A knowledge-representation task doesnt require
that we consider all the objects in the world
only those objects in a particular set are
relevant. - The set of objects about which knowledge is being
expressed is called a universe of discourse.
3Example Blocks World
A
B
D
C
E
- Here we conceptualize the blocks. Some could
conceptualize also the table, but we ignore it. - The universe of discourse corresponding to this
conceptualization is - A,B,C,D,E
- Although in this example the universe of
discourse is finite, this is not always the case.
- E.g. it is common in math to consider as the
universe of discourse the set of all integers,
the set of all real numbers etc.
4More about Conceptualization I
- A function is a kind of interrelationship among
the objects in a universe of discourse. - Although we can define many functions for a given
set of objects, in conceptualizing a portion of
the world we usually emphasize some functions and
ignore others. - The set of functions emphasized in a
conceptualization is called the functional basis
set. - E.g. in our blocks world, it would make sense to
define a (partial) function Hat that maps a block
into the block on top of it, if such exists. The
tuples corresponding to this function are - ltB,Agt, ltC,Bgt, ltE,Dgt
5More about Conceptualization II
- A relation is the second kind of
interrelationship among the objects in a universe
of dicourse. - The set of relations emphasized in a
conceptualization is called the relational basis
set. - E.g. in our blocks world, we can consider the On
relation - ltA,Bgt, ltB,Cgt, ltD,Egt
- Also, we can consider the Above relation
- ltA,Bgt, ltB,Cgt, ltA,Cgt, ltD,Egt
- More, we can consider the unary Clear relation
- ltAgt, ltDgt
- Or, the unary Table relation
- ltCgt, ltEgt
6Formally
- A conceptualization is a triple consisting of
- a universe of discourse,
- a functional basis set for that universe of
discourse and - a relational basis set.
- E.g. ltA,B,C,D,E, Hat, On,Above,Clear,Tablegt
- No matter how we choose to conceptualize the
world, there are other conceptualizations as
well. - What makes a conceptualization more appropriate
than another for knowledge formalization?
7Reification
- E.g. consider a Blocks World conceptualization in
which there are five blocks, no functions, and
there are three unary relations - ltA,B,C,D,E, , Red,White,Bluegt
- This conceptualization allows us to consider the
color of blocks but not the properties of colors.
- In order to overcome this, we reify the relations
and have instead the conceptualization - ltA,B,C,D,E, Red,White,Blue, Color, Nicegt
- The advantage of this is that it allows us to
consider properties of of properties.
8First-Order Logic
- Given a conceptualization of the world, we begin
to formalize knowledge in a language appropriate
to that conceptualization. - E.g. we can express the fact that the block A is
above block B by taking a relation symbol such as
above and object symbols a and b and writing - above(a,b)
- We can combine sentences by using logical
operators (?,?,?,?,?,?) in order to create more
complex sentences. - above(a,b) ? above(b,a)
- The names we use, such as above, a, b are
irrelevant. - We could have said
- abnwyrcn(pjkj, oiuy) ? abnwyrcn(oiuy, pjkj)
- What really matters is that they should should
have identifiable referents in the real world,
(better saying in the conceptualization that we
choose)
9Syntax
10Constants
- Constants refer to objects, functions and
relationships. - joe, mary, loves, happy,
- Simple sentences express relationships among
objects. - loves(joe,mary)
- They are called atoms.
- Compound sentences capture relationships among
relations. - loves(x,y) Þ loves(y,x)
- loves(x,y) Ù loves(y,x) Þ happy(x)
- Relations can be unary as well.
- tall(amy)
11Lets blur the distinction
- Constants refer to objects, functions and
relationships. - joe, mary, loves, happy, hat
- Ok, in order to be formal we should use object
constant, function constant, and relation
constant, but this is painful. - So, lets say for
- Object constant object
- Function constant function
- Relation constant relation
- It should be clear that the ones on the left are
different from ones on the right We are doing
this for the ease of presentation.
12Example with Functions
E.g. Quincy loves his dog. loves(quincy, dog_of
(quincy)) Note We are allowed to relate
sentences only. So, we can say loves(quincy,
dog_of (quincy)) Ù loves(quincy, cat_of
(quincy)) But not, loves(quincy, dog_of
(quincy) Ù cat_of (quincy)) because dog_of
(quincy), cat_of (quincy) arent sentences, they
are objects.
- E.g. How about saying that Jimmy Durante has a
big nose? - durante is an object and
- nose_of (durante)
- is a function that constructs an object from the
argument object. - Then, we can write
- big(nose_of (durante))
13Full-blown First-Order Logic ?,?
- The language that we have described so far,
consisting of atoms and the connectives
(?,?,?,?,?,?) is typically called predicate
logic. - To extend it to first-order logic, we need to add
quantifiers. - The purpose of quantifiers is to allow us to say
things about sets of objects. - To say that Quincy loves everything we write
- ?x. loves (quincy, x)
- We can think of ? as a big conjunction. For
example, if there are only three objects quincy,
dog, and cat, what the above asserts is - loves (quincy, dog) ? loves (quincy, cat) ?
loves (quincy, quincy) -
- To say that Quincy loves something we write
- ?x. loves (quincy, x)
- We can think of ? as a big disjunction. For
example, if there are only three objects as
above, then what we are asserting is - loves (quincy, dog) ? loves (quincy, cat) ?
loves (quincy, quincy) -
14Mushrooms
- The universe of discourse is the set of all
plants. - There is a unary relation for being mushroom,
another one for being purple, and a third for
being poisonous. - We designate these relations with the unary
relation symbols mushroom, purple, and poisonous.
- All purple mushrooms are poisonous.
- ?x (purple(x) ? mushroom(x) ? poisonous(x))
- A mushroom is poisonous only if it is purple.
- ?x (mushroom(x) ? poisonous(x) ? purple(x))
- No purple mushroom is poisonous.
- ?x ?(purple(x) ? mushroom(x) ? poisonous(x))
- There is exactly one mushroom.
- ?x mushroom(x) ? (?y y?x ? ?mushroom(y))
15Reverse translation
- Translate the following into English.
- ?x hesitates(x) ? lost(x)
- He who hesitates is lost.
- ??x business(x) ? like(x,Showbusiness)
- There is no business like show business.
- ??x glitters(x) ? gold(x)
- Not everything that glitters is gold.
- ?x ?t person(x) ? time(t) ? canfool(x,t)
- You can fool some of the people all the time.
16Semantics
17Models
- This is all well and good, but there isnt much
value to saying what sentences belong to a
language unless we also say what those sentences
mean. - Simply said, we are interested in the truth value
of given (possibly compound) sentences. - Suppose that our first-order language had no
logical connectives at all, just objects,
functions, and relations. - In that case, the sentences in our language would
be simply what we called atoms. - Let, A be the set of all atoms in our
impoverished language. - A model M is a subset of the set of atoms A.
- By a model M ? A, we will mean the state of
affairs in which all of the atoms in M are true
and all of the atoms not in M are false. - Given a model it is obviously straightforward to
decide whether or not some particular atom a is
true in M its true if a?M and false if a?M. - What makes first-order logic powerful, is that we
can also determine whether compound sentences are
true or false in M.
18Example
- Suppose that Tom is our only object, and that we
have two relations, rich and poor. - Now,
- A rich(tom), poor(tom)
- is the set of all atoms. So, we have 4 possible
models. - In M1?, Tom is neither rich nor poor.
- In M2rich(tom), Tom is rich and not poor.
- In M3poor(tom), tom is poor and not rich.
- In M4rich(tom), poor(tom), Tom is both rich
and poor. - Now, consider the sentence
- poor(tom) ? ?rich(tom)
- Using the truth table for the implication, the
above sentence will be true in M1, M2, M3 and
false only in M4. (try it)
19Entailment
- Definition.
- Given two sentences ? and ?, we will say that ?
entails ?, writing ? ?, if ? holds in every
model that ? holds. - Example Consider
- ?? (???) ?
- For any sentences ? and ?, any model M in which
?? (???) holds is model in which ? holds and also
a model in which ??? holds. - But since ? holds in M, it must be the case that
? holds in M as well. - By the definition of entailment, the claim
follows.
20Entailment II
- A set of premises logically entails a conclusion
if and only if every interpretation that
satisfies the premises also satisfies conclusion. - In the case of Propositional Logic, the number of
interpretations is finite, and so it is possible
to check logical entailment directly in finite
time. - In the case of Relational Logic, the number of
models is infinite, and so a direct check of
logical entailment is not feasible.
21Example
-
- p(a)
- q(a)
- p(a),q(a)
- p(b)
- q(b)
- p(b),q(b)
- p(a), p(b)
- p(a), p(b), q(a)
- p(a), p(b), q(b)
- p(a), p(b), q(a), q(b)
- ...
- Infinitely many models.
22Good News
- Given any set of sentences, there is a specially
defined subset of interpretations called Herbrand
interpretations. - Under certain conditions, checking just the
Herbrand models suffices to determine logical
entailment. - Checking just the Herbrand interpretations is
less work than checking all interpretations.
23Herbrand
- The Herbrand universe for a set of sentences is
the set of all ground terms that can be formed
from just the constants used in those sentences. - Ground terms are either object constants or
functions applied to object constants. - The Herbrand base for a set of sentences is the
set of all ground atomic sentences that can be
formed using just the elements in the Herbrand
universe. - A Herbrand model for a set of sentences is any
subset of the Herbrand base for those sentences.
24Example
- Sentences
- "x. (r(a,x) Þ r(x,b))
- "x."y."z. (r(x,y) Ù r(x,y) Þ r(x,z))
- Herbrand Universe (constants used in sentences
only) - a,b
- Herbrand Base
- r(a,a), r(a,b), r(b,a), r(b,b)
25Herbrand Models
-
- r(a,a)
- r(a,b)
- r(b,a)
- r(b,b)
- r(a,a), r(a,b)
- r(a,a), r(b,a)
- r(a,a), r(b,b)
- r(a,b), r(b,a)
- r(a,b), r(b,b)
- r(b,a), r(b,b)
- r(a,a), r(a,b), r(b,a)
- r(a,a), r(a,b), r(b,b)
- r(a,a), r(b,a), r(b,b)
- r(a,b), r(b,a), r(b,b)
- r(a,a), r(a,b), r(b,a), r(b,b)
- 16 Herbrand interpretations in all. Note 16lt.
26Herbrand Theorem
- Herbrand Theorem A set of (pure) ?-free
sentences is satisfiable if and only if it has a
Herbrand model that satisfies it. - Proof.
- If a set of ?-free sentences is satisfiable, then
there is a model that satisfies it. - Take the intersection of this model with the
Herbrand base. This is a Herbrand model. - Moreover, it is easy to see that it satisfies the
sentences. - If the sentences contain variables, the instances
must all be true, including those in which the
variables are replaced only by elements in the
Herbrand universe. - Note. With ?-free we mean pure ?-free. E.g.
??p(x), is nothing else but ??p(x). So, pure
?-free no negations preceding ?.
27Example
- Premises
- ?x. p(x) Þ q(x)
- p(a) Ú q(a)
- Conclusion
- q(a)
- Herbrand Models
-
- p(a)
- q(a)
- p(a),q(a)
28Herbrand Method
- Add negation of conclusion to the premises to
form the satisfaction set. - Loop over Herbrand interpretations. Cross out
each interpretation that does not satisfy the
sentences in the satisfaction set. - If all Herbrand interpretations are crossed out,
by the Herbrand Theorem, the set is
unsatisfiable. - Sound and Complete Negating the conclusion leads
to a contradiction therefore, the premises
logically entail the conclusion. - Termination Since there are only finitely many
Herbrand interpretations, the process halts.
29Example
- Premises
- ?x. p(x) Þ q(x)
- p(a) Ú q(a)
- Conclusion
- q(a)
- Satisfaction Set
- ?x. p(x) Þ q(x)
- p(a) Ú q(a)
- Øq(a)
- Herbrand Models
-
- p(a)
- q(a)
- p(a),q(a)
- By considering ? as a big conjunction we can
verify that the satisfaction set is unsatisfiable
in each Herbrand model.
30Herbrand for the rest of FOL
- In the presence of function constants, all ground
functional terms are included. - E.g. if we find in our sentences a,b,f,g then the
Herbrand universe is - a, b, f(a), f(b), g(a), g(b), f(f(a)), f(f(b)),
f(g(a)), f(g(b)), ... - Sad The size of the Herbrand universe for a
functional language is infinite. - Upshot Checking the Herbrand models for a
language to determine logical entailment is not
feasible in finite time. - Solution Use formal proofs!