With the simplification of contexts, bestfitting becomes simpler as well, as does the semantics for identifiers in expressions.

An equation *q* is, conceptually, a triple (*x*_{q}, *K*_{q}, *E*_{q}), where *x*_{q} is the variable being defined, *K*_{q} is the set of contexts where the equation is valid, and *E*_{q} is the defining expression.

Given two equations *q* and *q’*, we write *q* ⊂ *q’* if *x*_{q} = *x*_{q’} and *K*_{q} ⊃ *K*_{q’}.

If we have a set of equations σ, then best(σ) consists of the bestfit equations in σ , i.e.,

best(σ) = {*q* ∊ σ | ∄ *q'* ∊ σ. *q* ⊂ *q'*}

The restriction of a set of equations σ to an identifier *x* and a context κ is written

σ|*x*κ = {*q* ∊ σ | *x* = *x*_{q} and κ ∊ *K*_{q}}

We can now write the semantics for identifiers in equations.

⟦*x*⟧σκ =

let {*q*_{1}, ..., *q*_{n}} = best(σ|*x*κ) in

let *v*_{i} = ⟦*E*_{qi}⟧σκ in

*v*_{1} ⊕ ⋯ ⊕ *v*_{n}

where ⊕ is the combining operator. The simplest combining operator checks that all of its arguments are identical, and returns that value. In the general language, each identifier could have its own combining operator, which could be any commutative, associative operator.

## Reply