Lógica de Predicados de Primer Orden - Facultad de Ciencias Exactas
Lógica de Predicados de Primer Orden - Facultad de Ciencias Exactas
Lógica de Predicados de Primer Orden - Facultad de Ciencias Exactas
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Lógica</strong> <strong>de</strong> <strong>Predicados</strong>: Motivación<br />
Todo natural es entero y 2 es un natural. Luego 2 es entero.<br />
p q r<br />
p, q╞ r es claramente un razonamiento válido pero<br />
no es posible <strong>de</strong>mostrarlo <strong>de</strong>s<strong>de</strong> la <strong>Lógica</strong> Proposicional<br />
<strong>Lógica</strong> proposicional NO es suficientemente expresiva para<br />
captar esta relación<br />
∀x (x ∈ Ν → x ∈ Z)<br />
2 ∈ Ν<br />
Ν<br />
Ν .<br />
. .<br />
.<br />
2 ∈ Z<br />
La vali<strong>de</strong>z <strong>de</strong>l razonamiento<br />
<strong>de</strong>pen<strong>de</strong> <strong>de</strong> la estructura interna <strong>de</strong><br />
las proposiciones<br />
<strong>de</strong>be expresarse usando <strong>Lógica</strong> <strong>de</strong> <strong>Predicados</strong><br />
<strong>Ciencias</strong> <strong>de</strong> la Computación II - Filminas <strong>de</strong> Clase – Mg. Virginia Mauco – <strong>Facultad</strong> Cs. <strong>Exactas</strong> – UNCPBA - 2009<br />
<strong>Lógica</strong> <strong>de</strong> <strong>Predicados</strong> <strong>de</strong> <strong>Primer</strong> Or<strong>de</strong>n<br />
LENGUAJE DE PRIMER ORDEN<br />
Símbolos para <strong>de</strong>notar individuos<br />
- constantes (ej. 2, Juan, bicicleta)<br />
- variables (ej. x, y, z)<br />
- funciones (ej. sucesor, +, *, para <strong>de</strong>finir nuevos individuos<br />
como sucesor(2), (1+1), (2*1) )<br />
Símbolos <strong>de</strong> relaciones (entero(x), hermano(x, y))<br />
Conectivos<br />
Cuantificadores (existencial, universal)<br />
<strong>Ciencias</strong> <strong>de</strong> la Computación II - Filminas <strong>de</strong> Clase – Mg. Virginia Mauco – <strong>Facultad</strong> Cs. <strong>Exactas</strong> – UNCPBA - 2009<br />
1
Lenguaje <strong>de</strong> <strong>Primer</strong> Or<strong>de</strong>n<br />
Alfabeto básico consta <strong>de</strong> los siguientes símbolos:<br />
Variables: Var = {x, y, z, x 1 , x 2 , ... }<br />
Conectivos ¬, ∧, ∨, →, ↔<br />
Cuantificadores: ∀ (universal) ∃ (existencial)<br />
Símbolos auxiliares (, )<br />
Conjunto <strong>de</strong> símbolos F,<br />
símbolos <strong>de</strong> funciones n-arias, n ≥ 1 f, g, h<br />
Conjunto <strong>de</strong> símbolos C,<br />
símbolos <strong>de</strong> constantes a, b, c<br />
Conjunto <strong>de</strong> símbolos R,<br />
símbolos <strong>de</strong> relaciones o predicados n-arios,<br />
n ≥ 1 P, Q, R<br />
Símbolos comunes<br />
a todo lenguaje<br />
<strong>Ciencias</strong> <strong>de</strong> la Computación II - Filminas <strong>de</strong> Clase – Mg. Virginia Mauco – <strong>Facultad</strong> Cs. <strong>Exactas</strong> – UNCPBA - 2009<br />
Lenguaje <strong>de</strong> <strong>Primer</strong> Or<strong>de</strong>n<br />
Caracterizado por sus símbolos propios<br />
L = pue<strong>de</strong> ocurrir R = ∅, F = ∅, o C = ∅<br />
Ejemplos<br />
Sea L 1 = <br />
R = {P, Q} P unario, Q binario<br />
F = { f } f unaria<br />
C = ∅<br />
Ejemplos<br />
Sea L 2 = <br />
R = {P} P binario<br />
F = { f, g } f unaria g binaria<br />
C = {a, b}<br />
Símbolos propios<br />
<strong>de</strong> cada lenguaje<br />
Fórmulas bien <strong>de</strong>finidas en L 1<br />
Q(x, x) ∧ ∃xP(x)<br />
∀x(P(x) → Q(f(x), x))<br />
Fórmulas bien <strong>de</strong>finidas en L 2<br />
P(f(a), b) → ∀xP(x, b)<br />
∃x(P(x, a) ∧ P(g(x, b), x))<br />
<strong>Ciencias</strong> <strong>de</strong> la Computación II - Filminas <strong>de</strong> Clase – Mg. Virginia Mauco – <strong>Facultad</strong> Cs. <strong>Exactas</strong> – UNCPBA - 2009<br />
2
Dado L = <br />
Lenguaje <strong>de</strong> <strong>Primer</strong> Or<strong>de</strong>n<br />
Términos <strong>de</strong> L Ter(L) (representan elementos <strong>de</strong>l dominio)<br />
a) C ⊆ Ter(L)<br />
b)Var ⊆ Ter(L)<br />
c) Si t 1 , t 2 , ..., t n ∈ Ter(L) y f ∈ F es un símbolo <strong>de</strong> función n-aria,<br />
entonces f(t 1 , t 2 , ..., t n ) ∈ Ter(L)<br />
Ejemplos<br />
Sea L 2 = <br />
R = {P} P binario<br />
F = { f, g } f unaria g binaria<br />
C = {a, b}<br />
Ter(L 2 )<br />
a) a, b (las constantes son términos)<br />
b) x, y, z, ... (las variables son términos)<br />
c) f(a), g(a, b), f(g(a, b)), g(f(a), x), ...<br />
(funciones aplicadas a términos son<br />
términos)<br />
<strong>Ciencias</strong> <strong>de</strong> la Computación II - Filminas <strong>de</strong> Clase – Mg. Virginia Mauco – <strong>Facultad</strong> Cs. <strong>Exactas</strong> – UNCPBA - 2009<br />
Dado L = <br />
Lenguaje <strong>de</strong> <strong>Primer</strong> Or<strong>de</strong>n<br />
Fórmulas Atómicas <strong>de</strong> L At(L)<br />
Si t 1 , t 2 , ..., t n ∈ Ter(L) y P ∈ R es un símbolo <strong>de</strong> relación n-aria,<br />
entonces P(t 1 , t 2 , ..., t n ) ∈ At(L)<br />
Ter(L 2 )<br />
a) a, b<br />
b) x, y, z, ...<br />
c) f(a), g(a, b), f(g(a, b)),<br />
g(f(a), x), ...<br />
At(L 2 )<br />
P(a, b), P(a, a), P(x, y), P(x, b),<br />
P(f(a), g(a, b)), P(z, f(g(a, b))), ...<br />
<strong>Ciencias</strong> <strong>de</strong> la Computación II - Filminas <strong>de</strong> Clase – Mg. Virginia Mauco – <strong>Facultad</strong> Cs. <strong>Exactas</strong> – UNCPBA - 2009<br />
3
Dado L = <br />
Fórmulas <strong>de</strong> L F m (L)<br />
a) At(L) ⊆ F m (L)<br />
Lenguaje <strong>de</strong> <strong>Primer</strong> Or<strong>de</strong>n<br />
b) Si A, B ∈ F m (L) entonces (¬A), (A ∧ B), (A ∨ B), (A → B), (A ↔ B) ∈ F m (L)<br />
c) Si A ∈ F m (L) entonces (∀xA), (∃xA) ∈ F m (L) (x ∈ Var)<br />
At(L 2 )<br />
P(a, b), P(a, a), P(x, y), P(x, b),<br />
P(f(a), g(a, b)), P(z, f(g(a, b))),<br />
...<br />
F m (L 2 )<br />
(P(a, b) ∧ P(a, a))<br />
(∃x(P(x, y) ∨ (¬ P(x, b)))),<br />
(P(f(a), g(a, b)) ∧ P(z, f(g(a, b)))),<br />
...<br />
<strong>Ciencias</strong> <strong>de</strong> la Computación II - Filminas <strong>de</strong> Clase – Mg. Virginia Mauco – <strong>Facultad</strong> Cs. <strong>Exactas</strong> – UNCPBA - 2009<br />
Lenguaje <strong>de</strong> <strong>Primer</strong> Or<strong>de</strong>n<br />
Para simplificar la escritura <strong>de</strong> las fórmulas, po<strong>de</strong>mos eliminar ciertos<br />
paréntesis, siguiendo las reglas:<br />
• ¬, ∀x, ∃x tienen mayor prece<strong>de</strong>ncia que los conectivos binarios<br />
• los conectivos binarios tienen la misma prece<strong>de</strong>ncia que en la <strong>Lógica</strong><br />
Proposicional: ∧ , ∨, →, ↔ (<strong>de</strong> mayor a menor)<br />
F m (L 2 )<br />
Eliminando paréntesis<br />
(P(a, b) ∧ P(a, a)) P(a, b) ∧ P(a, a)<br />
(∃x(P(x, y) ∨ (¬ P(x, b)))) ∃x(P(x, y) ∨ ¬ P(x, b))<br />
(P(f(a), g(a, b)) ∧ P(z, f(g(a, b)))) P(f(a), g(a, b)) ∧ P(z, f(g(a, b)))<br />
<strong>Ciencias</strong> <strong>de</strong> la Computación II - Filminas <strong>de</strong> Clase – Mg. Virginia Mauco – <strong>Facultad</strong> Cs. <strong>Exactas</strong> – UNCPBA - 2009<br />
4
Subfórmulas<br />
Lenguaje <strong>de</strong> <strong>Primer</strong> Or<strong>de</strong>n<br />
Sea L un lenguaje y A, B ∈ F m (L). El conjunto <strong>de</strong> subfórmulas <strong>de</strong> una fórmula se<br />
<strong>de</strong>fine como<br />
a) Sf(A) = {A} si A ∈ At(L)<br />
b) Sf(¬A)) = Sf(A) ∪ {¬A}<br />
c) Sf(A * B) = Sf(A) ∪ Sf(B) ∪ { A * B } don<strong>de</strong> * es cualquiera <strong>de</strong> los conectivos<br />
binarios ∨, ∧, →, ↔<br />
d) Sf(∀xA) = Sf(A) ∪ {∀xA}<br />
e) Sf(∃xA) = Sf(A) ∪ {∃xA}<br />
Ejemplo<br />
Sf(∃x(P(x, y) ∨ P(x, b))) =<br />
= Sf(P(x, y) ∨ P(x, b)) ∪ {∃x(P(x, y) ∨ P(x, b))}<br />
= Sf(P(x, y)) ∪ Sf(P(x, b)) ∪ {P(x, y) ∨ P(x, b), ∃x(P(x, y) ∨ P(x, b))}<br />
= {P(x, y), P(x, b), P(x, y) ∨ P(x, b), ∃x(P(x, y) ∨ P(x, b))}<br />
<strong>Ciencias</strong> <strong>de</strong> la Computación II - Filminas <strong>de</strong> Clase – Mg. Virginia Mauco – <strong>Facultad</strong> Cs. <strong>Exactas</strong> – UNCPBA - 2009<br />
Lenguaje <strong>de</strong> <strong>Primer</strong> Or<strong>de</strong>n<br />
Alcance <strong>de</strong> un cuantificador<br />
Es la fórmula afectada por el cuantificador. Si ∀xA o ∃xA es una fórmula,<br />
el alcance <strong>de</strong>l cuantificador ∀x o ∃x es la fórmula A<br />
Ejemplos<br />
∀x P(x) → ∀y R(x, y)<br />
∀x P(x) → ∀x R(x, y)<br />
∀x ∀y (P(x) → R(x, y))<br />
<strong>Ciencias</strong> <strong>de</strong> la Computación II - Filminas <strong>de</strong> Clase – Mg. Virginia Mauco – <strong>Facultad</strong> Cs. <strong>Exactas</strong> – UNCPBA - 2009<br />
5
Variables libres y ligadas<br />
Lenguaje <strong>de</strong> <strong>Primer</strong> Or<strong>de</strong>n<br />
Una ocurrencia <strong>de</strong> una variable x en una fórmula A se dice ligada si está<br />
<strong>de</strong>ntro <strong>de</strong>l alcance <strong>de</strong> un cuantificador. En caso contrario se dice libre.<br />
Ejemplos<br />
∀x P(x) → ∀y R(x, y)<br />
Ocurrencia ligada <strong>de</strong> x<br />
En una fórmula A<br />
Ocurrencia libre <strong>de</strong> x<br />
Ocurrencia ligada <strong>de</strong> y<br />
- cada ocurrencia <strong>de</strong> una variable es o libre o ligada en A.<br />
- una misma variable pue<strong>de</strong> tener ocurrencias libres y ligadas en A<br />
<strong>Ciencias</strong> <strong>de</strong> la Computación II - Filminas <strong>de</strong> Clase – Mg. Virginia Mauco – <strong>Facultad</strong> Cs. <strong>Exactas</strong> – UNCPBA - 2009<br />
Lenguaje <strong>de</strong> <strong>Primer</strong> Or<strong>de</strong>n<br />
Una variable x ocurre libre en una fórmula A si:<br />
- Si A es atómica, x ocurre libre en A sí y sólo sí x es variable <strong>de</strong> A<br />
- Si A = ¬B, x ocurre libre en A sí y sólo sí x ocurre libre en B<br />
- Si A = B * C, x ocurre libre en A sí y sólo sí x ocurre libre en B o en C<br />
(siendo * alguno <strong>de</strong> los conectivos binarios)<br />
- Si A = ∀yB o A = ∃yB, x ocurre libre en A sí y sólo sí x ≠ y y x ocurre<br />
libre en B.<br />
A(x 1 , x 2 , ..., x n ) indica que las variables libres <strong>de</strong> A están en el conjunto<br />
{x 1 , x 2 , ..., x n }<br />
<strong>Ciencias</strong> <strong>de</strong> la Computación II - Filminas <strong>de</strong> Clase – Mg. Virginia Mauco – <strong>Facultad</strong> Cs. <strong>Exactas</strong> – UNCPBA - 2009<br />
6
Lenguaje <strong>de</strong> <strong>Primer</strong> Or<strong>de</strong>n<br />
Una fórmula A se dice cerrada (o sentencia) cuando no tiene variables<br />
libres (cada variable está <strong>de</strong>ntro <strong>de</strong>l alcance <strong>de</strong> un cuantificador).<br />
∀x ∀y (P(x) → R(x, y)) FORMULA CERRADA<br />
∀x P(x) → ∀x R(x, y) FORMULA NO CERRADA (y es libre)<br />
La clausura universal <strong>de</strong> una fórmula A(x 1 , x 2 , ..., x n ) es la sentencia<br />
∀x 1 ∀x 2 ... ∀x n A(x 1 , x 2 , ..., x n )<br />
La clausura existencial <strong>de</strong> una fórmula A(x 1 , x 2 , ..., x n ) es la sentencia<br />
∃x 1 ∃x 2 ... ∃x n A(x 1 , x 2 , ..., x n )<br />
Sustitución<br />
<strong>Ciencias</strong> <strong>de</strong> la Computación II - Filminas <strong>de</strong> Clase – Mg. Virginia Mauco – <strong>Facultad</strong> Cs. <strong>Exactas</strong> – UNCPBA - 2009<br />
Lenguaje <strong>de</strong> <strong>Primer</strong> Or<strong>de</strong>n<br />
Si A es una fórmula, x una variable libre <strong>de</strong> A y t un término, la sustitución<br />
<strong>de</strong> x por t en A, A(x/t), es la fórmula que se obtiene al reemplazar en A<br />
cada ocurrencia libre <strong>de</strong> x por el término t.<br />
Ejemplo<br />
A = ∀xR(x, y) ∧ B(y) A(y/c) = ∀xR(x, c) ∧ B(c) c constante<br />
A = ∀xP(x) → Q(x) A(x/c) = = ∀xP(x) → Q(c) c constante<br />
Sustitución simultánea<br />
Si A es una fórmula A(x 1 , x 2 , ..., x n ), y t 1 , t 2 , ..., t n son términos entonces la<br />
sustitución simultánea A(x 1 /t 1 , x 2 /t 2 , ..., x n /t n ) es la fórmula que se obtiene<br />
al reemplazar en A cada ocurrencia libre <strong>de</strong> x i por el término t i .<br />
<strong>Ciencias</strong> <strong>de</strong> la Computación II - Filminas <strong>de</strong> Clase – Mg. Virginia Mauco – <strong>Facultad</strong> Cs. <strong>Exactas</strong> – UNCPBA - 2009<br />
7
Sustitución en términos:<br />
Lenguaje <strong>de</strong> <strong>Primer</strong> Or<strong>de</strong>n<br />
Sean t y h términos y x una variable. La sustitución <strong>de</strong> la variable x por el<br />
término h en t es el término t(x/h) <strong>de</strong>finido como sigue:<br />
a) Si t = x entonces t(x/h) = h<br />
b) Si t = y, y variable distinta <strong>de</strong> x, entonces t(x/h) = y<br />
c) Si t = c, c constante, entonces t(x/h) = c<br />
d) Si t = f(t 1 , t 2 , ..., t n ), f símbolo <strong>de</strong> función n-aria y t 1 , t 2 , ..., t n términos,<br />
entonces t(x/h) = f(t 1 /h, t 2 /h, ..., t n /h)<br />
<strong>Ciencias</strong> <strong>de</strong> la Computación II - Filminas <strong>de</strong> Clase – Mg. Virginia Mauco – <strong>Facultad</strong> Cs. <strong>Exactas</strong> – UNCPBA - 2009<br />
Sustitución en fórmulas:<br />
Lenguaje <strong>de</strong> <strong>Primer</strong> Or<strong>de</strong>n<br />
Sea A una fórmula, h un término y x una variable. La sustitución <strong>de</strong> la<br />
variable x por el término h en A es la fórmula A(x/h) <strong>de</strong>finida como sigue:<br />
a) Si A = R(t 1 , t 2 , ..., t n ), R símbolo <strong>de</strong> predicado n-ario,<br />
entonces A(x/h) = R(t 1 /h, t 2 /h, ..., t n /h)<br />
b) Si A = ¬B, entonces A(x/h) = (¬B)(x/h)<br />
c) Si A = B * C, don<strong>de</strong> * es ∧, ∨, →, ↔, entonces A(x/h) = (B*C)(x/h) =<br />
B(x/h) * C(x/h)<br />
d) Si A = ∃xB, entonces A(x/h) = ∃xB<br />
e) Si A = ∃yB, entonces A(x/h) = ∃yB(x/h) siendo x variable libre en B<br />
f) Si A = ∀xB, entonces A(x/h) = ∀xB<br />
g) Si A = ∀yB, entonces A(x/h) = ∀yB(x/h) siendo x variable libre en B<br />
<strong>Ciencias</strong> <strong>de</strong> la Computación II - Filminas <strong>de</strong> Clase – Mg. Virginia Mauco – <strong>Facultad</strong> Cs. <strong>Exactas</strong> – UNCPBA - 2009<br />
8
Lenguaje <strong>de</strong> <strong>Primer</strong> Or<strong>de</strong>n<br />
Un término t se dice libre para una variable x en una fórmula A si<br />
ninguna ocurrencia libre <strong>de</strong> x está <strong>de</strong>ntro <strong>de</strong>l alcance <strong>de</strong> un cuantificador<br />
∀y o ∃y don<strong>de</strong> y es una variable <strong>de</strong> t.<br />
Si t es libre para x en A entonces t se pue<strong>de</strong> sustituir en todas las<br />
ocurrencias libres <strong>de</strong> x sin que alguna variable y <strong>de</strong> t que<strong>de</strong> <strong>de</strong>ntro <strong>de</strong>l<br />
alcance <strong>de</strong> un cuantificador.<br />
Resumiendo:<br />
- Sólo sustituiremos ocurrencias libres <strong>de</strong> las variables<br />
- Las ocurrencias <strong>de</strong> variables que aporte cada término sustituyente<br />
<strong>de</strong>ben resultar libres en la fórmula final.<br />
Estas restricciones garantizan que la fórmula resultante <strong>de</strong> la sustitución<br />
será (in)satisfacible si la original lo era.<br />
Ejemplos<br />
<strong>Ciencias</strong> <strong>de</strong> la Computación II - Filminas <strong>de</strong> Clase – Mg. Virginia Mauco – <strong>Facultad</strong> Cs. <strong>Exactas</strong> – UNCPBA - 2009<br />
A 1 = ∀x(B(x) → C(y))<br />
Lenguaje <strong>de</strong> <strong>Primer</strong> Or<strong>de</strong>n<br />
- El término t = f(x), f símbolo <strong>de</strong> función unaria, no es libre para y en A 1<br />
- El término t = f(z) es libre para y en A 1<br />
A 1 (y/f(z)) = ∀x(B(x) → C(f(z)))<br />
A 2 = ∀xB(x, y) → ∀zB(z, x)<br />
- El término t = g(x, w), g símbolo <strong>de</strong> función binaria, no es libre para y en A 2<br />
- El término t = g(y, z) es libre para y en A 2 y pero no es libre para x en A 2<br />
A 2 (y/g(y, z)) = ∀xB(x, g(y, z)) → ∀zB(z, x)<br />
<strong>Ciencias</strong> <strong>de</strong> la Computación II - Filminas <strong>de</strong> Clase – Mg. Virginia Mauco – <strong>Facultad</strong> Cs. <strong>Exactas</strong> – UNCPBA - 2009<br />
9
Lenguaje <strong>de</strong> <strong>Primer</strong> Or<strong>de</strong>n<br />
Composición <strong>de</strong> sustituciones: Dadas e 1 y e 2 sustituciones<br />
e 1 = { x 1/t 1, x 2/t 2, ..., x n/t n} e 2 = { y 1/s 1, y 2/s 2, ..., y k/s k}<br />
e 1.e 2 = { x i/t ie 2 : x i ≠ t ie 2, i = 1, ..., n} ∪ { y j/s j : y j ≠ x i , i = 1, ..., n, j = 1, ..., k}<br />
Ejemplo:<br />
e 1 = { x/g(y, a), y/b, z/f(w), u/w} e 2 = { y/f(b), w/u, t/g(a, f(b))}<br />
e 1.e 2 = { x/g(f(b), a), y/b, z/f(u), w/u, t/g(a, f(b))}<br />
<strong>Ciencias</strong> <strong>de</strong> la Computación II - Filminas <strong>de</strong> Clase – Mg. Virginia Mauco – <strong>Facultad</strong> Cs. <strong>Exactas</strong> – UNCPBA - 2009<br />
Semántica <strong>de</strong> <strong>Primer</strong> Or<strong>de</strong>n<br />
Mo<strong>de</strong>los o interpretaciones:<br />
Sea L = un lenguaje <strong>de</strong> primer or<strong>de</strong>n. Un mo<strong>de</strong>lo M en L es una<br />
estructura M = don<strong>de</strong>:<br />
D dominio o universo <strong>de</strong> interpretación (conjunto no vacío <strong>de</strong>l cual<br />
las variables toman valores)<br />
R D conjunto <strong>de</strong> relaciones n-arias sobre D tal que para cada<br />
símbolo P ∈ R existe una relación P D ⊆ D n asignada a P<br />
F D conjunto <strong>de</strong> funciones n-arias sobre D tal que para cada símbolo<br />
f ∈ F existe una función f D : D n → D asignada a f<br />
C D conjunto <strong>de</strong> elementos distinguidos <strong>de</strong> D tal que para cada<br />
constante c ∈ C existe un elemento c D ∈ D asignado a c<br />
<strong>Ciencias</strong> <strong>de</strong> la Computación II - Filminas <strong>de</strong> Clase – Mg. Virginia Mauco – <strong>Facultad</strong> Cs. <strong>Exactas</strong> – UNCPBA - 2009<br />
10
Ejemplo:<br />
Semántica <strong>de</strong> <strong>Primer</strong> Or<strong>de</strong>n<br />
Sea L = un lenguaje <strong>de</strong> primer or<strong>de</strong>n con una relación binaria Q,<br />
una función unaria f y una constante c<br />
Dadas F 1 = ∀xQ(x, c) y F 2 = ∃xQ(f(x), c) →∃zQ(z, z) sobre L<br />
Para el mo<strong>de</strong>lo M = <br />
D = {1, 2, 3} c D = 2<br />
Q D (x, y) = {(1, 2), (2, 1), (3, 3)} f D (1) = f D (2) = 3 f D (3) = 1<br />
F 1 es falsa en M y F 2 es verda<strong>de</strong>ra en M<br />
<strong>Ciencias</strong> <strong>de</strong> la Computación II - Filminas <strong>de</strong> Clase – Mg. Virginia Mauco – <strong>Facultad</strong> Cs. <strong>Exactas</strong> – UNCPBA - 2009<br />
Formalización <strong>de</strong> Lenguaje Natural<br />
Formalizar frase en lenguaje natural → encontrar expresión en<br />
lenguaje formal que la represente fielmente<br />
No hay procedimientos generales para la formalización<br />
Existen algunas estrategias o heurísticas<br />
- Si la estructura sintáctica <strong>de</strong> la frase es compleja, se pue<strong>de</strong> reescribir<br />
con una estructura más sencilla que mantenga el mismo significado<br />
- Definir el dominio al cual pertenecen los elementos a utilizar<br />
- Determinar:<br />
Constantes: elementos concretos <strong>de</strong>l dominio<br />
Variables: elementos genéricos<br />
Funciones: representan cómo un elemento queda<br />
<strong>de</strong>terminado por otros<br />
<strong>Predicados</strong> unarios: representan propieda<strong>de</strong>s <strong>de</strong> un elem.<br />
<strong>Predicados</strong> <strong>de</strong> aridad > 1: representan relaciones entre elem<br />
- I<strong>de</strong>ntificar conectivas linguísticas y cuantificadores y sustituir por<br />
conectivos y cuantificadores <strong>de</strong> la lógica <strong>de</strong> primer or<strong>de</strong>n<br />
<strong>Ciencias</strong> <strong>de</strong> la Computación II - Filminas <strong>de</strong> Clase – Mg. Virginia Mauco – <strong>Facultad</strong> Cs. <strong>Exactas</strong> – UNCPBA - 2009<br />
11
Formalización <strong>de</strong> Lenguaje Natural<br />
Patrones más habituales:<br />
• Universal afirmativo ∀x(A(x) →B(x))<br />
Todo A es B - Sólo los B son A – No hay ningún A que no sea B<br />
• Universal negativo ∀x(A(x) →¬ →¬B(x)) →¬<br />
Ningún A es B<br />
• Existencial afirmativo ∃x(A(x) ∧B(x))<br />
Algún A es B – Alguien es a la vez A y B<br />
• Existencial negativo ∃x(A(x) ∧¬ ∧¬B(x)) ∧¬<br />
Algún A no es B – No todos los A son B<br />
<strong>Ciencias</strong> <strong>de</strong> la Computación II - Filminas <strong>de</strong> Clase – Mg. Virginia Mauco – <strong>Facultad</strong> Cs. <strong>Exactas</strong> – UNCPBA - 2009<br />
Formalización <strong>de</strong> Lenguaje Natural<br />
Relación entre cuantificadores:<br />
• Universal/Existencial<br />
¬∀ ¬∀xA(x) ¬∀ ≡ ∃x¬A(x)<br />
“No todos son A” equivale a <strong>de</strong>cir “Algunos no son A”<br />
• Existencial/Universal<br />
¬∃ ¬∃xA(x) ¬∃ ≡ ∀x¬A(x)<br />
“No hay A” equivale a <strong>de</strong>cir “Todos son no A”<br />
<strong>Ciencias</strong> <strong>de</strong> la Computación II - Filminas <strong>de</strong> Clase – Mg. Virginia Mauco – <strong>Facultad</strong> Cs. <strong>Exactas</strong> – UNCPBA - 2009<br />
12