recursive-set 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,129 @@
1
+ /**
2
+ * @module recursive-set
3
+ * A mutable recursive set implementation enforcing Cantor's ZFC axioms
4
+ */
5
+ /**
6
+ * RecursiveSet: Mutable set with arbitrary nesting depth
7
+ *
8
+ * Enforced ZFC Axioms (as class invariants):
9
+ * - Extensionality: Sets with same elements are equal
10
+ * - Foundation (Regularity): No membership cycles allowed
11
+ * - Power Set: Can construct 𝒫(A) for any set A
12
+ * - Union: Can construct A ∪ B for any sets A, B
13
+ * - Pairing: Can construct {a, b} for any elements a, b
14
+ */
15
+ export declare class RecursiveSet<T = any> {
16
+ private _elements;
17
+ constructor(...elements: Array<T | RecursiveSet<T>>);
18
+ /**
19
+ * Internal: Add element with cycle detection (Foundation axiom)
20
+ */
21
+ private _addElement;
22
+ /**
23
+ * Check if adding element would violate Foundation axiom
24
+ */
25
+ private _wouldCreateCycle;
26
+ /**
27
+ * Verify class invariants (Design by Contract)
28
+ */
29
+ private _checkInvariants;
30
+ /**
31
+ * Add element to this set (Pairing axiom)
32
+ * @returns this for method chaining
33
+ */
34
+ add(element: T | RecursiveSet<T>): this;
35
+ /**
36
+ * Remove element from this set
37
+ * @returns this for method chaining
38
+ */
39
+ remove(element: T | RecursiveSet<T>): this;
40
+ /**
41
+ * Remove all elements
42
+ * @returns this for method chaining
43
+ */
44
+ clear(): this;
45
+ /**
46
+ * Union of two sets (Union axiom)
47
+ * Returns A ∪ B
48
+ */
49
+ union(other: RecursiveSet<T>): RecursiveSet<T>;
50
+ /**
51
+ * Intersection of two sets
52
+ * Returns A ∩ B
53
+ */
54
+ intersection(other: RecursiveSet<T>): RecursiveSet<T>;
55
+ /**
56
+ * Set difference
57
+ * Returns A \ B (elements in A but not in B)
58
+ */
59
+ difference(other: RecursiveSet<T>): RecursiveSet<T>;
60
+ /**
61
+ * Symmetric difference
62
+ * Returns A △ B (elements in either but not both)
63
+ */
64
+ symmetricDifference(other: RecursiveSet<T>): RecursiveSet<T>;
65
+ /**
66
+ * Power set construction (Power Set axiom)
67
+ * Returns 𝒫(A) - set of all subsets
68
+ */
69
+ powerset(): RecursiveSet<RecursiveSet<T>>;
70
+ /**
71
+ * Cartesian product
72
+ * Returns A × B as set of ordered pairs {{a}, {a,b}}
73
+ */
74
+ cartesianProduct<U>(other: RecursiveSet<U>): RecursiveSet<RecursiveSet<T | U>>;
75
+ /**
76
+ * Check membership (∈)
77
+ */
78
+ has(element: T | RecursiveSet<T>): boolean;
79
+ /**
80
+ * Check if subset (⊆)
81
+ */
82
+ isSubset(other: RecursiveSet<T>): boolean;
83
+ /**
84
+ * Check if superset (⊇)
85
+ */
86
+ isSuperset(other: RecursiveSet<T>): boolean;
87
+ /**
88
+ * Check if proper subset (⊂)
89
+ */
90
+ isProperSubset(other: RecursiveSet<T>): boolean;
91
+ /**
92
+ * Check if empty set
93
+ */
94
+ isEmpty(): boolean;
95
+ /**
96
+ * Structural equality (Extensionality axiom)
97
+ * Two sets are equal iff they have the same elements
98
+ */
99
+ equals(other: RecursiveSet<T>): boolean;
100
+ /**
101
+ * Cardinality |A|
102
+ */
103
+ get size(): number;
104
+ /**
105
+ * Convert to native Set (shallow)
106
+ */
107
+ toSet(): Set<T | RecursiveSet<T>>;
108
+ /**
109
+ * Iterate over elements
110
+ */
111
+ [Symbol.iterator](): Iterator<T | RecursiveSet<T>>;
112
+ /**
113
+ * Pretty print with mathematical notation
114
+ */
115
+ toString(): string;
116
+ }
117
+ /**
118
+ * Create empty set (Null Set axiom)
119
+ */
120
+ export declare function emptySet<T = any>(): RecursiveSet<T>;
121
+ /**
122
+ * Create singleton set
123
+ */
124
+ export declare function singleton<T>(element: T): RecursiveSet<T>;
125
+ /**
126
+ * Create set from iterable
127
+ */
128
+ export declare function fromIterable<T>(iterable: Iterable<T>): RecursiveSet<T>;
129
+ //# sourceMappingURL=index.d.ts.map
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AmB9E;;OAEG;IACH,GAAG,CAAC,OAAO,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,OAAO;IAI1C;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,OAAO;IASzC;;OAEG;IACH,UAAU,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,OAAO;IAI3C;;OAEG;IACH,cAAc,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,OAAO;IAI/C;;OAEG;IACH,OAAO,IAAI,OAAO;IAMlB;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,OAAO;IAyBvC;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;OAEG;IACH,KAAK,IAAI,GAAG,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;IAIjC;;OAEG;IACF,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;IAInD;;OAEG;IACH,QAAQ,IAAI,MAAM;CAqBrB;AAID;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,GAAG,GAAG,KAAK,YAAY,CAAC,CAAC,CAAC,CAEnD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAExD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAEtE"}
@@ -1,344 +1,299 @@
1
- /**
2
- * @module recursive-set
3
- * A mutable recursive set implementation enforcing Cantor's ZFC axioms
4
- */
5
-
6
- /**
7
- * RecursiveSet: Mutable set with arbitrary nesting depth
8
- *
9
- * Enforced ZFC Axioms (as class invariants):
10
- * - Extensionality: Sets with same elements are equal
11
- * - Foundation (Regularity): No membership cycles allowed
12
- * - Power Set: Can construct 𝒫(A) for any set A
13
- * - Union: Can construct A B for any sets A, B
14
- * - Pairing: Can construct {a, b} for any elements a, b
15
- */
16
- export class RecursiveSet<T = any> {
17
- private _elements: Set<T | RecursiveSet<T>>;
18
-
19
- constructor(...elements: Array<T | RecursiveSet<T>>) {
20
- this._elements = new Set();
21
- for (const el of elements) {
22
- this._addElement(el);
23
- }
24
- this._checkInvariants();
25
- }
26
-
27
- /**
28
- * Internal: Add element with cycle detection (Foundation axiom)
29
- */
30
- private _addElement(el: T | RecursiveSet<T>): void {
31
- if (el instanceof RecursiveSet) {
32
- if (this._wouldCreateCycle(el)) {
33
- throw new Error(
34
- "Foundation axiom violated: adding this element would create a membership cycle"
35
- );
36
- }
37
- }
38
- this._elements.add(el);
39
- }
40
-
41
- /**
42
- * Check if adding element would violate Foundation axiom
43
- */
44
- private _wouldCreateCycle(element: RecursiveSet<T>): boolean {
45
- const visited = new Set<RecursiveSet<any>>();
46
- const toCheck: RecursiveSet<any>[] = [element];
47
-
48
- while (toCheck.length > 0) {
49
- const current = toCheck.pop()!;
50
- if (current === this) {
51
- return true;
52
- }
53
- if (visited.has(current)) {
54
- continue;
55
- }
56
- visited.add(current);
57
-
58
- for (const el of current._elements) {
59
- if (el instanceof RecursiveSet) {
60
- toCheck.push(el);
61
- }
62
- }
63
- }
64
- return false;
65
- }
66
-
67
- /**
68
- * Verify class invariants (Design by Contract)
69
- */
70
- private _checkInvariants(): void {
71
- // Extensionality: enforced by Set semantics
72
- // Foundation: enforced by _wouldCreateCycle
73
- // Well-definedness: enforced by TypeScript type system
74
-
75
- // Additional runtime checks can be added here
76
- if (process.env.NODE_ENV === 'development') {
77
- // More expensive checks only in development
78
- }
79
- }
80
-
81
- // === Mutable Operations ===
82
-
83
- /**
84
- * Add element to this set (Pairing axiom)
85
- * @returns this for method chaining
86
- */
87
- add(element: T | RecursiveSet<T>): this {
88
- this._addElement(element);
89
- this._checkInvariants();
90
- return this;
91
- }
92
-
93
- /**
94
- * Remove element from this set
95
- * @returns this for method chaining
96
- */
97
- remove(element: T | RecursiveSet<T>): this {
98
- this._elements.delete(element);
99
- return this;
100
- }
101
-
102
- /**
103
- * Remove all elements
104
- * @returns this for method chaining
105
- */
106
- clear(): this {
107
- this._elements.clear();
108
- return this;
109
- }
110
-
111
- // === Immutable Operations (return new sets) ===
112
-
113
- /**
114
- * Union of two sets (Union axiom)
115
- * Returns A ∪ B
116
- */
117
- union(other: RecursiveSet<T>): RecursiveSet<T> {
118
- const result = new RecursiveSet<T>();
119
- result._elements = new Set([...this._elements, ...other._elements]);
120
- return result;
121
- }
122
-
123
- /**
124
- * Intersection of two sets
125
- * Returns A B
126
- */
127
- intersection(other: RecursiveSet<T>): RecursiveSet<T> {
128
- const result = new RecursiveSet<T>();
129
- for (const el of this._elements) {
130
- if (other.has(el)) {
131
- result._elements.add(el);
132
- }
133
- }
134
- return result;
135
- }
136
-
137
- /**
138
- * Set difference
139
- * Returns A \ B (elements in A but not in B)
140
- */
141
- difference(other: RecursiveSet<T>): RecursiveSet<T> {
142
- const result = new RecursiveSet<T>();
143
- for (const el of this._elements) {
144
- if (!other.has(el)) {
145
- result._elements.add(el);
146
- }
147
- }
148
- return result;
149
- }
150
-
151
- /**
152
- * Symmetric difference
153
- * Returns A △ B (elements in either but not both)
154
- */
155
- symmetricDifference(other: RecursiveSet<T>): RecursiveSet<T> {
156
- return this.union(other).difference(this.intersection(other));
157
- }
158
-
159
- /**
160
- * Power set construction (Power Set axiom)
161
- * Returns 𝒫(A) - set of all subsets
162
- */
163
- powerset(): RecursiveSet<RecursiveSet<T>> {
164
- const elements = Array.from(this._elements);
165
- const subsets: RecursiveSet<T>[] = [];
166
-
167
- // Generate all 2^n subsets
168
- const n = elements.length;
169
- for (let i = 0; i < (1 << n); i++) {
170
- const subset = new RecursiveSet<T>();
171
- for (let j = 0; j < n; j++) {
172
- if (i & (1 << j)) {
173
- subset._elements.add(elements[j]);
174
- }
175
- }
176
- subsets.push(subset);
177
- }
178
-
179
- return new RecursiveSet<RecursiveSet<T>>(...subsets);
180
- }
181
-
182
- /**
183
- * Cartesian product
184
- * Returns A × B as set of ordered pairs {{a}, {a,b}}
185
- */
186
- cartesianProduct<U>(other: RecursiveSet<U>): RecursiveSet<RecursiveSet<T | U>> {
187
- const pairs: RecursiveSet<T | U>[] = [];
188
-
189
- for (const x of this._elements) {
190
- for (const y of other._elements) {
191
- // Kuratowski ordered pair: (x,y) := {{x}, {x,y}}
192
- const pair = new RecursiveSet<T | U>(
193
- new RecursiveSet<T | U>(x),
194
- new RecursiveSet<T | U>(x, y)
195
- );
196
- pairs.push(pair);
197
- }
198
- }
199
-
200
- return new RecursiveSet<RecursiveSet<T | U>>(...pairs);
201
- }
202
-
203
- // === Predicates ===
204
-
205
- /**
206
- * Check membership (∈)
207
- */
208
- has(element: T | RecursiveSet<T>): boolean {
209
- return this._elements.has(element);
210
- }
211
-
212
- /**
213
- * Check if subset (⊆)
214
- */
215
- isSubset(other: RecursiveSet<T>): boolean {
216
- for (const el of this._elements) {
217
- if (!other.has(el)) {
218
- return false;
219
- }
220
- }
221
- return true;
222
- }
223
-
224
- /**
225
- * Check if superset (⊇)
226
- */
227
- isSuperset(other: RecursiveSet<T>): boolean {
228
- return other.isSubset(this);
229
- }
230
-
231
- /**
232
- * Check if proper subset (⊂)
233
- */
234
- isProperSubset(other: RecursiveSet<T>): boolean {
235
- return this.isSubset(other) && !this.equals(other);
236
- }
237
-
238
- /**
239
- * Check if empty set
240
- */
241
- isEmpty(): boolean {
242
- return this._elements.size === 0;
243
- }
244
-
245
- // === Extensionality (Equality) ===
246
-
247
- /**
248
- * Structural equality (Extensionality axiom)
249
- * Two sets are equal iff they have the same elements
250
- */
251
- equals(other: RecursiveSet<T>): boolean {
252
- if (this._elements.size !== other._elements.size) {
253
- return false;
254
- }
255
-
256
- for (const el of this._elements) {
257
- if (el instanceof RecursiveSet) {
258
- // Deep comparison for nested sets
259
- let found = false;
260
- for (const otherEl of other._elements) {
261
- if (otherEl instanceof RecursiveSet && el.equals(otherEl)) {
262
- found = true;
263
- break;
264
- }
265
- }
266
- if (!found) return false;
267
- } else {
268
- if (!other.has(el)) return false;
269
- }
270
- }
271
- return true;
272
- }
273
-
274
- // === Utility ===
275
-
276
- /**
277
- * Cardinality |A|
278
- */
279
- get size(): number {
280
- return this._elements.size;
281
- }
282
-
283
- /**
284
- * Convert to native Set (shallow)
285
- */
286
- toSet(): Set<T | RecursiveSet<T>> {
287
- return new Set(this._elements);
288
- }
289
-
290
- /**
291
- * Iterate over elements
292
- */
293
- *[Symbol.iterator](): Iterator<T | RecursiveSet<T>> {
294
- yield* this._elements;
295
- }
296
-
297
- /**
298
- * Pretty print with mathematical notation
299
- */
300
- toString(): string {
301
- if (this.isEmpty()) {
302
- return "∅";
303
- }
304
-
305
- const elements = Array.from(this._elements).map(el => {
306
- if (el instanceof RecursiveSet) {
307
- return el.toString();
308
- }
309
- return String(el);
310
- });
311
-
312
- return `{${elements.join(", ")}}`;
313
- }
314
-
315
- /**
316
- * For console.log
317
- */
318
- [Symbol.for('nodejs.util.inspect.custom')](): string {
319
- return this.toString();
320
- }
321
- }
322
-
323
- // === Helper Functions ===
324
-
325
- /**
326
- * Create empty set (Null Set axiom)
327
- */
328
- export function emptySet<T = any>(): RecursiveSet<T> {
329
- return new RecursiveSet<T>();
330
- }
331
-
332
- /**
333
- * Create singleton set
334
- */
335
- export function singleton<T>(element: T): RecursiveSet<T> {
336
- return new RecursiveSet<T>(element);
337
- }
338
-
339
- /**
340
- * Create set from iterable
341
- */
342
- export function fromIterable<T>(iterable: Iterable<T>): RecursiveSet<T> {
343
- return new RecursiveSet<T>(...iterable);
344
- }
1
+ /**
2
+ * @module recursive-set
3
+ * A mutable recursive set implementation enforcing Cantor's ZFC axioms
4
+ */
5
+ /**
6
+ * RecursiveSet: Mutable set with arbitrary nesting depth
7
+ *
8
+ * Enforced ZFC Axioms (as class invariants):
9
+ * - Extensionality: Sets with same elements are equal
10
+ * - Foundation (Regularity): No membership cycles allowed
11
+ * - Power Set: Can construct 𝒫(A) for any set A
12
+ * - Union: Can construct A ∪ B for any sets A, B
13
+ * - Pairing: Can construct {a, b} for any elements a, b
14
+ */
15
+ export class RecursiveSet {
16
+ _elements;
17
+ constructor(...elements) {
18
+ this._elements = new Set();
19
+ for (const el of elements) {
20
+ this._addElement(el);
21
+ }
22
+ this._checkInvariants();
23
+ }
24
+ /**
25
+ * Internal: Add element with cycle detection (Foundation axiom)
26
+ */
27
+ _addElement(el) {
28
+ if (el instanceof RecursiveSet) {
29
+ if (this._wouldCreateCycle(el)) {
30
+ throw new Error("Foundation axiom violated: adding this element would create a membership cycle");
31
+ }
32
+ }
33
+ this._elements.add(el);
34
+ }
35
+ /**
36
+ * Check if adding element would violate Foundation axiom
37
+ */
38
+ _wouldCreateCycle(element) {
39
+ const visited = new Set();
40
+ const toCheck = [element];
41
+ while (toCheck.length > 0) {
42
+ const current = toCheck.pop();
43
+ if (current === this) {
44
+ return true;
45
+ }
46
+ if (visited.has(current)) {
47
+ continue;
48
+ }
49
+ visited.add(current);
50
+ for (const el of current._elements) {
51
+ if (el instanceof RecursiveSet) {
52
+ toCheck.push(el);
53
+ }
54
+ }
55
+ }
56
+ return false;
57
+ }
58
+ /**
59
+ * Verify class invariants (Design by Contract)
60
+ */
61
+ _checkInvariants() {
62
+ // Extensionality: enforced by Set semantics
63
+ // Foundation: enforced by _wouldCreateCycle
64
+ // Well-definedness: enforced by TypeScript type system
65
+ // Additional runtime checks can be added here
66
+ if (process.env.NODE_ENV === 'development') {
67
+ // More expensive checks only in development
68
+ }
69
+ }
70
+ // === Mutable Operations ===
71
+ /**
72
+ * Add element to this set (Pairing axiom)
73
+ * @returns this for method chaining
74
+ */
75
+ add(element) {
76
+ this._addElement(element);
77
+ this._checkInvariants();
78
+ return this;
79
+ }
80
+ /**
81
+ * Remove element from this set
82
+ * @returns this for method chaining
83
+ */
84
+ remove(element) {
85
+ this._elements.delete(element);
86
+ return this;
87
+ }
88
+ /**
89
+ * Remove all elements
90
+ * @returns this for method chaining
91
+ */
92
+ clear() {
93
+ this._elements.clear();
94
+ return this;
95
+ }
96
+ // === Immutable Operations (return new sets) ===
97
+ /**
98
+ * Union of two sets (Union axiom)
99
+ * Returns A ∪ B
100
+ */
101
+ union(other) {
102
+ const result = new RecursiveSet();
103
+ result._elements = new Set([...this._elements, ...other._elements]);
104
+ return result;
105
+ }
106
+ /**
107
+ * Intersection of two sets
108
+ * Returns A ∩ B
109
+ */
110
+ intersection(other) {
111
+ const result = new RecursiveSet();
112
+ for (const el of this._elements) {
113
+ if (other.has(el)) {
114
+ result._elements.add(el);
115
+ }
116
+ }
117
+ return result;
118
+ }
119
+ /**
120
+ * Set difference
121
+ * Returns A \ B (elements in A but not in B)
122
+ */
123
+ difference(other) {
124
+ const result = new RecursiveSet();
125
+ for (const el of this._elements) {
126
+ if (!other.has(el)) {
127
+ result._elements.add(el);
128
+ }
129
+ }
130
+ return result;
131
+ }
132
+ /**
133
+ * Symmetric difference
134
+ * Returns A △ B (elements in either but not both)
135
+ */
136
+ symmetricDifference(other) {
137
+ return this.union(other).difference(this.intersection(other));
138
+ }
139
+ /**
140
+ * Power set construction (Power Set axiom)
141
+ * Returns 𝒫(A) - set of all subsets
142
+ */
143
+ powerset() {
144
+ const elements = Array.from(this._elements);
145
+ const subsets = [];
146
+ // Generate all 2^n subsets
147
+ const n = elements.length;
148
+ for (let i = 0; i < (1 << n); i++) {
149
+ const subset = new RecursiveSet();
150
+ for (let j = 0; j < n; j++) {
151
+ if (i & (1 << j)) {
152
+ subset._elements.add(elements[j]);
153
+ }
154
+ }
155
+ subsets.push(subset);
156
+ }
157
+ return new RecursiveSet(...subsets);
158
+ }
159
+ /**
160
+ * Cartesian product
161
+ * Returns A × B as set of ordered pairs {{a}, {a,b}}
162
+ */
163
+ cartesianProduct(other) {
164
+ const pairs = [];
165
+ for (const x of this._elements) {
166
+ for (const y of other._elements) {
167
+ // Kuratowski ordered pair: (x,y) := {{x}, {x,y}}
168
+ const pair = new RecursiveSet(new RecursiveSet(x), new RecursiveSet(x, y));
169
+ pairs.push(pair);
170
+ }
171
+ }
172
+ return new RecursiveSet(...pairs);
173
+ }
174
+ // === Predicates ===
175
+ /**
176
+ * Check membership ()
177
+ */
178
+ has(element) {
179
+ return this._elements.has(element);
180
+ }
181
+ /**
182
+ * Check if subset (⊆)
183
+ */
184
+ isSubset(other) {
185
+ for (const el of this._elements) {
186
+ if (!other.has(el)) {
187
+ return false;
188
+ }
189
+ }
190
+ return true;
191
+ }
192
+ /**
193
+ * Check if superset ()
194
+ */
195
+ isSuperset(other) {
196
+ return other.isSubset(this);
197
+ }
198
+ /**
199
+ * Check if proper subset (⊂)
200
+ */
201
+ isProperSubset(other) {
202
+ return this.isSubset(other) && !this.equals(other);
203
+ }
204
+ /**
205
+ * Check if empty set
206
+ */
207
+ isEmpty() {
208
+ return this._elements.size === 0;
209
+ }
210
+ // === Extensionality (Equality) ===
211
+ /**
212
+ * Structural equality (Extensionality axiom)
213
+ * Two sets are equal iff they have the same elements
214
+ */
215
+ equals(other) {
216
+ if (this._elements.size !== other._elements.size) {
217
+ return false;
218
+ }
219
+ for (const el of this._elements) {
220
+ if (el instanceof RecursiveSet) {
221
+ // Deep comparison for nested sets
222
+ let found = false;
223
+ for (const otherEl of other._elements) {
224
+ if (otherEl instanceof RecursiveSet && el.equals(otherEl)) {
225
+ found = true;
226
+ break;
227
+ }
228
+ }
229
+ if (!found)
230
+ return false;
231
+ }
232
+ else {
233
+ if (!other.has(el))
234
+ return false;
235
+ }
236
+ }
237
+ return true;
238
+ }
239
+ // === Utility ===
240
+ /**
241
+ * Cardinality |A|
242
+ */
243
+ get size() {
244
+ return this._elements.size;
245
+ }
246
+ /**
247
+ * Convert to native Set (shallow)
248
+ */
249
+ toSet() {
250
+ return new Set(this._elements);
251
+ }
252
+ /**
253
+ * Iterate over elements
254
+ */
255
+ *[Symbol.iterator]() {
256
+ yield* this._elements;
257
+ }
258
+ /**
259
+ * Pretty print with mathematical notation
260
+ */
261
+ toString() {
262
+ if (this.isEmpty()) {
263
+ return "∅";
264
+ }
265
+ const elements = Array.from(this._elements).map(el => {
266
+ if (el instanceof RecursiveSet) {
267
+ return el.toString();
268
+ }
269
+ return String(el);
270
+ });
271
+ return `{${elements.join(", ")}}`;
272
+ }
273
+ /**
274
+ * For console.log
275
+ */
276
+ [Symbol.for('nodejs.util.inspect.custom')]() {
277
+ return this.toString();
278
+ }
279
+ }
280
+ // === Helper Functions ===
281
+ /**
282
+ * Create empty set (Null Set axiom)
283
+ */
284
+ export function emptySet() {
285
+ return new RecursiveSet();
286
+ }
287
+ /**
288
+ * Create singleton set
289
+ */
290
+ export function singleton(element) {
291
+ return new RecursiveSet(element);
292
+ }
293
+ /**
294
+ * Create set from iterable
295
+ */
296
+ export function fromIterable(iterable) {
297
+ return new RecursiveSet(...iterable);
298
+ }
299
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;GASG;AACH,MAAM,OAAO,YAAY;IACb,SAAS,CAA2B;IAE5C,YAAY,GAAG,QAAoC;QAC/C,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC;QAC3B,KAAK,MAAM,EAAE,IAAI,QAAQ,EAAE,CAAC;YACxB,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QACzB,CAAC;QACD,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACK,WAAW,CAAC,EAAuB;QACvC,IAAI,EAAE,YAAY,YAAY,EAAE,CAAC;YAC7B,IAAI,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC,EAAE,CAAC;gBAC7B,MAAM,IAAI,KAAK,CACX,gFAAgF,CACnF,CAAC;YACN,CAA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UAAU,QAAQ;IACpB,OAAO,IAAI,YAAY,EAAK,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAI,OAAU;IACnC,OAAO,IAAI,YAAY,CAAI,OAAO,CAAC,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAI,QAAqB;IACjD,OAAO,IAAI,YAAY,CAAI,GAAG,QAAQ,CAAC,CAAC;AAC5C,CAAC"}
package/package.json CHANGED
@@ -1,17 +1,21 @@
1
1
  {
2
2
  "name": "recursive-set",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Mutable recursive sets with ZFC axioms for TypeScript",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "type": "module",
8
8
  "exports": {
9
9
  ".": {
10
- "import": "./dist/index.js",
11
- "types": "./dist/index.d.ts"
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
12
  }
13
13
  },
14
+ "files": [
15
+ "dist"
16
+ ],
14
17
  "scripts": {
18
+ "prepublishOnly": "npm run build",
15
19
  "build": "tsc",
16
20
  "watch": "tsc --watch",
17
21
  "clean": "rm -rf dist",
@@ -31,15 +35,15 @@
31
35
  "license": "MIT",
32
36
  "repository": {
33
37
  "type": "git",
34
- "url": "git+https://github.com/<USERNAME>/recursive-set.git"
38
+ "url": "git+https://github.com/cstrerath/recursive-set.git"
35
39
  },
36
40
  "bugs": {
37
- "url": "https://github.com/<USERNAME>/recursive-set/issues"
41
+ "url": "https://github.com/cstrerath/recursive-set/issues"
38
42
  },
39
- "homepage": "https://github.com/<USERNAME>/recursive-set#readme",
43
+ "homepage": "https://github.com/cstrerath/recursive-set#readme",
40
44
  "devDependencies": {
41
45
  "@types/node": "^20.0.0",
42
46
  "tsx": "^4.20.6",
43
47
  "typescript": "^5.6.0"
44
48
  }
45
- }
49
+ }
package/test.ts DELETED
@@ -1,115 +0,0 @@
1
- import { RecursiveSet } from './src/index.js';
2
-
3
- console.log('=== RecursiveSet Test Suite ===\n');
4
-
5
- // ============================================================================
6
- // Test 1: Basic FSM State Sets
7
- // ============================================================================
8
- console.log('--- Test 1: Basic State Sets ---');
9
- const q0 = "q0";
10
- const q1 = "q1";
11
- const q2 = "q2";
12
- const q3 = "q3";
13
-
14
- const eqClass1 = new RecursiveSet(q0, q1);
15
- const eqClass2 = new RecursiveSet(q2, q3);
16
- console.log(`Equivalence class 1: ${eqClass1}`);
17
- console.log(`Equivalence class 2: ${eqClass2}`);
18
- console.log();
19
-
20
- // ============================================================================
21
- // Test 2: Sets of Sets (Equivalence Classes)
22
- // ============================================================================
23
- console.log('--- Test 2: Sets of Sets ---');
24
- const eqClasses = new RecursiveSet(eqClass1, eqClass2);
25
- console.log(`Equivalence classes: ${eqClasses}`);
26
- console.log();
27
-
28
- // ============================================================================
29
- // Test 3: Mutability - Adding Elements
30
- // ============================================================================
31
- console.log('--- Test 3: Mutability ---');
32
- const eqClass3 = new RecursiveSet("q4");
33
- eqClasses.add(eqClass3);
34
- console.log(`After adding {q4}: ${eqClasses}`);
35
- console.log();
36
-
37
- // ============================================================================
38
- // Test 4: Extensionality (Structural Equality)
39
- // ============================================================================
40
- console.log('--- Test 4: Extensionality Axiom ---');
41
- const eqClass1_copy = new RecursiveSet("q0", "q1");
42
- console.log(`eqClass1: ${eqClass1}`);
43
- console.log(`eqClass1_copy: ${eqClass1_copy}`);
44
- console.log(`Are they equal? ${eqClass1.equals(eqClass1_copy)}`);
45
- console.log();
46
-
47
- // ============================================================================
48
- // Test 5: Empty Set Handling
49
- // ============================================================================
50
- console.log('--- Test 5: Empty Set ---');
51
- const emptyClass = new RecursiveSet();
52
- const eqClassesWithEmpty = new RecursiveSet(eqClass1, emptyClass);
53
- console.log(`With empty class: ${eqClassesWithEmpty}`);
54
- console.log();
55
-
56
- // ============================================================================
57
- // Test 6: Deep Nesting
58
- // ============================================================================
59
- console.log('--- Test 6: Deep Nesting ---');
60
- const nested = new RecursiveSet(eqClasses, eqClassesWithEmpty);
61
- console.log(`Nested structure: ${nested}`);
62
- console.log();
63
-
64
- // ============================================================================
65
- // Test 7: Set Operations
66
- // ============================================================================
67
- console.log('--- Test 7: Set Operations ---');
68
- const difference = eqClasses.difference(new RecursiveSet(eqClass2));
69
- console.log(`eqClasses - {eqClass2} = ${difference}`);
70
-
71
- const union = eqClass1.union(eqClass2);
72
- console.log(`eqClass1 ∪ eqClass2 = ${union}`);
73
-
74
- const intersection = new RecursiveSet(q0, q1, q2).intersection(new RecursiveSet(q1, q2, q3));
75
- console.log(`{q0, q1, q2} ∩ {q1, q2, q3} = ${intersection}`);
76
- console.log();
77
-
78
- // ============================================================================
79
- // Test 8: Power Set
80
- // ============================================================================
81
- console.log('--- Test 8: Power Set ---');
82
- const small = new RecursiveSet(1, 2);
83
- const power = small.powerset();
84
- console.log(`𝒫({1, 2}) = ${power}`);
85
- console.log();
86
-
87
- // ============================================================================
88
- // Test 9: Foundation Axiom (Cycle Detection)
89
- // ============================================================================
90
- console.log('--- Test 9: Foundation Axiom ---');
91
- try {
92
- const circular = new RecursiveSet(1, 2);
93
- circular.add(circular);
94
- console.log('❌ ERROR: Cycle should have been detected!');
95
- } catch (e: any) {
96
- console.log(`✓ Cycle detected: ${e.message}`);
97
- }
98
- console.log();
99
-
100
- // ============================================================================
101
- // Test 10: Subset Relations
102
- // ============================================================================
103
- console.log('--- Test 10: Subset Relations ---');
104
- const setA = new RecursiveSet(1, 2, 3);
105
- const setB = new RecursiveSet(1, 2);
106
- console.log(`A = ${setA}`);
107
- console.log(`B = ${setB}`);
108
- console.log(`B ⊆ A? ${setB.isSubset(setA)}`);
109
- console.log(`A ⊆ B? ${setA.isSubset(setB)}`);
110
- console.log();
111
-
112
- // ============================================================================
113
- // Summary
114
- // ============================================================================
115
- console.log('=== All Tests Completed Successfully ✓ ===');
package/tsconfig.json DELETED
@@ -1,19 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022", /* Modern JavaScript */
4
- "module": "ES2022", /* ESM modules */
5
- "lib": ["ES2022"], /* Available APIs */
6
- "outDir": "./dist", /* Compiled JS output directory */
7
- "rootDir": "./src", /* TypeScript source files */
8
- "declaration": true, /* Generate .d.ts type files */
9
- "declarationMap": true, /* Source maps for types */
10
- "sourceMap": true, /* Source maps for debugging */
11
- "strict": true, /* Enable all strict checks */
12
- "esModuleInterop": true, /* Better module compatibility */
13
- "skipLibCheck": true, /* Faster compilation */
14
- "forceConsistentCasingInFileNames": true,
15
- "moduleResolution": "node" /* Node.js module resolution */
16
- },
17
- "include": ["src/**/*"], /* Files to compile */
18
- "exclude": ["node_modules", "dist"] /* Files to ignore */
19
- }