What is Euclid
Syntax
Domains Covered
Operational Semantics
Solved Examples
Implementation
The Theory behind

Euclid Domains

Domains (Data types) available in Euclid

This document presents the domains used in Euclid together with the structure of their terms, their respective functions and relations. Note that equality is defined in ALL domains.

This document gives only a short summary of each domain. Please refer to the Euclid manual for more detailed information.

Real Numbers

The real numbers are used much in the same way as in CLP(R).

  • Terms (Constants): {1,2,...},{1.01,...},{infty,pi,e}
  • Functions (operators): -/1,+/2,-/2,//2,*/2,^/2,cos/1,sin/1,tan/1,cot/1,log/1,ln/1
  • Relations (constraints): real/1,>/2,=/2,<=/2,\=/2

For example X^3>=3*cos(Y)

top of page

Real Intervals

Euclid also knows about real intervals -in the mathematical sense: a tuple of the end points and the type of interval at each point (open or closed). The relations between intervals include (/2 (before), >/2 (after), meets/2, in/2 and many more. Intervals are represented as cc(X,Y) for [x,y], oc(X,Y) for (X,Y] and so forth for the other two cases.

  • Terms (Constants): oc(X,Y),oo(X,Y),cc(X,Y),co(X,Y) where X,Y are real numbers, such that X<=Y. ('o' stands for open and 'c' for closed interval side.
  • Functions (operators):
  • Relations (constraints): interval/1,>/2,=/2,<=/2,meets/2,overlaps/2. '>' and '<' stand for (strict) before/2 and after/2

For example oc(1,X) meets (Y,5)

top of page

Real Vectors

The real vectors are handled as lists of real elements

  • Terms (Constants): [X,Y,...,Z], where X,Y,...,Z are reals terms
  • Functions (operators): -/1,+/2,-/2,//2,*/2,x/2,^/2,cos/1,sin/1,tan/1,cot/1,log/1,ln/1 (direct generalizations of the real ones)
  • Relations (constraints): vector/2 (second argument is dimension)

For example vector(X,2),X^2=25,X=[5,M]

top of page

Real algebraic formulae (on one variable)

These objects are much the same as what is known in mathematics as one-valued reals functions but we will reserve the term function in Euclid to denote a much more complex object (one that has an interval based domain to take its values from). Real formulae are built up from real terms with the addition of a placeholder variable - the one we expect to substitute in the future. The formula f(t)=3*cos(w t) where w is a real variable can be represented in euclid as F=(3*cos(W*T))//T. The variable W will take its value from the real solver while T is only a placeholder for real values. The domain of real formulae comes equipped with the functors +, -, *, /, ^ ,limit/2, o/2, integral/1, derivative/1. The functors limit/2 and ^/2 are cross--domain functions defined as FxR->R. It is also interesting to note the function o/2 (composition) which allows for change of placeholder variables (i.e. if you know f(x) and x(t) you can calculate f(t) by x(t) o f(x), or in Euclid X o F). integral/1 and derivative/1 give the standard integral and total derivative respectively of the formula at hand. The way to obtain values from formulae is through the @/2} function defined as F x R -> R (i.e. f(2) would be given by the real term F@2).

  • Terms (Constants): KK//X, where KK is a real symbolic term which may or may not contain the real variable X.
  • Functions (operators): -/1,-/2,+/2,*/2,derivative/1,integral/1,@/2(value at), o/2(compose)
  • Relations (constraints): formula/1

For example formula(X),X=(3*Z^2-cos(2*pi))//Z,X@2=12

top of page

Real (multi-branch) symbolic functions (on one variable)

A function is an ordered collection of (interval,formula) pairs such that the interval of each pair is before the interval of the previous pair. If such a pair of intervals meets at a point both formulae must have the same value for that point. This type of function is some times referred to as a multi-branch function.

  • Terms (Constants): {[ int1:form1,...,intn:formn ]} where inti are intervals, and formi are formulae constrained as explained above
  • Functions (operators): #/2 (combine branches), @/2 (value at), derivative/2, integral/2 (direct generalizations of the real ones)
  • Relations (constraints): function/1
For example :

	formula(F), 
	F = {[
		cc(-infty,2): (X^2-2)//X ,
		cc(2,infty): (X^3-6)//X
	     ]}.

It is natural for variables to be declared at the beginning of each clause; this way the programmer makes sure that there is no ambiguity (except intentionally) on constraints (e.g. X+Y=Z could be answered as correct if X,Y,Z belong to the reals, vectors, formulae or functions -unless any of the variables has already been committed to a single domain).

 

© 1995 Dr. K J Dryllerakis
Please read the Legal Information concerning Euclid.
CLP(R) is a Trademark of IBM Watson Research Centre, Quintus Prolog is a trademark of Quintus Corporation, USA. SunOS is a trademark of Sun MicroSystems.