--> **************************************************************** --> Generic Sets --> **************************************************************** --> ---------------------------------------------------------------- --> SET: generic sets --> ---------------------------------------------------------------- mod! SET(X :: TRIV) { [Elt < Set] -- empty set op empty : -> Set {constr} . op __ : Set Set -> Set {constr assoc comm id: empty} . -- impotent ceq (S:Set S) = S if not(S == empty) . } --> ---------------------------------------------------------------- --> TRIV=: TRIV with _=e_ --> ---------------------------------------------------------------- mod* TRIV= { [Elt] pred _=e_ : Elt Elt {comm} . eq (E:Elt =e E) = true . cq [:nonexec]: E1:Elt = E2:Elt if (E1 =e E2) . } --> ---------------------------------------------------------------- --> SETin: generic sets with _in_ --> ---------------------------------------------------------------- mod! SETin (X :: TRIV=) { pr(SET(X)) -- in pred _in_ : Elt Set . eq (E:Elt in empty) = false . eq (E1:Elt in (E2:Elt S:Set)) = ((E1 =e E2) or (E1 in S)) . } --> ---------------------------------------------------------------- --> SET=: generic sets with _=_ --> ---------------------------------------------------------------- mod! SET= { pr(SETin) -- equality on Set pred _=s_ : Set Set {comm} . eq (S:Set =s S) = true . cq [:nonexec]: S1:Set = S2:Set if (S1 =s S2) . -- _=<_, equal of less than pred _=<_ : Set Set . eq (empty =< S:Set) = true . eq ((E1:Elt S1:Set) =< S2:Set) = (E1 in S2) and (S1 =< S2) . -- eq (S1:Set =s S2:Set) = ((S1 =< S2) and (S2 =< S1)) . } --> ---------------------------------------------------------------- --> provide set provide set --> **************************************************************** --> end of file eof --> ****************************************************************