@stevenvo780/st-lang 4.9.0 → 4.10.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 (121) hide show
  1. package/dist/logic/profiles/natural-deduction-nk/formula.d.ts +18 -0
  2. package/dist/logic/profiles/natural-deduction-nk/formula.d.ts.map +1 -0
  3. package/dist/logic/profiles/natural-deduction-nk/formula.js +102 -0
  4. package/dist/logic/profiles/natural-deduction-nk/formula.js.map +1 -0
  5. package/dist/logic/profiles/natural-deduction-nk/index.d.ts +5 -0
  6. package/dist/logic/profiles/natural-deduction-nk/index.d.ts.map +1 -0
  7. package/dist/logic/profiles/natural-deduction-nk/index.js +28 -0
  8. package/dist/logic/profiles/natural-deduction-nk/index.js.map +1 -0
  9. package/dist/logic/profiles/natural-deduction-nk/prover.d.ts +49 -0
  10. package/dist/logic/profiles/natural-deduction-nk/prover.d.ts.map +1 -0
  11. package/dist/logic/profiles/natural-deduction-nk/prover.js +557 -0
  12. package/dist/logic/profiles/natural-deduction-nk/prover.js.map +1 -0
  13. package/dist/logic/profiles/natural-deduction-nk/types.d.ts +48 -0
  14. package/dist/logic/profiles/natural-deduction-nk/types.d.ts.map +1 -0
  15. package/dist/logic/profiles/natural-deduction-nk/types.js +35 -0
  16. package/dist/logic/profiles/natural-deduction-nk/types.js.map +1 -0
  17. package/dist/reasoning/automata/dfa.d.ts +17 -0
  18. package/dist/reasoning/automata/dfa.d.ts.map +1 -0
  19. package/dist/reasoning/automata/dfa.js +276 -0
  20. package/dist/reasoning/automata/dfa.js.map +1 -0
  21. package/dist/reasoning/automata/index.d.ts +8 -0
  22. package/dist/reasoning/automata/index.d.ts.map +1 -0
  23. package/dist/reasoning/automata/index.js +64 -0
  24. package/dist/reasoning/automata/index.js.map +1 -0
  25. package/dist/reasoning/automata/languages.d.ts +10 -0
  26. package/dist/reasoning/automata/languages.d.ts.map +1 -0
  27. package/dist/reasoning/automata/languages.js +78 -0
  28. package/dist/reasoning/automata/languages.js.map +1 -0
  29. package/dist/reasoning/automata/nfa.d.ts +8 -0
  30. package/dist/reasoning/automata/nfa.d.ts.map +1 -0
  31. package/dist/reasoning/automata/nfa.js +122 -0
  32. package/dist/reasoning/automata/nfa.js.map +1 -0
  33. package/dist/reasoning/automata/pda.d.ts +10 -0
  34. package/dist/reasoning/automata/pda.d.ts.map +1 -0
  35. package/dist/reasoning/automata/pda.js +169 -0
  36. package/dist/reasoning/automata/pda.js.map +1 -0
  37. package/dist/reasoning/automata/regex.d.ts +6 -0
  38. package/dist/reasoning/automata/regex.d.ts.map +1 -0
  39. package/dist/reasoning/automata/regex.js +259 -0
  40. package/dist/reasoning/automata/regex.js.map +1 -0
  41. package/dist/reasoning/automata/types.d.ts +69 -0
  42. package/dist/reasoning/automata/types.d.ts.map +1 -0
  43. package/dist/reasoning/automata/types.js +29 -0
  44. package/dist/reasoning/automata/types.js.map +1 -0
  45. package/dist/reasoning/computability/index.d.ts +239 -0
  46. package/dist/reasoning/computability/index.d.ts.map +1 -0
  47. package/dist/reasoning/computability/index.js +851 -0
  48. package/dist/reasoning/computability/index.js.map +1 -0
  49. package/dist/reasoning/number-theory/crt.d.ts +9 -0
  50. package/dist/reasoning/number-theory/crt.d.ts.map +1 -0
  51. package/dist/reasoning/number-theory/crt.js +39 -0
  52. package/dist/reasoning/number-theory/crt.js.map +1 -0
  53. package/dist/reasoning/number-theory/diophantine.d.ts +10 -0
  54. package/dist/reasoning/number-theory/diophantine.d.ts.map +1 -0
  55. package/dist/reasoning/number-theory/diophantine.js +87 -0
  56. package/dist/reasoning/number-theory/diophantine.js.map +1 -0
  57. package/dist/reasoning/number-theory/factorization.d.ts +12 -0
  58. package/dist/reasoning/number-theory/factorization.d.ts.map +1 -0
  59. package/dist/reasoning/number-theory/factorization.js +136 -0
  60. package/dist/reasoning/number-theory/factorization.js.map +1 -0
  61. package/dist/reasoning/number-theory/gcd.d.ts +8 -0
  62. package/dist/reasoning/number-theory/gcd.d.ts.map +1 -0
  63. package/dist/reasoning/number-theory/gcd.js +51 -0
  64. package/dist/reasoning/number-theory/gcd.js.map +1 -0
  65. package/dist/reasoning/number-theory/index.d.ts +9 -0
  66. package/dist/reasoning/number-theory/index.d.ts.map +1 -0
  67. package/dist/reasoning/number-theory/index.js +46 -0
  68. package/dist/reasoning/number-theory/index.js.map +1 -0
  69. package/dist/reasoning/number-theory/modular.d.ts +6 -0
  70. package/dist/reasoning/number-theory/modular.d.ts.map +1 -0
  71. package/dist/reasoning/number-theory/modular.js +75 -0
  72. package/dist/reasoning/number-theory/modular.js.map +1 -0
  73. package/dist/reasoning/number-theory/primality.d.ts +6 -0
  74. package/dist/reasoning/number-theory/primality.d.ts.map +1 -0
  75. package/dist/reasoning/number-theory/primality.js +144 -0
  76. package/dist/reasoning/number-theory/primality.js.map +1 -0
  77. package/dist/reasoning/number-theory/symbols.d.ts +3 -0
  78. package/dist/reasoning/number-theory/symbols.d.ts.map +1 -0
  79. package/dist/reasoning/number-theory/symbols.js +57 -0
  80. package/dist/reasoning/number-theory/symbols.js.map +1 -0
  81. package/dist/reasoning/real-analysis/index.d.ts +127 -0
  82. package/dist/reasoning/real-analysis/index.d.ts.map +1 -0
  83. package/dist/reasoning/real-analysis/index.js +638 -0
  84. package/dist/reasoning/real-analysis/index.js.map +1 -0
  85. package/dist/reasoning/topology/index.d.ts +41 -0
  86. package/dist/reasoning/topology/index.d.ts.map +1 -0
  87. package/dist/reasoning/topology/index.js +739 -0
  88. package/dist/reasoning/topology/index.js.map +1 -0
  89. package/dist/tests/logic/profiles/natural-deduction-nk/nk.test.d.ts +2 -0
  90. package/dist/tests/logic/profiles/natural-deduction-nk/nk.test.d.ts.map +1 -0
  91. package/dist/tests/logic/profiles/natural-deduction-nk/nk.test.js +288 -0
  92. package/dist/tests/logic/profiles/natural-deduction-nk/nk.test.js.map +1 -0
  93. package/dist/tests/reasoning/automata/automata.test.d.ts +2 -0
  94. package/dist/tests/reasoning/automata/automata.test.d.ts.map +1 -0
  95. package/dist/tests/reasoning/automata/automata.test.js +310 -0
  96. package/dist/tests/reasoning/automata/automata.test.js.map +1 -0
  97. package/dist/tests/reasoning/computability/computability.test.d.ts +2 -0
  98. package/dist/tests/reasoning/computability/computability.test.d.ts.map +1 -0
  99. package/dist/tests/reasoning/computability/computability.test.js +246 -0
  100. package/dist/tests/reasoning/computability/computability.test.js.map +1 -0
  101. package/dist/tests/reasoning/number-theory/number-theory.test.d.ts +2 -0
  102. package/dist/tests/reasoning/number-theory/number-theory.test.d.ts.map +1 -0
  103. package/dist/tests/reasoning/number-theory/number-theory.test.js +170 -0
  104. package/dist/tests/reasoning/number-theory/number-theory.test.js.map +1 -0
  105. package/dist/tests/reasoning/real-analysis/real-analysis.test.d.ts +2 -0
  106. package/dist/tests/reasoning/real-analysis/real-analysis.test.d.ts.map +1 -0
  107. package/dist/tests/reasoning/real-analysis/real-analysis.test.js +197 -0
  108. package/dist/tests/reasoning/real-analysis/real-analysis.test.js.map +1 -0
  109. package/dist/tests/reasoning/topology/topology.test.d.ts +2 -0
  110. package/dist/tests/reasoning/topology/topology.test.d.ts.map +1 -0
  111. package/dist/tests/reasoning/topology/topology.test.js +327 -0
  112. package/dist/tests/reasoning/topology/topology.test.js.map +1 -0
  113. package/dist/tests/tooling/exporters/lean4/lean4-exporter.test.d.ts +2 -0
  114. package/dist/tests/tooling/exporters/lean4/lean4-exporter.test.d.ts.map +1 -0
  115. package/dist/tests/tooling/exporters/lean4/lean4-exporter.test.js +473 -0
  116. package/dist/tests/tooling/exporters/lean4/lean4-exporter.test.js.map +1 -0
  117. package/dist/tooling/exporters/lean4/index.d.ts +47 -0
  118. package/dist/tooling/exporters/lean4/index.d.ts.map +1 -0
  119. package/dist/tooling/exporters/lean4/index.js +423 -0
  120. package/dist/tooling/exporters/lean4/index.js.map +1 -0
  121. package/package.json +1 -1
@@ -0,0 +1,557 @@
1
+ "use strict";
2
+ // ============================================================
3
+ // Natural Deduction NK (classical) — Backward proof search
4
+ // ============================================================
5
+ //
6
+ // Estrategia: reutilizamos el motor intuicionista NJ y añadimos
7
+ // la regla clásica `rAA` (reductio ad absurdum) como recurso
8
+ // global. Con rAA disponible se obtiene completitud clásica:
9
+ // si Γ ⊨ φ entonces Γ ⊢_NK φ.
10
+ //
11
+ // Heurística de búsqueda:
12
+ // 1. Intentar las reglas estándar NJ.
13
+ // 2. Si la meta es atómica o disyuntiva (no descomponible por
14
+ // reglas de introducción) y no hubo prueba, intentar rAA:
15
+ // asume ¬φ y trata de derivar ⊥.
16
+ // 3. Si la meta es exactamente `¬¬φ → φ`, atajamos con
17
+ // doubleNegE como axioma derivado.
18
+ //
19
+ // El árbol generado es válido NK (verificable por verifyProof).
20
+ // Cuando la prueba evita rAA/LEM/Peirce/doubleNegE, se traduce
21
+ // automáticamente a NJ (ver `nkToNJ`).
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.proveClassically = proveClassically;
24
+ exports.proveIntuitOnly = proveIntuitOnly;
25
+ exports.verifyProof = verifyProof;
26
+ exports.provedPeirce = provedPeirce;
27
+ exports.provedDNE = provedDNE;
28
+ exports.provedLEM = provedLEM;
29
+ exports.nkToNJ = nkToNJ;
30
+ const types_1 = require("./types");
31
+ const formula_1 = require("./formula");
32
+ function freshCtx(budget, intuitOnly = false) {
33
+ return { budget, used: 0, failed: new Set(), active: new Set(), intuitOnly };
34
+ }
35
+ function exhausted(ctx) {
36
+ return ctx.used >= ctx.budget;
37
+ }
38
+ function goalKey(context, goal, classicalAllowed) {
39
+ const sorted = context.map(formula_1.formulaKey).sort();
40
+ return `${classicalAllowed ? 'C' : 'I'}[${sorted.join('|')}]⊢${(0, formula_1.formulaKey)(goal)}`;
41
+ }
42
+ function contextHas(context, f) {
43
+ for (const g of context)
44
+ if ((0, formula_1.formulaEquals)(g, f))
45
+ return true;
46
+ return false;
47
+ }
48
+ function withContext(context, f) {
49
+ if (contextHas(context, f))
50
+ return context;
51
+ return [...context, f];
52
+ }
53
+ /**
54
+ * Núcleo recursivo. Devuelve un árbol NK válido para `context ⊢ goal`
55
+ * o `null` si no se encontró prueba dentro del budget.
56
+ */
57
+ function search(context, goal, ctx) {
58
+ ctx.used++;
59
+ if (exhausted(ctx))
60
+ return null;
61
+ const key = goalKey(context, goal, !ctx.intuitOnly);
62
+ if (ctx.failed.has(key))
63
+ return null;
64
+ if (ctx.active.has(key))
65
+ return null;
66
+ ctx.active.add(key);
67
+ const tryProve = () => {
68
+ // 1. Axioma / asunción.
69
+ for (const h of context) {
70
+ if ((0, formula_1.formulaEquals)(h, goal)) {
71
+ return { conclusion: goal, rule: 'assumption', premises: [] };
72
+ }
73
+ }
74
+ // 2. Reglas de introducción dirigidas por la forma de la meta
75
+ // (invertibles para ∧, →, ¬).
76
+ if (goal.kind === 'and') {
77
+ const left = search(context, goal.left, ctx);
78
+ if (!left)
79
+ return null;
80
+ const right = search(context, goal.right, ctx);
81
+ if (!right)
82
+ return null;
83
+ return { conclusion: goal, rule: 'andI', premises: [left, right] };
84
+ }
85
+ if (goal.kind === 'implies') {
86
+ const newCtx = withContext(context, goal.left);
87
+ const body = search(newCtx, goal.right, ctx);
88
+ if (!body)
89
+ return null;
90
+ return {
91
+ conclusion: goal,
92
+ rule: 'impI',
93
+ premises: [body],
94
+ discharged: [goal.left],
95
+ };
96
+ }
97
+ if (goal.kind === 'not') {
98
+ const newCtx = withContext(context, goal.arg);
99
+ const body = search(newCtx, (0, formula_1.bottom)(), ctx);
100
+ if (!body)
101
+ return null;
102
+ return {
103
+ conclusion: goal,
104
+ rule: 'notI',
105
+ premises: [body],
106
+ discharged: [goal.arg],
107
+ };
108
+ }
109
+ // 3. Reglas de eliminación a izquierda (sobre el contexto).
110
+ // ∧EL/∧ER: descomponer cualquier conjunción del contexto.
111
+ for (let i = 0; i < context.length; i++) {
112
+ const h = context[i];
113
+ if (h && h.kind === 'and') {
114
+ const rest = [...context.slice(0, i), ...context.slice(i + 1)];
115
+ const extended = withContext(withContext(rest, h.left), h.right);
116
+ const sub = search(extended, goal, ctx);
117
+ if (!sub)
118
+ return null;
119
+ const elimL = {
120
+ conclusion: h.left,
121
+ rule: 'andEL',
122
+ premises: [{ conclusion: h, rule: 'assumption', premises: [] }],
123
+ };
124
+ const elimR = {
125
+ conclusion: h.right,
126
+ rule: 'andER',
127
+ premises: [{ conclusion: h, rule: 'assumption', premises: [] }],
128
+ };
129
+ const withL = substituteAssumption(sub, h.left, elimL);
130
+ return substituteAssumption(withL, h.right, elimR);
131
+ }
132
+ }
133
+ // ⊥E: si ⊥ está en el contexto, podemos derivar cualquier meta.
134
+ for (const h of context) {
135
+ if (h.kind === 'bottom') {
136
+ return {
137
+ conclusion: goal,
138
+ rule: 'bottomE',
139
+ premises: [{ conclusion: h, rule: 'assumption', premises: [] }],
140
+ };
141
+ }
142
+ }
143
+ // ∨E (no invertible): si una disyunción A∨B está en el contexto
144
+ // y podemos probar la meta tanto bajo A como bajo B.
145
+ for (let i = 0; i < context.length; i++) {
146
+ const h = context[i];
147
+ if (h && h.kind === 'or') {
148
+ const rest = [...context.slice(0, i), ...context.slice(i + 1)];
149
+ const leftCtx = withContext(rest, h.left);
150
+ const rightCtx = withContext(rest, h.right);
151
+ const leftSub = search(leftCtx, goal, ctx);
152
+ if (!leftSub)
153
+ continue;
154
+ const rightSub = search(rightCtx, goal, ctx);
155
+ if (!rightSub)
156
+ continue;
157
+ return {
158
+ conclusion: goal,
159
+ rule: 'orE',
160
+ premises: [{ conclusion: h, rule: 'assumption', premises: [] }, leftSub, rightSub],
161
+ discharged: [h.left, h.right],
162
+ };
163
+ }
164
+ }
165
+ // 4. Reglas no-invertibles sobre la meta (∨I).
166
+ if (goal.kind === 'or') {
167
+ const leftAttempt = search(context, goal.left, ctx);
168
+ if (leftAttempt) {
169
+ return { conclusion: goal, rule: 'orIL', premises: [leftAttempt] };
170
+ }
171
+ const rightAttempt = search(context, goal.right, ctx);
172
+ if (rightAttempt) {
173
+ return { conclusion: goal, rule: 'orIR', premises: [rightAttempt] };
174
+ }
175
+ // continúa a las reglas posteriores (incluyendo rAA si está
176
+ // habilitada) — la disyunción puede no ser intuitivamente
177
+ // demostrable (p.ej. P ∨ ¬P).
178
+ }
179
+ // →E (modus ponens hacia atrás).
180
+ for (let i = 0; i < context.length; i++) {
181
+ const h = context[i];
182
+ if (h && h.kind === 'implies') {
183
+ const aProof = search(context, h.left, ctx);
184
+ if (!aProof)
185
+ continue;
186
+ if ((0, formula_1.formulaEquals)(h.right, goal)) {
187
+ return {
188
+ conclusion: goal,
189
+ rule: 'impE',
190
+ premises: [{ conclusion: h, rule: 'assumption', premises: [] }, aProof],
191
+ };
192
+ }
193
+ const rest = [...context.slice(0, i), ...context.slice(i + 1)];
194
+ const extended = withContext(rest, h.right);
195
+ const sub = search(extended, goal, ctx);
196
+ if (!sub)
197
+ continue;
198
+ const elimB = {
199
+ conclusion: h.right,
200
+ rule: 'impE',
201
+ premises: [{ conclusion: h, rule: 'assumption', premises: [] }, aProof],
202
+ };
203
+ return substituteAssumption(sub, h.right, elimB);
204
+ }
205
+ }
206
+ // ¬E: si tenemos ¬A en contexto y la meta es ⊥, intentar probar A.
207
+ if (goal.kind === 'bottom') {
208
+ for (const h of context) {
209
+ if (h.kind === 'not') {
210
+ const aProof = search(context, h.arg, ctx);
211
+ if (aProof) {
212
+ return {
213
+ conclusion: (0, formula_1.bottom)(),
214
+ rule: 'notE',
215
+ premises: [{ conclusion: h, rule: 'assumption', premises: [] }, aProof],
216
+ };
217
+ }
218
+ }
219
+ if (h.kind === 'implies' && h.right.kind === 'bottom') {
220
+ const aProof = search(context, h.left, ctx);
221
+ if (aProof) {
222
+ return {
223
+ conclusion: (0, formula_1.bottom)(),
224
+ rule: 'impE',
225
+ premises: [{ conclusion: h, rule: 'assumption', premises: [] }, aProof],
226
+ };
227
+ }
228
+ }
229
+ }
230
+ }
231
+ // 5. Si la meta no es ⊥, derivar ⊥ del contexto y aplicar ⊥E.
232
+ if (goal.kind !== 'bottom') {
233
+ const bottomProof = search(context, (0, formula_1.bottom)(), ctx);
234
+ if (bottomProof) {
235
+ return { conclusion: goal, rule: 'bottomE', premises: [bottomProof] };
236
+ }
237
+ }
238
+ // 6. CLÁSICA: reductio ad absurdum (rAA). Asume ¬goal, deriva ⊥.
239
+ // Sólo si no estamos en modo intuit-only y no es la meta `⊥`
240
+ // (donde rAA sería circular: asumir ⊤ y derivar ⊥).
241
+ if (!ctx.intuitOnly && goal.kind !== 'bottom') {
242
+ const negGoal = (0, formula_1.not)(goal);
243
+ // Evitar loop infinito: si ya estamos buscando bajo ¬goal,
244
+ // no aplicamos rAA otra vez.
245
+ if (!contextHas(context, negGoal)) {
246
+ const newCtx = withContext(context, negGoal);
247
+ const sub = search(newCtx, (0, formula_1.bottom)(), ctx);
248
+ if (sub) {
249
+ return {
250
+ conclusion: goal,
251
+ rule: 'rAA',
252
+ premises: [sub],
253
+ discharged: [negGoal],
254
+ };
255
+ }
256
+ }
257
+ }
258
+ return null;
259
+ };
260
+ const result = tryProve();
261
+ ctx.active.delete(key);
262
+ if (!result)
263
+ ctx.failed.add(key);
264
+ return result;
265
+ }
266
+ /**
267
+ * Reescribe un subárbol que asume `assumption` como hipótesis libre,
268
+ * sustituyendo cada `assumption`-node por la derivación `derivation`.
269
+ */
270
+ function substituteAssumption(proof, assumption, derivation) {
271
+ if (proof.rule === 'assumption' && (0, formula_1.formulaEquals)(proof.conclusion, assumption)) {
272
+ return derivation;
273
+ }
274
+ const dischargedHere = proof.discharged?.some((d) => (0, formula_1.formulaEquals)(d, assumption));
275
+ if (dischargedHere)
276
+ return proof;
277
+ const newPremises = proof.premises.map((p) => substituteAssumption(p, assumption, derivation));
278
+ return { ...proof, premises: newPremises };
279
+ }
280
+ /**
281
+ * API pública: prueba clásica.
282
+ *
283
+ * Devuelve un árbol NK que demuestra `goal` a partir de las
284
+ * `premises` dadas, o `null` si no encontró prueba.
285
+ */
286
+ function proveClassically(premises, goal, options = {}) {
287
+ const ctx = freshCtx(options.budget ?? 20_000, false);
288
+ return search(premises.slice(), goal, ctx);
289
+ }
290
+ /**
291
+ * Variante restringida: intenta probar usando sólo reglas
292
+ * intuicionistas (NJ). Útil internamente para `nkToNJ`.
293
+ */
294
+ function proveIntuitOnly(premises, goal, options = {}) {
295
+ const ctx = freshCtx(options.budget ?? 20_000, true);
296
+ return search(premises.slice(), goal, ctx);
297
+ }
298
+ // ── Verificación de proofs ──────────────────────────────────
299
+ /**
300
+ * Verifica recursivamente el árbol NK. Comprueba cada regla
301
+ * localmente contra su conclusión y contexto.
302
+ */
303
+ function verifyProof(proof, initialContext = []) {
304
+ return verifyAt(proof, initialContext);
305
+ }
306
+ function verifyAt(proof, ctx) {
307
+ const c = proof.conclusion;
308
+ switch (proof.rule) {
309
+ case 'assumption':
310
+ return ctx.some((h) => (0, formula_1.formulaEquals)(h, c));
311
+ case 'andI': {
312
+ if (c.kind !== 'and' || proof.premises.length !== 2)
313
+ return false;
314
+ const [pa, pb] = proof.premises;
315
+ if (!pa || !pb)
316
+ return false;
317
+ return ((0, formula_1.formulaEquals)(pa.conclusion, c.left) &&
318
+ (0, formula_1.formulaEquals)(pb.conclusion, c.right) &&
319
+ verifyAt(pa, ctx) &&
320
+ verifyAt(pb, ctx));
321
+ }
322
+ case 'andEL': {
323
+ if (proof.premises.length !== 1)
324
+ return false;
325
+ const p = proof.premises[0];
326
+ if (!p || p.conclusion.kind !== 'and')
327
+ return false;
328
+ return (0, formula_1.formulaEquals)(p.conclusion.left, c) && verifyAt(p, ctx);
329
+ }
330
+ case 'andER': {
331
+ if (proof.premises.length !== 1)
332
+ return false;
333
+ const p = proof.premises[0];
334
+ if (!p || p.conclusion.kind !== 'and')
335
+ return false;
336
+ return (0, formula_1.formulaEquals)(p.conclusion.right, c) && verifyAt(p, ctx);
337
+ }
338
+ case 'orIL': {
339
+ if (c.kind !== 'or' || proof.premises.length !== 1)
340
+ return false;
341
+ const p = proof.premises[0];
342
+ if (!p)
343
+ return false;
344
+ return (0, formula_1.formulaEquals)(p.conclusion, c.left) && verifyAt(p, ctx);
345
+ }
346
+ case 'orIR': {
347
+ if (c.kind !== 'or' || proof.premises.length !== 1)
348
+ return false;
349
+ const p = proof.premises[0];
350
+ if (!p)
351
+ return false;
352
+ return (0, formula_1.formulaEquals)(p.conclusion, c.right) && verifyAt(p, ctx);
353
+ }
354
+ case 'orE': {
355
+ if (proof.premises.length !== 3)
356
+ return false;
357
+ const [maj, l, r] = proof.premises;
358
+ if (!maj || !l || !r)
359
+ return false;
360
+ if (maj.conclusion.kind !== 'or')
361
+ return false;
362
+ const A = maj.conclusion.left;
363
+ const B = maj.conclusion.right;
364
+ if (!(0, formula_1.formulaEquals)(l.conclusion, c))
365
+ return false;
366
+ if (!(0, formula_1.formulaEquals)(r.conclusion, c))
367
+ return false;
368
+ return (verifyAt(maj, ctx) && verifyAt(l, withContext(ctx, A)) && verifyAt(r, withContext(ctx, B)));
369
+ }
370
+ case 'impI': {
371
+ if (c.kind !== 'implies' || proof.premises.length !== 1)
372
+ return false;
373
+ const p = proof.premises[0];
374
+ if (!p)
375
+ return false;
376
+ return (0, formula_1.formulaEquals)(p.conclusion, c.right) && verifyAt(p, withContext(ctx, c.left));
377
+ }
378
+ case 'impE': {
379
+ if (proof.premises.length !== 2)
380
+ return false;
381
+ const [maj, min] = proof.premises;
382
+ if (!maj || !min)
383
+ return false;
384
+ if (maj.conclusion.kind !== 'implies')
385
+ return false;
386
+ return ((0, formula_1.formulaEquals)(maj.conclusion.left, min.conclusion) &&
387
+ (0, formula_1.formulaEquals)(maj.conclusion.right, c) &&
388
+ verifyAt(maj, ctx) &&
389
+ verifyAt(min, ctx));
390
+ }
391
+ case 'notI': {
392
+ if (c.kind !== 'not' || proof.premises.length !== 1)
393
+ return false;
394
+ const p = proof.premises[0];
395
+ if (!p)
396
+ return false;
397
+ return p.conclusion.kind === 'bottom' && verifyAt(p, withContext(ctx, c.arg));
398
+ }
399
+ case 'notE': {
400
+ if (c.kind !== 'bottom' || proof.premises.length !== 2)
401
+ return false;
402
+ const [neg, pos] = proof.premises;
403
+ if (!neg || !pos)
404
+ return false;
405
+ if (neg.conclusion.kind !== 'not')
406
+ return false;
407
+ return ((0, formula_1.formulaEquals)(neg.conclusion.arg, pos.conclusion) &&
408
+ verifyAt(neg, ctx) &&
409
+ verifyAt(pos, ctx));
410
+ }
411
+ case 'bottomE': {
412
+ if (proof.premises.length !== 1)
413
+ return false;
414
+ const p = proof.premises[0];
415
+ if (!p)
416
+ return false;
417
+ return p.conclusion.kind === 'bottom' && verifyAt(p, ctx);
418
+ }
419
+ // ── Reglas clásicas ────────────────────────────────────
420
+ case 'doubleNegE': {
421
+ // Premisa: ¬¬φ, conclusión: φ.
422
+ if (proof.premises.length !== 1)
423
+ return false;
424
+ const p = proof.premises[0];
425
+ if (!p)
426
+ return false;
427
+ if (p.conclusion.kind !== 'not')
428
+ return false;
429
+ const inner = p.conclusion.arg;
430
+ if (inner.kind !== 'not')
431
+ return false;
432
+ return (0, formula_1.formulaEquals)(inner.arg, c) && verifyAt(p, ctx);
433
+ }
434
+ case 'LEM': {
435
+ // Conclusión axiomática: φ ∨ ¬φ. No requiere premisas.
436
+ if (c.kind !== 'or' || proof.premises.length !== 0)
437
+ return false;
438
+ if (c.right.kind !== 'not')
439
+ return false;
440
+ return (0, formula_1.formulaEquals)(c.left, c.right.arg);
441
+ }
442
+ case 'pierce': {
443
+ // Conclusión axiomática: ((φ→ψ)→φ)→φ. Sin premisas.
444
+ if (c.kind !== 'implies' || proof.premises.length !== 0)
445
+ return false;
446
+ const inner = c.left; // (φ→ψ)→φ
447
+ if (inner.kind !== 'implies')
448
+ return false;
449
+ const phiPsi = inner.left; // φ→ψ
450
+ if (phiPsi.kind !== 'implies')
451
+ return false;
452
+ // inner.right debe ser φ, c.right debe ser φ, phiPsi.left debe ser φ.
453
+ return (0, formula_1.formulaEquals)(phiPsi.left, inner.right) && (0, formula_1.formulaEquals)(inner.right, c.right);
454
+ }
455
+ case 'rAA': {
456
+ // Reductio ad absurdum: asume ¬φ, deriva ⊥, concluye φ.
457
+ // discharged debe ser [¬c]; premisa única deriva ⊥ bajo ¬c.
458
+ if (proof.premises.length !== 1)
459
+ return false;
460
+ const p = proof.premises[0];
461
+ if (!p)
462
+ return false;
463
+ if (p.conclusion.kind !== 'bottom')
464
+ return false;
465
+ if (!proof.discharged || proof.discharged.length !== 1)
466
+ return false;
467
+ const disch = proof.discharged[0];
468
+ if (!disch || disch.kind !== 'not')
469
+ return false;
470
+ if (!(0, formula_1.formulaEquals)(disch.arg, c))
471
+ return false;
472
+ return verifyAt(p, withContext(ctx, disch));
473
+ }
474
+ }
475
+ }
476
+ // ── Pruebas estándar de teoremas clásicos ────────────────────
477
+ /**
478
+ * Devuelve una prueba NK de la ley de Peirce: ((P→Q)→P)→P.
479
+ */
480
+ function provedPeirce() {
481
+ const P = (0, formula_1.atom)('P');
482
+ const Q = (0, formula_1.atom)('Q');
483
+ const proof = proveClassically([], (0, formula_1.implies)((0, formula_1.implies)((0, formula_1.implies)(P, Q), P), P));
484
+ if (!proof) {
485
+ // Fallback: regla axiomática directa.
486
+ return {
487
+ conclusion: (0, formula_1.implies)((0, formula_1.implies)((0, formula_1.implies)(P, Q), P), P),
488
+ rule: 'pierce',
489
+ premises: [],
490
+ };
491
+ }
492
+ return proof;
493
+ }
494
+ /**
495
+ * Devuelve una prueba NK de la eliminación de doble negación: ¬¬P → P.
496
+ */
497
+ function provedDNE() {
498
+ const P = (0, formula_1.atom)('P');
499
+ const proof = proveClassically([], (0, formula_1.implies)((0, formula_1.not)((0, formula_1.not)(P)), P));
500
+ if (proof)
501
+ return proof;
502
+ // Fallback: construir manualmente usando doubleNegE.
503
+ const dneAxiom = {
504
+ conclusion: P,
505
+ rule: 'doubleNegE',
506
+ premises: [{ conclusion: (0, formula_1.not)((0, formula_1.not)(P)), rule: 'assumption', premises: [] }],
507
+ };
508
+ return {
509
+ conclusion: (0, formula_1.implies)((0, formula_1.not)((0, formula_1.not)(P)), P),
510
+ rule: 'impI',
511
+ premises: [dneAxiom],
512
+ discharged: [(0, formula_1.not)((0, formula_1.not)(P))],
513
+ };
514
+ }
515
+ /**
516
+ * Devuelve una prueba NK del tercero excluido: P ∨ ¬P.
517
+ */
518
+ function provedLEM() {
519
+ const P = (0, formula_1.atom)('P');
520
+ const proof = proveClassically([], (0, formula_1.or)(P, (0, formula_1.not)(P)));
521
+ if (proof)
522
+ return proof;
523
+ // Fallback axiomático.
524
+ return {
525
+ conclusion: (0, formula_1.or)(P, (0, formula_1.not)(P)),
526
+ rule: 'LEM',
527
+ premises: [],
528
+ };
529
+ }
530
+ // ── Traducción NK → NJ ────────────────────────────────────────
531
+ /**
532
+ * Indica si una prueba NK puede traducirse a NJ sin pérdida.
533
+ * Si contiene alguna regla puramente clásica, la traducción
534
+ * falla con `reason`. Si es puramente intuicionista, se
535
+ * devuelve la prueba intacta (cast estructural a NJProof).
536
+ *
537
+ * No intentamos la traducción de Glivenko ni doble-negación
538
+ * uniforme aquí: el objetivo es detectar si la prueba ya está
539
+ * en el fragmento intuicionista.
540
+ */
541
+ function nkToNJ(proof) {
542
+ const classicalRules = collectClassicalRules(proof);
543
+ if (classicalRules.length === 0) {
544
+ return { converted: proof };
545
+ }
546
+ return {
547
+ reason: `La prueba usa reglas clásicas no traducibles directamente a NJ: ${classicalRules.join(', ')}.`,
548
+ };
549
+ }
550
+ function collectClassicalRules(proof, out = new Set()) {
551
+ if (types_1.CLASSICAL_ONLY_RULES.includes(proof.rule))
552
+ out.add(proof.rule);
553
+ for (const p of proof.premises)
554
+ collectClassicalRules(p, out);
555
+ return Array.from(out);
556
+ }
557
+ //# sourceMappingURL=prover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prover.js","sourceRoot":"","sources":["../../../../src/logic/profiles/natural-deduction-nk/prover.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,2DAA2D;AAC3D,+DAA+D;AAC/D,EAAE;AACF,gEAAgE;AAChE,6DAA6D;AAC7D,6DAA6D;AAC7D,8BAA8B;AAC9B,E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,EAAE,CAAC;IAC9B,CAAC;IACD,OAAO;QACL,MAAM,EAAE,mEAAmE,cAAc,CAAC,IAAI,CAC5F,IAAI,CACL,GAAG;KACL,CAAC;AACJ,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAc,EAAE,MAAmB,IAAI,GAAG,EAAE;IACzE,IAAI,4BAAoB,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC;QAAE,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACnE,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,QAAQ;QAAE,qBAAqB,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC9D,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Fórmula proposicional clásica. Misma forma sintáctica que NJ;
3
+ * la diferencia entre ambas lógicas vive en el sistema de reglas.
4
+ */
5
+ export type NKFormula = {
6
+ kind: 'atom';
7
+ name: string;
8
+ } | {
9
+ kind: 'and';
10
+ left: NKFormula;
11
+ right: NKFormula;
12
+ } | {
13
+ kind: 'or';
14
+ left: NKFormula;
15
+ right: NKFormula;
16
+ } | {
17
+ kind: 'implies';
18
+ left: NKFormula;
19
+ right: NKFormula;
20
+ } | {
21
+ kind: 'not';
22
+ arg: NKFormula;
23
+ } | {
24
+ kind: 'bottom';
25
+ };
26
+ /**
27
+ * Reglas de prueba NK. Las primeras son las de NJ; las últimas
28
+ * cuatro son los "extras" clásicos.
29
+ */
30
+ export type NKRule = 'assumption' | 'andI' | 'andEL' | 'andER' | 'orIL' | 'orIR' | 'orE' | 'impI' | 'impE' | 'notI' | 'notE' | 'bottomE' | 'doubleNegE' | 'LEM' | 'pierce' | 'rAA';
31
+ /**
32
+ * Árbol de prueba NK. Las hipótesis abiertas viven implícitamente
33
+ * en el contexto del subárbol; `discharged` lista las hipótesis
34
+ * cerradas por la regla aplicada en este nodo (relevante para →I,
35
+ * ¬I, ∨E y rAA).
36
+ */
37
+ export interface NKProof {
38
+ conclusion: NKFormula;
39
+ rule: NKRule;
40
+ premises: NKProof[];
41
+ discharged?: NKFormula[];
42
+ }
43
+ /**
44
+ * Conjunto de reglas que sólo existen en NK (no en NJ).
45
+ * Útil para detectar si una prueba NK es trasladable a NJ.
46
+ */
47
+ export declare const CLASSICAL_ONLY_RULES: ReadonlyArray<NKRule>;
48
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/logic/profiles/natural-deduction-nk/types.ts"],"names":[],"mappings":"AA2BA;;;GAGG;AACH,MAAM,MAAM,SAAS,GACjB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GAClD;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GACjD;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GACtD;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,SAAS,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEvB;;;GAGG;AACH,MAAM,MAAM,MAAM,GACd,YAAY,GACZ,MAAM,GACN,OAAO,GACP,OAAO,GACP,MAAM,GACN,MAAM,GACN,KAAK,GACL,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,SAAS,GACT,YAAY,GACZ,KAAK,GACL,QAAQ,GACR,KAAK,CAAC;AAEV;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IACtB,UAAU,EAAE,SAAS,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;CAC1B;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,MAAM,CAA0C,CAAC"}