@stevenvo780/st-lang 4.14.0 → 4.15.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 (602) hide show
  1. package/README.md +6 -6
  2. package/dist/ast/nodes.d.ts +50 -0
  3. package/dist/ast/nodes.d.ts.map +1 -1
  4. package/dist/format/stnb/__tests__/executor.test.d.ts +2 -0
  5. package/dist/format/stnb/__tests__/executor.test.d.ts.map +1 -0
  6. package/dist/format/stnb/__tests__/executor.test.js +140 -0
  7. package/dist/format/stnb/__tests__/executor.test.js.map +1 -0
  8. package/dist/format/stnb/__tests__/parser.test.d.ts +2 -0
  9. package/dist/format/stnb/__tests__/parser.test.d.ts.map +1 -0
  10. package/dist/format/stnb/__tests__/parser.test.js +119 -0
  11. package/dist/format/stnb/__tests__/parser.test.js.map +1 -0
  12. package/dist/format/stnb/__tests__/renderer.test.d.ts +2 -0
  13. package/dist/format/stnb/__tests__/renderer.test.d.ts.map +1 -0
  14. package/dist/format/stnb/__tests__/renderer.test.js +109 -0
  15. package/dist/format/stnb/__tests__/renderer.test.js.map +1 -0
  16. package/dist/format/stnb/__tests__/roundtrip.test.d.ts +2 -0
  17. package/dist/format/stnb/__tests__/roundtrip.test.d.ts.map +1 -0
  18. package/dist/format/stnb/__tests__/roundtrip.test.js +91 -0
  19. package/dist/format/stnb/__tests__/roundtrip.test.js.map +1 -0
  20. package/dist/format/stnb/__tests__/serializer.test.d.ts +2 -0
  21. package/dist/format/stnb/__tests__/serializer.test.d.ts.map +1 -0
  22. package/dist/format/stnb/__tests__/serializer.test.js +60 -0
  23. package/dist/format/stnb/__tests__/serializer.test.js.map +1 -0
  24. package/dist/format/stnb/executor.d.ts +29 -0
  25. package/dist/format/stnb/executor.d.ts.map +1 -0
  26. package/dist/format/stnb/executor.js +139 -0
  27. package/dist/format/stnb/executor.js.map +1 -0
  28. package/dist/format/stnb/index.d.ts +19 -0
  29. package/dist/format/stnb/index.d.ts.map +1 -0
  30. package/dist/format/stnb/index.js +28 -0
  31. package/dist/format/stnb/index.js.map +1 -0
  32. package/dist/format/stnb/parser.d.ts +14 -0
  33. package/dist/format/stnb/parser.d.ts.map +1 -0
  34. package/dist/format/stnb/parser.js +123 -0
  35. package/dist/format/stnb/parser.js.map +1 -0
  36. package/dist/format/stnb/renderer-html.d.ts +11 -0
  37. package/dist/format/stnb/renderer-html.d.ts.map +1 -0
  38. package/dist/format/stnb/renderer-html.js +180 -0
  39. package/dist/format/stnb/renderer-html.js.map +1 -0
  40. package/dist/format/stnb/renderer-markdown.d.ts +13 -0
  41. package/dist/format/stnb/renderer-markdown.d.ts.map +1 -0
  42. package/dist/format/stnb/renderer-markdown.js +92 -0
  43. package/dist/format/stnb/renderer-markdown.js.map +1 -0
  44. package/dist/format/stnb/serializer.d.ts +14 -0
  45. package/dist/format/stnb/serializer.d.ts.map +1 -0
  46. package/dist/format/stnb/serializer.js +21 -0
  47. package/dist/format/stnb/serializer.js.map +1 -0
  48. package/dist/format/stnb/types.d.ts +45 -0
  49. package/dist/format/stnb/types.d.ts.map +1 -0
  50. package/dist/format/stnb/types.js +7 -0
  51. package/dist/format/stnb/types.js.map +1 -0
  52. package/dist/index.d.ts +5 -0
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +7 -1
  55. package/dist/index.js.map +1 -1
  56. package/dist/logic/profile-bridge/index.d.ts.map +1 -1
  57. package/dist/logic/profile-bridge/index.js +20 -3
  58. package/dist/logic/profile-bridge/index.js.map +1 -1
  59. package/dist/logic/profiles/classical/propositional.d.ts.map +1 -1
  60. package/dist/logic/profiles/classical/propositional.js.map +1 -1
  61. package/dist/logic/profiles/ctl/check.d.ts.map +1 -1
  62. package/dist/logic/profiles/ctl/check.js +21 -11
  63. package/dist/logic/profiles/ctl/check.js.map +1 -1
  64. package/dist/logic/profiles/ctl/witness.d.ts.map +1 -1
  65. package/dist/logic/profiles/ctl/witness.js +2 -0
  66. package/dist/logic/profiles/ctl/witness.js.map +1 -1
  67. package/dist/logic/profiles/description-logic/types.d.ts +15 -0
  68. package/dist/logic/profiles/description-logic/types.d.ts.map +1 -1
  69. package/dist/logic/profiles/description-logic/types.js +13 -0
  70. package/dist/logic/profiles/description-logic/types.js.map +1 -1
  71. package/dist/logic/profiles/dl-hybrid/__tests__/differential.test.d.ts +2 -0
  72. package/dist/logic/profiles/dl-hybrid/__tests__/differential.test.d.ts.map +1 -0
  73. package/dist/logic/profiles/dl-hybrid/__tests__/differential.test.js +141 -0
  74. package/dist/logic/profiles/dl-hybrid/__tests__/differential.test.js.map +1 -0
  75. package/dist/logic/profiles/dl-hybrid/__tests__/examples.test.d.ts +2 -0
  76. package/dist/logic/profiles/dl-hybrid/__tests__/examples.test.d.ts.map +1 -0
  77. package/dist/logic/profiles/dl-hybrid/__tests__/examples.test.js +55 -0
  78. package/dist/logic/profiles/dl-hybrid/__tests__/examples.test.js.map +1 -0
  79. package/dist/logic/profiles/dl-hybrid/__tests__/parser.test.d.ts +2 -0
  80. package/dist/logic/profiles/dl-hybrid/__tests__/parser.test.d.ts.map +1 -0
  81. package/dist/logic/profiles/dl-hybrid/__tests__/parser.test.js +149 -0
  82. package/dist/logic/profiles/dl-hybrid/__tests__/parser.test.js.map +1 -0
  83. package/dist/logic/profiles/dl-hybrid/__tests__/tableau.test.d.ts +2 -0
  84. package/dist/logic/profiles/dl-hybrid/__tests__/tableau.test.d.ts.map +1 -0
  85. package/dist/logic/profiles/dl-hybrid/__tests__/tableau.test.js +105 -0
  86. package/dist/logic/profiles/dl-hybrid/__tests__/tableau.test.js.map +1 -0
  87. package/dist/logic/profiles/dl-hybrid/ast.d.ts +160 -0
  88. package/dist/logic/profiles/dl-hybrid/ast.d.ts.map +1 -0
  89. package/dist/logic/profiles/dl-hybrid/ast.js +261 -0
  90. package/dist/logic/profiles/dl-hybrid/ast.js.map +1 -0
  91. package/dist/logic/profiles/dl-hybrid/differential.d.ts +61 -0
  92. package/dist/logic/profiles/dl-hybrid/differential.d.ts.map +1 -0
  93. package/dist/logic/profiles/dl-hybrid/differential.js +291 -0
  94. package/dist/logic/profiles/dl-hybrid/differential.js.map +1 -0
  95. package/dist/logic/profiles/dl-hybrid/index.d.ts +10 -0
  96. package/dist/logic/profiles/dl-hybrid/index.d.ts.map +1 -0
  97. package/dist/logic/profiles/dl-hybrid/index.js +90 -0
  98. package/dist/logic/profiles/dl-hybrid/index.js.map +1 -0
  99. package/dist/logic/profiles/dl-hybrid/parser.d.ts +8 -0
  100. package/dist/logic/profiles/dl-hybrid/parser.d.ts.map +1 -0
  101. package/dist/logic/profiles/dl-hybrid/parser.js +410 -0
  102. package/dist/logic/profiles/dl-hybrid/parser.js.map +1 -0
  103. package/dist/logic/profiles/dl-hybrid/profile.d.ts +23 -0
  104. package/dist/logic/profiles/dl-hybrid/profile.d.ts.map +1 -0
  105. package/dist/logic/profiles/dl-hybrid/profile.js +122 -0
  106. package/dist/logic/profiles/dl-hybrid/profile.js.map +1 -0
  107. package/dist/logic/profiles/dl-hybrid/semantics.d.ts +16 -0
  108. package/dist/logic/profiles/dl-hybrid/semantics.d.ts.map +1 -0
  109. package/dist/logic/profiles/dl-hybrid/semantics.js +181 -0
  110. package/dist/logic/profiles/dl-hybrid/semantics.js.map +1 -0
  111. package/dist/logic/profiles/dl-hybrid/tableau.d.ts +38 -0
  112. package/dist/logic/profiles/dl-hybrid/tableau.d.ts.map +1 -0
  113. package/dist/logic/profiles/dl-hybrid/tableau.js +289 -0
  114. package/dist/logic/profiles/dl-hybrid/tableau.js.map +1 -0
  115. package/dist/logic/profiles/hybrid-logic/types.d.ts +17 -0
  116. package/dist/logic/profiles/hybrid-logic/types.d.ts.map +1 -1
  117. package/dist/logic/profiles/hybrid-logic/types.js +17 -0
  118. package/dist/logic/profiles/hybrid-logic/types.js.map +1 -1
  119. package/dist/logic/profiles/intuitionistic-nj/kripke.d.ts.map +1 -1
  120. package/dist/logic/profiles/intuitionistic-nj/kripke.js +8 -5
  121. package/dist/logic/profiles/intuitionistic-nj/kripke.js.map +1 -1
  122. package/dist/logic/profiles/ltl-sat/tableau.d.ts +31 -0
  123. package/dist/logic/profiles/ltl-sat/tableau.d.ts.map +1 -1
  124. package/dist/logic/profiles/ltl-sat/tableau.js +18 -0
  125. package/dist/logic/profiles/ltl-sat/tableau.js.map +1 -1
  126. package/dist/logic/profiles/ltl-sat/types.d.ts +15 -0
  127. package/dist/logic/profiles/ltl-sat/types.d.ts.map +1 -1
  128. package/dist/logic/profiles/ltl-sat/types.js +2 -1
  129. package/dist/logic/profiles/ltl-sat/types.js.map +1 -1
  130. package/dist/logic/profiles/modal-frame-axioms/formula.d.ts +10 -0
  131. package/dist/logic/profiles/modal-frame-axioms/formula.d.ts.map +1 -1
  132. package/dist/logic/profiles/modal-frame-axioms/formula.js +10 -0
  133. package/dist/logic/profiles/modal-frame-axioms/formula.js.map +1 -1
  134. package/dist/logic/profiles/mu-calculus/check.d.ts.map +1 -1
  135. package/dist/logic/profiles/mu-calculus/check.js +7 -4
  136. package/dist/logic/profiles/mu-calculus/check.js.map +1 -1
  137. package/dist/logic/profiles/natural-deduction-nk/formula.d.ts +8 -0
  138. package/dist/logic/profiles/natural-deduction-nk/formula.d.ts.map +1 -1
  139. package/dist/logic/profiles/natural-deduction-nk/formula.js +8 -0
  140. package/dist/logic/profiles/natural-deduction-nk/formula.js.map +1 -1
  141. package/dist/logic/profiles/quantum/index.d.ts.map +1 -1
  142. package/dist/logic/profiles/quantum/index.js +11 -8
  143. package/dist/logic/profiles/quantum/index.js.map +1 -1
  144. package/dist/logic/profiles/sequent-lj/index.d.ts +90 -0
  145. package/dist/logic/profiles/sequent-lj/index.d.ts.map +1 -0
  146. package/dist/logic/profiles/sequent-lj/index.js +903 -0
  147. package/dist/logic/profiles/sequent-lj/index.js.map +1 -0
  148. package/dist/logic/profiles/shared/tableau-engine.d.ts.map +1 -1
  149. package/dist/logic/profiles/shared/tableau-engine.js +0 -17
  150. package/dist/logic/profiles/shared/tableau-engine.js.map +1 -1
  151. package/dist/namespaces/proof-systems.d.ts +1 -1
  152. package/dist/namespaces/proof-systems.d.ts.map +1 -1
  153. package/dist/namespaces/proof-systems.js.map +1 -1
  154. package/dist/namespaces/semantics.d.ts +1 -1
  155. package/dist/namespaces/semantics.d.ts.map +1 -1
  156. package/dist/namespaces/semantics.js.map +1 -1
  157. package/dist/proof-systems/distributed-exchange/index.d.ts +29 -0
  158. package/dist/proof-systems/distributed-exchange/index.d.ts.map +1 -1
  159. package/dist/proof-systems/distributed-exchange/index.js +18 -0
  160. package/dist/proof-systems/distributed-exchange/index.js.map +1 -1
  161. package/dist/proof-systems/fol-prover/types.d.ts +16 -0
  162. package/dist/proof-systems/fol-prover/types.d.ts.map +1 -1
  163. package/dist/proof-systems/fol-prover/types.js +7 -0
  164. package/dist/proof-systems/fol-prover/types.js.map +1 -1
  165. package/dist/proof-systems/fol-prover-advanced/index.d.ts +3 -3
  166. package/dist/proof-systems/fol-prover-advanced/index.d.ts.map +1 -1
  167. package/dist/proof-systems/fol-prover-advanced/index.js.map +1 -1
  168. package/dist/proof-systems/fol-prover-advanced/ordering.js +1 -1
  169. package/dist/proof-systems/fol-prover-advanced/prover.d.ts.map +1 -1
  170. package/dist/proof-systems/fol-prover-advanced/prover.js +19 -12
  171. package/dist/proof-systems/fol-prover-advanced/prover.js.map +1 -1
  172. package/dist/proof-systems/fol-prover-advanced/resolve.d.ts.map +1 -1
  173. package/dist/proof-systems/fol-prover-advanced/resolve.js +7 -7
  174. package/dist/proof-systems/fol-prover-advanced/resolve.js.map +1 -1
  175. package/dist/proof-systems/fol-prover-advanced/subsumption.d.ts.map +1 -1
  176. package/dist/proof-systems/fol-prover-advanced/subsumption.js.map +1 -1
  177. package/dist/proof-systems/fol-prover-advanced/types.d.ts +12 -0
  178. package/dist/proof-systems/fol-prover-advanced/types.d.ts.map +1 -1
  179. package/dist/proof-systems/fol-prover-advanced/unify.js +2 -2
  180. package/dist/proof-systems/fol-prover-equality/term-utils.d.ts +46 -0
  181. package/dist/proof-systems/fol-prover-equality/term-utils.d.ts.map +1 -1
  182. package/dist/proof-systems/fol-prover-equality/term-utils.js +46 -0
  183. package/dist/proof-systems/fol-prover-equality/term-utils.js.map +1 -1
  184. package/dist/proof-systems/proof-nets/correctness.d.ts.map +1 -1
  185. package/dist/proof-systems/proof-nets/correctness.js +24 -12
  186. package/dist/proof-systems/proof-nets/correctness.js.map +1 -1
  187. package/dist/proof-systems/proof-nets/types.d.ts +18 -0
  188. package/dist/proof-systems/proof-nets/types.d.ts.map +1 -1
  189. package/dist/proof-systems/proof-nets/types.js +6 -0
  190. package/dist/proof-systems/proof-nets/types.js.map +1 -1
  191. package/dist/proof-systems/tableau-framework/TableauProver.d.ts.map +1 -1
  192. package/dist/proof-systems/tableau-framework/TableauProver.js +5 -5
  193. package/dist/proof-systems/tableau-framework/TableauProver.js.map +1 -1
  194. package/dist/proof-systems/tableau-framework/propositional.d.ts.map +1 -1
  195. package/dist/proof-systems/tableau-framework/propositional.js +21 -21
  196. package/dist/proof-systems/tableau-framework/propositional.js.map +1 -1
  197. package/dist/reasoning/ban-logic/terms.d.ts +24 -0
  198. package/dist/reasoning/ban-logic/terms.d.ts.map +1 -1
  199. package/dist/reasoning/ban-logic/terms.js +24 -0
  200. package/dist/reasoning/ban-logic/terms.js.map +1 -1
  201. package/dist/reasoning/bayesian/factor.js +8 -8
  202. package/dist/reasoning/bayesian/factor.js.map +1 -1
  203. package/dist/reasoning/bayesian/inference.d.ts.map +1 -1
  204. package/dist/reasoning/bayesian/inference.js +11 -5
  205. package/dist/reasoning/bayesian/inference.js.map +1 -1
  206. package/dist/reasoning/combinatorics/generators.js.map +1 -1
  207. package/dist/reasoning/combinatorics/index.d.ts +3 -3
  208. package/dist/reasoning/combinatorics/index.d.ts.map +1 -1
  209. package/dist/reasoning/combinatorics/index.js.map +1 -1
  210. package/dist/reasoning/combinatorics/set-partitions.js.map +1 -1
  211. package/dist/reasoning/combinatorics/special-numbers.d.ts.map +1 -1
  212. package/dist/reasoning/combinatorics/special-numbers.js.map +1 -1
  213. package/dist/reasoning/constructive-analysis/cauchy.js +2 -2
  214. package/dist/reasoning/constructive-analysis/compact.js +1 -1
  215. package/dist/reasoning/constructive-analysis/continuity.d.ts.map +1 -1
  216. package/dist/reasoning/constructive-analysis/continuity.js +4 -4
  217. package/dist/reasoning/constructive-analysis/continuity.js.map +1 -1
  218. package/dist/reasoning/constructive-analysis/index.d.ts.map +1 -1
  219. package/dist/reasoning/constructive-analysis/index.js.map +1 -1
  220. package/dist/reasoning/constructive-analysis/ivt.d.ts.map +1 -1
  221. package/dist/reasoning/constructive-analysis/ivt.js +2 -2
  222. package/dist/reasoning/constructive-analysis/ivt.js.map +1 -1
  223. package/dist/reasoning/constructive-reals/index.d.ts.map +1 -1
  224. package/dist/reasoning/constructive-reals/index.js +4 -8
  225. package/dist/reasoning/constructive-reals/index.js.map +1 -1
  226. package/dist/reasoning/dl-hybrid/__tests__/invariant.test.d.ts +2 -0
  227. package/dist/reasoning/dl-hybrid/__tests__/invariant.test.d.ts.map +1 -0
  228. package/dist/reasoning/dl-hybrid/__tests__/invariant.test.js +74 -0
  229. package/dist/reasoning/dl-hybrid/__tests__/invariant.test.js.map +1 -0
  230. package/dist/reasoning/dl-hybrid/index.d.ts +3 -0
  231. package/dist/reasoning/dl-hybrid/index.d.ts.map +1 -0
  232. package/dist/reasoning/dl-hybrid/index.js +16 -0
  233. package/dist/reasoning/dl-hybrid/index.js.map +1 -0
  234. package/dist/reasoning/dl-hybrid/invariant-search.d.ts +39 -0
  235. package/dist/reasoning/dl-hybrid/invariant-search.d.ts.map +1 -0
  236. package/dist/reasoning/dl-hybrid/invariant-search.js +188 -0
  237. package/dist/reasoning/dl-hybrid/invariant-search.js.map +1 -0
  238. package/dist/reasoning/galois-fields/index.d.ts +64 -0
  239. package/dist/reasoning/galois-fields/index.d.ts.map +1 -1
  240. package/dist/reasoning/galois-fields/index.js +56 -6
  241. package/dist/reasoning/galois-fields/index.js.map +1 -1
  242. package/dist/reasoning/graph-theory/index.d.ts +31 -0
  243. package/dist/reasoning/graph-theory/index.d.ts.map +1 -1
  244. package/dist/reasoning/graph-theory/index.js +28 -10
  245. package/dist/reasoning/graph-theory/index.js.map +1 -1
  246. package/dist/reasoning/hoare-logic/index.d.ts +34 -0
  247. package/dist/reasoning/hoare-logic/index.d.ts.map +1 -1
  248. package/dist/reasoning/hoare-logic/index.js +26 -0
  249. package/dist/reasoning/hoare-logic/index.js.map +1 -1
  250. package/dist/reasoning/hyperreal/index.d.ts +30 -0
  251. package/dist/reasoning/hyperreal/index.d.ts.map +1 -1
  252. package/dist/reasoning/hyperreal/index.js +25 -0
  253. package/dist/reasoning/hyperreal/index.js.map +1 -1
  254. package/dist/reasoning/information-theory/index.d.ts +34 -0
  255. package/dist/reasoning/information-theory/index.d.ts.map +1 -1
  256. package/dist/reasoning/information-theory/index.js +27 -44
  257. package/dist/reasoning/information-theory/index.js.map +1 -1
  258. package/dist/reasoning/lemma-rag/__tests__/benchmarks.test.d.ts +2 -0
  259. package/dist/reasoning/lemma-rag/__tests__/benchmarks.test.d.ts.map +1 -0
  260. package/dist/reasoning/lemma-rag/__tests__/benchmarks.test.js +72 -0
  261. package/dist/reasoning/lemma-rag/__tests__/benchmarks.test.js.map +1 -0
  262. package/dist/reasoning/lemma-rag/__tests__/embedding.test.d.ts +2 -0
  263. package/dist/reasoning/lemma-rag/__tests__/embedding.test.d.ts.map +1 -0
  264. package/dist/reasoning/lemma-rag/__tests__/embedding.test.js +102 -0
  265. package/dist/reasoning/lemma-rag/__tests__/embedding.test.js.map +1 -0
  266. package/dist/reasoning/lemma-rag/__tests__/integration.test.d.ts +2 -0
  267. package/dist/reasoning/lemma-rag/__tests__/integration.test.d.ts.map +1 -0
  268. package/dist/reasoning/lemma-rag/__tests__/integration.test.js +40 -0
  269. package/dist/reasoning/lemma-rag/__tests__/integration.test.js.map +1 -0
  270. package/dist/reasoning/lemma-rag/__tests__/query.test.d.ts +2 -0
  271. package/dist/reasoning/lemma-rag/__tests__/query.test.d.ts.map +1 -0
  272. package/dist/reasoning/lemma-rag/__tests__/query.test.js +136 -0
  273. package/dist/reasoning/lemma-rag/__tests__/query.test.js.map +1 -0
  274. package/dist/reasoning/lemma-rag/__tests__/retrieval.test.d.ts +2 -0
  275. package/dist/reasoning/lemma-rag/__tests__/retrieval.test.d.ts.map +1 -0
  276. package/dist/reasoning/lemma-rag/__tests__/retrieval.test.js +147 -0
  277. package/dist/reasoning/lemma-rag/__tests__/retrieval.test.js.map +1 -0
  278. package/dist/reasoning/lemma-rag/benchmarks.d.ts +30 -0
  279. package/dist/reasoning/lemma-rag/benchmarks.d.ts.map +1 -0
  280. package/dist/reasoning/lemma-rag/benchmarks.js +177 -0
  281. package/dist/reasoning/lemma-rag/benchmarks.js.map +1 -0
  282. package/dist/reasoning/lemma-rag/embedding.d.ts +26 -0
  283. package/dist/reasoning/lemma-rag/embedding.d.ts.map +1 -0
  284. package/dist/reasoning/lemma-rag/embedding.js +243 -0
  285. package/dist/reasoning/lemma-rag/embedding.js.map +1 -0
  286. package/dist/reasoning/lemma-rag/index-store.d.ts +35 -0
  287. package/dist/reasoning/lemma-rag/index-store.d.ts.map +1 -0
  288. package/dist/reasoning/lemma-rag/index-store.js +105 -0
  289. package/dist/reasoning/lemma-rag/index-store.js.map +1 -0
  290. package/dist/reasoning/lemma-rag/index.d.ts +9 -0
  291. package/dist/reasoning/lemma-rag/index.d.ts.map +1 -0
  292. package/dist/reasoning/lemma-rag/index.js +34 -0
  293. package/dist/reasoning/lemma-rag/index.js.map +1 -0
  294. package/dist/reasoning/lemma-rag/query.d.ts +48 -0
  295. package/dist/reasoning/lemma-rag/query.d.ts.map +1 -0
  296. package/dist/reasoning/lemma-rag/query.js +92 -0
  297. package/dist/reasoning/lemma-rag/query.js.map +1 -0
  298. package/dist/reasoning/lemma-rag/retrieval.d.ts +33 -0
  299. package/dist/reasoning/lemma-rag/retrieval.d.ts.map +1 -0
  300. package/dist/reasoning/lemma-rag/retrieval.js +123 -0
  301. package/dist/reasoning/lemma-rag/retrieval.js.map +1 -0
  302. package/dist/reasoning/lemma-rag/types.d.ts +52 -0
  303. package/dist/reasoning/lemma-rag/types.d.ts.map +1 -0
  304. package/dist/reasoning/lemma-rag/types.js +13 -0
  305. package/dist/reasoning/lemma-rag/types.js.map +1 -0
  306. package/dist/reasoning/lemma-synthesis/index.d.ts +36 -0
  307. package/dist/reasoning/lemma-synthesis/index.d.ts.map +1 -1
  308. package/dist/reasoning/lemma-synthesis/index.js +12 -0
  309. package/dist/reasoning/lemma-synthesis/index.js.map +1 -1
  310. package/dist/reasoning/linear-algebra/index.d.ts +38 -0
  311. package/dist/reasoning/linear-algebra/index.d.ts.map +1 -1
  312. package/dist/reasoning/linear-algebra/index.js +34 -5
  313. package/dist/reasoning/linear-algebra/index.js.map +1 -1
  314. package/dist/reasoning/markov-logic/grounding.js +1 -1
  315. package/dist/reasoning/markov-logic/grounding.js.map +1 -1
  316. package/dist/reasoning/markov-logic/inference.js +1 -1
  317. package/dist/reasoning/markov-logic/inference.js.map +1 -1
  318. package/dist/reasoning/order-theory/index.d.ts +121 -0
  319. package/dist/reasoning/order-theory/index.d.ts.map +1 -0
  320. package/dist/reasoning/order-theory/index.js +562 -0
  321. package/dist/reasoning/order-theory/index.js.map +1 -0
  322. package/dist/reasoning/peano-arithmetic/index.d.ts +114 -0
  323. package/dist/reasoning/peano-arithmetic/index.d.ts.map +1 -0
  324. package/dist/reasoning/peano-arithmetic/index.js +650 -0
  325. package/dist/reasoning/peano-arithmetic/index.js.map +1 -0
  326. package/dist/reasoning/polynomial-ring/index.d.ts +80 -0
  327. package/dist/reasoning/polynomial-ring/index.d.ts.map +1 -1
  328. package/dist/reasoning/polynomial-ring/index.js +75 -0
  329. package/dist/reasoning/polynomial-ring/index.js.map +1 -1
  330. package/dist/reasoning/proof-mining/__tests__/extractor.test.d.ts +2 -0
  331. package/dist/reasoning/proof-mining/__tests__/extractor.test.d.ts.map +1 -0
  332. package/dist/reasoning/proof-mining/__tests__/extractor.test.js +263 -0
  333. package/dist/reasoning/proof-mining/__tests__/extractor.test.js.map +1 -0
  334. package/dist/reasoning/proof-mining/__tests__/generalizer.test.d.ts +2 -0
  335. package/dist/reasoning/proof-mining/__tests__/generalizer.test.d.ts.map +1 -0
  336. package/dist/reasoning/proof-mining/__tests__/generalizer.test.js +123 -0
  337. package/dist/reasoning/proof-mining/__tests__/generalizer.test.js.map +1 -0
  338. package/dist/reasoning/proof-mining/__tests__/integration.test.d.ts +2 -0
  339. package/dist/reasoning/proof-mining/__tests__/integration.test.d.ts.map +1 -0
  340. package/dist/reasoning/proof-mining/__tests__/integration.test.js +128 -0
  341. package/dist/reasoning/proof-mining/__tests__/integration.test.js.map +1 -0
  342. package/dist/reasoning/proof-mining/__tests__/persistence.test.d.ts +2 -0
  343. package/dist/reasoning/proof-mining/__tests__/persistence.test.d.ts.map +1 -0
  344. package/dist/reasoning/proof-mining/__tests__/persistence.test.js +119 -0
  345. package/dist/reasoning/proof-mining/__tests__/persistence.test.js.map +1 -0
  346. package/dist/reasoning/proof-mining/__tests__/ranker.test.d.ts +2 -0
  347. package/dist/reasoning/proof-mining/__tests__/ranker.test.d.ts.map +1 -0
  348. package/dist/reasoning/proof-mining/__tests__/ranker.test.js +93 -0
  349. package/dist/reasoning/proof-mining/__tests__/ranker.test.js.map +1 -0
  350. package/dist/reasoning/proof-mining/extractor.d.ts +73 -0
  351. package/dist/reasoning/proof-mining/extractor.d.ts.map +1 -0
  352. package/dist/reasoning/proof-mining/extractor.js +170 -0
  353. package/dist/reasoning/proof-mining/extractor.js.map +1 -0
  354. package/dist/reasoning/proof-mining/generalizer.d.ts +46 -0
  355. package/dist/reasoning/proof-mining/generalizer.d.ts.map +1 -0
  356. package/dist/reasoning/proof-mining/generalizer.js +245 -0
  357. package/dist/reasoning/proof-mining/generalizer.js.map +1 -0
  358. package/dist/reasoning/proof-mining/index.d.ts +62 -0
  359. package/dist/reasoning/proof-mining/index.d.ts.map +1 -0
  360. package/dist/reasoning/proof-mining/index.js +235 -0
  361. package/dist/reasoning/proof-mining/index.js.map +1 -0
  362. package/dist/reasoning/proof-mining/persistence.d.ts +35 -0
  363. package/dist/reasoning/proof-mining/persistence.d.ts.map +1 -0
  364. package/dist/reasoning/proof-mining/persistence.js +126 -0
  365. package/dist/reasoning/proof-mining/persistence.js.map +1 -0
  366. package/dist/reasoning/proof-mining/ranker.d.ts +29 -0
  367. package/dist/reasoning/proof-mining/ranker.d.ts.map +1 -0
  368. package/dist/reasoning/proof-mining/ranker.js +71 -0
  369. package/dist/reasoning/proof-mining/ranker.js.map +1 -0
  370. package/dist/reasoning/proof-mining/statistics.d.ts +11 -0
  371. package/dist/reasoning/proof-mining/statistics.d.ts.map +1 -0
  372. package/dist/reasoning/proof-mining/statistics.js +44 -0
  373. package/dist/reasoning/proof-mining/statistics.js.map +1 -0
  374. package/dist/reasoning/proof-mining/types.d.ts +117 -0
  375. package/dist/reasoning/proof-mining/types.d.ts.map +1 -0
  376. package/dist/reasoning/proof-mining/types.js +24 -0
  377. package/dist/reasoning/proof-mining/types.js.map +1 -0
  378. package/dist/reasoning/separation-logic/index.d.ts +30 -0
  379. package/dist/reasoning/separation-logic/index.d.ts.map +1 -1
  380. package/dist/reasoning/separation-logic/index.js +21 -0
  381. package/dist/reasoning/separation-logic/index.js.map +1 -1
  382. package/dist/reasoning/set-theory/hf-functions.js +3 -3
  383. package/dist/reasoning/set-theory/hf-sets.js +1 -1
  384. package/dist/reasoning/set-theory/index.d.ts +3 -3
  385. package/dist/reasoning/set-theory/index.d.ts.map +1 -1
  386. package/dist/reasoning/set-theory/zfc-axioms.js +4 -4
  387. package/dist/reasoning/tactic-dsl/tactics.d.ts +87 -0
  388. package/dist/reasoning/tactic-dsl/tactics.d.ts.map +1 -1
  389. package/dist/reasoning/tactic-dsl/tactics.js +86 -36
  390. package/dist/reasoning/tactic-dsl/tactics.js.map +1 -1
  391. package/dist/reasoning/topology/index.d.ts +81 -0
  392. package/dist/reasoning/topology/index.d.ts.map +1 -1
  393. package/dist/reasoning/topology/index.js +69 -45
  394. package/dist/reasoning/topology/index.js.map +1 -1
  395. package/dist/runtime/countermodel-min/minimize.js +0 -0
  396. package/dist/runtime/countermodel-min/minimize.js.map +1 -1
  397. package/dist/runtime/csp-hoare/semantics.d.ts +12 -0
  398. package/dist/runtime/csp-hoare/semantics.d.ts.map +1 -1
  399. package/dist/runtime/csp-hoare/semantics.js +12 -0
  400. package/dist/runtime/csp-hoare/semantics.js.map +1 -1
  401. package/dist/runtime/symbolic-diff/constructors.d.ts +20 -0
  402. package/dist/runtime/symbolic-diff/constructors.d.ts.map +1 -1
  403. package/dist/runtime/symbolic-diff/constructors.js +20 -0
  404. package/dist/runtime/symbolic-diff/constructors.js.map +1 -1
  405. package/dist/runtime/term-rewriting/term-utils.d.ts.map +1 -1
  406. package/dist/runtime/term-rewriting/term-utils.js +33 -2
  407. package/dist/runtime/term-rewriting/term-utils.js.map +1 -1
  408. package/dist/runtime/typecheck/checker.js +2 -2
  409. package/dist/runtime/typecheck/checker.js.map +1 -1
  410. package/dist/runtime/typecheck/levenshtein.js +1 -1
  411. package/dist/runtime/typecheck/levenshtein.js.map +1 -1
  412. package/dist/semantics/categorical/fin-set.d.ts.map +1 -1
  413. package/dist/semantics/categorical/fin-set.js +8 -1
  414. package/dist/semantics/categorical/fin-set.js.map +1 -1
  415. package/dist/semantics/categorical/free.d.ts.map +1 -1
  416. package/dist/semantics/categorical/free.js +8 -2
  417. package/dist/semantics/categorical/free.js.map +1 -1
  418. package/dist/semantics/categorical/limits.d.ts.map +1 -1
  419. package/dist/semantics/categorical/limits.js +13 -4
  420. package/dist/semantics/categorical/limits.js.map +1 -1
  421. package/dist/semantics/categorical/monoidal.d.ts.map +1 -1
  422. package/dist/semantics/categorical/monoidal.js +3 -1
  423. package/dist/semantics/categorical/monoidal.js.map +1 -1
  424. package/dist/semantics/text-layer/compiler.d.ts +46 -0
  425. package/dist/semantics/text-layer/compiler.d.ts.map +1 -1
  426. package/dist/semantics/text-layer/compiler.js +46 -11
  427. package/dist/semantics/text-layer/compiler.js.map +1 -1
  428. package/dist/solver/cdcl-v2/index.d.ts +8 -0
  429. package/dist/solver/cdcl-v2/index.d.ts.map +1 -1
  430. package/dist/solver/cdcl-v2/index.js +8 -0
  431. package/dist/solver/cdcl-v2/index.js.map +1 -1
  432. package/dist/solver/smt-z3/z3-wasm-backend.d.ts +0 -1
  433. package/dist/solver/smt-z3/z3-wasm-backend.d.ts.map +1 -1
  434. package/dist/solver/smt-z3/z3-wasm-backend.js +2 -3
  435. package/dist/solver/smt-z3/z3-wasm-backend.js.map +1 -1
  436. package/dist/tests/agora-integration-fixtures.test.js +7 -2
  437. package/dist/tests/agora-integration-fixtures.test.js.map +1 -1
  438. package/dist/tests/coverage-90/coverage-90-cdcl-v2-deep.test.d.ts +2 -0
  439. package/dist/tests/coverage-90/coverage-90-cdcl-v2-deep.test.d.ts.map +1 -0
  440. package/dist/tests/coverage-90/coverage-90-cdcl-v2-deep.test.js +123 -0
  441. package/dist/tests/coverage-90/coverage-90-cdcl-v2-deep.test.js.map +1 -0
  442. package/dist/tests/coverage-90/coverage-90-certificate-rules.test.d.ts +2 -0
  443. package/dist/tests/coverage-90/coverage-90-certificate-rules.test.d.ts.map +1 -0
  444. package/dist/tests/coverage-90/coverage-90-certificate-rules.test.js +172 -0
  445. package/dist/tests/coverage-90/coverage-90-certificate-rules.test.js.map +1 -0
  446. package/dist/tests/coverage-90/coverage-90-interpreter-extra.test.d.ts +2 -0
  447. package/dist/tests/coverage-90/coverage-90-interpreter-extra.test.d.ts.map +1 -0
  448. package/dist/tests/coverage-90/coverage-90-interpreter-extra.test.js +326 -0
  449. package/dist/tests/coverage-90/coverage-90-interpreter-extra.test.js.map +1 -0
  450. package/dist/tests/coverage-90/coverage-90-interpreter-features.test.d.ts +2 -0
  451. package/dist/tests/coverage-90/coverage-90-interpreter-features.test.d.ts.map +1 -0
  452. package/dist/tests/coverage-90/coverage-90-interpreter-features.test.js +418 -0
  453. package/dist/tests/coverage-90/coverage-90-interpreter-features.test.js.map +1 -0
  454. package/dist/tests/coverage-90/coverage-90-modal-temporal.test.d.ts +2 -0
  455. package/dist/tests/coverage-90/coverage-90-modal-temporal.test.d.ts.map +1 -0
  456. package/dist/tests/coverage-90/coverage-90-modal-temporal.test.js +162 -0
  457. package/dist/tests/coverage-90/coverage-90-modal-temporal.test.js.map +1 -0
  458. package/dist/tests/coverage-90/coverage-90-nk-prover.test.d.ts +2 -0
  459. package/dist/tests/coverage-90/coverage-90-nk-prover.test.d.ts.map +1 -0
  460. package/dist/tests/coverage-90/coverage-90-nk-prover.test.js +104 -0
  461. package/dist/tests/coverage-90/coverage-90-nk-prover.test.js.map +1 -0
  462. package/dist/tests/coverage-90/coverage-90-parser-deep.test.d.ts +2 -0
  463. package/dist/tests/coverage-90/coverage-90-parser-deep.test.d.ts.map +1 -0
  464. package/dist/tests/coverage-90/coverage-90-parser-deep.test.js +262 -0
  465. package/dist/tests/coverage-90/coverage-90-parser-deep.test.js.map +1 -0
  466. package/dist/tests/coverage-90/coverage-90-sat-engines.test.d.ts +2 -0
  467. package/dist/tests/coverage-90/coverage-90-sat-engines.test.d.ts.map +1 -0
  468. package/dist/tests/coverage-90/coverage-90-sat-engines.test.js +101 -0
  469. package/dist/tests/coverage-90/coverage-90-sat-engines.test.js.map +1 -0
  470. package/dist/tests/coverage-90/coverage-90-sequent-lk.test.d.ts +2 -0
  471. package/dist/tests/coverage-90/coverage-90-sequent-lk.test.d.ts.map +1 -0
  472. package/dist/tests/coverage-90/coverage-90-sequent-lk.test.js +219 -0
  473. package/dist/tests/coverage-90/coverage-90-sequent-lk.test.js.map +1 -0
  474. package/dist/tests/coverage-90/coverage-90-smt-lib-parser.test.d.ts +2 -0
  475. package/dist/tests/coverage-90/coverage-90-smt-lib-parser.test.d.ts.map +1 -0
  476. package/dist/tests/coverage-90/coverage-90-smt-lib-parser.test.js +154 -0
  477. package/dist/tests/coverage-90/coverage-90-smt-lib-parser.test.js.map +1 -0
  478. package/dist/tests/coverage-95/first-order.test.js.map +1 -1
  479. package/dist/tests/coverage-95/fol-prover.test.js.map +1 -1
  480. package/dist/tests/integration/cross-modules.test.js +43 -19
  481. package/dist/tests/integration/cross-modules.test.js.map +1 -1
  482. package/dist/tests/logic/ctl/check.test.js.map +1 -1
  483. package/dist/tests/logic/profile-bridge/translations.test.js +3 -3
  484. package/dist/tests/logic/profile-bridge/translations.test.js.map +1 -1
  485. package/dist/tests/logic/profiles/sequent-lj/lj.test.d.ts +2 -0
  486. package/dist/tests/logic/profiles/sequent-lj/lj.test.d.ts.map +1 -0
  487. package/dist/tests/logic/profiles/sequent-lj/lj.test.js +400 -0
  488. package/dist/tests/logic/profiles/sequent-lj/lj.test.js.map +1 -0
  489. package/dist/tests/logic/sequent-g3/prover.test.js.map +1 -1
  490. package/dist/tests/logic/substructural/prover.test.js.map +1 -1
  491. package/dist/tests/proof-systems/fol-prover-advanced/prover.test.js +40 -13
  492. package/dist/tests/proof-systems/fol-prover-advanced/prover.test.js.map +1 -1
  493. package/dist/tests/proof-systems/higher-order-unify/ho-unify.test.js.map +1 -1
  494. package/dist/tests/proof-systems/tableau-framework/tableau.test.js +8 -8
  495. package/dist/tests/proof-systems/tableau-framework/tableau.test.js.map +1 -1
  496. package/dist/tests/properties/agm.property.test.js +1 -1
  497. package/dist/tests/properties/agm.property.test.js.map +1 -1
  498. package/dist/tests/properties/anti-unification.property.test.js.map +1 -1
  499. package/dist/tests/properties/argumentation.property.test.js.map +1 -1
  500. package/dist/tests/properties/bisimulation.property.test.js.map +1 -1
  501. package/dist/tests/properties/cdcl.property.test.js.map +1 -1
  502. package/dist/tests/properties/coinduction.property.test.js.map +1 -1
  503. package/dist/tests/properties/constructive-reals.property.test.js.map +1 -1
  504. package/dist/tests/properties/csp.property.test.js +1 -3
  505. package/dist/tests/properties/csp.property.test.js.map +1 -1
  506. package/dist/tests/properties/generators.d.ts +1 -1
  507. package/dist/tests/properties/generators.d.ts.map +1 -1
  508. package/dist/tests/properties/generators.js +22 -30
  509. package/dist/tests/properties/generators.js.map +1 -1
  510. package/dist/tests/properties/intuit-nj.property.test.js +3 -1
  511. package/dist/tests/properties/intuit-nj.property.test.js.map +1 -1
  512. package/dist/tests/properties/lambda-calc.property.test.js.map +1 -1
  513. package/dist/tests/properties/mln.property.test.js +1 -3
  514. package/dist/tests/properties/mln.property.test.js.map +1 -1
  515. package/dist/tests/properties/planning.property.test.js.map +1 -1
  516. package/dist/tests/properties/profile-bridge.property.test.js.map +1 -1
  517. package/dist/tests/properties/theorem-cache.property.test.js.map +1 -1
  518. package/dist/tests/protocol-text-layer.test.js.map +1 -1
  519. package/dist/tests/reasoning/combinatorics/combinatorics.test.js +1 -1
  520. package/dist/tests/reasoning/constructive-analysis/constructive-analysis.test.js +9 -9
  521. package/dist/tests/reasoning/constructive-analysis/constructive-analysis.test.js.map +1 -1
  522. package/dist/tests/reasoning/linear-algebra/linear-algebra.test.js +80 -38
  523. package/dist/tests/reasoning/linear-algebra/linear-algebra.test.js.map +1 -1
  524. package/dist/tests/reasoning/order-theory/order-theory.test.d.ts +2 -0
  525. package/dist/tests/reasoning/order-theory/order-theory.test.d.ts.map +1 -0
  526. package/dist/tests/reasoning/order-theory/order-theory.test.js +211 -0
  527. package/dist/tests/reasoning/order-theory/order-theory.test.js.map +1 -0
  528. package/dist/tests/reasoning/peano-arithmetic/peano.test.d.ts +2 -0
  529. package/dist/tests/reasoning/peano-arithmetic/peano.test.d.ts.map +1 -0
  530. package/dist/tests/reasoning/peano-arithmetic/peano.test.js +159 -0
  531. package/dist/tests/reasoning/peano-arithmetic/peano.test.js.map +1 -0
  532. package/dist/tests/reasoning/set-theory/hf-functions.test.js +11 -11
  533. package/dist/tests/reasoning/set-theory/zfc-axioms.test.js +1 -1
  534. package/dist/tests/semantics/text-layer-v2/claim-graph.test.js.map +1 -1
  535. package/dist/tests/solver/smt-lib/emitter.test.js.map +1 -1
  536. package/dist/tests/solver/smt-z3/z3-wasm-backend.test.js.map +1 -1
  537. package/dist/tests/tooling/test-harness/test-harness.test.js +9 -6
  538. package/dist/tests/tooling/test-harness/test-harness.test.js.map +1 -1
  539. package/dist/tooling/lsp/types.d.ts +13 -0
  540. package/dist/tooling/lsp/types.d.ts.map +1 -1
  541. package/dist/tooling/lsp/types.js +1 -0
  542. package/dist/tooling/lsp/types.js.map +1 -1
  543. package/dist/tooling/test-harness/combinators.d.ts.map +1 -1
  544. package/dist/tooling/test-harness/combinators.js +4 -4
  545. package/dist/tooling/test-harness/combinators.js.map +1 -1
  546. package/dist/tooling/test-harness/coverage.js +1 -1
  547. package/dist/tooling/test-harness/generators.d.ts.map +1 -1
  548. package/dist/tooling/test-harness/generators.js.map +1 -1
  549. package/dist/tooling/test-harness/index.d.ts +1 -1
  550. package/dist/tooling/test-harness/index.d.ts.map +1 -1
  551. package/dist/tooling/test-harness/index.js.map +1 -1
  552. package/dist/tooling/test-harness/snapshot.d.ts.map +1 -1
  553. package/dist/tooling/test-harness/snapshot.js +2 -2
  554. package/dist/tooling/test-harness/snapshot.js.map +1 -1
  555. package/dist/type-theory/cubical/types.d.ts +25 -0
  556. package/dist/type-theory/cubical/types.d.ts.map +1 -1
  557. package/dist/type-theory/cubical/types.js +20 -0
  558. package/dist/type-theory/cubical/types.js.map +1 -1
  559. package/dist/type-theory/curry-howard/types.d.ts +27 -0
  560. package/dist/type-theory/curry-howard/types.d.ts.map +1 -1
  561. package/dist/type-theory/curry-howard/types.js +18 -0
  562. package/dist/type-theory/curry-howard/types.js.map +1 -1
  563. package/dist/type-theory/hindley-milner/substitution.d.ts +39 -0
  564. package/dist/type-theory/hindley-milner/substitution.d.ts.map +1 -1
  565. package/dist/type-theory/hindley-milner/substitution.js +37 -0
  566. package/dist/type-theory/hindley-milner/substitution.js.map +1 -1
  567. package/dist/type-theory/hindley-milner/types.d.ts +25 -0
  568. package/dist/type-theory/hindley-milner/types.d.ts.map +1 -1
  569. package/dist/type-theory/hindley-milner/types.js +22 -2
  570. package/dist/type-theory/hindley-milner/types.js.map +1 -1
  571. package/dist/type-theory/hol/rules.d.ts +36 -0
  572. package/dist/type-theory/hol/rules.d.ts.map +1 -1
  573. package/dist/type-theory/hol/rules.js +36 -0
  574. package/dist/type-theory/hol/rules.js.map +1 -1
  575. package/dist/type-theory/hott/types.d.ts +32 -0
  576. package/dist/type-theory/hott/types.d.ts.map +1 -1
  577. package/dist/type-theory/hott/types.js +31 -1
  578. package/dist/type-theory/hott/types.js.map +1 -1
  579. package/dist/type-theory/lambda-cube/types.d.ts +17 -0
  580. package/dist/type-theory/lambda-cube/types.d.ts.map +1 -1
  581. package/dist/type-theory/lambda-cube/types.js +13 -0
  582. package/dist/type-theory/lambda-cube/types.js.map +1 -1
  583. package/dist/type-theory/mltt/types.d.ts +19 -0
  584. package/dist/type-theory/mltt/types.d.ts.map +1 -1
  585. package/dist/type-theory/mltt/types.js +15 -1
  586. package/dist/type-theory/mltt/types.js.map +1 -1
  587. package/dist/type-theory/nbe/types.d.ts +21 -0
  588. package/dist/type-theory/nbe/types.d.ts.map +1 -1
  589. package/dist/type-theory/nbe/types.js +13 -1
  590. package/dist/type-theory/nbe/types.js.map +1 -1
  591. package/dist/type-theory/refinement-types/types.d.ts +38 -0
  592. package/dist/type-theory/refinement-types/types.d.ts.map +1 -1
  593. package/dist/type-theory/refinement-types/types.js +35 -0
  594. package/dist/type-theory/refinement-types/types.js.map +1 -1
  595. package/dist/type-theory/system-f/types.d.ts +30 -0
  596. package/dist/type-theory/system-f/types.d.ts.map +1 -1
  597. package/dist/type-theory/system-f/types.js +24 -3
  598. package/dist/type-theory/system-f/types.js.map +1 -1
  599. package/dist/types/index.d.ts +42 -0
  600. package/dist/types/index.d.ts.map +1 -1
  601. package/dist/types/index.js.map +1 -1
  602. package/package.json +26 -1
@@ -0,0 +1,903 @@
1
+ "use strict";
2
+ // ============================================================
3
+ // LJ Sequent Calculus — Calculo de secuentes intuicionista
4
+ // ============================================================
5
+ //
6
+ // LJ de Gentzen (1934) para logica intuicionista proposicional.
7
+ // A diferencia de LK clasico, LJ admite a lo sumo UNA formula
8
+ // en el succedente: secuentes de la forma Γ ⊢ φ (con succedente
9
+ // no vacio) o Γ ⊢ (succedente vacio). Esta restriccion es lo
10
+ // que hace que LJ NO derive ¬¬P → P ni P ∨ ¬P (LEM/DNE
11
+ // clasicas).
12
+ //
13
+ // Reglas (proposicionales):
14
+ // axiom : A, Γ ⊢ A
15
+ // cut : Γ ⊢ A A, Σ ⊢ C ⟹ Γ, Σ ⊢ C
16
+ // weakL : Γ ⊢ C ⟹ A, Γ ⊢ C
17
+ // contrL : A, A, Γ ⊢ C ⟹ A, Γ ⊢ C
18
+ // exL : permuta a la izquierda
19
+ // notL : Γ ⊢ A ⟹ ¬A, Γ ⊢ C
20
+ // notR : A, Γ ⊢ ⟹ Γ ⊢ ¬A (succedente vacio)
21
+ // andL : A, B, Γ ⊢ C ⟹ A∧B, Γ ⊢ C
22
+ // andR : Γ ⊢ A y Γ ⊢ B ⟹ Γ ⊢ A∧B
23
+ // orL : A, Γ ⊢ C y B, Γ ⊢ C ⟹ A∨B, Γ ⊢ C
24
+ // orR-l : Γ ⊢ A ⟹ Γ ⊢ A∨B
25
+ // orR-r : Γ ⊢ B ⟹ Γ ⊢ A∨B
26
+ // impL : Γ ⊢ A y B, Γ ⊢ C ⟹ A→B, Γ ⊢ C
27
+ // impR : A, Γ ⊢ B ⟹ Γ ⊢ A→B
28
+ // bottomL : ⊥, Γ ⊢ C (ex falso quodlibet)
29
+ //
30
+ // Glivenko (1929): Γ ⊢_LK φ sii Γ ⊢_LJ ¬¬φ. La funcion
31
+ // `glivenkoEmbed` traduce una formula clasica a su lectura
32
+ // intuicionista doble-negada.
33
+ //
34
+ // import { proveLJ, hasCut, eliminateCut, isValid, ljToLk, lkToLj, glivenkoEmbed }
35
+ // from 'src/profiles/sequent-lj';
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.proveLJ = proveLJ;
38
+ exports.proveLJFormula = proveLJFormula;
39
+ exports.isValid = isValid;
40
+ exports.hasCut = hasCut;
41
+ exports.eliminateCut = eliminateCut;
42
+ exports.ljToLk = ljToLk;
43
+ exports.lkToLj = lkToLj;
44
+ exports.glivenkoEmbed = glivenkoEmbed;
45
+ exports.ljKey = ljKey;
46
+ exports.ljEq = eqF;
47
+ exports.ljDepth = depth;
48
+ // ============================================================
49
+ // Utilidades sintacticas
50
+ // ============================================================
51
+ function ljKey(f) {
52
+ switch (f.kind) {
53
+ case 'atom':
54
+ return `a:${f.name}`;
55
+ case 'not':
56
+ return `n(${ljKey(f.arg)})`;
57
+ case 'and':
58
+ return `&(${ljKey(f.left)},${ljKey(f.right)})`;
59
+ case 'or':
60
+ return `|(${ljKey(f.left)},${ljKey(f.right)})`;
61
+ case 'implies':
62
+ return `>(${ljKey(f.left)},${ljKey(f.right)})`;
63
+ case 'bottom':
64
+ return '_';
65
+ }
66
+ }
67
+ function eqF(a, b) {
68
+ return ljKey(a) === ljKey(b);
69
+ }
70
+ function eqSide(a, b) {
71
+ if (a === null && b === null)
72
+ return true;
73
+ if (a === null || b === null)
74
+ return false;
75
+ return eqF(a, b);
76
+ }
77
+ function removeAt(xs, idx) {
78
+ const copy = xs.slice();
79
+ copy.splice(idx, 1);
80
+ return copy;
81
+ }
82
+ function removeFirstByKey(xs, key) {
83
+ const idx = xs.findIndex((f) => ljKey(f) === key);
84
+ if (idx === -1)
85
+ return xs.slice();
86
+ return removeAt(xs, idx);
87
+ }
88
+ function containsKey(xs, key) {
89
+ return xs.some((f) => ljKey(f) === key);
90
+ }
91
+ function multisetIncludes(haystack, needle) {
92
+ const counts = new Map();
93
+ for (const f of haystack)
94
+ counts.set(ljKey(f), (counts.get(ljKey(f)) ?? 0) + 1);
95
+ for (const f of needle) {
96
+ const k = ljKey(f);
97
+ const c = counts.get(k) ?? 0;
98
+ if (c <= 0)
99
+ return false;
100
+ counts.set(k, c - 1);
101
+ }
102
+ return true;
103
+ }
104
+ function sameMultiset(a, b) {
105
+ if (a.length !== b.length)
106
+ return false;
107
+ return multisetIncludes(a, b) && multisetIncludes(b, a);
108
+ }
109
+ function depth(f) {
110
+ switch (f.kind) {
111
+ case 'atom':
112
+ case 'bottom':
113
+ return 0;
114
+ case 'not':
115
+ return depth(f.arg) + 1;
116
+ case 'and':
117
+ case 'or':
118
+ case 'implies':
119
+ return Math.max(depth(f.left), depth(f.right)) + 1;
120
+ }
121
+ }
122
+ function exhausted(ctx) {
123
+ return ctx.used >= ctx.budget || ctx.depth >= ctx.maxDepth;
124
+ }
125
+ function seqKey(left, right) {
126
+ const lkeys = left.map(ljKey).sort().join(',');
127
+ const rkey = right ? ljKey(right) : '_';
128
+ return `${lkeys}|${rkey}`;
129
+ }
130
+ function isAtomic(f) {
131
+ return f.kind === 'atom' || f.kind === 'bottom';
132
+ }
133
+ function prove(left, right, ctx) {
134
+ ctx.used++;
135
+ if (exhausted(ctx))
136
+ return undefined;
137
+ const key = seqKey(left, right);
138
+ if (ctx.failed.has(key))
139
+ return undefined;
140
+ if (ctx.active.has(key))
141
+ return undefined;
142
+ ctx.active.add(key);
143
+ ctx.depth++;
144
+ const result = proveInner(left, right, ctx);
145
+ ctx.depth--;
146
+ ctx.active.delete(key);
147
+ if (!result)
148
+ ctx.failed.add(key);
149
+ return result;
150
+ }
151
+ function proveInner(left, right, ctx) {
152
+ // 1. Axioma: A ∈ Γ y right = A
153
+ if (right) {
154
+ const rkey = ljKey(right);
155
+ if (containsKey(left, rkey)) {
156
+ return {
157
+ goal: { left: left.slice(), right },
158
+ rule: 'axiom',
159
+ premises: [],
160
+ principalFormula: right,
161
+ };
162
+ }
163
+ }
164
+ // 2. bottomL: ⊥ ∈ Γ → cualquier conclusion (incluyendo right=null)
165
+ const bottomIdx = left.findIndex((f) => f.kind === 'bottom');
166
+ if (bottomIdx !== -1) {
167
+ const bf = left[bottomIdx];
168
+ if (bf) {
169
+ return {
170
+ goal: { left: left.slice(), right },
171
+ rule: 'bottomL',
172
+ premises: [],
173
+ principalFormula: bf,
174
+ };
175
+ }
176
+ }
177
+ // 3. Reglas invertibles a la izquierda (no ramificantes salvo orL/andL)
178
+ for (let i = 0; i < left.length; i++) {
179
+ const f = left[i];
180
+ if (!f)
181
+ continue;
182
+ if (f.kind === 'and') {
183
+ // A∧B, Γ ⊢ C ↦ A, B, Γ ⊢ C
184
+ const newL = [f.left, f.right, ...removeAt(left, i)];
185
+ const sub = prove(newL, right, ctx);
186
+ if (!sub)
187
+ return undefined;
188
+ return {
189
+ goal: { left: left.slice(), right },
190
+ rule: 'andL',
191
+ premises: [sub],
192
+ principalFormula: f,
193
+ };
194
+ }
195
+ }
196
+ // 4. Reglas invertibles a la derecha (no ramificantes)
197
+ if (right) {
198
+ if (right.kind === 'and') {
199
+ // Γ ⊢ A∧B ↦ Γ ⊢ A y Γ ⊢ B
200
+ const subA = prove(left, right.left, ctx);
201
+ if (!subA)
202
+ return undefined;
203
+ const subB = prove(left, right.right, ctx);
204
+ if (!subB)
205
+ return undefined;
206
+ return {
207
+ goal: { left: left.slice(), right },
208
+ rule: 'andR',
209
+ premises: [subA, subB],
210
+ principalFormula: right,
211
+ };
212
+ }
213
+ if (right.kind === 'implies') {
214
+ // Γ ⊢ A→B ↦ A, Γ ⊢ B
215
+ const newL = [right.left, ...left];
216
+ const sub = prove(newL, right.right, ctx);
217
+ if (!sub)
218
+ return undefined;
219
+ return {
220
+ goal: { left: left.slice(), right },
221
+ rule: 'impR',
222
+ premises: [sub],
223
+ principalFormula: right,
224
+ };
225
+ }
226
+ if (right.kind === 'not') {
227
+ // Γ ⊢ ¬A ↦ A, Γ ⊢ (succedente vacio)
228
+ const newL = [right.arg, ...left];
229
+ const sub = prove(newL, null, ctx);
230
+ if (!sub)
231
+ return undefined;
232
+ return {
233
+ goal: { left: left.slice(), right },
234
+ rule: 'notR',
235
+ premises: [sub],
236
+ principalFormula: right,
237
+ };
238
+ }
239
+ }
240
+ // 5. Reglas invertibles ramificantes a la izquierda (orL)
241
+ for (let i = 0; i < left.length; i++) {
242
+ const f = left[i];
243
+ if (!f)
244
+ continue;
245
+ if (f.kind === 'or') {
246
+ const rest = removeAt(left, i);
247
+ const subL = prove([f.left, ...rest], right, ctx);
248
+ if (!subL)
249
+ continue; // tratar como fallida la rama → no es orL; sigue intentando
250
+ const subR = prove([f.right, ...rest], right, ctx);
251
+ if (!subR)
252
+ continue;
253
+ return {
254
+ goal: { left: left.slice(), right },
255
+ rule: 'orL',
256
+ premises: [subL, subR],
257
+ principalFormula: f,
258
+ };
259
+ }
260
+ }
261
+ // 6. Regla no invertible a la izquierda: impL (Dyckhoff G3i, contraction-free)
262
+ // A→B, Γ ⊢ C via Γ' ⊢ A y B, Γ' ⊢ C (Γ' = Γ \ {A→B})
263
+ for (let i = 0; i < left.length; i++) {
264
+ const f = left[i];
265
+ if (!f)
266
+ continue;
267
+ if (f.kind === 'implies') {
268
+ const rest = removeAt(left, i);
269
+ // Sub-meta 1: Γ' ⊢ A (sin re-añadir A→B → contraction-free)
270
+ const subA = prove(rest, f.left, ctx);
271
+ if (!subA)
272
+ continue;
273
+ // Sub-meta 2: B, Γ' ⊢ C
274
+ const subB = prove([f.right, ...rest], right, ctx);
275
+ if (!subB)
276
+ continue;
277
+ return {
278
+ goal: { left: left.slice(), right },
279
+ rule: 'impL',
280
+ premises: [subA, subB],
281
+ principalFormula: f,
282
+ };
283
+ }
284
+ }
285
+ // 7. Regla no invertible a la izquierda: notL
286
+ // ¬A, Γ ⊢ C via Γ' ⊢ A
287
+ // Por defecto contraction-free (Γ' = Γ \ {¬A}). Pero cuando el
288
+ // succedente esta vacio (busqueda de contradiccion para Glivenko)
289
+ // o cuando esa rama no cierra, intentamos tambien con contraccion
290
+ // (Γ' = Γ, manteniendo ¬A para usos multiples).
291
+ for (let i = 0; i < left.length; i++) {
292
+ const f = left[i];
293
+ if (!f)
294
+ continue;
295
+ if (f.kind === 'not') {
296
+ const rest = removeAt(left, i);
297
+ const subA = prove(rest, f.arg, ctx);
298
+ if (subA) {
299
+ return {
300
+ goal: { left: left.slice(), right },
301
+ rule: 'notL',
302
+ premises: [subA],
303
+ principalFormula: f,
304
+ };
305
+ }
306
+ // Variante con contraccion (¬A se mantiene): util para derivar
307
+ // contradicciones donde ¬A se usa multiples veces.
308
+ const subAcontr = prove(left.slice(), f.arg, ctx);
309
+ if (subAcontr) {
310
+ return {
311
+ goal: { left: left.slice(), right },
312
+ rule: 'notL',
313
+ premises: [subAcontr],
314
+ principalFormula: f,
315
+ };
316
+ }
317
+ }
318
+ }
319
+ // 8. Reglas no invertibles a la derecha: orR-l y orR-r
320
+ if (right && right.kind === 'or') {
321
+ const subL = prove(left, right.left, ctx);
322
+ if (subL) {
323
+ return {
324
+ goal: { left: left.slice(), right },
325
+ rule: 'orR-l',
326
+ premises: [subL],
327
+ principalFormula: right,
328
+ };
329
+ }
330
+ const subR = prove(left, right.right, ctx);
331
+ if (subR) {
332
+ return {
333
+ goal: { left: left.slice(), right },
334
+ rule: 'orR-r',
335
+ premises: [subR],
336
+ principalFormula: right,
337
+ };
338
+ }
339
+ }
340
+ // 9. Sin reglas aplicables → no derivable
341
+ if (right === null) {
342
+ // succedente vacio sin ⊥ a la izquierda y sin formulas descomponibles
343
+ const anyComplex = left.some((f) => !isAtomic(f));
344
+ if (!anyComplex)
345
+ return undefined;
346
+ }
347
+ return undefined;
348
+ }
349
+ /**
350
+ * Demuestra el secuente `seq` en LJ intuicionista (sin cortes).
351
+ * Devuelve `null` si no encuentra derivacion dentro del budget.
352
+ */
353
+ function proveLJ(seq, options = {}) {
354
+ const ctx = {
355
+ budget: options.budget ?? 10_000,
356
+ used: 0,
357
+ depth: 0,
358
+ maxDepth: 200,
359
+ failed: new Set(),
360
+ active: new Set(),
361
+ };
362
+ const tree = prove(seq.left.slice(), seq.right, ctx);
363
+ return tree ?? null;
364
+ }
365
+ /** Atajo: ⊢ φ en LJ. */
366
+ /** Atajo: intenta derivar ⊢ φ en LJ (secuente con antecedente vacío). */
367
+ function proveLJFormula(formula, options = {}) {
368
+ return proveLJ({ left: [], right: formula }, options);
369
+ }
370
+ // ============================================================
371
+ // Validacion estructural de derivaciones LJ
372
+ // ============================================================
373
+ /** Verifica estructuralmente que un árbol de derivación LJ es correcto. */
374
+ function isValid(proof) {
375
+ const { goal, rule, premises } = proof;
376
+ const L = goal.left;
377
+ const R = goal.right;
378
+ for (const p of premises) {
379
+ if (!isValid(p))
380
+ return false;
381
+ }
382
+ switch (rule) {
383
+ case 'axiom': {
384
+ if (premises.length !== 0)
385
+ return false;
386
+ if (R === null)
387
+ return false;
388
+ return containsKey(L, ljKey(R));
389
+ }
390
+ case 'bottomL': {
391
+ if (premises.length !== 0)
392
+ return false;
393
+ return L.some((f) => f.kind === 'bottom');
394
+ }
395
+ case 'cut': {
396
+ if (premises.length !== 2)
397
+ return false;
398
+ const cf = proof.cutFormula;
399
+ if (!cf)
400
+ return false;
401
+ const [p1, p2] = premises;
402
+ if (!p1 || !p2)
403
+ return false;
404
+ // p1: Γ ⊢ A p2: A, Σ ⊢ C ⟹ Γ, Σ ⊢ C
405
+ if (!eqSide(p1.goal.right, cf))
406
+ return false;
407
+ if (!containsKey(p2.goal.left, ljKey(cf)))
408
+ return false;
409
+ const gamma = p1.goal.left;
410
+ const sigma = removeFirstByKey(p2.goal.left, ljKey(cf));
411
+ if (!eqSide(p2.goal.right, R))
412
+ return false;
413
+ return sameMultiset(L, [...gamma, ...sigma]);
414
+ }
415
+ case 'weakL': {
416
+ if (premises.length !== 1)
417
+ return false;
418
+ const [p] = premises;
419
+ if (!p)
420
+ return false;
421
+ if (!eqSide(p.goal.right, R))
422
+ return false;
423
+ for (let i = 0; i < L.length; i++) {
424
+ const x = L[i];
425
+ if (!x)
426
+ continue;
427
+ if (sameMultiset(removeAt(L, i), p.goal.left))
428
+ return true;
429
+ }
430
+ return false;
431
+ }
432
+ case 'contrL': {
433
+ if (premises.length !== 1)
434
+ return false;
435
+ const [p] = premises;
436
+ if (!p)
437
+ return false;
438
+ if (!eqSide(p.goal.right, R))
439
+ return false;
440
+ // p.goal.left ≡ L con alguna formula duplicada
441
+ for (let i = 0; i < L.length; i++) {
442
+ const x = L[i];
443
+ if (!x)
444
+ continue;
445
+ const candidate = [x, ...L];
446
+ if (sameMultiset(p.goal.left, candidate))
447
+ return true;
448
+ }
449
+ return false;
450
+ }
451
+ case 'exL': {
452
+ if (premises.length !== 1)
453
+ return false;
454
+ const [p] = premises;
455
+ if (!p)
456
+ return false;
457
+ return sameMultiset(p.goal.left, L) && eqSide(p.goal.right, R);
458
+ }
459
+ case 'notL': {
460
+ if (premises.length !== 1)
461
+ return false;
462
+ const [p] = premises;
463
+ if (!p)
464
+ return false;
465
+ const pf = proof.principalFormula;
466
+ if (!pf || pf.kind !== 'not')
467
+ return false;
468
+ // ¬A, Γ ⊢ C ; premisa: Γ ⊢ A
469
+ // Aceptamos forma contraction-free (Γ' = Γ \ {¬A}) o con contraccion (Γ' = Γ).
470
+ if (!containsKey(L, ljKey(pf)))
471
+ return false;
472
+ const gamma = removeFirstByKey(L, ljKey(pf));
473
+ const okCtx = sameMultiset(p.goal.left, gamma) || sameMultiset(p.goal.left, L);
474
+ return okCtx && eqSide(p.goal.right, pf.arg);
475
+ }
476
+ case 'notR': {
477
+ if (premises.length !== 1)
478
+ return false;
479
+ const [p] = premises;
480
+ if (!p)
481
+ return false;
482
+ const pf = proof.principalFormula;
483
+ if (!pf || pf.kind !== 'not')
484
+ return false;
485
+ if (!eqSide(R, pf))
486
+ return false;
487
+ // premisa: A, Γ ⊢ (vacio)
488
+ if (p.goal.right !== null)
489
+ return false;
490
+ if (!containsKey(p.goal.left, ljKey(pf.arg)))
491
+ return false;
492
+ const gamma = removeFirstByKey(p.goal.left, ljKey(pf.arg));
493
+ return sameMultiset(gamma, L);
494
+ }
495
+ case 'andL': {
496
+ if (premises.length !== 1)
497
+ return false;
498
+ const [p] = premises;
499
+ if (!p)
500
+ return false;
501
+ const pf = proof.principalFormula;
502
+ if (!pf || pf.kind !== 'and')
503
+ return false;
504
+ if (!containsKey(L, ljKey(pf)))
505
+ return false;
506
+ const gamma = removeFirstByKey(L, ljKey(pf));
507
+ const expected = [pf.left, pf.right, ...gamma];
508
+ return sameMultiset(p.goal.left, expected) && eqSide(p.goal.right, R);
509
+ }
510
+ case 'andR': {
511
+ if (premises.length !== 2)
512
+ return false;
513
+ const [p1, p2] = premises;
514
+ if (!p1 || !p2)
515
+ return false;
516
+ if (!R || R.kind !== 'and')
517
+ return false;
518
+ const pf = proof.principalFormula ?? R;
519
+ if (pf.kind !== 'and')
520
+ return false;
521
+ return (sameMultiset(p1.goal.left, L) &&
522
+ eqSide(p1.goal.right, pf.left) &&
523
+ sameMultiset(p2.goal.left, L) &&
524
+ eqSide(p2.goal.right, pf.right));
525
+ }
526
+ case 'orL': {
527
+ if (premises.length !== 2)
528
+ return false;
529
+ const [p1, p2] = premises;
530
+ if (!p1 || !p2)
531
+ return false;
532
+ const pf = proof.principalFormula;
533
+ if (!pf || pf.kind !== 'or')
534
+ return false;
535
+ if (!containsKey(L, ljKey(pf)))
536
+ return false;
537
+ const gamma = removeFirstByKey(L, ljKey(pf));
538
+ const okL = containsKey(p1.goal.left, ljKey(pf.left)) &&
539
+ sameMultiset(removeFirstByKey(p1.goal.left, ljKey(pf.left)), gamma) &&
540
+ eqSide(p1.goal.right, R);
541
+ const okR = containsKey(p2.goal.left, ljKey(pf.right)) &&
542
+ sameMultiset(removeFirstByKey(p2.goal.left, ljKey(pf.right)), gamma) &&
543
+ eqSide(p2.goal.right, R);
544
+ return okL && okR;
545
+ }
546
+ case 'orR-l': {
547
+ if (premises.length !== 1)
548
+ return false;
549
+ const [p] = premises;
550
+ if (!p)
551
+ return false;
552
+ if (!R || R.kind !== 'or')
553
+ return false;
554
+ return sameMultiset(p.goal.left, L) && eqSide(p.goal.right, R.left);
555
+ }
556
+ case 'orR-r': {
557
+ if (premises.length !== 1)
558
+ return false;
559
+ const [p] = premises;
560
+ if (!p)
561
+ return false;
562
+ if (!R || R.kind !== 'or')
563
+ return false;
564
+ return sameMultiset(p.goal.left, L) && eqSide(p.goal.right, R.right);
565
+ }
566
+ case 'impL': {
567
+ if (premises.length !== 2)
568
+ return false;
569
+ const [p1, p2] = premises;
570
+ if (!p1 || !p2)
571
+ return false;
572
+ const pf = proof.principalFormula;
573
+ if (!pf || pf.kind !== 'implies')
574
+ return false;
575
+ if (!containsKey(L, ljKey(pf)))
576
+ return false;
577
+ const gamma = removeFirstByKey(L, ljKey(pf));
578
+ // p1: Γ' ⊢ A (contraction-free: sin re-añadir A→B)
579
+ const okL = sameMultiset(p1.goal.left, gamma) && eqSide(p1.goal.right, pf.left);
580
+ // p2: B, Γ' ⊢ C
581
+ const okR = containsKey(p2.goal.left, ljKey(pf.right)) &&
582
+ sameMultiset(removeFirstByKey(p2.goal.left, ljKey(pf.right)), gamma) &&
583
+ eqSide(p2.goal.right, R);
584
+ return okL && okR;
585
+ }
586
+ case 'impR': {
587
+ if (premises.length !== 1)
588
+ return false;
589
+ const [p] = premises;
590
+ if (!p)
591
+ return false;
592
+ if (!R || R.kind !== 'implies')
593
+ return false;
594
+ // A, Γ ⊢ B
595
+ if (!containsKey(p.goal.left, ljKey(R.left)))
596
+ return false;
597
+ const gamma = removeFirstByKey(p.goal.left, ljKey(R.left));
598
+ return sameMultiset(gamma, L) && eqSide(p.goal.right, R.right);
599
+ }
600
+ }
601
+ }
602
+ /** Devuelve `true` si el árbol de derivación contiene alguna aplicación de la regla cut. */
603
+ function hasCut(proof) {
604
+ if (proof.rule === 'cut')
605
+ return true;
606
+ return proof.premises.some(hasCut);
607
+ }
608
+ // ============================================================
609
+ // Eliminacion de cortes (Hauptsatz para LJ)
610
+ // ============================================================
611
+ //
612
+ // Gentzen (1934) prueba que LJ admite eliminacion de cortes. La
613
+ // estrategia aqui combina reducciones principales cuando el cut
614
+ // es sobre un conectivo principal en ambas premisas, y usa el
615
+ // prover cut-free como oraculo para los casos restantes (cuts
616
+ // permutativos / commutativos): si el secuente final es
617
+ // derivable, lo es sin cortes por el Hauptsatz.
618
+ function eliminateCutAtRoot(proof) {
619
+ if (proof.rule !== 'cut')
620
+ return proof;
621
+ const [p1, p2] = proof.premises;
622
+ if (!p1 || !p2 || !proof.cutFormula)
623
+ return proof;
624
+ const A = proof.cutFormula;
625
+ const ak = ljKey(A);
626
+ // Caso axioma: A ⊢ A cut A, Σ ⊢ C ⟹ A, Σ ⊢ C (= p2)
627
+ if (p1.rule === 'axiom' && p1.principalFormula && ljKey(p1.principalFormula) === ak) {
628
+ // p1 prueba (Γ con A) ⊢ A; el cut con p2: A, Σ ⊢ C resulta en p2 con Γ adicional.
629
+ // Si p1 es exactamente "A ⊢ A", la conclusion es Σ ⊢ C = p2.
630
+ return p2;
631
+ }
632
+ if (p2.rule === 'axiom' && p2.principalFormula && ljKey(p2.principalFormula) === ak) {
633
+ return p1;
634
+ }
635
+ const principalOnLeft = p1.principalFormula && ljKey(p1.principalFormula) === ak;
636
+ const principalOnRight = p2.principalFormula && ljKey(p2.principalFormula) === ak;
637
+ if (principalOnLeft && principalOnRight) {
638
+ switch (A.kind) {
639
+ case 'and': {
640
+ // p1 termina en andR: Γ ⊢ A∧B con premisas Γ ⊢ A y Γ ⊢ B
641
+ // p2 termina en andL: A∧B, Σ ⊢ C con premisa A, B, Σ ⊢ C
642
+ // Resultado: cut sobre A y luego sobre B.
643
+ const subA = p1.premises[0];
644
+ const subB = p1.premises[1];
645
+ const subAB = p2.premises[0];
646
+ if (!subA || !subB || !subAB)
647
+ break;
648
+ const innerCut = {
649
+ goal: {
650
+ left: [...subB.goal.left, ...subAB.goal.left.filter((f) => ljKey(f) !== ljKey(A.left))],
651
+ right: subAB.goal.right,
652
+ },
653
+ rule: 'cut',
654
+ cutFormula: A.right,
655
+ premises: [subB, subAB],
656
+ };
657
+ const outerCut = {
658
+ goal: proof.goal,
659
+ rule: 'cut',
660
+ cutFormula: A.left,
661
+ premises: [subA, innerCut],
662
+ };
663
+ return eliminateCut(outerCut);
664
+ }
665
+ case 'or': {
666
+ // p1 termina en orR-l (Γ ⊢ A) o orR-r (Γ ⊢ B); p2 termina en orL.
667
+ const subOrR = p1.premises[0];
668
+ const subOrL_left = p2.premises[0]; // A, Σ ⊢ C
669
+ const subOrL_right = p2.premises[1]; // B, Σ ⊢ C
670
+ if (!subOrR || !subOrL_left || !subOrL_right)
671
+ break;
672
+ if (p1.rule === 'orR-l') {
673
+ // cut sobre A
674
+ const newCut = {
675
+ goal: proof.goal,
676
+ rule: 'cut',
677
+ cutFormula: A.left,
678
+ premises: [subOrR, subOrL_left],
679
+ };
680
+ return eliminateCut(newCut);
681
+ }
682
+ if (p1.rule === 'orR-r') {
683
+ const newCut = {
684
+ goal: proof.goal,
685
+ rule: 'cut',
686
+ cutFormula: A.right,
687
+ premises: [subOrR, subOrL_right],
688
+ };
689
+ return eliminateCut(newCut);
690
+ }
691
+ break;
692
+ }
693
+ case 'implies': {
694
+ // p1 termina en impR: A, Γ ⊢ B → premisa A, Γ ⊢ B (objetivo Γ ⊢ A→B)
695
+ // p2 termina en impL: A→B, Σ ⊢ C, premisas Σ ⊢ A y B, Σ ⊢ C
696
+ const subAB = p1.premises[0];
697
+ const subA = p2.premises[0];
698
+ const subC = p2.premises[1];
699
+ if (!subAB || !subA || !subC)
700
+ break;
701
+ // Cut sobre A: Σ ⊢ A y A, Γ ⊢ B → Σ, Γ ⊢ B
702
+ const cutOnA = {
703
+ goal: {
704
+ left: [...subA.goal.left, ...subAB.goal.left.filter((f) => ljKey(f) !== ljKey(A.left))],
705
+ right: subAB.goal.right,
706
+ },
707
+ rule: 'cut',
708
+ cutFormula: A.left,
709
+ premises: [subA, subAB],
710
+ };
711
+ // Cut sobre B: Σ, Γ ⊢ B y B, Σ ⊢ C → Σ, Γ, Σ ⊢ C
712
+ const cutOnB = {
713
+ goal: proof.goal,
714
+ rule: 'cut',
715
+ cutFormula: A.right,
716
+ premises: [cutOnA, subC],
717
+ };
718
+ return eliminateCut(cutOnB);
719
+ }
720
+ case 'not': {
721
+ // p1 termina en notR: Γ ⊢ ¬B, premisa B, Γ ⊢ (vacio)
722
+ // p2 termina en notL: ¬B, Σ ⊢ C, premisa Σ ⊢ B
723
+ // Cut sobre B: Σ ⊢ B y B, Γ ⊢ → Σ, Γ ⊢ ... pero el succedente
724
+ // del nuevo cut es null (de p1.premises[0]). Si necesitamos derivar
725
+ // C, debemos primero matar la rama con bottom; mas simple: usar oracle.
726
+ break;
727
+ }
728
+ case 'atom':
729
+ case 'bottom':
730
+ break;
731
+ }
732
+ }
733
+ // Casos restantes: usar el prover cut-free como oraculo.
734
+ const cutFree = proveLJ(proof.goal);
735
+ if (cutFree)
736
+ return cutFree;
737
+ return proof;
738
+ }
739
+ /**
740
+ * Elimina cortes de una derivación LJ (Hauptsatz de Gentzen).
741
+ * Usa reducciones principales para los casos estructurales y el prover
742
+ * cut-free como oráculo para los casos permutativos restantes.
743
+ */
744
+ function eliminateCut(proof) {
745
+ const premises = proof.premises.map(eliminateCut);
746
+ const updated = { ...proof, premises };
747
+ if (updated.rule !== 'cut')
748
+ return updated;
749
+ const reduced = eliminateCutAtRoot(updated);
750
+ let cur = reduced;
751
+ for (let i = 0; i < 32 && hasCut(cur); i++) {
752
+ cur = { ...cur, premises: cur.premises.map(eliminateCut) };
753
+ if (cur.rule === 'cut')
754
+ cur = eliminateCutAtRoot(cur);
755
+ }
756
+ if (hasCut(cur)) {
757
+ const cutFree = proveLJ(cur.goal);
758
+ if (cutFree && isValid(cutFree))
759
+ return cutFree;
760
+ }
761
+ return cur;
762
+ }
763
+ function formulaToLKLike(f) {
764
+ // LK no tiene `bottom` en este perfil; lo modelamos como atomo dedicado.
765
+ if (f.kind === 'bottom')
766
+ return { kind: 'atom', name: '⊥' };
767
+ if (f.kind === 'atom')
768
+ return { kind: 'atom', name: f.name };
769
+ if (f.kind === 'not')
770
+ return { kind: 'not', arg: formulaToLKLike(f.arg) };
771
+ if (f.kind === 'and')
772
+ return { kind: 'and', left: formulaToLKLike(f.left), right: formulaToLKLike(f.right) };
773
+ if (f.kind === 'or')
774
+ return { kind: 'or', left: formulaToLKLike(f.left), right: formulaToLKLike(f.right) };
775
+ return { kind: 'implies', left: formulaToLKLike(f.left), right: formulaToLKLike(f.right) };
776
+ }
777
+ function mapRuleLJtoLK(r) {
778
+ switch (r) {
779
+ case 'orR-l':
780
+ case 'orR-r':
781
+ return 'orR';
782
+ default:
783
+ return r;
784
+ }
785
+ }
786
+ /**
787
+ * Toda derivacion LJ es tambien una derivacion LK (con succedente
788
+ * a lo sumo unitario). La conversion es estructural: copia el arbol,
789
+ * usa right = [φ] o [] segun el secuente intuicionista, y mapea
790
+ * orR-l/orR-r → orR.
791
+ */
792
+ function ljToLk(proof) {
793
+ const convert = (p) => ({
794
+ goal: {
795
+ left: p.goal.left.map(formulaToLKLike),
796
+ right: p.goal.right ? [formulaToLKLike(p.goal.right)] : [],
797
+ },
798
+ rule: mapRuleLJtoLK(p.rule),
799
+ premises: p.premises.map(convert),
800
+ ...(p.cutFormula ? { cutFormula: formulaToLKLike(p.cutFormula) } : {}),
801
+ ...(p.principalFormula ? { principalFormula: formulaToLKLike(p.principalFormula) } : {}),
802
+ });
803
+ return convert(proof);
804
+ }
805
+ /**
806
+ * Conversion LK → LJ. Falla cuando la derivacion LK usa
807
+ * multisuccedente esencial (ej. LEM, doble negacion clasica).
808
+ * Estrategia: validar que cada secuente del arbol LK tenga
809
+ * succedente |Δ| ≤ 1; si no, rechazar con motivo.
810
+ */
811
+ function lkToLj(lkProof) {
812
+ if (lkProof === null || typeof lkProof !== 'object') {
813
+ return { rejected: 'entrada no es un LKProof' };
814
+ }
815
+ const lk = lkProof;
816
+ if (!lk.goal || !Array.isArray(lk.goal.left) || !Array.isArray(lk.goal.right)) {
817
+ return { rejected: 'estructura LKProof invalida' };
818
+ }
819
+ return convertLKtoLJ(lk);
820
+ }
821
+ function convertLKtoLJ(lk) {
822
+ if (lk.goal.right.length > 1) {
823
+ return {
824
+ rejected: `secuente LK con multisuccedente |Δ|=${lk.goal.right.length}; no traducible a LJ`,
825
+ };
826
+ }
827
+ const premises = [];
828
+ for (const sub of lk.premises) {
829
+ const r = convertLKtoLJ(sub);
830
+ if ('rejected' in r)
831
+ return r;
832
+ premises.push(r);
833
+ }
834
+ // Mapear reglas LK → LJ. Reglas exclusivas de LK (weakR, contrR, exR)
835
+ // no tienen analogo intuicionista; las rechazamos.
836
+ const ruleMap = {
837
+ axiom: 'axiom',
838
+ cut: 'cut',
839
+ weakL: 'weakL',
840
+ weakR: null,
841
+ contrL: 'contrL',
842
+ contrR: null,
843
+ exL: 'exL',
844
+ exR: null,
845
+ notL: 'notL',
846
+ notR: 'notR',
847
+ andL: 'andL',
848
+ andR: 'andR',
849
+ orL: 'orL',
850
+ orR: 'orR-l', // ambiguo: elegimos la rama izquierda por defecto
851
+ impL: 'impL',
852
+ impR: 'impR',
853
+ bottomL: 'bottomL',
854
+ };
855
+ const ljRule = ruleMap[lk.rule];
856
+ if (ljRule === undefined) {
857
+ return { rejected: `regla LK desconocida: ${lk.rule}` };
858
+ }
859
+ if (ljRule === null) {
860
+ return { rejected: `regla ${lk.rule} es exclusiva de LK (multisuccedente)` };
861
+ }
862
+ return {
863
+ goal: {
864
+ left: lk.goal.left.map(lkFormulaToLJ),
865
+ right: lk.goal.right.length === 0 ? null : lkFormulaToLJ(lk.goal.right[0]),
866
+ },
867
+ rule: ljRule,
868
+ premises,
869
+ ...(lk.cutFormula ? { cutFormula: lkFormulaToLJ(lk.cutFormula) } : {}),
870
+ ...(lk.principalFormula ? { principalFormula: lkFormulaToLJ(lk.principalFormula) } : {}),
871
+ };
872
+ }
873
+ function lkFormulaToLJ(f) {
874
+ if (!f || typeof f !== 'object') {
875
+ return { kind: 'atom', name: '?' };
876
+ }
877
+ const o = f;
878
+ switch (o.kind) {
879
+ case 'atom':
880
+ return { kind: 'atom', name: typeof o.name === 'string' ? o.name : '?' };
881
+ case 'not':
882
+ return { kind: 'not', arg: lkFormulaToLJ(o.arg) };
883
+ case 'and':
884
+ return { kind: 'and', left: lkFormulaToLJ(o.left), right: lkFormulaToLJ(o.right) };
885
+ case 'or':
886
+ return { kind: 'or', left: lkFormulaToLJ(o.left), right: lkFormulaToLJ(o.right) };
887
+ case 'implies':
888
+ return { kind: 'implies', left: lkFormulaToLJ(o.left), right: lkFormulaToLJ(o.right) };
889
+ default:
890
+ return { kind: 'atom', name: '?' };
891
+ }
892
+ }
893
+ // ============================================================
894
+ // Glivenko: clasico ⊢ φ sii intuicionista ⊢ ¬¬φ
895
+ // ============================================================
896
+ //
897
+ // Glivenko (1929) demostro que el fragmento proposicional clasico
898
+ // se traduce al intuicionista mediante doble negacion (Glivenko
899
+ // embedding). La traduccion mas simple es φ ↦ ¬¬φ.
900
+ function glivenkoEmbed(formula) {
901
+ return { kind: 'not', arg: { kind: 'not', arg: formula } };
902
+ }
903
+ //# sourceMappingURL=index.js.map