全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 Type substitution, type equation?

又称: type substitution · type equation

Definition 6.11 University Computer Science — Year 3 · 第 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).
在原文中阅读 →