KRR: FOL modelling and fragments of FOL
Artificial Intelligence ChallengeDéfi IA – ICM 2A19th March 2021
1
Outline
• Overview of online resources:https://www.emse.fr/~zimmermann/Teaching/KRR/
• Problem of reasoning in FOL• Decidable subsets of FOL: Datalog & Description Logics• Modelling tabular data• Graph-based knowledge representation
2
Reasoning with FOL: all valid formulas are provable• Gödel’s completeness theorem establishes that:“If a FOL formula is logically valid, then there exists a finite proof of the formula”• This justifies the search for algorithms that automate determining
whether a formula is valid (a tautology) or not.
3
Reasoning with FOL: resolution
Reminder from 1st year course:• Resolution is an algorithm to decide if a FOL formula is consistent• Steps:
1. Put the formula in prenex normal form (quantifiers at the beginning)2. Put the formula in Skolem normal form (remove existential quantifiers)3. Put the formula in conjunctive normal form (conjunctions of disjunctions)4. Apply resolution on unifiable literals
4
Problem with FOL reasoning
• Define a non-empty, transitive, and irreflexive relation:
…
• Is the formula consistent? • Try to determine this using resolution.
5
Problem with FOL reasoning
• Define a non-empty, transitive, and irreflexive relation:
… x y z t u (R(x,y) R(y,z) → R(x,z)) ¬R(t,t) R(t,u)
• Is the formula consistent? YES!• Try to determine this using resolution. It never ends!
6
Problem with FOL reasoning
• FOL is semi-decidable• There are algorithms that:
• can always prove that a valid formula is valid,• never say that an invalid formula is valid• BUT there will always be formulas that are invalid (not tautologies) for which
the algorithm does not answer (for instance, run forever).
7
Ensuring decidability: define FOL fragments
• Examples of FOL fragments that are decidable:• Datalog (used in deductive databases)• Description logics (used in the Web Ontology Language)
8
Datalog
• No function symbol is allowed (terms can only be variables or constants)
• Formulas are closed FOL formula of the form:• P(c1, …, cn) where P is an n-ary predicate and c1, ..., cn are constants, or• x1 … xk A1 … Ap → Ap+1 with p > 0 and A1, … , Ap+1 are atoms such that
the variables appearing in Ap+1 also appear in some of the A1, …, Ap
• Formulas of the 1st type are called facts (correspond to tuples, or rows in relational databases)
• Formulas of the 2nd type are called rules (used to deduce more tuples from known facts)
9
Modelling tabular data in FOL: first approach
• Each table corresponds to a predicate• The arity of the predicate is the number of columns• Each row corresponds to an atom• The value of a cell is a constant• The values of the cells of a row, in the order of the table columns,
correspond to the arguments of the predicate in the atom• The datatype of a column corresponds to a unary predicate• If a table T has n columns with datatypes D1, …, Dn, then add the following
FOL formula:x1 … xn T(x1, …, xn) → D1(x1) … Dn(xn)
10
Modelling tabular data in FOL: example 1
First name (String) Last name (String) Age (Integer) Deceased (Boolean) Gender (“F” or “M”)
Pedro Almodovar 70 false M
Akira Kurosawa 88 true M
Steven Spielberg 73 false M
Sofia Coppola 48 false F
Jane Campion 65 false F
11
Director("Pedro", "Almodovar", 70, false, "M")
Director("Akira", "Kurosawa", 88, true, "M")
Director("Steven", "Spielberg", 73, false, "M")
Director("Sofia", "Coppola", 48, false, "F")
Director("Jane", "Campion", 65, false, "F")
Table: Director
Modelling tabular data in FOL: example 1
First name (String) Last name (String) Age (Integer) Deceased (Boolean) Gender (“F” or “M”)
Pedro Almodovar 70 false M
Akira Kurosawa 88 true M
Steven Spielberg 73 false M
Sofia Coppola 48 false F
Jane Campion 65 false F
12
x1 x2 x3 x4 x5 Director(x1, x2, x3, x4, x5) → String(x1) String(x2) Integer(x3) Boolean(x4) F-or-M(x5)
Table: Director
Modelling tabular data in FOL: 2nd approach
• Each table corresponds to a unary predicate• The value v of a primary key in a row of a table T defines a constant
vT such that the atom T(vT) holds• In a row of a table T1, with primary key v, if there is a foreign key
column Cfk with value w referring to table T2, then the atom Cfk(vT1, wT2) holds
• Non-foreign key attributes become constants• In a row of a table T, with primary key v, if there is a non-foreign key
column C with value w, then the atom C(vT1, w) holds• For all column C with datatype D, the following formula holds:
x y C(x, y) → D(y)13
Modelling tabular data in FOL: example 2
14
Movie ID Title (String) DirectedBy Date (Integer)
tt0287467 Hable con ella nm0000264 2002
tt0083866 E.T. the Extra-Terrestrial nm0000229 1982
tt0047478 七人の侍 nm0000041 1954
tt0335266 Lost in Translation nm0001068 2003
tt0107822 The Piano nm0001005 1993
Table: Movie
Movie(tt0287467)Title(tt0287467, "Hable con ella")DirectedBy(tt0287467, nm0000264)Date(tt0287467, 2002)
x y Title(x, y) → String(y)x y Date(x, y) → Integer(y)
Ensuring decidability: Description Logics
• It is very common to describe things in terms of classes and their instances and the binary relations between things
• E.g., UML diagrams
15
employedBy
CompanyEmployee
Description logics: main components
• Classes describe sets of thingsEmployee, Company, Bird, Event, Process, Meeting
Classify things, group things in categories, make hierarchies• Relations describes binary relations
employedBy, parentOf, friendWith, before, owns Relate things to one another, define attributes of things• Instances are individual things
Antoine, IBM, tweety, usPresidentialElection, generalAssembly Instantiate classes, connect to one another via relations, etc.
16
Terminological vocabulary
Assersionalvocabulary
Description logics: formulas
• Description logics (DLs) are a family of logics• The symbols of DLs vary from one description logic to another• Three kinds of formulas are common to all DLs:
• C D where C and D are class names – concept inclusion
• C(a) where C is a class name (also called “atomic concept”) and a is an instance name (also called “individual”) – concept assertion
• R(a, b) where R is a relation name (also called “role”) and a, b are instance names – role assertion
Ex. TBox = {Man Person, Woman Person}ABox = {Man(Stefano), Woman(Erika), marriedTo(Stefano, Erika)}
17
ABox
TBox
Formalising DL semantics
• Interpretations are pairs ℑ = (D, ·ℑ) such that:• D is a non empty set (the domain of interpretation)• ·ℑ is a function from atomic concepts, roles, and individuals
such that:• Aℑ ⊆ D for all atomic concept A• Rℑ ⊆ D×D for all role R• aℑ ∈ D for all individual a
18
Formalising DL semantics
The satisfaction relation ⊨ is defined as follows:• ℑ ⊨ C ⊑ D if and only if Cℑ ⊆ Dℑ
• ℑ ⊨ C(a) if and only if aℑ ∈ Cℑ
• ℑ ⊨ R(a, b) if and only if (aℑ, bℑ) Rℑ
19
Interpreting DL names
• Assume that the universe of discourse is a non-empty set of things D
20
D = the universeof discourse
A thing in the universe
Interpreting DL names
• An individual name corresponds to a thing in the universe, i.e., an element of D
21
Bob
D = the universeof discourse
Interpreting DL names
• The universe may be infinite, so some things may not have a name
22
Bob
D = the universeof discourseunnamed
thing
Interpreting DL names
• An atomic concept (i.e., a class name) corresponds to a set of things in the universe, i.e., a subset of D
23
Bob
D = the universeof discoursePerson
Interpreting DL names
• A role name (also called a relation or property) corresponds to a binary relations over things in the universe, i.e., a subsetof DD
24
Bob
D = the universeof discourse
isCloseTo
Person
Expressing basic knowledge
• In DL, one can express that a thing belong to a class, e.g., Bob is a Person:
• Person(Bob)
25
Bob
D = the universeof discoursePerson
Expressing basic knowledge
• In DL, one can express that two things are in a relationship, e.g., Bob is close to the chair:
• isCloseTo(Bob,chair)
26
Bob
D = the universeof discourse
isCloseTochair
Expressing basic knowledge
• In DL, one can express that all things in a class are also in another class, e.g., all students are people:
• Student ⊑ Person
27
D = the universeof discourse
Student
Person
Modelling in DL
• A Tbox is a class hierarchy or classification systemClassification systems are everywhere!
• An ABox is a directed labelled multigraph:• Nodes are individuals labelled by sets of class names• Directed edges are labelled by roles
• Graphs are everywhere too!
28
Library classification (e.g., Dewey classification)500 Natural sciences and mathematics
510 Mathematics516 Geometry
516.3 Analytic geometries516.37 Metric differential geometries
516.375 Finsler Geometry
31
Classification systems
32
Classification systemsProduct classification (standard, e.g., Globale Product Classification;
or proprietary, e.g., Amazon classification)
Music/film/literary genre classifications
Vehicle classification
Drug classification
Education classification (ISCED)
Object Oriented Programming class hierarchy
Etc…
33
Classification: basic guidelines• A name can only be used for one class (e.g., French can’t be the
class of French cars and the class of French songs)• A word does not necessarily correspond to a class and vice versa• Use consistent naming convention (e.g., capital letters, singular
nouns or noun phrases)• Define classes by analogy: similar structure, similar featuresBinary classification: is / is not (has / has not)
e.g., Motorised vs. NotMotorisedFixed sets classifications:
e.g., FlyingVehicle, GroundVehicle, WaterVehicleClasses for each discrete values
e.g., 1WheeledVehicle, 2WheeledVehicle, 3WheelVehicle, etc.Classes for ranges
e.g., 10to20HorsePower, 20to100HorsePower, etc.
Graph-based knowledge representation
• Social networks (who knows who?)• Scholarly publication (what article cites what?)• Road network (where can I go from where?)• Genealogy, evolution of species• Relational DB: tuples are connected to one another by foreign keys.
It’s a graph!• Hypermedia: The World Wide Web• Everything is connected: a person owns a phone manufactured by a company
located at an address in a region governed by an assembly having meetings at
some times making decisions that etc…
34
Putting everything in the graph
• If classes are entities in the world, and subclass relations are like normal relations, then the class hierarchy can be part of the graph
• Add the instance-of relation• But how to interpret this?
• 1st option: class names and instance names must be disjoint; subclass-of can only be used between classes; instance-of can only be used between an instance and a class; other relations can only be used between instances
• 2nd option: classes are like other entities; they can have all kinds of relations and can themselves be instances of other classes (meta-classes)
• Require different semantics, lead to different reasoning methods
35
Top Related