Artificial Intelligence

Download Report

Transcript Artificial Intelligence

Lógica de Predicados
Dr. Rogelio Dávila Pérez
Profesor-Investigador
Depto. de Tecnologías de la Información
ITESM, Campus Guadalajara
Lógica de Predicados
I. Sintaxis
1. Vocabulario
(a)
(b)
(c)
(d)
(e)
(f)
(g)
(h)
Constantes lógicas: 
Conectores lógicos: , , , , =
Cuantificadores: , 
Símbolos de puntuación: ‘(’ , ‘)’ , ‘,’
Símbolos predicados: Rn, Pm, Qs, …
Símbolos de función: fn, gm, rs, …
Símbolos constantes: a, b, c, …
Variables individuales: x, y, z
2. Términos
(i)
(ii)
(iii)
Un símbolo constante es un término.
Una variable individual es un término.
Si fn es un símbolo de función n-aria y, t1, …, tn son términos
entonces fn(t1, …, tn ) es un término.
Lógica de Predicados
3. Fórmulas bien-formadas (fbfs)
(a)
(b)
(c)
(d)
(e)
La constante , llamada contradicción, es una fbf.
Si Rn es un símbolo predicado n-ario , y t1, …, tn son términos
entonces Rn (t1, …, tn ) es una fbf.
Si  y  son fbfs, entonces , ,  y  también fbfs.
Si  es una fbf y x es una variable, entonces x.(x) y
 x.(x) son ambas fbfs.
Nada fuera de lo indicado en (a)-(d) es una fbf.
Lógica de Predicados
II. Reglas de Inferencia
(a)
Todas las reglas de inferencia de la lógica proposicional son válidas
en la lógica de predicados.
(b)
Reglas del cuantificador Universal
 -Intro
 -Elim (Instanciación Universal)
(a)
x.(x)
…
(a)
(a)
x.((x) (x))
Solo en el caso de que (a) y
(a) no sean premisas,
y ‘a’ no aparezca en las premisas.
Lógica de Predicados
(a)
Reglas del cuantificador Existencial
-Intro
-Elim
y. (y)
(a)
(a)
…
y.  (y)


Sólo en el caso de que ‘a’ no aparezca en

‘ ’.
Identidades de la lógica de predicados
(a)       v 
(b) Ley de Contraposición:         
(c) Leyes Distributivas:
(i)  v (  )  ( v )  ( v )
(ii)   ( v )  (  ) v (  )
(e) Leyes de DeMorgan:
(i)  ( v )      
(ii)  (  )    v  
 x.  (x)
(g)  x. (x)  x.  (x)
(f)  x. (x)
Lógica de Predicados

Traduzca las siguientes oraciones a lógica
(a) Monica likes some of her students.
(b) Monica likes all her students.
(c) All men are created equal.
(d) Roses are red; violets are blue.
(e) Some freshmen are intelligent.
(f) All freshmen are intelligent.
(g) No freshmen are intelligent.
(h) One of the coats in the closet belongs to Sarah.
(i) Some Juniors date only Seniors.
(j) Not all birds can fly.
Lógica de Predicados
(k) Every elephant has a trunk.
(l) Adams is not married to anyone.
(m) No freshmen are not serious.
(n) Someone profited from the great depression.
(o) All fish except sharks are kind to children.
(p) Anyone with two or more spouses is a bigamist.
(q) John married Mary and she got pregnant.
(r) If all sophomores like Greek, then some freshmen do.
(s) Everyone loves somebody and no one loves everybody,
or somebody loves everybody and someone loves nobody.
Predicate Logic Semantics
Definition. An interpretation of a term consists in a non empty
domain E, and an assignment function F:
(i)
(ii)
(iii)
To each constant symbol, it is assigned an individual from
the domain.
To each n-ary function symbol, it is assigned a mapping
from E n E.
To each n-ary predicate symbol, it is assigned a subset
from E n.
Predicate Logic Semantics
Definition. An interpretation of a wff  consists of an mapping
I: wffs {0,1} as follows:
(i)
(ii)
(iii)
(iv)
(v)
(vi)
(vii)
I(Pi(t1, t2,…,tn)) = 1 iff <F(t1), F(t2), …,F( tn) >  F( Pi),
0 otherwise.
I(  ) = min(I(),I())
I(  ) = max(I(),I())
I( ) = 0 if I()=1 and I()=0, 1 otherwise
I() = 1-I()
I(x.(x)) = 1 if for all a  E, I((a))=1
I(x.(x)) = 1 if there is an F(a)  E such that
I((a))=1.
Predicate Logic
Definition. An interpretation of a set of well-formed formulas , is called a MODEL
of , if and only if, every wff in  is true under that interpretation.
Definition. A wff  is called a logical consequence of a set of wffs , if and only if,
 is true in al models of  ( |= ).
Definition. A wff  is satisfiable if it has a model, otherwise it is unsatisfiable.
Predicate Logic
Example
Lets define a simple language:
Basic expressions:
(i)
Constant symbols: m, j, d and n.
(ii)
Predicate symbols: M1, B1, K2, L2.
Sentences:
M(d), B(j), K(j,n) and L(n,m)
Evaluate the truth of the previous sentences according to the interpretations shown
bellow.
Predicate Logic
M1=<A1,F1>
A1 = {x | x is a country in America}
F1(m) =peru, F1(j)=chile, F1(d)= honduras, F1(n)= argentina
F1(M)={colombia, belice, argentina, canada, nicaragua}
F1(B)={x  A1| x borders the pacific ocean}
F1(K)={<x,y>| <x,y>  A1xA1 , x borders y}
F1(L)={<x,y>| <x,y>  A1xA1 , x is bigger than y}
Predicate Logic
M2=<A2,F2>
A2 = {x | x is an integer}
F2 (m) =0, F1(j)=2, F1(d)= 9, F1(n)= -1
F2 (M)={x  A2| x is odd}
F2 (B)={x  A| x is a perfect square}
F2 (K)={<x,y>| <x,y>  A2xA2 , and x > y}
F2 (L)={<x,y>|< x,y>  A2x A2 , x = y2}
Problems
The mother will die unless the doctor kills the child. If
the doctor kills the child, the doctor will be taking life. If
the mother dies, the doctor will be taking life.
Therefore, the doctor will be taking life.
Problems
If the soil is suitable for carrots, then it is deep, sandy
and free of stones. The soil is not suitable for linseed if
it is sandy or a heavy clay. Therefore the soil is not
suitable for both carrots and linseed.
Problems
Bank-notes all carry a metal strip. Anything with
a metal strip can be detected by X-rays.
Therefore, bank-notes can be detected by Xrays.
Problems
All the birds are either chiff-chaffs or willow warblers.
The birds are singing near the ground. Chiff-chaffs
don’t sing near the ground. Therefore the birds are
all willow-warblers.