|
Coalescable Equivalence Relation TemplateConcept Coalescable_Equivalence_Relation_Template (size: integer); uses boolean, integer; requires size > 0; Family Equiv_Reln Í ([1 .. size] x [1 .. size] ) ® B; exemplar E; constraints " x: [1 .. size], E(x,x) and " x,y: [1 .. size], if E(x,y) then E(y,x) and " x,y,z: [1 .. size], if E(x,y) and E(y,z) then E(x,z); initialization ensures " x,y: [1 .. size], if E(x,y) then x = y; operation are_equivalent ( x,y: [1 .. size]; e: Equiv_Reln): boolean; ensures are_equivalent = E(x,y); operation make_equivalent (x,y: [1 .. size]; var e: Equiv_Reln); ensures " u,v: [1 .. size], E(u,v) iff @E(u,v) or @E(u,x) and @R(y,v) or @E(u,y) and @E(x,v); operation clear_equivalence (var e: Equiv_Reln); ensures " x,y: [1 .. size], if E(x,y), x = y; end; |
Last modified: Tuesday, 18-Feb-2003 14:31:16 EST