Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Unification (computer science)
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Examples of syntactic unification of first-order terms=== In the Prolog syntactical convention a symbol starting with an upper case letter is a variable name; a symbol that starts with a lowercase letter is a function symbol; the comma is used as the logical ''and'' operator. For mathematical notation, ''x,y,z'' are used as variables, ''f,g'' as function symbols, and ''a,b'' as constants. {| class="wikitable" |- ! Prolog notation !! Mathematical notation !! Unifying substitution !! Explanation |- | <code> a = a </code> || { ''a'' = ''a'' } || {} || Succeeds. ([[Tautology (logic)|tautology]]) |- | <code> a = b </code> || { ''a'' = ''b'' } || β₯ || ''a'' and ''b'' do not match |- | <code> X = X </code> || { ''x'' = ''x'' } || {} || Succeeds. ([[Tautology (logic)|tautology]]) |- | <code> a = X </code> || { ''a'' = ''x'' } || { ''x'' β¦ ''a'' } || ''x'' is unified with the constant ''a'' |- | <code> X = Y </code> || { ''x'' = ''y'' } || { ''x'' β¦ ''y'' } || ''x'' and ''y'' are aliased |- | <code> f(a,X) = f(a,b) </code> || { ''f''(''a'',''x'') = ''f''(''a'',''b'') } || { ''x'' β¦ ''b'' } || function and constant symbols match, ''x'' is unified with the constant ''b'' |- | <code> f(a) = g(a) </code> || { ''f''(''a'') = ''g''(''a'') } || β₯ || ''f'' and ''g'' do not match |- | <code> f(X) = f(Y) </code> || { ''f''(''x'') = ''f''(''y'') } || { ''x'' β¦ ''y'' } || ''x'' and ''y'' are aliased |- | <code> f(X) = g(Y) </code> || { ''f''(''x'') = ''g''(''y'') } || β₯ || ''f'' and ''g'' do not match |- | <code> f(X) = f(Y,Z) </code> || { ''f''(''x'') = ''f''(''y'',''z'') } || β₯ || Fails. The ''f'' function symbols have different arity |- | <code> f(g(X)) = f(Y) </code> || { ''f''(''g''(''x'')) = ''f''(''y'') } || { ''y'' β¦ ''g''(''x'') } || Unifies ''y'' with the term {{tmath|g(x)}} |- | <code> f(g(X),X) = f(Y,a) </code> || { ''f''(''g''(''x''),''x'') = ''f''(''y'',''a'') } || { ''x'' β¦ ''a'', ''y'' β¦ ''g''(''a'') } || Unifies ''x'' with constant ''a'', and ''y'' with the term {{tmath|g(a)}} |- | <code> X = f(X) </code> || { ''x'' = ''f''(''x'') } || should be β₯ || Returns β₯ in first-order logic and many modern Prolog dialects (enforced by the ''[[occurs check]]''). Succeeds in traditional Prolog and in Prolog II, unifying ''x'' with infinite term <code>x=f(f(f(f(...))))</code>. |- | <code> X = Y, Y = a </code> || { ''x'' = ''y'', ''y'' = ''a'' } || { ''x'' β¦ ''a'', ''y'' β¦ ''a'' } || Both ''x'' and ''y'' are unified with the constant ''a'' |- | <code> a = Y, X = Y </code> || { ''a'' = ''y'', ''x'' = ''y'' } || { ''x'' β¦ ''a'', ''y'' β¦ ''a'' } || As above (order of equations in set doesn't matter) |- | <code> X = a, b = X </code> || { ''x'' = ''a'', ''b'' = ''x'' } || β₯ || Fails. ''a'' and ''b'' do not match, so ''x'' can't be unified with both |} [[File:Unification exponential blow-up svg.svg|thumb|Two terms with an exponentially larger tree for their least common instance. Its [[directed acyclic graph|dag]] representation (rightmost, orange part) is still of linear size.]] The most general unifier of a syntactic first-order unification problem of [[Term (logic)#Operations with terms|size]] {{mvar|n}} may have a size of {{math|2<sup>''n''</sup>}}. For example, the problem {{tmath| (((a*z)*y)*x)*w \doteq w*(x*(y*(z*a))) }} has the most general unifier {{tmath| \{ z \mapsto a, y \mapsto a*a, x \mapsto (a*a)*(a*a), w \mapsto ((a*a)*(a*a))*((a*a)*(a*a)) \} }}, cf. picture. In order to avoid exponential time complexity caused by such blow-up, advanced unification algorithms work on [[directed acyclic graph]]s (dags) rather than trees.{{refn|e.g. {{harvtxt|Paterson|Wegman|1978}} sect.2, p.159}}
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Unification (computer science)
(section)
Add topic