Presentation is loading. Please wait.

Presentation is loading. Please wait.

Logics for Data and Knowledge Representation Modeling Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia, Rui Zhang.

Similar presentations


Presentation on theme: "Logics for Data and Knowledge Representation Modeling Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia, Rui Zhang."— Presentation transcript:

1 Logics for Data and Knowledge Representation Modeling Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese

2 2 Outline  Modeling  Logical Modeling (formal modeling)  Domain  Language  Interpretation  Theory  Model  How to use logical modeling  What is a logic?  Choosing the right logic and writing the theory  Reasoning services  Expressiveness  Expressiveness, Efficiency, Complexity  Decidability 2

3 3 Modeling 3 World Language L Theory T Domain D Model M Data Knowledge Meaning Mental Model SEMANTIC GAP MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

4 4 Modeling  World: the phenomenon we want to describe  Domain: the abstract relevant elements in the real world  Mental Model: what we have in mind. It is the first abstraction of the world (subject to the semantic gap)  Language: the set of words and rules we use to build sentences used to express our mental model  Model: the formalization of the mental model, i.e. the set of true facts in the language, in agreement with the theory  Theory: the set of sentences (constraints) about the world expressed in the language that limit the possible models  NOTE: this does not necessarily need to be in formal semantics 4 MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

5 5 Example of informal Modeling 5 World Mental Model SEMANTIC GAP Model M L: Informal description in NL D: {monkey, banana, tree} T: If the monkey climbs on the tree, he can get the banana M: The monkey actually climbs on the tree and gets the banana Theory T NOTE: a database can be seen as an informal model Language L Domain D MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

6 6 Logical Modeling 6 Modeling Realization World Language L Theory T Domain D Model M Data Knowledge Meaning Mental Model SEMANTIC GAP Interpretation I Entailment ⊨ NOTE: the key point is that in logical modeling we have formal semantics MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

7 7 Logical Modeling Elements  Domain: relevant objects  Logical Language: the set of formal words and rules we use to build complex sentences  Interpretation: the function that associates elements of the language to the elements in the domain  Model: the set of true facts in the language describing the mental model, in agreement with the theory  Theory / Knowledge Base (KB): data and knowledge  Truth-relation / logical entailment ( ⊨ ): deduction, reasoning, inference 7 MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

8 8 Example of formal (intentional) modeling 8 World SEMANTIC GAP L = {Monkey, Climbs, GetBanana, , ,  } D= {T, F} T = {  (Monkey  Climbs)  GetBanana} A possible model M: I(Monkey) = T I(Climbs) = T I(GetBanana) = T Mental Model M Theory T Language L Domain D MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

9 9 Domain  Domain (D): the chosen objects from the world  We will deal only with finite domains!  Question: what are we leaving out? 9 Example: the LDKR class  The members of the LDKR class define a domain D  D is a finite set  Two “kinds” of the elements in D: Professor Student Both are specializations of Person Fausto Mary PaulJane HugoSaraRui MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

10 10 Language  Language (L) = a logical language  To each logical language we associate an alphabet of symbols Σ (sigma)  For instance, Σ may contain the logical symbols:  ∧ (and)  ∨ (or)  ¬ (not)  → (implication)  ∀ (for all, universal quantifier)  ∃ (exists, existential quantifier)  L has clear formation rules for formulas 10 MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

11 11 Logical Language (Syntax)  The first step in setting up a logical language is to list the symbols  the alphabet of (formal) symbols Σ  formal symbol = a character, or group of characters taken from some alphabet (it is formal because we specify the meaning)  Symbols in Σ can be divided in:  descriptive (non-logical)  non-descriptive (logical)  NOTE: English can be restricted to a propositional language,...but it is not logical (informal syntax) 11 MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

12 12 Logical language 12  The Language L for the LDKR class example with alphabet Σ  Logical symbols: ∧, ∨, ¬, →  Descriptive symbols: Person, Professor, Student Fausto Mary PaulJane HugoSaraRui MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

13 13 Formal Syntax  The set of rules saying how to construct the sentences of the language from the alphabet of symbols (i.e. the syntax) is a grammar (i.e., is formal)  Example: ¬A, A ∧ B, A → B ¬Professor, Professor ∧ Student, Student → Person  Formal syntax is often called an abstract syntax, in contrast to the concrete syntax used, for instance in implementations.  Example: context-free grammars 13 MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

14 14 Interpretation  Interpretation (I) = a mapping of L into D  I must be effective (i.e., computable) 14 Intensional interpretation I(Professor) = T I(Student) = T I(Person) = T Extensional interpretation I(Professor) = {Fausto} I(Student) = {Mary, Paul, Jane, Rui, Sara, Hugo} I(Person) = {Fausto, Mary, Paul, Jane, Rui, Sara, Hugo} Fausto Mary PaulJane HugoSaraRui MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

15 15 Theory  Theory T (also L-Theory) = set of facts of L  A fact defines a piece of knowledge (about D), namely something true  A theory is a way to put constraints on the intended models 15 MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

16 16 Theory  A finite theory T is called:  An ontology if it contains knowledge only (T-BOX)  A knowledge base (KB) if it contains knowledge (T-BOX) and data (A-BOX)  A database (DB) if it only contains data.  A DB + its schema is the simplest kind of knowledge base NOTE: Sometimes the terms Ontology and Knowledge Base are used interchangeably 16 MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

17 17 Theory 17 The set of (true) facts T over L Student → Person Professor → Person Student → ¬ Professor Professor → ¬ Student Fausto Mary PaulJane HugoSaraRui MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

18 18 Model  Model (M) = the abstract (in mathematical sense) representation of the intended truths via interpretation I of the language L  M is called L-model of D:M ⊨ T M satisfies T T holds in M T is TRUE in M M yields T with T set of arbitrary complex formulas 18 MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

19 19 Model 19 Intensional interpretation I(Professor) = T I(Student) = T I(Person) = T The I is a model for the theories below: M ⊨ {Person} M ⊨ {Professor ∨ Student} M ⊨ {Person, Professor ∨ Student, Student → Person} … Fausto Mary PaulJane HugoSaraRui MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

20 20 Theory and Model  We have: M ⊨ T iff M ⊨ A, for each formula A in T  A model M of a theory T is any interpretation function that satisfies all the facts in T  There can be many models satisfying the theory T. They are a subset of all possible interpretation functions over L.  In case there are no models for T, we say that the theory T is unsatisfiable. 20 MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

21 21 Theory and Model 21 T Student → Person Professor → Person Student → ¬ Professor Professor → ¬ Student Fausto Mary PaulJane HugoSaraRui M I(Professor) = {Fausto} I(Student) = {Mary, Paul, Jane, Rui, Sara, Hugo} I(Person) = {Fausto, Mary, Paul, Jane, Rui, Sara, Hugo} M is a model for T (M ⊨ T ) M’ I(Professor) = {Fausto, Mary} I(Student) = {Mary, Paul, Jane, Rui, Sara, Hugo} I(Person) = {Fausto, Mary, Paul, Jane, Rui, Sara, Hugo} M’ is not, because Mary is both a student and a professor MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

22 22 Same theory, different models (MODEL#1) L = {MonkeyLow, BananaHigh, MonkeyClimbBox, MonkeyGetBanana, , ,  } T = {  (MonkeyLow  BananaHigh  MonkeyGetBanana)  (MonkeyLow  MonkeyClimbBox)  (  MonkeyLow   BananaHigh  MonkeyGetBanana)} Informal Semantics: “If the monkey is low and the banana is high in position, then the monkey cannot get the banana. “ Formal Semantics: I(MonkeyLow) = T I(BananaHigh) = T I(MonkeyClimbBox) = F I(MonkeyGetBanana) = F MODEL#1 MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

23 23 Same theory, different models (MODEL#2) L = {MonkeyLow, BananaHigh, MonkeyClimbBox, MonkeyGetBanana, , ,  } T = {  (MonkeyLow  BananaHigh  MonkeyGetBanana)  (MonkeyLow  MonkeyClimbBox)  (  MonkeyLow   BananaHigh  MonkeyGetBanana)} Informal Semantics: “If the monkey climbs onto the box, he becomes high in position (not low anymore) and can get the banana.” Formal Semantics: I(MonkeyLow) = F I(BananaHigh) = T I(MonkeyClimbBox) = T I(MonkeyGetBanana) = T MODEL#2 MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

24 24 Same theory, different models (MODEL#3) L = {MonkeyLow, BananaHigh, MonkeyClimbBox, MonkeyGetBanana, , ,  } T = {  (MonkeyLow  BananaHigh  MonkeyGetBanana)  (MonkeyLow  MonkeyClimbBox)  (  MonkeyLow   BananaHigh  MonkeyGetBanana)} Informal Semantics: “If the monkey is low and the banana is also low, then the monkey can get the banana. “ Formal Semantics: I(MonkeyLow) = T I(BananaHigh) = F I(MonkeyClimbBox) = F I(MonkeyGetBanana) = T MODEL#3 MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

25 25 How to use logical modeling 25 1. Define a logic  most often by reseachers  once for all (not a trivial task!) 2. Choose the right logic for the problem  Given a problem the computer scientist must choose the right logic, most often one of the many available 3. Write the theory  The computer scientist writes a theory T 4. Use reasoning services  The computer scientist uses reasoning services to solve her programs MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: EXPRESSIVENESSMODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

26 26 What is a Logic?  Logic = where L Language Set of phrases/sentences/formulas (alphabet + formation rules) I Interpretation function What phrases mean in a chosen domain D with I: L -> D ⊨ Satisfiability relation (over M) How to compute the fact that a formula A is TRUE in M, notationally M ⊨ A A ⊨ B in M iff M ⊨ A implies M ⊨ B 26 MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

27 27 Choose the right logic for the problem 27 Problem: the LDKR class Specification: “In the LDKR class Fausto is the professor. There are 6 students. They are Mary, Paul, Jane, Rui, Hugo and Sara”. Formalization:  We want to represent both classes of objects (Professor, Student) and individuals (Mary, Paul…)  Choose a logic that allows for them, e.g. ClassL with Individuals Fausto Mary PaulJane HugoSaraRui L = {Professor, Student, ∧, ∨, ¬, → } D = {Fausto, Mary, Paul, Jane, Rui, Sara, Hugo} MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

28 28 Define the theory for the problem 28 L = {Professor, Student, ∧, ∨, ¬, → } D = {Fausto, Mary, Paul, Jane, Rui, Sara, Hugo} In the theory we want to model the fact that the set of professors is always disjoint from the set of students… Fausto Mary PaulJane HugoSaraRui T = {Student → ¬ Professor; Professor → ¬ Student} M I(Professor) = {Fausto} I(Student) = {Mary, Paul, Jane, Rui, Sara, Hugo} M ⊨ T Then we can use reasoning services to handle our problem MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

29 29 Reasoning Services: EVAL Model Checking (EVAL) Is a sentence ψ true in model M? Check M ⊨ ψ EVAL ψ, M Yes, M ⊨ ψ No, M ⊭ ψ MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

30 30 EVAL L = {MonkeyLow, BananaHigh, MonkeyClimbBox, MonkeyGetBanana, , ,  } T = {  (MonkeyLow  BananaHigh  MonkeyGetBanana)  (MonkeyLow  MonkeyClimbBox)  (  MonkeyLow   BananaHigh  MonkeyGetBanana)} I(MonkeyLow) = T I(BananaHigh) = T I(MonkeyClimbBox) = F I(MonkeyGetBanana) = F Evaluate ψ 1 and ψ 2 in M ψ 1 =  MonkeyClimbBox is true in M (YES) ψ 2 = MonkeyGetBanana is false in M (NO) M MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

31 31 Reasoning Services: SAT Satisfiability (SAT) Is there a model M where ψ is true? find M such that M ⊨ ψ SAT ψ M No MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

32 32 SAT L = {MonkeyLow, BananaHigh, MonkeyClimbBox, MonkeyGetBanana, , ,  } T = {  (MonkeyLow  BananaHigh  MonkeyGetBanana)  (MonkeyLow  MonkeyClimbBox)  (  MonkeyLow   BananaHigh  MonkeyGetBanana)} I(MonkeyLow) = F I(BananaHigh) = T I(MonkeyClimbBox) = T I(MonkeyGetBanana) = T ψ = MonkeyGetBanana Is there a model M where ψ is true? (YES, the model on the left) SAT is a search problem (find a model M) MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

33 33 Reasoning Services: VAL Validity (VAL) Is ψ true according to all possible models? Check whether for all M, M ⊨ ψ VAL ψ Yes No MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

34 34 VAL L = {MonkeyLow, BananaHigh, MonkeyClimbBox, MonkeyGetBanana, , ,  } T = {  (MonkeyLow  BananaHigh  MonkeyGetBanana)  (MonkeyLow  MonkeyClimbBox)  (  MonkeyLow   BananaHigh  MonkeyGetBanana)} I(MonkeyLow) = F I(BananaHigh) = T I(MonkeyClimbBox) = T I(MonkeyGetBanana) = F ψ = MonkeyLow  MonkeyGetBanana Is ψ true according to all possible model M? (No, the monkey can be high without getting the banana) VAL is a search problem (check ψ in all M) NOTE: It is enough to find a counterexample to conclude for non validity MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

35 35 Reasoning Services: ENT Entailment (ENT) ψ 1 true in M (all models) implies ψ 2 true in M (all models) check A ⊨ B in M by checking M ⊨ A implies M ⊨ B ENT ψ 1, ψ 2, M Yes, ψ 1 ⊨ ψ 2 No MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

36 36 ENT L = {MonkeyLow, BananaHigh, MonkeyClimbBox, MonkeyGetBanana, , ,  } T = {  (MonkeyLow  BananaHigh  MonkeyGetBanana)  (MonkeyLow  MonkeyClimbBox)  (  MonkeyLow   BananaHigh  MonkeyGetBanana)} ψ1 = MonkeyClimbBox ψ2 =  MonkeyLow ψ1 true in M (all models) implies ψ2 is true in M (all models). (Yes) NOTE: ψ 1 entails ψ 2 in all models MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

37 37 An Important Trade-Off  There is a trade-off between:  expressive power (expressiveness) and  computational efficiency provided by a (logical) language  This trade-off is a measure of the tension between specification and automation  To use logic for modeling, the modeler must find the right trade off between expressiveness in the language for more tractable forms of reasoning services. 37 MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

38 38 Examples of Expressiveness 38 LANGUAGENL SENTENCEFORMULA Propositional logic Fausto likes skiing I like skiing Fausto-likes-skiing I-like-skiing Modal logic I believe I like skiingB(I-like-skiing) First-order logic Every person likes skiing I like skiing Fausto likes skiing ∀ person.like-skiing(person) like-skiing(I) like-skiing(Fausto) Description Logic Every person likes cars person ⊑ ∃ likes.Car … MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

39 39 Efficiency VS. Complexity  Efficiency  Performing in the best possible manner; satisfactory and economical to use [Webster]  In modeling it applies to reasoning  We use the more specific term computational complexity (time, space,...)  Complexity (or computational complexity) of reasoning  It is the difficulty to compute a reasoning task expressed by using a logic  With degrees of expressiveness, we may classify the logical languages according to some “degrees of complexity” 39 MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

40 40 Degrees of Complexity 40  The more you specify, the more cost grows COST & PRECISION OF THE SPECIFICATION Natural Language Diagram Logics FORMALITY MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

41 41 When is the use of logics appropriate?  When logic is used we always pay a performance price  We therefore use it when it is cost-effective  To prove correctness (offline use)  To draw conclusions (online use) MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

42 42 Examples of offline use (specification)  For data and knowledge representation  In safety-critical applications  Trains  Planes  …  In security critical applications  bank transactions  … MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

43 43 Examples of online use (reasoning)  To let programs interoperate Web 1.0 Web 2.0 LET PEOPLE INTEROPERATE (informal semantics) Web 3.0 LET PROGRAMS INTEROPERATE (formal semantics) MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS

44 44 Decidability  The existence of an effective method to determine the validity of formulas in a logical language  A logic is decidable if there is an effective method to determine whether arbitrary formulas are included in a theory  A decision procedure is an algorithm that, given a decision problem, terminates with the correct yes/no answer.  In this course we focus on logics that are expressive enough to model real problems but are still decidable 44 MODELING :: LOGICAL MODELING :: HOW TO USE LOGICAL MODELING :: REASONING SERVICES :: EXPRESSIVENESS


Download ppt "Logics for Data and Knowledge Representation Modeling Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia, Rui Zhang."

Similar presentations


Ads by Google