Docsity

Universal Quantification - Lecture Slides | 22C 145, Study notes of Computer Science

Partial preview of the text

Download Universal Quantification - Lecture Slides | 22C 145 and more Study notes Computer Science in PDF only on Docsity!

22c:145 Artificial Intelligence

First-Order Logic

Readings:

Chapter 8 of Russell &

Norvig.

Language of FOL: Grammar

Sentence

::=^

AtomicS

|^ ComplexS

AtomicS

::=^

True

|^ False

|^ RelationSymb

(Term

,.. .)

|^ Term

=^ Term

ComplexS

::=^

(Sentence

)^ |^ Sentence Connective Sentence

| ¬Sentence

|^ Quantifier Sentence

Term

::=^

FunctionSymb

(Term

,.. .)

|^ ConstantSymb

|^ Variable

Connective

::=^

∧ | ∨ | ⇒ | ⇔

Quantifier

::=^

∀^ Variable

| ∃^ Variable

Variable

::=^

a^ |^ b^

| · · · |

x^ |^ y

| · · ·

ConstantSymb

::=

A^

|^ B^ | · · · |

John

|^0 |

1 | · · · |

π^ |^...

FunctionSymb

::=

F^

|^ G^ | · · · |

Cosine

|^ Height

|^ FatherOf

|^ +

|^...

RelationSymb

::=

P^

|^ Q^ | · · · |

Red^

|^ Brother

|^ Apple

|^ >

| · · ·

A common mistake to avoid

Typically,

is the main connective with

Common mistake: using

∧^ as the main connective with

∀^ x At

(x, U Iowa

)^ ∧^ Smart

(x)

means “Everyone is at UIowa and everyone is smart”

Existential quantification

∃ 〈variable

〉 〈sentence

Someone at Stanford is smart: ∃^ x At

(x, Stanf ord

)^ ∧^ Smart

(x)

∃^ x P

is true in an interpretation

I^ iff

P^ is true with

x^ being

some

possible object in the domain

Roughly speaking, equivalent to the disjunction ofinstantiations of

P

At(KingJohn, Stanf ord

)^ ∧^ Smart

(KingJohn

∨^ At

(Richard, Stanf ord

)^ ∧^ Smart

(Richard

∨^ At

(Stanf ord, Stanf ord

)^ ∧^ Smart

(Stanf ord

∨^...

Properties of quantifiers

∀^ x^

∀^ y^

is the same as

∀^ y^

∀^ x^

(why

∃^ x^

∃^ y^

is the same as

∃^ y^

∃^ x^

(why

∃^ x^

∀^ y^

is not the same as

∀^ y^

∃^ x

∃^ x^

∀^ y Loves

(x, y

“There is a person who loves everyone in the world” ∀^ y^

∃^ x Loves

(x, y

“Everyone in the world is loved by at least one person”Quantifier duality: each can be expressed using the other ∀^ x Likes

(x, IceCream

)^

¬∃^ x

¬Likes

(x, IceCream

∃^ x Likes

(x, Broccoli

)^

¬∀^ x

¬Likes

(x, Broccoli

Fun with sentences

Brothers are siblings ∀^ x, y Brother

(x, y

Sibling

(x, y

“Sibling” is symmetric

Fun with sentences

Brothers are siblings ∀^ x, y Brother

(x, y

Sibling

(x, y

“Sibling” is symmetric ∀^ x, y Sibling

(x, y

)^ ⇔

Sibling

(y, x

One’s mother is one’s female parent ∀^ x, y M other

(x, y

)^ ⇔

(F emale

(x)^ ∧

P arent

(x, y

A first cousin is a child of a parent’s sibling

Fun with sentences

Brothers are siblings ∀^ x, y Brother

(x, y

Sibling

(x, y

“Sibling” is symmetric ∀^ x, y Sibling

(x, y

)^ ⇔

Sibling

(y, x

One’s mother is one’s female parent ∀^ x, y M other

(x, y

)^ ⇔

(F emale

(x)^ ∧

P arent

(x, y

A first cousin is a child of a parent’s sibling ∀^ x, y F irstCousin

(x, y

)^ ⇔ ∃

p, ps P arent

(p, x

)^ ∧

Sibling

(ps, p

)^ ∧^ P arent

(ps, y

Semantics of First-Order Logic

(A little) more formally:An^ interpretation

is a pair

(D, σ

)^ where

D^ is a set of objects, the universe (or

domain

σ^ is mapping from variables to objects in

D;

D^ C

is an object in

D^ for every constant symbol

C;

D^ F

is a function from

n^ D

to^ D

for every function symbol

F^ of arity

n;

D^ R

is a relation over

n^ D

for every relation symbol

R^ of

arity

n;

An Interpretation

A

in the Blocks World

Constant Symbols:

A, B, C, D, E, T

Function Symbols:

Support

Relation Symbols:

On

,^ Above

,^ Clear a b c

d e

t

A^ A= a, B

A^ =^

Ab, C =^ c, D

A^ =^

Ad, E =^ e, F

A^ =^

Af, T =^ t

Support

A^ =

{〈a, b

〉,^ 〈b, c

〉,^ 〈c, t

〉,^ 〈d, e

〉,^ 〈e, t

〉,^ 〈t, t

〉}

A On

=^ {〈

a, b〉,

〈b, c〉

,^ 〈d, e

〉}

Above

A^

=^ {〈

a, b〉,

〈a, c

〉,^ 〈b, c

〉,^ 〈d, e

〉}

Clear

A^

=^ {〈

a〉,^ 〈d

〉}

Models for FOL: Lots!

We^

can

enumerate the models for a given FOL sentence:

For each number of universe elements

n^ from 1 to

For each

k-ary predicate

Pk^

in the sentence

For each possible

k-ary relation on

n^ objects

For each constant symbol

C^ in the sentence

For each one of

n^ objects mapped to

C

Enumerating models is not going to be easy!

Semantics of First-Order Logic Let^ (

D, σ

)^ be an interpretation and

E^ an expression of

FOL. We write

[[E]]

Dto denote the σ^

meaning of

E^ in the

domain

D^ under the variable assignment

The meaning

D [[t]] σ

of a term

t^ is an object of

D. It is

inductively defined as follows.D^ [[x]]^ σ

:=^

σ(x)

for all variables

x

D [[C]] σ

:=^

D^ C

for all constant symbols

C

[[F^ (t

,... , t 1

D)]]n σ^ :=^

DF ([[

Dt]],... , 1 σ^

D [[t]]n σ )^ for all function symbols

F

of arity

n

Semantics of First-Order Logic The meaning

[[ϕ]]

Dof a formula σ^

ϕ^ is either

True

or^ False

It is inductively defined as follows.^ [[t^1

=^ t]]^2

D σ^

:=^

True

iff^

D[[t]] 1 σ is the same as

[[t]]^2 D σ

[[R(t

,... , t 1

D)]]n σ^ :=^

True

iff^

〈[[t]]^1

D,... , σ^

D [[t]]n σ 〉 ∈^ R

D

[[¬ϕ]]

D σ^

:=^

True

/False

iff^

D[[ϕ]] σ =^ False

/True

[[ϕ∨^1

D ϕ]] 2 σ

:=^

True

iff^

[[ϕ]]^1 D=^ σ^

True

or^ [[

Dϕ]] 2 σ =^ True

[[∃x ϕ

D]] σ^

:=^

True

iff^

D[[ϕ]] σ =^ True′

for some

′^ σcoinci

with^

σ^ except maybe for

x

Semantics of First-Order Logic The meaning of formulas built with the other logicalsymbols can be defined by reduction to the previoussymbols.^ [[ϕ^1

∧^ ϕ^2

D]] σ^

:=^

[[¬(¬

ϕ∨ ¬^1

ϕ)]]^2

D σ

[[ϕ^1

⇒^ ϕ

D]] 2 σ^

:=^

[[¬ϕ

∨^ ϕ 1

D]] 2 σ

[[ϕ^1

⇔^ ϕ

D]] 2 σ^

:=^

[[(ϕ^1

⇒^

ϕ)^2

∧^ (ϕ

ϕ)]]^1

D σ

[[∀xϕ

D]] σ^

:=^

[[¬∃

x^ ¬ϕ

D]] σ

If a sentence is closed (no free variables), its meaning does not depend

on the the variable assignment

(although it may depend on the domain):^ [[

∀x^ ∃

y R(

x, y)]]

D= [[ σ^

∀x^ ∃

y R(

x, y)]]

D′^ σ

for any

σ, σ

′