@stevenvo780/st-lang 2.0.4 → 2.5.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.
Files changed (98) hide show
  1. package/dist/cli/index.js.map +1 -1
  2. package/dist/lexer/tokens.d.ts.map +1 -1
  3. package/dist/parser/parser.d.ts +1 -0
  4. package/dist/parser/parser.d.ts.map +1 -1
  5. package/dist/parser/parser.js +99 -22
  6. package/dist/parser/parser.js.map +1 -1
  7. package/dist/profiles/aristotelian/syllogistic.d.ts.map +1 -1
  8. package/dist/profiles/aristotelian/syllogistic.js +219 -15
  9. package/dist/profiles/aristotelian/syllogistic.js.map +1 -1
  10. package/dist/profiles/arithmetic/index.d.ts +1 -6
  11. package/dist/profiles/arithmetic/index.d.ts.map +1 -1
  12. package/dist/profiles/arithmetic/index.js +142 -65
  13. package/dist/profiles/arithmetic/index.js.map +1 -1
  14. package/dist/profiles/classical/first-order.d.ts +2 -0
  15. package/dist/profiles/classical/first-order.d.ts.map +1 -1
  16. package/dist/profiles/classical/first-order.js +375 -51
  17. package/dist/profiles/classical/first-order.js.map +1 -1
  18. package/dist/profiles/classical/propositional.d.ts +7 -0
  19. package/dist/profiles/classical/propositional.d.ts.map +1 -1
  20. package/dist/profiles/classical/propositional.js +467 -32
  21. package/dist/profiles/classical/propositional.js.map +1 -1
  22. package/dist/profiles/deontic/standard.d.ts.map +1 -1
  23. package/dist/profiles/deontic/standard.js +13 -1
  24. package/dist/profiles/deontic/standard.js.map +1 -1
  25. package/dist/profiles/epistemic/s5.d.ts.map +1 -1
  26. package/dist/profiles/epistemic/s5.js +14 -1
  27. package/dist/profiles/epistemic/s5.js.map +1 -1
  28. package/dist/profiles/intuitionistic/propositional.d.ts.map +1 -1
  29. package/dist/profiles/intuitionistic/propositional.js +98 -13
  30. package/dist/profiles/intuitionistic/propositional.js.map +1 -1
  31. package/dist/profiles/modal/k.d.ts.map +1 -1
  32. package/dist/profiles/modal/k.js +9 -1
  33. package/dist/profiles/modal/k.js.map +1 -1
  34. package/dist/profiles/paraconsistent/belnap.d.ts +2 -1
  35. package/dist/profiles/paraconsistent/belnap.d.ts.map +1 -1
  36. package/dist/profiles/paraconsistent/belnap.js +81 -4
  37. package/dist/profiles/paraconsistent/belnap.js.map +1 -1
  38. package/dist/profiles/probabilistic/basic.d.ts.map +1 -1
  39. package/dist/profiles/probabilistic/basic.js +71 -1
  40. package/dist/profiles/probabilistic/basic.js.map +1 -1
  41. package/dist/profiles/shared/base-profile.d.ts +4 -2
  42. package/dist/profiles/shared/base-profile.d.ts.map +1 -1
  43. package/dist/profiles/shared/base-profile.js +72 -11
  44. package/dist/profiles/shared/base-profile.js.map +1 -1
  45. package/dist/profiles/shared/tableau-engine.d.ts +7 -7
  46. package/dist/profiles/shared/tableau-engine.d.ts.map +1 -1
  47. package/dist/profiles/shared/tableau-engine.js +74 -70
  48. package/dist/profiles/shared/tableau-engine.js.map +1 -1
  49. package/dist/profiles/temporal/ltl.d.ts +1 -0
  50. package/dist/profiles/temporal/ltl.d.ts.map +1 -1
  51. package/dist/profiles/temporal/ltl.js +65 -0
  52. package/dist/profiles/temporal/ltl.js.map +1 -1
  53. package/dist/protocol/handler.d.ts.map +1 -1
  54. package/dist/protocol/handler.js +96 -27
  55. package/dist/protocol/handler.js.map +1 -1
  56. package/dist/runtime/cross-system-compare.d.ts +4 -0
  57. package/dist/runtime/cross-system-compare.d.ts.map +1 -0
  58. package/dist/runtime/cross-system-compare.js +50 -0
  59. package/dist/runtime/cross-system-compare.js.map +1 -0
  60. package/dist/runtime/fallacies.d.ts.map +1 -1
  61. package/dist/runtime/fallacies.js +130 -0
  62. package/dist/runtime/fallacies.js.map +1 -1
  63. package/dist/runtime/format.d.ts +5 -0
  64. package/dist/runtime/format.d.ts.map +1 -1
  65. package/dist/runtime/format.js +54 -6
  66. package/dist/runtime/format.js.map +1 -1
  67. package/dist/runtime/formula-classifier.d.ts +18 -0
  68. package/dist/runtime/formula-classifier.d.ts.map +1 -0
  69. package/dist/runtime/formula-classifier.js +183 -0
  70. package/dist/runtime/formula-classifier.js.map +1 -0
  71. package/dist/runtime/interpreter.d.ts +1 -0
  72. package/dist/runtime/interpreter.d.ts.map +1 -1
  73. package/dist/runtime/interpreter.js +221 -49
  74. package/dist/runtime/interpreter.js.map +1 -1
  75. package/dist/runtime/known-theorems.d.ts +12 -0
  76. package/dist/runtime/known-theorems.d.ts.map +1 -0
  77. package/dist/runtime/known-theorems.js +147 -0
  78. package/dist/runtime/known-theorems.js.map +1 -0
  79. package/dist/tests/arithmetic.test.js +81 -27
  80. package/dist/tests/arithmetic.test.js.map +1 -1
  81. package/dist/tests/core.test.js +2 -2
  82. package/dist/tests/core.test.js.map +1 -1
  83. package/dist/tests/engines.test.js +1 -1
  84. package/dist/tests/engines.test.js.map +1 -1
  85. package/dist/tests/examples.test.js +1 -7
  86. package/dist/tests/examples.test.js.map +1 -1
  87. package/dist/tests/exhaustive-matrix.test.js +2 -2
  88. package/dist/tests/philosophy.test.js +2 -0
  89. package/dist/tests/philosophy.test.js.map +1 -1
  90. package/dist/tests/profiles.test.js +111 -0
  91. package/dist/tests/profiles.test.js.map +1 -1
  92. package/dist/tests/stress-exhaustive.test.js +94 -29
  93. package/dist/tests/stress-exhaustive.test.js.map +1 -1
  94. package/dist/tests/v1-features.test.js +10 -4
  95. package/dist/tests/v1-features.test.js.map +1 -1
  96. package/dist/types/index.d.ts +29 -0
  97. package/dist/types/index.d.ts.map +1 -1
  98. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/profiles/arithmetic/index.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,gDAAgD;AAChD,+DAA+D;AAC/D,sEAAsE;AACtE,wDAAwD;AACxD,EAAE;AACF,0BAA0B;AAC1B,EAAE;AACF,qEAAqE;AACrE,iEAAiE;AACjE,+DAA+D;;;AA4B/D,kCAmDC;AArED,4BAA4B;AAE5B,MAAM,gBAAgB,G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K,CAAC,EAAE,CAAC;YACzC,KAAK,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;YACtD,OAAO,CAAC,CAAC;QACX,CAAC;QACD,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,EAAE,CAAC;YACzC,KAAK,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;YACtD,OAAO,CAAC,CAAC;QACX,CAAC;QACD,OAAO,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IAChC,CAAC;IACD,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;QACX,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;IACtE,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -1,4 +1,6 @@
1
1
  import { Formula, Diagnostic, RunResult, Theory, LogicProfile } from '../../types';
2
+ export declare function toPrenex(f: Formula): Formula;
3
+ export declare function skolemize(f: Formula): Formula;
2
4
  export declare class ClassicalFirstOrder implements LogicProfile {
3
5
  readonly name = "classical.first_order";
4
6
  readonly description = "Logica clasica de primer orden (FOL) \u2014 Motor de Tableau v2";
@@ -1 +1 @@
1
- {"version":3,"file":"first-order.d.ts","sourceRoot":"","sources":["../../../src/profiles/classical/first-order.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAOnF,qBAAa,mBAAoB,YAAW,YAAY;IACtD,QAAQ,CAAC,IAAI,2BAA2B;IACxC,QAAQ,CAAC,WAAW,qEAAgE;IAEpF,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,EAA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C,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS;IAsFpE,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS;IAiEzC,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS;IAmHpC,eAAe,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,SAAS;IAelD,OAAO,CAAC,KAAK;IAcb,OAAO,CAAC,cAAc;IAuRtB,OAAO,CAAC,WAAW;IAGnB,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,OAAO;CAgBhB"}
@@ -4,7 +4,86 @@
4
4
  // ============================================================
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ClassicalFirstOrder = void 0;
7
+ exports.toPrenex = toPrenex;
8
+ exports.skolemize = skolemize;
7
9
  const propositional_1 = require("./propositional");
10
+ // ── Transforms ─────────────────────────────────────────────────────────────
11
+ let varCounter = 0;
12
+ function getNewVar() {
13
+ return `v${varCounter++}`;
14
+ }
15
+ let skolemCounter = 0;
16
+ function getSkolem(isFunc) {
17
+ return isFunc ? `f${skolemCounter++}` : `c${skolemCounter++}`;
18
+ }
19
+ function toPrenex(f) {
20
+ const nnf = (0, propositional_1.toNNF)(f);
21
+ function rename(node, mapping) {
22
+ if (node.kind === 'forall' || node.kind === 'exists') {
23
+ const v = node.variable;
24
+ const nv = getNewVar();
25
+ const newMap = new Map(mapping).set(v, nv);
26
+ return { ...node, variable: nv, args: [rename((node.args || [])[0], newMap)] };
27
+ }
28
+ if (node.kind === 'predicate') {
29
+ return { ...node, params: (node.params || []).map((p) => mapping.get(p) || p) };
30
+ }
31
+ if (node.args) {
32
+ return { ...node, args: node.args.map((a) => rename(a, mapping)) };
33
+ }
34
+ return node;
35
+ }
36
+ const renamed = rename(nnf, new Map());
37
+ const quantifiers = [];
38
+ function extract(node) {
39
+ if (node.kind === 'forall' || node.kind === 'exists') {
40
+ quantifiers.push({ kind: node.kind, v: node.variable });
41
+ return extract((node.args || [])[0]);
42
+ }
43
+ if (node.args) {
44
+ return { ...node, args: node.args.map(extract) };
45
+ }
46
+ return node;
47
+ }
48
+ const matrix = extract(renamed);
49
+ let res = matrix;
50
+ for (let i = quantifiers.length - 1; i >= 0; i--) {
51
+ res = { kind: quantifiers[i].kind, variable: quantifiers[i].v, args: [res] };
52
+ }
53
+ return res;
54
+ }
55
+ function skolemize(f) {
56
+ const prenex = toPrenex(f);
57
+ const foralls = [];
58
+ function process(node) {
59
+ if (node.kind === 'forall') {
60
+ foralls.push(node.variable);
61
+ const inner = process((node.args || [])[0]);
62
+ foralls.pop();
63
+ return { ...node, args: [inner] };
64
+ }
65
+ if (node.kind === 'exists') {
66
+ const v = node.variable;
67
+ const isFunc = foralls.length > 0;
68
+ const skName = getSkolem(isFunc);
69
+ const replaceStr = isFunc ? `${skName}(${foralls.join(',')})` : skName;
70
+ function rep(n) {
71
+ if (n.kind === 'predicate') {
72
+ return { ...n, params: (n.params || []).map((p) => (p === v ? replaceStr : p)) };
73
+ }
74
+ if (n.args)
75
+ return { ...n, args: n.args.map(rep) };
76
+ return n;
77
+ }
78
+ return process(rep((node.args || [])[0]));
79
+ }
80
+ return node;
81
+ }
82
+ const rawMatrix = process(prenex);
83
+ // Restore remaining foralls (Skolemization removes existentials, keeps foralls usually implicitly but we make them explicit)
84
+ const finalRes = rawMatrix;
85
+ return finalRes; // Simplification: we just return the matrix, standard skolemization implicitly universalizes
86
+ }
8
87
  class ClassicalFirstOrder {
9
88
  name = 'classical.first_order';
10
89
  description = 'Logica clasica de primer orden (FOL) — Motor de Tableau v2';
@@ -22,19 +101,21 @@ class ClassicalFirstOrder {
22
101
  }
23
102
  checkValid(formula) {
24
103
  const negated = (0, propositional_1.toNNF)({ kind: 'not', args: [formula] });
25
- const isClosed = this.solve([{ formula: negated }]);
104
+ const res = this.solve([{ formula: negated }]);
105
+ const isClosed = res.closed;
26
106
  return {
27
- status: isClosed ? 'valid' : 'unknown',
107
+ status: isClosed ? 'valid' : 'invalid',
28
108
  output: isClosed
29
- ? `${(0, propositional_1.formulaToString)(formula)} es VALIDA en FOL`
30
- : `${(0, propositional_1.formulaToString)(formula)} no demostrada`,
109
+ ? `${(0, propositional_1.formulaToString)(formula)} es VÁLIDA en FOL`
110
+ : `${(0, propositional_1.formulaToString)(formula)} NO es válida (tiene un contramodelo)`,
111
+ tableauTrace: res.trace,
31
112
  diagnostics: [],
32
113
  formula,
33
114
  };
34
115
  }
35
116
  checkSatisfiable(formula) {
36
117
  const nnf = (0, propositional_1.toNNF)(formula);
37
- const isClosed = this.solve([{ formula: nnf }]);
118
+ const isClosed = this.solve([{ formula: nnf }]).closed;
38
119
  return {
39
120
  status: !isClosed ? 'satisfiable' : 'unsatisfiable',
40
121
  output: !isClosed ? `Satisfacible` : `Insatisfacible`,
@@ -48,32 +129,256 @@ class ClassicalFirstOrder {
48
129
  ...axioms.map((a) => ({ formula: (0, propositional_1.toNNF)(a) })),
49
130
  { formula: (0, propositional_1.toNNF)({ kind: 'not', args: [goal] }) },
50
131
  ];
51
- const isClosed = this.solve(nodes);
132
+ const res = this.solve(nodes);
133
+ const isClosed = res.closed;
52
134
  return {
53
135
  status: isClosed ? 'provable' : 'refutable',
54
136
  output: isClosed ? 'Demostrado' : 'No demostrable',
137
+ tableauTrace: res.trace,
55
138
  diagnostics: [],
56
139
  formula: goal,
57
140
  };
58
141
  }
59
142
  derive(goal, premises, theory) {
60
- const formulas = premises.map((p) => theory.axioms.get(p)).filter((f) => !!f);
143
+ const formulas = premises
144
+ .map((p) => theory.axioms.get(p) || theory.theorems.get(p))
145
+ .filter((f) => !!f);
61
146
  const nodes = [
62
147
  ...formulas.map((f) => ({ formula: (0, propositional_1.toNNF)(f) })),
63
148
  { formula: (0, propositional_1.toNNF)({ kind: 'not', args: [goal] }) },
64
149
  ];
150
+ const res = this.solve(nodes);
151
+ // Build proof steps from tableau trace
152
+ const proof = { goal, steps: [], status: 'incomplete' };
153
+ let stepNum = 0;
154
+ // Add premises as steps
155
+ for (let i = 0; i < premises.length; i++) {
156
+ stepNum++;
157
+ const f = formulas[i];
158
+ if (f) {
159
+ proof.steps.push({
160
+ stepNumber: stepNum,
161
+ formula: f,
162
+ justification: `Premisa (${premises[i]})`,
163
+ premises: [],
164
+ });
165
+ }
166
+ }
167
+ // Parse tableau trace to extract named quantifier rules
168
+ for (const traceLine of res.trace) {
169
+ if (traceLine.includes('Instanciación Universal UI') ||
170
+ traceLine.includes('Gamma') ||
171
+ traceLine.includes('gamma')) {
172
+ stepNum++;
173
+ proof.steps.push({
174
+ stepNumber: stepNum,
175
+ formula: goal,
176
+ justification: 'Instanciación Universal (UI): ∀xφ(x) ⊢ φ(a)',
177
+ premises: [],
178
+ });
179
+ }
180
+ if (traceLine.includes('Instanciación Existencial EI') ||
181
+ traceLine.includes('Delta') ||
182
+ traceLine.includes('delta')) {
183
+ stepNum++;
184
+ proof.steps.push({
185
+ stepNumber: stepNum,
186
+ formula: goal,
187
+ justification: 'Instanciación Existencial (EI): ∃xφ(x) ⊢ φ(c) [c nueva]',
188
+ premises: [],
189
+ });
190
+ }
191
+ }
192
+ // Final step
193
+ if (res.closed) {
194
+ stepNum++;
195
+ proof.steps.push({
196
+ stepNumber: stepNum,
197
+ formula: goal,
198
+ justification: 'Demostrado por refutación — todas las ramas del tableau cerradas',
199
+ premises: [],
200
+ });
201
+ proof.status = 'complete';
202
+ }
203
+ const output = res.closed
204
+ ? `Derivado con éxito mediante tableau de primer orden.\n Reglas de cuantificadores aplicadas:\n UI: Instanciación Universal — ∀xφ(x) ⊢ φ(a)\n EI: Instanciación Existencial — ∃xφ(x) ⊢ φ(c) [c nueva]\n UG: Generalización Universal — φ(a) [a arbitrario] ⊢ ∀xφ(x)\n EG: Generalización Existencial — φ(a) ⊢ ∃xφ(x)`
205
+ : 'No se pudo derivar.';
65
206
  return {
66
- status: this.solve(nodes) ? 'provable' : 'refutable',
67
- output: 'Derivacion',
207
+ status: res.closed ? 'provable' : 'refutable',
208
+ output,
209
+ proof: res.closed ? proof : undefined,
210
+ tableauTrace: res.trace,
211
+ reasoningType: res.closed ? 'Tableau de primer orden (refutación)' : undefined,
212
+ reasoningSchema: res.closed ? 'Γ, ¬φ ⊢ ⊥ ∴ Γ ⊢ φ' : undefined,
68
213
  diagnostics: [],
69
214
  formula: goal,
70
215
  };
71
216
  }
72
217
  countermodel(formula) {
73
- return this.checkValid(formula);
218
+ const nnf = (0, propositional_1.toNNF)(formula);
219
+ const res = this.solve([{ formula: { kind: 'not', args: [nnf] } }]);
220
+ if (!res.closed) {
221
+ // Extract domain and interpretation from open branch trace
222
+ const domain = new Set();
223
+ const interpretations = new Map();
224
+ for (const line of res.trace) {
225
+ // Collect constants mentioned in trace
226
+ const constMatch = line.match(/\b(c\d+|[a-d])\b/g);
227
+ if (constMatch) {
228
+ for (const c of constMatch)
229
+ domain.add(c);
230
+ }
231
+ }
232
+ if (domain.size === 0)
233
+ domain.add('a');
234
+ // Build output
235
+ let output = `Contramodelo encontrado:\n`;
236
+ output += ` Dominio D = {${Array.from(domain).join(', ')}}\n`;
237
+ output += ` Interpretación:\n`;
238
+ // Collect predicates from formula
239
+ const preds = new Map();
240
+ const collectPreds = (f) => {
241
+ if (f.kind === 'predicate' && f.name) {
242
+ preds.set(f.name, (f.params || []).length);
243
+ }
244
+ f.args?.forEach(collectPreds);
245
+ };
246
+ collectPreds(formula);
247
+ for (const [pred, arity] of preds) {
248
+ const interp = interpretations.get(pred);
249
+ if (interp && interp.size > 0) {
250
+ output += ` ${pred} = {${Array.from(interp).join(', ')}} (aridad ${arity})\n`;
251
+ }
252
+ else {
253
+ output += ` ${pred} = {} (vacío, aridad ${arity})\n`;
254
+ }
255
+ }
256
+ output += ` → La fórmula no es válida`;
257
+ return {
258
+ status: 'invalid',
259
+ output,
260
+ model: {
261
+ type: 'first_order',
262
+ valuation: Object.fromEntries(Array.from(preds.keys()).map((p) => [p, false])),
263
+ },
264
+ tableauTrace: res.trace,
265
+ diagnostics: [],
266
+ formula,
267
+ };
268
+ }
269
+ return {
270
+ status: 'valid',
271
+ output: `No existen contramodelos — la fórmula es válida en FOL.`,
272
+ tableauTrace: res.trace,
273
+ diagnostics: [],
274
+ formula,
275
+ };
74
276
  }
75
277
  explain(formula) {
76
- return { status: 'unknown', output: `FOL`, diagnostics: [], formula };
278
+ const nnf = (0, propositional_1.toNNF)(formula);
279
+ const prenex = toPrenex(formula);
280
+ const skolem = skolemize(formula);
281
+ // Collect quantifiers, predicates, variables
282
+ const quantifiers = [];
283
+ const predicates = new Map(); // name -> arity
284
+ const freeVars = new Set();
285
+ const boundVars = new Set();
286
+ const collectInfo = (f, bound) => {
287
+ if (f.kind === 'forall' || f.kind === 'exists') {
288
+ const v = f.variable || '_';
289
+ const innerStr = f.args?.[0] ? (0, propositional_1.formulaToString)(f.args[0]) : '?';
290
+ quantifiers.push({
291
+ kind: f.kind === 'forall' ? '∀' : '∃',
292
+ variable: v,
293
+ scope: innerStr,
294
+ });
295
+ const newBound = new Set(bound);
296
+ newBound.add(v);
297
+ boundVars.add(v);
298
+ if (f.args)
299
+ f.args.forEach((a) => collectInfo(a, newBound));
300
+ return;
301
+ }
302
+ if (f.kind === 'predicate' && f.name) {
303
+ const arity = (f.params || []).length;
304
+ predicates.set(f.name, arity);
305
+ for (const p of f.params || []) {
306
+ if (!bound.has(p))
307
+ freeVars.add(p);
308
+ }
309
+ }
310
+ if (f.kind === 'atom' && f.name) {
311
+ predicates.set(f.name, 0);
312
+ }
313
+ if (f.args)
314
+ f.args.forEach((a) => collectInfo(a, bound));
315
+ };
316
+ collectInfo(formula, new Set());
317
+ let out = `Análisis de Fórmula en Primer Orden:\n`;
318
+ out += ` Fórmula original: ${(0, propositional_1.formulaToString)(formula)}\n`;
319
+ // Syntactic analysis
320
+ out += `\nAnálisis sintáctico:\n`;
321
+ if (quantifiers.length > 0) {
322
+ const qStrs = quantifiers.map((q) => `${q.kind}${q.variable} (${q.kind === '∀' ? 'universal' : 'existencial'})`);
323
+ out += ` Cuantificadores: ${qStrs.join(', ')}\n`;
324
+ for (const q of quantifiers) {
325
+ out += ` Alcance de ${q.kind}${q.variable}: ${q.scope}\n`;
326
+ }
327
+ }
328
+ else {
329
+ out += ` Cuantificadores: ninguno (fórmula proposicional con predicados)\n`;
330
+ }
331
+ if (predicates.size > 0) {
332
+ const predStrs = Array.from(predicates.entries()).map(([n, a]) => `${n}/${a} (aridad ${a})`);
333
+ out += ` Predicados: ${predStrs.join(', ')}\n`;
334
+ }
335
+ if (boundVars.size > 0)
336
+ out += ` Variables ligadas: ${Array.from(boundVars).join(', ')}\n`;
337
+ if (freeVars.size > 0) {
338
+ out += ` Variables libres: ${Array.from(freeVars).join(', ')}\n`;
339
+ }
340
+ else {
341
+ out += ` Variables libres: ninguna (sentencia cerrada)\n`;
342
+ }
343
+ // Quantifier alternation depth
344
+ let altDepth = 0;
345
+ let lastQ = '';
346
+ for (const q of quantifiers) {
347
+ if (lastQ && lastQ !== q.kind)
348
+ altDepth++;
349
+ lastQ = q.kind;
350
+ }
351
+ out += ` Alternancia de cuantificadores: ${altDepth}\n`;
352
+ out += ` Profundidad de cuantificadores: ${quantifiers.length}\n`;
353
+ // Normal forms
354
+ out += `\nFormas normales:\n`;
355
+ out += ` NNF: ${(0, propositional_1.formulaToString)(nnf)}\n`;
356
+ out += ` PNF: ${(0, propositional_1.formulaToString)(prenex)}\n`;
357
+ out += ` Skolem: ${(0, propositional_1.formulaToString)(skolem)}\n`;
358
+ // Natural language interpretation
359
+ if (quantifiers.length === 1 &&
360
+ quantifiers[0].kind === '∀' &&
361
+ formula.args?.[0]?.kind === 'implies' &&
362
+ predicates.size === 2) {
363
+ const pNames = Array.from(predicates.keys());
364
+ out += `\nInterpretación natural: "Para todo ${quantifiers[0].variable}, si ${quantifiers[0].variable} es ${pNames[0]} entonces ${quantifiers[0].variable} es ${pNames[1]}"\n`;
365
+ out += `Lectura categórica: "Todo ${pNames[0]} es ${pNames[1]}" (proposición tipo A)\n`;
366
+ }
367
+ // Validity check
368
+ const res = this.solve([{ formula: (0, propositional_1.toNNF)({ kind: 'not', args: [formula] }) }]);
369
+ out += `\nEstatus: ${res.closed ? 'VÁLIDA (demostrada por tableau)' : 'INVÁLIDA (rama abierta encontrada)'}`;
370
+ return {
371
+ status: res.closed ? 'valid' : 'invalid',
372
+ output: out,
373
+ tableauTrace: res.trace,
374
+ normalForms: {
375
+ nnf: (0, propositional_1.formulaToString)(nnf),
376
+ pnf: (0, propositional_1.formulaToString)(prenex),
377
+ skolem: (0, propositional_1.formulaToString)(skolem),
378
+ },
379
+ diagnostics: [],
380
+ formula,
381
+ };
77
382
  }
78
383
  checkEquivalent(a, b) {
79
384
  const biconditional = { kind: 'biconditional', args: [a, b] };
@@ -99,17 +404,25 @@ class ClassicalFirstOrder {
99
404
  f.args?.forEach(collect);
100
405
  };
101
406
  initialNodes.forEach((n) => collect(n.formula));
102
- return this.solveRecursive(initialNodes, constants, new Set(), 0);
407
+ const trace = [];
408
+ const closed = this.solveRecursive(initialNodes, constants, new Set(), 0, trace);
409
+ return { closed, trace };
103
410
  }
104
- solveRecursive(nodes, constants, processed, depth) {
105
- if (depth > 50 || nodes.length === 0)
411
+ solveRecursive(nodes, constants, processed, depth, trace) {
412
+ if (depth > 50) {
413
+ trace.push(`[${depth}] ⚠ Se superó la profundidad máxima permitida (50).`);
414
+ return false;
415
+ }
416
+ if (nodes.length === 0)
106
417
  return false;
107
418
  // 1. Contradicción robusta (comparación canónica)
108
419
  for (const n1 of nodes) {
109
420
  if (n1.formula.kind === 'not' && n1.formula.args) {
110
421
  const atom = n1.formula.args[0];
111
- if (nodes.some((n2) => this.isEqual(n2.formula, atom)))
422
+ if (nodes.some((n2) => this.isEqual(n2.formula, atom))) {
423
+ trace.push(`[${depth}] ✕ Rama cerrada por contradicción con ${(0, propositional_1.formulaToString)(atom)}`);
112
424
  return true;
425
+ }
113
426
  }
114
427
  }
115
428
  const type = (f) => {
@@ -127,15 +440,15 @@ class ClassicalFirstOrder {
127
440
  const inner = (f.args || [])[0];
128
441
  if (inner) {
129
442
  if (inner.kind === 'and')
130
- return 'beta'; // ¬(A∧B) = ¬A∨¬B
443
+ return 'beta';
131
444
  if (inner.kind === 'or')
132
- return 'alfa'; // ¬(A∨B) = ¬A∧¬B
445
+ return 'alfa';
133
446
  if (inner.kind === 'implies')
134
- return 'alfa'; // ¬(A→B) = A∧¬B
447
+ return 'alfa';
135
448
  if (inner.kind === 'exists')
136
- return 'gamma'; // ¬∃x = ∀x¬
449
+ return 'gamma';
137
450
  if (inner.kind === 'forall')
138
- return 'delta'; // ¬∀x = ∃x¬
451
+ return 'delta';
139
452
  }
140
453
  }
141
454
  return 'atom';
@@ -151,20 +464,22 @@ class ClassicalFirstOrder {
151
464
  const args = f.args || [];
152
465
  const key = this.formulaHash(f);
153
466
  if (p !== 'gamma' && p !== 'atom' && processed.has(key))
154
- return this.solveRecursive(rest, constants, processed, depth);
467
+ return this.solveRecursive(rest, constants, processed, depth, trace);
155
468
  const nextProcessed = new Set(processed);
156
469
  if (p !== 'gamma' && p !== 'atom')
157
470
  nextProcessed.add(key);
158
471
  switch (f.kind) {
159
472
  case 'and':
160
- return this.solveRecursive([{ formula: args[0] }, { formula: args[1] }, ...rest], constants, nextProcessed, depth + 1);
473
+ trace.push(`[${depth}] Alfa (∧): ${(0, propositional_1.formulaToString)(f)}`);
474
+ return this.solveRecursive([{ formula: args[0] }, { formula: args[1] }, ...rest], constants, nextProcessed, depth + 1, trace);
161
475
  case 'exists': {
162
476
  const variable = f.variable;
163
477
  if (!args[0] || !variable)
164
478
  return false;
165
479
  const newC = `c${constants.size}`;
480
+ trace.push(`[${depth}] Delta (∃ - Instanciación Existencial EI): ${(0, propositional_1.formulaToString)(f)} -> asignando cte nueva ${newC}`);
166
481
  const nextConstants = new Set(constants).add(newC);
167
- return this.solveRecursive([{ formula: this.substitute(args[0], variable, newC) }, ...rest], nextConstants, nextProcessed, depth + 1);
482
+ return this.solveRecursive([{ formula: this.substitute(args[0], variable, newC) }, ...rest], nextConstants, nextProcessed, depth + 1, trace);
168
483
  }
169
484
  case 'forall': {
170
485
  const variable = f.variable;
@@ -178,62 +493,71 @@ class ClassicalFirstOrder {
178
493
  processed.add(instKey);
179
494
  }
180
495
  }
181
- if (newInsts.length > 0)
182
- return this.solveRecursive([...newInsts, ...nodes], constants, processed, depth + 1);
183
- return this.solveRecursive(rest, constants, nextProcessed, depth);
496
+ if (newInsts.length > 0) {
497
+ trace.push(`[${depth}] Gamma (∀ - Instanciación Universal UI): ${(0, propositional_1.formulaToString)(f)} -> con instantes actuales`);
498
+ return this.solveRecursive([...newInsts, ...nodes], constants, processed, depth + 1, trace);
499
+ }
500
+ return this.solveRecursive(rest, constants, nextProcessed, depth, trace);
184
501
  }
185
502
  case 'or':
186
- return (this.solveRecursive([{ formula: args[0] }, ...rest], constants, nextProcessed, depth + 1) &&
187
- this.solveRecursive([{ formula: args[1] }, ...rest], constants, nextProcessed, depth + 1));
503
+ trace.push(`[${depth}] Beta (∨): ${(0, propositional_1.formulaToString)(f)} -> Bifurcando`);
504
+ return (this.solveRecursive([{ formula: args[0] }, ...rest], constants, nextProcessed, depth + 1, [...trace, `[${depth}] -> Rama 1: ${(0, propositional_1.formulaToString)(args[0])}`]) &&
505
+ this.solveRecursive([{ formula: args[1] }, ...rest], constants, nextProcessed, depth + 1, [...trace, `[${depth}] -> Rama 2: ${(0, propositional_1.formulaToString)(args[1])}`]));
188
506
  case 'implies':
189
- // AB ¬A ∨ B (beta)
190
- return (this.solveRecursive([{ formula: { kind: 'not', args: [args[0]] } }, ...rest], constants, nextProcessed, depth + 1) &&
191
- this.solveRecursive([{ formula: args[1] }, ...rest], constants, nextProcessed, depth + 1));
507
+ trace.push(`[${depth}] Beta (): ${(0, propositional_1.formulaToString)(f)} -> Bifurcando`);
508
+ return (this.solveRecursive([{ formula: { kind: 'not', args: [args[0]] } }, ...rest], constants, nextProcessed, depth + 1, [...trace, `[${depth}] -> Rama 1: ¬${(0, propositional_1.formulaToString)(args[0])}`]) &&
509
+ this.solveRecursive([{ formula: args[1] }, ...rest], constants, nextProcessed, depth + 1, [...trace, `[${depth}] -> Rama 2: ${(0, propositional_1.formulaToString)(args[1])}`]));
192
510
  case 'biconditional':
193
- // AB ≡ (A∧B) ∨ (¬A∧¬B) (beta)
194
- return (this.solveRecursive([{ formula: args[0] }, { formula: args[1] }, ...rest], constants, nextProcessed, depth + 1) &&
511
+ trace.push(`[${depth}] Beta (): ${(0, propositional_1.formulaToString)(f)}`);
512
+ return (this.solveRecursive([{ formula: args[0] }, { formula: args[1] }, ...rest], constants, nextProcessed, depth + 1, [...trace]) &&
195
513
  this.solveRecursive([
196
514
  { formula: { kind: 'not', args: [args[0]] } },
197
515
  { formula: { kind: 'not', args: [args[1]] } },
198
516
  ...rest,
199
- ], constants, nextProcessed, depth + 1));
517
+ ], constants, nextProcessed, depth + 1, [...trace]));
200
518
  case 'not': {
201
519
  const inner = args[0];
202
520
  if (!inner)
203
521
  return false;
204
522
  switch (inner.kind) {
205
523
  case 'and':
206
- // ¬(A∧B) = ¬A∨¬B (beta)
524
+ trace.push(`[${depth}] Beta (¬∧): ${(0, propositional_1.formulaToString)(f)}`);
207
525
  return ((inner.args || []).length >= 2 &&
208
- this.solveRecursive([{ formula: { kind: 'not', args: [inner.args[0]] } }, ...rest], constants, nextProcessed, depth + 1) &&
209
- this.solveRecursive([{ formula: { kind: 'not', args: [inner.args[1]] } }, ...rest], constants, nextProcessed, depth + 1));
526
+ this.solveRecursive([{ formula: { kind: 'not', args: [inner.args[0]] } }, ...rest], constants, nextProcessed, depth + 1, [...trace]) &&
527
+ this.solveRecursive([{ formula: { kind: 'not', args: [inner.args[1]] } }, ...rest], constants, nextProcessed, depth + 1, [...trace]));
210
528
  case 'or':
211
- // ¬(A∨B) = ¬A∧¬B (alfa)
529
+ trace.push(`[${depth}] Alfa (¬∨): ${(0, propositional_1.formulaToString)(f)}`);
212
530
  return this.solveRecursive([
213
- ...((inner.args || []).map((a) => ({ formula: { kind: 'not', args: [a] } }))),
531
+ ...(inner.args || []).map((a) => ({
532
+ formula: { kind: 'not', args: [a] },
533
+ })),
214
534
  ...rest,
215
- ], constants, nextProcessed, depth + 1);
535
+ ], constants, nextProcessed, depth + 1, trace);
216
536
  case 'implies':
217
- // ¬(A→B) = A∧¬B (alfa)
537
+ trace.push(`[${depth}] Alfa (¬→): ${(0, propositional_1.formulaToString)(f)}`);
218
538
  return this.solveRecursive([
219
539
  { formula: (inner.args || [])[0] },
220
540
  { formula: { kind: 'not', args: [(inner.args || [])[1]] } },
221
541
  ...rest,
222
- ], constants, nextProcessed, depth + 1);
542
+ ], constants, nextProcessed, depth + 1, trace);
223
543
  case 'forall': {
224
- // ¬∀x.φ = ∃x.¬φ (delta)
225
544
  const variable = inner.variable;
226
545
  if (!(inner.args || [])[0] || !variable)
227
546
  return false;
228
547
  const newC = `c${constants.size}`;
548
+ trace.push(`[${depth}] Delta (¬∀): ${(0, propositional_1.formulaToString)(f)} -> instanciando con ${newC} (EI)`);
229
549
  const nextConstants = new Set(constants).add(newC);
230
550
  return this.solveRecursive([
231
- { formula: { kind: 'not', args: [this.substitute(inner.args[0], variable, newC)] } },
551
+ {
552
+ formula: {
553
+ kind: 'not',
554
+ args: [this.substitute(inner.args[0], variable, newC)],
555
+ },
556
+ },
232
557
  ...rest,
233
- ], nextConstants, nextProcessed, depth + 1);
558
+ ], nextConstants, nextProcessed, depth + 1, trace);
234
559
  }
235
560
  case 'exists': {
236
- // ¬∃x.φ = ∀x.¬φ (gamma)
237
561
  const variable = inner.variable;
238
562
  if (!(inner.args || [])[0] || !variable)
239
563
  return false;
@@ -242,18 +566,18 @@ class ClassicalFirstOrder {
242
566
  variable,
243
567
  args: [{ kind: 'not', args: [inner.args[0]] }],
244
568
  };
245
- return this.solveRecursive([{ formula: negForall }, ...rest], constants, nextProcessed, depth + 1);
569
+ trace.push(`[${depth}] Gamma (¬∃): ${(0, propositional_1.formulaToString)(f)} -> transformando a ∀¬ (UG/UI prep)`);
570
+ return this.solveRecursive([{ formula: negForall }, ...rest], constants, nextProcessed, depth + 1, trace);
246
571
  }
247
572
  case 'not':
248
- // ¬¬A = A (doble negación)
249
- return this.solveRecursive([{ formula: (inner.args || [])[0] }, ...rest], constants, nextProcessed, depth + 1);
250
- default:
251
- break;
573
+ trace.push(`[${depth}] Doble negación: ${(0, propositional_1.formulaToString)(f)}`);
574
+ return this.solveRecursive([{ formula: (inner.args || [])[0] }, ...rest], constants, nextProcessed, depth + 1, trace);
252
575
  }
253
576
  break;
254
577
  }
255
578
  }
256
579
  }
580
+ trace.push(`[${depth}] ✓ Rama saturada y ABIERTA.`);
257
581
  return false;
258
582
  }
259
583
  formulaHash(f) {