Logics for Data and Knowledge Representation Exercises Description

  • Slides: 28
Download presentation
Logics for Data and Knowledge Representation Exercises: Description Logics Fausto Giunchiglia, Rui Zhang and

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

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

TBOX : : MODELING IN DL : : PROOFS : : TBOX REASONING : : ABOX REASONING Normalization of a TBox q Normalize the TBox below: Monkey. Low ⊑ Get. Banana ≡ Survive q Possible solution: Monkey. Low ≡ Get. Banana ⊓ Climb. Box Get. Banana ≡ Survive Note that, with this theory, the monkey necessarily needs to get the banana to survive. 2

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

TBOX : : MODELING IN DL : : PROOFS : : TBOX REASONING : : ABOX REASONING Expansion of a TBox q Expand the TBox below: Monkey. Low ≡ Get. Banana ⊓ Climb. Box Get. Banana ≡ Survive q T’, expansion of T (The Venn diagram gives a possible model): Monkey. Low ≡ Survive ⊓ Climb. Box Get. Banana ≡ Survive Get. Banana 3 Climb. Box Monkey. Low Notice that the fact that a monkey climbs the box does not necessarily mean that it survives.

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

TBOX : : MODELING IN DL : : PROOFS : : TBOX REASONING : : ABOX REASONING 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 :

TBOX : : MODELING IN DL : : PROOFS : : TBOX REASONING : : ABOX REASONING Satisfiability with respect to a TBox T (II) q 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 T Monkey. Low ⊑ Get. Banana ⊑ Survive q Is T satisfiable? YES! Look at the Venn diagram Survive Get. Banana 5 Monkey. Low

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

TBOX : : MODELING IN DL : : PROOFS : : TBOX REASONING : : ABOX REASONING Satisfiability with respect to a TBox T (III) q Suppose we model the Monkey-Banana problem as follows: TBox T Monkey. Low ⊑ Get. Banana ⊑ Survive Is it possible for a monkey to survive even if it does not get the banana? q We can restate the problem as follow: does T ⊨ Get. Banana ⊓ Survive ? q YES! Look at the Venn diagram Survive Get. Banana 6 Monkey. Low

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

TBOX : : MODELING IN DL : : PROOFS : : TBOX REASONING : : ABOX REASONING Translate the following statements in DL (I) All users can download files User ⊑ ∃Download. File A read access user can read files only Read. Acces. User ⊑ ∀Read. File Those who can write can also read Write ⊑ Read A limited user can download no more than 3 files Limited. User ⊑ ≤ 3 Download. File

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

TBOX : : MODELING IN DL : : PROOFS : : TBOX REASONING : : ABOX REASONING Translate the following statements in DL (I) Programmers write programs Programmer ⊑ ∃Write. Programs Producers can produce music and song files only Music ⊑ File Song ⊑ File Producer ⊑ ∀Produce. (Music ⊔ Song) A program can be downloaded by developers only Program ⊑ ∀Download-1. Developer

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

TBOX : : MODELING IN DL : : PROOFS : : TBOX REASONING : : ABOX REASONING 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. File Best. Friend ⊑ ∃Write. File ⊓ Friend Best. Friend(Gloria) Friend(Bill) Can Gloria read Diana’s files? Yes Best. Friend(Gloria) ∃Read. File(Gloria)

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

TBOX : : MODELING IN DL : : PROOFS : : TBOX REASONING : : ABOX REASONING 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. Book Loaned. Book ⊑ Book ⊓ Precious ⊓ ∀Read-1. Client(Mary) Book(Top. Stories) Read(Mary, Top. Stories) Is it possible for the book to be precious? Yes We can verify that Precious(Top. Stories) is consistent with the ABox and TBox above.

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

TBOX : : MODELING IN DL : : PROOFS : : TBOX REASONING : : ABOX REASONING Defining the TBox and ABox: the LDKR Class q Define a TBox and ABox for the following database: LDKR Name Nationality Hair Fausto Italian White Enzo Italian Black Rui Chinese Black Bisu Indian Black NOTE: Class. L is not expressive enough to represent database constrains such as keys involving two fields. 11 ABox = {Italian(Fausto), Italian(Enzo), Chinese(Rui), Indian(Bisu), Black. Hair(Enzo), Black. Hair(Rui), Black. Hair(Bisu), White. Hair(Fausto)} TBox = {Italian ⊑ LDKR, Indian ⊑ LDKR, Chinese ⊑ LDKR, Black. Hair ⊑ LDKR, White. Hair ⊑ LDKR}

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

TBOX : : MODELING IN DL : : PROOFS : : TBOX REASONING : : ABOX REASONING Formalization of a semantic network instance-of Person ⊑ ∃Drives. Car Person ⊑ ∃Has. Hobby. Sport. Car Person ⊑ ∃Has. Hobby. Opera Student ⊑ Person Sport. Car ⊑ Car Student(Ralf) Opera(Don. Carlos) 12 instance-of

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

TBOX : : MODELING IN DL : : PROOFS : : TBOX REASONING : : ABOX REASONING Venn diagrams the Venn diagram for: A ⊑ B ⊓ ¬C as a way to prove the satisfiability q Provide B A 13 C

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

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

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

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

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

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

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

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

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

TBOX : : MODELING IN DL : : PROOFS : : TBOX REASONING : : ABOX REASONING 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 :

TBOX : : MODELING IN DL : : PROOFS : : TBOX REASONING : : ABOX REASONING Reduce to PL reasoning q 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)) ⊓ X E’ = E A’ = (B (D E Y)) X E’ = 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’ = Rewrite. In. PL(C’); D’ = Rewrite. In. PL(D’); return DPLL(C’ → D’);

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

TBOX : : MODELING IN DL : : PROOFS : : TBOX REASONING : : ABOX REASONING Satisfiability of a TBox (a set of formulas) q Say if the following TBox is satisfiable and provide a class valuation in the case: Federal. Agent ⊑ ∃Access. Top. Secret. Document XFile ⊑ Top. Secret. Document ⊓ Restricted ⊓ ∀Read-1. Policeman I(Federal. Agent) = {A} I(Top. Secret. Document) = {D 1, D 2} I(Access) = {(A, D 1), (A, D 2)} I(XFile) = {D 1} I(Restricted) = {D 2} I(Read) = {(B, D 1)} I(Policeman) = {B} 20 We have that I ⊨ T

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

TBOX : : MODELING IN DL : : PROOFS : : TBOX REASONING : : ABOX REASONING Satisfiability w. r. t. a TBox q Consider the TBox T: Federal. Agent ⊑ ∃Access. Top. Secret. Document XFile ⊑ Top. Secret. Document ⊓ Restricted ⊓ ∀Read-1. Policeman and the formula P: Top. Secret. Document ⊓ Restricted does T ⊨ P ? q Yes, if fact these is an interpretation I (e. g. the one of the previous exercise) such that I ⊨ T and I ⊨ P. I(Top. Secret. Document) = {D 1, D 2} I(Restricted) = {D 1} q 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 :

TBOX : : MODELING IN DL : : PROOFS : : TBOX REASONING : : ABOX REASONING Subsumption q Consider the TBox T: Federal. Agent ⊑ ∃Access. Top. Secret. Document XFile ⊑ Top. Secret. Document ⊓ Restricted ⊓ ∀Read-1. Policeman does T ⊨ Top. Secret. Document ⊑ Restricted ? By definition, it must be I(Top. Secret. Document ) 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: I(Federal. Agent) = {A} I(Top. Secret. Document) = {D 2} I(Access) = {(A, D 1), (A, D 2)} 22 I(XFile) = {D 2} I(Restricted) = {D 1} I(Read) = {(B, D 2)} I(Policeman) = {B}

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

TBOX : : MODELING IN DL : : PROOFS : : TBOX REASONING : : ABOX REASONING Satisfiability of a TBox using tableaux q Say if the following TBox is satisfiable using the tableaux: Federal. Agent ⊑ ∃Access. Top. Secret. Document XFile ⊑ Top. Secret. Document ⊓ Restricted ⊓ ∀Read-1. Policeman Translate into a formula: ( Federal. Agent ⊔ ∃Access. Top. Secret. Document) ⊓ ( XFile ⊔ (Top. Secret. Document ⊓ Restricted ⊓ ∀Read-1. Policeman)) Apply the tableaux rules: (1) Federal. Agent(x) or ∃Access. Top. Secret. Document(x) and (2) Xfile(x) or {Top. Secret. Document(x), Restricted(x), ∀Read 1. Policeman(x)} … 23

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

TBOX : : MODELING IN DL : : PROOFS : : TBOX REASONING : : ABOX REASONING Expansion of an ABox q 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 :

TBOX : : MODELING IN DL : : PROOFS : : TBOX REASONING : : ABOX REASONING 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⊑≤ 1 has. Child} A = {has. Child(mary, bob), has. Child(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 :

TBOX : : MODELING IN DL : : PROOFS : : TBOX REASONING : : ABOX REASONING ABox: Instance checking (I) Given the TBox and ABox below T: q Female⊑Human Mother⊑Female Father⊑Male Child≡∃has. Mother⊓ ∃has. Father Male⊓Female⊑⊥ Prove: 1. Human(Anna) 2. ¬Female(Bob) 3. Child(Cate) 26 A: q q Mother(Anna) Father(Bob) has(Cate, Anna) has(Cate, Bob)

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

TBOX : : MODELING IN DL : : PROOFS : : TBOX REASONING : : ABOX REASONING ABox: Instance checking (II) Expand A w. r. t. T: q A: q q q 27 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 :

TBOX : : MODELING IN DL : : PROOFS : : TBOX REASONING : : ABOX REASONING ABox: Instance checking (III) 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. 28