Background for Unification


Simple Implementation Background
type term = Variable of string 
                | Const of (string * term list)
let x = Variable "a";; 
let tm = Const ("2", []);;

let rec subst var_name residue term = 
    match term with Variable name -> 
        if var_name = name then residue else term 
    | Const (c, tys) -> 
        Const (c, List.map (subst var_name residue) tys);;
Unification Problem

Given a set of pairs of terms (“equations”)

\[ \textcolor{blue}{\{(s_1, t_1), (s_2, t_2), ..., (s_n, t_n)\}} \]

\(\text{(the \color{red}{unification problem}) \color{black} does there exist}\)

\(\text{a substitution } \color{blue}{\sigma} \text{(the \color{red} unification solution)}\)

\(\text{of terms for variables such that}\)

\[ \color{blue} \sigma(s_i) = \sigma(t_i) \]

\(\text{for all } i = 1, ..., n?\)

Uses for Unification
Unification Algorithm