Unification

From Wikipedia, the free encyclopedia

This article is about the computer science topic. For other uses of the term, see Unification (disambiguation). For the idea of global unification, see globalization.

In mathematical logic, in particular as applied to computer science, a unification of two terms is a join (in the lattice sense) with respect to a specialisation order. That is, we suppose a preorder on a set of terms, for which t* ≤ t means that t* is obtained from t by substituting some term(s) for one or more free variables in t. The unification u of s and t, if it exists, is a term that is a substitution instance of both s and t. If any common substitution instance of s and t is also an instance of u, u is called minimal unification.

For example, with polynomials, X2 and Y3 can be unified to Z6 by taking X = Z3 and Y = Z2.

The concept of unification is one of the main ideas behind logic programming, best known through the language Prolog. It represents the mechanism of binding the contents of variables and can be viewed as a kind of one-time assignment. In Prolog, this operation is denoted by symbol "=".

  1. In traditional Prolog, a variable X which is uninstantiated—i.e. no previous unifications were performed on it—can be unified with an atom, a term, or another uninstantiated variable, thus effectively becoming its alias. In many modern Prolog dialects and in first-order logic, a variable cannot be unified with a term that contains it; this is the so called occurs check.
  2. A Prolog atom can be unified only with the same atom.
  3. Similarly, a term can be unified with another term if the top function symbols and arities of the terms are identical and if the parameters can be unified simultaneously. Note that this is a recursive behaviour.

Due to its declarative nature, the order in a sequence of unifications is (usually) unimportant.

Note that in the terminology of first-order logic, an atom is a basic proposition and is unified similarly to a Prolog term.

  • A = A : Succeeds (tautology)
  • A = B, B = abc : Both A and B are unified with the atom abc
  • xyz = C, C = D : Unification is symmetric
  • abc = abc : Unification succeeds
  • abc = xyz : Fails to unify because the atoms are different
  • f(A) = f(B) : A is unified with B
  • f(A) = g(B) : Fails because the heads of the terms are different
  • f(A) = f(B, C) : Fails to unify because the terms have different arity
  • f(g(A)) = f(B) : Unifies B with the term g(A)
  • f(g(A), A) = f(B, xyz) : Unifies A with the atom xyz and B with the term g(xyz)
  • A = f(A) : Infinite unification, A is unified with f(f(f(f(...)))). In proper first-order logic and many modern Prolog dialects this is forbidden (and enforced by the occurs check)
  • A = abc, xyz = X, A = X : Fails to unify; effectively abc = xyz

Advanced Search
Included Web Search Engines


Safe Search

close

Top Matching Results

Occasionally Search.com will highlight specialized results that are based on the context of your query. Examples of specialized results include specific links to news, images, or video.

Top Matching Results may highlight information from other Search.com pages, content from the CNET Network of sites, or third party content. The listings are based purely on relevance. Search.com does not receive payment for listings in this section but our partners that provide this data may get paid for listing these products.

Sponsored Links

This section contains paid listings which have been purchased by companies that want to have their sites appear for specific search terms and related content. These listings are administered, sorted and maintained by a third party and are not endorsed by Search.com.

Search Results

Search.com sends your search query to several search engines at one time and integrates the results into one list which has been sorted by relevance using Search.com's proprietary algorithm. You can customize the list of search engines included in your metasearch from the preferences.

The search engines that are used in your metasearch may allow companies to pay to have their Web sites included within the results. To view the Paid Inclusion policy for a specific search engine, please visit their Web site. Search.com does not accept payment or share revenue with any search engine partner for listings in this section.