Term unification
Author: Daniel Diaz
Keywords: GNU Prolog, manual, Prolog, compiler, constraints, finite domains

### 8.2 Term unification

- (=)/2 - Prolog unification
- unify_with_occurs_check/2
- (\=)/2 - not Prolog unifiable

#### 8.2.1 (=)/2 - Prolog unification

Templates

  =(?term, ?term)

Description

Term1 = Term2 unifies Term1 and Term2. No occurs check is done, i.e. this predicate does not check if a variable is unified with a compound term containing this variable (this can lead to an infinite loop).

= is a predefined infix operator (section 8.14.10).

Errors

None.

Portability

ISO predicate.

#### 8.2.2 unify_with_occurs_check/2

Templates

  unify_with_occurs_check(?term, ?term)

Description

unify_with_occurs_check(Term1, Term2) unifies Term1 and Term2. The occurs check test is done (i.e. the unification fails if a variable is unified with a compound term containing this variable).

Errors

None.

Portability

ISO predicate.

#### 8.2.3 (\=)/2 - not Prolog unifiable

Templates

  \=(?term, ?term)

Description

Term1 \= Term2 succeeds if Term1 and Term2 are not unifiable (no occurs check is done).

\= is a predefined infix operator (section 8.14.10).

Errors

None.

Portability

ISO predicate.

Copyright (C) 1999-2021 Daniel Diaz Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. More about the copyright