Está en la página 1de 60

INTELIGENCIA

ARTIFICIAL
¨ LOGICA DE PRIMER
ORDEN O LOGICA
DE PREDICADOS ¨
Ing Mg
Ing. Mg. BRUNO ELIO VARGAS TAMANI
LOGICA PROPOSICIONAL

Lógica
g p
proposicional
p :
no permite variables de
ningún
g tipo.
p

14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 2


LOGICA DE PRIMER ORDEN

Lógica
g de p
primer orden :
variables representan
objetos.
j

14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 3


LOGICA DE SEGUNDO
ORDEN
Lógica
g de segundo
g
orden :
variables representan
p
objetos
j yppredicados.
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 4
QUE PREDICADOS DEBEMOS
DEFINIR PARA PODER UTILIZAR
LA REGLA GENERAL :

Todos los hombres


son mortales

14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 5


PREDICADO PARA REPRESENTAR
LA PROPIEDAD DE SER HOMBRE

hombre(x)

predicado
di d objeto
bj t
Significa para nosotros :
14/11/2011
x es hombre
h b
Ing. M.Sc. BRUNO VARGAS T. 6
PREDICADO PARA REPRESENTAR
LA PROPIEDAD DE SER MORTAL

mortal(x)

predicado
di d objeto
bj t
Significa para nosotros :
14/11/2011
x es mortal
t l
Ing. M.Sc. BRUNO VARGAS T. 7
EXPRESAMOS LOS HECHOS EN
LOGICA DE PRIMER ORDEN

hombre(Juan)

predicado
di d objeto
bj t
Significa para nosotros :
14/11/2011
J
Juan es un hombre
h b
Ing. M.Sc. BRUNO VARGAS T. 8
BASE DE CONOCIMIENTOS
hombre (Juan)
hombre ( Luis)
hombre ( Pedro)
hombre ( José))
hombre ( etc.)
hombre ( etc.)
14/11/2011
h b ( etc.)
hombre t )
Ing. M.Sc. BRUNO VARGAS T. 9
EXPRESAMOS LOS HECHOS PARA
LAS CONCLUSIONES
EN LOGICA DE PRIMER ORDEN

mortal(Juan)
( )
predicado
di d objeto
bj t
Significa para nosotros :
14/11/2011
J
Juan es mortal
t l
Ing. M.Sc. BRUNO VARGAS T. 10
AGREGAMOS REGLA A LA
BASE DE CONOCIMIENTOS
(en forma general)
TODOS LOS HOMBRES SON
MORTALES
∀x hom b ( x) → mortall( x)
h bre
Si x es hombre entonces x es
14/11/2011
mortal
t l
Ing. M.Sc. BRUNO VARGAS T. 11
BASE DE CONOCIMIENTOS
hombre( Juan)
hombre( Luis)
hombre( Pedro)
hombre( José)
hombre(etc.)
∀x hombre
b ( x) → mortal
14/11/2011
t l( x)
Ing. M.Sc. BRUNO VARGAS T. 12
QUEREMOS DEMOSTRAR QUE
JUAN ES MORTAL

Expresamos la conclusión a
evaluar
l como un h
hecho
h :

mortal((Juan)

14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 13


AGREGAMOS LA CONCLUSION
NEGADA A LA BASE DE
CONOCIMIENTOS
Expresamos la conclusión
a evaluar como un hecho :

mortal(Juan)
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 14
AGREGAMOS LA CONCLUSION
NEGADA A LA BASE DE
CONOCIMIENTOS
∀x hom bre( x) → mortal( x)
hom bre( Juan)
hom bre( Luis)
hom bre( Pedro)
hom bre( José)
hom bre(etc.)
14/11/2011
¬ mortal(Juan)
Ing. M.Sc. BRUNO VARGAS T. 15
LAS IMPLICACIONES SE EXPRESAN
EN FORMA DISYUNTIVA

∀x hom b ( x) → mortall( x)
h bre
equivale
q a:
∀x ¬ homb ( x) ∨ mortal
h bre t l( x)
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 16
LA BASE DE CONOCIMIENTOS
1. ∀x ¬ hom b ( x) ∨ mortal
h bre t l( x)
2. hom bre( Juan)
3. hom bre( Luis)
4. hom bre( Pedro)
5. hom bre( José)
6. hom bre(etc.)
7. ¬ mortal
t l( Juan
J )
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 17
EN TODOS LOS CASOS IMPLICITA
CUANTIFICACION UNIVERSAL
ELIMINAMOS O OS ∀x
OS SIMBOLOS
S

∀x ¬ hombre( x) ∨ mortal( x)
equivale
i l a:
¬ hombre( x) ∨ mortal( x)
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 18
LA BASE DE CONOCIMIENTOS
1. ¬ hombre( x) ∨ mortal( x)
2. hom bre( Juan)
3. hom bre( Luis)
4. hom bre( Pedro)
5. hom bre( José)
6. hom bre(etc.)
14/11/2011
7. ¬ mortal( Juan)
Ing. M.Sc. BRUNO VARGAS T. 19
UTILIZAMOS LA REGLA DE
INFERENCIA DE RESOLUCION

( x ∨ y ) , (¬ y ∨ z )
x∨ z
Si se ambas ( x ∨ y ) y ( ¬ y ∨ z )
son ciertas, entonces ( x ∨ z )
es cierta.
i t
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 20
EVALUEMOS DOS REGLAS QUE
CONTENGAN SUS ATOMOS
NEGADOS
¬ mortal( Juan) ¬ hombre( x) ∨ mortal( x)

¿
¿Cuándo estas dos
proposiciones son ciertas?
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 21
SI AMBOS HECHOS SON CIERTOS
ENTONCES
x debe ser igual a Juan

¬ mortal( Juan) ¬ hombre( x) ∨ mortal( x)

{x = Juan}
¬ mortal( Juan) ¬ hombre( Juan) ∨ mortal( Juan)

14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 22


SE REALIZA EL PROCESO DE
UNIFICACION ENTRE LAS
CLAUSULAS : SUSTITUYENDO
LAS VARIABLES PARA QUE DOS
CLAUSULAS SEAN CIERTAS O
SE LLEGUE A UNA
CONTRADICCION

14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 23


UNIFICACION DE CLAUSULAS
PARA DEDUCIR OTRAS
CLAUSULAS
¬ mo
mortal
tal( Juan) ¬ hom
o bbree( x) ∨ mo
mortal
tal( x)

{x = Juan}
¬ hom bre( Juan)

14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 24


A PARTIR DE LA REGLA
ANTERIOR BUSCAMOS UNA
REGLA QUE CONTENGA ESE
ATOMO NEGADO

¬ hombre( Juan) hombre( Juan)

CONTRADICCION
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 25
AL LLEGARSE A UNA
CONTRADICCION EN LA BASE
DE CONOCIMIENTOS
SIGNIFICA QUE LA CONCLUSION
ES CIERTA
EN NUESTRO CASO :

JUAN ES MORTAL

14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 26


RESUMEN DE LA
DEMOSTRACION
¬mortal( Juan) ¬hombre( x) ∨ mortal( x)

{x = Juan}
¬ hombre( Juan) hombre( Juan)

CONTRADICCION
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 27
EJERCICIO
Demuestre que el hecho :
Pedro es mortal
es cierto
cierto, es decir :
mortall(Pedro
(P d )
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 28
UNIFICACION
Procedimiento mediante el
cual dos sentencias se
comparan y descubre si
hay sustituciones que los
h
haga idé
idénticos.
ti
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 29
UNIFICACION
Se verifican si los
predicados coinciden,,
p
luego
g se hacen
coincidir los
argumentos.
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 30
LOGICA DE PRIMER
Juan estima a todos los que
conoce
Sean x e y personas

Conoce(Juan x) → Estima(Juan,x)
Conoce(Juan,x) Estima(Juan x)

14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 31


BASE DE CONOCIMIENTOS
Conoce(Juan,x) → Estima(Juan,x)
Conoce(Juan,Mary)
Conoce(y,José)
Conoce(y,Madre(y))
Conoce(x,Isabel)
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 32
EJEMPLO DE INFERENCIA

Demuestre por Modus


Ponens que :
Juan estima a Mary

14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 33


UNIFICACION
Ejemplo por Modus Ponens

14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 34


EJEMPLO DE INFERENCIA

Demuestre por Modus


Ponens que :
Juan estima a José

14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 35


UNIFICACION
Ejemplo por Modus Ponens

14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 36


EJEMPLO DE INFERENCIA

Demuestre por Modus


Ponens que :
Juan estima a su madre

14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 37


UNIFICACION
Ejemplo por Modus Ponens

14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 38


EJEMPLO DE INFERENCIA

Demuestre por Modus


Ponens que :
Juan estima a su Isabel

14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 39


UNIFICACION
Ejemplo por Modus Ponens

Así la UNIFICACION
14/11/2011
f
falla
Ing. M.Sc. BRUNO VARGAS T. 40
FALLO DE LA UNIFICACION

No puede asumir x el valor de


Juan y de Isabel a la vez
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 41
SOLUCION PARA UNIFICACION
RENOMBRAR VARIABLES
Conoce(Juan x1) → Estima(Juan
Conoce(Juan,x1) Estima(Juan,x1)
x1)
Conoce(Juan,Mary)
Conoce(y1 José)
Conoce(y1,José)
Conoce(y2 Madre(y2))
Conoce(y2,Madre(y2))
Conoce(x2 Isabel)
Conoce(x2,Isabel)
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 42
UNIFICACION
Ejemplo por Modus Ponens

14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 43


SKOLEMIZACION
Proceso para eliminar
los cuantificadores
e istenciales
existenciales.

14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 44


SKOLEMIZACION
Existe una p
persona x
que es p
q presidente
Sean x personas
∃x : Presidente(x)
Presidente( )
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 45
SKOLEMIZACION
Sean x personas
∃ x : Presidente(x)
( )
Se p
puede transformar a:
Presidente(A)
donde A es una constante
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 46
SKOLEMIZACION
Para toda persona x
existe una y que es
su padre
Sean x e y personas
∀x : ∃y : padrede(y,x)
14/11/2011
padrede(y x)
Ing. M.Sc. BRUNO VARGAS T. 47
SKOLEMIZACION
Para toda persona x existe
una y que es su padre
Observe que el valor de y
d b d
debe depender
d d dell valor
l
de xx. Es decir y debe ser
función de xx.
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 48
SKOLEMIZACION
∀ x : ∃ y : padrede(y,x)
padrede(y x)
Se reemplaza y por una
función de x.
Ess decir
dec se haceace :
yy=f(x)
f(x)
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 49
SKOLEMIZACION
∀ x : ∃y : padrede(y,x)
padrede(y x)
Al reemplazar : y=f(x)
Eliminamos el cuantificador
e se ca
existencial
∀x : padrede(f(x),x)
padrede(f(x) x)
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 50
SKOLEMIZACION
Sean x e y personas
p :
∀x : ∃y : padrede(y,x)
padrede(y x)
Se puede transformar a :
padrede(f(x),x)
d d (f( ) )
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 51
RELACION ENTRE CUANTIFICADOR
UNIVERSAL Y CUANTIFICADOR
EXISTENCIAL
PERSONAS PROFESIONES CONDICION

Juan Médico socio


Pedro Abogado
g socio
Luis Médico socio
Ana Programador socio
Luisa Contador socio
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 52
RELACION ENTRE CUANTIFICADOR
UNIVERSAL Y CUANTIFICADOR
EXISTENCIAL
Sean x personas, sean y
profesiones y z condiciones :
P(x,y)
( ) : x tiene profesión
f y
C(x,z) : x tiene condición z
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 53
RELACION ENTRE CUANTIFICADOR
UNIVERSAL Y CUANTIFICADOR
EXISTENCIAL
Todas las personas son socios :
∀x C(x,socio)
C(x socio)
Puede interpretarse como :
(
C(Juan,socio)) ∧ C(Pedro,socio)
( )
∧ C(Luis,socio) ∧ C(Ana,socio)
∧ C(Luisa,socio)
C(L i
14/11/2011
i )
Ing. M.Sc. BRUNO VARGAS T. 54
RELACION ENTRE CUANTIFICADOR
UNIVERSAL Y CUANTIFICADOR
EXISTENCIAL
E iste una
Existe na persona abogado :
∃x P(x,abogado)
P(x abogado)
Puede interpretarse como :
P(Juan,abogado)
( g ∨
) P(Pedro,abogado)
( g )
∨ ∨
P(Luis, abogado) P(Ana, abogado)

P(Luisa abogado)
P(Luisa,
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 55
RELACION ENTRE CUANTIFICADOR
UNIVERSAL Y CUANTIFICADOR
EXISTENCIAL

∀x ( ) = ¬ ∃ x ¬ F(x)
F(x) ( )
∃x ( ) = ¬∀x ¬ F(x)
F(x) ( )
¬∀x F(x) = ∃ x ¬ F(x)
¬ ∃x F(x) = ∀x ¬ F(x)
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 56
RELACION ENTRE CUANTIFICADOR
UNIVERSAL Y EXISTENCIAL

Todos son no biólogos :


∀x ¬P(x,biólogo)
P(x biólogo)
Puede interpretarse como :
No existe uno que sea biólogo :
¬∃x P(x,biólogo)
( , g )
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 57
RELACION ENTRE CUANTIFICADOR
UNIVERSAL Y EXISTENCIAL
No todos son médicos :
¬∀x P(x,médico)
Puede interpretarse como :
Existe al menos uno que no es
médico
édi :
∃x ¬P(x,médico)
P(x médico)
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 58
RELACION ENTRE CUANTIFICADOR
UNIVERSAL Y EXISTENCIAL

Todos son socios :


∀x C(x,socio)
C(x socio)
Puede interpretarse como :
No existe uno que no sea socio :
¬∃x ¬C(x,socio)
( , )
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 59
RELACION ENTRE CUANTIFICADOR
UNIVERSAL Y EXISTENCIAL
Hayy una persona
p q
que es
abogado :
∃ x P(x,abogado)
Puede interpretarse como :
N son ttodos
No d no abogados
b d :
¬∀x ¬P(x,abogado)
P(x abogado)
14/11/2011 Ing. M.Sc. BRUNO VARGAS T. 60

También podría gustarte