There seem to be problems with the various orderings. 

As a partial order is reflexive the basic operation in PartialOrder is "<=" and 
hence there are categorial implementations for >, >= and < there. 

for the category OrderedSet for the total (linear) orderings in FriCAS we have 
"<" as the basic operation. This gives confusion what to implement in a domain 
of OrderedSet. 

E.g. I defined a FiniteSet using as first parameter Symbol and a second 
parameter a List of Symbols using as the linear ordering the one from the 
occurence in the List - and implemented  <= using smaller? - of course a 
mistake, as smaller? is really < which strange results for min and max.  But 
the setting confused. 

I suggest the following: 

stay on "<="  as basic operations also for OrderedSet. 

It suffices to have the following categorial implementation, all the others are 
inherited from PartialOrder

    max(x, y) ==
        x <= y  => y
        x
    min(x, y) ==
        x  <= y => x
        y

and drop all the other, which are inherited anyway.
Perhaps one could think about an Attribute linearilyOrdered or totallyOrdered



)abbrev category COMPAR Comparable
++ Description:
++ The class of set equipped with possibly unnatural linear order
++ (needed for technical reasons).
Comparable() : Category == SetCategory with
  --operations
    smaller? : (%, %) -> Boolean
      ++ smaller?(x, y) is a strict total ordering on the elements of the set.

PartialOrder() : Category == with
    "<": (%,%) -> Boolean
      ++ x < y is a less than test.
    ">":         (%, %) -> Boolean
      ++ x > y is a greater than test.
    ">=":        (%, %) -> Boolean
      ++ x >= y is a greater than or equal test.
    "<=":        (%, %) -> Boolean
      ++ x <= y is a less than or equal test.

  add

     x >= y == y <= x

     x > y == y < x

     x < y == x <= y and not(y <= x)


OrderedSet() : Category == Join(Comparable, PartialOrder) with
  --operations

    max : (%, %) -> %
      ++ max(x,y) returns the maximum of x and y relative to "<".
    min : (%, %) -> %
      ++ min(x,y) returns the minimum of x and y relative to "<".
  add
    -- transitional definitions
    smaller?(x, y) == x < y

  --declarations
    x, y : %
  --definitions
  -- These really ought to become some sort of macro
    max(x, y) ==
        x > y => x
        y
    min(x, y) ==
        x > y => y
        x
    ((x : %) >  (y : %)) : Boolean == y < x
    ((x : %) >= (y : %)) : Boolean == not (x < y)
    ((x : %) <= (y : %)) : Boolean == not (y < x)






-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to