[m-dev.] not_reached inst

Ian MacLarty maclarty at csse.unimelb.edu.au
Wed Apr 11 16:23:21 AEST 2007

On Wed, Apr 11, 2007 at 02:43:31PM +1000, Simon Taylor wrote:
> On 11-Apr-2007, Ian MacLarty <maclarty at csse.unimelb.edu.au> wrote:
> > I've been reading David Overton's PHD thesis and discovered the not_reached
> > inst.
> > 
> > I would find it useful to use this inst in some Mercury code that is being
> > automatically generated.  The not_reached insts is however not documented
> > anywhere in the reference manual.  Could we make the not_reached inst
> > "official" by documenting it in the reference manual?  Are there any problems
> > with using the not_reached inst in Mercury programs?
> In what context do you want to use not_reached insts?  What would the
> documented behaviour be?

What I want is the inst bound({}) (where {} is the empty set) which, according
to Overton's PhD, is what not_reached is defined as.

Here is the reason I want such an inst:

I have a tool that generates Mercury code for an OWL ontology (for more
information on OWL see http://www.w3.org/TR/owl-semantics/direct).  The OWL
ontology consists of individuals, classes and properties.  Individuals are just
URIs, classes are sets of individuals and properties are binary relations on
individuals.  The tool generates insts for the classes and binary predicates
for the properties.  Here is an example:

Suppose we have class c = {"a", "b", "c"}, class d = {"a", "b"}
and property p = {<"a", "b">, <"b", "b">, <"c", "a">, <"c", "b">}
the tool would generate something like:

:- inst c
	--->	"a"
	;	"b"
	;	"c".

:- inst d
	--->	"a"
	;	"b".

:- pred p(string, string).
:- mode p(in, out) is nondet.

p("a", "b").
p("b", "b").
p("c", "a").
p("c", "b").

Now, in OWL you can place restrictions on properties for particular sub
domains of the property, so for example, you could say that p should relate
each individual from class d to exacly one individual from class c.  This
would cause the following mode to be generated:

:- mode p(in(d), out(c)) is det.

Developers use the generated insts and predicates to write interpreters for
OWL ontologies.

Now it may be the case that class d is empty (perhaps because no members of d
have been added to the ontology yet).  In this case I'd like to be able to
generate the inst:

:- inst d == not_reached.

but still have the same modes as above, so that developers could write
and compile code using the d inst (even though no procedures that used
the d inst could ever be called).

Actually if I try this it doesn't do what I expect.  I get a determinism error
for the mode :- mode p(in(d), out(c)) is det.  I don't expect a determinism
error, because, as I understand it, this mode of p could never be called, so it
shouldn't really matter what determinism I give.

Clearly the not_reached doesn't behave how I think it does, so I withdraw
my request for it to be documented in the reference manual.

mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au

More information about the developers mailing list