Lecture-Notes-6
Propositional Logic and First-Order Predicate Calculus
The syntax and formal semantics of propositional and first-order
predicate calculus (FOPC) will be covered, with particular focus on
their importance in defining the problem representation (the
"representational scheme").
We will focus on logical representation
in non-mathematical, non-formal domains.
Conversion to clausal form, unification, and
resolution will be covered, emphasizing
implications for representation.
Problem Representation
-
What is the best way to represent the problem? What
representational scheme is being used?
-
Why do we care about formal semantics?
-
Gives an understanding of representational choices:
What are the objects? What are the predicates? What are the functions?
-
Without care in defining a world, and an interpretation mapping our
symbols to this world:
-
Inconsistent representation schemes would likely result
-
Proofs you WANT will NOT go through
-
Proofs you do NOT want WILL go through
-
Representation will not be as extensible
Levels/views of Knowledge-Based Agents
-
Knowledge/epistemological level: most abstract. All men are mortal
-
Logical level: Forall X (man(X) --> mortal(X))
-
Implementation level: (forall (X) (ant (man X)(cons (mortal X)))
Semantics: connects sentences with facts ("the world")
-
See figure 6.5
- We'll try to avoid reasoning like figure 6.6!
-
A |= B means that, whenever A is true, B must be true as well.
Examples:
Man, Man --> Mortal |= Mortal
Tall ^ Silly |= Silly
Tall, Silly |= Tall ^ Silly
Raining, Dog -> Mammal not |= Mammal
Smoke, Fire --> Smoke not |= Fire
Inference procedure: procedure that derives sentences from sentences
A |- B under inference procedure i means that B is derivable from A
using i
Examples:
applications of rules of inference, such as modus ponens,
and-elimination, and-introduction (see figure 6.13 for a list of rules
of inference).
The general form of a rule of inference is "conditions |
conclusions". When something in the knowledge base matches the
conditions, the rule produces a new sentence (or sentences) that matches the conclusions.
applications of other rules of inference (not listed in figure
6.13), such as:
Abduction: B, A--> B | A
For some religious people (just to show there are infinite
possibilities): B | GodExists (i.e., anything implies that God exists)
or any other algorithm that produces sentences from sentences
(whether the procedure is stated as rules or not)
Soundness of inference (proof) procedure i:
forall A,B ((A |- B under inference procedure i) --> (A |= B))
Completeness of inference (proof) procedure i:
forall A,B ((A |= B) --> (A |- B under inference procedure i))
Propositional Logic: Syntax and Semantics
Syntax: see figure 6.8
Semantics: give an interpretation to sentences; assign elements
of the world to sentences, and define the meanings of the logical connectives
Semantics of propositional logic is easy:
-
assign T or F to each sentence (the sentence is T or F under that interpretation)
-
If the truth values of sentences G and H are determined:
-
truth value of ~G is F, if T assigned to G; T, otherwise.
-
truth value of G --> H is F, if T assigned to G and F assigned to H; T
otherwise.
-
Note: G --> H is logically equivalent to ~G or H
-
G or H, G and H: see truth tables in figure 6.9
-
G = H means that G and H are assigned the same truth value under the interpretation
A set of sentences S is satisfied by interpretation I iff
the sentences in S are assigned T under I
A set of sentences S is satisfiable if there is an interpretation
that satisfies it
An interpretation I is a model of a set of sentence S
iff the sentences in S are all true under I
A set of sentences that is not satisfiable is inconsistent
A sentence is valid if it is true under every interpretation
Example of an inconsistent sentence? P ^ ~P
Example of a valid sentence? P v ~P
Valid sentences are true by virtue of their logical form. They don't
tell you anything about the domain
But they are critical for logical inference: the computer has no independent
access to the world being modeled. We want it to be able to draw conclusions
from premises, regardless of the particular interpretation.
A more technical definition of |=
A logically entails B (A |= B) iff every interpretation
that satisifies A also satisfies B
Entailment gives us a (very strict) criterion for deciding whether it is ok to infer
a particular conclusion from a set of premises: infer the conclusion only
if it is logically entailed by the premises
Computational method: apply rules of inference (or other inference
or proof procedure) that are sound,
because if A is derived from B using a sound rule of inference, then
we know that B logically entails A.
The rules of inference in figure 6.13 are sound
Abduction (which we saw above), is an example of an unsound rule of inference:
A, B-->A | B. "Where there's smoke, there's fire".
In this part of the course, we are concerned with sound reasoning.
A logic is monotonic if the following implication is true:
forall (KB1, KB2,Alpha) (KB1 |= Alpha) --> (KB1 and KB2 |= Alpha)
Adding knowledge never makes something that was true become false.
First-order predicate calculus and propositional logic are monotonic.
First-Order Predicate Calculus
The world consists of objects, properties that distinguish them from other
objects, and
functions (from objects to objects).
Wumpus world:
objects: the gold, the wumpus, a square,...
predicates(relations): holding, smelly, breezy,
...
functions: leftAdjacentSquare, rightAdjacentSquare,...
Syntax: Figure 7.1 (examples in lecture)
FOPC inherits the logical connectives, but breaks things up into objects,
predicates, and functions;
it also includes quantifiers.
- User defines these primitives:
- Constant symbols (which refer to the "individuals" in the world)
E.g., Mary, 3
- Function symbols (mapping individuals to individuals)
E.g., father-of(Mary) = John, color-of(Sky) = Blue
- Predicate symbols (mapping from individuals to truth values)
E.g., greater(5,3), green(Grass), color(Grass, Green)
- FOL supplies these primitives:
- Variable symbols. E.g., x, y
- Connectives. Same as in PL: not (~), and (^), or (v), implies (=>),
if and only if (<=>)
- Quantifiers: Universal (A) and Existential (E)
- Universal quantification corresponds to conjunction ("and")
in that (Ax)P(x) means that P holds for all values of x in the
domain. E.g., (Ax) dolphin(x) => mammal(x)
- Existential quantification corresponds to disjunction ("or")
in that (Ex)P(x) means that P holds for some value of x in the domain.
E.g., (Ex) mammal(x) ^ lays-eggs(x)
- Universal quantifiers usually used with "implies" to form
"if-then rules." E.g., (Ax) cs540-student(x) => smart(x) means
"All cs540 students are smart." You rarely use universal quantification
to make blanket statements about every individual in the world:
(Ax)cs540-student(x) ^ smart(x) meaning that everyone in the world
is a cs540 student and is smart.
- Existential quantifiers usually used with "and" to specify a
list of properties or facts about an individual. E.g.,
(Ex) cs540-student(x) ^ smart(x) means "there is a cs540 student who
is smart." A common mistake is to represent this English sentence
as the FOL sentence: (Ex) cs540-student(x) => smart(x)
This is a very weak statement. We'll return to this type of
sentence after we've seen conversion to clausal form.
- Switching the order of universal quantifiers does not change
the meaning: (Ax)(Ay)P(x,y) is logically equivalent to (Ay)(Ax)P(x,y).
Similarly, you can switch the order of existential quantifiers.
- Switching the order of universals and existentials does
change meaning:
- Everyone likes someone: (Ax)(Ey)likes(x,y)
- Someone is liked by everyone: (Ey)(Ax)likes(x,y)
- Sentences are built up from terms and atomic sentences:
- A term (denoting a real-world individual) is
a constant symbol, a variable symbol, or an n-place function of
n terms. For example, x and f(x1, ..., xn)
are terms, where each xi is a term.
- An atomic sentence (which has value true or false) is
an n-place predicate of n terms
- If P and Q are atomic
sentences, then P, Q, ~P, P V Q, P ^ Q, P => Q, P <=> Q are
all sentences
- if P is a sentence and x is
a variable, then (Ax)P and (Ex)P are sentences
- A well-formed formula (wff) is a sentence containing
no "free" variables. I.e., all variables are "bound" by universal
or existential quantifiers. E.g., (Ax)P(x,y) has x bound as a
universally quantified variable, but y is free.
Translating English to FOL
- Every gardener likes the sun.
(Ax) gardener(x) => likes(x,Sun)
- You can fool some of the people all of the time
(Ex)(At) (person(x) ^ time(t)) => can-be-fooled(x,t)
- You can fool all of the people some of the time.
(Ax)(Et) (person(x) ^ time(t) => can-be-fooled(x,t)
The representations for the above 2 need work! But at least we have
done some of the work distinguishing their meanings from each other.
- All purple mushrooms are poisonous.
(Ax) (mushroom(x) ^ purple(x)) => poisonous(x)
- No purple mushroom is poisonous.
~(Ex) purple(x) ^ mushroom(x) ^ poisonous(x)
or, equivalently,
(Ax) (mushroom(x) ^ purple(x)) => ~poisonous(x)
- There are exactly two purple mushrooms.
(Ex)(Ey) mushroom(x) ^ purple(x) ^ mushroom(y) ^ purple(y) ^
~(x=y) ^ (Az) (mushroom(z) ^ purple(z)) => ((x=z) v (y=z))
- Deb is not tall.
~tall(Deb)
- X is above Y if X is on directly on top of Y or else there is
a pile of one or more other objects directly on top of one another
starting with X and ending with Y.
(Ax)(Ay) above(x,y) <=> (on(x,y) v (Ez) (on(x,z) ^ above(z,y)))
Semantics
Basic idea: as for propositional logic, specify an interpretation,
a mapping between elements
of the language and elements of the world. World: domain
of objects (D), functions, predicates
Type of Symbol
What sort of thing is assigned to it
constant
an element of D
N-ary function symbol
mapping from D^N to D
N-ary predicate symbol a subset
of D^N
For example, given D={sam,juan,krishnan,sally,kathy},
"Sam" might be assigned sam
"Juan" might be assigned juan
"Krishnan" might be assigned krishnan
"Sally" might be assigned sally
"Kathy" might be assigned kathy
function symbol "father" might be assigned the set {<sam,juan>,
<juan,krishnan>,
<krishnan,sally>}
predicate symbol "siblings" might be assigned the set {<sally,sam>,<kathy,sam>}
The meaning of propositions is determined as follows:
First, assign meanings to terms. Terms are assigned objects
of the domain.
We already assigned objects to constants.
For a functional expression f(t1,....,tn): assign the result
of applying the function assigned to f to the objects assigned to
the ti's
Now, assign truth values to atomic sentences, p(t1,...,tn): assign
true if the tuple formed from the objects assigned to the ti's is an element
of the predicate assigned to "p".
Examples using above in lecture.
The truth values of sentences with logical connectives are determined
as in propositional logic.
Finally: forall X G is T if G is T with X assigned d, for all
d in D; F otherwise.
exists X G is t if G is T with X assigned d, for some d in D; F otherwise.
REPRESENTATIONAL CHOICES
A. What are the objects? What are the predicates? What are the functions?
Example:
Representational Scheme 1:
D={a,b,c,d,e}; predicate red = {a,b,c}; predicate pink = {d,e}
Under the intended interpretation:
red(a). pink(d).
Representational Scheme 2 -- reify the predicates, for a more
expressive representation
D = {a,b,c,d,e,red,pink}; predicate colorof={<a,red>,<b,red>,<c,red>,<d,pink>,<e,pink>}
predicate color={red,pink}; predicate primary={red}; predicate pretty={pink}.
Under the intended interpretation:
colorof(a,red). color(pink). primary(red).
More expressive, but inference may take longer (axioms may be larger)
(an alternative: axiom schemata;)
A scheme that mixes and matches will lead to trouble.
For example:
forall(X,Y,Z) fatherof(X,Y) and fatherof(Y,Z) -->
grandfatherof(X,Z).
fatherof(john) = sam. fatherof(sam,mark).
Even though "mark" is the father of "sam" who is the father of "john",
we cannot conclude "grandfatherof(john,mark)", because of the
inconsistent representational scheme.
Another example of a type of inconsistency that can creep in:
You might use ISA to mean set membership, that is,
isa(element,set) means "element" is a member of set "set".
isa(1,{1,2,3}).
isa(john, person). John is a member of the set of all people.
isa(pittsburgh,PA cities). Pittsburgh is a member of the set of
cities in PA.
isa(john,CS2710). John is a member of the people taking CS2710.
Above is all fine. Just don't forget how you are using the
constants above. Suppose CS2710 started 10 years ago.
age(CS2710,10) would mean that the set of people taking the course
is 10 years old.
-
B. Grain size of objects?
NLP problem 1: word-sense disambiguation
Smallest object a word?
What about about morphological clues? (E.g., plural, singular, root
form, past form, etc. This is a simplification.)
What about the individuals letters?
Probably words and morphological features of words are appropriate for
this task.
morph-feature(word3,plural).
ending(plural). ending(past-marker).
forall X exists Y (morph-feature(X,Y) and ending(Y) -->
NOT morph-feature(X,root-form).
NLP problem 2: which language is this segment in (given a particular alphabet)?
Now it makes sense to model individual words and diacritics, since
letter (accent) frequencies and letter (accent) combinations are
informative. Also, modeling properties of sentences can be useful:
sometimes the shape and height are informative.
-
C. Meaning of predicates and functions?
In practice, you don't enumerate the tuples
defining the predicates and functions. Instead,
specifiy the types of the arguments and include a gloss of what it is
supposed to mean. For example:
morph-feature(Word, Morph-Feature): word Word has morphological
feature Morph-Feature
fatherof(X) designates the father of person X.
The other knowledge in the system about predicates and functions is
encoded in axioms.
-
D. What meaning distinctions are being made?
Action types versus action instances. Action types have typical
preconditions and effects; action instances have individual durations,
agents, locations, etc.
Process (Playing the piano), versus achievement (Write a book), versus
accomplishment (Kiss your Mom), etc.
-
If you write a book, a new book is created by writing it.
But if you kiss your Mom, a new Mom is not created by kissing her.
-
In a subinterval of playing the piano you are also playing the
piano.
But being in the process of writing a book (rather than having written a book)
does not imply the existence of a new book.
(These kinds of morphological variations in languages contribute
greatly to the meaning being conveyed, by setting a perspective on the
event or state. Here, the progressive aspect is important.
Morphology is even richer in other languages like Finnish, Russian,
and Korean).
Individuals (John) versus groups (Baseball team) versus substances
(Sand).
Put some sand in a truck, and the truck contains
sand. Put some members of a baseball team in a truck, and the
truck does not contain a baseball team (just part of one).
And, put part of a sand dune in a truck, and the truck does not
contain a sand dune (just part of one). You can have three
baseball teams but not three sands (unless you are talking about types
of sand).
Specific versus non-specific references
-
`The tiger is an animal'', ``The tigar bit him''
-
``I'll have what he's having''
-
``The murderer is insane'' (classic example)
-
``John wants to marry a Swedish woman'' (classic example)
Intensions versus extensions
-
John dialed Mary's phone number
-
Mary's phone number is 646-6445
-
Fine: John dialed 646-6445.
-
Now let's try:
John believes Mary's phone number is 646-6228
-
Mary's phone number is 646-6445
-
John believes 646-6228 is 646-6445???
-
The relationships among language, thought, and perception raise
age-old philosophical and psychological issues. In any case,
distinctions such as those above are cognitive and are important for
building intelligent agents who reason about the world.
-
Compared to other representations in computer science,
logical knowledge representation (in its various forms) is more
expressive. Of course, there is a tradeoff between expressiveness and
efficiency. An important goal is to find the appropriate point on
this scale for the task at hand.