speech & nlp (fall 2014): formal knowledge representation & semantics

61
Speech & NLP www.vkedco.blogspot.com Knowledge Representation & Semantics Conceptualization, Syntax & Semantics of First-Order Predicate Calculus, Interpretation, Variable Assignment, Satisfaction Vladimir Kulyukin Department of Computer Science Utah State University

Upload: vladimir-kulyukin

Post on 28-May-2015

207 views

Category:

Science


1 download

TRANSCRIPT

Page 1: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Speech & NLP

www.vkedco.blogspot.com

Knowledge Representation & Semantics

Conceptualization, Syntax & Semantics of First-Order Predicate Calculus,

Interpretation, Variable Assignment, Satisfaction

Vladimir Kulyukin

Department of Computer Science

Utah State University

Page 2: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Outline

● Conceptualization

● First-Order Predicate Calculus

– Syntax

– Semantics: Interpretation, Variable Assignment, Satisfaction

● Natural Language Examples

Page 3: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Introduction

● Intelligent behavior depends on an agent’s knowledge about

its world

● This knowledge is, to a great extent, descriptive (declarative)

● If this knowledge is to be used by a computer, this descriptive

knowledge must be formalized

● Knowledge representation is an area of AI the studies

methods to formalize the existing bodies of knowledge

Page 4: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

What Does this Agent Need to Act in the World?

World

Agent

Page 5: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Agent Needs Conceptualization. What Else?

Conceptualization

World

Some ideas about how the world works

Agent

Page 6: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

The Agent Needs Some Place to Store Knowledge

Conceptualization

World Knowledge Repository Some accessible place to store knowledge

Agent

Some ideas about how the world works

Page 7: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

The Agent Needs a Way to Write Knowledge Down

Conceptualization

World Knowledge Repository Some accessible place to store knowledge

Agent

Some ideas about how the world works

Page 8: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Agents need formalisms to encode & manipulate

knowledge about the world.

Fundamental Tenet of Symbolic AI

Page 9: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Conceptualization

Page 10: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Objects & Relations

● Knowledge formalization begins with a conceptualization of the

world

● Conceptualization, generally speaking, analyzes the world in terms of

objects and relations

● Functions are also relations

● Objects can be concrete (book, pen, block) or abstract (number 2,

honesty, love)

● Objects can be primitive (number 2) or abstract (algebraic

expression)

Page 11: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Universe of Discourse

● It is impossible for any conceptualization to include all objects in the world

● Conceptualizations reside inside observers (human or mechanical) and

include only those objects that present some interest to the observers

● Beekeepers conceptualize the world in terms bees, swarms, beehives, honey

extractors, bee disease treatments, etc

● Number theorists conceptualize the world in terms of numbers, sets, properties

of numbers, etc.

● The set of objects covered by a conceptualization is called the universe of

discourse

Page 12: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Functions & Relations

● Once a conceptualization has objects, the observer must

establish relations among those objects

● There are two types of relations most conceptualizations

contain: functions and relations

● A set of functions in the conceptualization is called functional

basis

● A set of relations in the conceptualization is called relational

basis

Page 13: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Blocks World

A

A

A

A

A

A

c

b

a

d

e

Which objects do you conceptualize in this world?

Page 14: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Blocks World: Objects

A

A

A

A

A

A

c

b

a

d

e

Many human observers conceptualize five blocks {a, b, c, d, e}

}and the table t

Page 15: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Blocks World: Objects

A

A

A

A

A

A

c

b

a

d

e

One can conceptualize five blocks {a, b, c, d, e} and the table t

Page 16: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Blocks World: Functions & Relations

A

A

A

A

A

A

c

b

a

d

e

What functions & relations do you see in this world?

Page 17: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Blocks World: Functions & Relations

A

A

A

A

A

A

c

b

a

d

e

We can define the partial function hat that maps a block into the block on top of

it. Formally, hat consists of the following tuples: hat: {<b, a>, <c, b>, <e, d>}

Page 18: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Blocks World: Functions & Relations

A

A

A

A

A

A

c

b

a

d

e

We can define the relations on or above with the obvious interpretations. Formally, these

relations consist of the following tuples:

on: {<a, b>, <b, c>, <d, e>}

above: {<a, b>, <b, c>, <a, c>, <d, e>}

Page 19: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Blocks World: Functions & Relations

A

A

A

A

A

A

c

b

a

d

e

We can define the relation clear that holds for a block if and only if there is no block on top of

it: clear: {a, d}

Page 20: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Blocks World: One Conceptualization

A

A

A

A

A

A

c

b

a

d

e

.,,,,,,,, clearaboveonhatedcba

Page 21: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Upper Bound on Number of N-ary Relations

subsets. possible 2 are There tuples.- theseofsubset a

isrelation ary -Every tuples.-distinct are There

objects. contains Discourse of Universe theSuppose

nO

n

n

nnO

O

Page 22: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Notes on Conceptualizations

● Conceptualizations, although they are written down, consists

of the objects and relations the observer actually sees in

the world

● The same world may have multiple conceptualizations (e.g.,

blocks world can be conceptualized in terms of line segments,

curves, and their relations)

● Different conceptualizations allow/inhibit certain kinds of

knowledge (light as a wave vs. light as a particle; geocentric

vs. heliocentric universe)

Page 23: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Realism vs. Nominalism

● Realism takes a stand that objects & relations in one’s

conceptualization really exist in the world

● Nominalism takes a stand that objects & relations in

one’s conceptualization do not necessarily exist in the

world

● AI takes a standpoint that conceptualizations are

justified by their utility to the system (this is, strictly

speaking, neither realism nor nominalism)

Page 24: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Brief Introduction

to

First-Order Predicate Calculus

Page 25: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Alphabets & Symbols

● Since FOPC is a formal language, it must start with an

alphabet

● Chapter 2 in Logical Foundations of AI contains one such

alphabet (typically it consists of the standard ASCII

augmented with specific mathematical symbols)

● FOPC has two types of symbols: variables and constants

● Constants consists of object constants, function

constants, and relation constants

Page 26: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Variables & Constants

● A variable is a sequence of lowercase alphanumeric characters and numeric characters

such that the first character is lowercase alphabetic

● An object constant names a specific element in the universe of discourse and is a

sequence of alphabetic characters or digits such that the first character is either uppercase

alphabetic or digit

● A function constant names a function on the members of the universe of discourse and is

a mathematical operator or a sequence of alphabetic characters or digits in which the first

character is uppercase alphabetic

● A relation constant names a relation on the members of the universe of discourse and is a

mathematical operator or a sequence of alphabetic characters or digits in which the first

character is uppercase alphabetic

Page 27: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Variables & Constants: Examples

● Variables: x, y, z, x10, y15, z500

● Object constants: Logan, Aristotle, Hallway100

● Function constants: Age, Cosine, Tangent, +, -, *

● Relation constants: Above, Clear, Below

Page 28: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Terms

● A term is an object’s name

● A term can be a variable, an object constant, or a

functional expression

● A functional expression is an expression of the form

f(t1, t2, …, tn) , where f is an n-ary function constant

and are t1, t2, …, tn terms (this is a recursive definition)

Page 29: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Terms: Examples

● A, B, C, D, E are object constants and, therefore, terms

● Hat is a function constant

● Hat(C) is a term (functional expression)

● Hat(Hat(C)) is a term (functional expression)

● Hat(x) is a term (functional expression)

● Hat(Hat(x)) is a term (functional expression)

Page 30: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Well-Formed Formulas (WFFs)

● In FOPC, facts are stated in sentences (aka well-

formed formulas or wffs)

● Three types of sentences:

– Atomic sentences (aka atoms);

– Logical sentences;

– Quantified sentences

Page 31: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Atoms

at(C))Above(A, H

Hat(C))On(Hat(B),

On(A, B)

tttt nn

:Examples

termsare ,..., andconstant relation a is where,,..., 11

Page 32: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Atoms

21

21

21

:Examples atoms. are sexpression

subset es,inequaliti ,equalities almathematic All

tt

tt

tt

Page 33: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Logical Sentences

atomsor sentences logical are , where,:eequivalenc 6.

atomsor sentences logical are , where, :nimplicatio reverse 5.

atomsor sentences logical are , where, :nimplicatio 4.

atomor sentence logical a is ,... :ndisjunctio 3.

atomor sentence logical a is ,... :nconjunctio 2.

sentence logical a is where :negation 1.

sentences. logicalother or

atoms tooperators logical applyingby formed are sentences Logical

11

11

nin

nin

Page 34: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Logical Sentences: Examples

AEOnADOnACOnABOnAClear

yxOnyxAbove

yxAboveyxOn

xxHatAbovexxHatAbove

EDAboveBAOn

BAOn

,,,, 6.

,, 5.

,, 4.

,, 3.

,, 2.

, 1.

sentences. logicalother or atoms to

operators logical applyingby formed are sentences Logical

Page 35: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Quantified Sentences

vTablevBlockv

vBlockvBluev

vBlockvBluev

xBlockxBluex

vv

vv

:Examples

sentence a is and

variablea is where :tionquantifica lexistentia 2.

sentence a is and

variablea is where :tionquantifica universal 1.

s.quantifier lexistentiaor universal the

withsentencesother prefixingby formed are sentences Quantified

Page 36: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

More Examples of Quantified Sentences

yxyx

yxyx

yxyx

yxLovesyx

yxLovesyx

yxLovesyx

,

,

,

Page 37: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Semantics

Page 38: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

How Does the Agent Know What is True?

Conceptualization

World Knowledge Repository

Agent

Page 39: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Worlds, Conceptualizations, Knowledge

Repositories, & Agents

● Sentences are written in a knowledge repository (book, smartphone,

database, etc.)

● Conceptualizations of the world exist in the agent’s head (some true,

some false, some partially true)

● Truth of each sentence is evaluated with respect to a specific

conceptualization

● As the agent acts in the world, the agent may modify or abandon

conceptualizations or adopt new ones

Page 40: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Interpretation as a Function

● Interpretation is a mapping b/w the elements of a formal

language (FOPC in our case) and the elements of a

conceptualization

● Formally, an interpretation is the function I(σ) where σ is an

element of the language

● The value of I(σ) is an element of a given conceptualization

● The universe of discourse is denoted |I|

Page 41: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Formal Properties of Interpretation

constantrelation a is if ,

constantfunction a is if , :

constantobject an is if

n

n

II

III

II

Page 42: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Blocks World Interpretation I

daClearI

edcacbbaAboveI

edcbbaOnI

debcabHatI

eEIdDIcCIbBIaAI

,

,,,,,,,

,,,,,

,,,,,

;;;;;

Page 43: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Blocks World Interpretation J

daClearI

deacbcabAboveI

debcabOnJ

debcabHatJ

eEJdDJcCJbBJaAJ

Above

OnClear

HatIJ

,

,,,,,,,

,,,,,

,,,,,

;;;;;

:below'' as

and under'' as interpretsbut ,relation unary

and ,function constants,object on with agrees

Page 44: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Variable Assignment

CzUByUAxU

U

;;:Example

constants.object

to variablesmapping function a is assignment Variable

symbols.other from separately dinterprete are Variables

Page 45: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Term Interpretation

nIUii

n

IU

IU

IU

xxftTxtI

fIttt

tUtTt

tItTt

T

UI

,...,then ,

, and ,..., form theof terma is If .3

then variable,a is If .2

then constant,object an is If .1

:follows as defined

objects to termsmapping assignment terma is the

,assignment variablea is and tion,interpretaan is If

1

1

Page 46: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Term Interpretation: Example

then ,let

and ,previously definedtion interpreta theis If

bCHatwUHatIwHatT

CwU

I

IU

Page 47: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Satisfaction

Page 48: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

General Notation

U

IU

U

IU

I

I

assignment variablea

and tion interpretaan under satisfiednot is Sentence:|

assignment variablea

and tion interpretaan under satisfied is Sentence:|

Page 49: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Case 1

2121 iff | tTtTUtt IUIUI

Page 50: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Case 2

edcacbbaAboveIcaCTAT

UCAAbove

edcacbbaAboveI

cCIaAI

ItTtTUtt

IUIU

I

nIUnIUI

,,,,,,,,,

because satisfied is ,|

,,,,,,,

;;

:Example

,..., iff ,...,| 21

Page 51: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Case 3

UttUtt II 2121 ,...,| iff ,...,|

Page 52: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Case 4

niUU iInI ,...,1,| iff ...| 1

Page 53: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Case 5

niUU iInI ,...,1 somefor ,| iff ...| 1

Page 54: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Case 6

UUU III 2121 | | iff |

Page 55: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Case 7

UUU III 122121 | | iff |

Page 56: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Case 8

.|,in with

replaced is after |,| allfor iff |

Ud

vIdUv

I

I

Page 57: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Case 9

Udv

IdUv

I

I

|,in with replaced is after

|,| somefor iff |

Page 58: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Examples

xPoisonousxMushroomxPurplex

xPoisonousxMushroomxPurplex

poisonous. are mushrooms purple All

Page 59: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Examples

xPurplexPoisonousxMushroomx

purple. isit ifonly poisonous is mushroomA

Page 60: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

Examples

xPoisonousxMushroomxPurplex

xPoisonousxMushroomxPurplex

poisonous. is mushroom purple No

Page 61: Speech & NLP (Fall 2014): Formal Knowledge Representation & Semantics

References

● Ch 02, M. Genesereth & N. Nilsson. Logical Foundations

of AI, Morgan Kaufmann