Edición de «Práctica 3 (Paradigmas)»
De Cuba-Wiki
Puedes deshacer la edición. Antes de deshacer la edición, comprueba la siguiente comparación para verificar que realmente es lo que quieres hacer, y entonces publica los cambios para así efectuar la reversión.
Revisión actual | Tu texto | ||
Línea 6: | Línea 6: | ||
dado X = {w, w1, w2, . . . , x, x1, x2, . . . , y, y1, y2, . . . , f, f1, f2, . . . } | dado X = {w, w1, w2, . . . , x, x1, x2, . . . , y, y1, y2, . . . , f, f1, f2, . . . } | ||
Términos sin anotaciones | Términos sin anotaciones | ||
M0 ::= x | λx.M0 | M0 M0 | True | False | if M0 then M0 else M0 | 0 | succ(M0) | pred(M0) | isZero(M0) | M0 | ||
::= x | λx.M0 | |||
| M0 M0 | |||
| True | False | if M0 | |||
then M0 | |||
else M0 | |||
| 0 | succ(M0 | |||
) | pred(M0 | |||
) | isZero(M0 | |||
) | |||
Tipos | Tipos | ||
σ ::= Bool | Nat | σ → σ | s | σ ::= Bool | Nat | σ → σ | s | ||
Línea 14: | Línea 23: | ||
== Ejercicio 1 == | == Ejercicio 1 == | ||
Determinar qué expresiones son sintácticamente válidas y, para las que sean, indicar a qué gramática pertenecen. | Determinar qué expresiones son sintácticamente válidas y, para las que sean, indicar a qué gramática pertenecen. | ||
i. λx: Bool.succ(x) -- Válida, grámatica con anotaciones. | i. λx: Bool.succ(x) -- Válida, grámatica con anotaciones. | ||
ii. λx.isZero(x) -- Válida, grámatica sin anotaciones. | ii. λx.isZero(x) -- Válida, grámatica sin anotaciones. | ||
iii. s → σ -- No Válida. σ es una metavariable. | iii. s → σ -- No Válida. σ es una metavariable. | ||
iv. Erase(f y) Válida, grámatica sin anotaciones. | iv. Erase(f y) Válida, grámatica sin anotaciones. | ||
v. s -- Válida, grámatica de tipos. | v. s -- Válida, grámatica de tipos. | ||
vi. s → (Bool → t) -- Válida, grámatica de tipos. | vi. s → (Bool → t) -- Válida, grámatica de tipos. | ||
vii. λx: s1 → s2.if 0 then True else 0 succ(True) -- No Válida | |||
vii. λx: s1 → s2.if 0 then True else 0 succ(True) -- No Válida | |||
viii. Erase(λf : Bool → s.λy : Bool.f y) -- Válida, grámatica con anotaciones. | viii. Erase(λf : Bool → s.λy : Bool.f y) -- Válida, grámatica con anotaciones. | ||