Todos los libros

Profesional

Apps Acerca de Coach Iniciar sesión Empezar a leer

Computer Science · Glosario

¿Qué es Type substitution, type equation?

También llamado: type substitution · type equation

Definition 6.11 University Computer Science — Year 3 · Capítulo 6 — Type Systems and Type Inference

A type substitution maps type variables to types and applies to a type by replacing each of its variables. A type equation τ1≐τ2\tau_1 \doteq \tau_2 asks for a type substitution SS with S(τ1)=S(τ2)S(\tau_1) = S(\tau_2).

Unifying ( a b) × a with ( int bool) × c: left children first gives 'a := int and 'b := bool; the right children are then 'a, already int, and 'c, so 'c := int. Both trees become the tree on the right (unification_of_the_figure).
Unifying (’ a→’ b)×’ a(\texttt{\textquotesingle a} \to \texttt{\textquotesingle b}) \times \texttt{\textquotesingle a} with (int→bool)×’ c(\mathtt{int} \to \mathtt{bool}) \times \texttt{\textquotesingle c}: left children first gives 'a := int and 'b := bool; the right children are then 'a, already int, and 'c, so 'c := int. Both trees become the tree on the right (unification_of_the_figure).
Leer en el capítulo →