maple 8 relation problem

Gesus
Gesus used Ask the Experts™
on
> buildrelation:=proc(s1::set,s2::set,z::relation)
> local x, y, ans,rel;
> ans:= NULL;

> for x in s1 do
>   for y in s2 do
>    if z then
>      ans:=ans,[x,y];
>    fi;
>   od;
> od;
> return({ans});
> end:
> trace(buildrelation);

                            buildrelation

> buildrelation({$1..3},{$1..3},x<y);
{--> enter buildrelation, args = {1, 2, 3}, {1, 2, 3}, x < y

                               ans :=


                                x := 1


                                y := 1

<-- ERROR in buildrelation (now at top level) = "cannot determine if this expression is true or false: %1"}
Error, (in buildrelation) cannot determine if this expression is true or false: x-y < 0



the above works if i put x<y directly in the program, but not when i give input it as the relationship "z".

any idea how i can correct this?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
i've sorted this out on my own, but i have another maple question, if anyone can help.

i need to create proceedures to check relations for properties of reflexivity and transitivity

reflexitive rule - if Y is a subset of tX then X -> Y
Transitive Rule - if X -> Y & Y -> Z, then X -> Z
Commented:
Gladly. Thanks Gesus.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial