Download presentation

Presentation is loading. Please wait.

Published byRyan Stickel Modified over 3 years ago

1
DK R 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
2 Outline Key notions Model Language Natural Language ER UML Formal models Using Languages: Specification & Automation Theory: data and knowledge

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

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

5
5 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 Language KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

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

7
Syntax and Semantics 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 syntactic constructs (expressions), that is, the relationship between syntactic constructs and the elements of some universe of meanings (the intended model). Such relationship is called interpretation. KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

8
Example of Syntax and Semantics Suppose we want to represent the fact that Mary and Sara are near each other. ENGLISH Mary is near Sara. formal syntax, informal semantics ‘SYMBOLIZED’ ENGLISH near(M,S) near(Mary, Sara) formal syntax, informal semantics LOGICS with an interpretation function I “near” by I means near as spatial relation “M” by I means Mary the girl “S” by I means Sara the girl formal syntax, formal semantics KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

9
9 Formal vs. Informal languages 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. KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

10
Levels of Formalization Logics Diagrams NL Programming Languages English Italian Russian Hindi... ER UML... SQL... PL FOL DL... Both Syntax and Semantics can be formal or informal. Level 1 Level n FORMALITY informal semi-formal formal 10 KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

11
11 Natural Language 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? KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

12
12 Possible mental models “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 KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

13
13 E-R Schemas 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 RelationAttribute KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

14
14 The E-R Constructs (1) 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. 14 Monkey Climb Height KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

15
15 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. MonkeyBox Climb 0..10..n Banana Height KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

16
16 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. E E1E1 EiEi EnEn Animal Monkey Dog Tiger KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

17
17 Example of Monkey and Bananas in ER Monkey Banana Box Climb 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 Get Height KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

18
18 UML (Unified Modeling Language) 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 well as the E-R schemas. KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

19
19 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. Class A Attribute Method Class B Attribute Method 1 0..* KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

20
20 Example of Monkey and Bananas in UML Monkey Height … Box Height … Banana Height … Climb 1 0..1 Get 1 0..* 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 KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

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

22
22 Logic 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 Language L = {A, , , } Domain D = {T, F} or D’ = {o 1, …, o n } 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 KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

23
23 Formal Extensional Model A (formal) model is an abstraction of a part of the world An extensional model is a triple M = 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 = 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 KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

24
24 Example of a formal (extensional) model 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) = { } I (Gets) = { } Cita B1B2B3 box1 box2 KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

25
25 Formal Intensional Model A (formal) model is an abstraction of a part of the world An intensional model is a pair M = 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 KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

26
26 Example of a formal (intensional) model 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 Cita B1B2B3 box1 box2 PROPOSITION KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

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

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

29
29 Why Natural Languages? Used forAdvantagesDisadvantages For 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 Useful to interact with users Semantics is informal, largely ambiguous Pragmatically inefficient for automation KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

30
30 Why Diagrams? Used forAdvantagesDisadvantages To provide more structured and organized specification than natural languages Informal/formal syntax (depends on the kind of diagram) Largely structured and organized; usually used in representation with unified languages when things are non-trivial or more precision is required w.r.t. Natural Language Useful to interact with users Semantics is informal, largely ambiguous Pragmatically inefficient for automation KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

31
31 Why Logic? Used forAdvantagesDisadvantages Formal specification Automation Well-understood with formal syntax and formal semantics: we can better specify and prove correctness Pragmatically efficient for automation exploiting the explicitly codified semantics: r easoning services It cannot be used to interact with users An exponential grow in cost (computational, man power) KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

32
32 Logics, formal syntax and formal semantic 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) about data and knowledge. KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

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

34
34 Specification / Representation 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 KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

35
35 Logics for Reasoning 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 KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

36
36 Reasoning / Automation 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 KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

37
Theory, data and knowledge 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. KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

38
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) Data in the Example GIRL Mary Julie Sara KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

39
Knowledge in the Example 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) GIRL PLAY KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

40
Data vs. Knowledge in different aspects 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) KEY NOTIONS :: MODEL :: LANGUAGE :: FORMAL MODELS :: SPECIFICATION & AUTOMATION :: THEORY

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
42 Appendix: Greek letters Αα Alpha Νν Nu Ββ Beta Ξξ Xi Γγ Gamma Οο Omicron Δδ Delta Ππ Pi Εε Epsilon Ρρ Rho Ζζ Zeta Σσς Sigma Ηη Eta Ττ Tau Θθ Theta Υυ Upsilon Ιι Iota Φφ Phi Κκ Kappa Χχ Chi Λλ Lamdba Ψψ Psi Μμ Mu Ωω Omega

Similar presentations

OK

CS 330 Programming Languages 09 / 18 / 2007 Instructor: Michael Eckmann.

CS 330 Programming Languages 09 / 18 / 2007 Instructor: Michael Eckmann.

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on content development tools Ppt on automobile related topics such Ppt on understanding marketing management Ppt on do's and don'ts of group discussion techniques Ppt on l&t finance share value Ppt on human chromosomes Ppt on marie curie timeline Ppt on power line carrier communication pdf Ppt on astronomy and astrophysics letters Ppt on safe drinking water