[ library(sd) | Reference Manual | Alphabetic Index ]

# msg(?X, ?Y, -MSG)

MSG is the most specific generalisation of X and Y representable with domain variables from this library
X
Any term or variable
Y
Any term or variable
MSG
A domain variable or constant (output)

## Description

This predicate computes the most specific generalisation of X and Y which can be represented using this library's domain variables.

If X and Y are domain variables (or atomic constants), then MSG will be unified with a new domain variable whose domain consists of the union of the domain elements of X and Y. If the domain union contains only a single value, the result is this single value.

If X or Y are free (unconstrained) variables, then the result will also be a free (unconstrained) variable.

None

## Examples

```    ?- msg(we, fr, Z).
Z = Z{[we, fr]}
Yes (0.00s cpu)

?- X &:: [sa, su], msg(X, we, Z).
X = X{[sa, su]}
Z = Z{[we, sa, su]}
Yes (0.00s cpu)

?- X &:: [sa, su], Y &:: [mo, tu, we], msg(X, Y, Z).
X = X{[sa, su]}
Y = Y{[mo, tu, we]}
Z = Z{[mo, tu, we, sa, su]}
Yes (0.00s cpu)

?- X &:: [sa, su], msg(X, _, Z).
X = X{[sa, su]}
Z = Z
Yes (0.01s cpu)

?- msg(we, we, X).
X = we
Yes (0.00s cpu)
```