DIRECTORY Rope, IO, AlgebraClasses; ASPowerSetStructure: CEDAR DEFINITIONS ~ BEGIN OPEN Rope, AC: AlgebraClasses; Set: TYPE = AC.Object; SetData: TYPE = LIST OF AC.Object; PowerSetStructureData: TYPE = REF PowerSetStructureDataRec; PowerSetStructureDataRec: TYPE = RECORD [ universe: AC.Object -- the elements of the Structure are the subsets of universe ]; MakePowerSetStructure: AC.SequenceStructureConstructor; PrintName: AC.ToRopeOp; ShortPrintName: AC.ToRopeOp; IsPowerSetStructure: AC.UnaryPredicate; Universe: AC.UnaryOp; Recast: AC.BinaryOp; CanRecast: AC.BinaryPredicate; ToExpr: AC.ToExprOp; LegalFirstChar: AC.LegalFirstCharOp; Read: AC.ReadOp; FromRope: AC.FromRopeOp; ToRope: AC.ToRopeOp; Write: AC.WriteOp; MakeSet: AC.ListImbedOp; IsElement: AC.BinaryPredicate; IsSubset: AC.BinaryPredicate; Cardinality: AC.ElementRankOp; Equal: AC.BinaryPredicate; Union: AC.BinaryOp; Intersection: AC.BinaryOp; DeleteElement: AC.BinaryOp; Difference: AC.BinaryOp; MapUnaryElementOp: AC.BinaryMixedOp; END. LASPowerSetStructure.mesa Last Edited by: Arnon, November 19, 1987 8:31:50 am PST Structure Constructor: Power set of argument Structure. Currently, only allows creation of, and can only work with, finite subsets (i.e. finite collections of elements of argument Structure). Element Representation The elements of SetData are assumed to be distinct. The empty set is represented by NIL SetData. Structure Instance Data Structure Constructor Record that the resulting Structure is a BooleanAlgebra. Operations on Power Set Structures selector: universe of a Power Set Structure Conversion and IO for Elements of Power Set Structures (i.e. finite sets) Element Constructor I.e. makes a finite set belonging to a particular PowerSetStructure. Currently no checks for repetitions of elements. Does check that supplied elements actually belong to universe (recasts if necessary). data = NIL => empty set. Predicates for Sets firstArg is an Object, and secondArg is a Set. Returns TRUE if firstArg is an element of secondArg. firstArg and secondArg are Sets. Returns TRUE if firstArg is a subset of secondArg. Operations on Sets firstArg is a Set, secondArg an element of it. result is firstArg - {secondArg}. Error if secondArg not an element of firstArg firstArg is a Set, secondArg an element of it. result is A - B. ok if B has elements not in A. firstArg is a Set, secondArg is REF to UnaryOp on its elementStructure, result is Set of results of applications of UnaryOp to elements of firstArg. Note that, by elimination of duplicates, cardinality of result may be less than cardinality of argument. Κύ˜Jšœ™J™7J˜Jšœΐ™ΐJ™šΟk ˜ Icodešœ˜Kšœ˜Kšœ˜—Ihead2šΟnœœ ˜&Jšœœœœ˜'headšž™Jšœœœ˜J˜Jš œ œœœœ˜"J˜Jšœ4™4Jšœ.™.—šœ™Kšœœœ˜;šœœœ˜)Kšœ œΟc<˜PK˜——šœ™šžœœ˜7K™8K˜K˜——šœ"™"šž œœ ˜K˜—šžœœ ˜K˜—šžœœ˜'J˜—šžœœ ˜Jšœ+™+——šœI™Išžœœ ˜J˜—šž œœ˜J˜—šžœœ ˜J˜—šžœœ˜$J˜—šžœœ˜J˜—šžœœ ˜J˜—šžœœ ˜J˜—Jšžœ ˜—šœ™šžœœ ˜JšœD™DJšœ0™0JšœU™UJšœ™——šž™šž œœ˜Kšœd™dK™—šžœœ˜KšœS™S——šž™šž œœ˜K˜—šžœœ˜J˜—šžœœ ˜K˜—šž œœ ˜K˜—šž œœ ˜Kšœ™K˜—šž œœ ˜Kšœ_™_K˜K˜—šžœœ˜$K™”K™h——J˜Jšœ˜—…— Q