Logics for Data and Knowledge Representation

Slides:



Advertisements
Similar presentations
LDK R Logics for Data and Knowledge Representation Exercises: First Order Logics (FOL) Originally by Alessandro Agostini and Fausto Giunchiglia Modified.
Advertisements

Predicate Logic Colin Campbell. A Formal Language Predicate Logic provides a way to formalize natural language so that ambiguity is removed. Mathematical.
Predicates and Quantifiers
LDK R Logics for Data and Knowledge Representation Modal Logic Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia,
Search in the semantic domain. Some definitions atomic formula: smallest formula possible (no sub- formulas) literal: atomic formula or negation of an.
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse.
Predicates and Quantifiers
Logics for Data and Knowledge Representation Propositional Logic: Reasoning Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto.
LDK R Logics for Data and Knowledge Representation Modeling First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia.
1st-order Predicate Logic (FOL)
LDK R Logics for Data and Knowledge Representation First Order Logics (FOL) Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
First Order Predicate Logic
LDK R Logics for Data and Knowledge Representation Propositional Logic Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia,
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
LDK R Logics for Data and Knowledge Representation Modal Logic Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia,
Logics for Data and Knowledge Representation ClassL (part 1): syntax and semantics.
Bertram Ludäscher Department of Computer Science & Engineering University of California, San Diego CSE-291: Ontologies in Data Integration.
1 Introduction to Abstract Mathematics Chapter 2: The Logic of Quantified Statements. Predicate Calculus Instructor: Hayk Melikya 2.3.
CS6133 Software Specification and Verification
1 Introduction to Abstract Mathematics Predicate Logic Instructor: Hayk Melikya Purpose of Section: To introduce predicate logic (or.
LDK R Logics for Data and Knowledge Representation First Order Logics (FOL) Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto.
LDK R Logics for Data and Knowledge Representation Propositional Logic Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia,
Albert Gatt LIN3021 Formal Semantics Lecture 3. Aims This lecture is divided into two parts: 1. We make our first attempts at formalising the notion of.
First-Order Logic Semantics Reading: Chapter 8, , FOL Syntax and Semantics read: FOL Knowledge Engineering read: FOL.
1 First Order Logic CS 171/271 (Chapter 8) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Logics for Data and Knowledge Representation ClassL (part 1): syntax and semantics.
1 Chapter 2.1 Chapter 2.2 Chapter 2.3 Chapter 2.4 All images are copyrighted to their respective copyright holders and reproduced here for academic purposes.
Lecture 041 Predicate Calculus Learning outcomes Students are able to: 1. Evaluate predicate 2. Translate predicate into human language and vice versa.
1 Section 7.1 First-Order Predicate Calculus Predicate calculus studies the internal structure of sentences where subjects are applied to predicates existentially.
Logics for Data and Knowledge Representation ClassL (part 1): syntax and semantics.
Logics for Data and Knowledge Representation
Chapter 7. Propositional and Predicate Logic
3. The Logic of Quantified Statements Summary
Logics for Data and Knowledge Representation
Knowledge Representation and Reasoning
Logics for Data and Knowledge Representation
Semantics In propositional logic, we associate atoms with propositions about the world. We specify the semantics of our logic, giving it a “meaning”. Such.
Logics for Data and Knowledge Representation
Logics for Data and Knowledge Representation
CS201: Data Structures and Discrete Mathematics I
Logics for Data and Knowledge Representation
Logics for Data and Knowledge Representation
Lesson 5 Relations, mappings, countable and uncountable sets
Logics for Data and Knowledge Representation
Logics for Data and Knowledge Representation
Logics for Data and Knowledge Representation
Logics for Data and Knowledge Representation
Formal Methods in software development
1st-order Predicate Logic (FOL)
Lesson 5 Relations, mappings, countable and uncountable sets
Back to “Serious” Topics…
MA/CSSE 474 More Math Review Theory of Computation
Computer Security: Art and Science, 2nd Edition
Logics for Data and Knowledge Representation
Chapter 7. Propositional and Predicate Logic
Formal Methods in software development
Logics for Data and Knowledge Representation
Predicates and Quantifiers
Logics for Data and Knowledge Representation
Chapter 1: Propositional and First-Order Logic
Logics for Data and Knowledge Representation
CS201: Data Structures and Discrete Mathematics I
Herbrand Semantics Computational Logic Lecture 15
Representations & Reasoning Systems (RRS) (2.2)
Logics for Data and Knowledge Representation
1st-order Predicate Logic (FOL)
Logics for Data and Knowledge Representation
Logics for Data and Knowledge Representation
Presentation transcript:

Logics for Data and Knowledge Representation First Order Logics (FOL) Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese

Outline Introduction Syntax Semantics Reasoning Services Changed 2

INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES Propositions INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES All knowledge representation languages deal with sentences Sentences denote propositions (by definition), namely they express something true or false (the mental image of what you mean when you write the sentence) Logic languages deal with propositions Logic languages have different expressiveness, i.e. they have different expressive power. “All men are mortals” “Obama is the president of the USA”

What we can express with PL and ClassL (I) INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES PL “There is a monkey” Monkey We use Intensional Interpretation: the truth valuation ν of the proposition Monkey determines a truth-value ν(Monkey). ν tells us if a proposition P “holds” or not. ClassL “Fausto is a Professor” Fausto ∈ σ(Professor) We use Extensional Interpretation: the interpretation function σ of Professor determines a class of objects σ(Professor) that includes Fausto. In other words, given x ∈ P: “x belongs to P” or “x in P” or “x is an instance of P” 4

What we can express with PL and ClassL (II) INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES PL Monkey ∧ Banana We mean that there is a monkey and there is a banana. ClassL Monkey ⊓ Banana We mean that there is an x ∈ σ(Monkey) ∩ σ(Banana) 5

What we cannot express in PL and ClassL INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES n-ary relations They express objects in Dn Near(Kimba,Simba) LessThan(x,3) Connects(x,y,z) Functions They return a value of the domain, Dn → D Sum(2,3) Multiply(x,y) Exp(3,6) Universal quantification ∀x Man(x) → Mortal(x) “All men are mortal” Existential quantification ∃x (Dog(x) ∧ Black(x)) “There exists a dog which is black”

The need for greater expressive power INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES We need FOL for a greater expressive power. In FOL we have: constants/individuals (e.g. 2) variables (e.g. x) Unary predicates (e.g. Man) N-ary predicates (eg. Near) functions (e.g. Sum, Exp) quantifiers (∀, ∃) equality symbol = (optional) NOTE: P(a) → ∃x P(x) ∀x P(x) → ∃x P(x) ∀x P(x) → P(x) 7

Example of what we can express in FOL INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES constants Cita Monkey 1-ary predicates n-ary predicates Eats Hunts Kimba Simba Lion Near 8

The use of FOL in mathematics INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES FOL has being introduced to express mathematical properties The set of axioms describing the properties of equality between natural numbers (by Peano): Axioms about equality ∀x1 (x1 = x1) reflexivity ∀x1 ∀x2 (x1 = x2 → x2 = x1) symmetricity ∀x1 ∀x2 ∀x3 (x1 = x2  x2 = x3 → x1 = x3) transitivity ∀x1 ∀x2 (x1 = x2 → S(x1) = S(x2)) successor NOTE: Other axioms can be given for the properties of the successor, the addition (+) and the multiplication (x). 9

INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES Alphabet of symbols INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES Variables x1, x2, …, y, z Constants a1, a2, …, b, c Predicate symbols A11, A12, …, Anm Function symbols f11, f12, …, fnm Logical symbols ∧, ∨, , → , ∀, ∃ Auxiliary symbols ( ) Indexes on top are used to denote the number of arguments, called arity, in predicates and functions. Indexes on the bottom are used to disambiguate between symbols having the same name. Predicates of arity =1 correspond to properties or concepts

INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES Terms INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES Terms can be defined using the following BNF grammar: <term> ::= <variable> | <constant> | <function> (<term> {,<term>}*) A term is called a closed term iff it does not contain variables x, 2, SQRT(x), Sum(2, 3), Sum(2, x), Average(x1, x2, x3) Sum(2, 3)

INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES Well formed formulas INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES Well formed formulas (wff) can be defined as follows: <atomic formula> ::= <predicate> (<term> {,<term>}*) | <term> = <term> <wff> ::= <atomic formula> | ¬<wff> | <wff> ∧ <wff> | <wff> ∨ <wff> | <wff> → <wff> | ∀ <variable> <wff> | ∃ <variable> <wff> NOTE: <term> = <term> is optional. If it is included, we have a FO language with equality. NOTE: We can also write ∃x.P(x) or ∃x:P(x) as notation (with ‘.’ or “:”)

INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES Well formed formulas INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES NL FOL “x is a man” Man(x) “3 is an odd number” Odd(3) “Each number is odd or even” ∀x (Odd(x)  Even(x)) “Each even number greater than 2 is the sum of two prime numbers” ∀x ( Even(x)  GreaterThan(x,2) → ∃y ∃z (Prime(y)  Prime(z)  x = Sum(y,z)) ) There is (at least) a white dog ∃x (Dog(x)  White(x)) There are (at least) two dogs ∃x ∃y (Dog(x)  Dog(y)  (x = y)) 13

Scope and index of logical operators INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES Given two wff α and β Unary operators In ¬α, ∀xα and∃xα, α is the scope and x is the index of the operator Binary operators In α  β, α  β and α  β, α and β are the scope of the operator NOTE: in the formula ∀x1 A(x2), x1 is the index but x1 is not in the scope, therefore the formula can be simplified to A(x2). 14

Free and bound variables INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES A variable x is bound in a formula γ if it is γ = ∀x α(x) or ∃x α(x) that is x is both in the index and in the scope of the operator. A variable is free otherwise. A formula with no free variables is said to be a sentence or closed formula. A FO theory is any set of FO-sentences. NOTE: we can substitute the bound variables without changing the meaning of the formula, while it is in general not true for free variables. 15

Interpretation function INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES An interpretation I for a FO language L over a domain D is a function such that: I(ai) = di ∈D for each constant ai I(An)  Dn for each predicate A of arity n I(fn) is a function f: Dn  D  Dn +1 for each function f of arity n 16

INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES Assignment INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES An assignment for the variables {x1, …, xn} of a FO language L over a domain D is a mapping function a: {x1, …, xn}  Dn a(xi) = di ∈ D NOTE: In countable domains (finite and enumerable) the elements of the domain D are given in an ordered sequence <d1,…,dn> such that the assignment of the variables xi follows the sequence. NOTE: the assignment a can be defined on free variables only. 17

Interpretation over an assignment a INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES An interpretation Ia for a FO language L over an assignment a and a domain D is an extended interpretation where: Ia(c) = I(c) for each constant c Ia(x) = a(x) for each variable x Ia(fn(t1,…, tn)) = I(fn)(Ia(t1),…, Ia(tn)) for each function f of arity n NOTE: Ia is defined on terms only 18

Interpretation over an assignment a INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES D = the set N of natural numbers Succ(x) = the function that returns the successor x+1 zero = we could assign the value 0 to it. Ia(xi) = a(xi) = i ∈ N Ia(zero) = I(zero) = 0 ∈ N Ia(Succ(x)) = I(Succ)(Ia(x)) = S(a(x)) such that S(a(x)) = a(x)+1 Ia(Succ(xi)) = I(Succ)(Ia(xi)) = S(i) = i+1 19

Satisfaction relation INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES We are now ready to provide the notion of satisfaction relation: M ⊨ γ [a] (to be read: M satisfies γ under a or γ is true in M under a) where: M is an interpretation function I over D M is a mathematical structure <D, I> a is an assignment {x1, …, xn}  Dn γ is a FO-formula NOTE: if γ is a sentence with no free variables, we can simply write: M ⊨ γ (without the assignment a) 20

Satisfaction relation for well formed formulas INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES γ atomic formula: γ: t1= t2 M ⊨ (t1= t2) [a] iff Ia(t1) = Ia(t2) γ: An(t1,…, tn) M ⊨ An(t1,…, tn) [a] iff (Ia(t1), …, Ia(tn)) ∈ I(An) 21

Satisfaction relation for well formed formulas INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES γ well formed formula: γ:  α M ⊨  α [a] iff M ⊭ α [a] γ: α  β M ⊨ α  β [a] iff M ⊨ α [a] and M ⊨ β [a] γ: α  β M ⊨ α  β [a] iff M ⊨ α [a] or M ⊨ β [a] γ: α  β M ⊨ α  β [a] iff M ⊭ α [a] or M ⊨ β [a] γ: ∀xiα M ⊨ ∀xiα [a] iff M ⊨ α [s] for all assignments s = <d1,…, d’i,…, dn> where s varies from a only for the i-th element (s is called an i-th variant of a) γ: ∃xiα M ⊨ ∃xiα [a] iff M ⊨ α [s] for some assignment s = <d1,…, d’i,…, dn> i-th variant of a 22

Satisfaction relation for a set of formulas INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES We say that a formula γ is true (w.r.t. an interpretation I) iff every assignment a = <d1,…, dn> satisfies γ, i.e. M ⊨ γ [a] for all a. NOTE: under this definition, a formula γ might be neither true nor false w.r.t. an interpretation I (it depends on the assignment) If γ is true under I we say that I is a model for γ. Given a set of formulas Γ, M satisfies Γ iff M ⊨ γ for all γ in Γ 23

Satisfiability and Validity INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES We say that a formula γ is satisfiable iff there is a structure M = <D, I> and an assignment a such that M ⊨ γ [a] We say that a set of formulas Γ is satisfiable iff there is a structure M = <D, I> and an assignment a such that M ⊨ γ [a] for all γ in Γ We say that a formula γ is valid iff it is true for any structure and assignment, in symbols ⊨ γ A set of formulas Γ is valid iff all formulas in Γ are valid. 24

Example of satisfiability INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES D = {0, 1, 2, 3} constants = {zero} variables = {x} predicate symbols = {even, odd} functions = {succ} γ1 : ∀x (even(x)  odd(succ(x))) γ2 : even(zero) γ3 : odd(zero) Is there any M and a such that M ⊨ γ1  γ2 [a]? Ia(zero) = I(zero) = 0 Ia(succ(x)) = I(succ)(Ia(x)) = S(n) = {1 if n=0, n+1 otherwise} I(even) = {0, 2} I(odd) = {1, 3} Is there any M and a such that M ⊨ γ1  γ3 [a]? Yes! Just invert the interpretation of even and odd. 25

Example of valid formulas INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES ∀x1 (P(x1)  Q(x1))  ∀x1 P(x1)  ∀x1 Q(x1) ∃x1 (P(x1)  Q(x1))  ∃x1 P(x1)  ∃x1 Q(x1) ∀x1 P(x1)  ∃x1 P(x1) ∀x1 ∃x1 P(x1) ∃x1 P(x1) ∃x1 ∀x1 P(x1)  ∀x1 P(x1) 26

INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES Entailment INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES Let be  a set of FO- formulas, γ a FO- formula, we say that  ⊨ γ (to be read  entails γ) iff for all the interpretations M and assignments a, if M ⊨  [a] then M ⊨ γ [a]. 27

Reasoning Services: EVAL INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES Model Checking (EVAL) Is a FO-formula γ true under a structure M = <D, I> and an assignment a? Check M ⊨ γ [a] EVAL γ , M, a Yes No Undecidable in infinite domains (in general) Decidable in finite domains 28

Reasoning Services: SAT INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES Satisfiability (SAT) Given a FO-formula γ, is there any structure M = <D, I> and an assignment a such that M ⊨ γ [a]? Theorem (Church, 1936): SAT is undecidable However, it is decidable in finite domains. SAT γ M, a No 29

Reasoning Services: VAL INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES Validity (VAL) Given a FO-formula γ, is γ true for all the interpretations M and assignments a, i.e. ⊨ γ? Theorem (Church, 1936): VAL is undecidable However, it is decidable in finite domains. VAL γ Yes No 30

How to reason on finite domains (I) INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES ⊨ ∀x P(x) [a] D = {a, b, c} we have only 3 possible assignments a(x) = a, a(x) = b, a(x) = c we translate in ⊨ P(a)  P(b)  P(c) ⊨ ∃x P(x) [a] D = {a, b, c} we translate in ⊨ P(a)  P(b)  P(c) 31

How to reason on finite domains (II) INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES ⊨ ∀x ∃y R(x,y) [a] D = {a, b, c} we have 9 possible assignments, e.g. a(x) = a, a(y) = b we translate in ⊨ ∃y R(a,y)  ∃y R(b,y)  ∃y R(c,y) and then in ⊨ (R(a,a)  R(a,b)  R(a,c) )  (R(b,a)  R(b,b)  R(b,c) )  (R(c,a)  R(c,b)  R(c,c) ) 32

INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES Calculus INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES Semantic tableau is a decision procedure to determine the satisfiability of finite sets of formulas. There are rules for handling each of the logical connectives thus generating a truth tree. A branch in the tree is closed if a contradiction is present along the path (i.e. of an atomic formula, e.g. B and B) If all branches close, the proof is complete and the set of formulas are unsatisfiable, otherwise are satisfiable. With refutation tableaux the objective is to show that the negation of a formula is unsatisfiable. Γ = {(A B), B} B A  B A B closed 33

Rules of the semantic tableaux in FOL (I) INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES The initial set of formulas are considered in conjunction and are put in the same branch of the tree Conjunctions lie on the same branch Disjunctions generate new branches Propositional rules: () A  B () A  B --------- --------- A A | B B ()   A A --------- --------- A   A (A B)  B B (A  B) A  B A B closed 34

Rules of the semantic tableaux in FOL (II) INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES Universal quantifiers are instantiated with a terminal t. Existential quantifiers are instantiated with a new constant symbol c. (∀) ∀x.P(x) --------- P(t) (∃) ∃x.P(x) P(c) NOTE: a constant is a terminal NOTE: Multiple applications of the ∀ rule might be necessary (as in the example) {∀x.P(x), ∃x.(¬P(x)  ¬P(f(x))) ∀x.P(x) ∃x.(¬P(x)  ¬P(f(x)) ¬P(c)  ¬P(f(c)) (∃) P(c) (∀) ¬P(c) ¬P(f(c)) () closed P(f(c)) (∀) closed 35

Rules of the semantic tableaux in FOL (III) INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES Correctness: the two rules for universal and existential quantifiers together with the propositional rules are correct: closed tableau → unsatisfiable set of formulas Completeness: it can also be proved: unsatisfiable set of formulas → ∃ closed tableau However, the problem is finding such a closed tableau. An unsatisfiable set can in fact generate an infinite-growing tableau. ∀ rule is non-deterministic: it does not specify which term to instantiate with. It also may require multiple applications. In tableaux with unification, the choice of how to instantiate the ∀ is delayed until all the other formulas have been expanded. At that point the ∀ is applied to all unbounded formulas. 36