Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "LDK R Logics for Data and Knowledge Representation First Order Logics (FOL) Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto."— Presentation transcript:

1 LDK R 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

2 2 Outline  Introduction  Syntax  Semantics  Reasoning Services 2

3 Propositions  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. 3 “All men are mortals”“Obama is the president of the USA” INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

4 What we can express with PL and ClassL (I)  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 INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

5 What we can express with PL and ClassL (II)  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 INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

6 What we cannot express in PL and ClassL  n-ary relations They express objects in D n Near(Kimba,Simba) LessThan(x,3) Connects(x,y,z)  Functions They return a value of the domain, D n → 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” 6 INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

7 The need for greater expressive power  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 INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

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

9 The use of FOL in mathematics 9  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 1. ∀ x 1 (x 1 = x 1 )reflexivity 2. ∀ x 1 ∀ x 2 (x 1 = x 2 → x 2 = x 1 )symmetricity 3. ∀ x 1 ∀ x 2 ∀ x 3 (x 1 = x 2  x 2 = x 3 → x 1 = x 3 )transitivity 4. ∀ x 1 ∀ x 2 (x 1 = x 2 → S( x 1 ) = S(x 2 ))successor NOTE: Other axioms can be given for the properties of the successor, the addition (+) and the multiplication (x). INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

10 Alphabet of symbols  Variables x 1, x 2, …, y, z  Constants a 1, a 2, …, b, c  Predicate symbols A 1 1, A 1 2, …, A n m  Function symbolsf 1 1, f 1 2, …, f n m  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 10 INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

11 Terms  Terms can be defined using the following BNF grammar: ::= | | ( {, }*)  A term is called a closed term iff it does not contain variables 11 x, 2, SQRT(x), Sum(2, 3), Sum(2, x), Average(x 1, x 2, x 3 ) Sum(2, 3) INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

12 Well formed formulas  Well formed formulas (wff) can be defined as follows: ::= ( {, }*) | = ::= | ¬ | ∧ | ∨ | → | ∀ | ∃ NOTE: = 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 “:”) 12 INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

13 Well formed formulas 13 INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES NLFOL “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))

14 Scope and index of logical operators 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 ∀ x 1 A(x 2 ), x 1 is the index but x 1 is not in the scope, therefore the formula can be simplified to A(x 2 ). 14 INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

15 Free and bound variables  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 INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

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

17 Assignment  An assignment for the variables { x 1, …, x n } of a FO language L over a domain D is a mapping function a: { x 1, …, x n }  D a( x i ) = d i ∈ D NOTE: In countable domains (finite and enumerable) the elements of the domain D are given in an ordered sequence such that the assignment of the variables x i follows the sequence. NOTE: the assignment a can be defined on free variables only. 17 INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

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

19 Interpretation over an assignment a  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. I a ( x i ) = a( x i ) = i ∈ N I a (zero) = I(zero) = 0 ∈ N I a (Succ(x)) = I(Succ)(I a (x)) = S(a(x)) such that S(a(x)) = a(x)+1 I a (Succ( x i )) = I(Succ)(I a ( x i )) = S(i) = i+1 19 INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

20 Satisfaction relation  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  a is an assignment { x 1, …, x n }  D  γ is a FO-formula NOTE: if γ is a sentence with no free variables, we can simply write: M ⊨ γ (without the assignment a) 20 INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

21 Satisfaction relation for well formed formulas  γ atomic formula:  γ: t 1 = t 2 M ⊨ (t 1 = t 2 ) [a] iff I a (t 1 ) = I a (t 2 )  γ: A n (t 1,…, t n ) M ⊨ A n (t 1,…, t n ) [a] iff (I a (t 1 ), …, I a (t n )) ∈ I(A n ) 21 INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

22 Satisfaction relation for well formed formulas  γ 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]  γ: ∀ x i α M ⊨ ∀ x i α [a]iff M ⊨ α [s] for all assignments s = where s varies from a only for the i-th element (s is called an i-th variant of a)  γ: ∃ x i α M ⊨ ∃ x i α [a]iff M ⊨ α [s] for some assignment s = i-th variant of a 22 INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

23 Satisfaction relation for a set of formulas  We say that a formula γ is true (w.r.t. an interpretation I) iff every assignment s = satisfies γ, i.e. M ⊨ γ [s] for all s. 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 INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

24 Satisfiability and Validity  We say that a formula γ is satisfiable iff there is a structure M = and an assignment a such that M ⊨ γ [a]  We say that a set of formulas Γ is satisfiable iff there is a structure M = 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 INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

25 Example of satisfiability  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]? I a (zero) = I(zero) = 0 I a (succ(x)) = I(succ)(I a (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 INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

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

27 Entailment  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 INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

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

29 Reasoning Services: SAT  Satisfiability (SAT) Given a FO-formula γ, is there any structure M = 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 INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

30 Reasoning Services: VAL  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 INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

31 How to reason on finite domains (I)  ⊨ ∀ 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 have only 3 possible assignments a(x) = a, a(x) = b, a(x) = c we translate in ⊨ P(a)  P(b)  P(c) INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

32 How to reason on finite domains (II)  ⊨ ∀ 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) ) INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

33 Calculus  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. 33 Γ = {(A  B), B} B A   B A BB closed INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

34 Rules of the semantic tableaux in FOL (I)  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 34  (A  B)  B B A   B A closed BB  (A   B) INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

35 Rules of the semantic tableaux in FOL (II)  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) 35 { ∀ x.P(x), ∃ x.(¬P(x)  ¬P(f(x))) ∀ x.P(x) P(c) ¬P(c) closed ¬P(f(c)) ∃ x.(¬P(x)  ¬P(f(x)) INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES P(f(c)) (∀)(∀) (∃)(∃) ¬P(c)  ¬P(f(c)) ()() (∀)(∀) closed

36 Rules of the semantic tableaux in FOL (III)  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 INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES


Download ppt "LDK R Logics for Data and Knowledge Representation First Order Logics (FOL) Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto."

Similar presentations


Ads by Google