[m-dev.] Re: [HAL-dev] Adding Herbrand types to Mercury

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Jan 27 06:03:09 AEDT 2004


On 23-Jan-2004, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> (2) Herbrand types in Mercury
> 
> Herbrand types are a special kind of solver type supporting Prolog
> style unification.
> 
> The syntax for Herbrand type definitions will be as follows:
> 
> :- herbrand type <typename> ---> <du constructors>.
>
> Herbrand types have private builtin <initpred> and <unifypred>
> definitions with signatures
> 
> :- pred init_Herbrand(T::out(any)) is det.
> :- pred unify_Herbrand(T::in(any), T:in(any)) is semidet.

I'm a bit confused here.  Should that be

	:- pred init_Herbrand(<typename>::out(any)) is det.

or perhaps

	:- pred init_<typename>(<typename>::out(any)) is det.

(and likewise for unify_Herbrand)?

Here I am using angle brackets to denote meta-variables.

> The unification procedure generated for <typename> is almost identical
> to what would be generated if it were an ordinary du type, with the
> exception that unify_Herbrand/2 is called where one or both of the
> variables being unified is "unbound" (i.e. has been initialised, but is
> not currently bound to a ground value.)

I'm not quite sure why you want to split unification into
two parts, the first part being the unification procedure
and the second part being the unify_Herbrand procedure.
Wouldn't it be simpler to just have the unification procedure
handle all the cases?

If one of the two procedures was being implemented by the user,
and one automatically generated by the compiler, then that would
explain the split.  But the syntax that you proposed for Herbrand
types doesn't allow the user to specify a different unify_Herbrand
procedure.

Is it a design goal to allow users to implement their own constraint
solver for Herbrand-style variables?

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list