0% found this document useful (0 votes)
40 views

The Language of First-Order Logic

Language of first-order logic is a declarative language. Need to be able to express knowledge before there can be learning, reasoning, planning, explanation. Want to know exactly what strings of symbols count as sentences.

Uploaded by

Wr Windride
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

The Language of First-Order Logic

Language of first-order logic is a declarative language. Need to be able to express knowledge before there can be learning, reasoning, planning, explanation. Want to know exactly what strings of symbols count as sentences.

Uploaded by

Wr Windride
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

2.

The Language of
First-order Logic
KR & R

Brachman & Levesque 2005

17

Declarative language
Before building system
before there can be learning, reasoning, planning,
explanation ...

need to be able to express knowledge


Want a precise declarative language
declarative: believe P = hold P to be true
cannot believe P without some sense of
what it would mean for the world to satisfy P

precise: need to know exactly


what strings of symbols count as sentences
what it means for a sentence to be true
(but without having to specify which ones are true)

Here: language of first-order logic


again: not the only choice
KR & R

Brachman & Levesque 2005

18

Alphabet
Logical symbols:
Punctuation: (, ), .
Connectives: , , , , , =
Variables: x, x1, x2, ..., x', x", ..., y, ..., z, ...
Fixed meaning and use
like keywords in a programming language

Non-logical symbols
Note: not treating = as a predicate

Predicate symbols (like Dog)


Function symbols (like bestFriendOf)
Domain-dependent meaning and use

like identifiers in a programming language

Have arity: number of arguments


arity 0 predicates: propositional symbols
arity 0 functions: constant symbols
Assume infinite supply of every arity

KR & R

Brachman & Levesque 2005

19

Grammar
Terms
1. Every variable is a term.
2. If t1, t2, ..., tn are terms and f is a function of arity n,
then f(t1, t2, ..., tn) is a term.

Atomic wffs (well-formed formula)


1. If t1, t2, ..., tn are terms and P is a predicate of arity n,
then P(t1, t2, ..., tn) is an atomic wff.
2. If t1 and t2 are terms, then (t1=t2) is an atomic wff.

Wffs
1. Every atomic wff is a wff.
2. If and are wffs, and v is a variable, then , (), (), v., v.
are wffs.

The propositional subset: no terms, no quantifiers


Atomic wffs: only predicates of 0-arity: (p (q r))
KR & R

Brachman & Levesque 2005

20

Notation
Occasionally add or omit (,), .
Use [,] and {,} also.
Abbreviations:
( ) for ( )
safer to read as disjunction than as if ... then ...

( ) for (() ())

Non-logical symbols:
Predicates: mixed case capitalized
Person, Happy, OlderThan
Functions (and constants): mixed case uncapitalized
fatherOf, successor,
johnSmith

KR & R

Brachman & Levesque 2005

21

Variable scope
Like variables in programming languages, the variables in FOL
have a scope determined by the quantifiers
Lexical scope for variables
P(x) x[P(x) Q(x)]
free

bound

occurrences of variables

A sentence: wff with no free variables (closed)


Substitution:
[v/t] means with all free occurrences of the v replaced by term t

Note: written vt elsewhere (and in book)


Also: [t1,...,tn] means [v1/t1,...,vn/tn]
KR & R

Brachman & Levesque 2005

22

Semantics
How to interpret sentences?
what do sentences claim about the world?
what does believing one amount to?

Without answers, cannot use sentences to represent knowledge


Problem:
cannot fully specify interpretation of sentences because non-logical
symbols reach outside the language

So:
make clear dependence of interpretation on non-logical symbols

Logical interpretation:
specification of how to understand predicate and function symbols
Can be complex!
DemocraticCountry, IsABetterJudgeOfCharacterThan,
favouriteIceCreamFlavourOf, puddleOfWater27
KR & R

Brachman & Levesque 2005

23

The simple case


There are objects.
some satisfy predicate P; some do not

Each interpretation settles extension of P.


borderline cases ruled in separate interpretations

Each interpretation assigns to function f a mapping from objects


to objects.
functions always well-defined and single-valued

The FOL assumption:


this is all you need to know about the non-logical symbols
to understand which sentences of FOL are true or false
In other words, given a specification of
what objects there are
which of them satisfy P
what mapping is denoted by f

it will be possible to say which sentences of FOL are true


KR & R

Brachman & Levesque 2005

24

Interpretations
Two parts: = D, I
D is the domain of discourse
can be any non-empty set
not just formal / mathematical objects
e.g. people, tables, numbers, sentences, unicorns, chunks of peanut butter,
situations, the universe

I is an interpretation mapping
If P is a predicate symbol of arity n,

If f is a function symbol of arity n,


I[f] [DD...D D]

I[P] DD...D

an n-ary function over D

an n-ary relation over D

for constants, I[c] D

for propositional symbols,


I[p] = {} or I[p] = {}
In propositional case, convenient to assume

= I [prop. symbols {true, false}]


KR & R

Brachman & Levesque 2005

25

Denotation
In terms of interpretation , terms will denote elements of the
domain D.
will write element as ||t||

For terms with variables, the denotation depends on the values of


variables
will write as ||t||,
where [Variables D],
called a variable assignment

Rules of interpretation:
1. ||v||, = (v).

2. || f(t1, t2, ..., tn) ||, = H(d1, d2, ..., dn)


where H = I[f]

and
KR & R

di = ||ti||,, recursively

Brachman & Levesque 2005

26

Satisfaction
In terms of an interpretation , sentences of FOL will be either
true or false.
Formulas with free variables will be true for some values of the
free variables and false for others.
Notation:
will write as , =

is satisfied by and

where [Variables D], as before

or = , when is a sentence
is true under interpretation

or = S, when S is a set of sentences


the elements of S are true under interpretation

And now the definition...


KR & R

Brachman & Levesque 2005

27

Rules of interpretation
1. , = P(t1, t2, ..., tn) iff d1, d2, ..., dn R

where R = I[P]
and di = || ti ||,, as on denotation slide

2. , = (t1 = t2) iff || t1 ||, is the same as || t2 ||,


3. , = iff ,
4. , = () iff , = and , =
5. , = () iff , = or , =
6. , = v iff for some d D, ,{d;v}=
7. , = v iff for all d D, ,{d;v}=
where {d;v} is just like , except that (v)=d.

For propositional subset:


= p
KR & R

iff I[p] {}

Brachman & Levesque 2005

and the rest as above

28

Entailment defined
Semantic rules of interpretation tell us how to understand all wffs
in terms of specification for non-logical symbols.
But some connections among sentences are independent of the
non-logical symbols involved.
e.g. If is true under , then so is (),
no matter what is, why is true, what is, ...

S |= iff for every , if |= S then |= .


Say that S entails or is a logical consequence of S:
In other words: for no , |= S {}.

S {} is unsatisfiable

Special case when S is empty: |= iff for every , |= .


Say that is valid.

Note: {1, 2, ..., n} |=

iff

|= (1 2 ... n)

finite entailment reduces to validity


KR & R

Brachman & Levesque 2005

29

Why do we care?
We do not have access to user-intended interpretation of nonlogical symbols
But, with entailment, we know that if S is true in the intended
interpretation, then so is .
If the user's view has the world satisfying S, then it must also satisfy .
There may be other sentences true also; but is logically guaranteed.

So what about ordinary reasoning?


Dog(fido) Mammal(fido) ??
Not entailment!
There are logical interpretations where I[Dog] I[Mammal]

include such connections explicitly in S


Key idea
of KR:

KR & R

x[Dog(x) Mammal(x)]

Get: S {Dog(fido)} |= Mammal(fido)

Brachman & Levesque 2005

the rest is just


details...
30

Knowledge bases
KB is set of sentences
explicit statement of sentences believed (including any assumed
connections among non-logical symbols)

KB |=

is a further consequence of what is believed

explicit knowledge: KB
implicit knowledge: { | KB |= }

Often non trivial: explicit implicit


Example:
Three blocks stacked.
Top one is green.
Bottom one is not green.

A
B
C

green

non-green

Is there a green block directly on top of a non-green block?


KR & R

Brachman & Levesque 2005

31

A formalization
S = {On(a,b), On(b,c), Green(a), Green(c)}
all that is required

= xy[Green(x) Green(y) On(x,y)]


Claim: S |=
Proof:
Let be any interpretation such that |= S.
Case 1: |= Green(b).

Case 2: | Green(b).

|= Green(b) Green(c) On(b,c).

|= Green(b)

|=

|= Green(a) Green(b) On(a,b).


|=

Either way, for any , if |= S then |= .


So S |= .

KR & R

QED

Brachman & Levesque 2005

32

Knowledge-based system
Start with (large) KB representing what is explicitly known
e.g. what the system has been told or has learned

Want to influence behaviour based on what is implicit in the KB


(or as close as possible)
Requires reasoning
deductive inference:
process of calculating entailments of KB
i.e given KB and any , determine if KB |=

Process is sound if whenever it produces , then KB |=


does not allow for plausible assumptions that may be true
in the intended interpretation

Process is complete if whenever KB |= , it produces


does not allow for process to miss some or be unable to
determine the status of

KR & R

Brachman & Levesque 2005

33

You might also like