@stevenvo780/st-lang 4.10.0 → 4.11.0
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.
- package/dist/proof-systems/distributed-exchange/index.d.ts +101 -0
- package/dist/proof-systems/distributed-exchange/index.d.ts.map +1 -0
- package/dist/proof-systems/distributed-exchange/index.js +408 -0
- package/dist/proof-systems/distributed-exchange/index.js.map +1 -0
- package/dist/reasoning/graph-theory/index.d.ts +63 -0
- package/dist/reasoning/graph-theory/index.d.ts.map +1 -0
- package/dist/reasoning/graph-theory/index.js +1043 -0
- package/dist/reasoning/graph-theory/index.js.map +1 -0
- package/dist/reasoning/group-presentation/cayley.d.ts +8 -0
- package/dist/reasoning/group-presentation/cayley.d.ts.map +1 -0
- package/dist/reasoning/group-presentation/cayley.js +38 -0
- package/dist/reasoning/group-presentation/cayley.js.map +1 -0
- package/dist/reasoning/group-presentation/index.d.ts +8 -0
- package/dist/reasoning/group-presentation/index.d.ts.map +1 -0
- package/dist/reasoning/group-presentation/index.js +36 -0
- package/dist/reasoning/group-presentation/index.js.map +1 -0
- package/dist/reasoning/group-presentation/standard-groups.d.ts +6 -0
- package/dist/reasoning/group-presentation/standard-groups.d.ts.map +1 -0
- package/dist/reasoning/group-presentation/standard-groups.js +93 -0
- package/dist/reasoning/group-presentation/standard-groups.js.map +1 -0
- package/dist/reasoning/group-presentation/todd-coxeter.d.ts +10 -0
- package/dist/reasoning/group-presentation/todd-coxeter.d.ts.map +1 -0
- package/dist/reasoning/group-presentation/todd-coxeter.js +362 -0
- package/dist/reasoning/group-presentation/todd-coxeter.js.map +1 -0
- package/dist/reasoning/group-presentation/types.d.ts +7 -0
- package/dist/reasoning/group-presentation/types.d.ts.map +1 -0
- package/dist/reasoning/group-presentation/types.js +22 -0
- package/dist/reasoning/group-presentation/types.js.map +1 -0
- package/dist/reasoning/group-presentation/words.d.ts +10 -0
- package/dist/reasoning/group-presentation/words.d.ts.map +1 -0
- package/dist/reasoning/group-presentation/words.js +109 -0
- package/dist/reasoning/group-presentation/words.js.map +1 -0
- package/dist/tests/proof-systems/distributed-exchange/distributed-exchange.test.d.ts +2 -0
- package/dist/tests/proof-systems/distributed-exchange/distributed-exchange.test.d.ts.map +1 -0
- package/dist/tests/proof-systems/distributed-exchange/distributed-exchange.test.js +328 -0
- package/dist/tests/proof-systems/distributed-exchange/distributed-exchange.test.js.map +1 -0
- package/dist/tests/reasoning/graph-theory/graph-theory.test.d.ts +2 -0
- package/dist/tests/reasoning/graph-theory/graph-theory.test.d.ts.map +1 -0
- package/dist/tests/reasoning/graph-theory/graph-theory.test.js +363 -0
- package/dist/tests/reasoning/graph-theory/graph-theory.test.js.map +1 -0
- package/dist/tests/reasoning/group-presentation/group-presentation.test.d.ts +2 -0
- package/dist/tests/reasoning/group-presentation/group-presentation.test.d.ts.map +1 -0
- package/dist/tests/reasoning/group-presentation/group-presentation.test.js +229 -0
- package/dist/tests/reasoning/group-presentation/group-presentation.test.js.map +1 -0
- package/dist/tests/tooling/exporters/coq-v2/coq-v2-exporter.test.d.ts +2 -0
- package/dist/tests/tooling/exporters/coq-v2/coq-v2-exporter.test.d.ts.map +1 -0
- package/dist/tests/tooling/exporters/coq-v2/coq-v2-exporter.test.js +411 -0
- package/dist/tests/tooling/exporters/coq-v2/coq-v2-exporter.test.js.map +1 -0
- package/dist/tests/tooling/lemma-library/lemma-library.test.d.ts +2 -0
- package/dist/tests/tooling/lemma-library/lemma-library.test.d.ts.map +1 -0
- package/dist/tests/tooling/lemma-library/lemma-library.test.js +197 -0
- package/dist/tests/tooling/lemma-library/lemma-library.test.js.map +1 -0
- package/dist/tests/tooling/provenance/ledger.test.d.ts +2 -0
- package/dist/tests/tooling/provenance/ledger.test.d.ts.map +1 -0
- package/dist/tests/tooling/provenance/ledger.test.js +545 -0
- package/dist/tests/tooling/provenance/ledger.test.js.map +1 -0
- package/dist/tooling/exporters/coq-v2/index.d.ts +68 -0
- package/dist/tooling/exporters/coq-v2/index.d.ts.map +1 -0
- package/dist/tooling/exporters/coq-v2/index.js +692 -0
- package/dist/tooling/exporters/coq-v2/index.js.map +1 -0
- package/dist/tooling/lemma-library/apply.d.ts +9 -0
- package/dist/tooling/lemma-library/apply.d.ts.map +1 -0
- package/dist/tooling/lemma-library/apply.js +94 -0
- package/dist/tooling/lemma-library/apply.js.map +1 -0
- package/dist/tooling/lemma-library/arithmetic.d.ts +3 -0
- package/dist/tooling/lemma-library/arithmetic.d.ts.map +1 -0
- package/dist/tooling/lemma-library/arithmetic.js +176 -0
- package/dist/tooling/lemma-library/arithmetic.js.map +1 -0
- package/dist/tooling/lemma-library/firstorder.d.ts +3 -0
- package/dist/tooling/lemma-library/firstorder.d.ts.map +1 -0
- package/dist/tooling/lemma-library/firstorder.js +136 -0
- package/dist/tooling/lemma-library/firstorder.js.map +1 -0
- package/dist/tooling/lemma-library/index.d.ts +13 -0
- package/dist/tooling/lemma-library/index.d.ts.map +1 -0
- package/dist/tooling/lemma-library/index.js +32 -0
- package/dist/tooling/lemma-library/index.js.map +1 -0
- package/dist/tooling/lemma-library/library.d.ts +34 -0
- package/dist/tooling/lemma-library/library.d.ts.map +1 -0
- package/dist/tooling/lemma-library/library.js +126 -0
- package/dist/tooling/lemma-library/library.js.map +1 -0
- package/dist/tooling/lemma-library/modal.d.ts +3 -0
- package/dist/tooling/lemma-library/modal.d.ts.map +1 -0
- package/dist/tooling/lemma-library/modal.js +138 -0
- package/dist/tooling/lemma-library/modal.js.map +1 -0
- package/dist/tooling/lemma-library/propositional.d.ts +3 -0
- package/dist/tooling/lemma-library/propositional.d.ts.map +1 -0
- package/dist/tooling/lemma-library/propositional.js +265 -0
- package/dist/tooling/lemma-library/propositional.js.map +1 -0
- package/dist/tooling/lemma-library/set-theory.d.ts +3 -0
- package/dist/tooling/lemma-library/set-theory.d.ts.map +1 -0
- package/dist/tooling/lemma-library/set-theory.js +134 -0
- package/dist/tooling/lemma-library/set-theory.js.map +1 -0
- package/dist/tooling/lemma-library/standard.d.ts +3 -0
- package/dist/tooling/lemma-library/standard.d.ts.map +1 -0
- package/dist/tooling/lemma-library/standard.js +27 -0
- package/dist/tooling/lemma-library/standard.js.map +1 -0
- package/dist/tooling/lemma-library/tfidf.d.ts +5 -0
- package/dist/tooling/lemma-library/tfidf.d.ts.map +1 -0
- package/dist/tooling/lemma-library/tfidf.js +100 -0
- package/dist/tooling/lemma-library/tfidf.js.map +1 -0
- package/dist/tooling/lemma-library/tokenize.d.ts +2 -0
- package/dist/tooling/lemma-library/tokenize.d.ts.map +1 -0
- package/dist/tooling/lemma-library/tokenize.js +74 -0
- package/dist/tooling/lemma-library/tokenize.js.map +1 -0
- package/dist/tooling/lemma-library/types.d.ts +53 -0
- package/dist/tooling/lemma-library/types.d.ts.map +1 -0
- package/dist/tooling/lemma-library/types.js +10 -0
- package/dist/tooling/lemma-library/types.js.map +1 -0
- package/dist/tooling/provenance/index.d.ts +3 -0
- package/dist/tooling/provenance/index.d.ts.map +1 -0
- package/dist/tooling/provenance/index.js +16 -0
- package/dist/tooling/provenance/index.js.map +1 -0
- package/dist/tooling/provenance/ledger.d.ts +89 -0
- package/dist/tooling/provenance/ledger.d.ts.map +1 -0
- package/dist/tooling/provenance/ledger.js +439 -0
- package/dist/tooling/provenance/ledger.js.map +1 -0
- package/dist/tooling/provenance/types.d.ts +70 -0
- package/dist/tooling/provenance/types.d.ts.map +1 -0
- package/dist/tooling/provenance/types.js +14 -0
- package/dist/tooling/provenance/types.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const graph_theory_1 = require("../../../reasoning/graph-theory");
|
|
5
|
+
// Helpers
|
|
6
|
+
function pathGraph(n, directed = false) {
|
|
7
|
+
const G = (0, graph_theory_1.makeGraph)(directed);
|
|
8
|
+
for (let i = 0; i < n; i++)
|
|
9
|
+
(0, graph_theory_1.addVertex)(G, i);
|
|
10
|
+
for (let i = 0; i < n - 1; i++)
|
|
11
|
+
(0, graph_theory_1.addEdge)(G, { from: i, to: i + 1, weight: 1 });
|
|
12
|
+
return G;
|
|
13
|
+
}
|
|
14
|
+
function cycleGraph(n, directed = false) {
|
|
15
|
+
const G = (0, graph_theory_1.makeGraph)(directed);
|
|
16
|
+
for (let i = 0; i < n; i++)
|
|
17
|
+
(0, graph_theory_1.addVertex)(G, i);
|
|
18
|
+
for (let i = 0; i < n; i++)
|
|
19
|
+
(0, graph_theory_1.addEdge)(G, { from: i, to: (i + 1) % n, weight: 1 });
|
|
20
|
+
return G;
|
|
21
|
+
}
|
|
22
|
+
function completeGraph(n) {
|
|
23
|
+
const G = (0, graph_theory_1.makeGraph)(false);
|
|
24
|
+
for (let i = 0; i < n; i++)
|
|
25
|
+
(0, graph_theory_1.addVertex)(G, i);
|
|
26
|
+
for (let i = 0; i < n; i++) {
|
|
27
|
+
for (let j = i + 1; j < n; j++) {
|
|
28
|
+
(0, graph_theory_1.addEdge)(G, { from: i, to: j, weight: 1 });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return G;
|
|
32
|
+
}
|
|
33
|
+
// ------------------------------------------------------------
|
|
34
|
+
// 1. Construcción
|
|
35
|
+
// ------------------------------------------------------------
|
|
36
|
+
(0, vitest_1.describe)('graph-theory / construcción', () => {
|
|
37
|
+
(0, vitest_1.it)('makeGraph inicializa vacío', () => {
|
|
38
|
+
const G = (0, graph_theory_1.makeGraph)();
|
|
39
|
+
(0, vitest_1.expect)(G.vertices.size).toBe(0);
|
|
40
|
+
(0, vitest_1.expect)(G.edges.length).toBe(0);
|
|
41
|
+
(0, vitest_1.expect)(G.directed).toBe(false);
|
|
42
|
+
});
|
|
43
|
+
(0, vitest_1.it)('addEdge añade extremos como vértices', () => {
|
|
44
|
+
const G = (0, graph_theory_1.makeGraph)();
|
|
45
|
+
(0, graph_theory_1.addEdge)(G, { from: 'a', to: 'b', weight: 2 });
|
|
46
|
+
(0, vitest_1.expect)(G.vertices.has('a')).toBe(true);
|
|
47
|
+
(0, vitest_1.expect)(G.vertices.has('b')).toBe(true);
|
|
48
|
+
(0, vitest_1.expect)(G.edges.length).toBe(1);
|
|
49
|
+
});
|
|
50
|
+
(0, vitest_1.it)('neighbors respeta dirección', () => {
|
|
51
|
+
const G = (0, graph_theory_1.makeGraph)(true);
|
|
52
|
+
(0, graph_theory_1.addEdge)(G, { from: 1, to: 2 });
|
|
53
|
+
(0, vitest_1.expect)((0, graph_theory_1.neighbors)(G, 1)).toEqual([2]);
|
|
54
|
+
(0, vitest_1.expect)((0, graph_theory_1.neighbors)(G, 2)).toEqual([]);
|
|
55
|
+
});
|
|
56
|
+
(0, vitest_1.it)('inDegree/outDegree en grafo dirigido', () => {
|
|
57
|
+
const G = (0, graph_theory_1.makeGraph)(true);
|
|
58
|
+
(0, graph_theory_1.addEdge)(G, { from: 1, to: 2 });
|
|
59
|
+
(0, graph_theory_1.addEdge)(G, { from: 3, to: 2 });
|
|
60
|
+
(0, vitest_1.expect)((0, graph_theory_1.inDegree)(G, 2)).toBe(2);
|
|
61
|
+
(0, vitest_1.expect)((0, graph_theory_1.outDegree)(G, 2)).toBe(0);
|
|
62
|
+
(0, vitest_1.expect)((0, graph_theory_1.outDegree)(G, 1)).toBe(1);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
// ------------------------------------------------------------
|
|
66
|
+
// 2. Recorridos
|
|
67
|
+
// ------------------------------------------------------------
|
|
68
|
+
(0, vitest_1.describe)('graph-theory / recorridos', () => {
|
|
69
|
+
(0, vitest_1.it)('BFS visita en orden de niveles', () => {
|
|
70
|
+
// Grafo: 0 - 1 - 3
|
|
71
|
+
// | |
|
|
72
|
+
// 2 - 4
|
|
73
|
+
const G = (0, graph_theory_1.makeGraph)();
|
|
74
|
+
(0, graph_theory_1.addEdge)(G, { from: 0, to: 1 });
|
|
75
|
+
(0, graph_theory_1.addEdge)(G, { from: 0, to: 2 });
|
|
76
|
+
(0, graph_theory_1.addEdge)(G, { from: 1, to: 3 });
|
|
77
|
+
(0, graph_theory_1.addEdge)(G, { from: 1, to: 4 });
|
|
78
|
+
(0, graph_theory_1.addEdge)(G, { from: 2, to: 4 });
|
|
79
|
+
const order = (0, graph_theory_1.bfs)(G, 0);
|
|
80
|
+
(0, vitest_1.expect)(order[0]).toBe(0);
|
|
81
|
+
// Nivel 1 debe ser {1, 2} antes que {3, 4}.
|
|
82
|
+
const idx = new Map(order.map((v, i) => [v, i]));
|
|
83
|
+
(0, vitest_1.expect)(idx.get(1)).toBeLessThan(idx.get(3));
|
|
84
|
+
(0, vitest_1.expect)(idx.get(2)).toBeLessThan(idx.get(3));
|
|
85
|
+
(0, vitest_1.expect)(idx.get(1)).toBeLessThan(idx.get(4));
|
|
86
|
+
});
|
|
87
|
+
(0, vitest_1.it)('DFS recorre en profundidad', () => {
|
|
88
|
+
const G = pathGraph(5);
|
|
89
|
+
const order = (0, graph_theory_1.dfs)(G, 0);
|
|
90
|
+
// Path 0-1-2-3-4: DFS desde 0 debe visitar todos en orden creciente.
|
|
91
|
+
(0, vitest_1.expect)(order).toEqual([0, 1, 2, 3, 4]);
|
|
92
|
+
});
|
|
93
|
+
(0, vitest_1.it)('topologicalSort en DAG válido', () => {
|
|
94
|
+
const G = (0, graph_theory_1.makeGraph)(true);
|
|
95
|
+
(0, graph_theory_1.addEdge)(G, { from: 1, to: 2 });
|
|
96
|
+
(0, graph_theory_1.addEdge)(G, { from: 1, to: 3 });
|
|
97
|
+
(0, graph_theory_1.addEdge)(G, { from: 2, to: 4 });
|
|
98
|
+
(0, graph_theory_1.addEdge)(G, { from: 3, to: 4 });
|
|
99
|
+
const order = (0, graph_theory_1.topologicalSort)(G);
|
|
100
|
+
(0, vitest_1.expect)(order).not.toBe('has-cycle');
|
|
101
|
+
if (order === 'has-cycle')
|
|
102
|
+
return;
|
|
103
|
+
const idx = new Map(order.map((v, i) => [v, i]));
|
|
104
|
+
(0, vitest_1.expect)(idx.get(1)).toBeLessThan(idx.get(2));
|
|
105
|
+
(0, vitest_1.expect)(idx.get(1)).toBeLessThan(idx.get(3));
|
|
106
|
+
(0, vitest_1.expect)(idx.get(2)).toBeLessThan(idx.get(4));
|
|
107
|
+
(0, vitest_1.expect)(idx.get(3)).toBeLessThan(idx.get(4));
|
|
108
|
+
});
|
|
109
|
+
(0, vitest_1.it)('topologicalSort detecta ciclo', () => {
|
|
110
|
+
const G = (0, graph_theory_1.makeGraph)(true);
|
|
111
|
+
(0, graph_theory_1.addEdge)(G, { from: 1, to: 2 });
|
|
112
|
+
(0, graph_theory_1.addEdge)(G, { from: 2, to: 3 });
|
|
113
|
+
(0, graph_theory_1.addEdge)(G, { from: 3, to: 1 });
|
|
114
|
+
(0, vitest_1.expect)((0, graph_theory_1.topologicalSort)(G)).toBe('has-cycle');
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
// ------------------------------------------------------------
|
|
118
|
+
// 3. Conectividad
|
|
119
|
+
// ------------------------------------------------------------
|
|
120
|
+
(0, vitest_1.describe)('graph-theory / conectividad', () => {
|
|
121
|
+
(0, vitest_1.it)('connectedComponents identifica 2 componentes', () => {
|
|
122
|
+
const G = (0, graph_theory_1.makeGraph)();
|
|
123
|
+
(0, graph_theory_1.addEdge)(G, { from: 1, to: 2 });
|
|
124
|
+
(0, graph_theory_1.addEdge)(G, { from: 3, to: 4 });
|
|
125
|
+
(0, graph_theory_1.addVertex)(G, 5);
|
|
126
|
+
const comps = (0, graph_theory_1.connectedComponents)(G);
|
|
127
|
+
(0, vitest_1.expect)(comps.length).toBe(3);
|
|
128
|
+
const sizes = comps.map((c) => c.length).sort((a, b) => a - b);
|
|
129
|
+
(0, vitest_1.expect)(sizes).toEqual([1, 2, 2]);
|
|
130
|
+
});
|
|
131
|
+
(0, vitest_1.it)('isConnected en path', () => {
|
|
132
|
+
(0, vitest_1.expect)((0, graph_theory_1.isConnected)(pathGraph(5))).toBe(true);
|
|
133
|
+
});
|
|
134
|
+
(0, vitest_1.it)('SCC de Tarjan con 2 SCC en grafo dirigido', () => {
|
|
135
|
+
// SCC 1: {1, 2, 3} (ciclo) ; SCC 2: {4} ; arista 3 -> 4 no fuerte.
|
|
136
|
+
const G = (0, graph_theory_1.makeGraph)(true);
|
|
137
|
+
(0, graph_theory_1.addEdge)(G, { from: 1, to: 2 });
|
|
138
|
+
(0, graph_theory_1.addEdge)(G, { from: 2, to: 3 });
|
|
139
|
+
(0, graph_theory_1.addEdge)(G, { from: 3, to: 1 });
|
|
140
|
+
(0, graph_theory_1.addEdge)(G, { from: 3, to: 4 });
|
|
141
|
+
const sccs = (0, graph_theory_1.stronglyConnectedComponents)(G);
|
|
142
|
+
(0, vitest_1.expect)(sccs.length).toBe(2);
|
|
143
|
+
const sizes = sccs.map((c) => c.length).sort((a, b) => a - b);
|
|
144
|
+
(0, vitest_1.expect)(sizes).toEqual([1, 3]);
|
|
145
|
+
});
|
|
146
|
+
(0, vitest_1.it)('articulationPoints en cadena lineal', () => {
|
|
147
|
+
// Path 0-1-2-3-4: los puntos de articulación son 1, 2, 3.
|
|
148
|
+
const G = pathGraph(5);
|
|
149
|
+
const arts = (0, graph_theory_1.articulationPoints)(G).sort((a, b) => a - b);
|
|
150
|
+
(0, vitest_1.expect)(arts).toEqual([1, 2, 3]);
|
|
151
|
+
});
|
|
152
|
+
(0, vitest_1.it)('bridges en cadena lineal', () => {
|
|
153
|
+
const G = pathGraph(4);
|
|
154
|
+
const br = (0, graph_theory_1.bridges)(G);
|
|
155
|
+
// Todo edge de un árbol es puente.
|
|
156
|
+
(0, vitest_1.expect)(br.length).toBe(3);
|
|
157
|
+
});
|
|
158
|
+
(0, vitest_1.it)('bridges: ciclo no tiene puentes', () => {
|
|
159
|
+
const G = cycleGraph(5);
|
|
160
|
+
(0, vitest_1.expect)((0, graph_theory_1.bridges)(G).length).toBe(0);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
// ------------------------------------------------------------
|
|
164
|
+
// 4. Caminos mínimos
|
|
165
|
+
// ------------------------------------------------------------
|
|
166
|
+
(0, vitest_1.describe)('graph-theory / caminos mínimos', () => {
|
|
167
|
+
(0, vitest_1.it)('dijkstra en grafo 5-vertex weighted', () => {
|
|
168
|
+
// Grafo clásico:
|
|
169
|
+
// 0 --(7)-- 1 --(1)-- 4
|
|
170
|
+
// |\ |
|
|
171
|
+
// (1)(5) (2)
|
|
172
|
+
// | \ |
|
|
173
|
+
// 2 --(2)- 3
|
|
174
|
+
const G = (0, graph_theory_1.makeGraph)();
|
|
175
|
+
(0, graph_theory_1.addEdge)(G, { from: 0, to: 1, weight: 7 });
|
|
176
|
+
(0, graph_theory_1.addEdge)(G, { from: 0, to: 2, weight: 1 });
|
|
177
|
+
(0, graph_theory_1.addEdge)(G, { from: 0, to: 3, weight: 5 });
|
|
178
|
+
(0, graph_theory_1.addEdge)(G, { from: 1, to: 3, weight: 2 });
|
|
179
|
+
(0, graph_theory_1.addEdge)(G, { from: 1, to: 4, weight: 1 });
|
|
180
|
+
(0, graph_theory_1.addEdge)(G, { from: 2, to: 3, weight: 2 });
|
|
181
|
+
const { distances } = (0, graph_theory_1.dijkstra)(G, 0);
|
|
182
|
+
(0, vitest_1.expect)(distances.get(0)).toBe(0);
|
|
183
|
+
(0, vitest_1.expect)(distances.get(1)).toBe(5); // 0->2->3->1 = 1+2+2 = 5
|
|
184
|
+
(0, vitest_1.expect)(distances.get(2)).toBe(1);
|
|
185
|
+
(0, vitest_1.expect)(distances.get(3)).toBe(3); // 0->2->3 = 3
|
|
186
|
+
(0, vitest_1.expect)(distances.get(4)).toBe(6); // 0->2->3->1->4 = 6
|
|
187
|
+
});
|
|
188
|
+
(0, vitest_1.it)('dijkstra rechaza pesos negativos', () => {
|
|
189
|
+
const G = (0, graph_theory_1.makeGraph)();
|
|
190
|
+
(0, graph_theory_1.addEdge)(G, { from: 0, to: 1, weight: -1 });
|
|
191
|
+
(0, vitest_1.expect)(() => (0, graph_theory_1.dijkstra)(G, 0)).toThrow();
|
|
192
|
+
});
|
|
193
|
+
(0, vitest_1.it)('bellmanFord detecta ciclo negativo', () => {
|
|
194
|
+
const G = (0, graph_theory_1.makeGraph)(true);
|
|
195
|
+
(0, graph_theory_1.addEdge)(G, { from: 1, to: 2, weight: 1 });
|
|
196
|
+
(0, graph_theory_1.addEdge)(G, { from: 2, to: 3, weight: -3 });
|
|
197
|
+
(0, graph_theory_1.addEdge)(G, { from: 3, to: 1, weight: 1 });
|
|
198
|
+
const r = (0, graph_theory_1.bellmanFord)(G, 1);
|
|
199
|
+
(0, vitest_1.expect)(r.negativeCycle).toBe(true);
|
|
200
|
+
});
|
|
201
|
+
(0, vitest_1.it)('bellmanFord en grafo sin ciclos negativos', () => {
|
|
202
|
+
const G = (0, graph_theory_1.makeGraph)(true);
|
|
203
|
+
(0, graph_theory_1.addEdge)(G, { from: 1, to: 2, weight: 4 });
|
|
204
|
+
(0, graph_theory_1.addEdge)(G, { from: 1, to: 3, weight: 1 });
|
|
205
|
+
(0, graph_theory_1.addEdge)(G, { from: 3, to: 2, weight: 2 });
|
|
206
|
+
const r = (0, graph_theory_1.bellmanFord)(G, 1);
|
|
207
|
+
(0, vitest_1.expect)(r.negativeCycle).toBe(false);
|
|
208
|
+
(0, vitest_1.expect)(r.distances.get(2)).toBe(3); // 1->3->2 = 3
|
|
209
|
+
});
|
|
210
|
+
(0, vitest_1.it)('floydWarshall coincide con dijkstra en pesos positivos', () => {
|
|
211
|
+
const G = (0, graph_theory_1.makeGraph)();
|
|
212
|
+
(0, graph_theory_1.addEdge)(G, { from: 0, to: 1, weight: 4 });
|
|
213
|
+
(0, graph_theory_1.addEdge)(G, { from: 0, to: 2, weight: 1 });
|
|
214
|
+
(0, graph_theory_1.addEdge)(G, { from: 1, to: 2, weight: 2 });
|
|
215
|
+
(0, graph_theory_1.addEdge)(G, { from: 1, to: 3, weight: 1 });
|
|
216
|
+
(0, graph_theory_1.addEdge)(G, { from: 2, to: 3, weight: 5 });
|
|
217
|
+
const fw = (0, graph_theory_1.floydWarshall)(G);
|
|
218
|
+
const dj = (0, graph_theory_1.dijkstra)(G, 0);
|
|
219
|
+
for (const v of G.vertices) {
|
|
220
|
+
(0, vitest_1.expect)(fw.get(0)?.get(v)).toBe(dj.distances.get(v));
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
// ------------------------------------------------------------
|
|
225
|
+
// 5. MST
|
|
226
|
+
// ------------------------------------------------------------
|
|
227
|
+
(0, vitest_1.describe)('graph-theory / MST', () => {
|
|
228
|
+
(0, vitest_1.it)('kruskal MST en grafo simple', () => {
|
|
229
|
+
// Grafo de 4 nodos con pesos:
|
|
230
|
+
// 1-2(1), 2-3(2), 3-4(3), 1-4(10), 1-3(5)
|
|
231
|
+
const G = (0, graph_theory_1.makeGraph)();
|
|
232
|
+
(0, graph_theory_1.addEdge)(G, { from: 1, to: 2, weight: 1 });
|
|
233
|
+
(0, graph_theory_1.addEdge)(G, { from: 2, to: 3, weight: 2 });
|
|
234
|
+
(0, graph_theory_1.addEdge)(G, { from: 3, to: 4, weight: 3 });
|
|
235
|
+
(0, graph_theory_1.addEdge)(G, { from: 1, to: 4, weight: 10 });
|
|
236
|
+
(0, graph_theory_1.addEdge)(G, { from: 1, to: 3, weight: 5 });
|
|
237
|
+
const mst = (0, graph_theory_1.kruskal)(G);
|
|
238
|
+
(0, vitest_1.expect)(mst.totalWeight).toBe(6); // 1 + 2 + 3
|
|
239
|
+
(0, vitest_1.expect)(mst.edges.length).toBe(3);
|
|
240
|
+
});
|
|
241
|
+
(0, vitest_1.it)('prim MST coincide con kruskal en weight', () => {
|
|
242
|
+
const G = (0, graph_theory_1.makeGraph)();
|
|
243
|
+
(0, graph_theory_1.addEdge)(G, { from: 0, to: 1, weight: 4 });
|
|
244
|
+
(0, graph_theory_1.addEdge)(G, { from: 0, to: 2, weight: 3 });
|
|
245
|
+
(0, graph_theory_1.addEdge)(G, { from: 1, to: 2, weight: 1 });
|
|
246
|
+
(0, graph_theory_1.addEdge)(G, { from: 1, to: 3, weight: 2 });
|
|
247
|
+
(0, graph_theory_1.addEdge)(G, { from: 2, to: 3, weight: 4 });
|
|
248
|
+
(0, graph_theory_1.addEdge)(G, { from: 3, to: 4, weight: 2 });
|
|
249
|
+
(0, graph_theory_1.addEdge)(G, { from: 2, to: 4, weight: 7 });
|
|
250
|
+
const kw = (0, graph_theory_1.kruskal)(G).totalWeight;
|
|
251
|
+
const pw = (0, graph_theory_1.prim)(G).totalWeight;
|
|
252
|
+
(0, vitest_1.expect)(pw).toBe(kw);
|
|
253
|
+
});
|
|
254
|
+
(0, vitest_1.it)('prim en grafo desconectado cubre solo su componente', () => {
|
|
255
|
+
const G = (0, graph_theory_1.makeGraph)();
|
|
256
|
+
(0, graph_theory_1.addEdge)(G, { from: 0, to: 1, weight: 1 });
|
|
257
|
+
(0, graph_theory_1.addEdge)(G, { from: 2, to: 3, weight: 1 });
|
|
258
|
+
const r = (0, graph_theory_1.prim)(G, 0);
|
|
259
|
+
(0, vitest_1.expect)(r.edges.length).toBe(1);
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
// ------------------------------------------------------------
|
|
263
|
+
// 6. Bipartite matching
|
|
264
|
+
// ------------------------------------------------------------
|
|
265
|
+
(0, vitest_1.describe)('graph-theory / matching bipartito', () => {
|
|
266
|
+
(0, vitest_1.it)('bipartiteMaximumMatching: 3 + 3 con 4 edges, max 3', () => {
|
|
267
|
+
// Lado izquierdo: L1, L2, L3 ; derecho: R1, R2, R3
|
|
268
|
+
// L1-R1, L1-R2, L2-R2, L3-R3
|
|
269
|
+
const G = (0, graph_theory_1.makeGraph)();
|
|
270
|
+
const left = new Set(['L1', 'L2', 'L3']);
|
|
271
|
+
(0, graph_theory_1.addEdge)(G, { from: 'L1', to: 'R1' });
|
|
272
|
+
(0, graph_theory_1.addEdge)(G, { from: 'L1', to: 'R2' });
|
|
273
|
+
(0, graph_theory_1.addEdge)(G, { from: 'L2', to: 'R2' });
|
|
274
|
+
(0, graph_theory_1.addEdge)(G, { from: 'L3', to: 'R3' });
|
|
275
|
+
const m = (0, graph_theory_1.bipartiteMaximumMatching)(G, left);
|
|
276
|
+
(0, vitest_1.expect)(m.length).toBe(3);
|
|
277
|
+
});
|
|
278
|
+
(0, vitest_1.it)('hopcroftKarp coincide en tamaño con Kuhn', () => {
|
|
279
|
+
const G = (0, graph_theory_1.makeGraph)();
|
|
280
|
+
const left = new Set(['L1', 'L2', 'L3', 'L4']);
|
|
281
|
+
(0, graph_theory_1.addEdge)(G, { from: 'L1', to: 'R1' });
|
|
282
|
+
(0, graph_theory_1.addEdge)(G, { from: 'L1', to: 'R2' });
|
|
283
|
+
(0, graph_theory_1.addEdge)(G, { from: 'L2', to: 'R1' });
|
|
284
|
+
(0, graph_theory_1.addEdge)(G, { from: 'L3', to: 'R2' });
|
|
285
|
+
(0, graph_theory_1.addEdge)(G, { from: 'L3', to: 'R3' });
|
|
286
|
+
(0, graph_theory_1.addEdge)(G, { from: 'L4', to: 'R3' });
|
|
287
|
+
const k = (0, graph_theory_1.bipartiteMaximumMatching)(G, left).length;
|
|
288
|
+
const h = (0, graph_theory_1.hopcroftKarp)(G, left).length;
|
|
289
|
+
(0, vitest_1.expect)(h).toBe(k);
|
|
290
|
+
(0, vitest_1.expect)(h).toBe(3);
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
// ------------------------------------------------------------
|
|
294
|
+
// 7. Coloreo
|
|
295
|
+
// ------------------------------------------------------------
|
|
296
|
+
(0, vitest_1.describe)('graph-theory / coloreo', () => {
|
|
297
|
+
(0, vitest_1.it)('chromaticNumber de K4 = 4', () => {
|
|
298
|
+
(0, vitest_1.expect)((0, graph_theory_1.chromaticNumber)(completeGraph(4))).toBe(4);
|
|
299
|
+
});
|
|
300
|
+
(0, vitest_1.it)('chromaticNumber de bipartito completo K_{3,3} = 2', () => {
|
|
301
|
+
const G = (0, graph_theory_1.makeGraph)();
|
|
302
|
+
const left = ['l1', 'l2', 'l3'];
|
|
303
|
+
const right = ['r1', 'r2', 'r3'];
|
|
304
|
+
for (const l of left)
|
|
305
|
+
for (const r of right)
|
|
306
|
+
(0, graph_theory_1.addEdge)(G, { from: l, to: r });
|
|
307
|
+
(0, vitest_1.expect)((0, graph_theory_1.chromaticNumber)(G)).toBe(2);
|
|
308
|
+
});
|
|
309
|
+
(0, vitest_1.it)('chromaticNumber de C5 (impar) = 3', () => {
|
|
310
|
+
(0, vitest_1.expect)((0, graph_theory_1.chromaticNumber)(cycleGraph(5))).toBe(3);
|
|
311
|
+
});
|
|
312
|
+
(0, vitest_1.it)('greedyColoring no asigna mismo color a vecinos', () => {
|
|
313
|
+
const G = completeGraph(5);
|
|
314
|
+
const color = (0, graph_theory_1.greedyColoring)(G);
|
|
315
|
+
for (const e of G.edges) {
|
|
316
|
+
(0, vitest_1.expect)(color.get(e.from)).not.toBe(color.get(e.to));
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
// ------------------------------------------------------------
|
|
321
|
+
// 8. Isomorfismo
|
|
322
|
+
// ------------------------------------------------------------
|
|
323
|
+
(0, vitest_1.describe)('graph-theory / isomorfismo', () => {
|
|
324
|
+
(0, vitest_1.it)('dos C5 son isomorfos', () => {
|
|
325
|
+
const G1 = cycleGraph(5);
|
|
326
|
+
const G2 = (0, graph_theory_1.makeGraph)();
|
|
327
|
+
const labels = ['a', 'b', 'c', 'd', 'e'];
|
|
328
|
+
for (const l of labels)
|
|
329
|
+
(0, graph_theory_1.addVertex)(G2, l);
|
|
330
|
+
for (let i = 0; i < labels.length; i++) {
|
|
331
|
+
(0, graph_theory_1.addEdge)(G2, { from: labels[i], to: labels[(i + 1) % labels.length] });
|
|
332
|
+
}
|
|
333
|
+
(0, vitest_1.expect)((0, graph_theory_1.areIsomorphic)(G1, G2)).toBe(true);
|
|
334
|
+
});
|
|
335
|
+
(0, vitest_1.it)('C5 y C6 no son isomorfos', () => {
|
|
336
|
+
(0, vitest_1.expect)((0, graph_theory_1.areIsomorphic)(cycleGraph(5), cycleGraph(6))).toBe(false);
|
|
337
|
+
});
|
|
338
|
+
(0, vitest_1.it)('K4 y C4 no son isomorfos (mismo |V| distinto |E|)', () => {
|
|
339
|
+
(0, vitest_1.expect)((0, graph_theory_1.areIsomorphic)(completeGraph(4), cycleGraph(4))).toBe(false);
|
|
340
|
+
});
|
|
341
|
+
(0, vitest_1.it)('findIsomorphism devuelve mapeo válido', () => {
|
|
342
|
+
const G1 = pathGraph(4);
|
|
343
|
+
const G2 = (0, graph_theory_1.makeGraph)();
|
|
344
|
+
const labels = ['w', 'x', 'y', 'z'];
|
|
345
|
+
for (const l of labels)
|
|
346
|
+
(0, graph_theory_1.addVertex)(G2, l);
|
|
347
|
+
for (let i = 0; i < labels.length - 1; i++) {
|
|
348
|
+
(0, graph_theory_1.addEdge)(G2, { from: labels[i], to: labels[i + 1] });
|
|
349
|
+
}
|
|
350
|
+
const m = (0, graph_theory_1.findIsomorphism)(G1, G2);
|
|
351
|
+
(0, vitest_1.expect)(m).not.toBeNull();
|
|
352
|
+
if (!m)
|
|
353
|
+
return;
|
|
354
|
+
// Verificar que las aristas se preservan.
|
|
355
|
+
for (const e of G1.edges) {
|
|
356
|
+
const f = m.get(e.from);
|
|
357
|
+
const t = m.get(e.to);
|
|
358
|
+
const found = G2.edges.some((e2) => (e2.from === f && e2.to === t) || (e2.from === t && e2.to === f));
|
|
359
|
+
(0, vitest_1.expect)(found).toBe(true);
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
});
|
|
363
|
+
//# sourceMappingURL=graph-theory.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-theory.test.js","sourceRoot":"","sources":["../../../../src/tests/reasoning/graph-theory/graph-theory.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,kEA2ByC;AAEzC,UAAU;AACV,SAAS,SAAS,CAAC,CAAS,EAAE,QAAQ,GAAG,KAAK;IAC5C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I,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CACzE,CAAC;YACF,IAAA,eAAM,EAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group-presentation.test.d.ts","sourceRoot":"","sources":["../../../../src/tests/reasoning/group-presentation/group-presentation.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const group_presentation_1 = require("../../../reasoning/group-presentation");
|
|
5
|
+
(0, vitest_1.describe)('Group Presentation — palabras y reducción libre', () => {
|
|
6
|
+
(0, vitest_1.it)('inverse intercambia caja a↔A, r↔R', () => {
|
|
7
|
+
(0, vitest_1.expect)((0, group_presentation_1.inverse)('a')).toBe('A');
|
|
8
|
+
(0, vitest_1.expect)((0, group_presentation_1.inverse)('A')).toBe('a');
|
|
9
|
+
(0, vitest_1.expect)((0, group_presentation_1.inverse)('r')).toBe('R');
|
|
10
|
+
(0, vitest_1.expect)((0, group_presentation_1.inverse)('R')).toBe('r');
|
|
11
|
+
});
|
|
12
|
+
(0, vitest_1.it)('reduceWord cancela pares adyacentes inverso-mutuos', () => {
|
|
13
|
+
(0, vitest_1.expect)((0, group_presentation_1.reduceWord)(['a', 'b', 'B', 'a'])).toEqual(['a', 'a']);
|
|
14
|
+
(0, vitest_1.expect)((0, group_presentation_1.reduceWord)(['A', 'a', 'b'])).toEqual(['b']);
|
|
15
|
+
(0, vitest_1.expect)((0, group_presentation_1.reduceWord)(['a', 'A'])).toEqual([]);
|
|
16
|
+
(0, vitest_1.expect)((0, group_presentation_1.reduceWord)([])).toEqual([]);
|
|
17
|
+
});
|
|
18
|
+
(0, vitest_1.it)('reduceWord es idempotente y elimina cascadas', () => {
|
|
19
|
+
// a b B A → ε (cancelaciones encadenadas)
|
|
20
|
+
(0, vitest_1.expect)((0, group_presentation_1.reduceWord)(['a', 'b', 'B', 'A'])).toEqual([]);
|
|
21
|
+
// a a b B A A → ε (a²b · b⁻¹ · a⁻² )
|
|
22
|
+
(0, vitest_1.expect)((0, group_presentation_1.reduceWord)(['a', 'a', 'b', 'B', 'A', 'A'])).toEqual([]);
|
|
23
|
+
});
|
|
24
|
+
(0, vitest_1.it)('multiplyWords concatena y reduce', () => {
|
|
25
|
+
(0, vitest_1.expect)((0, group_presentation_1.multiplyWords)(['a', 'b'], ['B', 'a'])).toEqual(['a', 'a']);
|
|
26
|
+
(0, vitest_1.expect)((0, group_presentation_1.multiplyWords)([], ['a'])).toEqual(['a']);
|
|
27
|
+
(0, vitest_1.expect)((0, group_presentation_1.multiplyWords)(['a'], ['A'])).toEqual([]);
|
|
28
|
+
});
|
|
29
|
+
(0, vitest_1.it)('invertWord invierte y aplica inverso a cada letra', () => {
|
|
30
|
+
(0, vitest_1.expect)((0, group_presentation_1.invertWord)(['a', 'b', 'A'])).toEqual(['a', 'B', 'A']);
|
|
31
|
+
(0, vitest_1.expect)((0, group_presentation_1.invertWord)([])).toEqual([]);
|
|
32
|
+
// (w · w⁻¹) reduce a ε
|
|
33
|
+
const w = ['a', 'b', 'c', 'A'];
|
|
34
|
+
(0, vitest_1.expect)((0, group_presentation_1.multiplyWords)(w, (0, group_presentation_1.invertWord)(w))).toEqual([]);
|
|
35
|
+
});
|
|
36
|
+
(0, vitest_1.it)('wordEquals compara sintácticamente', () => {
|
|
37
|
+
(0, vitest_1.expect)((0, group_presentation_1.wordEquals)(['a', 'b'], ['a', 'b'])).toBe(true);
|
|
38
|
+
(0, vitest_1.expect)((0, group_presentation_1.wordEquals)(['a', 'b'], ['a', 'B'])).toBe(false);
|
|
39
|
+
(0, vitest_1.expect)((0, group_presentation_1.wordEquals)([], [])).toBe(true);
|
|
40
|
+
(0, vitest_1.expect)((0, group_presentation_1.wordEquals)(['a'], ['a', 'b'])).toBe(false);
|
|
41
|
+
});
|
|
42
|
+
(0, vitest_1.it)('isReduced detecta y rechaza cancelaciones pendientes', () => {
|
|
43
|
+
(0, vitest_1.expect)((0, group_presentation_1.isReduced)(['a', 'b'])).toBe(true);
|
|
44
|
+
(0, vitest_1.expect)((0, group_presentation_1.isReduced)(['a', 'A'])).toBe(false);
|
|
45
|
+
(0, vitest_1.expect)((0, group_presentation_1.isReduced)(['a', 'b', 'B'])).toBe(false);
|
|
46
|
+
(0, vitest_1.expect)((0, group_presentation_1.isReduced)([])).toBe(true);
|
|
47
|
+
});
|
|
48
|
+
(0, vitest_1.it)('parseWord y wordToString son inversas', () => {
|
|
49
|
+
(0, vitest_1.expect)((0, group_presentation_1.parseWord)('abAb')).toEqual(['a', 'b', 'A', 'b']);
|
|
50
|
+
(0, vitest_1.expect)((0, group_presentation_1.wordToString)(['a', 'b', 'A', 'b'])).toBe('abAb');
|
|
51
|
+
(0, vitest_1.expect)((0, group_presentation_1.wordToString)([])).toBe('1');
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
(0, vitest_1.describe)('Group Presentation — Todd-Coxeter coset enumeration', () => {
|
|
55
|
+
(0, vitest_1.it)('cyclicGroupZn(5) tiene orden 5', () => {
|
|
56
|
+
(0, vitest_1.expect)((0, group_presentation_1.groupOrder)((0, group_presentation_1.cyclicGroupZn)(5))).toBe(5);
|
|
57
|
+
});
|
|
58
|
+
(0, vitest_1.it)('cyclicGroupZn(1) es trivial: orden 1', () => {
|
|
59
|
+
(0, vitest_1.expect)((0, group_presentation_1.groupOrder)((0, group_presentation_1.cyclicGroupZn)(1))).toBe(1);
|
|
60
|
+
});
|
|
61
|
+
(0, vitest_1.it)('cyclicGroupZn(7) — primo: orden 7', () => {
|
|
62
|
+
(0, vitest_1.expect)((0, group_presentation_1.groupOrder)((0, group_presentation_1.cyclicGroupZn)(7))).toBe(7);
|
|
63
|
+
});
|
|
64
|
+
(0, vitest_1.it)('dihedralGroupDn(3) tiene orden 6 (≅ S_3)', () => {
|
|
65
|
+
(0, vitest_1.expect)((0, group_presentation_1.groupOrder)((0, group_presentation_1.dihedralGroupDn)(3))).toBe(6);
|
|
66
|
+
});
|
|
67
|
+
(0, vitest_1.it)('dihedralGroupDn(4) tiene orden 8', () => {
|
|
68
|
+
(0, vitest_1.expect)((0, group_presentation_1.groupOrder)((0, group_presentation_1.dihedralGroupDn)(4))).toBe(8);
|
|
69
|
+
});
|
|
70
|
+
(0, vitest_1.it)('dihedralGroupDn(5) tiene orden 10', () => {
|
|
71
|
+
(0, vitest_1.expect)((0, group_presentation_1.groupOrder)((0, group_presentation_1.dihedralGroupDn)(5))).toBe(10);
|
|
72
|
+
});
|
|
73
|
+
(0, vitest_1.it)('grupo libre F_2 tiene orden infinito', () => {
|
|
74
|
+
(0, vitest_1.expect)((0, group_presentation_1.groupOrder)((0, group_presentation_1.freeGroupFn)(2))).toBe('infinite');
|
|
75
|
+
});
|
|
76
|
+
(0, vitest_1.it)('grupo libre F_1 tiene orden infinito', () => {
|
|
77
|
+
(0, vitest_1.expect)((0, group_presentation_1.groupOrder)((0, group_presentation_1.freeGroupFn)(1))).toBe('infinite');
|
|
78
|
+
});
|
|
79
|
+
(0, vitest_1.it)('grupo trivial ⟨ | ⟩ tiene orden 1', () => {
|
|
80
|
+
(0, vitest_1.expect)((0, group_presentation_1.groupOrder)({ generators: [], relations: [] })).toBe(1);
|
|
81
|
+
});
|
|
82
|
+
(0, vitest_1.it)('S_3 vía symmetricGroupSn(3) tiene orden 6', () => {
|
|
83
|
+
(0, vitest_1.expect)((0, group_presentation_1.groupOrder)((0, group_presentation_1.symmetricGroupSn)(3))).toBe(6);
|
|
84
|
+
});
|
|
85
|
+
(0, vitest_1.it)('S_4 vía symmetricGroupSn(4) tiene orden 24', () => {
|
|
86
|
+
(0, vitest_1.expect)((0, group_presentation_1.groupOrder)((0, group_presentation_1.symmetricGroupSn)(4), 256)).toBe(24);
|
|
87
|
+
});
|
|
88
|
+
(0, vitest_1.it)('Klein four-group ⟨a,b | a², b², (ab)²⟩ tiene orden 4', () => {
|
|
89
|
+
const klein = {
|
|
90
|
+
generators: ['a', 'b'],
|
|
91
|
+
relations: [
|
|
92
|
+
['a', 'a'],
|
|
93
|
+
['b', 'b'],
|
|
94
|
+
['a', 'b', 'a', 'b'],
|
|
95
|
+
],
|
|
96
|
+
};
|
|
97
|
+
(0, vitest_1.expect)((0, group_presentation_1.groupOrder)(klein)).toBe(4);
|
|
98
|
+
});
|
|
99
|
+
(0, vitest_1.it)('cap maxCosets demasiado bajo en F_2 devuelve unknown', () => {
|
|
100
|
+
// F_2 es infinito; con maxCosets=10, Todd-Coxeter no termina,
|
|
101
|
+
// aunque la rama 'infinite' lo detecta antes por ausencia de
|
|
102
|
+
// relaciones. Forzamos relación trivial para evitar el shortcut.
|
|
103
|
+
const almostFree = {
|
|
104
|
+
generators: ['a', 'b'],
|
|
105
|
+
relations: [['a', 'A']], // relación trivialmente reducible a vacío
|
|
106
|
+
};
|
|
107
|
+
// Como la relación reduce a ε, sigue siendo libre → 'infinite' por shortcut.
|
|
108
|
+
// Para forzar 'unknown' añadimos una relación no-trivial que no acote rápido:
|
|
109
|
+
const slow = {
|
|
110
|
+
generators: ['a', 'b'],
|
|
111
|
+
relations: [['a', 'b', 'A', 'B']], // commutator → Z²; con cap chico no termina
|
|
112
|
+
};
|
|
113
|
+
// Z² es infinito; cap pequeño da 'unknown'.
|
|
114
|
+
(0, vitest_1.expect)((0, group_presentation_1.groupOrder)(slow, 8)).toBe('unknown');
|
|
115
|
+
// El caso almostFree mantiene la rama 'infinite'.
|
|
116
|
+
(0, vitest_1.expect)((0, group_presentation_1.groupOrder)(almostFree)).toBe('infinite');
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
(0, vitest_1.describe)('Group Presentation — tabla de cosets y subgrupos', () => {
|
|
120
|
+
(0, vitest_1.it)('toddCoxeter sobre Z_6 produce 6 cosets', () => {
|
|
121
|
+
const t = (0, group_presentation_1.toddCoxeter)((0, group_presentation_1.cyclicGroupZn)(6));
|
|
122
|
+
(0, vitest_1.expect)(t).not.toBe('incomplete');
|
|
123
|
+
if (t === 'incomplete')
|
|
124
|
+
return;
|
|
125
|
+
(0, vitest_1.expect)(t.numCosets).toBe(6);
|
|
126
|
+
});
|
|
127
|
+
(0, vitest_1.it)('isInSubgroup: ⟨a²⟩ en Z_6 tiene índice 2 (Lagrange: |Z_6|/|⟨a²⟩|=6/3=2)', () => {
|
|
128
|
+
const z6 = (0, group_presentation_1.cyclicGroupZn)(6);
|
|
129
|
+
const t = (0, group_presentation_1.toddCoxeter)(z6, [['a', 'a']]);
|
|
130
|
+
(0, vitest_1.expect)(t).not.toBe('incomplete');
|
|
131
|
+
if (t === 'incomplete')
|
|
132
|
+
return;
|
|
133
|
+
(0, vitest_1.expect)(t.numCosets).toBe(2);
|
|
134
|
+
// a² ∈ ⟨a²⟩
|
|
135
|
+
(0, vitest_1.expect)((0, group_presentation_1.isInSubgroup)(['a', 'a'], t)).toBe(true);
|
|
136
|
+
// a ∉ ⟨a²⟩
|
|
137
|
+
(0, vitest_1.expect)((0, group_presentation_1.isInSubgroup)(['a'], t)).toBe(false);
|
|
138
|
+
// a⁴ ∈ ⟨a²⟩
|
|
139
|
+
(0, vitest_1.expect)((0, group_presentation_1.isInSubgroup)(['a', 'a', 'a', 'a'], t)).toBe(true);
|
|
140
|
+
});
|
|
141
|
+
(0, vitest_1.it)('isInSubgroup: ⟨a³⟩ en Z_6 tiene índice 3 (Lagrange: 6/2=3)', () => {
|
|
142
|
+
const z6 = (0, group_presentation_1.cyclicGroupZn)(6);
|
|
143
|
+
const t = (0, group_presentation_1.toddCoxeter)(z6, [['a', 'a', 'a']]);
|
|
144
|
+
(0, vitest_1.expect)(t).not.toBe('incomplete');
|
|
145
|
+
if (t === 'incomplete')
|
|
146
|
+
return;
|
|
147
|
+
(0, vitest_1.expect)(t.numCosets).toBe(3);
|
|
148
|
+
// a³ ∈ ⟨a³⟩
|
|
149
|
+
(0, vitest_1.expect)((0, group_presentation_1.isInSubgroup)(['a', 'a', 'a'], t)).toBe(true);
|
|
150
|
+
// a ∉ ⟨a³⟩
|
|
151
|
+
(0, vitest_1.expect)((0, group_presentation_1.isInSubgroup)(['a'], t)).toBe(false);
|
|
152
|
+
});
|
|
153
|
+
(0, vitest_1.it)('isInSubgroup: ε siempre está en cualquier subgrupo', () => {
|
|
154
|
+
const t = (0, group_presentation_1.toddCoxeter)((0, group_presentation_1.cyclicGroupZn)(4));
|
|
155
|
+
(0, vitest_1.expect)(t).not.toBe('incomplete');
|
|
156
|
+
if (t === 'incomplete')
|
|
157
|
+
return;
|
|
158
|
+
(0, vitest_1.expect)((0, group_presentation_1.isInSubgroup)([], t)).toBe(true);
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
(0, vitest_1.describe)('Group Presentation — Cayley graph', () => {
|
|
162
|
+
(0, vitest_1.it)('grafo de Cayley de Z_4 tiene 4 vértices y 4 aristas con un generador', () => {
|
|
163
|
+
const t = (0, group_presentation_1.toddCoxeter)((0, group_presentation_1.cyclicGroupZn)(4));
|
|
164
|
+
(0, vitest_1.expect)(t).not.toBe('incomplete');
|
|
165
|
+
if (t === 'incomplete')
|
|
166
|
+
return;
|
|
167
|
+
const g = (0, group_presentation_1.cayleyGraph)(t);
|
|
168
|
+
(0, vitest_1.expect)(g.vertices.length).toBe(4);
|
|
169
|
+
(0, vitest_1.expect)(g.edges.length).toBe(4); // solo el generador positivo 'a'
|
|
170
|
+
// Cada vértice tiene exactamente una arista saliente con 'a'.
|
|
171
|
+
const out = new Map();
|
|
172
|
+
for (const [v, ,] of g.edges) {
|
|
173
|
+
out.set(v, (out.get(v) ?? 0) + 1);
|
|
174
|
+
}
|
|
175
|
+
for (const v of g.vertices) {
|
|
176
|
+
(0, vitest_1.expect)(out.get(v)).toBe(1);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
(0, vitest_1.it)('grafo de Cayley de D_3 tiene 6 vértices y 12 aristas (2 generadores)', () => {
|
|
180
|
+
const t = (0, group_presentation_1.toddCoxeter)((0, group_presentation_1.dihedralGroupDn)(3));
|
|
181
|
+
(0, vitest_1.expect)(t).not.toBe('incomplete');
|
|
182
|
+
if (t === 'incomplete')
|
|
183
|
+
return;
|
|
184
|
+
const g = (0, group_presentation_1.cayleyGraph)(t);
|
|
185
|
+
(0, vitest_1.expect)(g.vertices.length).toBe(6);
|
|
186
|
+
(0, vitest_1.expect)(g.edges.length).toBe(12); // 6 vértices × 2 generadores positivos
|
|
187
|
+
});
|
|
188
|
+
(0, vitest_1.it)('grafo de Cayley del grupo trivial tiene 1 vértice', () => {
|
|
189
|
+
const t = (0, group_presentation_1.toddCoxeter)({ generators: ['a'], relations: [['a']] });
|
|
190
|
+
(0, vitest_1.expect)(t).not.toBe('incomplete');
|
|
191
|
+
if (t === 'incomplete')
|
|
192
|
+
return;
|
|
193
|
+
const g = (0, group_presentation_1.cayleyGraph)(t);
|
|
194
|
+
(0, vitest_1.expect)(g.vertices.length).toBe(1);
|
|
195
|
+
// El bucle a: 1 → 1 cuenta como una arista.
|
|
196
|
+
(0, vitest_1.expect)(g.edges.length).toBe(1);
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
(0, vitest_1.describe)('Group Presentation — más familias clásicas', () => {
|
|
200
|
+
(0, vitest_1.it)('Z_2 × Z_2 (Klein) usando otra presentación', () => {
|
|
201
|
+
// ⟨a, b | a², b², ab=ba⟩ ↔ conmutador [a,b]=1
|
|
202
|
+
const v4 = {
|
|
203
|
+
generators: ['a', 'b'],
|
|
204
|
+
relations: [
|
|
205
|
+
['a', 'a'],
|
|
206
|
+
['b', 'b'],
|
|
207
|
+
['a', 'b', 'A', 'B'], // [a,b] = 1
|
|
208
|
+
],
|
|
209
|
+
};
|
|
210
|
+
(0, vitest_1.expect)((0, group_presentation_1.groupOrder)(v4)).toBe(4);
|
|
211
|
+
});
|
|
212
|
+
(0, vitest_1.it)('grupo cuaternio Q_8: ⟨a,b | a⁴, a²b⁻², bab⁻¹a⟩ tiene orden 8', () => {
|
|
213
|
+
// Presentación clásica: a^4 = 1, a^2 = b^2, b a b^{-1} = a^{-1}
|
|
214
|
+
// → relaciones a^4, a^2 b^{-2}, b a b^{-1} a
|
|
215
|
+
const q8 = {
|
|
216
|
+
generators: ['a', 'b'],
|
|
217
|
+
relations: [
|
|
218
|
+
['a', 'a', 'a', 'a'],
|
|
219
|
+
['a', 'a', 'B', 'B'],
|
|
220
|
+
['b', 'a', 'B', 'a'],
|
|
221
|
+
],
|
|
222
|
+
};
|
|
223
|
+
(0, vitest_1.expect)((0, group_presentation_1.groupOrder)(q8, 128)).toBe(8);
|
|
224
|
+
});
|
|
225
|
+
(0, vitest_1.it)('D_2 = Z_2 × Z_2 (Klein) tiene orden 4', () => {
|
|
226
|
+
(0, vitest_1.expect)((0, group_presentation_1.groupOrder)((0, group_presentation_1.dihedralGroupDn)(2))).toBe(4);
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
//# sourceMappingURL=group-presentation.test.js.map
|