(06) semantic web technologies - logics

88
Semantic Web Technologies Lecture Dr. Harald Sack Hasso-Plattner-Institut für IT Systems Engineering University of Potsdam Winter Semester 2012/13 Lecture Blog: http://semweb2013.blogspot.com / This file is licensed under the Creative Commons Attribution-NonCommercial 3.0 (CC BY-NC 3.0 ) Dienstag, 20. November 12

Upload: harald-sack

Post on 02-Nov-2014

1.298 views

Category:

Education


3 download

DESCRIPTION

 

TRANSCRIPT

Page 1: (06) Semantic Web Technologies - Logics

Semantic Web Technologies

LectureDr. Harald Sack

Hasso-Plattner-Institut für IT Systems EngineeringUniversity of Potsdam

Winter Semester 2012/13

Lecture Blog: http://semweb2013.blogspot.com/This file is licensed under the Creative Commons Attribution-NonCommercial 3.0 (CC BY-NC 3.0)

Dienstag, 20. November 12

Page 2: (06) Semantic Web Technologies - Logics

Semantic Web Technologies , Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

2 1. Introduction 2. Semantic Web - Basic Architecture

Languages of the Semantic Web - Part 1

3. Knowledge Representation and LogicsLanguages of the Semantic Web - Part 2

4. Applications in the ,Web of Data‘

Semantic Web Technologies Content

Dienstag, 20. November 12

Page 3: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

3

Semantic Web Technologien Wiederholung

Ontolo

gien

last lecture

Dienstag, 20. November 12

Page 4: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

4 3. Knowledge Representation and LogicsThe Languages of the Semantic Web - Part 2

• Excursion: Ontologies in Philosophy and Computer Science

• Recapitulation: Popositional Logic and First Order Logic

• Description Logics

• RDF(S) Semantics• OWL and OWL-Semantics• OWL 2 and Rules

Semantic Web Technologies Content

Dienstag, 20. November 12

Page 5: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

5

Formalization of Ontological Models with Logic

Dienstag, 20. November 12

Page 6: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

6 3.2 Recapitulation: Popositional Logic and First Order Logic3.2.1 Foundations of Logic3.2.2 Modeltheoretic Semantics 3.2.3 Canonical Form 3.2.4 Resolution3.2.5 Properties of PL and FOL

3. Knowledge Representation & Logic3.2 Recapitulation: Popositional Logic and First Order Logic

Dienstag, 20. November 12

Page 7: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam Turmbau zu Babel, Pieter Brueghel, 1563

7

3. Wissensrepräsentationen3.2 Wiederholung Aussagenlogik und Prädikatenlogik

A friend of Einstein‘s, Kurt Gödel found a hole in the center of Mathematics...

Dienstag, 20. November 12

Page 8: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam Turmbau zu Babel, Pieter Brueghel, 1563

8 Foundations of Logic■ we only give a brief recapitulation□ cf. in your bachelor computer science course, etc.■ a fundamental understanding of the principles of logic including propositional logic

and first order logic is mandatory. Please recapitulate for yourself, if necessary...□ see also

U. Schöning: Logik für Informatiker, Spektrum Akademischer Verlag, 5. Aufl. 2000.

3. Knowledge Representation & Logic3.2 Recapitulation: Popositional Logic and First Order Logic

Dienstag, 20. November 12

Page 9: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam Turmbau zu Babel, Pieter Brueghel, 1563

9

Foundations of Logic ■Origin of the term: λογος =[greek] word, study, ...

■Definition (for our lecture):Logic is the study of how to make formal correct deductions and inferences.

■Why „formal logic“?--> automation

■Construction of a calculator machine for logic.

Arbor naturalis et logicalis, ausRaimundus Lullus „Ars Magna“, ca. 1275 AD

Raimundus Lullus(1232-1316)

■ Logic according to Ramon Lull is „the art and the science to distinguish between truth or lie with the help of reason, to accept truth and to reject lie.“

Dienstag, 20. November 12

Page 10: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

10

Gottfried Wilhelm Leibniz (1646-1716)

"... omnes humanas ratiocinationes ad calculum aliqvem characteristicum qvalis in Algebra combinatoriave arte et numeris habetur, revocandi, qvo non tantum certa arte inventio humana promoveri posset, sed et controversiae multae tolli, certum ab incerto distingvi, et ipsi gradus probabilitatum aestimari, dum disputantium alter alteri dicere posset: calculemus."

Leibniz in a letter to Ph. J. Spener, Juli 1687

Foundations of Logic

Dienstag, 20. November 12

Page 11: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

11

Gottfried Wilhelm Leibniz (1646-1716) Leibnitz in einem Brief an Ph. J. Spener, Juli 1687

„alle menschlichen Schlussfolgerungen müssten auf irgendeine mit Zeichen arbeitende Rechnungsart zurückgeführt werden, wie es sie in der Algebra und Kombinatorik und mit den Zahlen gibt, wodurch nicht nur mit einer unzweifelhaften Kunst die menschliche Erfindungsgabe gefördert werden könnte, sondern auch viele Streitigkeiten beendet werden könnten, das Sichere vom Unsicheren unterschieden und selbst die Grade der Wahrscheinlichkeiten abgeschätzt werden könnten, da ja der eine der im Disput Streitenden zum anderen sagen könnte: Lasst uns doch nachrechnen!“

Foundations of Logic

Dienstag, 20. November 12

Page 12: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

12

■ Syntax: symbols without meaning defines rules, how to construct well-formed and valid sequences of symbols (strings)

■ Semantic: meaning of syntax defines rules how the meaning of complex sequences of symbols can be derived from atomic sequences of symbols.

If (i<0) then display (“negatives Guthaben!“)

assignment ofmeaning

Syntax

print the message “negative account!“, ifthe account balance is negative

Foundations of Logic

Dienstag, 20. November 12

Page 13: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

13

Variants of Semantics■ E.g. programming languages

computation of the factorial

intentional semanticsFUNCTION f(n:natural):natural;BEGIN IF n=0 THEN f:=1 ELSE f:=n*f(n-1);END;

• „the meaning intended by the user“• restricts the set of all possible models (meanings)

to the meaning intended by the (human) user

Dienstag, 20. November 12

Page 14: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

14

Syntax

•aims to express the meaning of symbol sequences (programs) in a formal language,in a way that assertions over the symbol sequences (programs) can be proven by the application of deduction rules.

formal semantics

f : n → n!

Variants of Semantics■ E.g. programming languages

computation of the factorial

intentional semanticsFUNCTION f(n:natural):natural;BEGIN IF n=0 THEN f:=1 ELSE f:=n*f(n-1);END;

Dienstag, 20. November 12

Page 15: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

15

Syntax

formal semantics

f : n → n!

behaviour of the program at execution

• the meaning of a language expression (program) is the procedure that takes place internally, whenever the expression does occur.

Variants of Semantics■ E.g. programming languages

computation of the factorial

intentional semanticsFUNCTION f(n:natural):natural;BEGIN IF n=0 THEN f:=1 ELSE f:=n*f(n-1);END;

procedural semantics

Dienstag, 20. November 12

Page 16: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

16

■Model-theoretic semantics performs the semantic interpretation of artificial and natural languages by „identifying meaning with an exact and formally defined interpretation with a model“■= formal Interpretation with a model

■e.g. model-theoretic semantics of propositional logic■ assignment of truth values „true“ and „false“ to

atomic assertions and■description of logical connectives with

truth tables

Alfred Tarski(1901-1983)

Variants of Semantics

Dienstag, 20. November 12

Page 17: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

17 ■Example: the language of arithmetics

■Syntax:■ x+2 ≥ y is a formula■ x2+y≥ is not a formula

■Semantics:■ x+2 ≥ y is true under the interpretation x = 7, y = 1■ x+2 ≥ y is not true under the interpretation

x = 1, y = 7■ Inference/Entailment:

■Gaussian Elimination is an algorithm for arithmetics.

Alfred Tarski(1901-1983)

Model-theoretic Semantics

Dienstag, 20. November 12

Page 18: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

18

How Logic works...

Syntax

■Any logic L:=(S,⊨) consists of a set of assertions S and an entailment relation ⊨

■ Let Φ ⊆ S and φ ∈ S :

■ „ φ is a logical consequence of Φ“ or„from the assertions of Φ follows the assertion φ“

■ If for 2 assertions φ,ψ ∈ S both {φ} ⊨ ψ and {ψ} ⊨ φ, then both assertions φ and ψ are logically equivalent

Φ ⊨ φ

φ≡ψ

Dienstag, 20. November 12

Page 19: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

19

Syntax

Chrysippus of Soli(279-206 BC)

■Already in classical Greek antiquity Stoic philosophers laid the foundations of logic■Chrysippus of Soli developed the first

complete logic calculus based on logical connectives in the 3rd century BC and called it ,grammatical logic‘

Propositional Logic (PL)

Dienstag, 20. November 12

Page 20: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

20■George Boole developed the first algebraic

calculus of logic in his 1847 published„The Mathematical Analysis of Logic“■Boole formalized classical logic and

propositional logic and developed a decision algorithm for true formulas via disjunctive canonical form

George Boole(1815-1864)

Propositional Logic (PL)

Dienstag, 20. November 12

Page 21: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

21■Gottlob Frege formulates the first

calculus for propositional logic with deduction rules whithin the scope of his 1879 published „Begriffsschrift“

Gottlob Frege(1848-1925)

Propositional Logic (PL)

Dienstag, 20. November 12

Page 22: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

22■Bertrand Russel together with Alfred North

Whitehead formulates a calculus for propositional logic in their „Principia Mathematica“ in 1910

Bertrand Arthur William Russell, 3. Earl Russell(1872-1970)

Propositional Logic (PL)

Dienstag, 20. November 12

Page 23: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

23

■ Logical connectives: Op={ ¬,∧,∨,→,↔,(,) }, a set of symbols Σ with Σ∩Op=∅ and {true, false}

■ Production rules for propositional formulae (propositions):■ all atomic formulas are propositions (all elements of Σ)■ if φ is a proposition, then also ¬φ■ if φ and ψ are propositions, then also φ∧ψ, φ∨ψ, φ→ψ, φ↔ψ

■ Priority: ¬ prior to ∧,∨ prior to →, ↔

logical connective Name intentional meaning

⌐ Negation „not“

∧ Conjunction „and“

⋁ Disjunction „or“

→ Implication „if – then“

↔ Equivalence „if, and only if, then“

Propositional Logic (PL)

Dienstag, 20. November 12

Page 24: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

24 • How to model facts?

Simple Assertions ModelingThe moon is made of green cheese gIt rains rThe street is getting wet. n

Composed Assertions Modeling

if it rains, then the street wil get wet. r → n

If it rains and the street does not get wet, then the moon is made of green cheese. (r ∧ ⌐n) → g

Propositional Logic (PL)

Dienstag, 20. November 12

Page 25: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

25■Basic approaches of a generalization of

propositional logic can already be found at Aristotle and his Syllogisms.

First Order Logic (FOL)Aristotle(384-322 BC)

major premise All humans are mortal

minor premise All Greeks are humans

conclusion All Greeks are mortal

subject predicate

major termminor term middle term

Dienstag, 20. November 12

Page 26: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

26■Gottlob Frege develops and formalizes a

first order logic calculus in his 1879 published„Begriffsschrift - eine der arithmetischen nachgebildete Formelsprache des reinen Denkens“

Gottlob Frege(1848-1925)

First Order Logic (FOL)

Dienstag, 20. November 12

Page 27: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

27■Charles Sanders Peirce develops

together with his student O.H. Mitchell (independent from Gottlob Frege) a complete syntax for quantifier logic in today‘s form of notation

Charles Sanders Peirce(1839-1914)

First Order Logic (FOL)

Dienstag, 20. November 12

Page 28: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

28

□Operators as in propositional logic□Variables, e.g., X,Y,Z,…□Constants, e.g., a, b, c, …□Functions, e.g., f, g, h, … (incl. arity)□Relations / Predicates,e.g., p, q, r, … (incl. arity) (∀X)(∃Y) ((p(X)∨ ¬q(f(X),Y))→ r(X))

Quantifier Name Intentional Meaning

∃ Existential Quantifier „it exists“

∀ Universal Quantifier „for all“

First Order Logic (FOL)

Dienstag, 20. November 12

Page 29: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

29 FOL: Syntax■ „correct“ formulation of Terms from Variables, Constants and Functions:□ f(X), g(a,f(Y)), s(a), .(H,T), x_location(Pixel)

■ „correct“ formulation of Atoms from Relations with Terms as arguments

□ p(f(X)), q (s(a),g(a,f(Y))), add(a,s(a),s(a)), greater_than(x_location(Pixel),128)

■ „correct“ formulation of Formulas from Atoms, Operators and Quantifiers:□ (∀Pixel) (greater_than(x_location(Pixel),128) → red(Pixel) )

■ If in doubt, use brackets! ■ All Variables shoul be quantified!

First Order Logic (FOL)

Dienstag, 20. November 12

Page 30: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

30

• How to model facts?■ „All kids love icecream.“

∀X: Child(X) → lovesIcecreme(X)

■ „the father of a person is a male parent.“∀X ∀Y: isFather(X,Y) ↔ (Male(X) ∧ isParent(X,Y))

■ „There are (one or more) interesting lectures.“∃X: Lecture(X) ∧ Interesting(X)

■ „The relation ,isNNeighbor‘ is symmetric.“∀X ∀Y: isNeighbor(X,Y) → isNeighbor(Y,X)

First Order Logic (FOL)

Dienstag, 20. November 12

Page 31: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

31■Example: Relationships

(∀X) ( parent(X) ↔ ( human(X) ∧ (∃Y) parent_of(X,Y) ))

(∀X) ( human(X) → (∃Y) parent_of(Y,X) )

(∀X) (orphan(X) ↔ (human(X) ∧¬(∃Y) (parent_of(Y,X)∧ alive(Y))))

(∀X)(∀Y)(∀Z)(uncle_of(X,Z) ↔ (brother_of(X,Y) ∧ parent_of(Y,Z)) )

Intentional Semantics should be clear...

First Order Logic (FOL)

Dienstag, 20. November 12

Page 32: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

32■Example: Pinguins

( (∀X)( penguin(X) → blackandwhite(X) )

∧ (∃X)( oldTVshow(X) ∧ blackandwhite(X) )

) → (∃X)( penguin(X) ∧ oldTVshow(X) )

Intentional Semantics?

First Order Logic (FOL)

Dienstag, 20. November 12

Page 33: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

33 3.2 Recapitulation: Popositional Logic and First Order Logic3.2.1 Foundations of Logic3.2.2 Modeltheoretic Semantics 3.2.3 Canonical Form 3.2.4 Resolution3.2.5 Properties of PL and FOL

3. Knowledge Representation & Logic3.2 Recapitulation: Popositional Logic and First Order Logic

Dienstag, 20. November 12

Page 34: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

34

PL - Model-theoretic Semantics

30 ■ Interpretation I:Mapping of all atomic propositions to {t,f}.

■ If F is a formula and I an Interpretation, then I(F) is a truth value computed from F and I via truth tables.

I(p) I(q) I(⌐p) I(p⋁q) I(p∧q) I(p→q) I(p↔q)

f f t f t t t

f t t t f t f

t f f t f f f

t t f t t t t

Dienstag, 20. November 12

Page 35: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

3530 ■We write I ⊨ F, if I(F)=w, and call Interpretation I a Model of formula F.

■Rules of Semantics:■ I is model of ¬φ, iff I is not a model of φ■ I is model of (φ∧ψ), iff I is a model of φ AND of ψ■ ...

■Basic concepts:□ tautology□ satisfiable□ refutable□unsatisfiable (contradiction)

PL - Model-theoretic Semantics

Dienstag, 20. November 12

Page 36: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

3630

■Structure:□Definition of a domain D.□Constant symbols are mapped to elements of D.□ Function symbols are mapped to funtions in D.□Relation symbols are mapped to relations over D.

■Then:□Assertions will become elements of D.□Relation symbols with arguments will become true or

false.□ Logical connectives and quantifiers are treated likewise.

FOL - Model-theoretic Semantics

Dienstag, 20. November 12

Page 37: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

3730( (∀X)( penguin(X) → blackandwhite(X) )

∧ (∃X)( oldTVshow(X) ∧ blackandwhite(X) )

) → (∃X)( penguin(X) ∧ oldTVshow(X) )

■ Interpretation I:□ Domain: a set M, containing elements a,b.□ … no constant of function symbols …□ We show: the formula is refutable (i.e. it is not a tautology):

□ If I(penguin)(a), I(blackandwhite)(a), I(oldTVshow)(b), I(blackandwhite)(b) is true ,

I(oldTVshow)(a) and I(penguin)(b) is wrong,□ then formula with Interpretation I is wrong, d.h. I ⊭ F

.

FOL - Model-theoretic Semantics

Dienstag, 20. November 12

Page 38: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

38

Logical Entailment

30■ a theory T is a set of formulas.■ an interpretation I is a model of T,

iff I ⊨ G for all formulas G in T.

■ a formula F is a logical consequence from T, iff all models of T are also models of F.

■ then we write T ⊨ F.

■ two formulas F,G are called logically equivalent, iff {F} ⊨ G and {G} ⊨ F.

■ then we write F ≡ G

Theory ≣ Knowledge Base

Dienstag, 20. November 12

Page 39: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

39

Logical Entailment

30■ a theory T is a set of formulas.■ an interpretation I is a model of T,

iff I ⊨ G for all formulas G in T.

■ a formula F is a logical consequence of T, iff all models of T are also models of F.

■ then we write T ⊨ F.

■ two formulas F,G are called logically equivalent, iff {F} ⊨ G and {G} ⊨ F.

■ then we write F ≡ G

Theory ≣ Knowledge Base

Dienstag, 20. November 12

Page 40: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

4030

DeMorgans‘ Laws

F ∧ G ≡ G ∧ FF ∨ G ≡ G ∨ F

F → G ≡ ¬F ∨ GF ↔ G ≡ (F → G) ∧ (G → F)

¬(F ∧ G) ≡ ¬F ∨ ¬G¬(F ∨ G) ≡ ¬F ∧ ¬G

¬¬F ≡ F

F ∧ t ≡ F F ∧ f ≡ f F ∨ t ≡ t F ∨ f ≡ F

F ∨ (G ∧ H) ≡ (F ∨ G) ∧ (F ∨ H)F ∧ (G ∨ H) ≡ (F ∧ G) ∨ (F ∧ H)

¬(∀X) F ≡ (∃X) ¬F¬(∃X) F ≡ (∀X) ¬F

(∀X)(∀Y) F ≡ (∀Y)(∀X) F(∃X)(∃Y) F ≡ (∃Y)(∃X) F

(∀X) (F ∧ G) ≡ (∀X) F ∧ (∀X) G(∃X) (F ∨ G) ≡ (∃X) F ∨ (∃X) G

F ∧ ¬F = f F ∨ ¬F = t

Augustus De Morgan(1806-1871)

Logical Equivalences

Dienstag, 20. November 12

Page 41: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

4130

Commutativity and Quantifiers

(∀X)(∀Y) F ≡ (∀Y)(∀X) F(∃X)(∃Y) F ≡ (∃Y)(∃X) F

■Quantifiers (of the same sort) are commutative

■But

■Example:■ (∃x)(∀y): loves(x,y)

„There exists somebody, who loves everybody.“■ (∀y)(∃x): loves(x,y)

„Everybody is loved by somebody.“

(∃X)(∀Y) F ≢ (∀Y)(∃X) F

Dienstag, 20. November 12

Page 42: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

42 3.2 Recapitulation: Popositional Logic and First Order Logic3.2.1 Foundations of Logic3.2.2 Modeltheoretic Semantics 3.2.3 Canonical Form 3.2.4 Resolution3.2.5 Properties of PL and FOL

3. Knowledge Representation & Logic3.2 Recapitulation: Popositional Logic and First Order Logic

Dienstag, 20. November 12

Page 43: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

43

Canonical Form (Normal Form)

30

■ For every formula there exist infinitely many logically equivalent formulas.

F ∧ G ≡ G ∧ FF ∨ G ≡ G ∨ F

F → G ≡ ¬F ∨ GF ↔ G ≡ (F → G) ∧ (G → F)

¬(F ∧ G) ≡ ¬F ∨ ¬G¬(F ∨ G) ≡ ¬F ∧ ¬G

¬¬F ≡ FF ∨ (G ∧ H) ≡ (F ∨ G) ∧ (F ∨ H)F ∧ (G ∨ H) ≡ (F ∧ G) ∨ (F ∧ H)

¬(∀X) F ≡ (∃X) ¬F¬(∃X) F ≡ (∀X) ¬F

(∀X)(∀Y) F ≡ (∀Y)(∀X) F(∃X)(∃Y) F ≡ (∃Y)(∃X) F

(∀X) (F ∧ G) ≡ (∀X) F ∧ (∀X) G(∃X) (F ∨ G) ≡ (∃X) F ∨ (∃X) G

Dienstag, 20. November 12

Page 44: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

4430

■ For all of these Equivalence Classes one designates a most simple and unique representative.

■ The representatives are called Canonical Forms or Normal Forms.

■Simple example:□we write ¬F instead of ¬¬¬¬¬F

F ∧ G ≡ G ∧ FF ∨ G ≡ G ∨ FF → G ≡ ¬F ∨ GF ↔ G ≡ (F → G) ∧ (G → F)¬(F ∧ G) ≡ ¬F ∨ ¬G¬(F ∨ G) ≡ ¬F ∧ ¬G¬¬F ≡ FF ∨ (G ∧ H) ≡ (F ∨ G) ∧ (F ∨ H)F ∧ (G ∨ H) ≡ (F ∧ G) ∨ (F ∧ H)

¬(∀X) F ≡ (∃X) ¬F¬(∃X) F ≡ (∀X) ¬F(∀X)(∀Y) F ≡ (∀Y)(∀X) F(∃X)(∃Y) F ≡ (∃Y)(∃X) F(∀X) (F ∧ G) ≡ (∀X) F ∧ (∀X) G(∃X) (F ∨ G) ≡ (∃X) F ∨ (∃X) G

Canonical Form (Normal Form)

Dienstag, 20. November 12

Page 45: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

4530■ Goal: Transformation of formulas into Clausal form.■ (a∧(b∨¬c)∧(a∨d)) {a,{b,¬c},{a,d}}

■ Required Steps:1.Negation Normal Form

□ move all negations inwards2.Prenex Normal Form

□ move all quantifiers in front3.Skolem Normal Form

□ remove existential quantifiers4.Conjunctive Normal Morm (CNF) = Clausal Form

□ Representation as Conjunction of Disjunctions

(CNF) (Clause)

Canonical Form (Normal Forms)

Dienstag, 20. November 12

Page 46: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

46

Negation Normal Form

30 ■ All negations are moved inwards via the following logical equivalences:

F ↔ G ≡ (F → G)∧(G → F) ¬(F ∧ G) ≡ ¬F ∨ ¬G

F → G ≡ ¬F ∨ G ¬(F ∨ G) ≡ ¬F ∧ ¬G

¬(∀X) F ≡ (∃X) ¬F ¬¬F ≡ F¬(∃X) F ≡ (∀X) ¬F

■ Result:□ Implications and Equivalences are removed□ multiple Negations are removed□ all Negations are placed directly in fron of Atoms

Dienstag, 20. November 12

Page 47: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

4730 ■ Example

( (∀X)( penguin(X) → blackandwhite(X) )

∧ (∃X)( oldTVshow(X) ∧ blackandwhite(X) )

) → (∃X)( penguin(X) ∧ oldTVshow(X) )

is transformed into

¬( (∀X)( ¬penguin(X) ∨ blackandwhite(X) )

∧ (∃X)( oldTVshow(X) ∧ blackandwhite(X) )

) ∨ (∃X)( penguin(X) ∧ oldTVshow(X) )

is transformed into

( (∃X)( penguin(X) ∧ ¬blackandwhite(X) )

∨ (∀X)(¬oldTVshow(X) ∨ ¬blackandwhite(X) )

) ∨ (∃X)( penguin(X) ∧ oldTVshow(X) )

Negation Normal Form

Dienstag, 20. November 12

Page 48: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

4830 ■ Clean up formulas (Quantifiers are bound to different variables).

( (∃X)( penguin(X) ∧ ¬blackandwhite(X) )

∨ (∀X)( ¬oldTVshow(X) ∨ ¬blackandwhite(X) )

) ∨ (∃X)( penguin(X) ∧ oldTVshow(X) )

is transformed into

( (∃X)( penguin(X) ∧ ¬blackandwhite(X) )

∨ (∀Y)( ¬oldTVshow(Y) ∨ ¬blackandwhite(Y) )

) ∨ (∃Z)( penguin(Z) ∧ oldTVshow(Z) )

Prenex Normal Form

Dienstag, 20. November 12

Page 49: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

4930■ Then put all Quantifiers from Negation Normal Form in front

( (∃X)( penguin(X) ∧ ¬blackandwhite(X) )

∨ (∀Y)( ¬oldTVshow(Y) ∨ ¬blackandwhite(Y) )

) ∨ (∃Z)( penguin(Z) ∧ oldTVshow(Z) )

is transformed into

(∃X)(∀Y)(∃Z)( ( penguin(X) ∧ ¬blackandwhite(X) )

∨ ( ¬oldTVshow(Y) ∨ ¬blackandwhite(Y) ) )

∨ ( penguin(Z) ∧ oldTVshow(Z) )

Prenex Normal Form

Dienstag, 20. November 12

Page 50: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

5030

■ remove existential quantifiers

(∃X) (∀Y) (∃Z) ( ( penguin(X) ∧ ¬blackandwhite(X) )

∨ ( ¬oldTVshow(Y) ∨ ¬blackandwhite(Y) ) )

∨ ( penguin(Z) ∧ oldTVshow(Z) )

is transformed into

(∀Y)( ( penguin(a) ∧ ¬blackandwhite(a) )

∨ ( ¬oldTVshow(Y) ∨ ¬blackandwhite(Y) ) )

∨ ( penguin( f(Y) ) ∧ oldTVshow( f(Y) ) )

■ where a and f are new symbols (so called Skolem Constant or Skolem Function).

Skolem Normal Form

Dienstag, 20. November 12

Page 51: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

5130

■ How To:1.Remove Existential Quantifiers from left to right.2. If there is no Universal Quantifier left of the existential

quantifier to be removed, then the according variable is substituted by a new Constant Symbol.

3. If there are n Universal Quantifiers left of the existential quantifier to be removed, then the according variable is substituted with a new Function Symbol with arity n, whose arguments are exactely the Variables of the n Universal Quantifiers sind.

Skolem Normal Form

Dienstag, 20. November 12

Page 52: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

5230■ remove existential quantifiers

(∃X) (∀Y) (∃Z) ( ( penguin(X) ∧ ¬blackandwhite(X) )

∨ ( ¬oldTVshow(Y) ∨ ¬blackandwhite(Y) ) )

∨ ( penguin(Z) ∧ oldTVshow(Z) )

is transformed into

(∀Y)( ( penguin(a) ∧ ¬blackandwhite(a) )

∨ ( ¬oldTVshow(Y) ∨ ¬blackandwhite(Y) ) )

∨ ( penguin( f(Y) ) ∧ oldTVshow( f(Y) ) )

■ where a and f are new symbols (so called Skolem Constant or Skolem Function).

Skolem Normal Form

Dienstag, 20. November 12

Page 53: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

5330

Conjunctive Normal Form(Clausal Form)■ There are only Universal Quantifiers, therefore we can also

remove them:

( penguin(a) ∧ ¬blackandwhite(a) )

∨ ( ¬oldTVshow(Y) ∨ ¬blackandwhite(Y) ) )

∨ ( penguin(f(Y)) ∧ oldTVshow(f(Y))

■ With the help of logical equivalences the formula is now transfomed into a Conjunction of Disjunctions.

F ∨ (G ∧ H) ≡ (F ∨ G) ∧ (F ∨ H)F ∧ (G ∨ H) ≡ (F ∧ G) ∨ (F ∧ H)

Dienstag, 20. November 12

Page 54: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

5430

(penguin(a) ∧ ¬blackandwhite(a) )

∨ ( ¬oldTVshow(Y) ∨ ¬blackandwhite(Y) )

∨ ( penguin(f(Y)) ∧ oldTVshow(f(Y))

is transformed into ( penguin(a)∨¬oldTVshow(Y)∨¬blackandwhite(Y)∨penguin(f(Y)) )

∧ ( penguin(a)∨¬oldTVshow(Y)∨¬blackandwhite(Y)∨oldTVshow(f(Y)) )

∧ ( ¬blackandwhite(a)∨¬oldTVshow(Y)∨¬blackandwhite(Y)∨penguin(f(Y)) )

∧ ( ¬blackandwhite(a)∨¬oldTVshow(Y)∨¬blackandwhite(Y)∨oldTVshow(f(Y)) )

is transformed into{ {penguin(a),¬oldTVshow(Y),¬blackandwhite(Y),penguin(f(Y))}, {penguin(a),¬oldTVshow(Y),¬blackandwhite(Y),oldTVshow(f(Y))}, { ¬blackandwhite(a),¬oldTVshow(Y),¬blackandwhite(Y),penguin(f(Y))}, {¬blackandwhite(a),¬oldTVshow(Y),¬blackandwhite(Y),oldTVshow(f(Y))} }

Conjunctive Normal Form(Clausal Form)

Dienstag, 20. November 12

Page 55: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

5530

Properties of Canonical Forms

■ Let F be a formula,■ G is the Prenex Normal Form of F,■ H is the Skolem Normal Form of G, ■ K is the Clausal Form of H.

■ Then F ≡ G and H ≡ K but usually F ≢ K.

■ Nevertheless it holds, that□ F is not satisfiable (a contradiction),

if K is a contradiction.(Foundation of the Resolution)

Dienstag, 20. November 12

Page 56: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

5630

Skolemnization is not a Logical Equivalence■ The formula (∃x) p(x) ∨ ¬(∃x) p(x) is a tautology.

■ Negation Normal Form: (∃x) p(x) ∨ (∀x) ¬p(x)

■ Prenex Normal Form: (∃x) (∀y) (p(x) ∨ ¬p(y))

■ Skolem Normal Form: (∀y) (p(a) ∨ ¬p(y))

■ logical equivalent to: p(a) ∨ ¬(∃y) p(y)

■ The resulting formula is not a tautology■ e.g. with Interpretation I □ I(p(a)) = f

□ I(p(b)) = t

Dienstag, 20. November 12

Page 57: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

57

3.2 Recapitulation: Popositional Logic and First Order Logic3.2.1 Foundations of Logic3.2.2 Modeltheoretic Semantics 3.2.3 Canonical Form 3.2.4 Resolution3.2.5 Properties of PL and FOL

3. Knowledge Representation & Logic3.2 Recapitulation: Popositional Logic and First Order LogicDienstag, 20. November 12

Page 58: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

5830

A Calculator Machine for Logic■ Recall:■ A formula F is a logical consequence of a

theory/knowledge base T, if all models of T are also models of F.

■ Problem: ■How do I work with all possible Interpretations in practice?

■ Therefore, logical consequence is implemented via

syntactical methods (= Calculus).■Correctness: every syntactic entailment is also a semantic

entailment, if T ⊢ F then T ⊨ F

■Completeness: all semantic entailments are also syntactic entailments, if T ⊨ F then T ⊢ F

Gottfried Wilhelm Leibniz (1646-1716)

Dienstag, 20. November 12

Page 59: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

5930■We distinguish:■Decision Procedures (Decidability)■ Input: {φ1,..., φn} and assertion φ■Output: ■ „Yes“, if assertions φ exists with {φ1,..., φn} ⊨ φ■ „No“, otherwise.

■Enumeration Procedures (Semi Decidability)■ Input: {φ1,..., φn}■Output:

■ assertions φ with {φ1,..., φn} ⊨ φ

A Calculator Machine for Logic

Dienstag, 20. November 12

Page 60: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

6030

Resolution

{F1,…,Fn} with F0 as logical Consequence

{F1,…,Fn} ⊨ F0

F1 ∧… ∧ Fn → F0 is a tautology¬(F1 ∧… ∧ Fn → F0) is a contradiction

G1 ∧ …∧ Gk is a contradiction

□ The resolution procedure allows the entailment of a contradictionfrom G1 ∧ …∧ Gk.

Theory

equi

vale

nt a

sser

tions

John Alan Robinson, "A Machine-Oriented Logic Based on the Resolution Principle", Communications of the ACM, 5:23–41, 1965.

John Alan Robinson (*1930)

Dienstag, 20. November 12

Page 61: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

6130

Resolution (Propositional Logic)

■ If (p1∨…∨pk∨p∨¬q1∨…∨¬ql)∧(r1∨…∨rm∨¬p∨¬s1∨…∨¬sn) is true, then:

■ One of both p, ¬p has to be wrong.

■ Therefore: One of the other Literals must be true, i.e. p1∨…∨pk∨¬q1∨…∨¬ql∨r1∨…∨rm∨¬s1∨…∨¬sn

must be true.

■ Therfore: If p1∨…∨pk∨¬q1∨…∨¬ql∨r1∨…∨rm∨¬s1∨…∨¬sn is a contradiction, then(p1∨…∨pk∨p∨¬q1∨…∨¬ql)∧(r1∨…∨rm∨¬p∨¬s1∨…∨¬sn)is also a contradiction.

Dienstag, 20. November 12

Page 62: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

6230 (p1∨…∨pk∨p∨¬q1∨…∨¬ql) (r1∨…∨rm∨¬p∨¬s1∨…∨¬sn)

p1∨…∨pk∨¬q1∨…∨¬ql∨r1∨…∨rm∨¬s1∨…∨¬sn

■ two clauses are transformed into a new one

■ End of the resolution procedure:■ If clauses are resolved that cosist only of an atom and the

negated atom, then a new „empty clause“ ⊥ can be resolved.

K2

K3

{K1,K 2} ⊨ K3Resolution step

K1

Resolution (Propositional Logic)

Dienstag, 20. November 12

Page 63: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

6330• How to deduce a contradiction from a set M of clauses:

1.Select two clauses from M and create a new clause K via a resolution step.

2. If K =⊥ , then a contradiction has been found.

3. If K ≠⊥ , K is added to the set M, continue with step 1.

Resolution (Propositional Logic)

• The Resolution Calculus is correct and complete

Dienstag, 20. November 12

Page 64: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

6430 ■ For resolution in First Order Logic additional variable bindings have to be considered with the help of Substitutions

■ e.g. (p(X,f(Y)) ∨ q( f(X),Y)) (¬p(a,Z) ∨ r(Z) )

(q( f(a),Y) ∨ r(f(Y))).

Resolution with [X/a, Z/f(Y)] results in

Resolution (First Order Logic)

Substitutions

Dienstag, 20. November 12

Page 65: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

6530 ■ Unification of Terms■ Given: Literals L1, L2

■ Wanted: Variable substitution σ applied on L1 and L2 results in: L1σ = L2σ

■ If there is such a variable substiution σ, then σ is called Unifier of L1 und L2.

Resolution (First Order Logic)

Dienstag, 20. November 12

Page 66: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

6630 Unification Algorithm■ Given: Literals L1, L2

■ Wanted: Unifier σ of L1 and L2.

1. L1 and L2 are Constants: only unifiable, if L1 = L2 .

2. L1 is Variable and L2 arbitrary Term: unifiable, if for Variable L1 the Term L2 can be substituted and Variable L1 does not occur in L2.

3. L1 and L2 are Predicates or Functions PL1(s1,...,sm) and PL2(t1,...,tn):unifiable, if

1. PL1 = PL2 or

2. n=m and all terms si are unifiable with a term ti

Resolution (First Order Logic)

Dienstag, 20. November 12

Page 67: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

6730 Examples for Unification

L1 L2 σp(X,X) p(a,a) [X/a]p(X,X) p(a,b) n.a.p(X,Y) p(a,b) [X/a, Y/b]p(X,Y) p(a,a) [X/a, Y/a]

p(f(X),b) p(f(c),Z) [X/c, Z/b]p(X,f(X)) p(Y,Z) [X/Y, Z/f(Y)]p(X,f(X)) p(Y,Y) n.a.

Resolution (First Order Logic)

Dienstag, 20. November 12

Page 68: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

6830

Resolution (First Order Logic)

■ For resolution in First Order Logic additional variable bindings have to be considered with the help of Substitutions

■ e.g. (p(X,f(Y)) ∨ q( f(X),Y)) (¬p(a,Z) ∨ r(Z) )

(q( f(a),Y) ∨ r(f(Y))).

Resolution with [X/a, Z/f(Y)] results in

Dienstag, 20. November 12

Page 69: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

6930Example for FOL Resolution:

■ Terminological Knowledge (TBox): (∀X) ( human(X) → (∃Y) parent_of(Y,X) )

(∀X) ( orphan(X) ↔

(human(X) ∧ ¬(∃Y) (parent_of(Y,X) ∧ alive(Y)))

■ Assertional Knowledge (ABox): orphan(harrypotter)

parent_of(jamespotter,harrypotter)

■ Can we deduce: ¬alive(jamespotter)?

Resolution (First Order Logic)

Dienstag, 20. November 12

Page 70: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

7030Example for FOL Resolution:

We have to proof that:

((∀X) ( human(X) → (∃Y) parent_of(Y,X) )

∧ (∀X) (orphan(X) ↔

(human(X) ∧ ¬(∃Y) (parent_of(Y,X) ∧ alive(Y)))

∧ orphan(harrypotter)

∧ parent_of(jamespotter,harrypotter))

→ ¬alive(jamespotter))

is a tautology.

Resolution (First Order Logic)

Dienstag, 20. November 12

Page 71: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

7130 Example for FOL Resolution:We have to proof that:

¬((∀X) ( human(X) → (∃Y) parent_of(Y,X) )

∧ (∀X) (orphan(X) ↔

(human(X) ∧ ¬(∃Y) (parent_of(Y,X) ∧ alive(Y)))

∧ orphan(harrypotter)

∧ parent_of(jamespotter,harrypotter))

→ ¬alive(jamespotter))

ist a contradiction.

Resolution (First Order Logic)

Dienstag, 20. November 12

Page 72: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

7230 Example for FOL Resolution: ■ Prenex Normal Form:

(∀X)(∃Y)(∀X1)(∀Y1)(∀X2)(∃Y2)

(( ¬human(X) ∨ parent_of(Y,X) )

∧ (¬orphan(X1)∨ (human(X1) ∧ (¬parent_of(Y1,X1) ∨ ¬alive(Y1)))

∧ (orphan(X2) ∨ (¬human(X2) ∨ (parent_of(Y2,X2) ∧ alive(Y2)))

∧ orphan(harrypotter)

∧ parent_of(jamespotter,harrypotter))

∧ alive(jamespotter))

Resolution (First Order Logic)

Dienstag, 20. November 12

Page 73: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

7330

( ¬human(X) ∨ parent_of(f(X),X) )

∧ (¬orphan(X1) ∨ human(X1))

∧ (¬orphan(X1) ∨ ¬parent_of(Y1,X1) ∨ ¬alive(Y1))

∧ (orphan(X2) ∨ ¬human(X2) ∨ parent_of(g(X,X1,Y1,X2),X2))

∧ (orphan(X2) ∨ ¬human(X2) ∨ alive(g(X,X1,Y1,X2)))

∧ orphan(harrypotter)

∧ parent_of(jamespotter,harrypotter))

∧ alive(jamespotter)

Example for FOL Resolution: ■ Clausal Form (CNF):

Resolution (First Order Logic)

Dienstag, 20. November 12

Page 74: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

7430

{ {¬human(X), parent_of(f(X),X)},

{¬orphan(X1), human(X1)},

{¬orphan(X1),¬parent_of(Y1,X1),¬alive(Y1)},

{orphan(X2),¬human(X2),parent_of(g(X,X1,Y1,X2),X2)},

{orphan(X2) ,¬human(X2),alive(g(X,X1,Y1,X2))},

{orphan(harrypotter)},

{parent_of(jamespotter,harrypotter)},

{alive(jamespotter)} }

Resolution (First Order Logic)

Example for FOL Resolution: ■ Clausal Form (CNF):

Dienstag, 20. November 12

Page 75: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

7530

1. {¬human(X), parent_of(f(X),X)}2. {(¬orphan(X1), human(X1)}3. {¬orphan(X1), ¬parent_of(Y1,X1),¬alive(Y1))}4. {(orphan(X2), ¬human(X2), parent_of(g(X,X1,Y1,X2),X2)}5. {orphan(X2), ¬human(X2), alive(g(X,X1,Y1,X2))}6. {orphan(harrypotter)}7. {parent_of(jamespotter,harrypotter)}8. {alive(jamespotter)}

9. {¬orphan(harrypotter), ¬alive(jamespotter)} (3,7) [X1/harrypotter, Y1/jamespotter]

Knowledge Base:

Entailed Clauses:

Resolution (First Order Logic)

Example for FOL Resolution:

Dienstag, 20. November 12

Page 76: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

7630

Knowledge Base:

Entailed Clauses:

1. {¬human(X), parent_of(f(X),X)}2. {(¬orphan(X1), human(X1)}3. {¬orphan(X1), ¬parent_of(Y1,X1),¬alive(Y1))}4. {(orphan(X2), ¬human(X2), parent_of(g(X,X1,Y1,X2),X2)}5. {orphan(X2), ¬human(X2), alive(g(X,X1,Y1,X2))}6. {orphan(harrypotter)}7. {parent_of(jamespotter,harrypotter)}8. {alive(jamespotter)}

9. {¬orphan(harrypotter), ¬alive(jamespotter)} (3,7)10. {¬orphan(harrypotter)} (8,9)

Resolution (First Order Logic)

Example for FOL Resolution:

Dienstag, 20. November 12

Page 77: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

7730

Knowledge Base:

Entailed Clauses:

1. {¬human(X), parent_of(f(X),X)}2. {(¬orphan(X1), human(X1)}3. {¬orphan(X1), ¬parent_of(Y1,X1),¬alive(Y1))}4. {(orphan(X2), ¬human(X2), parent_of(g(X,X1,Y1,X2),X2)}5. {orphan(X2), ¬human(X2), alive(g(X,X1,Y1,X2))}6. {orphan(harrypotter)}7. {parent_of(jamespotter,harrypotter)}8. {alive(jamespotter)}

9. {¬orphan(harrypotter), ¬alive(jamespotter)} (3,7)10. {¬orphan(harrypotter)} (8,9)11. ⊥ (6,10)

Resolution (First Order Logic)

Example for FOL Resolution:

Dienstag, 20. November 12

Page 78: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

7830 Properties of FOL Resolution■ Completeness of Refutation□ If resolution is applied to a contradictory set of clauses,

then there exists a finite number of resolution steps to detect the contradiction.

□ The number n of necessary steps can be very large (not efficient)

□ Resolution in FOL is undecidable□ If the set of clauses is not contradictory, then the

termination of the resolution is not guaranteed.

Resolution (First Order Logic)

Dienstag, 20. November 12

Page 79: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

79

3.2 Recapitulation: Popositional Logic and First Order Logic3.2.1 Foundations of Logic3.2.2 Modeltheoretic Semantics 3.2.3 Canonical Form 3.2.4 Resolution3.2.5 Properties of PL and FOL

3. Knowledge Representation & Logic3.2 Recapitulation: Popositional Logic and First Order Logic

Dienstag, 20. November 12

Page 80: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

8030

Properties of FOL

■ Monotony□ If the knowledge base growths, all previously

possible entailments hold.

□ S and T are Theories, with S⊆T

□ Then it holds that {F|S ⊨ F} ⊆ {F|T ⊨ F}

Dienstag, 20. November 12

Page 81: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

8130

■ Compactness□ For each entailment made from a theory, a finite

subset of the theory is sufficient.

■ Semi-decidability□ FOL is not decidable□ But, FOL is semi-decidable, i.e.

a logical consequence T ⊨ F always can be proven in finite time (but not necessarely also T⊭F)

Properties of FOL

Dienstag, 20. November 12

Page 82: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

8230 ■ All properties of FOL hold, including■ Decidability□ All true entailments can be found, and all false

entailments can be refuted, as long as you spent enough time.

■ ⇒ there always exist terminating automatic theorem proofer

■ Useful property:■ {φ1,...,φn} ⊨ φ holds, iff

(φ1 ∧...∧ φn) → φ is a tautology■ The decision, if an assertion is an tautology, can be

made via truth table■ in principle this equals the evaluation of all possible

interpretations

Properties of PL

Dienstag, 20. November 12

Page 83: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

83 3.2 Recapitulation: Popositional Logic and First Order Logic3.2.1 Foundations of Logic3.2.2 Modeltheoretic Semantics 3.2.3 Canonical Form 3.2.4 Resolution3.2.5 Properties of PL and FOL

3. Knowledge Representation & Logic3.2 Recapitulation: Popositional Logic and First Order Logic

Dienstag, 20. November 12

Page 84: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

84 3. Knowledge Representation and LogicsThe Languages of the Semantic Web - Part 2

• Excursion: Ontologies in Philosophy and Computer Science

• Recapitulation: Popositional Logic and First Order Logic

• Description Logics

• RDFS Semantics• OWL and OWL-Semantics• OWL 2 and Rules

Semantic Web Technologies Content

Dienstag, 20. November 12

Page 85: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

85

Descri

ption

Logics

next lecture

Dienstag, 20. November 12

Page 86: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

86

Bibliography

• P. Hitzler, S. Roschke, Y. Sure: Semantic Web Grundlagen, Springer, 2007.

• U. Schöning: Logik für Informatiker, Spektrum Akademischer Verlag, 5. Aufl. 2000.

3. Knowledge Representation & Logic3.2 Recapitulation: Popositional Logic and First Order Logic

Dienstag, 20. November 12

Page 87: (06) Semantic Web Technologies - Logics

Vorlesung Semantic Web, Dr. Harald Sack, Hasso-Plattner-Institut, Universität Potsdam

87 Complementary Bibliography

• A. Doxiadis, C.H. Papadimitriou: Logicomix: eine epische Suche nach der Wahrheit, Atrium Verlag, 2010.

3. Knowledge Representation & Logic3.2 Recapitulation: Popositional Logic and First Order Logic

Dienstag, 20. November 12