1 / 42

Logics for D ata and K nowledge R epresentation

Logics for D ata and K nowledge R epresentation. Languages for Data Representation. Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese. Outline. Key notions Model Language Natural Language ER UML Formal models

taji
Télécharger la présentation

Logics for D ata and K nowledge R epresentation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. Outline • Key notions • Model • Language • Natural Language • ER • UML • Formal models • Using Languages: Specification & Automation • Theory: data and knowledge

  3. Key notions KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY Representation (Abstraction) Modeling MODEL LANGUAGE + THEORY THE WORLD Realization Interpretation Monkey Banana MonkeyEatsBanana Semantic Gap 3

  4. Model for the world KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY A model is an abstraction of a part of the world INDIVIDUAL SET RELATION (e.g. Near, Sister) DOMAIN (e.g. the girls in foreground)

  5. Language KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY • A (usually finite) set of words (the alphabet) and rules to compose them to build “correct sentences” • e.g. Monkey and GetBanana are words • e.g. Monkey  GetBanana is a sentence (rule: A  B) • A tool for codifying our (mental) model (what we have in mind): • Sentences (syntax) with an intended meaning (semantics) • e.g. with the word Monkey we mean

  6. Language and correctness Yes, correct! PARSER s, L No KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY • We need an algorithm for checking correctness of the sentences in a language • We say that a language is decidable if it is possible to create such a tool that in finite time can take the decision

  7. Syntax and Semantics KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY • Syntax: the way a language is written: • Syntax is determined by a set of rules saying how to construct the expressions of the language from the set of atomic tokens (i.e., terms, characters, symbols). • The set of atomic tokens is called alphabet of symbols, or simply the alphabet). • Semantics: the way a language is interpreted: • It determines the meaning of the syntacticconstructs (expressions), that is, the relationship between syntacticconstructs and the elements of some universe of meanings (the intended model). • Such relationship is called interpretation.

  8. Example of Syntax and Semantics KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY • Suppose we want to represent the fact that Mary and Sara are near each other.

  9. Formal vs. Informal languages KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY • Language = Syntax(what we write)+ Semantics(what we mean) • 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 in a language L and the elements of an universe of meanings D is a (mathematical) function I: L  pow(D) • Informal syntax/semantics • the opposite of formal, namely the absence of the elements above.

  10. Levels of Formalization KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY Both Syntax and Semantics can be formal or informal. ProgrammingLanguages Diagrams NL Logics Level1 Leveln PLFOLDL... EnglishItalianRussianHindi... SQL... ERUML... FORMALITY semi-formal informal formal 10

  11. Natural Language KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY • Let us try to recognize relevant entities, relations and properties in the NL text below • The Monkey-Bananas (MB) problem 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?

  12. Possible mental models KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY “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. [...]” NOTE: each picture is a different model

  13. E-R Schemas KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY • Data representation models for databases design under the Entity-Relationship Model [Chen 1976]. • In E-R the “alphabet “ is a set of graphical objects, that are used to construct schemas (the sentences): • Entity (or Class) • Relation (or Association) • Attribute (simple and composed) • … + arrows and various notation Entity Relation Attribute

  14. The E-R Constructs (1) KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY • Entity: class of objects with same properties. These denote/contain individuals • Relation: relations among entities. • Attribute: properties of entities • Entity Identificator: ID which provides unique identification of an entity. Monkey Climb Height 14

  15. 0..1 0..n Climb Monkey Box Height Banana The E-R Constructs (2) KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY • 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.

  16. Animal Dog Monkey Tiger The E-R Constructs (3) KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY • Generalization: logical relationship between an entity E (father entity) and a set of entities E1...Ei...En (child entities). • For each i, E generalizes Ei and Ei specializes E. • Ei is a subset of E (IS-A relation). • Properties of E are also of Ei (inheritance), but not necessarily vice versa. E E1 Ei En

  17. Example of Monkey and Bananas in ER KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY Height Get Banana Climb Monkey Box Height Height The squares represent monkeys, bananas and boxes. The attribute “height” may have either value “high” or “low”. The diamonds “Climb” and “Get” are binary relations. NOTE: here the syntax is formal, semantics is not

  18. UML (Unified Modeling Language) KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY • Representation language to model data, operations, processes, architectures. • From software engineering under the paradigm of object-oriented programming. • UML class diagrams useful in database designas well as the E-R schemas.

  19. UML Class Diagrams KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY 1 0..* • 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.

  20. Example of Monkey and Bananas in UML KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY Get 0..* 1 1 Climb 0..1 A monkey can climb from 0 to 1 box. A monkey can get 0 or more bananas. NOTE: here the syntax is formal, semantics is not

  21. Intensional vs Extensional semantics KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY “Bananas are yellow” “Bananas have a curve shape” “All men are mortal” man  mortal GirlsPlaying = True • Extensional: I provide the objects of the domain corresponding to the proposition “The author of Romeo and Juliet is Shakespeare” author(R&G, Shakespeare) GirlsPlaying = {Mary, Sara, Julie} • Intensional: I can only express the fact that a given proposition is true or false

  22. Logic KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY • Logics has two fundamental components: • L is a formal language • I is an interpretation function which maps sentences into a formal model M (over all possible ones) with a domain D • LanguageL= {A,,,} • Domain D = {T, F} or D’ = {o1, …, on} I: L  D is intensional or I: L  pow(D’) is extensional • Theory • A set of sentences which are true in the language • It can be seen a set of constraints on possible models to filter out all undesired ones

  23. Formal Extensional Model KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY • A (formal) model is an abstraction of a part of the world • An extensional model is a triple M = <D, A, R> • D = domain (a is in D). The set of objects of interest. • A = set of attributes (a has attribute A). Subsets of D. • R = set of relations (a is in relation with b). Subset of Cartesian products A×B, with A and B subsets of D, r = <a, b> is a pair of objects. • In other words, M is an assignment over all possible ones which satisfies the theory T NOTE: we can easily extend to n-ary relations

  24. Example of a formal (extensional) model KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY D = {Cita, box1, box2, B1, B2, B3} L = {Monkey, Banana, High, Box, Climbs, Gets, , , } A = {Monkey, Banana, High, Box} R = {Climbs, Gets} I (Monkey) = {Cita} I (Box) = {box1, box2} I (Banana) = {B1, B2, B3} I (High) = {Cita, B1, B2, B3} I (Climbs) = {<Cita, box2>} I (Gets) = {<Cita, B3>} B1 B2 B3 Cita box1 box2

  25. Formal Intensional Model KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY 25 • A (formal) model is an abstraction of a part of the world • An intensional model is a pair M = <D, P> • D = domain (a is in D). The set of objects of interest. • P = set of propositions (P is true/false). • In other words, M is an assignment over all possible ones which satisfies the theory T NOTE: we do not have relations in intensional models

  26. Example of a formal (intensional) model PROPOSITION KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY D = {T, F} L = {Monkey, Banana, High, Box, Climbs, Gets , , } P(Monkey) = “there exists a monkey” I (Monkey) = T I (Banana) = T I (Box) = T I (High) = T I (Climbs) = T I (Gets) = T B1 B2 B3 Cita box1 box2

  27. Domain = { } , , Monkey Banana Box Attribute = { } Height Relation = { } , Climb Get Formal semantics for diagrams (e.g. E-R) KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY Height Get Banana Climb Box Monkey Height Height The domain contains the instances of the classes here NOTE: We have made both the syntax and the semantics formal

  28. Uses of Data Representation Languages KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY • The two purposes in modeling • Specification: • Representation of the problem at the proper level of abstraction • Allow informal/formal syntaxandinformal/formal semantics • Automated Reasoning (Automation) • Computing consequences or properties of the chosen specifications • It requires formal semantics. • Logics have formal syntax and formal semantics!

  29. Why Natural Languages? KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

  30. Why Diagrams? KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY 30

  31. Why Logic? KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY 31

  32. Logics, formal syntax and formal semantic KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY • A logic is a representation language with • a formal syntax • a formal semantics • Any language can have these characteristics • eg., using mathematical notation, textual, graphical, … • As formal languages, logics are suitable for: • representing (specification) • reasoning (automation) aboutdataandknowledge.

  33. Logics for Specification KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY • Logic as a formal language • is good for the specification (representation) ofknowledge • Logic as a formal semantics • is good for specification ofdeclarative 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.

  34. Specification / Representation KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY MODEL#1 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 34 L = {MonkeyLow, BananaHigh, MonkeyClimbBox, MonkeyGetBanana, , , } T = { (MonkeyLow  BananaHigh  MonkeyGetBanana)  (MonkeyLow  MonkeyClimbBox)  ( MonkeyLow  BananaHigh  MonkeyGetBanana)}

  35. Logics for Reasoning KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY 35 • Logics provides a notion of deduction • axioms, deductive machinery, theorem • Deduction can be used to implement reasoners • Reasoners allow inferring conclusions from a given knowledge base (i.e, a set of “premises”, premises can be axioms or theorems). • From implicit knowledge to explicit knowledge

  36. Reasoning / Automation KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY L = {MonkeyLow, BananaHigh, MonkeyClimbBox, MonkeyGetBanana, , , } T = { (MonkeyLow  BananaHigh  MonkeyGetBanana)  (MonkeyLow  MonkeyClimbBox)  ( MonkeyLow  BananaHigh  MonkeyGetBanana)} MODEL#1 Given that: MonkeyLow = T BananaHigh = T We derive that: MonkeyGetBanana = F

  37. Theory, data and knowledge KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY • Theory: A set of statements which describe the (part of the) world as abstracted in the (mental) model • Data: Factual information from which conclusions may be drawn • Useful irrelevant or redundant facts, which must be processed to be meaningful. • Used as a basis for reasoning, discussion or calculation (Merriam-Webster). • Knowledge: How to use a language to represent and structure the facts. The sum of what is known. Knowledge is data in context, or organized data, or also data in relationship.

  38. Data in the Example Mary Julie GIRL Sara KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY • English: “There are 3 girls playing on the snow. Their names are Mary, Julie and Sara.” • Java: G1 = new Girl(“Mary”); G2 = new Girl(“Julie”); G3 = new Girl(“Sara)”; • Diagram: • FOL: Girl(Mary) Girl(Julie) Girl(Sara)

  39. Knowledge in the Example PLAY GIRL KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY • English “There are 3 girls playing on the snow. Their names are Mary...” • Java Class Girl(String name); G1 = new Girl(“Mary”); G1.Playing(G2); … • Diagram • FOL  x,y Girl(x)  Girl(y)  Play(x,y)

  40. Data vs. Knowledge in different aspects KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY Data • A factual output of physical device • Bare facts • Isolated facts • Direct facts • … Observed Knowledge • Statement on how a class is related to another • Organized facts • Related facts • Processed facts • … Axioms + theorems (inference/deduction/reasoning)

  41. Using logics in practice: a summary • What is a logic for? • Specification • Automation • Why logic? • Advantages of a logical framework: • Precise Syntax • Precise Semantics • Reasoning mechanisms • Which logic? • Tradeoff Expressiveness ↔ Complexity • Different problems, different logics • How to represent?

  42. Appendix: Greek letters 42

More Related