[ ECLiPSe PROPIA built-in.|Group Index| Full Index]

+Goal infers +Language

Succeeds if Goal succeeds. Computes the most specific generalization of all the solutions of the Goal according to the approximation Language and delays if Goal has several non comparable solutions.

+Goal
Callable Term.
+Language
One of the terms most, ground, consistent, none or size(N) where N is a positive integer.

Description

Used to do generalized propagation over Goal.

With the most language, Goal is bound to the most specific generalization of all its solutions. If one of the solutions is not a variant of this answer, the goal is delayed until one of its variables is bound. Note that the Goal may have an infinity of solutions.

Using other languages, an approximation of this most specific generalization can be computed. With the ground language, infers/2 instantiates the Goal only if the solutions of Goal are all the same ground term. If not, the goal is delayed until one of its variables is bound. With the consistent language, infers/2 does not bind the Goal but only checks if Goal has at least one solution. In this case, the goal is delayed until one of its variables is bound.

Fail Conditions

Fails if Goal has no solution.

Resatisfiable

No.

Exceptions

(4) Instantiation fault
Goal or Language is not instantiated.
(6) Range error
Language is not a correct language.
(68)
Goal is an undefined procedure.

Examples


   Success:
   [eclipse]: member(X, [f(1), f(2)]) infers most.
   X = f(_g1075[1, 2])
   yes.
   [eclipse]: [user].
   and(0, _, 0).
   and(_, 0, 0).
   and(1, 1, 1).
   user       compiled traceable 528 bytes in 0.00 seconds
   yes.
   [eclipse]: and(0, X, Y).
   X = X
   Y = 0     More? (;)          % Prolog: two solutions
   X = 0
   Y = 0
   yes.
   [eclipse]: and(0, X, Y) infers most.
   X = X
   Y = 0
   yes.                         % Prolog + infers: one solution
   [eclipse]: [user].
   greater_than(succ(X), X).
   greater_than(succ(X), Y) :- greater_than(X, Y).
   user       compiled traceable 268 bytes in 0.00 seconds
   yes.
   [eclipse]: greater_than(X, zero).
   X = succ(zero)     More? (;) % Prolog: infinity of solutions
   ...
   [eclipse]: greater_than(X, zero) infers most.
   X = succ(_g1073)
   Delayed goals:
   infers(greater_than(succ(_g1073), zero), most, eclipse)
   yes.
   Fail:
   [eclipse]: member(1, [2, 3]) infers consistent.
   no (more) solution.
   Error:
   Goal infers most. % Error 4
   true infers true.  % Error 6

See Also