Re: rationals or reals?

On Fri, 7 Dec 2007, Pascal Hitzler wrote:
>
> Just a forward from little discussion we just had in the lunch break. 
> Consider e.g. the following setting: We allow rationals as datatype, but not 
> the reals. If we also have multiplication, then it would be possible to 
> specify a class
>
> smallSquare: all squares with sideLength*sideLength < 2
>
> What happens then (since we're over the rationals) is that this class would 
> be empty (because sideLength would not resolve in a rational).
>
> My feeling is that this is very unintuitive. It might be preferrable to use 
> the reals (instead of the rationals) for defining the semantics - if that is 
> possible.

I agree that this is problematic. It makes datatype reasoning more
difficult and users will be surprised if results really rely on a
number being not rational. So rationals together with multiplication
is not a good choice.

My preferred solution would be to add the rationals *and the reals* as
new datatypes. As constants, we should then admit only rationals (for
the obvious reason that real numbers s cannot be represented as finite
strings). On top, we could think of admitting particular real constants
such as pi. Don't know whether we really want that. I feel that the
rationals should still be included, for the sake of completeness (and
also they *do* make sense if, say, we only have addition but not multi-
plication).

greetings,
 		Carsten

--
*      Carsten Lutz, Institut f"ur Theoretische Informatik, TU Dresden       *
*     Office phone:++49 351 46339171   mailto:lutz@tcs.inf.tu-dresden.de     *

Received on Wednesday, 12 December 2007 12:10:13 UTC