Re: An alternative to possreps

From: David BL <davidbl_at_iinet.net.au>
Date: Thu, 9 Jun 2011 09:34:24 -0700 (PDT)
Message-ID: <bb82c6ec-e23d-4b52-b44f-f4189848914f_at_h12g2000pro.googlegroups.com>


On Jun 8, 6:08 pm, Erwin <e.sm..._at_myonline.be> wrote:
> On 8 jun, 03:55, David BL <davi..._at_iinet.net.au> wrote:

> > The equality operator has a role to play in this. The possrep
> > constraint which specifies which representations of ellipses are
> > circles is instead defined indirectly by the equality operator (which
> > defines which representations of ellipses are equal to some
> > representation of a circle).

> I definitely prefer to see the rule that determines whether or not an
> ellipse is a circle, stated explicitly as part of the declaration of
> CIRCLE, rather than having to go digging in the details of the
> equality operator (or even worse, in its implementing code).

It occurred to me that Horn clauses in the manner of Prolog provide a nice way to define the equality operator at the logical level of discourse.

For example, thinking of the infix equality operator as a Prolog predicate the following can be interpreted as a Prolog Horn clause:

  circle(R,C) = ellipse(R,R,C).

I see no reason why this clause cannot appear near the declarations associated with type Circle.

Here's some more examples of clauses:

  rational(N1,D1) = rational(N2,D2) :-
    N1*D2 = N2*D1.

  ocircle(R) = circle(R,cartesian(0,0)).

That's elegant!

However, things are murky when reals get involved, and the implementation uses floating point numbers. E.g.

  cartesian(X,Y) = polar(R,T) :-
    X = R*cos(T), Y = R*sin(T).

For any operator f(X1,...,Xn) we have the implicit rule

  f(X1,...,Xn) = f(Y1,...,Yn) :-
    X1=Y1, X2=Y2, ... , Xn=Yn.

This rule implies equality is reflexive, i.e. the following rule is implied

  X = X.

It would be appropriate to assume equality is symmetric and transitive, which should help simplify the problem of defining equality. Received on Thu Jun 09 2011 - 18:34:24 CEST

Original text of this message