28
Logics for Data and Knowledge Representation Exercises: Description Logics Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese

Logics for Data and Knowledge Representation

  • Upload
    yale

  • View
    51

  • Download
    1

Embed Size (px)

DESCRIPTION

Logics for Data and Knowledge Representation. Exercises: Description Logics. Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese. Normalization of a TBox. Normalize the TBox below: MonkeyLow ⊑  GetBanana GetBanana ≡ Survive Possible solution: MonkeyLow ≡  GetBanana ⊓  ClimbBox - PowerPoint PPT Presentation

Citation preview

Page 1: Logics for Data and Knowledge Representation

Logics for Data and KnowledgeRepresentation

Exercises: Description Logics

Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese

Page 2: Logics for Data and Knowledge Representation

Normalization of a TBox Normalize the TBox below:

MonkeyLow ⊑ GetBananaGetBanana ≡ Survive

Possible solution:MonkeyLow ≡ GetBanana ⊓ ClimbBoxGetBanana ≡ Survive

Note that, with this theory, the monkey necessarily needs to get the banana to survive.

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

2

Page 3: Logics for Data and Knowledge Representation

Expansion of a TBox Expand the TBox below:

MonkeyLow ≡ GetBanana ⊓ ClimbBoxGetBanana ≡ Survive

T’, expansion of T (The Venn diagram gives a possible model):MonkeyLow ≡ Survive ⊓ ClimbBoxGetBanana ≡ Survive

SurviveGetBanana MonkeyLow

ClimbBoxNotice that the fact that a monkey climbs the box does not necessarily mean that it survives.

3

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 4: Logics for Data and Knowledge Representation

Satisfiability with respect to a TBox T (I)

RECALL:

A concept P is satisfiable w.r.t. a terminology T, if there exists an interpretation I with I ⊨ θ for all θ ∈ T, and such that I ⊨ P, namely I(P) is not empty

4

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 5: Logics for Data and Knowledge Representation

Satisfiability with respect to a TBox T (II) Suppose we model the Monkey-Banana problem as follows:

“If the monkey is low in position then it cannot get the banana. If the monkey gets the banana it survives”.

TBox TMonkeyLow ⊑ GetBananaGetBanana ⊑ Survive

Is T satisfiable?

Survive

GetBanana MonkeyLow

5

YES! Look at the Venn diagram

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 6: Logics for Data and Knowledge Representation

Satisfiability with respect to a TBox T (III) Suppose we model the Monkey-Banana problem as follows:

TBox TMonkeyLow ⊑ GetBananaGetBanana ⊑ Survive

Is it possible for a monkey to survive even if it does not get the banana?

We can restate the problem as follow: does T ⊨ GetBanana Survive⊓ ?

6

Survive

GetBanana MonkeyLow

YES! Look at the Venn diagram

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 7: Logics for Data and Knowledge Representation

Translate the following statements in DL (I) All users can download files

User ⊑ ∃Download.File

A read access user can read files only ReadAccesUser ⊑ ∀Read.File

Those who can write can also read Write ⊑ Read

A limited user can download no more than 3 files LimitedUser ⊑ ≤3 Download.File

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 8: Logics for Data and Knowledge Representation

Translate the following statements in DL (I) Programmers write programs

Programmer ⊑ ∃Write.Programs

Producers can produce music and song files onlyMusic ⊑ FileSong ⊑ File

Producer ⊑ ∀Produce.(Music ⊔ Song)

A program can be downloaded by developers only Program ⊑ ∀Download-1.Developer

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 9: Logics for Data and Knowledge Representation

Define a TBox and ABox for the following problem Diana wants to give read access to her friends to the files on

her PC, and write access to her best friend Gloria only. Bill is just a friend.

Friend ⊑ ∃Read.FileBestFriend ⊑ ∃Write.File ⊓ Friend

BestFriend(Gloria)Friend(Bill)

Can Gloria read Diana’s files? YesBestFriend(Gloria) Friend(Gloria) ∃Read.File(Gloria)

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 10: Logics for Data and Knowledge Representation

Define a TBox and ABox for the following problem In a library, employees have access to books. However, a

loaned book is a non precious book and can be read by clients. Mary is a client and reads a book titled “Top stories”.

Employee ⊑ ∃Access.BookLoanedBook ⊑ Book ⊓ Precious ⊓ ∀Read-1.Client

Client(Mary) Book(TopStories)

Read(Mary,TopStories)

Is it possible for the book to be precious? YesWe can verify that Precious(TopStories) is consistent with the ABox and TBox above.

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 11: Logics for Data and Knowledge Representation

Defining the TBox and ABox: the LDKR Class

Name Nationality HairFausto Italian White

Enzo Italian Black

Rui Chinese Black

Bisu Indian Black

11

ABox ={Italian(Fausto), Italian(Enzo), Chinese(Rui), Indian(Bisu), BlackHair(Enzo), BlackHair(Rui), BlackHair(Bisu),WhiteHair(Fausto)}

TBox ={Italian ⊑ LDKR, Indian ⊑ LDKR,Chinese ⊑ LDKR, BlackHair ⊑ LDKR,WhiteHair ⊑ LDKR}

Define a TBox and ABox for the following database:

LDKR

NOTE: ClassL is not expressive enough to represent database constrains such as keys involving two fields.

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 12: Logics for Data and Knowledge Representation

Formalization of a semantic network

12

instance-of

instance-of

Person Drives.Car⊑ ∃Person HasHobby.SportCar⊑ ∃Person HasHobby.Opera⊑ ∃Student Person⊑SportCar ⊑ CarStudent(Ralf)Opera(DonCarlos)

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 13: Logics for Data and Knowledge Representation

Venn diagrams Provide the Venn diagram for: A ⊑ B ⊓ ¬C

as a way to prove the satisfiability

13

B

A

C

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 14: Logics for Data and Knowledge Representation

14

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 15: Logics for Data and Knowledge Representation

15

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 16: Logics for Data and Knowledge Representation

16

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 17: Logics for Data and Knowledge Representation

17

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 18: Logics for Data and Knowledge Representation

Using DPLL for reasoning tasks DPLL solves the CNFSAT-problem by searching a truth-assignment that

satisfies all clauses θi in the input proposition P = θ1 … θn DL sentences must to be translated in PL (via TBox and ABox

elimination)

Model checking Does ν satisfy P? (ν P?⊨ )Check if ν(P) = true

Satisfiability Is there any ν such that ν P?⊨Check that DPLL(P) succeeds and returns a ν

Unsatisfiability Is it true that there are no ν satisfying P?Check that DPLL(P) fails

Validity Is P a tautology? (true for all ν)Check that DPLL(P) fails

18

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 19: Logics for Data and Knowledge Representation

Reduce to PL reasoning Consider the TBox T = {A B ⊑ ⊔ C, C D ⊑ ⊓ E}.

Determine if A E by elimination of T. ⊑

T’ = {A ≡ (B ⊔ C) ⊓ X, C ≡ D ⊓ E ⊓ Y}

A’ = (B ⊔ (D ⊓ E ⊓ Y)) ⊓ XE’ = E

A’ = (B (D E Y)) XE’ = E

Call DPLL((B (D E Y)) X → E)(Note that the formula has to be converted in CNF first)

19

The steps:T’ = Normalize(T); C’ = Expand(C, T’);D’ = Expand(D, T’);C’ =

RewriteInPL(C’);D’ =

RewriteInPL(D’);return DPLL(C’ →

D’);

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 20: Logics for Data and Knowledge Representation

Satisfiability of a TBox (a set of formulas) Say if the following TBox is satisfiable and provide a class

valuation in the case: FederalAgent Access.TopSecretDocument⊑ ∃ XFile TopSecretDocument ⊑ ⊓ Restricted Read⊓ ∀ -1.Policeman

I(FederalAgent) = {A} We have that I ⊨ TI(TopSecretDocument) = {D1, D2}I(Access) = {(A, D1), (A, D2)}I(XFile) = {D1}I(Restricted) = {D2}I(Read) = {(B, D1)}I(Policeman) = {B}

20

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 21: Logics for Data and Knowledge Representation

Satisfiability w.r.t. a TBox Consider the TBox T:

FederalAgent Access.TopSecretDocument⊑ ∃ XFile TopSecretDocument ⊑ ⊓ Restricted Read⊓ ∀ -1.Policeman and the formula P: TopSecretDocument Restricted⊓ does T P ?⊨ Yes, if fact these is an interpretation I (e.g. the one of the previous

exercise) such that I T and I P. ⊨ ⊨I(TopSecretDocument) = {D1, D2}I(Restricted) = {D1} Notice that T does not affect P at all (i.e. we cannot further

expand P w.r.t. T)

21

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 22: Logics for Data and Knowledge Representation

Subsumption Consider the TBox T:

FederalAgent Access.TopSecretDocument⊑ ∃ XFile TopSecretDocument ⊑ ⊓ Restricted Read⊓ ∀ -1.Policeman does T ⊨ TopSecretDocument Restricted⊑ ?

By definition, it must be I(TopSecretDocument ) I(Restricted ) for every model I of T. Even if this is true for the I of the previous exercise, this is not true in general. It is enough to provide a counterexample:

22

I(FederalAgent) = {A}I(TopSecretDocument) = {D2}I(Access) = {(A, D1), (A, D2)}

I(XFile) = {D2}I(Restricted) = {D1}I(Read) = {(B, D2)}I(Policeman) = {B}

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 23: Logics for Data and Knowledge Representation

Satisfiability of a TBox using tableaux Say if the following TBox is satisfiable using the tableaux: FederalAgent Access.TopSecretDocument⊑ ∃ XFile TopSecretDocument ⊑ ⊓ Restricted Read⊓ ∀ -1.Policeman

Translate into a formula:( FederalAgent ⊔ Access.TopSecretDocument) ∃ ⊓( XFile ⊔ (TopSecretDocument ⊓ Restricted Read⊓ ∀ -1.Policeman))

Apply the tableaux rules:(1) FederalAgent(x) or Access.TopSecretDocument(x)∃and(2) Xfile(x) or {TopSecretDocument(x), Restricted(x), Read∀ 1.Policeman(x)}

23

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 24: Logics for Data and Knowledge Representation

Expansion of an ABox Provide the expansion of A w.r.t. T (without normalization),

where:

TBox T = {Student Faculty, Professor Faculty Teach} ⊑ ⊑ ⊓ ABox A = {Professor(Bob), Faculty(Rui)}

Professor(Bob), Faculty(Bob), Teach(Bob)Faculty(Rui)

24

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 25: Logics for Data and Knowledge Representation

ABox Consistency An ABox A is consistent with respect to a TBox T if there is an

interpretation I which is a model of both A and T.

T = {Parent⊑≤1hasChild}A = {hasChild(mary, bob), hasChild(mary, cate), Parent(mary)}

A is consistent ALONE but is not consistent with respect T.In fact, from A mary has two children while T imposes maximum one

25

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 26: Logics for Data and Knowledge Representation

ABox: Instance checking (I)Given the TBox and ABox below T:

Female⊑Human Male⊑Human Mother⊑Female Father⊑Male Child≡∃has.Mother⊓ ∃has.Father Male⊓Female⊑⊥

26

Prove:1. Human(Anna)2. ¬Female(Bob)3. Child(Cate)

A: Mother(Anna) Father(Bob) has(Cate,Anna) has(Cate,Bob)

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 27: Logics for Data and Knowledge Representation

ABox: Instance checking (II)

27

Expand A w.r.t. T:

A: Mother(Anna) Female(Anna) Human(Anna) Father(Bob) Male(Bob) Human(Bob) , ¬Female(Bob) has(Cate,Anna) , has(Cate,Bob) Child(Cate)

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING

Page 28: Logics for Data and Knowledge Representation

ABox: Instance checking (III)

28

Given the ABox A = {R(a,b), R(a, c), A(b)} is a an instance of ∃R.A?

Take R.A(a). Given its semantics, there should be {R(a, x), A(x)} ∃ A for some x.

If we take x = b we see that this actually holds.

TBOX :: MODELING IN DL :: PROOFS :: TBOX REASONING :: ABOX REASONING