LDK R Logics for Data and Knowledge Representation Context Logic Originally by Alessandro Agostini...

30
L Logics for D Data and K Knowledge R Representation Context Logic Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese

Transcript of LDK R Logics for Data and Knowledge Representation Context Logic Originally by Alessandro Agostini...

LLogics for DData and KKnowledgeRRepresentation

Context Logic

Originally by Alessandro Agostini and Fausto GiunchigliaModified by Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese

2

Outline Introduction: contexts Syntax Semantics

Local Models Contextual models

Satisfiability, validity and contextual entailment

3

The notion of context The notion of “context” is used in various areas of AI,

including data and knowledge representation, NLP, and multimedia IR. However,

its meaning is frequently left to the user its use is implicit and intuitive its formalization is poor or missing

No formal definition of context was given

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

4

Example

‘Today is nice’

What do we mean by ‘nice’? Which day is ‘today’?

We cannot answer, as the proposition does not have a precise meaning or context.

Therefore, we cannot say whether the proposition is true or false.

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

5

Example (McCarthy, 1987)

‘The book is on the table’

Consider modeling the on preposition so as to draw appropriate consequences from the information expressed in the sentence

How many interpretations of it we can think? What is the right level of generality?

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

6

Example (Tarski, 1931)

‘Snow is white’

Is this proposition true? What about the color of the snow on top of Mount Etna in Sicily?

(Mount Etna is one of the most active volcanoes in the world)

Tarski made explicit the context he used to interpret it:

“I would only mention that [...] I shall be concerned exclusively with grasping the intentions which are contained in the so-called classical conception of truth.”(The first attempt to formalize a context)

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

7

Summary These examples show that:

even a very simple proposition requires the use of some context to be interpreted

the notion of context is often unclear, undefined or left implicit.

The first attempt to formalize a context as a way to interpret (first-order) statements was introduced by Tarski (1930-31).

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

8

Definitions of context From Webster dictionary

A context “surrounds, and gives meaning to, something else”

In linguistic

It is “the text surrounding a term in which the term is used”

In logic (Giunchiglia, 1993)

that subset of the complete state of an individual that is used for reasoning about a given goal, e.g. to formulate a query.

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

9

Subjective Perspective (I) The “magic box” (Giunchiglia& Ghidini, 1998)

Intuitively, a context is a theory of the world which encodes (formally by using a logic called contextual logic, CxL) an individual’s subjective perspective about the world.

In this example, two observer look at the same phenomenon from two different perspectives.

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

10

Subjective Perspective (II) The “magic box” (Giunchiglia& Ghidini, 1998)

The “magic box” represents a world with two contexts, called the local models, that encode Mr.1 and Mr. 2’s subjective view of the phenomenon.

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

11

Syntax: alphabet and languages Alphabet of symbols

For every i∈N, with N the set of contexts, we define an alphabet Σi for a contextual language Li such that L = {Li} i∈N

Multi-Context Alphabet A multi-context alphabet is a set Σ = ∪i∈I Σi with I ⊆ N, where

each Σi is a first-order alphabet enriched by some auxiliary symbols to build contextual formulas

Family of languages From the multi-context alphabet Σ = ∪i∈I Σi we define a

family of languages L = {Li} i∈N

Each Li is the formal language used to state what is true in the context I, and it is therefore called a local language

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

12

Syntax: formation rules First order formulas<term> ::= <variable> | <constant> | <function sym>

(<term>{,<term>}*)

<atomic formula> ::= <predicate sym> (<term>{,<term>}*) |

<term> = <term>

<wff> ::= <atomic formula> | ¬<wff> | <wff> ∧ <wff> | <wff> ∨ <wff> |

<wff> → <wff> | ∀ <variable> <wff> | ∃ <variable> <wff>

Contextual formulas <cwff> ::= i : <wff> for each i ∈ I (also called i-formula or Li-formula)

Using contextual formulas we turn a meta-theoretic object (the name i of a context) into a theoretic object (an i-formula i : ψ)

A contextual formula is a kind of labeled formula

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

13

Example Contextual Laws for ∧, ¬ and →:

i : (A∧¬B)→¬ (A→B)

i : ¬(A→B)→(A∧¬B)

Contextual Pierce’s law:

i : ((A→B)→A)→A

Contextual De Morgan’s laws: i : ¬(A∨B) ↔ (¬A∧¬B)i : ¬(A∧B) ↔ (¬A∨¬B)

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

14

Contextual languages and theories Multi-context language

The multi-context alphabet Σ and the formation rules define a multi-context language L = {Li} i∈I

Multi-context theoryA set of closed wff’s over L is a multi-context theory

NOTE: A first order theory T is a special case of a contextual theory Ti where ψ ∈ T iff i : ψ ∈ Ti for any i ∈ I

A first-order theory Ti is called local theory

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

15

ExampleT1 = {

1:∀x.apple(x)→Computer(x),1: apple(docPBG4pdf)

}

T2 = {2:∀x.apple(x)→Fruit(x),2:∀x.orange(x)→Fruit(x),2: apple(docRdoc),2: apple(docGtxt)

}

Same terminology, different meaning.

1

2

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

16

ExampleT1 = {

1:∀x.apple(x)→Computer(x),1: apple(doc1)

}

T2 = {2:∀x.Mac(x)→Computer(x),2: Mac(doc1)

}

Different terminology, same meaning.

1

2

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

17

Local model semantics Local model semantics (LMS)

Provide the meaning of the sentences and model reasoning as logical consequence over a multi-context language. LMS formalizes:

Principle of Locality We never consider all we know, but rather a very small subset of

it Modeling reasoning which uses only a subset of what reasoners

actually know about the world The part being used while reasoning is what we call a context,

i.e., a local theory Ti

Principle of Compatibility There is compatibility among the kinds of reasoning performed in

different contexts

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

18

Example: viewpoints (I) The “magic box” (Giunchiglia& Ghidini, 1998)

Locality: Mr. 1 and Mr. 2 do not have any perception of the depth of the box

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

19

Example: viewpoints (II) Compatibility: there are some compatible situations we

can list

Compatible pairs can be described: “if Mr.1 sees at least one ball then Mr.2 sees at least one ball”

NOTE: each of the configurations depicted here is what we call a local model (see next slides), i.e. one of the possible situations in a context

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

20

Example: viewpoints (III) Compatibility: there are cases in which observers cannot

really distinguish among different situations

In these cases we need a third view

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

21

Viewpoints: applications An application where partial views matter is data

integration in federations of relational databases

Each federated database can be represented as a context

The federation of databases is a set of views of an ideal (global) database which is impossible, too complex or even not worth to reconstruct completely

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

22

Local models and compatibility sequencesGiven a family of languages L = {Li} i∈I

Local model We denote with M(Li) the set of all models for Li

An element m ∈ M(Li) is a local model

Compatibility sequence A compatibility sequence for L is an infinite sequence

c = <c0, c1, . . . , ci, . . . > where ci is a subset of M(Li).

NOTE: For I = {1,2}, c is called a compatibility pair

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

23

Model and compatibility relation Intuitively, local models describe what is locally true while compatibility sequences

put together local models which are mutually compatible consistently with the situation we are modeling

A compatibility relation (for L) is a set C of compatibility sequences.

A model (for L) is a non-empty compatibility relation C such that the sequence <∅, ∅, . . .> is not in C

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

24

Example: viewpoints semantics (I) Languages

We need languages L1 and L2 describing the views of Mr.1 and Mr.2.

With L1 we describe that a ball can be on the left or on the right

With L2 we describe that a ball can be on the left, in the center, or on the right.

No other constrains are specified

L1 = {Bl Br}

L2 = {Bl Br Bc}

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

25

Example: viewpoints semantics (II) Local models

We construct all the possible situations (models) for L1 and L2

This leads to the definition of four situations (models) for L1 and eight situations (models) for L2

Compatibility pairs We construct all the

compatibility pairs

Compatibility relation The collection of all the

compatibility pairs

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

26

Formal definition of contextLet model C = {<c0, c1, . . . , ci, . . . >” be given.

A context is any ci, i.e. the set of local models m ∈ M(Li) allowed by C within any particular compatibility sequence c in C

Given c, a context captures exactly locally true facts given the constraints posed by the local models of the other contexts in the same compatibility sequence, as allowed by c

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

27

Truth relation (satisfaction relation)The scope of the FO-logic truth relation is extend

A model C satisfies an i-formula i : ψ

C ⊨ i : ψ

if for all <c0, c1, . . . , ci, . . .> ∈ C and for all m ∈ ci, m ⊨ ψ

C is a model of i : ψ i : ψ is true in C

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

28

Satisfiability and validity An Li-formula i : ψ is satisfied by a model C if all the

local models in each context ci satisfy it

A model C satisfies a set of formulas Γ (C ⊨ Γ ) if C satisfies every formula i : ψ in Γ

Γ is satisfiable if C ⊨ i : ψ for some C and for all i : ψ in Γ

i : ψ is valid (⊨ i : ψ ) if C ⊨ i : ψ for all C

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

29

Contextual entailment A set Γ of formulas entails a formula i : ψ w.r.t. a model C

(i : ψ is a logical consequence of Γ w.r.t. C)

Γ ⊨C i : ψ

if for every compatibility sequence c ∈ C and for all j∈I with jǂi, if cj ⊨ Γj then for all m ∈ ci, if m ⊨ Γi then m ⊨ ψ

If Γ is empty then i : ψ is a tautology

Intuitively, given a contextual model C, for any c ∈ C

(1) distinguish between the local formulas Γi and the others Γj

(2) throw away c if cj ⊮ Γj, continue otherwise

(3) throw away all the local models m’ ∈ ci that m’ ⊮ Γi

(4) the remaining models m ∈ ci locally satisfy ψ

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT

30

Example: the “magic box” If Mr. 1 sees a ball on the left

and Mr. 2 does not see any ball on the right, then Mr. 2 sees a ball on the left or in the center.

(1) In the premises, local conditions are in blue, the others in red

(2) Throw away all the compatibility sequences that do not satisfy the red condition

(3) Throw away all the local models that do not satisfy the blue one

(4) Notice how the remaining local models for Mr. 2 satisfy the condition in green.

INTRODUCTION :: SYNTAX :: LOCAL MODELS :: CONTEXTUAL MODELS :: SATISFIABILITY, VALIDITY AND ENTAILMENT