Loading in 5 sec....

L ogics for D ata and K nowledge R epresentationPowerPoint Presentation

L ogics for D ata and K nowledge R epresentation

- 81 Views
- Uploaded on
- Presentation posted in: General

L ogics for D ata and K nowledge R epresentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Logics for Data and KnowledgeRepresentation

First Order Logics (FOL)

Originally by Alessandro Agostini and Fausto Giunchiglia

Modified by Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese

- Introduction
- Syntax
- Semantics
- Reasoning Services

2

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”

INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

- PL
“There is a monkey” Monkey

We useIntensional 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 useExtensional 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

- 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

- 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”

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

INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

constants

Cita

Monkey

1-ary predicates

n-ary predicates

Eats

Hunts

Kimba

Simba

Lion

Near

8

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 = x2x2 = 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

- Variables x1, x2, …, y, z
- Constants a1, a2, …, b, c
- Predicate symbols A11, A12, …, Anm
- Function symbolsf11, 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 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 (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

13

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 ∀x1A(x2), x1 is the index but x1 is not in the scope, therefore the formula can be simplified to A(x2).

14

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

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 ∈Dfor each constant ai
- I(An) Dnfor 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

- 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

INTRODUCTION :: SYNTAX :: SEMANTICS :: REASONING SERVICES

- An interpretationIa 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

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

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)

- M is an interpretation function I over D

20

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

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

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

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

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

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

- 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

Yes

EVAL

γ, M, a

No

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]

- Undecidable in infinite domains (in general)
- Decidable in finite domains

M, a

SAT

γ

No

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.

Yes

VAL

γ

No

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.

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 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

- ⊨ ∀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

- 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

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

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

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