@stevenvo780/st-lang 4.2.0 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +70 -1
- package/dist/index.js.map +1 -1
- package/dist/lambda-calc/church.d.ts +8 -0
- package/dist/lambda-calc/church.d.ts.map +1 -0
- package/dist/lambda-calc/church.js +67 -0
- package/dist/lambda-calc/church.js.map +1 -0
- package/dist/lambda-calc/combinators.d.ts +8 -0
- package/dist/lambda-calc/combinators.d.ts.map +1 -0
- package/dist/lambda-calc/combinators.js +24 -0
- package/dist/lambda-calc/combinators.js.map +1 -0
- package/dist/lambda-calc/index.d.ts +8 -0
- package/dist/lambda-calc/index.d.ts.map +1 -0
- package/dist/lambda-calc/index.js +48 -0
- package/dist/lambda-calc/index.js.map +1 -0
- package/dist/lambda-calc/reduce.d.ts +18 -0
- package/dist/lambda-calc/reduce.d.ts.map +1 -0
- package/dist/lambda-calc/reduce.js +174 -0
- package/dist/lambda-calc/reduce.js.map +1 -0
- package/dist/lambda-calc/substitution.d.ts +6 -0
- package/dist/lambda-calc/substitution.d.ts.map +1 -0
- package/dist/lambda-calc/substitution.js +120 -0
- package/dist/lambda-calc/substitution.js.map +1 -0
- package/dist/lambda-calc/types.d.ts +19 -0
- package/dist/lambda-calc/types.d.ts.map +1 -0
- package/dist/lambda-calc/types.js +72 -0
- package/dist/lambda-calc/types.js.map +1 -0
- package/dist/mltt/equality.d.ts +9 -0
- package/dist/mltt/equality.d.ts.map +1 -0
- package/dist/mltt/equality.js +79 -0
- package/dist/mltt/equality.js.map +1 -0
- package/dist/mltt/index.d.ts +8 -0
- package/dist/mltt/index.d.ts.map +1 -0
- package/dist/mltt/index.js +49 -0
- package/dist/mltt/index.js.map +1 -0
- package/dist/mltt/infer.d.ts +17 -0
- package/dist/mltt/infer.d.ts.map +1 -0
- package/dist/mltt/infer.js +269 -0
- package/dist/mltt/infer.js.map +1 -0
- package/dist/mltt/normalize.d.ts +7 -0
- package/dist/mltt/normalize.d.ts.map +1 -0
- package/dist/mltt/normalize.js +131 -0
- package/dist/mltt/normalize.js.map +1 -0
- package/dist/mltt/substitute.d.ts +4 -0
- package/dist/mltt/substitute.d.ts.map +1 -0
- package/dist/mltt/substitute.js +94 -0
- package/dist/mltt/substitute.js.map +1 -0
- package/dist/mltt/types.d.ts +72 -0
- package/dist/mltt/types.d.ts.map +1 -0
- package/dist/mltt/types.js +211 -0
- package/dist/mltt/types.js.map +1 -0
- package/dist/profiles/intuitionistic-nj/formula.d.ts +19 -0
- package/dist/profiles/intuitionistic-nj/formula.d.ts.map +1 -0
- package/dist/profiles/intuitionistic-nj/formula.js +99 -0
- package/dist/profiles/intuitionistic-nj/formula.js.map +1 -0
- package/dist/profiles/intuitionistic-nj/index.d.ts +5 -0
- package/dist/profiles/intuitionistic-nj/index.d.ts.map +1 -0
- package/dist/profiles/intuitionistic-nj/index.js +24 -0
- package/dist/profiles/intuitionistic-nj/index.js.map +1 -0
- package/dist/profiles/intuitionistic-nj/kripke.d.ts +17 -0
- package/dist/profiles/intuitionistic-nj/kripke.d.ts.map +1 -0
- package/dist/profiles/intuitionistic-nj/kripke.js +206 -0
- package/dist/profiles/intuitionistic-nj/kripke.js.map +1 -0
- package/dist/profiles/intuitionistic-nj/prover.d.ts +13 -0
- package/dist/profiles/intuitionistic-nj/prover.d.ts.map +1 -0
- package/dist/profiles/intuitionistic-nj/prover.js +418 -0
- package/dist/profiles/intuitionistic-nj/prover.js.map +1 -0
- package/dist/profiles/intuitionistic-nj/types.d.ts +55 -0
- package/dist/profiles/intuitionistic-nj/types.d.ts.map +1 -0
- package/dist/profiles/intuitionistic-nj/types.js +21 -0
- package/dist/profiles/intuitionistic-nj/types.js.map +1 -0
- package/dist/profiles/many-valued/index.d.ts +39 -0
- package/dist/profiles/many-valued/index.d.ts.map +1 -0
- package/dist/profiles/many-valued/index.js +250 -0
- package/dist/profiles/many-valued/index.js.map +1 -0
- package/dist/profiles/modal-frame-axioms/formula.d.ts +23 -0
- package/dist/profiles/modal-frame-axioms/formula.d.ts.map +1 -0
- package/dist/profiles/modal-frame-axioms/formula.js +158 -0
- package/dist/profiles/modal-frame-axioms/formula.js.map +1 -0
- package/dist/profiles/modal-frame-axioms/index.d.ts +6 -0
- package/dist/profiles/modal-frame-axioms/index.d.ts.map +1 -0
- package/dist/profiles/modal-frame-axioms/index.js +41 -0
- package/dist/profiles/modal-frame-axioms/index.js.map +1 -0
- package/dist/profiles/modal-frame-axioms/systems.d.ts +29 -0
- package/dist/profiles/modal-frame-axioms/systems.d.ts.map +1 -0
- package/dist/profiles/modal-frame-axioms/systems.js +96 -0
- package/dist/profiles/modal-frame-axioms/systems.js.map +1 -0
- package/dist/profiles/modal-frame-axioms/tableau.d.ts +12 -0
- package/dist/profiles/modal-frame-axioms/tableau.d.ts.map +1 -0
- package/dist/profiles/modal-frame-axioms/tableau.js +299 -0
- package/dist/profiles/modal-frame-axioms/tableau.js.map +1 -0
- package/dist/profiles/modal-frame-axioms/types.d.ts +61 -0
- package/dist/profiles/modal-frame-axioms/types.d.ts.map +1 -0
- package/dist/profiles/modal-frame-axioms/types.js +27 -0
- package/dist/profiles/modal-frame-axioms/types.js.map +1 -0
- package/dist/profiles/mu-calculus/check.d.ts +15 -0
- package/dist/profiles/mu-calculus/check.d.ts.map +1 -0
- package/dist/profiles/mu-calculus/check.js +172 -0
- package/dist/profiles/mu-calculus/check.js.map +1 -0
- package/dist/profiles/mu-calculus/ctl-translate.d.ts +61 -0
- package/dist/profiles/mu-calculus/ctl-translate.d.ts.map +1 -0
- package/dist/profiles/mu-calculus/ctl-translate.js +181 -0
- package/dist/profiles/mu-calculus/ctl-translate.js.map +1 -0
- package/dist/profiles/mu-calculus/index.d.ts +7 -0
- package/dist/profiles/mu-calculus/index.d.ts.map +1 -0
- package/dist/profiles/mu-calculus/index.js +33 -0
- package/dist/profiles/mu-calculus/index.js.map +1 -0
- package/dist/profiles/mu-calculus/types.d.ts +51 -0
- package/dist/profiles/mu-calculus/types.d.ts.map +1 -0
- package/dist/profiles/mu-calculus/types.js +42 -0
- package/dist/profiles/mu-calculus/types.js.map +1 -0
- package/dist/profiles/mu-calculus/wellformed.d.ts +40 -0
- package/dist/profiles/mu-calculus/wellformed.d.ts.map +1 -0
- package/dist/profiles/mu-calculus/wellformed.js +160 -0
- package/dist/profiles/mu-calculus/wellformed.js.map +1 -0
- package/dist/profiles/sequent-lk/cut-elimination.d.ts +11 -0
- package/dist/profiles/sequent-lk/cut-elimination.d.ts.map +1 -0
- package/dist/profiles/sequent-lk/cut-elimination.js +216 -0
- package/dist/profiles/sequent-lk/cut-elimination.js.map +1 -0
- package/dist/profiles/sequent-lk/index.d.ts +5 -0
- package/dist/profiles/sequent-lk/index.d.ts.map +1 -0
- package/dist/profiles/sequent-lk/index.js +24 -0
- package/dist/profiles/sequent-lk/index.js.map +1 -0
- package/dist/profiles/sequent-lk/prover.d.ts +25 -0
- package/dist/profiles/sequent-lk/prover.d.ts.map +1 -0
- package/dist/profiles/sequent-lk/prover.js +532 -0
- package/dist/profiles/sequent-lk/prover.js.map +1 -0
- package/dist/profiles/sequent-lk/types.d.ts +55 -0
- package/dist/profiles/sequent-lk/types.d.ts.map +1 -0
- package/dist/profiles/sequent-lk/types.js +18 -0
- package/dist/profiles/sequent-lk/types.js.map +1 -0
- package/dist/profiles/sequent-lk/util.d.ts +18 -0
- package/dist/profiles/sequent-lk/util.d.ts.map +1 -0
- package/dist/profiles/sequent-lk/util.js +71 -0
- package/dist/profiles/sequent-lk/util.js.map +1 -0
- package/dist/profiles/substructural/index.d.ts +4 -0
- package/dist/profiles/substructural/index.d.ts.map +1 -0
- package/dist/profiles/substructural/index.js +22 -0
- package/dist/profiles/substructural/index.js.map +1 -0
- package/dist/profiles/substructural/prover.d.ts +13 -0
- package/dist/profiles/substructural/prover.d.ts.map +1 -0
- package/dist/profiles/substructural/prover.js +481 -0
- package/dist/profiles/substructural/prover.js.map +1 -0
- package/dist/profiles/substructural/types.d.ts +72 -0
- package/dist/profiles/substructural/types.d.ts.map +1 -0
- package/dist/profiles/substructural/types.js +27 -0
- package/dist/profiles/substructural/types.js.map +1 -0
- package/dist/refinement-types/checker.d.ts +19 -0
- package/dist/refinement-types/checker.d.ts.map +1 -0
- package/dist/refinement-types/checker.js +248 -0
- package/dist/refinement-types/checker.js.map +1 -0
- package/dist/refinement-types/index.d.ts +11 -0
- package/dist/refinement-types/index.d.ts.map +1 -0
- package/dist/refinement-types/index.js +51 -0
- package/dist/refinement-types/index.js.map +1 -0
- package/dist/refinement-types/predicate.d.ts +31 -0
- package/dist/refinement-types/predicate.d.ts.map +1 -0
- package/dist/refinement-types/predicate.js +369 -0
- package/dist/refinement-types/predicate.js.map +1 -0
- package/dist/refinement-types/solver.d.ts +24 -0
- package/dist/refinement-types/solver.d.ts.map +1 -0
- package/dist/refinement-types/solver.js +207 -0
- package/dist/refinement-types/solver.js.map +1 -0
- package/dist/refinement-types/subtype.d.ts +14 -0
- package/dist/refinement-types/subtype.d.ts.map +1 -0
- package/dist/refinement-types/subtype.js +39 -0
- package/dist/refinement-types/subtype.js.map +1 -0
- package/dist/refinement-types/types.d.ts +64 -0
- package/dist/refinement-types/types.d.ts.map +1 -0
- package/dist/refinement-types/types.js +130 -0
- package/dist/refinement-types/types.js.map +1 -0
- package/dist/runtime/abduction/entails.d.ts +21 -0
- package/dist/runtime/abduction/entails.d.ts.map +1 -0
- package/dist/runtime/abduction/entails.js +308 -0
- package/dist/runtime/abduction/entails.js.map +1 -0
- package/dist/runtime/abduction/find.d.ts +18 -0
- package/dist/runtime/abduction/find.d.ts.map +1 -0
- package/dist/runtime/abduction/find.js +202 -0
- package/dist/runtime/abduction/find.js.map +1 -0
- package/dist/runtime/abduction/index.d.ts +4 -0
- package/dist/runtime/abduction/index.d.ts.map +1 -0
- package/dist/runtime/abduction/index.js +26 -0
- package/dist/runtime/abduction/index.js.map +1 -0
- package/dist/runtime/abduction/types.d.ts +78 -0
- package/dist/runtime/abduction/types.d.ts.map +1 -0
- package/dist/runtime/abduction/types.js +23 -0
- package/dist/runtime/abduction/types.js.map +1 -0
- package/dist/runtime/anti-unification/anti-unify.d.ts +22 -0
- package/dist/runtime/anti-unification/anti-unify.d.ts.map +1 -0
- package/dist/runtime/anti-unification/anti-unify.js +154 -0
- package/dist/runtime/anti-unification/anti-unify.js.map +1 -0
- package/dist/runtime/anti-unification/index.d.ts +6 -0
- package/dist/runtime/anti-unification/index.d.ts.map +1 -0
- package/dist/runtime/anti-unification/index.js +23 -0
- package/dist/runtime/anti-unification/index.js.map +1 -0
- package/dist/runtime/anti-unification/many.d.ts +49 -0
- package/dist/runtime/anti-unification/many.d.ts.map +1 -0
- package/dist/runtime/anti-unification/many.js +185 -0
- package/dist/runtime/anti-unification/many.js.map +1 -0
- package/dist/runtime/anti-unification/term-utils.d.ts +40 -0
- package/dist/runtime/anti-unification/term-utils.d.ts.map +1 -0
- package/dist/runtime/anti-unification/term-utils.js +173 -0
- package/dist/runtime/anti-unification/term-utils.js.map +1 -0
- package/dist/runtime/anti-unification/types.d.ts +41 -0
- package/dist/runtime/anti-unification/types.d.ts.map +1 -0
- package/dist/runtime/anti-unification/types.js +26 -0
- package/dist/runtime/anti-unification/types.js.map +1 -0
- package/dist/runtime/bayesian/factor.d.ts +22 -0
- package/dist/runtime/bayesian/factor.d.ts.map +1 -0
- package/dist/runtime/bayesian/factor.js +249 -0
- package/dist/runtime/bayesian/factor.js.map +1 -0
- package/dist/runtime/bayesian/index.d.ts +3 -0
- package/dist/runtime/bayesian/index.d.ts.map +1 -0
- package/dist/runtime/bayesian/index.js +25 -0
- package/dist/runtime/bayesian/index.js.map +1 -0
- package/dist/runtime/bayesian/inference.d.ts +6 -0
- package/dist/runtime/bayesian/inference.d.ts.map +1 -0
- package/dist/runtime/bayesian/inference.js +260 -0
- package/dist/runtime/bayesian/inference.js.map +1 -0
- package/dist/runtime/bayesian/types.d.ts +19 -0
- package/dist/runtime/bayesian/types.d.ts.map +1 -0
- package/dist/runtime/bayesian/types.js +9 -0
- package/dist/runtime/bayesian/types.js.map +1 -0
- package/dist/runtime/bisimulation/index.d.ts +4 -0
- package/dist/runtime/bisimulation/index.d.ts.map +1 -0
- package/dist/runtime/bisimulation/index.js +21 -0
- package/dist/runtime/bisimulation/index.js.map +1 -0
- package/dist/runtime/bisimulation/operations.d.ts +40 -0
- package/dist/runtime/bisimulation/operations.d.ts.map +1 -0
- package/dist/runtime/bisimulation/operations.js +219 -0
- package/dist/runtime/bisimulation/operations.js.map +1 -0
- package/dist/runtime/bisimulation/paige-tarjan.d.ts +8 -0
- package/dist/runtime/bisimulation/paige-tarjan.d.ts.map +1 -0
- package/dist/runtime/bisimulation/paige-tarjan.js +199 -0
- package/dist/runtime/bisimulation/paige-tarjan.js.map +1 -0
- package/dist/runtime/bisimulation/types.d.ts +26 -0
- package/dist/runtime/bisimulation/types.d.ts.map +1 -0
- package/dist/runtime/bisimulation/types.js +22 -0
- package/dist/runtime/bisimulation/types.js.map +1 -0
- package/dist/runtime/csp/ac3.d.ts +20 -0
- package/dist/runtime/csp/ac3.d.ts.map +1 -0
- package/dist/runtime/csp/ac3.js +165 -0
- package/dist/runtime/csp/ac3.js.map +1 -0
- package/dist/runtime/csp/backtrack.d.ts +15 -0
- package/dist/runtime/csp/backtrack.d.ts.map +1 -0
- package/dist/runtime/csp/backtrack.js +233 -0
- package/dist/runtime/csp/backtrack.js.map +1 -0
- package/dist/runtime/csp/builtins.d.ts +27 -0
- package/dist/runtime/csp/builtins.d.ts.map +1 -0
- package/dist/runtime/csp/builtins.js +109 -0
- package/dist/runtime/csp/builtins.js.map +1 -0
- package/dist/runtime/csp/index.d.ts +5 -0
- package/dist/runtime/csp/index.d.ts.map +1 -0
- package/dist/runtime/csp/index.js +23 -0
- package/dist/runtime/csp/index.js.map +1 -0
- package/dist/runtime/csp/types.d.ts +54 -0
- package/dist/runtime/csp/types.d.ts.map +1 -0
- package/dist/runtime/csp/types.js +14 -0
- package/dist/runtime/csp/types.js.map +1 -0
- package/dist/runtime/fca/context.d.ts +46 -0
- package/dist/runtime/fca/context.d.ts.map +1 -0
- package/dist/runtime/fca/context.js +155 -0
- package/dist/runtime/fca/context.js.map +1 -0
- package/dist/runtime/fca/implications.d.ts +10 -0
- package/dist/runtime/fca/implications.d.ts.map +1 -0
- package/dist/runtime/fca/implications.js +33 -0
- package/dist/runtime/fca/implications.js.map +1 -0
- package/dist/runtime/fca/index.d.ts +6 -0
- package/dist/runtime/fca/index.d.ts.map +1 -0
- package/dist/runtime/fca/index.js +39 -0
- package/dist/runtime/fca/index.js.map +1 -0
- package/dist/runtime/fca/lattice.d.ts +10 -0
- package/dist/runtime/fca/lattice.d.ts.map +1 -0
- package/dist/runtime/fca/lattice.js +86 -0
- package/dist/runtime/fca/lattice.js.map +1 -0
- package/dist/runtime/fca/next-closure.d.ts +12 -0
- package/dist/runtime/fca/next-closure.d.ts.map +1 -0
- package/dist/runtime/fca/next-closure.js +99 -0
- package/dist/runtime/fca/next-closure.js.map +1 -0
- package/dist/runtime/fca/types.d.ts +31 -0
- package/dist/runtime/fca/types.d.ts.map +1 -0
- package/dist/runtime/fca/types.js +30 -0
- package/dist/runtime/fca/types.js.map +1 -0
- package/dist/runtime/markov-logic/grounding.d.ts +19 -0
- package/dist/runtime/markov-logic/grounding.d.ts.map +1 -0
- package/dist/runtime/markov-logic/grounding.js +252 -0
- package/dist/runtime/markov-logic/grounding.js.map +1 -0
- package/dist/runtime/markov-logic/index.d.ts +6 -0
- package/dist/runtime/markov-logic/index.d.ts.map +1 -0
- package/dist/runtime/markov-logic/index.js +47 -0
- package/dist/runtime/markov-logic/index.js.map +1 -0
- package/dist/runtime/markov-logic/inference.d.ts +77 -0
- package/dist/runtime/markov-logic/inference.d.ts.map +1 -0
- package/dist/runtime/markov-logic/inference.js +382 -0
- package/dist/runtime/markov-logic/inference.js.map +1 -0
- package/dist/runtime/markov-logic/parser.d.ts +25 -0
- package/dist/runtime/markov-logic/parser.d.ts.map +1 -0
- package/dist/runtime/markov-logic/parser.js +264 -0
- package/dist/runtime/markov-logic/parser.js.map +1 -0
- package/dist/runtime/markov-logic/types.d.ts +64 -0
- package/dist/runtime/markov-logic/types.d.ts.map +1 -0
- package/dist/runtime/markov-logic/types.js +17 -0
- package/dist/runtime/markov-logic/types.js.map +1 -0
- package/dist/runtime/pi-calculus/congruence.d.ts +15 -0
- package/dist/runtime/pi-calculus/congruence.d.ts.map +1 -0
- package/dist/runtime/pi-calculus/congruence.js +271 -0
- package/dist/runtime/pi-calculus/congruence.js.map +1 -0
- package/dist/runtime/pi-calculus/index.d.ts +6 -0
- package/dist/runtime/pi-calculus/index.d.ts.map +1 -0
- package/dist/runtime/pi-calculus/index.js +30 -0
- package/dist/runtime/pi-calculus/index.js.map +1 -0
- package/dist/runtime/pi-calculus/names.d.ts +28 -0
- package/dist/runtime/pi-calculus/names.d.ts.map +1 -0
- package/dist/runtime/pi-calculus/names.js +182 -0
- package/dist/runtime/pi-calculus/names.js.map +1 -0
- package/dist/runtime/pi-calculus/reduction.d.ts +25 -0
- package/dist/runtime/pi-calculus/reduction.d.ts.map +1 -0
- package/dist/runtime/pi-calculus/reduction.js +338 -0
- package/dist/runtime/pi-calculus/reduction.js.map +1 -0
- package/dist/runtime/pi-calculus/substitution.d.ts +11 -0
- package/dist/runtime/pi-calculus/substitution.d.ts.map +1 -0
- package/dist/runtime/pi-calculus/substitution.js +109 -0
- package/dist/runtime/pi-calculus/substitution.js.map +1 -0
- package/dist/runtime/pi-calculus/types.d.ts +38 -0
- package/dist/runtime/pi-calculus/types.d.ts.map +1 -0
- package/dist/runtime/pi-calculus/types.js +22 -0
- package/dist/runtime/pi-calculus/types.js.map +1 -0
- package/dist/runtime/planning/astar.d.ts +10 -0
- package/dist/runtime/planning/astar.d.ts.map +1 -0
- package/dist/runtime/planning/astar.js +155 -0
- package/dist/runtime/planning/astar.js.map +1 -0
- package/dist/runtime/planning/bfs.d.ts +17 -0
- package/dist/runtime/planning/bfs.d.ts.map +1 -0
- package/dist/runtime/planning/bfs.js +87 -0
- package/dist/runtime/planning/bfs.js.map +1 -0
- package/dist/runtime/planning/ground.d.ts +55 -0
- package/dist/runtime/planning/ground.d.ts.map +1 -0
- package/dist/runtime/planning/ground.js +154 -0
- package/dist/runtime/planning/ground.js.map +1 -0
- package/dist/runtime/planning/heuristic.d.ts +29 -0
- package/dist/runtime/planning/heuristic.d.ts.map +1 -0
- package/dist/runtime/planning/heuristic.js +172 -0
- package/dist/runtime/planning/heuristic.js.map +1 -0
- package/dist/runtime/planning/index.d.ts +6 -0
- package/dist/runtime/planning/index.d.ts.map +1 -0
- package/dist/runtime/planning/index.js +38 -0
- package/dist/runtime/planning/index.js.map +1 -0
- package/dist/runtime/planning/types.d.ts +100 -0
- package/dist/runtime/planning/types.d.ts.map +1 -0
- package/dist/runtime/planning/types.js +22 -0
- package/dist/runtime/planning/types.js.map +1 -0
- package/dist/runtime/proof-minify/index.d.ts +3 -0
- package/dist/runtime/proof-minify/index.d.ts.map +1 -0
- package/dist/runtime/proof-minify/index.js +13 -0
- package/dist/runtime/proof-minify/index.js.map +1 -0
- package/dist/runtime/proof-minify/minify.d.ts +13 -0
- package/dist/runtime/proof-minify/minify.d.ts.map +1 -0
- package/dist/runtime/proof-minify/minify.js +540 -0
- package/dist/runtime/proof-minify/minify.js.map +1 -0
- package/dist/runtime/proof-minify/types.d.ts +89 -0
- package/dist/runtime/proof-minify/types.d.ts.map +1 -0
- package/dist/runtime/proof-minify/types.js +16 -0
- package/dist/runtime/proof-minify/types.js.map +1 -0
- package/dist/runtime/symbolic-diff/constructors.d.ts +16 -0
- package/dist/runtime/symbolic-diff/constructors.d.ts.map +1 -0
- package/dist/runtime/symbolic-diff/constructors.js +75 -0
- package/dist/runtime/symbolic-diff/constructors.js.map +1 -0
- package/dist/runtime/symbolic-diff/differentiate.d.ts +22 -0
- package/dist/runtime/symbolic-diff/differentiate.d.ts.map +1 -0
- package/dist/runtime/symbolic-diff/differentiate.js +107 -0
- package/dist/runtime/symbolic-diff/differentiate.js.map +1 -0
- package/dist/runtime/symbolic-diff/evaluate.d.ts +3 -0
- package/dist/runtime/symbolic-diff/evaluate.d.ts.map +1 -0
- package/dist/runtime/symbolic-diff/evaluate.js +47 -0
- package/dist/runtime/symbolic-diff/evaluate.js.map +1 -0
- package/dist/runtime/symbolic-diff/index.d.ts +9 -0
- package/dist/runtime/symbolic-diff/index.d.ts.map +1 -0
- package/dist/runtime/symbolic-diff/index.js +34 -0
- package/dist/runtime/symbolic-diff/index.js.map +1 -0
- package/dist/runtime/symbolic-diff/parse.d.ts +16 -0
- package/dist/runtime/symbolic-diff/parse.d.ts.map +1 -0
- package/dist/runtime/symbolic-diff/parse.js +212 -0
- package/dist/runtime/symbolic-diff/parse.js.map +1 -0
- package/dist/runtime/symbolic-diff/simplify.d.ts +11 -0
- package/dist/runtime/symbolic-diff/simplify.d.ts.map +1 -0
- package/dist/runtime/symbolic-diff/simplify.js +214 -0
- package/dist/runtime/symbolic-diff/simplify.js.map +1 -0
- package/dist/runtime/symbolic-diff/stringify.d.ts +3 -0
- package/dist/runtime/symbolic-diff/stringify.d.ts.map +1 -0
- package/dist/runtime/symbolic-diff/stringify.js +69 -0
- package/dist/runtime/symbolic-diff/stringify.js.map +1 -0
- package/dist/runtime/symbolic-diff/types.d.ts +35 -0
- package/dist/runtime/symbolic-diff/types.d.ts.map +1 -0
- package/dist/runtime/symbolic-diff/types.js +9 -0
- package/dist/runtime/symbolic-diff/types.js.map +1 -0
- package/dist/runtime/term-rewriting/critical-pairs.d.ts +38 -0
- package/dist/runtime/term-rewriting/critical-pairs.d.ts.map +1 -0
- package/dist/runtime/term-rewriting/critical-pairs.js +109 -0
- package/dist/runtime/term-rewriting/critical-pairs.js.map +1 -0
- package/dist/runtime/term-rewriting/index.d.ts +9 -0
- package/dist/runtime/term-rewriting/index.d.ts.map +1 -0
- package/dist/runtime/term-rewriting/index.js +38 -0
- package/dist/runtime/term-rewriting/index.js.map +1 -0
- package/dist/runtime/term-rewriting/knuth-bendix.d.ts +29 -0
- package/dist/runtime/term-rewriting/knuth-bendix.d.ts.map +1 -0
- package/dist/runtime/term-rewriting/knuth-bendix.js +196 -0
- package/dist/runtime/term-rewriting/knuth-bendix.js.map +1 -0
- package/dist/runtime/term-rewriting/lpo.d.ts +17 -0
- package/dist/runtime/term-rewriting/lpo.d.ts.map +1 -0
- package/dist/runtime/term-rewriting/lpo.js +158 -0
- package/dist/runtime/term-rewriting/lpo.js.map +1 -0
- package/dist/runtime/term-rewriting/rewrite.d.ts +44 -0
- package/dist/runtime/term-rewriting/rewrite.d.ts.map +1 -0
- package/dist/runtime/term-rewriting/rewrite.js +189 -0
- package/dist/runtime/term-rewriting/rewrite.js.map +1 -0
- package/dist/runtime/term-rewriting/term-utils.d.ts +64 -0
- package/dist/runtime/term-rewriting/term-utils.d.ts.map +1 -0
- package/dist/runtime/term-rewriting/term-utils.js +360 -0
- package/dist/runtime/term-rewriting/term-utils.js.map +1 -0
- package/dist/runtime/term-rewriting/types.d.ts +66 -0
- package/dist/runtime/term-rewriting/types.d.ts.map +1 -0
- package/dist/runtime/term-rewriting/types.js +21 -0
- package/dist/runtime/term-rewriting/types.js.map +1 -0
- package/dist/runtime/theorem-cache/cache.d.ts +100 -0
- package/dist/runtime/theorem-cache/cache.d.ts.map +1 -0
- package/dist/runtime/theorem-cache/cache.js +213 -0
- package/dist/runtime/theorem-cache/cache.js.map +1 -0
- package/dist/runtime/theorem-cache/canonical.d.ts +59 -0
- package/dist/runtime/theorem-cache/canonical.d.ts.map +1 -0
- package/dist/runtime/theorem-cache/canonical.js +105 -0
- package/dist/runtime/theorem-cache/canonical.js.map +1 -0
- package/dist/runtime/theorem-cache/index.d.ts +6 -0
- package/dist/runtime/theorem-cache/index.d.ts.map +1 -0
- package/dist/runtime/theorem-cache/index.js +16 -0
- package/dist/runtime/theorem-cache/index.js.map +1 -0
- package/dist/runtime/theorem-cache/pattern.d.ts +24 -0
- package/dist/runtime/theorem-cache/pattern.d.ts.map +1 -0
- package/dist/runtime/theorem-cache/pattern.js +80 -0
- package/dist/runtime/theorem-cache/pattern.js.map +1 -0
- package/dist/system-f/index.d.ts +7 -0
- package/dist/system-f/index.d.ts.map +1 -0
- package/dist/system-f/index.js +48 -0
- package/dist/system-f/index.js.map +1 -0
- package/dist/system-f/infer.d.ts +9 -0
- package/dist/system-f/infer.d.ts.map +1 -0
- package/dist/system-f/infer.js +94 -0
- package/dist/system-f/infer.js.map +1 -0
- package/dist/system-f/reduce.d.ts +15 -0
- package/dist/system-f/reduce.d.ts.map +1 -0
- package/dist/system-f/reduce.js +259 -0
- package/dist/system-f/reduce.js.map +1 -0
- package/dist/system-f/types.d.ts +53 -0
- package/dist/system-f/types.d.ts.map +1 -0
- package/dist/system-f/types.js +157 -0
- package/dist/system-f/types.js.map +1 -0
- package/dist/tests/abduction/abduction.test.d.ts +2 -0
- package/dist/tests/abduction/abduction.test.d.ts.map +1 -0
- package/dist/tests/abduction/abduction.test.js +380 -0
- package/dist/tests/abduction/abduction.test.js.map +1 -0
- package/dist/tests/anti-unification/anti-unify.test.d.ts +2 -0
- package/dist/tests/anti-unification/anti-unify.test.d.ts.map +1 -0
- package/dist/tests/anti-unification/anti-unify.test.js +219 -0
- package/dist/tests/anti-unification/anti-unify.test.js.map +1 -0
- package/dist/tests/bayesian/bayesian.test.d.ts +2 -0
- package/dist/tests/bayesian/bayesian.test.d.ts.map +1 -0
- package/dist/tests/bayesian/bayesian.test.js +328 -0
- package/dist/tests/bayesian/bayesian.test.js.map +1 -0
- package/dist/tests/bisimulation/paige-tarjan.test.d.ts +2 -0
- package/dist/tests/bisimulation/paige-tarjan.test.d.ts.map +1 -0
- package/dist/tests/bisimulation/paige-tarjan.test.js +254 -0
- package/dist/tests/bisimulation/paige-tarjan.test.js.map +1 -0
- package/dist/tests/coverage-fill-aristotelian.test.js +1 -1
- package/dist/tests/coverage-fill-aristotelian.test.js.map +1 -1
- package/dist/tests/coverage-fill-fallacies.test.js +1 -1
- package/dist/tests/coverage-fill-fallacies.test.js.map +1 -1
- package/dist/tests/coverage-fill-format.test.js +1 -1
- package/dist/tests/coverage-fill-format.test.js.map +1 -1
- package/dist/tests/coverage-fill-intuitionistic.test.js +1 -1
- package/dist/tests/coverage-fill-intuitionistic.test.js.map +1 -1
- package/dist/tests/coverage-fill-probabilistic.test.js +1 -1
- package/dist/tests/coverage-fill-probabilistic.test.js.map +1 -1
- package/dist/tests/csp/csp.test.d.ts +2 -0
- package/dist/tests/csp/csp.test.d.ts.map +1 -0
- package/dist/tests/csp/csp.test.js +292 -0
- package/dist/tests/csp/csp.test.js.map +1 -0
- package/dist/tests/fca/fca.test.d.ts +2 -0
- package/dist/tests/fca/fca.test.d.ts.map +1 -0
- package/dist/tests/fca/fca.test.js +317 -0
- package/dist/tests/fca/fca.test.js.map +1 -0
- package/dist/tests/intuitionistic-nj/nj.test.d.ts +2 -0
- package/dist/tests/intuitionistic-nj/nj.test.d.ts.map +1 -0
- package/dist/tests/intuitionistic-nj/nj.test.js +216 -0
- package/dist/tests/intuitionistic-nj/nj.test.js.map +1 -0
- package/dist/tests/lambda-calc/lambda-calc.test.d.ts +2 -0
- package/dist/tests/lambda-calc/lambda-calc.test.d.ts.map +1 -0
- package/dist/tests/lambda-calc/lambda-calc.test.js +164 -0
- package/dist/tests/lambda-calc/lambda-calc.test.js.map +1 -0
- package/dist/tests/many-valued/many-valued.test.d.ts +2 -0
- package/dist/tests/many-valued/many-valued.test.d.ts.map +1 -0
- package/dist/tests/many-valued/many-valued.test.js +150 -0
- package/dist/tests/many-valued/many-valued.test.js.map +1 -0
- package/dist/tests/markov-logic/markov-logic.test.d.ts +2 -0
- package/dist/tests/markov-logic/markov-logic.test.d.ts.map +1 -0
- package/dist/tests/markov-logic/markov-logic.test.js +349 -0
- package/dist/tests/markov-logic/markov-logic.test.js.map +1 -0
- package/dist/tests/mltt/mltt.test.d.ts +2 -0
- package/dist/tests/mltt/mltt.test.d.ts.map +1 -0
- package/dist/tests/mltt/mltt.test.js +181 -0
- package/dist/tests/mltt/mltt.test.js.map +1 -0
- package/dist/tests/modal-frame-axioms/frame-axioms.test.d.ts +2 -0
- package/dist/tests/modal-frame-axioms/frame-axioms.test.d.ts.map +1 -0
- package/dist/tests/modal-frame-axioms/frame-axioms.test.js +236 -0
- package/dist/tests/modal-frame-axioms/frame-axioms.test.js.map +1 -0
- package/dist/tests/mu-calculus/check.test.d.ts +2 -0
- package/dist/tests/mu-calculus/check.test.d.ts.map +1 -0
- package/dist/tests/mu-calculus/check.test.js +234 -0
- package/dist/tests/mu-calculus/check.test.js.map +1 -0
- package/dist/tests/pi-calculus/pi-calculus.test.d.ts +2 -0
- package/dist/tests/pi-calculus/pi-calculus.test.d.ts.map +1 -0
- package/dist/tests/pi-calculus/pi-calculus.test.js +273 -0
- package/dist/tests/pi-calculus/pi-calculus.test.js.map +1 -0
- package/dist/tests/planning/planning.test.d.ts +2 -0
- package/dist/tests/planning/planning.test.d.ts.map +1 -0
- package/dist/tests/planning/planning.test.js +397 -0
- package/dist/tests/planning/planning.test.js.map +1 -0
- package/dist/tests/proof-minify/minify.test.d.ts +2 -0
- package/dist/tests/proof-minify/minify.test.d.ts.map +1 -0
- package/dist/tests/proof-minify/minify.test.js +281 -0
- package/dist/tests/proof-minify/minify.test.js.map +1 -0
- package/dist/tests/refinement-types/refinement-types.test.d.ts +2 -0
- package/dist/tests/refinement-types/refinement-types.test.d.ts.map +1 -0
- package/dist/tests/refinement-types/refinement-types.test.js +174 -0
- package/dist/tests/refinement-types/refinement-types.test.js.map +1 -0
- package/dist/tests/sequent-lk/prover.test.d.ts +2 -0
- package/dist/tests/sequent-lk/prover.test.d.ts.map +1 -0
- package/dist/tests/sequent-lk/prover.test.js +317 -0
- package/dist/tests/sequent-lk/prover.test.js.map +1 -0
- package/dist/tests/substructural/prover.test.d.ts +2 -0
- package/dist/tests/substructural/prover.test.d.ts.map +1 -0
- package/dist/tests/substructural/prover.test.js +271 -0
- package/dist/tests/substructural/prover.test.js.map +1 -0
- package/dist/tests/symbolic-diff/symbolic-diff.test.d.ts +2 -0
- package/dist/tests/symbolic-diff/symbolic-diff.test.d.ts.map +1 -0
- package/dist/tests/symbolic-diff/symbolic-diff.test.js +278 -0
- package/dist/tests/symbolic-diff/symbolic-diff.test.js.map +1 -0
- package/dist/tests/system-f/system-f.test.d.ts +2 -0
- package/dist/tests/system-f/system-f.test.d.ts.map +1 -0
- package/dist/tests/system-f/system-f.test.js +217 -0
- package/dist/tests/system-f/system-f.test.js.map +1 -0
- package/dist/tests/term-rewriting/critical-pairs.test.d.ts +2 -0
- package/dist/tests/term-rewriting/critical-pairs.test.d.ts.map +1 -0
- package/dist/tests/term-rewriting/critical-pairs.test.js +34 -0
- package/dist/tests/term-rewriting/critical-pairs.test.js.map +1 -0
- package/dist/tests/term-rewriting/knuth-bendix.test.d.ts +2 -0
- package/dist/tests/term-rewriting/knuth-bendix.test.d.ts.map +1 -0
- package/dist/tests/term-rewriting/knuth-bendix.test.js +94 -0
- package/dist/tests/term-rewriting/knuth-bendix.test.js.map +1 -0
- package/dist/tests/term-rewriting/lpo.test.d.ts +2 -0
- package/dist/tests/term-rewriting/lpo.test.d.ts.map +1 -0
- package/dist/tests/term-rewriting/lpo.test.js +57 -0
- package/dist/tests/term-rewriting/lpo.test.js.map +1 -0
- package/dist/tests/term-rewriting/rewrite.test.d.ts +2 -0
- package/dist/tests/term-rewriting/rewrite.test.d.ts.map +1 -0
- package/dist/tests/term-rewriting/rewrite.test.js +56 -0
- package/dist/tests/term-rewriting/rewrite.test.js.map +1 -0
- package/dist/tests/term-rewriting/term-utils.test.d.ts +2 -0
- package/dist/tests/term-rewriting/term-utils.test.d.ts.map +1 -0
- package/dist/tests/term-rewriting/term-utils.test.js +58 -0
- package/dist/tests/term-rewriting/term-utils.test.js.map +1 -0
- package/dist/tests/theorem-cache/cache.test.d.ts +2 -0
- package/dist/tests/theorem-cache/cache.test.d.ts.map +1 -0
- package/dist/tests/theorem-cache/cache.test.js +510 -0
- package/dist/tests/theorem-cache/cache.test.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TheoremCache = void 0;
|
|
7
|
+
exports.tryReuseProof = tryReuseProof;
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const os_1 = __importDefault(require("os"));
|
|
11
|
+
const crypto_1 = require("crypto");
|
|
12
|
+
const canonical_1 = require("./canonical");
|
|
13
|
+
const pattern_1 = require("./pattern");
|
|
14
|
+
function defaultPersistPath() {
|
|
15
|
+
return path_1.default.join(os_1.default.homedir(), '.st-theorem-cache', 'theorems.json');
|
|
16
|
+
}
|
|
17
|
+
function defaultHash(input) {
|
|
18
|
+
return (0, crypto_1.createHash)('sha1').update(input).digest('hex');
|
|
19
|
+
}
|
|
20
|
+
class TheoremCache {
|
|
21
|
+
maxEntries;
|
|
22
|
+
persistPath;
|
|
23
|
+
hashFn;
|
|
24
|
+
entries = new Map();
|
|
25
|
+
hits = 0;
|
|
26
|
+
misses = 0;
|
|
27
|
+
constructor(opts) {
|
|
28
|
+
this.maxEntries = opts?.maxEntries ?? 10000;
|
|
29
|
+
this.persistPath = opts?.persistPath ?? defaultPersistPath();
|
|
30
|
+
this.hashFn = opts?.hashFn ?? defaultHash;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Canonicaliza una fórmula a forma estable (placeholders).
|
|
34
|
+
*/
|
|
35
|
+
canonicalize(formula) {
|
|
36
|
+
return (0, canonical_1.canonicalize)(formula).canonical;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Almacena un teorema; retorna el id asignado. Si ya existe una
|
|
40
|
+
* entrada con el mismo (formula canónica, profile), la reemplaza
|
|
41
|
+
* y la promueve a MRU.
|
|
42
|
+
*/
|
|
43
|
+
store(theorem) {
|
|
44
|
+
const normalized = theorem.normalizedFormula && theorem.normalizedFormula.length > 0
|
|
45
|
+
? theorem.normalizedFormula
|
|
46
|
+
: this.canonicalize(theorem.formula);
|
|
47
|
+
const id = this.hashFn(`${theorem.profile}::${normalized}`);
|
|
48
|
+
const full = { ...theorem, normalizedFormula: normalized, id };
|
|
49
|
+
if (this.entries.has(id)) {
|
|
50
|
+
this.entries.delete(id);
|
|
51
|
+
}
|
|
52
|
+
else if (this.entries.size >= this.maxEntries) {
|
|
53
|
+
this.evictLru();
|
|
54
|
+
}
|
|
55
|
+
this.entries.set(id, { theorem: full });
|
|
56
|
+
return id;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Devuelve el teorema cacheado para una fórmula+profile dados, o
|
|
60
|
+
* `undefined` si no existe. Incrementa hits/misses.
|
|
61
|
+
*/
|
|
62
|
+
retrieve(formula, profile) {
|
|
63
|
+
const normalized = this.canonicalize(formula);
|
|
64
|
+
const id = this.hashFn(`${profile}::${normalized}`);
|
|
65
|
+
const entry = this.entries.get(id);
|
|
66
|
+
if (entry === undefined) {
|
|
67
|
+
this.misses++;
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
this.hits++;
|
|
71
|
+
// LRU promote.
|
|
72
|
+
this.entries.delete(id);
|
|
73
|
+
this.entries.set(id, entry);
|
|
74
|
+
return entry.theorem;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Retorna todos los teoremas que matchean el patrón dado.
|
|
78
|
+
*
|
|
79
|
+
* El patrón usa metavariables `?x`. Ej: `?x -> ?x` matchea cualquier
|
|
80
|
+
* teorema cacheado cuya fórmula sea `<id> -> <id>` (mismo lado).
|
|
81
|
+
*
|
|
82
|
+
* El matching opera sobre la fórmula original (no la canónica), de
|
|
83
|
+
* modo que el caller puede inspeccionar los nombres reales.
|
|
84
|
+
*/
|
|
85
|
+
retrieveByPattern(pattern) {
|
|
86
|
+
const out = [];
|
|
87
|
+
for (const { theorem } of this.entries.values()) {
|
|
88
|
+
if ((0, pattern_1.matchPattern)(pattern, theorem.formula) !== undefined) {
|
|
89
|
+
out.push(theorem);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return out;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Comprueba si existe una entrada para (formula, profile). NO afecta
|
|
96
|
+
* los contadores hits/misses.
|
|
97
|
+
*/
|
|
98
|
+
exists(formula, profile) {
|
|
99
|
+
const normalized = this.canonicalize(formula);
|
|
100
|
+
const id = this.hashFn(`${profile}::${normalized}`);
|
|
101
|
+
return this.entries.has(id);
|
|
102
|
+
}
|
|
103
|
+
remove(id) {
|
|
104
|
+
return this.entries.delete(id);
|
|
105
|
+
}
|
|
106
|
+
clear() {
|
|
107
|
+
this.entries.clear();
|
|
108
|
+
this.hits = 0;
|
|
109
|
+
this.misses = 0;
|
|
110
|
+
}
|
|
111
|
+
async saveToDisk() {
|
|
112
|
+
const dir = path_1.default.dirname(this.persistPath);
|
|
113
|
+
await fs_1.promises.mkdir(dir, { recursive: true });
|
|
114
|
+
const payload = [];
|
|
115
|
+
for (const { theorem } of this.entries.values())
|
|
116
|
+
payload.push(theorem);
|
|
117
|
+
await fs_1.promises.writeFile(this.persistPath, JSON.stringify(payload), 'utf-8');
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Carga teoremas desde disco. Devuelve cuántas entradas cargó.
|
|
121
|
+
* No-op silencioso si el archivo no existe.
|
|
122
|
+
*/
|
|
123
|
+
async loadFromDisk() {
|
|
124
|
+
let raw;
|
|
125
|
+
try {
|
|
126
|
+
raw = await fs_1.promises.readFile(this.persistPath, 'utf-8');
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
return 0;
|
|
130
|
+
}
|
|
131
|
+
let parsed;
|
|
132
|
+
try {
|
|
133
|
+
parsed = JSON.parse(raw);
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
return 0;
|
|
137
|
+
}
|
|
138
|
+
if (!Array.isArray(parsed))
|
|
139
|
+
return 0;
|
|
140
|
+
let loaded = 0;
|
|
141
|
+
for (const item of parsed) {
|
|
142
|
+
if (!item || typeof item !== 'object')
|
|
143
|
+
continue;
|
|
144
|
+
const t = item;
|
|
145
|
+
if (typeof t.id !== 'string' ||
|
|
146
|
+
typeof t.formula !== 'string' ||
|
|
147
|
+
typeof t.normalizedFormula !== 'string' ||
|
|
148
|
+
typeof t.profile !== 'string' ||
|
|
149
|
+
!t.metadata ||
|
|
150
|
+
typeof t.metadata !== 'object') {
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
if (this.entries.has(t.id))
|
|
154
|
+
continue;
|
|
155
|
+
if (this.entries.size >= this.maxEntries)
|
|
156
|
+
break;
|
|
157
|
+
this.entries.set(t.id, { theorem: t });
|
|
158
|
+
loaded++;
|
|
159
|
+
}
|
|
160
|
+
return loaded;
|
|
161
|
+
}
|
|
162
|
+
stats() {
|
|
163
|
+
let bytes = 0;
|
|
164
|
+
for (const { theorem } of this.entries.values()) {
|
|
165
|
+
bytes += JSON.stringify(theorem).length;
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
entries: this.entries.size,
|
|
169
|
+
hits: this.hits,
|
|
170
|
+
misses: this.misses,
|
|
171
|
+
storedBytes: bytes,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
evictLru() {
|
|
175
|
+
const firstKey = this.entries.keys().next().value;
|
|
176
|
+
if (firstKey !== undefined)
|
|
177
|
+
this.entries.delete(firstKey);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
exports.TheoremCache = TheoremCache;
|
|
181
|
+
/**
|
|
182
|
+
* Intenta reusar la prueba de un teorema cacheado para un target
|
|
183
|
+
* dado. Si las fórmulas son canónicamente equivalentes (misma
|
|
184
|
+
* estructura, identificadores en el mismo orden), calcula la
|
|
185
|
+
* substitución y reemplaza los nombres en la prueba (cuando la
|
|
186
|
+
* prueba es un string o un objeto JSON que la admita textualmente).
|
|
187
|
+
*
|
|
188
|
+
* Para pruebas opacas no-string, devuelve la prueba original sin
|
|
189
|
+
* tocar — el caller es responsable de re-instanciar.
|
|
190
|
+
*/
|
|
191
|
+
function tryReuseProof(theorem, targetFormula) {
|
|
192
|
+
const substitution = (0, canonical_1.computeSubstitution)(theorem.formula, targetFormula);
|
|
193
|
+
if (substitution === undefined) {
|
|
194
|
+
return { reusable: false };
|
|
195
|
+
}
|
|
196
|
+
let reusedProof = theorem.proof;
|
|
197
|
+
if (typeof theorem.proof === 'string') {
|
|
198
|
+
reusedProof = (0, canonical_1.applySubstitution)(theorem.proof, substitution);
|
|
199
|
+
}
|
|
200
|
+
else if (theorem.proof && typeof theorem.proof === 'object') {
|
|
201
|
+
// Substitución textual sobre la serialización JSON.
|
|
202
|
+
try {
|
|
203
|
+
const serialized = JSON.stringify(theorem.proof);
|
|
204
|
+
const rewritten = (0, canonical_1.applySubstitution)(serialized, substitution);
|
|
205
|
+
reusedProof = JSON.parse(rewritten);
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
reusedProof = theorem.proof;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return { reusable: true, substitution, reusedProof };
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../src/runtime/theorem-cache/cache.ts"],"names":[],"mappings":";;;;;;AAwPA,sCAqBC;AA7QD,2BAAqC;AACrC,gDAAwB;AACxB,4CAAoB;AACpB,mCAAoC;AACpC,2CAAmF;AACnF,uCAAyC;AA6CzC,SAAS,kBAAkB;IACzB,OAAO,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,OAAO,EAA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SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACjD,MAAM,SAAS,GAAG,IAAA,6BAAiB,EAAC,UAAU,EAAE,YAAY,CAAC,CAAC;YAC9D,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACtC,CAAC;QAAC,MAAM,CAAC;YACP,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC;QAC9B,CAAC;IACH,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonicalización de fórmulas (string-based) para el theorem cache.
|
|
3
|
+
*
|
|
4
|
+
* El objetivo no es parsear lógica completa, sino normalizar:
|
|
5
|
+
* - whitespace
|
|
6
|
+
* - mapear identificadores (átomos / metavariables) a placeholders
|
|
7
|
+
* canónicos en orden de primera aparición, preservando estructura.
|
|
8
|
+
*
|
|
9
|
+
* Resultado: `P -> P` y `Q -> Q` producen la misma forma canónica
|
|
10
|
+
* (`?0 -> ?0`), mientras que `P -> Q` produce `?0 -> ?1`. Esto soporta
|
|
11
|
+
* proof reuse via substitución.
|
|
12
|
+
*
|
|
13
|
+
* Símbolos lógicos reservados (palabras clave) NO se renombran:
|
|
14
|
+
* not, and, or, implies, iff, forall, exists, true, false, ->,
|
|
15
|
+
* →, ∧, ∨, ¬, ↔, ∀, ∃, ⊤, ⊥
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Normaliza whitespace: colapsa runs de espacio/tabs/newlines a un solo
|
|
19
|
+
* espacio, y trimea. Mantiene la separación de tokens.
|
|
20
|
+
*/
|
|
21
|
+
export declare function normalizeWhitespace(formula: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Devuelve la forma canónica de una fórmula como string.
|
|
24
|
+
*
|
|
25
|
+
* Cada identificador no reservado se reemplaza por `?N` donde N es el
|
|
26
|
+
* orden de primera aparición. La estructura (operadores, paréntesis,
|
|
27
|
+
* cuantificadores) se preserva intacta tras normalizar whitespace.
|
|
28
|
+
*
|
|
29
|
+
* También devuelve el mapping inverso (canonical → original) para
|
|
30
|
+
* poder reconstruir substituciones.
|
|
31
|
+
*/
|
|
32
|
+
export interface CanonicalResult {
|
|
33
|
+
canonical: string;
|
|
34
|
+
/** Mapping de original → placeholder. Ej: `{P: "?0", Q: "?1"}` */
|
|
35
|
+
forward: Map<string, string>;
|
|
36
|
+
/** Mapping de placeholder → original. Ej: `{"?0": "P", "?1": "Q"}` */
|
|
37
|
+
reverse: Map<string, string>;
|
|
38
|
+
}
|
|
39
|
+
export declare function canonicalize(formula: string): CanonicalResult;
|
|
40
|
+
/**
|
|
41
|
+
* Versión simple que sólo devuelve el string canónico.
|
|
42
|
+
*/
|
|
43
|
+
export declare function canonicalString(formula: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Intenta encontrar una substitución que mapee la fórmula cacheada
|
|
46
|
+
* al target. Si las formas canónicas coinciden, calcula el mapping
|
|
47
|
+
* desde los identificadores originales del teorema hacia los del
|
|
48
|
+
* target.
|
|
49
|
+
*
|
|
50
|
+
* Retorna `undefined` si no son canónicamente equivalentes.
|
|
51
|
+
*/
|
|
52
|
+
export declare function computeSubstitution(cachedFormula: string, targetFormula: string): Record<string, string> | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Aplica una substitución textual (mapping original → reemplazo) a
|
|
55
|
+
* una fórmula, respetando límites de identificador. Útil para
|
|
56
|
+
* rehidratar pruebas reutilizadas.
|
|
57
|
+
*/
|
|
58
|
+
export declare function applySubstitution(formula: string, substitution: Record<string, string>): string;
|
|
59
|
+
//# sourceMappingURL=canonical.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical.d.ts","sourceRoot":"","sources":["../../../src/runtime/theorem-cache/canonical.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAoBH;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,sEAAsE;IACtE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAkB7D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,GACpB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAapC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAK/F"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Canonicalización de fórmulas (string-based) para el theorem cache.
|
|
4
|
+
*
|
|
5
|
+
* El objetivo no es parsear lógica completa, sino normalizar:
|
|
6
|
+
* - whitespace
|
|
7
|
+
* - mapear identificadores (átomos / metavariables) a placeholders
|
|
8
|
+
* canónicos en orden de primera aparición, preservando estructura.
|
|
9
|
+
*
|
|
10
|
+
* Resultado: `P -> P` y `Q -> Q` producen la misma forma canónica
|
|
11
|
+
* (`?0 -> ?0`), mientras que `P -> Q` produce `?0 -> ?1`. Esto soporta
|
|
12
|
+
* proof reuse via substitución.
|
|
13
|
+
*
|
|
14
|
+
* Símbolos lógicos reservados (palabras clave) NO se renombran:
|
|
15
|
+
* not, and, or, implies, iff, forall, exists, true, false, ->,
|
|
16
|
+
* →, ∧, ∨, ¬, ↔, ∀, ∃, ⊤, ⊥
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.normalizeWhitespace = normalizeWhitespace;
|
|
20
|
+
exports.canonicalize = canonicalize;
|
|
21
|
+
exports.canonicalString = canonicalString;
|
|
22
|
+
exports.computeSubstitution = computeSubstitution;
|
|
23
|
+
exports.applySubstitution = applySubstitution;
|
|
24
|
+
const RESERVED = new Set([
|
|
25
|
+
'not',
|
|
26
|
+
'and',
|
|
27
|
+
'or',
|
|
28
|
+
'implies',
|
|
29
|
+
'iff',
|
|
30
|
+
'forall',
|
|
31
|
+
'exists',
|
|
32
|
+
'true',
|
|
33
|
+
'false',
|
|
34
|
+
'True',
|
|
35
|
+
'False',
|
|
36
|
+
'TRUE',
|
|
37
|
+
'FALSE',
|
|
38
|
+
]);
|
|
39
|
+
const IDENT_RE = /[A-Za-z_][A-Za-z0-9_]*/g;
|
|
40
|
+
/**
|
|
41
|
+
* Normaliza whitespace: colapsa runs de espacio/tabs/newlines a un solo
|
|
42
|
+
* espacio, y trimea. Mantiene la separación de tokens.
|
|
43
|
+
*/
|
|
44
|
+
function normalizeWhitespace(formula) {
|
|
45
|
+
return formula.replace(/\s+/g, ' ').trim();
|
|
46
|
+
}
|
|
47
|
+
function canonicalize(formula) {
|
|
48
|
+
const normalized = normalizeWhitespace(formula);
|
|
49
|
+
const forward = new Map();
|
|
50
|
+
const reverse = new Map();
|
|
51
|
+
let counter = 0;
|
|
52
|
+
const canonical = normalized.replace(IDENT_RE, (match) => {
|
|
53
|
+
if (RESERVED.has(match))
|
|
54
|
+
return match;
|
|
55
|
+
let placeholder = forward.get(match);
|
|
56
|
+
if (placeholder === undefined) {
|
|
57
|
+
placeholder = `?${counter++}`;
|
|
58
|
+
forward.set(match, placeholder);
|
|
59
|
+
reverse.set(placeholder, match);
|
|
60
|
+
}
|
|
61
|
+
return placeholder;
|
|
62
|
+
});
|
|
63
|
+
return { canonical, forward, reverse };
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Versión simple que sólo devuelve el string canónico.
|
|
67
|
+
*/
|
|
68
|
+
function canonicalString(formula) {
|
|
69
|
+
return canonicalize(formula).canonical;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Intenta encontrar una substitución que mapee la fórmula cacheada
|
|
73
|
+
* al target. Si las formas canónicas coinciden, calcula el mapping
|
|
74
|
+
* desde los identificadores originales del teorema hacia los del
|
|
75
|
+
* target.
|
|
76
|
+
*
|
|
77
|
+
* Retorna `undefined` si no son canónicamente equivalentes.
|
|
78
|
+
*/
|
|
79
|
+
function computeSubstitution(cachedFormula, targetFormula) {
|
|
80
|
+
const c1 = canonicalize(cachedFormula);
|
|
81
|
+
const c2 = canonicalize(targetFormula);
|
|
82
|
+
if (c1.canonical !== c2.canonical)
|
|
83
|
+
return undefined;
|
|
84
|
+
const substitution = {};
|
|
85
|
+
for (const [original, placeholder] of c1.forward) {
|
|
86
|
+
const targetOriginal = c2.reverse.get(placeholder);
|
|
87
|
+
if (targetOriginal === undefined)
|
|
88
|
+
return undefined;
|
|
89
|
+
substitution[original] = targetOriginal;
|
|
90
|
+
}
|
|
91
|
+
return substitution;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Aplica una substitución textual (mapping original → reemplazo) a
|
|
95
|
+
* una fórmula, respetando límites de identificador. Útil para
|
|
96
|
+
* rehidratar pruebas reutilizadas.
|
|
97
|
+
*/
|
|
98
|
+
function applySubstitution(formula, substitution) {
|
|
99
|
+
return formula.replace(IDENT_RE, (match) => {
|
|
100
|
+
if (RESERVED.has(match))
|
|
101
|
+
return match;
|
|
102
|
+
return substitution[match] ?? match;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=canonical.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical.js","sourceRoot":"","sources":["../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'./cache';
|
|
3
|
+
export { canonicalize, canonicalString, computeSubstitution, applySubstitution, normalizeWhitespace, } from './canonical';
|
|
4
|
+
export type { CanonicalResult } from './canonical';
|
|
5
|
+
export { matchPattern, patternMatches } from './pattern';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/theorem-cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACpF,OAAO,EACL,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.patternMatches = exports.matchPattern = exports.normalizeWhitespace = exports.applySubstitution = exports.computeSubstitution = exports.canonicalString = exports.canonicalize = exports.tryReuseProof = exports.TheoremCache = void 0;
|
|
4
|
+
var cache_1 = require("./cache");
|
|
5
|
+
Object.defineProperty(exports, "TheoremCache", { enumerable: true, get: function () { return cache_1.TheoremCache; } });
|
|
6
|
+
Object.defineProperty(exports, "tryReuseProof", { enumerable: true, get: function () { return cache_1.tryReuseProof; } });
|
|
7
|
+
var canonical_1 = require("./canonical");
|
|
8
|
+
Object.defineProperty(exports, "canonicalize", { enumerable: true, get: function () { return canonical_1.canonicalize; } });
|
|
9
|
+
Object.defineProperty(exports, "canonicalString", { enumerable: true, get: function () { return canonical_1.canonicalString; } });
|
|
10
|
+
Object.defineProperty(exports, "computeSubstitution", { enumerable: true, get: function () { return canonical_1.computeSubstitution; } });
|
|
11
|
+
Object.defineProperty(exports, "applySubstitution", { enumerable: true, get: function () { return canonical_1.applySubstitution; } });
|
|
12
|
+
Object.defineProperty(exports, "normalizeWhitespace", { enumerable: true, get: function () { return canonical_1.normalizeWhitespace; } });
|
|
13
|
+
var pattern_1 = require("./pattern");
|
|
14
|
+
Object.defineProperty(exports, "matchPattern", { enumerable: true, get: function () { return pattern_1.matchPattern; } });
|
|
15
|
+
Object.defineProperty(exports, "patternMatches", { enumerable: true, get: function () { return pattern_1.patternMatches; } });
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/theorem-cache/index.ts"],"names":[],"mappings":";;;AAAA,iCAAsD;AAA7C,qGAAA,YAAY,OAAA;AAAE,sGAAA,aAAa,OAAA;AAEpC,yCAMqB;AALnB,yGAAA,YAAY,OAAA;AACZ,4GAAA,eAAe,OAAA;AACf,gHAAA,mBAAmB,OAAA;AACnB,8GAAA,iBAAiB,OAAA;AACjB,gHAAA,mBAAmB,OAAA;AAGrB,qCAAyD;AAAhD,uGAAA,YAAY,OAAA;AAAE,yGAAA,cAAc,OAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Matching de patrones contra fórmulas cacheadas.
|
|
3
|
+
*
|
|
4
|
+
* Un patrón usa `?x`, `?y`, … como metavariables. Para que un patrón
|
|
5
|
+
* matchee una fórmula, debe existir una asignación consistente
|
|
6
|
+
* (cada metavariable mapea a un único identificador en la fórmula).
|
|
7
|
+
*
|
|
8
|
+
* Ejemplos:
|
|
9
|
+
* patrón `?x -> ?x` matchea `P -> P` (con x=P)
|
|
10
|
+
* patrón `?x -> ?x` NO matchea `P -> Q`
|
|
11
|
+
* patrón `?x -> ?y` matchea `P -> Q` (con x=P, y=Q)
|
|
12
|
+
* patrón `?x -> ?y` matchea `P -> P` (con x=P, y=P)
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Intenta matchear un patrón contra una fórmula. Retorna la
|
|
16
|
+
* asignación de metavariables si matchea, o `undefined` si no.
|
|
17
|
+
*/
|
|
18
|
+
export declare function matchPattern(pattern: string, formula: string): Record<string, string> | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Comprueba si un patrón matchea (al menos una vez) sobre la fórmula
|
|
21
|
+
* completa, sin extraer las bindings.
|
|
22
|
+
*/
|
|
23
|
+
export declare function patternMatches(pattern: string, formula: string): boolean;
|
|
24
|
+
//# sourceMappingURL=pattern.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pattern.d.ts","sourceRoot":"","sources":["../../../src/runtime/theorem-cache/pattern.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA4BH;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CA8BjG;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAExE"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Matching de patrones contra fórmulas cacheadas.
|
|
4
|
+
*
|
|
5
|
+
* Un patrón usa `?x`, `?y`, … como metavariables. Para que un patrón
|
|
6
|
+
* matchee una fórmula, debe existir una asignación consistente
|
|
7
|
+
* (cada metavariable mapea a un único identificador en la fórmula).
|
|
8
|
+
*
|
|
9
|
+
* Ejemplos:
|
|
10
|
+
* patrón `?x -> ?x` matchea `P -> P` (con x=P)
|
|
11
|
+
* patrón `?x -> ?x` NO matchea `P -> Q`
|
|
12
|
+
* patrón `?x -> ?y` matchea `P -> Q` (con x=P, y=Q)
|
|
13
|
+
* patrón `?x -> ?y` matchea `P -> P` (con x=P, y=P)
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.matchPattern = matchPattern;
|
|
17
|
+
exports.patternMatches = patternMatches;
|
|
18
|
+
const canonical_1 = require("./canonical");
|
|
19
|
+
const RESERVED = new Set([
|
|
20
|
+
'not',
|
|
21
|
+
'and',
|
|
22
|
+
'or',
|
|
23
|
+
'implies',
|
|
24
|
+
'iff',
|
|
25
|
+
'forall',
|
|
26
|
+
'exists',
|
|
27
|
+
'true',
|
|
28
|
+
'false',
|
|
29
|
+
'True',
|
|
30
|
+
'False',
|
|
31
|
+
'TRUE',
|
|
32
|
+
'FALSE',
|
|
33
|
+
]);
|
|
34
|
+
// Token: meta-variable (?name), identificador, número, símbolo.
|
|
35
|
+
const TOKEN_RE = /\?[A-Za-z_][A-Za-z0-9_]*|[A-Za-z_][A-Za-z0-9_]*|\d+|[^\sA-Za-z0-9_]/g;
|
|
36
|
+
function tokenize(s) {
|
|
37
|
+
const normalized = (0, canonical_1.normalizeWhitespace)(s);
|
|
38
|
+
return normalized.match(TOKEN_RE) ?? [];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Intenta matchear un patrón contra una fórmula. Retorna la
|
|
42
|
+
* asignación de metavariables si matchea, o `undefined` si no.
|
|
43
|
+
*/
|
|
44
|
+
function matchPattern(pattern, formula) {
|
|
45
|
+
const patternTokens = tokenize(pattern);
|
|
46
|
+
const formulaTokens = tokenize(formula);
|
|
47
|
+
if (patternTokens.length !== formulaTokens.length)
|
|
48
|
+
return undefined;
|
|
49
|
+
const bindings = {};
|
|
50
|
+
for (let i = 0; i < patternTokens.length; i++) {
|
|
51
|
+
const pt = patternTokens[i];
|
|
52
|
+
const ft = formulaTokens[i];
|
|
53
|
+
if (pt.startsWith('?')) {
|
|
54
|
+
const metaName = pt.slice(1);
|
|
55
|
+
const existing = bindings[metaName];
|
|
56
|
+
if (existing === undefined) {
|
|
57
|
+
// ft debe ser un identificador (no operador / paréntesis).
|
|
58
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(ft) || RESERVED.has(ft)) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
bindings[metaName] = ft;
|
|
62
|
+
}
|
|
63
|
+
else if (existing !== ft) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else if (pt !== ft) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return bindings;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Comprueba si un patrón matchea (al menos una vez) sobre la fórmula
|
|
75
|
+
* completa, sin extraer las bindings.
|
|
76
|
+
*/
|
|
77
|
+
function patternMatches(pattern, formula) {
|
|
78
|
+
return matchPattern(pattern, formula) !== undefined;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=pattern.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pattern.js","sourceRoot":"","sources":["../../../src/runtime/theorem-cache/pattern.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;AAgCH,oCA8BC;AAMD,wCAEC;AApED,2CAAkD;AAElD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAS;IAC/B,KAAK;IACL,KAAK;IACL,IAAI;IACJ,SAAS;IACT,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;CACR,CAAC,CAAC;AAEH,gEAAgE;AAChE,MAAM,QAAQ,GAAG,sEAAsE,CAAC;AAExF,SAAS,QAAQ,CAAC,CAAS;IACzB,MAAM,UAAU,GAAG,IAAA,+BAAmB,EAAC,CAAC,CAAC,CAAC;IAC1C,OAAO,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC1C,CAAC;AAED;;;GAG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7D,OAAO,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,SAAS,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { FType, FTerm, FContext } from './types';
|
|
2
|
+
export { fAtom, fArrow, fForall, fVar, fAbs, fApp, fTAbs, fTApp, freeTypeVars, alphaEqType, isWellFormed, fTypeToString, fTermToString, emptyContext, cloneContext, } from './types';
|
|
3
|
+
export type { FTypeResult } from './infer';
|
|
4
|
+
export { typeOf, isTypeError } from './infer';
|
|
5
|
+
export type { NormalizeResult } from './reduce';
|
|
6
|
+
export { reduceBeta, normalize, isNormal, freeVars, termTypeVars, substType, substTypeInTerm, substTerm, } from './reduce';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/system-f/index.ts"],"names":[],"mappings":"AAiBA,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EACL,KAAK,EACL,MAAM,EACN,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,KAAK,EACL,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,aAAa,EACb,aAAa,EACb,YAAY,EACZ,YAAY,GACb,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE9C,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EACL,UAAU,EACV,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,eAAe,EACf,SAAS,GACV,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================
|
|
3
|
+
// System F — Punto de entrada público
|
|
4
|
+
// ============================================================
|
|
5
|
+
//
|
|
6
|
+
// λ² (System F) extiende STLC con cuantificación universal sobre
|
|
7
|
+
// tipos. Curry-Howard: corresponde a la lógica proposicional
|
|
8
|
+
// intuicionista de segundo orden.
|
|
9
|
+
//
|
|
10
|
+
// Constructores y operaciones:
|
|
11
|
+
// - Tipos: atom, arrow, forall.
|
|
12
|
+
// - Términos: var, abs, app, tabs (Λ), tapp (t [T]).
|
|
13
|
+
// - typeOf: type-checking con contexto (term + type).
|
|
14
|
+
// - reduceBeta / normalize: β + type-β (call-by-name).
|
|
15
|
+
// - isWellFormed: chequea que tipos no tengan variables libres
|
|
16
|
+
// no declaradas.
|
|
17
|
+
// - alphaEqType: igualdad de tipos módulo α.
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.substTerm = exports.substTypeInTerm = exports.substType = exports.termTypeVars = exports.freeVars = exports.isNormal = exports.normalize = exports.reduceBeta = exports.isTypeError = exports.typeOf = exports.cloneContext = exports.emptyContext = exports.fTermToString = exports.fTypeToString = exports.isWellFormed = exports.alphaEqType = exports.freeTypeVars = exports.fTApp = exports.fTAbs = exports.fApp = exports.fAbs = exports.fVar = exports.fForall = exports.fArrow = exports.fAtom = void 0;
|
|
20
|
+
var types_1 = require("./types");
|
|
21
|
+
Object.defineProperty(exports, "fAtom", { enumerable: true, get: function () { return types_1.fAtom; } });
|
|
22
|
+
Object.defineProperty(exports, "fArrow", { enumerable: true, get: function () { return types_1.fArrow; } });
|
|
23
|
+
Object.defineProperty(exports, "fForall", { enumerable: true, get: function () { return types_1.fForall; } });
|
|
24
|
+
Object.defineProperty(exports, "fVar", { enumerable: true, get: function () { return types_1.fVar; } });
|
|
25
|
+
Object.defineProperty(exports, "fAbs", { enumerable: true, get: function () { return types_1.fAbs; } });
|
|
26
|
+
Object.defineProperty(exports, "fApp", { enumerable: true, get: function () { return types_1.fApp; } });
|
|
27
|
+
Object.defineProperty(exports, "fTAbs", { enumerable: true, get: function () { return types_1.fTAbs; } });
|
|
28
|
+
Object.defineProperty(exports, "fTApp", { enumerable: true, get: function () { return types_1.fTApp; } });
|
|
29
|
+
Object.defineProperty(exports, "freeTypeVars", { enumerable: true, get: function () { return types_1.freeTypeVars; } });
|
|
30
|
+
Object.defineProperty(exports, "alphaEqType", { enumerable: true, get: function () { return types_1.alphaEqType; } });
|
|
31
|
+
Object.defineProperty(exports, "isWellFormed", { enumerable: true, get: function () { return types_1.isWellFormed; } });
|
|
32
|
+
Object.defineProperty(exports, "fTypeToString", { enumerable: true, get: function () { return types_1.fTypeToString; } });
|
|
33
|
+
Object.defineProperty(exports, "fTermToString", { enumerable: true, get: function () { return types_1.fTermToString; } });
|
|
34
|
+
Object.defineProperty(exports, "emptyContext", { enumerable: true, get: function () { return types_1.emptyContext; } });
|
|
35
|
+
Object.defineProperty(exports, "cloneContext", { enumerable: true, get: function () { return types_1.cloneContext; } });
|
|
36
|
+
var infer_1 = require("./infer");
|
|
37
|
+
Object.defineProperty(exports, "typeOf", { enumerable: true, get: function () { return infer_1.typeOf; } });
|
|
38
|
+
Object.defineProperty(exports, "isTypeError", { enumerable: true, get: function () { return infer_1.isTypeError; } });
|
|
39
|
+
var reduce_1 = require("./reduce");
|
|
40
|
+
Object.defineProperty(exports, "reduceBeta", { enumerable: true, get: function () { return reduce_1.reduceBeta; } });
|
|
41
|
+
Object.defineProperty(exports, "normalize", { enumerable: true, get: function () { return reduce_1.normalize; } });
|
|
42
|
+
Object.defineProperty(exports, "isNormal", { enumerable: true, get: function () { return reduce_1.isNormal; } });
|
|
43
|
+
Object.defineProperty(exports, "freeVars", { enumerable: true, get: function () { return reduce_1.freeVars; } });
|
|
44
|
+
Object.defineProperty(exports, "termTypeVars", { enumerable: true, get: function () { return reduce_1.termTypeVars; } });
|
|
45
|
+
Object.defineProperty(exports, "substType", { enumerable: true, get: function () { return reduce_1.substType; } });
|
|
46
|
+
Object.defineProperty(exports, "substTypeInTerm", { enumerable: true, get: function () { return reduce_1.substTypeInTerm; } });
|
|
47
|
+
Object.defineProperty(exports, "substTerm", { enumerable: true, get: function () { return reduce_1.substTerm; } });
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/system-f/index.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,sCAAsC;AACtC,+DAA+D;AAC/D,EAAE;AACF,iEAAiE;AACjE,6DAA6D;AAC7D,kCAAkC;AAClC,EAAE;AACF,+BAA+B;AAC/B,kCAAkC;AAClC,uDAAuD;AACvD,wDAAwD;AACxD,yDAAyD;AACzD,iEAAiE;AACjE,qBAAqB;AACrB,+CAA+C;;;AAG/C,iCAgBiB;AAff,8FAAA,KAAK,OAAA;AACL,+FAAA,MAAM,OAAA;AACN,gGAAA,OAAO,OAAA;AACP,6FAAA,IAAI,OAAA;AACJ,6FAAA,IAAI,OAAA;AACJ,6FAAA,IAAI,OAAA;AACJ,8FAAA,KAAK,OAAA;AACL,8FAAA,KAAK,OAAA;AACL,qGAAA,YAAY,OAAA;AACZ,oGAAA,WAAW,OAAA;AACX,qGAAA,YAAY,OAAA;AACZ,sGAAA,aAAa,OAAA;AACb,sGAAA,aAAa,OAAA;AACb,qGAAA,YAAY,OAAA;AACZ,qGAAA,YAAY,OAAA;AAId,iCAA8C;AAArC,+FAAA,MAAM,OAAA;AAAE,oGAAA,WAAW,OAAA;AAG5B,mCASkB;AARhB,oGAAA,UAAU,OAAA;AACV,mGAAA,SAAS,OAAA;AACT,kGAAA,QAAQ,OAAA;AACR,kGAAA,QAAQ,OAAA;AACR,sGAAA,YAAY,OAAA;AACZ,mGAAA,SAAS,OAAA;AACT,yGAAA,eAAe,OAAA;AACf,mGAAA,SAAS,OAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FContext, FTerm, FType } from './types';
|
|
2
|
+
export type FTypeResult = FType | {
|
|
3
|
+
error: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function isTypeError(r: FTypeResult): r is {
|
|
6
|
+
error: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function typeOf(term: FTerm, ctx?: FContext): FTypeResult;
|
|
9
|
+
//# sourceMappingURL=infer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infer.d.ts","sourceRoot":"","sources":["../../src/system-f/infer.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAItD,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpD,wBAAgB,WAAW,CAAC,CAAC,EAAE,WAAW,GAAG,CAAC,IAAI;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAElE;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,GAAE,QAAyB,GAAG,WAAW,CAyE/E"}
|