Presentation is loading. Please wait.

Presentation is loading. Please wait.

Logics for Data and Knowledge Representation Languages for Data Representation First version by Alessandro Agostini and Fausto Giunchiglia Second version.

Similar presentations


Presentation on theme: "Logics for Data and Knowledge Representation Languages for Data Representation First version by Alessandro Agostini and Fausto Giunchiglia Second version."— Presentation transcript:

1 Logics for Data and Knowledge Representation Languages for Data Representation First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

2 Outline MModel LLanguage NNatural Language EER UUML LLogic UUsing Languages SSpecification & Automation SServices UUsing logics First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

3 Model A model is an abstraction of a part of the world First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

4 Outline  Model  Language  Natural Language  ER  UML  Logic  Using Languages  Specification & Automation  Services  Using logics First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

5 Language  Language : A (usually infinite) set of expressions (phrases), and rules to form expressions, with a notion of “correct phrase” (a phrase member of a language). Often an algorithm for checking correctness  A tool for codifying the (mental) model (what we have in mind)  Expressions  Meaning Syntax Semantics Boss First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

6 Formal vs. Informal languages  Recall the composition of a language Language = Syntax + Semantics  Formal syntax  Infinite/ finite (always recognizable) alphabet  Finite set of formal constructors and building rules for phrase construction  Algorithm for correctness checking (a phrase in a language)  Formal Semantics: the relationship between syntactic constructs and the elements of an universe of meanings is a (mathematical) function  Informal syntax/ semantics: the opposite of formal First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

7 Levels of Formalization (update) Both Syntax and Semantics can be formal or informal. NOTE: formal Semantics only with formal syntax. 7 LogicsDiagramsNLs Programming Languages English Italian Russian Hindi... ER UML... SQL... PL FOL DL... 01 First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

8 Natural Language  Monkey-Bananas (MB) by McCarthy, 1969 “There is a monkey in a laboratory with some bananas hanging out of reach from the ceiling. A box is available that will enable the monkey to reach the bananas if he climbs on it. The monkey and box have height Low, but if the monkey climbs onto the box he will have height High, the same as the bananas. [...]”  Question: How shall the monkey reach the bananas? First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

9 E-R Schemas  Data representation models for databases design under the Entity-Relationship Model [Chen 1976].  It provides basic “alphabet “ (constructs for schemas:  Entity (or Class)  Relation (or Association)  Attribute (simple and composed)  … + arrows and various notation 9 Entity RelationAttribute First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

10 The E-R Constructs (1)  Entity: class of objects with same properties. These are individuals (objects)  Relation: relations among entities.  Attribute: properties of entities 10 First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang Bananas Climb Height 9/2009

11 The E-R Constructs (2)  Cardinality of Relation: min/max number of objects in an entity that may be related by a relation to an object in a different entity.  Cardinality of Attribute: range of values of an attribute of an entity or a relation.  Entity Identificator: Id which provides unique identification of an entity. 11 First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang MonkeysBoxes Climb 0..10..n Bananas Height 9/2009

12 The E-R Constructs (3)  Generalization: logical relationship between an entity E (father entity ) and a set of entities E 1...E i...E n (child entities).  For each i, E generalizes E i and E i specializes E. E i is a subset of E (IS- A relation). Properties of E are also of E i (inheritance), but not necessarily vice versa. 12 E E1E1 EiEi EnEn There are other representations for ER diagrams First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

13 Example of Monkey and Bananas in ER Monkeys Bananas Boxes Climb Height The squares represent monkey, bananas and box. The attribute “height” may has either value of “high” or “low”. The diamonds “Climb” and “Get” are binary relations Get Height First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

14 UML  Unified Modeling Language UML.  Representation language to model data, operations, processes, architectures.  From software engineering under the paradigm of object- oriented programming.  UML class diagrams useful in database design as an “alternative” to the E-R schemas. 14 First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

15 UML Class Diagrams  Basic components of an UML class diagram  Class  Association.  Classes and associations correspond to entities and relations in the E-R schemas.  The elements in a class are called instances.  The world here is a set of instances. 15 Class A Attribute Method Class B Attribute Method 1 0..* First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

16 Example of Monkey and Bananas in UML Monkeys Height … Boxes Height … Bananas Height … Climb 1 0..1 Get 1 0..* “A monkey can climb onto 0 to 1 box. A monkey can get 0 or more bananas.” First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

17 Logic: eg. Propositional Logic  Language L ={A, , , ,  }  Example MonkeyLow, BananaHigh, MonkeyLow  BananaHigh   MonkeyGetBanana MonkeyLow  MonkeyClimbBox  MonkeyHigh MonkeyHigh  BananaHigh  MonkeyGetBanana  Semantics: “Originally, the monkey is low and bananas are high in position. The monkey cannot get the bananas. If the monkey climbs onto the box, it becomes high in position and can get the bananas.” First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

18 Formal Model A (formal) model is an abstraction of a part of the world A model : a Triple=  D= domain (a is in A): set of objects of interest  A= set of attributes (a has attribute P): subsets of D  R= set of relations (a is in relation with b): subset of Cartesian products A×B, with A,B subsets of D, r= is a pair of objects. Note: we can easily extend to n-ary relations First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

19 Formal semantics (example)  Domain {monkey1, banana3, box11, leaf0}  Attribute High={banana3},Low={monkey1, box11}  Relation Climb={ } Get={, } First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

20 Formal semantics )(example)  Domain {True, False} (the same as: {1, 0} )  Attribute HighBanana=1, LowMonkey=0  Relation ClimbLowBox= 1 First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

21 Formal semantics for ER and UML  Domain {monkey, banana, box}  Attribute High={banana},Low={monkey, box}  Relation Climb= … Get= … First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang Monkeys Bananas Boxes Climb Height Get Height Monkeys Height … Boxes Height … Bananas Height … Climb 1 0..1 Get 1 0..* Same 9/2009

22 Outline  Model  Language  Natural Language  ER  UML  Logic  Using Languages  Specification & Automation  Services  Using logics First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

23 First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang Uses of Data Representation Languages  The two purposes in modeling: Specification and Automation (Automated Reasoning)  Specification: representation of the problem at the proper level of abstraction  Allow informal/formal syntax and informal/formal semantics.  Automated Reasoning: computing consequences or properties of the chosen specifications.  Requires formal semantics. 9/2009

24 First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang Why Natural Languages?  Used as informal specification  often used at the very beginning of problem solving, when we need a direct, “flexible”, well-understood language and the problem is still largely unclear  semantics is informal, largely ambiguous  Pragmatically inefficient for automation 9/2009

25 First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang Why Diagrams?  Used to provide more structured/organized specification than natural languages  Informal/formal syntax (depends on the kind of diagram)  Informal semantics  Largely structured and organized; usually used better in representation with unified languages.  When things are non-trivial  More precision Example: NL to UML  Pragmatically inefficient for automation 9/2009

26 First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang  Used as formal specification languages  formal syntax, formal semantics  well-understood  Used as (formal) languages for automation  “reasoning services” (see the next slides)  Pragmatically efficient for automation exploiting the explicitly codified semantics. Why Logic? 9/2009

27 Informal and Formal specification tradeoff  The more you specify, the more cost grows (e.g., man power) First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang Cost & Precision of specification Natural Language Diagram Logics Formalization 9/2009

28 Outline  Model  Language  Natural Language  ER  UML  Logic  Using Languages  Specification & Automation  Services  Using logics First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

29 First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang Logics  A logic is a representation language with  a formal syntax;  a formal semantics. … any language (eg., using mathematical notation, textual, graphical, …)  As formal languages, logics are suitable for representing (specification) of and reasoning (automation) about data and knowledge. 9/2009

30 First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang Logics for Specification  Logic as a formal language: is good for the specification (representation) of knowledge.  it provides a formal syntax.  Starting from a precise syntax logic provides a formal (i.e., unambiguous) semantics.  Logic as a formal semantics: is good for specification of declarative data and knowledge (as different from programs). The meaning of sentences is declaratively defined, i.e. with logic we describe what holds without caring about how it can be computed. 9/2009

31 First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang Logics for Reasoning  Logics provides a notion of deduction (axioms, deductive machinery, theorem) that can be used to implement “reasoners” which allow to infer conclusions from a given knowledge base (i.e, a set of “premises”, premises can be axioms or theorems).  From implicit knowledge to explicit knowledge. 9/2009

32 Outline  Model  Language  Natural Language  ER  UML  Logic  Using Languages  Specification & Automation  Services  Using logics First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

33 First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang Logics for Automated Reasoning  Recall the MB story… MonkeyHigh  BananaHigh  MonkeyGetBanana MonkeyLow  BoxLow  MonkeyCanClimbBox MonkeyCanClimbBox  MonkeyClimbBox  MonkeyHigh MonkeyLow   MonkeyClimbBox  BananaHigh   MonkeyGetBanana 9/2009

34 Tools for Automated Reasoning  SAT  Description Logic reasoners  LCF (Robin Milner @ Edinburgh & Stanford)  Prover9 (William McCune)  … many many others ….  To list updated automated reasoning tools First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

35 First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang Reasoning Services (1)  The basic reasoning tasks (or “services”) we would like to compute are the following:  Model Checking (EVAL): Is a sentence ψ true in model M?  Satisfiability (SAT): Is there a model M where ψ is true?  Validity(VAL): Is ψ true according to all possible models M?  Entailment(ENT): ψ1 true in M (all models) implies ψ 2 is true in M (all models). 9/2009

36 EVAL  Is a sentence ψ true according to a model M? Given that ∆ ={T,F},and MonkeyHigh  BananaHigh  MonkeyGetBanana MonkeyLow  BoxLow  MonkeyCanClimbBox MonkeyCanClimbBox  MonkeyClimbBox  MonkeyHigh MonkeyLow   MonkeyClimbBox  BananaHigh   MonkeyGetBanana And a model M MonkeyLow=TMonkeyClimbBox=F BananaHigh=TBoxLow=T  Evaluate whether  ψ 1 = MonkeyCanClimbBox is true  ψ 2 = MonkeyGetBanana is false. First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

37 SAT  Is there existing model M that is ψ true? Given that ∆ ={T,F}, ψ = MonkeyGetBanana MonkeyHigh  BananaHigh  MonkeyGetBanana MonkeyLow  BoxLow  MonkeyCanClimbBox MonkeyCanClimbBox  MonkeyClimbBox  MonkeyHigh MonkeyLow   MonkeyClimbBox  BananaHigh   MonkeyGetBanana Look for a model M MonkeyLow=TMonkeyClimbBox=T BananaHigh=TBoxLow=T Where ψ = MonkeyGetBanana is true. First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

38 VAL  Is a sentence ψ true according to every possible model M? Given a theory as MonkeyHigh  BananaHigh  MonkeyGetBanana MonkeyLow  BoxLow  MonkeyCanClimbBox MonkeyCanClimbBox  MonkeyClimbBox  MonkeyHigh MonkeyLow   MonkeyClimbBox  BananaHigh   MonkeyGetBanana ψ 1 = MonkeyGetBanana is true for the model in the previous slide; First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

39 ENT Given a theory as MonkeyHigh  BananaHigh  MonkeyGetBanana MonkeyLow  BoxLow  MonkeyCanClimbBox MonkeyCanClimbBox  MonkeyClimbBox  MonkeyHigh MonkeyLow   MonkeyClimbBox  BananaHigh   MonkeyGetBanana  ψ 1 = BoxLow  MonkeyClimbBox  ψ 2 = MonkeyGetBanana  We have ψ 1 entails ψ 2. First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

40 First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang Reasoning Services (2)  Other services: consistency subsumption, instance checking, equivalence, concept coherence,...  NB: not all reasoning services are provided by a single logic (e.g., instance checking). 9/2009

41 Outline  Model  Language  Natural Language  ER  UML  Logic  Using Languages  Specification & Automation  Services  Using logics First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

42 First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang What does a logic allow to do?  To specify the knowledge formally  To derive new knowledge automatically  Must be efficient 9/2009

43 The thread of the logics (substitute)  Syllogism and Class?  PL  FOL  MLs,DefL,DLs  OWL  CxL  C-OWL SyllogismClassification PLFOL MLs Syllogism Definition L??? DLsOWL CxLC-OWL We will see all these in this course First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009

44 E-R Semantics (Exercise)  Complete the definition of the formal, set-theoretic semantics for the E-R schema given in the foregoing example.  Represent the formal semantics of the previous slide informally by using natural language (English). First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang 9/2009


Download ppt "Logics for Data and Knowledge Representation Languages for Data Representation First version by Alessandro Agostini and Fausto Giunchiglia Second version."

Similar presentations


Ads by Google