Re: Equivalence classes

Henry S. Thompson (ht@cogsci.ed.ac.uk) writes:

> Philip Wadler <wadler@research.bell-labs.com> writes:
> 
> > If all elements are declared via top-level `element' declarations,
> > then I think that I understand how equivalence classes work.  Can
> > someone please explain how equivalence classes work in the presence
> > of element declarations nested within type declarations?
> 
> 'equivClass' is incoherent on a nested (or 'local') element
> declaration, because of the asymmetry pointed out below.  This should
> be made clear in the spec. -- I agree it is not clear now.

I don't see what this has to do with assymetry.
Let me try my question again.

First, let's review ordinary equivalence classes with top-level elements.

  <element name="b">
    <type>
      <element name="a-in-b" type="a-in-b-type"/>
    </type>
  </element>
  <element name="c">
    <type>
      <element name="a-in-c" type="a-in-c-type"/>
    </type>
  </element>
  <element name="a-in-b-prime" type="a-in-b-prime-type" equivClass="a-in-b"/>
  <element name="a-in-c-prime" type="a-in-c-prime-type" equivClass="a-in-c"/>

This says that we can use an "a-in-b-prime" element anywhere an
"a-in-b" element may appear, and an "a-in-c-prime" element anywhere an
"a-in-c" element may appear.  (It assumes "a-in-b-prime-type" is
derived from "a-in-b-type", and "a-in-c-prime" type is derived from
"a-in-c-type".)

Now, let's say we modify the first part of the above to use the
element name "a" in place of both "a-in-b" and "a-in-c".

  <element name="b">
    <type>
      <element name="a" type="a-in-b-type"/>
    </type>
  </element>
  <element name="c">
    <type>
      <element name="a" type="a-in-c-type"/>
    </type>
  </element>

What is the corresponding modification for the remainder?  That is,
how can I specify that "a-in-b-prime" can replace the occurrences of
"a" within "b", and that "a-in-c-prime" can replace the occurrence of
"a" within "c"?  Or is this not possible?  If it's not possible, what
was the rationale for omitting it?    -- P

Received on Friday, 18 February 2000 13:00:05 UTC