Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and...

25
Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese

Transcript of Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and...

Page 1: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

Logics for Data and KnowledgeRepresentation

Exercises: Modeling

Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese

Page 2: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

Outline Modeling Logical Modeling

Exercises with intensional models Forest

Exercises with extensional models Classroom Family My friends Databases

2

Page 3: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

Modeling: from the world to its representation

3

World

LanguageL

TheoryT

DomainD

ModelM

DataKnowledge

Meaning

MentalModel

SEMANTICGAP

MODELING :: LOGICAL MODELING :: INTENTIONAL MODELS :: EXTENSIONAL MODELS

Page 4: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

What and How World: the phenomenon we want to describe Domain: the abstract relevant elements in the real world Mental Model: what we have in mind. It is the first abstraction of

the world (subject to the semantic gap) Language: the set of words and rules we use to build sentences

used to express our mental model Model: the formalization of the mental model, i.e. the set of true

facts in the language, in agreement with the theory Theory: the set of sentences (constraints) about the world

expressed in the language that limit the possible models

NOTE: this does not necessarily need to be in formal semantics

4

MODELING :: LOGICAL MODELING :: INTENTIONAL MODELS :: EXTENSIONAL MODELS

Page 5: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

Example of informal Modeling

5

World

MentalModel

SEMANTICGAP

ModelM

L: Informal description in NL

D: {monkey, banana, tree}

T: If the monkey climbs on the tree, he can get the banana

M: The monkey actually climbs on the tree and gets the banana

TheoryT

NOTE: a database can be seen as an informal model

LanguageL

DomainD

MODELING :: LOGICAL MODELING :: INTENTIONAL MODELS :: EXTENSIONAL MODELS

Page 6: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

Logical Modeling

6

Modeling

Realization

World

LanguageL

TheoryT

DomainD

ModelM

DataKnowledge

Meaning

MentalModel

SEMANTICGAP

Inte

rpre

tatio

n

I

En

tailm

en

t⊨

NOTE: the key point is that in logical modeling we have formal semantics

MODELING :: LOGICAL MODELING :: INTENTIONAL MODELS :: EXTENSIONAL MODELS

Page 7: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

What and How World: the phenomenon that we are observing and want to model Domain (D) = the abstract relevant objects from the world Language (L) = a logical language with formal syntax and semantics:

The formal syntax is given by the set of rules to construct complex sentences (the grammar)

The formal semantics is given by the interpretation function I: L → D

Model (M) = the abstract (mathematical sense) representation of the intended truths via the interpretation I of the language L. M is called L-model of D M P, indicates that M satisfies P⊨

Theory (T) = the set of facts/constraints expressed in the language L. A fact defines a piece of knowledge (about D), something true in

the model.

7

MODELING :: LOGICAL MODELING :: INTENTIONAL MODELS :: EXTENSIONAL MODELS

Page 8: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

Example of formal (intentional) Modeling

8

World

SEMANTICGAP

L = {Monkey, Climbs, GetBanana, , , }

D= {T, F}

T = { (Monkey Climbs) GetBanana}

A possible model M:I(Monkey) = TI(Climbs) = TI(GetBanana) = T

MentalModel

ModelM

TheoryT

LanguageL

DomainD

MODELING :: LOGICAL MODELING :: INTENTIONAL MODELS :: EXTENSIONAL MODELS

Page 9: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

Example of formal (extensional) Modeling

9

World

SEMANTICGAP

L = {Monkey, Climbs, GetBanana, , , }

D= {Cita, ThatBanana}

T = { Climbs GetBanana}

A possible model M:I(Monkey) = CitaI(Climbs) = CitaI(GetBanana) = ThatBanana

MentalModel

ModelM

TheoryT

LanguageL

DomainD

MODELING :: LOGICAL MODELING :: INTENTIONAL MODELS :: EXTENSIONAL MODELS

Page 10: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

Modeling Exercise: Forest Description: There are two lions, Kimba and Simba,

in the forest. They are in competition for the food. There is a nice antelope they want to hunt. If they want to survive they have to catch it.

Problem: Model the problem by identify relevant objects, defining the domain, the language, the theory and providing a possible intentional model.

10

MODELING :: LOGICAL MODELING :: INTENTIONAL MODELS :: EXTENSIONAL MODELS

Page 11: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

Solution: Forest (I) Description: There are two lions, Kimba and Simba,

in the forest. They are in competition for the food. There is a nice antelope they want to hunt. If they want to survive they have to catch it.

Relevant objects are in red

D = {T, F}

L = {Lion, Antelope, Survive, Catch}

11

MODELING :: LOGICAL MODELING :: INTENTIONAL MODELS :: EXTENSIONAL MODELS

Page 12: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

Solution: Forest (II) A possible model:

I (Lion) = T I (Antelope) = T

I (Catch) = T I (Survive) = T

The theory T:

Antelope (Catch Survive)

Antelope Catch

I above is a model for T

I below is NOT a model for T

I (Lion) = T I (Antelope) = F

I (Catch) = F I (Survive) = T

12

MODELING :: LOGICAL MODELING :: INTENTIONAL MODELS :: EXTENSIONAL MODELS

Page 13: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

Modeling Exercise: Classroom Description: In a class there are several persons.

Usually there is one professor who teaches to some students. Students can be Master students or PhD students. Among PhD students there might be some Assistants of the professor.

Problem: Model the problem by identify relevant objects, defining the domain and the language, and providing a possible extensional model for it.

13

MODELING :: LOGICAL MODELING :: INTENTIONAL MODELS :: EXTENSIONAL MODELS

Page 14: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

Solution: Classroom (I) Description: In a class there are several persons.

Usually there is one professor who teaches to some students. Students can be Master students or PhD students. Among PhD students there might be some Assistants of the professor.

Relevant objects are in red

L = {Person, Professor, Student, Master, PhD, Assistant}

D = {Fausto, Mary, Paul, Jane}

14

MODELING :: LOGICAL MODELING :: INTENTIONAL MODELS :: EXTENSIONAL MODELS

Page 15: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

Solution: Classroom (II) The corresponding Venn diagram

15

PersonStudent

ProfessorPhD

Master

Assistant

MODELING :: LOGICAL MODELING :: INTENTIONAL MODELS :: EXTENSIONAL MODELS

U

Page 16: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

Solution: Classroom (III) A possible model:

I (Person) = {Fausto, Mary, Paul, Jane}

I (Professor) = {Fausto}

I (Student) = {Mary, Paul, Jane}

I (Master) = {Mary}

I (PhD) = {Paul, Jane}

I (Assistant) = {Paul}

16

MODELING :: LOGICAL MODELING :: INTENTIONAL MODELS :: EXTENSIONAL MODELS

Page 17: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

Modeling Exercise: Family Description: My family consists of several

members. There is a grandparent and my parents. Then there are some children, i.e. two sisters, one brother and me

Problem: Model the problem by identify relevant objects, defining the domain and the language, and providing a possible extensional model for it.

17

MODELING :: LOGICAL MODELING :: INTENTIONAL MODELS :: EXTENSIONAL MODELS

Page 18: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

Solution: Family (I) Description: My family consists of several

members. There is a grandparent and my parents. Then there are some children, i.e. two sisters, one brother and me

Relevant objects are in red

L = {member, grandparent, parent, child, brother, sister, me}

D = {Bob, Fausto, Mary, Paul, Jane, Hugo, Robert}

18

MODELING :: LOGICAL MODELING :: INTENTIONAL MODELS :: EXTENSIONAL MODELS

Page 19: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

Solution: Family (II)

19

Member

ParentGrandparent

Brother SisterChild

The corresponding Venn diagram

Me

MODELING :: LOGICAL MODELING :: INTENTIONAL MODELS :: EXTENSIONAL MODELS

U

Page 20: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

Solution: Family (III) A possible model:

I (Member) = {Bob, Fausto, Mary, Paul, Jane, Hugo, Robert}

I (Grandparent) = {Bob}

I (Parent) = {Fausto, Mary, Bob}

I (Brother) = {Robert, Paul}

I (Sister) = {Jane}

I (Me) = {Hugo}

20

MODELING :: LOGICAL MODELING :: INTENTIONAL MODELS :: EXTENSIONAL MODELS

Page 21: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

Modeling Exercise: My friends Description: I have a lot of friends. I met some of

them on the forum of my website. However, only a few of them are close to me. In particular, I use to play chess with Paul.

Problem: Model the problem by identify relevant objects, defining the domain and the language, and providing a possible extensional model for it.

21

MODELING :: LOGICAL MODELING :: INTENTIONAL MODELS :: EXTENSIONAL MODELS

Page 22: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

Solution: My friends (I) Description: I have a lot of friends. I met some of

them on the forum of my website. However, only a few of them are close to me. In particular, I use to play chess with Paul.

Relevant objects are in red

L = {Friend, Forum, Close, PlayingChess}

D = {Bob, Fausto, Mary, Paul, Jane, Hugo, Robert}

22

MODELING :: LOGICAL MODELING :: INTENTIONAL MODELS :: EXTENSIONAL MODELS

Page 23: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

Solution: My friends (II)

23

FriendFriend

Forum

The corresponding Venn diagram

Close

PlayingChess

MODELING :: LOGICAL MODELING :: INTENTIONAL MODELS :: EXTENSIONAL MODELS

U

Page 24: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

Solution: My friends (III) A possible model:

I (Friend) = {Bob, Paul, Jane, Robert, Richard, Samuel}

I (Forum) = {Bob, Paul, Jane}

I (Close) = {Bob, Paul, Samuel}

I (PlayingChess) = {Paul}

24

MODELING :: LOGICAL MODELING :: INTENTIONAL MODELS :: EXTENSIONAL MODELS

Page 25: Logics for Data and Knowledge Representation Exercises: Modeling Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese.

Closed world assumption (CWA): The assumption that what is not currently

known to be true, is false.

I (Italian) = {Fausto, Enzo}

I (BlackHair) = {Enzo, Rui}

… Open world assumption

(OWA): anything which is not explicitly asserted is unknown.

Is Rui Italian? This is not asserted in the DB, therefore it is unknown.

A Database

25

ID Name Nationality Hair Color Affiliation

1 Fausto Italian White Professor

2 Enzo Italian Black PhD

3 Rui Chinese Black Assistant

4 …

5 …

… …

ClassItalian

BlackHairPhD

MODELING :: LOGICAL MODELING :: INTENTIONAL MODELS :: EXTENSIONAL MODELS