General Remarks - cs.man.ac.uk

30
Applications of Description Logics: Intelligent Conceptual Modeling [2,supervised Lab] Uli Sattler University of Manchester 1 General Remarks In this session, I assume that you have understood syntax and semantic of the basic description logic (DL) ALC and show you a nice application of DLs: to support conceptual modeling, e.g., of databases. To this purpose, I will re-fresh your memory of entity-relationship diagrams (ER-diagrams): what they are and what they mean, explain an extension of ALC that is necessary for this application, namely an extension with inverse roles and number restrictions, and show how an ER-diagram can be translated into a DL knowledge base and what the benefit is University of Manchester 2 ER diagrams: a formalism to specify a Conceptual Schema A Conceptual Schema is a formal conceptualisation of the world specifies a set of constraints, which declare what should nec- essarily hold in a database Given a conceptual schema S,a database DB is called legal w.r.t. S iff DB satisfies all constraints in S Logical Schema Result Database Query Integrity Constraints Conceptual Schema Deduction University of Manchester 3 ER diagrams ER-diagrams formalisms for representing conceptual schemas, e.g., of databases are graphs where nodes stand for entities: unary predicates (drawn as rectangles) and relations: 2-ary predicates (drawn as trapezes) here, we restrict our attention to unary and binary relations: this makes our life easier, but is not necessary: the whole approach you will see in the following works for relations of unrestricted arity in the following, a database DB over relations E 1 ,...,E k ,R 1 ,...,R is given by a domain Δ DB , unary relations (sets) E DB i Δ DB , and binary relations R DB j Δ DB × Δ DB University of Manchester 4

Transcript of General Remarks - cs.man.ac.uk

Page 1: General Remarks - cs.man.ac.uk

Applications of Description Logics: Intelligent Conceptual Modeling

[2,supervised Lab]

Uli Sattler

University ofManchester

1

General Remarks

In this session,

• I assume that you have understood syntax and semantic of the basic description logic

(DL) ALC and

• show you a nice application of DLs: to support conceptual modeling, e.g., of databases.

To this purpose, I will

• re-fresh your memory of entity-relationship diagrams (ER-diagrams): what they are

and what they mean,

• explain an extension of ALC that is necessary for this application, namely an extension

with inverse roles and number restrictions, and

• show how an ER-diagram can be translated into a DL knowledge base and what the

benefit is

University ofManchester

2

ER diagrams: a formalism to specify a Conceptual Schema

A Conceptual Schema • is a formal conceptualisation of the world

• specifies a set of constraints, which declare what should nec-

essarily hold in a database

• Given a conceptual schema S, a

database DB is called legal w.r.t. S

iff

DB satisfies all constraints in S

LogicalSchema Result

Database

Query

Integrity Constraints

ConceptualSchema

Deduction

University ofManchester

3

ER diagrams

ER-diagrams • formalisms for representing conceptual schemas, e.g., of databases

• are graphs where nodes stand for

– entities: unary predicates (drawn as rectangles) and

– relations: ≥ 2-ary predicates (drawn as trapezes)

• here, we restrict our attention to unary and binary relations:

this makes our life easier, but is not necessary: the whole approach

you will see in the following works for relations of unrestricted arity

• in the following, a

database DB over relations E1, . . . , Ek, R1, . . . , R`

is given by

– a domain ∆DB,

– unary relations (sets) EDBi ⊆ ∆DB, and

– binary relations RDBj ⊆ ∆DB × ∆DB

University ofManchester

4

Page 2: General Remarks - cs.man.ac.uk

ER diagrams

• Clearly, databases are (a special case of) FOL interpretations

(see slide 23) and thus we know what DB |= φ means

• Next, we define a translation π from an ER-diagram S into FOL formulae such that

DB is legal w.r.t. S iff DB |= π(S)

and, for any database DB legal w.r.t. S, we have

(a1, . . . , an) ∈ RDB iff DB |= R(a1, . . . , an)

University ofManchester

5

ER diagrams, their Semantics, and their FOL Translation: Relations

If an ER-diagram S contains a constraint C of the form

E FR1 2

then this means that, in any database DB legal w.r.t. S, we have

RDB ⊆ EDB × FDB,

which is enforced by the following FOL formula π(C):

∀x1, x2 : R(x1, x2) ⇒ E(x1) ∧ F (x2)

i.e., if a database DB is legal w.r.t. C, then DB |= π(C).

University ofManchester

6

ER diagrams, their Semantics, and their FOL Translation: Attributes

If an ER-diagram S contains, for D a “concrete domain” such as String, Integer, etc.,

the following constraint C:

EA

D

then this means that, in any database DB legal w.r.t. S, we have

EDB ⊆ {e ∈ ∆DB | fA(e) ∈ D},

for a function fA, which is enforced by the following FOL formula π(C):

∀x : E(x) ⇒ (∃y. fA(x) = y ∧D(y))

where Strings, Integers, etc., are axiomatised, e.g.,

∀x.(L(x) ⇒ ¬(String(x) ∨ Integer(x))) ∧ (String(x) ⇒ ¬Integer(x))

Please note that A being an attribute means that each instance of E has exactly one

object related to it via A, which is why we translate it into a function fAUniversity ofManchester

7

ER diagrams, their Semantics, and their FOL Translation: Cardinality Restrictions

If an ER-diagram S contains the following constraint C:

E FR(p,q)

1 2

then this means that, in any database DB legal w.r.t. S, we have

EDB ⊆ {e ∈ ∆DB | p ≤ #{b | (e, b) ∈ RDB} ≤ q},

which is enforced by the following FOL formula π(C):

∀x1 : E(x1) ⇒(∃≥px2.R(x1, x2) ∧ ∃≤qx2.R(x1, x2)

)

where ∃≥p and ∃≤q are FOL counting quantifiers, i.e.,

∃≥px.ψ(x) ≡ ∃x1, . . . , xp.(∧

1≤i<j≤p

xi 6= xj ∧∧

1≤i≤p

ψ(xi))

∃≤qx.ψ(x) ≡ ∀x1, . . . , xq+1.(∧

1≤i≤q+1

ψ(xi) ⇒∨

1≤i<j≤q+1

xi = xj)

University ofManchester

8

Page 3: General Remarks - cs.man.ac.uk

ER diagrams, their Semantics, and their FOL Translation: Cardinality Restrictions

(Similar:) if an ER-diagram S contains the following constraint C:

E FR(p,q)

1 2

then this means that, in any database DB legal w.r.t. S, we have

FDB ⊆ {e ∈ ∆DB | p ≤ #{b | (b, e) ∈ RDB} ≤ q},

which is enforced by the following FOL formula π(C):

∀x1 : F (x1) ⇒(∃≥px2.R(x2, x1) ∧ ∃≤qx2.R(x2, x1)

)

Important: cardinality constraints (p, q) are allowed for p ∈ N and q ∈ N ∪ {n}If q = n, this translates to no upper bound

University ofManchester

9

ER diagrams — Cardinality Restrictions: an Example

Professor StudentSupervises(2,n) (1,1)

A valid Database is:

ProfessorprofessorId

Alexa

Bob

StudentstudentId

John

Mary

Nick

Paul

Laura

SupervisesprofessorId studentId

Alexa John

Bob Laura

Alexa Mary

Bob Nick

Alexa Paul

University ofManchester

10

ER diagrams — Cardinality Restrictions: an Example

Professor StudentSupervises(2,n) (1,1)

An invalid Database is:

ProfessorprofessorId

Alexa

Bob

StudentstudentId

John

Mary

Nick

Paul

Laura

SupervisesprofessorId studentId

Alexa John

Bob Laura

Alexa Mary

Bob Nick

Alexa Paul

Alexa Laura

University ofManchester

11

ER diagrams — Cardinality Restrictions: an Example

Professor StudentSupervises(2,n) (1,1)

The FOL translation of the whole ER-diagram is:

∀x, y.Supervises(x, y) ⇒ Professor(x) ∧ Student(y)

∀x.Professor(x) ⇒ ∃≥2y.Supervises(x, y)

∀y.Student(y) ⇒ ∃≥1x.Supervises(x, y) ∧∃≤1x.Supervises(x, y)

University ofManchester

12

Page 4: General Remarks - cs.man.ac.uk

ER diagrams: IS-A Relations

If an ER-diagram S contains the following constraint C:

E

E1 . . . En

then this means that, in any database DB legal w.r.t. S, we have

EDBi ⊆ EDB, for all i = 1, . . . , n.

which is enforced by the following FOL formula π(C):∧

1≤i≤n

∀x.Ei(x) ⇒ E(x)

University ofManchester

13

ER diagrams: Covering IS-A Relations

If an ER-diagram S contains, additionally, the following constraint C:

E

E1 . . . En

then this means that, in any database DB legal w.r.t. S, we have additionally

EDB ⊆⋃

1≤i≤n

EDBi

which is enforced by the following FOL formula π(C):

∀x.E(x) ⇒∨

1≤i≤n

Ei(x)

University ofManchester

14

ER diagrams: Disjoint IS-A Relations

If an ER-diagram S contains, additionally, the following constraint C:

E

E1 . . . En

×

then this means that, in any database DB legal w.r.t. S, we have additionally

EDBi ∩ EDB

j = ∅, for all 1 ≤ i < j ≤ n

which is enforced by the following FOL formula π(C):∧

1≤i<j≤n

∀x.Ei(x) ⇒ ¬Ej(x)

University ofManchester

15

ER diagrams: Summary

An ER-diagram S is translated into a finite set π(S) of FOL formulae comprising

• all translations π(C) of

• all constraints C in S.

Then we can show that, for each database DB, we have

DB is legal w.r.t. S iff DB |= π(S)

(for the definition of DB |= π(S), see slide 26)

University ofManchester

16

Page 5: General Remarks - cs.man.ac.uk

ER diagrams – another Example

Employee

ProjectManager

TopManagerAreaManager

×

Works-for

Manages

(1,n)

(1,3)(1,1)

∀x, y.Works-for(x, y) ⇒ Employee(x) ∧ Project(y)

∀x, y.Manages(x, y) ⇒ Top-Manager(x) ∧ Project(y)

∀y.Project(y) ⇒ ∃x.Works-for(x, y)

∀y.Project(y) ⇒ ∃≤1x.Manages(x, y) ∧ ∃≥1x.Manages(x, y)

∀x.Top-Manager(x) ⇒ ∃≥1y.Manages(x, y) ∧ ∃≤3y.Manages(x, y)

University ofManchester

17

ER diagrams – another Example (ctd.)

Employee

ProjectManager

TopManagerAreaManager

×

Works-for

Manages

(1,n)

(1,3)(1,1)

∀x.Manager(x) ⇒ Employee(x)

∀x.Manager(x) ⇒ Area-Manager(x) ∨ Top-Manager(x)

∀x.Area-Manager(x) ⇒ Manager(x)

∀x.Top-Manager(x) ⇒ Manager(x)

∀x.Area-Manager(x) ⇒ ¬Top-Manager(x)

University ofManchester

18

ER-diagrams – another Example with Additional (Integrity) Constraints

Employee

ProjectManager

TopManagerAreaManager

×

Works-for

Manages

(1,n)

(1,3)(1,1)

(1,n)

• Managers do not work for a project (she/he just manages it):

∀x.Manager(x) ⇒ ∀y.¬Works-For(x, y)

• If, additionally, the minimum cardinality for the participation of employees to the Works-For

relationship is increased, then, TopManager becomes unsatisfiable

• If an IS-A link is added stating that every AreaManager is a TopManager, then

– AreaManager becomes unsatisfiable and

– every Manager is a TopManager

University ofManchester

19

ER-diagrams: Reasoning Problems and Inference Services

As we have just seen,

• each ER-diagram S can be translated into a finite set of FOL formulae π(S) and

• additional integrity constraints can be expressed,

• which might lead to the inconsisteny of a conceptual model...

Inferences: a finite set Γ of FOL formulae obtained by the translation of an ER-

diagram S plus possibly some FOL formulae I as additional integrity

constraints is called a FOL conceptual model.

For Γ a FOL conceptual model, and X, Y entities or relationships, we

say that

•X is inconsistent in Γ if DB |= Γ implies XDB = ∅iff Γ ∪ {∃~x.X(~x)} is not satisfiable

•X is subsumed by Y in Γ if DB |= Γ implies XDB ⊆ Y DB

iff Γ |= ∀~x.(X(~x) ⇒ Y (~x))

University ofManchester

20

Page 6: General Remarks - cs.man.ac.uk

ER-diagrams: Reasoning Problems and Inference Services

Clearly, to verify your conceptual model, it would be nice to automatically

• test each entity and relationship for (in)consistency and

• test each pair of entities and each pair of relationships for subsumption and

• notify the user about each

– inconsistency and

– subsumption that is not explicit in the ER-diagram,

where a subsumption relation between X and Y is explicit if there is a path of

IS-A links between X and Y in the ER-diagram

• unfortunately, as we have seen before, we have no decision procedure for these inferences:

they translate to (un)satisfiability and consequence, which are both undecidable for FOL.

What to do?

• see whether we really need full FOL for ER-diagrams and additional integrity constraints

University ofManchester

21

ER diagrams and their Description Logic Translation

As we will see next, we can translate ER-diagrams into Description Logic TBoxes

However, the DL ALC is not expressive enough for this: in ER-diagrams, we

• constrain the domain and range of relations – in ALC, we can only constrain the

range, e.g., using > v̇ ∀R.F .

Hence we extend ALC with the possibility to “turn around” R to R− and also allow,

e.g., > v̇ ∀R−.E,

i.e., we allow for inverse roles in the place of role names

• use cardinality constraints (p, q) on relations – in ALC, we cannot count.

Hence we extend ALC with number restrictions, i.e., concepts of the form (≤ nR)

and (≥ nR) for n ∈ N and R a possibly inverse role

We can show that the subsumption and the satisfiability problem for the extension of

ALC with inverse roles and number restrictions, ALCIN , are still decidable.

University ofManchester

22

ER diagrams and their Description Logic Translation: Relations

If an ER-diagram S contains a constraint C of the form

E FR1 2

then this means that, in any database DB legal w.r.t. S, we have

RDB ⊆ EDB × FDB,

which can be enforced by the following DL axiom π′(C):

> v̇ ∀R.F u ∀R−.E

where R− is the inverse of R and all interpretations must satisfy

(R−)I = {(d, e) | (e, d) ∈ RI}

University ofManchester

23

ER diagrams and their Description Logic Translation: Relations

If an ER-diagram S contains a constraint C of the form

E FR1 2

...how can we understand

> v̇ ∀R.F u ∀R−.E?

First, lets see what it means for an interpretation DB to satisfy the above axiom:

∆DB ⊆ {e | ∀f.(e, f) ∈ RDB ⇒ f ∈ FDB}∩

{e | ∀f. (e, f) ∈ (R−)DB︸ ︷︷ ︸

(f,e)∈RDB

⇒ f ∈ EDB}

which is the same as to say

∀e, f ∈ ∆DB : (e, f) ∈ RDB ⇒ (e ∈ EDB ∧ f ∈ FDB)

University ofManchester

24

Page 7: General Remarks - cs.man.ac.uk

ER diagrams and their DL Translation: Attributes

If an ER-diagram S contains, for D a “concrete domain” such as String, Integer, etc.,

the following constraint C:

EA

D

then this means that, in any database DB legal w.r.t. S, we have

EDB ⊆ {e ∈ ∆DB | fA(e) ∈ D},

which can be enforced by the following DL axiom π′(C):

E v̇ ∃A.D u (≤ 1A)

where (≤ 1A) is a number restriction and all interpretations I must satisfy

(≤ 1A)I = {d ∈ ∆I | #{e | (d, e) ∈ AI} ≤ 1}

Moreover, Strings, Integers, etc., are axiomatised, e.g.,

E v̇ L, L v̇ ¬(String t Integer), String v̇ ¬Integer

University ofManchester

25

ER diagrams and their DL Translation: Cardinality Restrictions

If an ER-diagram S contains the following constraint C:

E FR(p,q)

then this means that, in any database DB legal w.r.t. S, we have

EDB ⊆ {e ∈ ∆DB | p ≤ #{b | (e, b) ∈ RDB} ≤ q},

which can be enforced by the following DL axiom π′(C):

E v̇ (≥ pR) u (≤ q R)

where (≥ pR), (≤ q R) are number restrictions, with the following semantics:

(≥ pR)I = {d ∈ ∆I | #{e | (d, e) ∈ RI} ≥ p}(≤ q R)I = {d ∈ ∆I | #{e | (d, e) ∈ RI} ≤ q}

University ofManchester

26

ER diagrams and their DL Translation: Cardinality Restrictions

(Similar:) if an ER-diagram S contains the following constraint C:

E FR(p,q)

then this means that, in any database DB legal w.r.t. S, we have

FDB ⊆ {e ∈ ∆DB | p ≤ #{b | (b, e) ∈ RDB} ≤ q} =

{e ∈ ∆DB | p ≤ #{b | (e, b) ∈ (R−)DB} ≤ q},

which can be enforced by the following DL axiom π′(C):

F v̇ (≥ pR−) u (≤ q R−)

University ofManchester

27

ER diagrams — Cardinality Restrictions: an Example

Professor StudentSupervises(2,n) (1,1)

The DL translation of the whole ER-diagram is:

> v̇ ∀Supervises.Student u ∀Supervises−.Professor

Professor v̇ (≥ 2 Supervises)

Student v̇ (≥ 1 Supervises−) u (≤ 1 Supervises−)

University ofManchester

28

Page 8: General Remarks - cs.man.ac.uk

ER diagrams: IS-A Relations

If an ER-diagram S contains the following constraint C:

E

E1 . . . En

then this means that, in any database DB legal w.r.t. S, we have

EDBi ⊆ EDB, for all i = 1, . . . , n.

which is enforced by the following set of DL axioms π′(C):⋃

1≤i≤n

{Ei v̇ E}

University ofManchester

29

ER diagrams: Covering IS-A Relations

If an ER-diagram S contains, additionally, the following constraint C:

E

E1 . . . En

then this means that, in any database DB legal w.r.t. S, we have additionally

EDB ⊆⋃

1≤i≤n

EDBi

which is enforced by the following DL axiom π′(C):

E v̇ E1 t . . . t En

University ofManchester

30

ER diagrams: Disjoint IS-A Relations

If an ER-diagram S contains, additionally, the following constraint C:

E

E1 . . . En

×

then this means that, in any database DB legal w.r.t. S, we have additionally

EDBi ∩ EDB

j = ∅, for all 1 ≤ i < j ≤ n

which is enforced by the following set of DL axioms π′(C):⋃

1≤i<j≤n

{Ei v̇ ¬Ej}

University ofManchester

31

ER diagrams and DL: Summary

An ER-diagram S is translated into a finite set π′(S) of ALCIN axioms comprising

• all translations π′(C) of

• all constraints C in S.

Then we can show that, for each database DB, we have

DB is legal w.r.t. S iff DB |= π′(S)

University ofManchester

32

Page 9: General Remarks - cs.man.ac.uk

ER diagrams and DLs – another Example

Employee

ProjectManager

TopManagerAreaManager

×

Works-for

Manages

(1,n)

(1,3)(1,1)

> v̇ ∀Works-for.Project u ∀Works-for−.Employee

> v̇ ∀Manages.Project u ∀Manages−.Top-Manager

Project v̇ (≥ 1 Works-for−)

Project v̇ (≤ 1 Manages−) u (≥ 1 Manages−)

Top-Manager v̇ (≥ 1 Manages) u (≤ 3 Manages)

University ofManchester

33

ER diagrams – another Example (ctd.)

Employee

ProjectManager

TopManagerAreaManager

×

Works-for

Manages

(1,n)

(1,3)(1,1)

Manager v̇ Employee

Manager v̇ Area-Manager t Top-Manager

Area-Manager v̇ Manager

Top-Manager v̇ Manager

Area-Manager v̇ ¬Top-Manager

University ofManchester

34

ER-diagrams – another Example with Additional (Integrity) Constraints

Employee

ProjectManager

TopManagerAreaManager

×

Works-for

Manages

(1,n)

(1,3)(1,1)

(1,n)

• I we also want to express that managers do not work for a project (she/he just manages

it), we can add the following to π′(S):

Manager v̇ ∀Works-For.⊥

• If, additionally, the minimum cardinality for the participation of employees to the Works-For

relationship is increased, then, TopManager becomes unsatisfiable

• If an IS-A link is added stating that every AreaManager is a TopManager, then

– AreaManager becomes unsatisfiable and

– every Manager is a TopManager

University ofManchester

35

ER-diagrams: Reasoning Problems and Inference Services

As we have just seen,

• each ER-diagram S can be translated into a finite set of DL axioms π′(S) and

• additional integrity constraints can be expressed,

• which might lead to the inconsisteny of a conceptual model...

Inferences: a TBox T obtained by the translation of an ER-diagram S plus possibly

some DL axioms as additional integrity constraints is called a DL con-

ceptual model.

For T a DL conceptual model, and X, Y entities or relationships, we

say that

•X is inconsistent in T if DB |= T implies XDB = ∅iff X is not satisfiable w.r.t. T

•X is subsumed by Y in T if DB |= T implies XDB ⊆ Y DB

iff X is subsumed by Y w.r.t. T in the DL senseUniversity ofManchester

36

Page 10: General Remarks - cs.man.ac.uk

ER-diagrams: Reasoning Problems and Inference Services

Clearly, to verify your conceptual model, it would be nice to automatically

• test each entity and relationship for (in)consistency and

• test each pair of entities and each pair of relationships for subsumption and

• notify the user about each

– inconsistency and

– subsumption that is not explicit in the ER-diagram,

where a subsumption relation between X and Y is explicit if there is a path of

IS-A links between X and Y in the ER-diagram

• fortunately, there exists a decision procedure for these inferences: they translate to DL

(un)satisfiability and subsumption, which are both decidable for the DL ALCIN

• see the coursework with icom, which is a tool that implements this idea

University ofManchester

37

Summary

In this section, we have seen

• that and how ER-diagrams can be translated into FOL and

• how additional integrity constraints can be expressed,

• which might yield inconsistencies or implicit IS-A relationships.

Hence reasoning algorithms would be desirable, and thus we have

• discussed the translation of ER-diagrams and integrity constraints into the DL ALCIN ,

• for which satisfiability and subsumption are known to be decidable.

• You are going to experience the whole approach in the coursework.

University ofManchester

38

Non-Standard Reasoning Services

in Description Logics [2, supervised Lab]

Uli Sattler

University ofManchester

39

General Remarks

In this session, we will discuss

• a selection of reasoning problems that cannot be translated into standard logical

reasoning problems such as satisfiability, validity, or consequence,

• but are still logical problems,

• and have nice applications in knowledge representation

University ofManchester

40

Page 11: General Remarks - cs.man.ac.uk

Motivation: in general: Top-Down Construction of TBoxes

Concept1

Concept2 Concept3

Concept4 Concept5

First:Design TBox

Next:"Fill" ABox, i.e.,

describe objectsuse TBox to

Problem: • to design a TBox, a user has to define concepts

• user has to know KR formalism/DL and the application field

University ofManchester

41

Motivation: helpful: Bottom-Up Construction of TBoxes

Concept4

"Fill" ABox, i.e.,

describe objectsuse TBox to

Second:

ask DL−systemto compute a concept that coversall communalitiesof red objects and extend TBox

Third:Choose "red" objects and

Concept1

Concept2 Concept3

Concept5

First:

Concept5

Have/design part of TBox

Observation: often, describing ob-

jects as prototypical instances of a

concept is easier than defining this

concept

Problem: how to compute Con-

cept5 for the “red” objects?

University ofManchester

42

Motivation: Example

Assume you have built the following TBox:

NoSon v̇ ∀child.Female,

NoDaughter v̇ ∀child.¬Female,

SonRichDoctor v̇ ∀child.(¬Female ⇒ (Doctor u Rich)),

DaughterHappyDoctor v̇ ∀child.(Female ⇒ (Doctor u Happy))

ChildrenDoctor v̇ ∀child.Doctor

and find the following ABox

(a1, c1) : child, c1 : NoSon u DaughterHappyDoctor

(a2, c2) : child, c2 : NoDaughter, c2 : SonRichDoctor

A concept “covering” a1 and a2 would be ∃child.ChildrenDoctor.

How can we compute such a concept?

University ofManchester

43

Motivation

Suppose you use a DL-based KR system and have, so far, built

• a TBox T with the relevant concepts of your application domain, and

• an ABox A containing some objects with descriptions and relationships

Now you realize that the objects o1, . . . , ok should all be instances of a certain

concept C that is not yet defined in T ...

Since formulating the definition of the concept C might be tricky,

you want some help,

i.e., a system service that automatically generates, from A and T , a concept X

• such that each oi is an instance of it in each model of T and A,

i.e., (T ,A) |= oi : X and

•X is as specific as possible (otherwise, X = > would be an easy answer):

whenever (T ,A) |= oi : Y , for all 1 ≤ i ≤ k, then (T ,A) |= X v Y

University ofManchester

44

Page 12: General Remarks - cs.man.ac.uk

Motivation: an Example

Example: • let T be empty (you just start to build it) and

• A = { o1 : ∃child.> u ∀child.(Male u Doctor)

o2 : ∃child.(Male u Student) u ∀child.(Doctor u Female)}

• what would be a “good” proposal for X covering o1 and o2?

Observation: • in ALC, we simply take the disjunction, i.e.,

X =(∃child.> u . . .

)t

(∃child.(Male u Student) u . . .

),

then clearly

– (T ,A) |= o1 : X and (T ,A) |= o2 : X, and

–X is the most specific such concept

• but this is not what we wanted: a concept describing the

“commonalities” of o1 and o2!

University ofManchester

45

Motivation: an Example

Example: • let T be empty (you just start to build it) and

• A = { o1 : ∃child.> u ∀child.(Male u Doctor)

o2 : ∃child.(Male u Student) u ∀child.(Doctor u Female)}

• what would be a “good” proposal for X covering o1 and o2?

Observation: • we want: a concept describing the “commonalities” of o1 and o2!

• better and without disjunction:

X = ∃child.(Male u Doctor) u ∀child.Doctor

• how do we get this?

• What if A contains role assertions, i.e., some of oi’s properties are not

covered by concept assertions?

University ofManchester

46

LCS and MSC for Bottom-Up Construction of TBoxes

Usage of the computation of the

least common subsumer and

the most specific concept to

compute a concept C describing

the commonalities of the objects

o1, . . . , ok

C1

o1 o2 ok...

C

Second: compute

subsumer of these concepts

the least common

First: compute most specificconcept for eachobject

CkC2

University ofManchester

47

Important Side Remarks

In the following, we • use T for a TBox and

• A for an ABox

Since we are concerned with the computation of concepts, we have to fix a description

logic: besides ALC, there are several other DLs, e.g., the extension of ALC with inverse

roles ALCI.

Moreover, also restrictions of ALC are considered in the literature:

EL is the restriction of ALC in which

• concepts can only be built using u, ∃r.C, and >.

Example: •A u ∃r.(B u C) is an EL-concept, but

• neither ∀r.B nor ¬B nor A tB are EL-concepts

University ofManchester

48

Page 13: General Remarks - cs.man.ac.uk

MSC — Most Specific Concept

In the following, L will stand for a description logic, e.g., ALC, EL, etc.

MSC: An L-concept X is a most specific L-concept of o w.r.t. T and A,

written X ∈ mscL(o,T ,A), if

1. (T ,A) |= o : X and

2. for all L-concepts Y , (T ,A) |= o : Y implies (T ,A) |= X v Y

Examples: • for T = {A.= B u ∃r.C} and

A = {b : B, c : C, (b, c) : r},

we have A ∈ mscEL(b, T ,A)

• for T = { A.= B u ∃r.C

C.= D u ∃s.(E u F )} and

A = { b : B, c : D, (b, c) : r, (c, e) : s, e : (E u F )},

we have B u ∃r.C ∈ mscEL(b,T ,A)

University ofManchester

49

MSC — Most Specific Concept

Observe: • mscL(o,T ,A) may contain more than one concept, e.g.,

B u ∃r.C ∈ mscEL(b,T ,A)

However, by definition, X1, X2 ∈ mscL(o,T ,A) implies

(T ,A) |= X1 v X2 and (T ,A) |= X2 v X1

• mscL(o,T ,A) may contain no element, e.g.,

mscEL(a, ∅, {(a, a) : r, a : A}) = ∅ because

(∅, {(a, a) : r, a : A}) |= a : X for each

X ∈ {A,A u ∃r.A,A u ∃r.(A u ∃r.A),

A u ∃r.(A u ∃r.(A u ∃r.A)),

. . .}all these concepts are increasingly specific, and there is no most specific

one in EL

University ofManchester

50

MSC — Most Specific Concept: how can it be computed?

Clearly, an algorithm for the computation of mscL(o,T ,A) depends on L.

As an example, we present an algorithm for the following framework:

1. L = EL, i.e, we only have >, conjunctions, and existential restrictions,

2. TBoxes are sets of concepts definitions

(i.e., no complex concepts on left hand side)

without definitorial cycles: a set of definitions referring cyclically to each other,

i.e., of the form

A0.= . . . A1 . . .

A1.= . . . A2 . . .

. . . . . .

An.= . . . A0 . . .

3. ABoxes whose relational structure (as induced by role assertions) forms acyclic graph

University ofManchester

51

MSC — Most Specific Concept: how can it be computed?

The mscEL(o,T ,A) is then constructed as follows:

1. construct the graph corresponding to A:

– use 1 node per object oi, labelled with L(oi) = {C | oi : C ∈ A} and

– put an r-labelled edge from oi to oj if (oi, oj) : r ∈ A

2. un-fold T and break-down concepts:

– whenever a concept symbol A ∈ L(oi) and A.= C or A v̇ C is in T , then add

C to L(oi)

– whenever a concept C1 u C2 ∈ L(oi), add C1 and C2 to L(oi)

– whenever ∃r.C ∈ L(oi) and oi doesn’t have an r-successor oj with C ∈ L(oj),

generate such an r-successor with label {C}

apply these rules exhaustively—this terminates since T is acyclic

3. read the concept off...

University ofManchester

52

Page 14: General Remarks - cs.man.ac.uk

MSC — Most Specific Concept: how can it be computed?

3. read the concept off:

– for each path p = or1−→ o1

r2−→ o2 . . .r`−→ o` from o to a leaf o`,

construct the concept

Xp = ∃r1.(L̂(o1) u ∃r2.(L̂(o2) u . . . ∃r`.L̂(o`)) . . .)

where L̂(oi) = uC∈L(oi)

C (where the empty conjunction is >)

– if p1, . . . , pr are all paths in the graph starting at o, return the concept

X = L̂(o) uXp1 u . . . Xpr

• let’s see an example on the blackboard for

T = {B v̇ ∃t.D, F v̇ A uB}A = {a : A uB, b : ∃s.A u F, c : D u E,

(a, b) : r, (a, c) : t, (c, d) : u, (b, d) : s}

University ofManchester

53

LCS — Least Common Subsumer

Remember: we planned to use both

msc and lcs for the bottom-up con-

struction of knowledge bases!

So far, we have discussed the msc,

let’s have a look at the lcs

C1

o1 o2 ok...

C

Second: compute

subsumer of these concepts

the least common

First: compute most specificconcept for eachobject

CkC2

University ofManchester

54

LCS for the Bottom-Up Construction of TBoxes

Similar to the msc, the lcs (of a set of concepts) is a “common subsumer” and the smallest

such subsumer. Hence its definition consists, again, of 2 conditions:

LCS: let C1, . . . , Ck be concepts.

An L-concept X is a least common L-subsumer of C1, . . . , Ck w.r.t.

T , written X ∈ lcsL(C1 . . . , Ck,T ), if

1. T |= Ci v X, for all 1 ≤ i ≤ k and

2. for all L-concepts Y , if T |= Ci v Y for all 1 ≤ i ≤ k, then

T |= X v Y

Example: for C1 = ∃child.> u ∀child.(Male u Doctor)

C2 = ∃child.(Male u Student) u ∀child.(Doctor u Female)}

C1 t C2,

∃child.(Male u Doctor) u ∀child.Doctor ∈ lcsALC(C1, C2, ∅)

University ofManchester

55

LCS for the Bottom-Up Construction of TBoxes

Observations: • again, the lcs makes only sense in the absence of disjunction since

C1 t . . . t Ck ∈ lcsL(C1 . . . , Ck,T ) if L provides t

• again, lcsL(C1 . . . , Ck,T ) may contain several concepts, but all are

equivalent

• in contrast to the msc, for lcsL(C1 . . . , Ck,T ) to be empty is less

likely: for all DLs L considered here, it is never empty!

How to compute the lcs? Again, we restrict our attention to

• the DL EL for the lcs concept to be computed and

• TBoxes that

– contain only concept definitions and

– that do not contain definitorial cycles

• but we allow the TBox to involve concepts of the form >, C1 u C2, ∃R.C, and

∀R.C (for the msc, we did not allow for ∀R.C)

University ofManchester

56

Page 15: General Remarks - cs.man.ac.uk

Algorithm for the construction of EL-LCS

The lcsEL(C1, C2,T ) is then constructed as follows:

1. for each i ∈ {1, 2}, construct the tree corresponding to Ci:

– start with root node oi0 labelled L(oi0) = {Ci}

– whenever a concept symbol A ∈ L(oj) and A.= C or A v̇ C is in T ,

then add C to L(oj)

– whenever a concept D1 uD2 ∈ L(oj), add D1 and D2 to L(oj)

– whenever ∃r.C ∈ L(oj) and oj doesn’t have an r-successor o` with C ∈ L(o`),

generate an r-successor o` with L(o`) = {C}

– whenever ∀r.C ∈ L(oj) and oj has an r-successor o` with C 6∈ L(o`),

then add C to L(o`)

– this terminates since T is acyclic

2. read the concept off:...

University ofManchester

57

Algorithm for the construction of EL-LCS

2. read the concept off is defined recursively: for o, u nodes in trees, we define

co(o, u) = uA atomic concept in

L(o)∩L(u)

A u uroles r,

r-successors o′ of o,

r-successors u′ of u

∃r.co(o′, u′)

(where the “empty” conjunction is >)

Return co(o10, o

20)

• for lcsEL(C1, . . . , Ck,T ), compute

lcsEL(C1, . . . , lcsEL(Ck−2, lcsEL(Ck−1, Ck,T ),T ) . . .T )

• the “read the concept off” construction is a product on trees!

• let’s see an example on the blackboard for

C1 = A uB u ∃s.C u ∀s.(D u E u ∃t.(F uG))

C2 = A u ∃s.D u ∀s.C u ∃s.(E u ∃t.F )

C3 = B u ∃s.(C u ∃t.F ) u ∃s.D

University ofManchester

58

Algorithm for the construction of EL-LCS

What does this algorithm do? What are its properties?

• When started withC1, C2, and T (all conforming to the restrictions mentioned before),

• it always terminates

– because maximal length of concepts in node labels decreases strictly

– because T contains no definitorial cycles

• it computes some X ∈ lcsEL(C1, C2,T )

• whose size can be exponential in the size of C1 and C2

University ofManchester

59

Other Non-Standard Inferences: Rewriting

Rewriting: of a concept C w.r.t. a TBox T :

• given C and T , compute some D such that

– T |= C v D and T |= D v C

(C and D are equivalent w.r.t. T ) and

–D is a concept of minimal length with this property

For example, E u ∃r.(F uB) is a minimal rewriting of

∃r.(B u (∃t.∃s.B)) u ∃s.∃t.A

w.r.t. the TBox { E.= ∃s.∃t.A

F.= ∃t.∃s.B

}

Extremely useful, e.g., since the lcs algorithm can compute quite large concepts!

Such an answer concept has to be analysed by the user to see whether it suits her

intuition...so rewriting it to equivalent shorter ones helps this analysis!

University ofManchester

60

Page 16: General Remarks - cs.man.ac.uk

Other Non-Standard Inferences: Approximation

Approximation: of a concept C in a DL L into a DL L′ w.r.t. aTBox Twhere L′ is less expressive than L:

• given T an L-concept C, compute an L′-concept D such

that

– T |= C v D and

–D is a most specific L′-concept with this property

For example, the ALC-concept

∃r.(A uB)

is an approximation of the ALCN -concept

∃r.A u ∃r.B u (≤ 1 r)

Which information is lost in the approximation?

Approximations are useful for users that are no DL experts and only understand “fragments”

of the DL used in a certain application, i.e., they provide a simplified view of the TBox.

University ofManchester

61

Non-Standard Inferences: Summary and Outlook

• We have seen several useful inference services that cannot be reduced to classical logical

ones such as satisfiability or validity:

– most specific concept msc (in depth)

– least common subsumer lcs (in depth)

– rewriting of concepts (sketchy)

– approximation of concepts (sketchy)

• other such inference services have already been investigated

– matching of concepts

– unification of concepts

• more such inferences will be needed in the future

– describe the difference between two concepts

– tell me all about an object (is this msc?)

– what is the “closest” concept defined in T to C?

University ofManchester

62

Temporal Logic [3, supervised Labs]

Uli Sattler

University ofManchester

63

General Remarks

In this section of the lecture, we will

• discuss different possibilities to represent temporal knowledge,

i.e., knowledge somehow related to time,

• start from a rather simple, well-known formalism, propositional linear temporal logic

LTL, and then

• extend it to structured domains,

i.e., replace the “propositional” with “description logical”

University ofManchester

64

Page 17: General Remarks - cs.man.ac.uk

What is Temporal Knowledge? Different Views of Time

• temporal statements can be quantitative or qualitative

I have breakfast before I brush my

teeth

I have breakfast at 8am and brush

my teeth at 8:45am

• temporal statements can be point-based versus interval-based

I have breakfast nowI read the paper while having

breakfast

• time can be discrete versus continuous

I have breakfast, and next I brush

my teeth

no “next”: between any 2 time-

points, there is a third one

• time can be linear versus branching

any 2 time-points are one be-

fore/after the other1 time-point can have several fu-

tures

University ofManchester

65

Situations, Events, States, Actions, Snapshots

Temporal knowledge comes with various concepts, which are difficult to define:

• a Situation is a certain time-slice or -point

• an Event might take place in a certain situation

• a State might be true in a certain situation

• an Action, when carried out, might change states in the following situations

• a Snapshot is a (rough) representation of the states that are true in a certain situationUniversity ofManchester

66

First Order Logic for Temporal Statements

We can use FOL formulae to express temporal knowledge, e.g., as follows:

1. one approach (going back to Allen, 1984) distinguishes

– states, e.g., Asleep(Mary) and

– events, e.g., WalkTo(John, Station)

both are denoted by terms, and their temporal incidence is expressed using predicates

Holds (for states) and Occurs (for events), e.g.

Holds(Asleep(Mary), (1pm, 6pm)),

Occurs(WalkTo(John, Station), (1pm, 1.15pm))

where terms of the form (t, t′) denote time intervals in the obvious way.

The homogeneity of states and inhomogeneity of events is secured by axioms such

as

∀s, i, i′.(Holds(s, i) ∧ In(i′, i)) ⇒ Holds(s, i′),

∀e, i, i′.(Occurs(e, i) ∧ In(i′, i)) ⇒ ¬Occurs(e, i′)

University ofManchester

67

First Order Logic for Temporal Statements

clearly, we have to axiomatise In(i, i′), Before(i, i′), After(i, i′), etc. E.g.,

– use predicate P< and add the axiomatisation of a total order φP<tot:

∀x, y, z. ¬P<(x, x) ∧ (P<(y, x) ∨ P<(x, y) ∨ x = y)∧((P<(x, y) ∧ P<(y, z)) ⇒ P<(x, z)

– use functions `(i), r(i) for left and right border of intervals and ∀i.T I(i) ⇒P<(`(i), r(i))

– add, e.g., for In(i′, i)

∀i, i′.In(i′, i) ⇔ (TI(i) ∧ TI(i′) ∧ P<(`(i), `(i′)) ∧ P<(r(i′), r(i))

– add, e.g., for Before(i, i′)

∀i, i′.Before(i, i′) ⇔ (TI(i) ∧ TI(i′) ∧ P<(r(i), `(i′)))

...make sure you don’t forget any axioms!

University ofManchester

68

Page 18: General Remarks - cs.man.ac.uk

First Order Logic for Temporal Statements

2. in another approach, event-token reification (Davidson, 1967), each

– event-forming predicate (e.g., See(John,Mary)) is extended with

– an extra argument-place for a variable ranging over time-points,

e.g., See(John,Mary, s)

This allows to draw conclusion such as

∃e(See(John,Mary, e) ∧ P lace(e, London) ∧ T ime(e, Tuesday))implies ∃e(See(John,Mary, e) ∧ T ime(e, Tuesday)).

Again, we have to axiomatise a predicate P< to compare time-points

University ofManchester

69

First Order Logic for Temporal Statements

3. the situation calculus (McCarthy, Reiter) is a FOL approach to reason about actions,

their consequences, and ultimately plan agent/robot behaviour. It involves

– actions a (as terms),

– situations s (as terms),

– a function do(a, s) mapping a and s to the situation resulting of carrying out

action a in situation s, and

– other predicates, e.g., On(book, table, s), poss(a, s)

Effects of actions are expressed as follows:

∀x, y, z, s.(On(x, y, s) ∧ Clear(x, s) ∧ Clear(z, s) ∧ x 6= z) ⇒On(x, z, do(move(x, y, z), s)

︸ ︷︷ ︸s′

)

Actions typically leave many aspects of a snapshot unchanged...describing, for each

action,

– what they change seems feasible

– what they don’t change seems tedious

University ofManchester

70

First Order Logic for Temporal Statements

This is known as frame problem (how to state what remains unchanged).

In the situation calculus, a variety of frame axioms express what remains unchanged,

e.g.,

∀x, y, z, v, u, s.(On(x, y, s) ∧ x 6= u) ⇒ On(x, y, do(move(u, v, z), s))

4. and many other approaches were developed for different applications

In all three approaches sketched above,

• situations/time-points/intervals are “logical objects” and

• a formalism without a notion of time is used for representing temporal knowledge,

which implies that

• extra axioms have to be added to axiomatise the desired temporal properties, e.g., of

P< and

• readability might become poor

University ofManchester

71

A Logic for Temporal Knowledge

Next, we discuss an example of a (modal) logical formalism designed for the representation

of and reasoning about temporal knowledge.

We will concentrate on

• qualitative

• point-based

• discrete

• linear time,

that is, a time flow that looks as follows:

Now Nextmoment

... ... ...... ... ...Past Future

However, there are similar formalisms for other temporal structures.

University ofManchester

72

Page 19: General Remarks - cs.man.ac.uk

LTL, a Logic for Temporal Knowledge: Syntax

LTL: is a modal logic, and its formulae are inductively defined as follows:

given a set P of propositional variables, the set of LTL formulae is the smallest

set such that

• each p ∈ P is a LTL formulae

• if φ and ψ are LTL formulae, then

φ ∧ ψ, φ ∨ ψ, ¬ψ, ◦ψ, and ψUφ

Intuitively, we read

• ◦ψ as “in the next time-point (moment,day, etc) ψ holds” and

• ψUφ as “ψ holds until φ holds”

Example: • bf ∧ ◦bt can be read as I have breakfast and next I brush my teeth

• bf ∧wkU lu can be read as I have breakfast and then work until lunch

University ofManchester

73

LTL, a Logic for Temporal Knowledge: Semantics

So far for the intuitive reading, let’s define the semantics!

As mentioned before, LTL is a modal logic, hence we can define its semantics

using Kripke structures:

LTL Semantics is given by a Kripke Structure M = (N, <, I) where

• N are the non-negative integers, representing time-points,

•< is the natural ordering on N, representing “before”, and

• I maps each propositional variable p ∈ P to the set of

time-points I(p) in which p holds.

The interpretation of formulae is (as usually) defined inductively:

M, w |= p iff w ∈ I(p)

M, w |= ψ ∧ φ iff M, w |= ψ and M, w |= φ

M, w |= ψ ∨ φ iff M, w |= ψ or M, w |= φ

so far, nothing new

University ofManchester

74

LTL, a Logic for Temporal Knowledge: Semantics

So far for the intuitive reading, let’s define the semantics!

As mentioned before, LTL is a modal logic, hence its semantics is based on

Kripke structures:

LTL Semantics is given by a Kripke Structure M = (N , <, I) where

...

(ctd.) The interpretation of formulae is (as usually) defined

inductively:

M, w |= ◦ψ iff M, (w + 1) |= ψ

M, w |= φUψ iff there is some v ≥ w such that

M, v′ |= φ for all v′ with w ≤ v′ < v and

M, v |= ψ

... ... ...

... ... ...... ... ...

Now, w Later, v

University ofManchester

75

LTL, a Logic for Temporal Knowledge: Abbreviations

Again, we have only specified a few logical constructors, but we can use more as abbrevia-

tions:

• ⇒, ⇔, ⊥, >, etc. are the standard propositional abbreviations

• we have “next” and “until”, but what about “eventually in the future”?

We can introduce it as abbreviation: in the following, we use ♦φ for “eventually in the

future φ”:

♦φ = >Uφ

Let’s see why this is ok on the blackboard!

• similarly, we don’t have “always in the future”?

Since “always in the future φ” is equivalent to “not eventually in the future ¬φ”, we

introduce �φ for “always in the future φ” as follows:

�φ = ¬♦¬φ = ¬(>U¬φ)

Let’s see why this is ok on the blackboard!

University ofManchester

76

Page 20: General Remarks - cs.man.ac.uk

LTL, a Logic for Temporal Knowledge: Example

Let’s model the behaviour of traffic lights i at one crossing:

• use propositional variables gi (ri, yi) for “the traffic light i shows green (red, yellow)”

• state the behaviour of each single traffic light:

�((gi ⇒ ¬(ri ∨ yi)) ∧ (ri ⇒ ¬(gi ∨ yi)) ∧ (yi ⇒ ¬(gi ∨ ri)))∧

�((gi ⇒ giU(yi ∧ yiUri)) ∧ (ri ⇒ riU(yi ∧ yiUgi)))

• Is our system (of n traffic lights) lively? I.e., does the above specification imply∧

1≤i≤n

�(ri ⇒ ♦gi)

• Is our system (of n traffic lights) safe? I.e., does the above specification imply∧

1≤i<j≤n

�(¬(gi ∧ gj))

University ofManchester

77

LTL, a Logic for Temporal Knowledge: Reasoning Problems I

As we have just seen, we can

• use LTL to specify (the behaviour of) a system, and then

• translate (un)desired properties of our specification into implications

• We know that we can reduce an implication ψ ⇒ φ (or consequence) to the unsatisfi-

ability of ψ ∧ ¬φ, thus

• is (un)satisfiability of LTL decidable? If yes, how complex is it?

– since LTL is an extension of propositional logic (PL),

satisfiability of LTL is at least as hard as satisfiability of PL, i.e., NP-hard

– it is decidable, and we can design an algorithm that runs in

∗ exponential time (is that much?) and

∗ polynomial space

– we can show that sat. of LTL is PSpace-complete,

i.e., in the next class above NP

University ofManchester

78

LTL, a Logic for Temporal Knowledge: Reasoning Problems II

Alternatively to

• specifying a system (and thus considering a variety of its implementations, i.e., a variety

of Kripke structures),

• we can fix a system, i.e., consider a single Kripke structure M, and ask whether

M satisfies a (desired or undesired) property ψ

• this translates into

given M with some “initial state” s and ψ, does M, s |= ψ?

• this problem is known as model checking

• it is a special case of satisfiability: simply use a specification that is so “strict” that it

only has a single model M

• is LTL model checking decidable? If yes, how complex is it?

– we can show that LTL model checking is also PSpace-complete,

i.e., as complex as satisfiability

University ofManchester

79

Logics for Temporal Knowledge: Extensions of LTL I

There are several shortcomings of LTL that motivated the investigation of extensions

1. in LTL, we can only talk about the future:

to talk about the past, we can extend LTL with converse modalities

• ◦ψ for “in the previous moment/day, ψ was true”

• φUψ for “φ did hold since ψ was true” (where U is to be read as “since”)

• as before, we can introduce an abbreviation

♦ψ = >Uψ for “somewhere in the past, ψ was true” and

�ψ = ¬♦¬ψ = ¬(>U¬ψ) for “always in the past, ψ was true”

in addition, we have to decide whether our temporal structure

• starts (e.g., with a big bang), i.e., is isomorphic to N, or

• has no “start”, i.e., is isomorphic to Z

University ofManchester

80

Page 21: General Remarks - cs.man.ac.uk

Logics for Temporal Knowledge: Extensions of LTL I

2. in LTL, time is linear. However, if we describe

• (the behaviour of) systems, we might want to consider

• several futures/successor

states, i.e., our temporal

structure looks like a tree:

... ... ...... ... ...

Now

... ... ...Past Future

Nextmoments

• reflecting non-determinism or interaction with the outside world

• for example, consider two processes with some mutual exclusion part and states

– non-critical ni,

– trying to go into the critical part ti, and

– being in the critical part ci, where we use semaphore variables siwe can only switch into ci of si is false.

Since, at each point in time, different actions are possible, modelling this example in

“branching” logic is useful

University ofManchester

81

Logics for Temporal Knowledge: Extensions II

Another shortcoming of LTL is due to the fact that it extends propositional logic:

each state/moment is a point in which certain propositional variables hold or not hold.

What if our world has a richer structure, i.e., if we want to talk about

• objects (Peter, Paul, and Mary),

• predicates (Happy, Human), and

• relations between object (likes, marriedTo, neighbourOf)?

Solutions:

1. if we only have few objects and relations, “press” it all in propositional setting, e.g.,

use propositional variables HappyPeter, PeterLikesMary, etc.

2. use temporal FOL – but FOL is already undecidable, hence any extension will be!

3. use an appropriate decidable fragment of FOL and temporalise it...

University ofManchester

82

Temporal Description Logics

We know extensions of propositional logic that are decidable fragments of FOL:

Description Logics

So let’s see how they can be temporalised:

General Idea: at each time point, consider a whole DL interpretation

Nextmoment

Now

... ... ...... ... ...

University ofManchester

83

Temporal Description Logics

Nextmoment

Now

... ... ...... ... ...

• next, temporalise concepts:

Stud u ♦Rich u �Happy u StudUGoodJob

describes students who are eventually rich, are always in the future happy, and

who will be students until they find a good job

an object does not only “live” in one interpretation,

but in many different interpretations at various time points

University ofManchester

84

Page 22: General Remarks - cs.man.ac.uk

Temporal Description Logics

Nextmoment

Now

... ... ...... ... ...

this objects is an instance of

Blue u ♦Brown u �(¬∃greenRel.Brown) u ♦(∃greenRel.Blue)

where the �(¬∃greenRel.Brown) is “difficult” because we only see part of time scale!

University ofManchester

85

Temporal Description Logics

• next, we stronger temporalise concepts:

– Humanu♦(∃marriedTo.(Boldu Human)) describes humans who will eventually be

married to a bold human, whereas

– Human u ∃marriedTo.(♦Bold u Human) describes humans who are married to a

human who will eventually be bold!

• next, extend TBoxes to allow for temporalised concepts and temporalise axioms:

– �(Living v̇ LivingU(Dies u �¬Living)) expresses that it will always be the

case that any living object will remain alive until it dies, and then remain dead

– ♦(Living v̇ Happy) expresses that there will eventually be a “world” where all

living objects are happy

• so far for the intuition, let’s see syntax and semantics of this logic!

University ofManchester

86

Temporal Description Logics: Syntax of LTLALC

LTLALC-concepts: for NK and NR sets of atomic concepts and roles, the set of

LTLALC-concepts is the smallest set such that

• every A ∈ NK is a LTLALC-concept and,

• if C and D are LTLALC-concepts and r is a role, then also

¬C, C uD, C tD, ∃r.C, ∀r.C, ◦C, CUD

are LTLALC-concepts.

So far, we have simply extended ALC with the temporal operators on concepts –

what about axioms?

For axioms, we will allow TBox and ABox axioms, their temporalisation, and Boolean

combinations thereof...

University ofManchester

87

Temporal Description Logics: Syntax of LTLALC

LTLALC-axioms: the set of LTLALC-axioms is the smallest set such that

• if C, D are LTLALC-concepts, a, b are object names, and

r is a role, then

a : C, (a, b) : r, C v̇ D, C.= D

are LTLALC-axioms and,

• if ψ, φ are LTLALC-axioms, then

¬φ, φ ∧ ψ, φ ∨ ψ, ◦ψ, φUψ

are also LTLALC-axioms

• again, we can use all the usual abbreviations ⇒,.... and ♦ψ, �ψ

• perhaps we should go back to the motivating examples and check whether they fit the

syntax definition?

• what about the semantics?

University ofManchester

88

Page 23: General Remarks - cs.man.ac.uk

Temporal Description Logics: Semantics of LTLALC

As shown in the pictures before, semantics is given by

• a sequence of ALC interpretations Ii or

• the two-dimensional combination of LTL and ALC interpretations

• To define this, we must first make some assumptions:

– can objects appear? can objects disappear?

here, objects can neither disappear nor appear,

i.e., all interpretations Ii share the same interpretation domain ∆I

LTLALC-semantics: is given by an infinite sequence M = Ii, i ≥ 0 of ALC-

interpretations Ii = (∆I, ·Ii) sharing the same domain ∆I .

As usual, each ·Ii associates

• a set AIi ⊆ ∆I with each atomic concept A and

• a binary relation rIi ⊆ ∆I × ∆I with each role name r

• an element aIi ∈ ∆I with each object name

University ofManchester

89

Temporal Description Logics: Semantics of LTLALC

LTLALC-concepts are interpreted as follows:

>Ii = ∆I, (¬C)Ii = ∆I \ CIi

(C uD)Ii = CIi ∩DIi, (C tD)Ii = CIi ∪DIi

(∃r.C)Ii = {d | there is e s.t. (d, e) ∈ rIi and e ∈ CIi}(∀r.C)Ii = {d | for all e, if (d, e) ∈ rIi, then e ∈ CIi}

nothing unusual so far – but that I carries an index i!

(◦C)Ii = CIi+1

(CUD)Ii = {d | there is j ≥ i s.t. d ∈ DIj and

for all ` with i ≤ ` < j : d ∈ CI`}

Before going to the semantics of axioms, let’s consider instances of concepts

Human u Happy u ◦BoldHuman u (¬Happy)U(∃marriedTo.Bold)Human u (¬Happy)U(∃marriedTo.♦Bold)Human u ∃marriedTo.(♦Bold)

University ofManchester

90

Temporal Description Logics: Semantics of LTLALC

LTLALC-axioms are interpreted as follows: for n ∈ N , we define

M, n |= ψ ∧ φ iff M, n |= ψ and M, n |= φ

M, n |= ψ ∨ φ iff M, n |= ψ or M, n |= φ

M, n |= ¬φ iff not M, n |= φ nothing unusual so far!

M, n |= a : C iff aIn ∈ CIn

M, n |= (a, b) : r iff (aIn, bIn) ∈ rIn

M, n |= C v̇ D iff CIn ⊆ DIn

M, n |= C=̇D iff CIn = DIn still nothing unusual!

M, n |= ◦ψ iff M, n+ 1 |= ψ

M, n |= φUψ iff there is some m ≥ n s.t. M,m |= ψ and

for all i with n ≤ i < m:M, i |= φ

only combinations of old, known stuff!

University ofManchester

91

Temporal Description Logics: Outlook

We have just defined the very powerful combination of LTL and ALC because

• we wanted to represent structured worlds at each time-point

(i.e., LTL did not suffice) and

• we know that satisfiability of FOL formulae is undecidable,

(i.e., its temporalisation is as well undecidable)

• so what about the satisfiability of LTLALC-axioms? Is it decidable?

– yes, it is decidable, but of a rather high complexity – far beyond that of ALC

University ofManchester

92

Page 24: General Remarks - cs.man.ac.uk

Temporal Description Logics: Outlook

We have just defined the very powerful combination of LTL and ALCthus allowing the temporal statements over structured domains.

Clearly, according to the application we are interested in, we can

• replace the underlying DL with something weaker (e.g., EL) or stronger (e.g., ALCIN )

• replace the underlying temporal logic LTL with another one, e.g., one for branching time

or one with temporal operators for the past

A nice application of this framework is to reason about temporal ER-diagrams:

• extend ER-diagrams with the notion of time, and

• translate it into the temporalisation of ALCIN

• just as we have done it for ER-diagrams with additional integrity constraints

University ofManchester

93

Defaults [3, supervised Labs]

Uli Sattler

University ofManchester

94

Motivation

In the first section, we have seen different readings of is-a relations:

• if A and B are concepts/classes, does is-a translate to

– each instance of A is also an instance of B? E.g., each square is a rectangle

– by default/normally As are Bs? E.g. normally birds are flying animals?

–As inherit all properties of B—if not stated otherwise? E.g., white elephants are

elephants, but they are not grey, but white

– ...?

So far, all formalisms presented employ the first reading – what about the second one?

• suppose you are describing animal families:

– birds fly – but for penguins, those with broken wings, those in an oil disaster, etc

– dogs have a tail – but those whose tail is docked

– mammals have their heart on the right side – but those that have it on the left

– etc.

University ofManchester

95

Motivation

• We can introduce concepts “NormalBird”, “NormalMammal”, etc., and model

abnormities explicitly, e.g.,

NormalBird v̇ Bird u Normal

NormalBird v̇ ∃ableTo.Fly

Problem: if we learn that a : Bird,

– we cannot conclude/assume/believe that a is a normal bird, i.e.,

– normality cannot be assumed by default, but

– has to be stated explicitly.

– Hence we cannot assume that a is a normal bird (and can thus fly) unless we learn

about some abnormality

• Or we can extend our knowledge representation formalism with defaults

i.e., expressive means to make statements such as

if I know that a is a bird, and it is safe to assume that that a is normal,

then I conclude that a can fly

University ofManchester

96

Page 25: General Remarks - cs.man.ac.uk

Propositional Default Logic: Syntax

Default: for α, β, γ propositional formulae, we callα : βγ

a default with

• pre-requisite α,

• justification β, and

• consequent γ.

A default theory (W,D) consists of

• a finite set W of propositional formulae (the background knowledge) and

• a finite set D of defaults

Reading: a defaultα : βγ

is read as if I know α, and it is safe to assume β,

then I can conclude γ

Example: the (prop. version of the) bird example can be formalised asBird : Normal

Fly

Question: what does “it is safe to assume β”/”I can conclude γ” mean? Semantics?

University ofManchester

97

Propositional Default Logic: Semantics – Preliminaries

The exact meaning of defaults is given via so-called extensions, where an extension is

• a set of formulae that is

• deductively closed, i.e., if E is deductively closed and E |= ψ, then ψ ∈ E

Theory: for Γ a set of formulae, its theory Th(Γ) the smallest set that

• contains Γ and that

• is deductively closed

Remarks: • given Γ, we can “construct” Th(Γ) by exhaustively adding all con-

sequences of Γ

• e.g., Th( {p ∧ q, p ⇒ (s ∧ (t ∨ u))}) =

{p ∧ q, p ⇒ (s ∧ (t ∨ u)), p, q, (s ∧ (t ∨ u)), s, (t ∨ u), . . .}

• since we are in propositional logic, we can decide E |= ψ?

• since there are only finitely many propositional formulae over a

finite signature (up to equivalence), we can thus effectively compute

Th(Γ) if Γ is finiteUniversity ofManchester

98

Propositional Default Logic: Semantics

Extensions: let Γ be a set of formulae and (W,D) be a default theory. We set

•E0 = W and

•Ei+1 = Ei ∪ {γ |α : βγ

∈ D, Ei |= α, and ¬β 6∈ Γ}

Then Γ is an extension of (W,D) if Γ =⋃

i≥0 Th(Ei), and

ψ is consistent with (W,D) if there is an extension Γ of (W,D)

with ψ ∈ Γ

Remarks: • careful: in the definition of Ei, Γ is already used,

intuitively to translate “it is safe to assume β”

• since we are only adding consequents of defaults in D, every extension

Γ is of the form Th(W ∪ Con(D̂)) for some D̂ ⊆ D and where

– Pre(D) denotes the set of pre-requisites of defaults in D,

– Jus(D) denotes the set of justifications of defaults in D, and

–Con(D) denotes the set of consequents of defaults in D.University ofManchester

99

Propositional Default Logic: Semantics – Examples

• for the default theory

– W = {Bird}

– D = {Bird : NormalFlies

},

– there is only one extension: {Bird, Flies}, and thus, e.g.,

– Flies is consistent with (W,D)

• for the default theory

– W = {Bird,¬Normal}

– D = {Bird : NormalFlies

},

– there is only one extension: {Bird,¬Normal}, and thus

– Flies is not consistent with (W,D)

University ofManchester

100

Page 26: General Remarks - cs.man.ac.uk

Propositional Default Logic: Semantics – Examples

• for the default theory

– W = {Bat ∨ Bird}

– D = {Bird : FliesFlies

,Bat : Flies

Flies},

– there is only one extension: {Bat ∨ Bird}, and thus, e.g.,

– Flies is not consistent with (W,D)

• for the default theory

– W = {Penguin, Penguin ⇒ Bird}

– D = {Bird : FliesFlies

,Penguin : ¬Flies

¬Flies},

– there are two extensions:

– {Penguin, Bird, Flies}, and

– {Penguin, Bird, ¬Flies},

– hence both Flies and ¬Flies are consistent with (W,D)

University ofManchester

101

Propositional Default Logic: Semantics – Examples

• for the default theory

– W = {Penguin, Penguin ⇒ Bird}

– D = {Bird : Winged

Winged,Penguin : ¬Flies

¬Flies,Winged : Flies

Flies},

– there is are also two extensions, one that contains

– Penguin, Bird, Winged and Flies, and one that contains

– Penguin, Bird, Winged and ¬Flies

• the default theory

– W = {P}

– D = {P : ¬QQ

}

– has no extension: if E were an extension,

∗E had to be of the form E =⋃

i≥0 Th(Ei), and

∗ if Q ∈ E, then we have “put” it into some Ei because Q 6∈ E contradiction

∗ if Q 6∈ E, then we had to put Q into E1, and thus Q ∈ E contradiction

University ofManchester

102

Propositional Default Logic: Semantics – Observations

➠ a default theory can have no or more than one extension!

➠ as we have seen, both ψ and ¬ψ can be consistent with a single (W,D)

➠ default logic is non-monotonic because there are (W,D) such that

– ψ is consistent with (W,D), but

– ψ is not consistent with (W ∪ {φ},D)

➠ how can we compute extensions?

University ofManchester

103

Propositional Default Logic: Computation of Extensions

Input: (W,D), both finite

First test: if W is not satisfiable, Return Th(W)

Init: E0 := W, Used := ∅, i := 0

Repeat choose some D̂ ⊆ {α : βγ

∈ D | Ei |= α}

set Ei+1 := Ei ∪ Con(D̂), Used := Used ∪ D̂, i := i+ 1

Until Return E := Th(Ei) if

1. for allα : βγ

∈ Used : ¬β 6∈ E

2. for allα : βγ

∈ D \ Used : ¬β ∈ E or α /∈ E

Stop, return NIL if there is aα : βγ

∈ Used : Ei |= ¬β

• this algorithm always terminates (we are in propositional logic)

• and, for each extension E of (W,D), it can choose a suite of sets D̂ such that it

returns E

• hence it indeeds computes (in a non-deterministic way) all extensions of (W,D)

University ofManchester

104

Page 27: General Remarks - cs.man.ac.uk

Propositional Default Logic: Computation of Extensions

Can this algorithm be enhanced? Yes, we can choose D̂ more efficiently, i.e., before

computing Ei+1, we can estimate whether our choice of D̂ is ok:

Input: (W,D), a default theory

First test: if W is not satisfiable, Return Th(W)

Init: E0 := W, Used := ∅, J0 := ∅, i := 0

Repeat set Di := {α : βγ

∈ D | Ei |= α}

choose some D̂ ⊆ Di that satisfies

for all β ∈ Jus(D̂) : Ei ∪ Con(D̂) ∪ Ji ∪ ¬Jus(Di \ D̂) 6|= ¬βset Ei+1 := Ei ∪ Con(D̂)

set Ji+1 := Ji ∪ ¬Jus(Di \ D̂)

set Used := Used ∪ D̂, i := i+ 1

Return E := Th(Ei) if 1. for allα : βγ

∈ Used : ¬β 6∈ E

2. for allα : βγ

∈ D \ Used : ¬β ∈ E or α /∈ E

Stop, return NIL if there is aα : βγ

∈ Used : Ei |= ¬β

University ofManchester

105

Propositional Default Logic: Computation of Extensions

Explanation:

• Ei is always a subset of W ∪ Con(D)

• Ji is always a subset of ¬Jus(D), where ¬Jus(D) = {¬β | β ∈ Jus(D)}

• the idea of the additional set Ji is as follows:

– ifα : βγ

∈ Di \ D̂, thenα : βγ

could have been “applied”, but was not.

– This is only acceptable if its justification is not consistent with the final extension,

i.e., ¬β ∈ E, and thus

– we add ¬β to Ji and take Ji into account in the additional condition of D̂

– since we will add ¬Jus(Di \ D̂) to Ji, we can also take ¬Jus(Di \ D̂) into

account in the additional condition of D̂

• this algorithm always terminates (we are in propositional logic)

• and, for each extension E of (W,D), it can choose D̂s such that it returns E

• hence it indeeds computes (in a non-deterministic way) all extensions of (W,D)

University ofManchester

106

Propositional Default Logic: Summary

So far, we have

• seen a logic with defaults, and

• defined extensions and seen algorithms that compute extensions...so what’s next?

• let’s consider again the example

– W = {Penguin, Penguin ⇒ Bird}

– D = {Bird : FliesFlies

,Penguin : ¬Flies

¬Flies},

– we can verify that there are two extensions, one that contains

– Penguin, Bird and Flies, and one that contains

– Penguin, Bird and ¬Flies

➠ Problem: given that Penguin is more specific than Bird, we should

– activate the penguin-default before the bird-default or

– prefer the penguin-default over the bird-default,

– thus accepting only the Penguin, Bird and ¬Flies extension

University ofManchester

107

Propositional Default Logic: Preferences/Prioritisation

In the literature, a variety of different approaches to solve this problem exist,

• they all involve some ordering of defaults, i.e.,

– giving them priorities, and

– adapting the definition of extensions to take into account priorities

• they have different (dis)advantages

• here, we discuss an approach that fits nicely with the remainder of the course:

– we extend defaults from propositional ones to description logic defaults, and

– use subsumption between concepts as a natural indicator for prioritisation/being

more specific than

• more precisely, we

– extend syntax and semantics of defaults, e.g.,a : Bird | a : Flies

a : Fliesand

– extend the algorithm for the computation of extensions

University ofManchester

108

Page 28: General Remarks - cs.man.ac.uk

Description Logic Defaults – an Example

Remarks: in the following, we consider default theories (W,D):

• where the world description W = (T ,A) consists of

– an acyclic set of ALC concept definitions T (see Section 7) and

– an ALC ABox A

• for defaults, we can think of starting with defaults of the formC : DE

for conceptsC,D, andE and instantiate them with all object names

from the ABox, i.e., if a, b are objects occurring in A and

a : C | a : Da : E

∈ D, then we also haveb : C | b : D

b : E∈ D

Example: • T = {Penguin v̇ Bird}

• A = {a : Penguin}

• D = {a : Bird | a : Flies

a : Flies,a : Penguin | a : ¬Flies

a : ¬Flies},

University ofManchester

109

Description Logic Defaults – Extensions

We start with defining extensions without prioritisation:

Extensions: let T be a TBox, A′ an ABox consistent with T , and (T ,A,D) a

description logical default theory. We set

•E0 = {a : C | T ,A |= a : C} and

•Ei+1 = Ei ∪ {a : E |a : C | a : D

a : E∈ D, T , Ei |= a : C, and

T ,A′ 6|= a : ¬D}

Then A′ is an extension of (T ,A,D) if

A′ = {a : C | T ,⋃

i≥0

{Ei} |= a : C}

University ofManchester

110

Description Logic Defaults – Extensions

Next, we extend this definition to take into account prioritisation,

for which we define active defaults:

Active: a defaulta : C | a : D

a : Eis active in T , A if T ,A |= a : C and

T ,A 6|= a : ¬D

Please note that “active” only refers to the current ABox and not to an extension, and

thus being active can be decided (how?)!

University ofManchester

111

Description Logic Defaults – P-Extensions

P-Extensions: let T be a TBox, A′ an ABox consistent with T , and (T ,A,D) a

description logical default theory. We set

•E0 = {a : C | T ,A |= a : C} and

•Ei+1 = Ei ∪ { a : E |a : C | a : D

a : E∈ D is active in T ,A′

and for alla : C′ | a : D′

a : E′ ∈ D,

if T |= C ′ v C, and T 6|= C v C ′,

thena : C ′ | a : D′

a : E′ is not active in T , Ei}

Then A′ is a p-extension of (T ,A,D) if

A′ = {a : C | T ,⋃

i≥0

{Ei} |= a : C}

University ofManchester

112

Page 29: General Remarks - cs.man.ac.uk

Description Logic Defaults – P-Extensions

Finally, we say that an assertion a : C is consistent with a prioritised ALC default

theory (T ,A,D) if there exists a p-extension E of (T ,A,D) with T , E |= a : C.

Remarks: • the “p” in “p-extension” stands for “prioritised”.

• as for propositional default theories, ALC default theories can have several

or no extensions

• the Penguin example has exactly one extension:

– we start with E0 = A, and then

– both defaults are active in T , E0, but Penguin is more specific, thus

the Bird-default is not “applied”, i.e., E1 = A∪{a : ¬Flies}, and

then

– stop since (trivially) T , Ei |= a : ¬Flies with the extension

A′ = {a : C | T , {a : Penguin, a : ¬Flies} |= a : C}{a : Penguin, a : ¬Flies, a : Bird, a : (Bird u ¬Flies), . . .}

University ofManchester

113

Description Logic Defaults – Sub-Summary

In this section, we have seen

• propositional defaults: their syntax and semantics, given via extensions

• a “naive” and an “enhanced” algorithm for the computation of extensions

• that there is a problem with “one default being more specific than another one”, which

we solved in

• description logic default theories:

– they are a bit more expressive, i.e., we have ABoxes, relations between individuals,

etc., and

– we can use subsumption between the pre-requisites of defaults to prioritise defaults:

intuitively, if we could “apply” two defaults with pre-requisites a : C and a : C ′

where C is subsumed by C ′, we only apply the one with a : C, and only later

possibly the other one!

• finally, we adapt the (naive) algorithm for the computation of extensions of propositional

default theories to description logic default theories:

University ofManchester

114

Description Logic Defaults – How to Compute Extensions

Input: (T ,A,D), a (finite) ALC default theory

First test: if A is not consistent with T , Return “inconsistent”

Init: E0 := A, Used := ∅, i := 0

Repeat Di := {a : C | a : D

a : E∈ D |

a : C | a : Da : E

is active in T , Ei

and for alla : C ′ | a : D′

a : E′ ∈ D active in T , Ei,

if T |= C ′ v C, then T |= C v C ′}choose some D̂ ⊆ Di

set Ei+1 := Ei ∪ {a : E |a : C | a : D

a : E∈ D̂}

set Used := Used ∪ D̂, i := i+ 1

Return E := {a : C | T , Ei+1 |= a : C} if

1. for alla : C | a : D

a : E∈ Used : T , E 6|= a : ¬D

2. for alla : C | a : D

a : E∈ D \ Used : T , E |= a : ¬D or T , E¬ |= a : C

Stop, return NIL if there is aa : C | a : D

a : E∈ Used : T , Ei+1 |= a : ¬D

University ofManchester

115

Description Logic Defaults – Example Extensions

Apply the algorithm to the following example ALC default theory, where KP stands for

KingPenguin, P for Penguin, and B for Bird

• T = {KP.= P u ∃has.GoldSwish, P v̇ B, B v̇ Animal,

Runs v̇ Locom u ¬Hops u ¬Flies}

• A = {a : P, b : P, (b, c) : has, c : GoldSwish}

• D = {x : KP | x : Runs

x : Runs,x : P | x : Hops

x : Hops,

x : P | x : ¬Flies

x : ¬Flies,x : B | x : Flies

x : Flies| x ∈ {a, b, c}}}

• to compute D0, we first have to find the defaults that are active in E0 (= A), and

then find the “most specific ones”

• next, we have to choose some D̂ ⊆ D0, which yields E1 and a new Used, etc.

• we check whether we are done – if not, we compute D1 and choose another D̂, etc...

University ofManchester

116

Page 30: General Remarks - cs.man.ac.uk

Default Logic – Summary and Outlook

• In this section, we have seen formalisms for non-monotonic inferences:

– propositional default logic and

– description logic defaults

• discussed syntax and semantics and

• seen algorithms for the computation of extensions:

– a naive one for propositional default logic,

– an enhanced one for propositional default logic, and

– one for prioritised description logic defaults

• There are a variety of other default logics and a

• large variety of other non-monotonic formalisms, e.g.

– circumscription,

– formalisms with closed world assumption/negation as failure,

– auto-epistemic logics

– see http://plato.stanford.edu/entries/logic-nonmonotonic/

University ofManchester

117