@stevenvo780/st-lang 4.3.0 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/coinduction/index.d.ts +136 -0
- package/dist/coinduction/index.d.ts.map +1 -0
- package/dist/coinduction/index.js +318 -0
- package/dist/coinduction/index.js.map +1 -0
- package/dist/combinators-ski/abstract.d.ts +5 -0
- package/dist/combinators-ski/abstract.d.ts.map +1 -0
- package/dist/combinators-ski/abstract.js +88 -0
- package/dist/combinators-ski/abstract.js.map +1 -0
- package/dist/combinators-ski/index.d.ts +6 -0
- package/dist/combinators-ski/index.d.ts.map +1 -0
- package/dist/combinators-ski/index.js +30 -0
- package/dist/combinators-ski/index.js.map +1 -0
- package/dist/combinators-ski/reduce.d.ts +10 -0
- package/dist/combinators-ski/reduce.d.ts.map +1 -0
- package/dist/combinators-ski/reduce.js +118 -0
- package/dist/combinators-ski/reduce.js.map +1 -0
- package/dist/combinators-ski/types.d.ts +23 -0
- package/dist/combinators-ski/types.d.ts.map +1 -0
- package/dist/combinators-ski/types.js +102 -0
- package/dist/combinators-ski/types.js.map +1 -0
- package/dist/constructive-reals/index.d.ts +132 -0
- package/dist/constructive-reals/index.d.ts.map +1 -0
- package/dist/constructive-reals/index.js +723 -0
- package/dist/constructive-reals/index.js.map +1 -0
- package/dist/game-semantics/convert.d.ts +4 -0
- package/dist/game-semantics/convert.d.ts.map +1 -0
- package/dist/game-semantics/convert.js +28 -0
- package/dist/game-semantics/convert.js.map +1 -0
- package/dist/game-semantics/index.d.ts +6 -0
- package/dist/game-semantics/index.d.ts.map +1 -0
- package/dist/game-semantics/index.js +28 -0
- package/dist/game-semantics/index.js.map +1 -0
- package/dist/game-semantics/strategy.d.ts +34 -0
- package/dist/game-semantics/strategy.d.ts.map +1 -0
- package/dist/game-semantics/strategy.js +336 -0
- package/dist/game-semantics/strategy.js.map +1 -0
- package/dist/game-semantics/types.d.ts +64 -0
- package/dist/game-semantics/types.d.ts.map +1 -0
- package/dist/game-semantics/types.js +78 -0
- package/dist/game-semantics/types.js.map +1 -0
- package/dist/higher-order-unify/index.d.ts +5 -0
- package/dist/higher-order-unify/index.d.ts.map +1 -0
- package/dist/higher-order-unify/index.js +27 -0
- package/dist/higher-order-unify/index.js.map +1 -0
- package/dist/higher-order-unify/normalize.d.ts +14 -0
- package/dist/higher-order-unify/normalize.d.ts.map +1 -0
- package/dist/higher-order-unify/normalize.js +191 -0
- package/dist/higher-order-unify/normalize.js.map +1 -0
- package/dist/higher-order-unify/pattern.d.ts +4 -0
- package/dist/higher-order-unify/pattern.d.ts.map +1 -0
- package/dist/higher-order-unify/pattern.js +70 -0
- package/dist/higher-order-unify/pattern.js.map +1 -0
- package/dist/higher-order-unify/types.d.ts +19 -0
- package/dist/higher-order-unify/types.d.ts.map +1 -0
- package/dist/higher-order-unify/types.js +14 -0
- package/dist/higher-order-unify/types.js.map +1 -0
- package/dist/higher-order-unify/unify.d.ts +5 -0
- package/dist/higher-order-unify/unify.d.ts.map +1 -0
- package/dist/higher-order-unify/unify.js +306 -0
- package/dist/higher-order-unify/unify.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -2
- package/dist/index.js.map +1 -1
- package/dist/lambda-calc/church.d.ts.map +1 -1
- package/dist/lambda-calc/church.js.map +1 -1
- package/dist/lambda-calc/combinators.d.ts.map +1 -1
- package/dist/lambda-calc/combinators.js.map +1 -1
- package/dist/lambda-calc/index.d.ts +1 -1
- package/dist/lambda-calc/index.d.ts.map +1 -1
- package/dist/lambda-calc/index.js.map +1 -1
- 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/nbe/index.d.ts +3 -0
- package/dist/nbe/index.d.ts.map +1 -0
- package/dist/nbe/index.js +25 -0
- package/dist/nbe/index.js.map +1 -0
- package/dist/nbe/nbe.d.ts +7 -0
- package/dist/nbe/nbe.d.ts.map +1 -0
- package/dist/nbe/nbe.js +118 -0
- package/dist/nbe/nbe.js.map +1 -0
- package/dist/nbe/types.d.ts +54 -0
- package/dist/nbe/types.d.ts.map +1 -0
- package/dist/nbe/types.js +117 -0
- package/dist/nbe/types.js.map +1 -0
- package/dist/profile-bridge/index.d.ts +64 -0
- package/dist/profile-bridge/index.d.ts.map +1 -0
- package/dist/profile-bridge/index.js +328 -0
- package/dist/profile-bridge/index.js.map +1 -0
- package/dist/profiles/many-valued/index.d.ts.map +1 -1
- package/dist/profiles/many-valued/index.js.map +1 -1
- 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/proof-nets/construct.d.ts +3 -0
- package/dist/proof-nets/construct.d.ts.map +1 -0
- package/dist/proof-nets/construct.js +85 -0
- package/dist/proof-nets/construct.js.map +1 -0
- package/dist/proof-nets/correctness.d.ts +3 -0
- package/dist/proof-nets/correctness.d.ts.map +1 -0
- package/dist/proof-nets/correctness.js +213 -0
- package/dist/proof-nets/correctness.js.map +1 -0
- package/dist/proof-nets/cut-elim.d.ts +9 -0
- package/dist/proof-nets/cut-elim.d.ts.map +1 -0
- package/dist/proof-nets/cut-elim.js +149 -0
- package/dist/proof-nets/cut-elim.js.map +1 -0
- package/dist/proof-nets/index.d.ts +6 -0
- package/dist/proof-nets/index.d.ts.map +1 -0
- package/dist/proof-nets/index.js +33 -0
- package/dist/proof-nets/index.js.map +1 -0
- package/dist/proof-nets/types.d.ts +36 -0
- package/dist/proof-nets/types.d.ts.map +1 -0
- package/dist/proof-nets/types.js +89 -0
- package/dist/proof-nets/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/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/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/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/symbolic-diff/differentiate.d.ts.map +1 -1
- package/dist/runtime/symbolic-diff/differentiate.js.map +1 -1
- package/dist/runtime/symbolic-diff/index.d.ts +1 -1
- package/dist/runtime/symbolic-diff/index.d.ts.map +1 -1
- package/dist/runtime/symbolic-diff/index.js.map +1 -1
- package/dist/runtime/symbolic-diff/parse.d.ts.map +1 -1
- package/dist/runtime/symbolic-diff/parse.js +7 -1
- package/dist/runtime/symbolic-diff/parse.js.map +1 -1
- 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/tableau-framework/TableauProver.d.ts +10 -0
- package/dist/tableau-framework/TableauProver.d.ts.map +1 -0
- package/dist/tableau-framework/TableauProver.js +118 -0
- package/dist/tableau-framework/TableauProver.js.map +1 -0
- package/dist/tableau-framework/index.d.ts +5 -0
- package/dist/tableau-framework/index.d.ts.map +1 -0
- package/dist/tableau-framework/index.js +11 -0
- package/dist/tableau-framework/index.js.map +1 -0
- package/dist/tableau-framework/propositional.d.ts +11 -0
- package/dist/tableau-framework/propositional.d.ts.map +1 -0
- package/dist/tableau-framework/propositional.js +143 -0
- package/dist/tableau-framework/propositional.js.map +1 -0
- package/dist/tableau-framework/types.d.ts +32 -0
- package/dist/tableau-framework/types.d.ts.map +1 -0
- package/dist/tableau-framework/types.js +6 -0
- package/dist/tableau-framework/types.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/coinduction/coinduction.test.d.ts +2 -0
- package/dist/tests/coinduction/coinduction.test.d.ts.map +1 -0
- package/dist/tests/coinduction/coinduction.test.js +217 -0
- package/dist/tests/coinduction/coinduction.test.js.map +1 -0
- package/dist/tests/combinators-ski/combinators-ski.test.d.ts +2 -0
- package/dist/tests/combinators-ski/combinators-ski.test.d.ts.map +1 -0
- package/dist/tests/combinators-ski/combinators-ski.test.js +211 -0
- package/dist/tests/combinators-ski/combinators-ski.test.js.map +1 -0
- package/dist/tests/constructive-reals/constructive-reals.test.d.ts +2 -0
- package/dist/tests/constructive-reals/constructive-reals.test.d.ts.map +1 -0
- package/dist/tests/constructive-reals/constructive-reals.test.js +357 -0
- package/dist/tests/constructive-reals/constructive-reals.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/game-semantics/game-semantics.test.d.ts +2 -0
- package/dist/tests/game-semantics/game-semantics.test.d.ts.map +1 -0
- package/dist/tests/game-semantics/game-semantics.test.js +143 -0
- package/dist/tests/game-semantics/game-semantics.test.js.map +1 -0
- package/dist/tests/higher-order-unify/ho-unify.test.d.ts +2 -0
- package/dist/tests/higher-order-unify/ho-unify.test.d.ts.map +1 -0
- package/dist/tests/higher-order-unify/ho-unify.test.js +264 -0
- package/dist/tests/higher-order-unify/ho-unify.test.js.map +1 -0
- package/dist/tests/integration/cross-modules.test.d.ts +8 -0
- package/dist/tests/integration/cross-modules.test.d.ts.map +1 -0
- package/dist/tests/integration/cross-modules.test.js +668 -0
- package/dist/tests/integration/cross-modules.test.js.map +1 -0
- package/dist/tests/lambda-calc/lambda-calc.test.js.map +1 -1
- package/dist/tests/many-valued/many-valued.test.js.map +1 -1
- 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/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/nbe/nbe.test.d.ts +2 -0
- package/dist/tests/nbe/nbe.test.d.ts.map +1 -0
- package/dist/tests/nbe/nbe.test.js +121 -0
- package/dist/tests/nbe/nbe.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/profile-bridge/translations.test.d.ts +2 -0
- package/dist/tests/profile-bridge/translations.test.d.ts.map +1 -0
- package/dist/tests/profile-bridge/translations.test.js +266 -0
- package/dist/tests/profile-bridge/translations.test.js.map +1 -0
- package/dist/tests/proof-nets/proof-nets.test.d.ts +2 -0
- package/dist/tests/proof-nets/proof-nets.test.d.ts.map +1 -0
- package/dist/tests/proof-nets/proof-nets.test.js +263 -0
- package/dist/tests/proof-nets/proof-nets.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/symbolic-diff/symbolic-diff.test.js.map +1 -1
- 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/tableau-framework/tableau.test.d.ts +2 -0
- package/dist/tests/tableau-framework/tableau.test.d.ts.map +1 -0
- package/dist/tests/tableau-framework/tableau.test.js +196 -0
- package/dist/tests/tableau-framework/tableau.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,264 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================
|
|
3
|
+
// Markov Logic — Mini parser FOL (sin cuantificadores explícitos)
|
|
4
|
+
// ============================================================
|
|
5
|
+
//
|
|
6
|
+
// Gramática soportada (las variables libres se cuantifican
|
|
7
|
+
// universalmente al groundear):
|
|
8
|
+
//
|
|
9
|
+
// formula := implication
|
|
10
|
+
// implication := disjunction ('→' | '->' disjunction)* (right-assoc)
|
|
11
|
+
// disjunction := conjunction ('∨' | '|' | '||' conjunction)*
|
|
12
|
+
// conjunction := unary ('∧' | '&' | '&&' unary)*
|
|
13
|
+
// unary := ('¬' | '!') unary | atom
|
|
14
|
+
// atom := '(' formula ')' | predicate
|
|
15
|
+
// predicate := Ident '(' arg (',' arg)* ')'
|
|
16
|
+
// arg := Ident
|
|
17
|
+
//
|
|
18
|
+
// Convención de variables/constantes:
|
|
19
|
+
// - identificadores en minúscula → variables (lower-cased first char)
|
|
20
|
+
// - identificadores en mayúscula → constantes
|
|
21
|
+
//
|
|
22
|
+
// Esta gramática alcanza para Smoking, Friends, transitividad, etc.
|
|
23
|
+
// No soporta cuantificadores explícitos `∀ ∃`; la cuantificación es
|
|
24
|
+
// implícitamente universal sobre todas las variables libres.
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.parseFOL = parseFOL;
|
|
27
|
+
exports.freeVariables = freeVariables;
|
|
28
|
+
exports.isVariable = isVariable;
|
|
29
|
+
function parseFOL(input) {
|
|
30
|
+
const tokens = tokenize(input);
|
|
31
|
+
const parser = new Parser(tokens, input);
|
|
32
|
+
const node = parser.parseImplication();
|
|
33
|
+
parser.expectEOF();
|
|
34
|
+
return node;
|
|
35
|
+
}
|
|
36
|
+
/** Devuelve las variables libres (lowercase) que aparecen en `node`. */
|
|
37
|
+
function freeVariables(node) {
|
|
38
|
+
const out = new Set();
|
|
39
|
+
walk(node, out);
|
|
40
|
+
return Array.from(out).sort();
|
|
41
|
+
}
|
|
42
|
+
function walk(node, acc) {
|
|
43
|
+
switch (node.kind) {
|
|
44
|
+
case 'atom':
|
|
45
|
+
for (const a of node.args)
|
|
46
|
+
if (isVariable(a))
|
|
47
|
+
acc.add(a);
|
|
48
|
+
return;
|
|
49
|
+
case 'not':
|
|
50
|
+
walk(node.arg, acc);
|
|
51
|
+
return;
|
|
52
|
+
case 'and':
|
|
53
|
+
case 'or':
|
|
54
|
+
case 'implies':
|
|
55
|
+
walk(node.left, acc);
|
|
56
|
+
walk(node.right, acc);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function isVariable(name) {
|
|
61
|
+
if (name.length === 0)
|
|
62
|
+
return false;
|
|
63
|
+
const c = name.charCodeAt(0);
|
|
64
|
+
// 'a'..'z' → variable
|
|
65
|
+
return c >= 97 && c <= 122;
|
|
66
|
+
}
|
|
67
|
+
function tokenize(input) {
|
|
68
|
+
const out = [];
|
|
69
|
+
let i = 0;
|
|
70
|
+
const n = input.length;
|
|
71
|
+
while (i < n) {
|
|
72
|
+
const c = input[i];
|
|
73
|
+
if (c === undefined)
|
|
74
|
+
break;
|
|
75
|
+
// whitespace
|
|
76
|
+
if (c === ' ' || c === '\t' || c === '\n' || c === '\r') {
|
|
77
|
+
i++;
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
// single chars
|
|
81
|
+
if (c === '(') {
|
|
82
|
+
out.push({ kind: 'LPAREN', text: c, pos: i });
|
|
83
|
+
i++;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (c === ')') {
|
|
87
|
+
out.push({ kind: 'RPAREN', text: c, pos: i });
|
|
88
|
+
i++;
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
if (c === ',') {
|
|
92
|
+
out.push({ kind: 'COMMA', text: c, pos: i });
|
|
93
|
+
i++;
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (c === '¬' || c === '!' || c === '~') {
|
|
97
|
+
out.push({ kind: 'NOT', text: c, pos: i });
|
|
98
|
+
i++;
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (c === '∧') {
|
|
102
|
+
out.push({ kind: 'AND', text: c, pos: i });
|
|
103
|
+
i++;
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (c === '&') {
|
|
107
|
+
// accept "&" or "&&"
|
|
108
|
+
let text = '&';
|
|
109
|
+
i++;
|
|
110
|
+
if (input[i] === '&') {
|
|
111
|
+
text = '&&';
|
|
112
|
+
i++;
|
|
113
|
+
}
|
|
114
|
+
out.push({ kind: 'AND', text, pos: i });
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (c === '∨') {
|
|
118
|
+
out.push({ kind: 'OR', text: c, pos: i });
|
|
119
|
+
i++;
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
if (c === '|') {
|
|
123
|
+
let text = '|';
|
|
124
|
+
i++;
|
|
125
|
+
if (input[i] === '|') {
|
|
126
|
+
text = '||';
|
|
127
|
+
i++;
|
|
128
|
+
}
|
|
129
|
+
out.push({ kind: 'OR', text, pos: i });
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
if (c === '→') {
|
|
133
|
+
out.push({ kind: 'IMPLIES', text: c, pos: i });
|
|
134
|
+
i++;
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (c === '-') {
|
|
138
|
+
if (input[i + 1] === '>') {
|
|
139
|
+
out.push({ kind: 'IMPLIES', text: '->', pos: i });
|
|
140
|
+
i += 2;
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
throw new Error(`Carácter inesperado '-' en posición ${i}`);
|
|
144
|
+
}
|
|
145
|
+
// identifier: [A-Za-z_][A-Za-z0-9_]*
|
|
146
|
+
if (isIdentStart(c)) {
|
|
147
|
+
const start = i;
|
|
148
|
+
i++;
|
|
149
|
+
while (i < n) {
|
|
150
|
+
const ch = input[i];
|
|
151
|
+
if (ch !== undefined && isIdentCont(ch))
|
|
152
|
+
i++;
|
|
153
|
+
else
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
out.push({ kind: 'IDENT', text: input.slice(start, i), pos: start });
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
throw new Error(`Carácter inesperado '${c}' en posición ${i}`);
|
|
160
|
+
}
|
|
161
|
+
out.push({ kind: 'EOF', text: '', pos: n });
|
|
162
|
+
return out;
|
|
163
|
+
}
|
|
164
|
+
function isIdentStart(c) {
|
|
165
|
+
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c === '_';
|
|
166
|
+
}
|
|
167
|
+
function isIdentCont(c) {
|
|
168
|
+
return isIdentStart(c) || (c >= '0' && c <= '9');
|
|
169
|
+
}
|
|
170
|
+
// ── Recursive-descent parser ──────────────────────────────────
|
|
171
|
+
class Parser {
|
|
172
|
+
tokens;
|
|
173
|
+
src;
|
|
174
|
+
idx = 0;
|
|
175
|
+
constructor(tokens, src) {
|
|
176
|
+
this.tokens = tokens;
|
|
177
|
+
this.src = src;
|
|
178
|
+
}
|
|
179
|
+
peek() {
|
|
180
|
+
const t = this.tokens[this.idx];
|
|
181
|
+
if (!t)
|
|
182
|
+
throw new Error('Fin de tokens inesperado');
|
|
183
|
+
return t;
|
|
184
|
+
}
|
|
185
|
+
consume() {
|
|
186
|
+
const t = this.peek();
|
|
187
|
+
this.idx++;
|
|
188
|
+
return t;
|
|
189
|
+
}
|
|
190
|
+
expect(kind) {
|
|
191
|
+
const t = this.peek();
|
|
192
|
+
if (t.kind !== kind) {
|
|
193
|
+
throw new Error(`Esperaba ${kind} en posición ${t.pos}, encontré ${t.kind} ('${t.text}'). Fórmula: "${this.src}"`);
|
|
194
|
+
}
|
|
195
|
+
return this.consume();
|
|
196
|
+
}
|
|
197
|
+
expectEOF() {
|
|
198
|
+
const t = this.peek();
|
|
199
|
+
if (t.kind !== 'EOF') {
|
|
200
|
+
throw new Error(`Tokens sobrantes desde posición ${t.pos} en fórmula: "${this.src}"`);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
// implication is right-associative: A → B → C ≡ A → (B → C)
|
|
204
|
+
parseImplication() {
|
|
205
|
+
const left = this.parseDisjunction();
|
|
206
|
+
if (this.peek().kind === 'IMPLIES') {
|
|
207
|
+
this.consume();
|
|
208
|
+
const right = this.parseImplication();
|
|
209
|
+
return { kind: 'implies', left, right };
|
|
210
|
+
}
|
|
211
|
+
return left;
|
|
212
|
+
}
|
|
213
|
+
parseDisjunction() {
|
|
214
|
+
let left = this.parseConjunction();
|
|
215
|
+
while (this.peek().kind === 'OR') {
|
|
216
|
+
this.consume();
|
|
217
|
+
const right = this.parseConjunction();
|
|
218
|
+
left = { kind: 'or', left, right };
|
|
219
|
+
}
|
|
220
|
+
return left;
|
|
221
|
+
}
|
|
222
|
+
parseConjunction() {
|
|
223
|
+
let left = this.parseUnary();
|
|
224
|
+
while (this.peek().kind === 'AND') {
|
|
225
|
+
this.consume();
|
|
226
|
+
const right = this.parseUnary();
|
|
227
|
+
left = { kind: 'and', left, right };
|
|
228
|
+
}
|
|
229
|
+
return left;
|
|
230
|
+
}
|
|
231
|
+
parseUnary() {
|
|
232
|
+
if (this.peek().kind === 'NOT') {
|
|
233
|
+
this.consume();
|
|
234
|
+
return { kind: 'not', arg: this.parseUnary() };
|
|
235
|
+
}
|
|
236
|
+
return this.parseAtom();
|
|
237
|
+
}
|
|
238
|
+
parseAtom() {
|
|
239
|
+
const t = this.peek();
|
|
240
|
+
if (t.kind === 'LPAREN') {
|
|
241
|
+
this.consume();
|
|
242
|
+
const inner = this.parseImplication();
|
|
243
|
+
this.expect('RPAREN');
|
|
244
|
+
return inner;
|
|
245
|
+
}
|
|
246
|
+
if (t.kind === 'IDENT') {
|
|
247
|
+
const pred = this.consume().text;
|
|
248
|
+
this.expect('LPAREN');
|
|
249
|
+
const args = [];
|
|
250
|
+
// accept zero-arity gracefully: P()
|
|
251
|
+
if (this.peek().kind !== 'RPAREN') {
|
|
252
|
+
args.push(this.expect('IDENT').text);
|
|
253
|
+
while (this.peek().kind === 'COMMA') {
|
|
254
|
+
this.consume();
|
|
255
|
+
args.push(this.expect('IDENT').text);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
this.expect('RPAREN');
|
|
259
|
+
return { kind: 'atom', predicate: pred, args };
|
|
260
|
+
}
|
|
261
|
+
throw new Error(`Esperaba un átomo en posición ${t.pos}, encontré ${t.kind} ('${t.text}')`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
//# sourceMappingURL=parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../src/runtime/markov-logic/parser.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,kEAAkE;AAClE,+DAA+D;AAC/D,EAAE;AACF,2DAA2D;AAC3D,gCAAgC;AAChC,EAAE;AACF,4BAA4B;AAC5B,yEAAyE;AACzE,+DAA+D;AAC/D,mDAAmD;AACnD,4CAA4C;AAC5C,+CAA+C;AAC/C,gDAAgD;AAChD,yBAAyB;AACzB,EAAE;AACF,sCAAsC;AACtC,wEAAwE;AACxE,gDAAgD;AAChD,EAAE;AACF,oEAAoE;AACpE,oEAAoE;AACpE,6DAA6D;;AAS7D,4BAMC;AAGD,sCA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,CAAC,CAAC,IAAI,CAAC,CAAC;gBACrC,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;oBACpC,IAAI,CAAC,OAAO,EAAE,CAAC;oBACf,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;gBACvC,CAAC;YACH,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACtB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QACjD,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC;IAC9F,CAAC;CACF"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fórmula de la teoría MLN.
|
|
3
|
+
*
|
|
4
|
+
* `formula` es una cadena FOL con literales `Pred(args)` y
|
|
5
|
+
* conectores `∧`, `∨`, `→`, `¬` (o sus variantes ASCII `&`, `|`, `->`,
|
|
6
|
+
* `!`). Las variables se infieren por convención: identificadores que
|
|
7
|
+
* empiezan en minúscula son variables; los que empiezan en mayúscula
|
|
8
|
+
* son constantes (cerradas).
|
|
9
|
+
*
|
|
10
|
+
* `weight` es un peso real. `Infinity` significa hard constraint: la
|
|
11
|
+
* fórmula DEBE satisfacerse en todo mundo con probabilidad no nula.
|
|
12
|
+
*/
|
|
13
|
+
export interface MLNFormula {
|
|
14
|
+
formula: string;
|
|
15
|
+
weight: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Teoría MLN completa: fórmulas + dominios tipados de constantes +
|
|
19
|
+
* declaración de predicados.
|
|
20
|
+
*
|
|
21
|
+
* `constants[t]` es el conjunto de constantes del tipo `t`.
|
|
22
|
+
* `predicates[i].types` declara el tipo de cada argumento del
|
|
23
|
+
* predicado `predicates[i].name`.
|
|
24
|
+
*
|
|
25
|
+
* Para teorías untyped, basta usar un único tipo (por ejemplo
|
|
26
|
+
* `"Person"`) y declarar todos los predicados sobre él.
|
|
27
|
+
*/
|
|
28
|
+
export interface MLNTheory {
|
|
29
|
+
formulas: MLNFormula[];
|
|
30
|
+
constants: Record<string, string[]>;
|
|
31
|
+
predicates: Array<{
|
|
32
|
+
name: string;
|
|
33
|
+
types: string[];
|
|
34
|
+
}>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Mundo posible: asignación booleana sobre ground atoms.
|
|
38
|
+
*
|
|
39
|
+
* Las claves son strings canónicos `"Pred(arg1,arg2,...)"` (sin
|
|
40
|
+
* espacios). Atoms ausentes se interpretan como `false` (closed-world
|
|
41
|
+
* assumption opcional, usualmente activada en MLN).
|
|
42
|
+
*/
|
|
43
|
+
export interface MLNWorld {
|
|
44
|
+
groundAtoms: Record<string, boolean>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Resultado de groundear una fórmula sobre el universo de constantes.
|
|
48
|
+
*
|
|
49
|
+
* Cada `GroundedFormula` representa una instancia concreta (sin
|
|
50
|
+
* variables libres) de la fórmula original. `violations(world)`
|
|
51
|
+
* devuelve `0` si el mundo SATISFACE la instancia, `1` si la viola.
|
|
52
|
+
* Esto facilita componer el peso del mundo: cada `violations > 0`
|
|
53
|
+
* resta `w · violations` del log-score.
|
|
54
|
+
*/
|
|
55
|
+
export interface GroundedFormula {
|
|
56
|
+
groundFormula: string;
|
|
57
|
+
weight: number;
|
|
58
|
+
violations: (world: MLNWorld) => number;
|
|
59
|
+
/** Atoms que aparecen en esta ground formula (útil para Gibbs). */
|
|
60
|
+
atoms: string[];
|
|
61
|
+
/** Predicado: ¿la fórmula se satisface en `world`? */
|
|
62
|
+
satisfied: (world: MLNWorld) => boolean;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime/markov-logic/types.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,UAAU,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACpC,UAAU,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;CACtD;AAED;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,MAAM,CAAC;IACxC,mEAAmE;IACnE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,sDAAsD;IACtD,SAAS,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,OAAO,CAAC;CACzC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================
|
|
3
|
+
// Markov Logic Networks — Types
|
|
4
|
+
// ============================================================
|
|
5
|
+
//
|
|
6
|
+
// Una Markov Logic Network (MLN) combina lógica de primer orden
|
|
7
|
+
// con redes de Markov. Cada fórmula `F` lleva un peso real `w`.
|
|
8
|
+
// La distribución sobre mundos posibles `W` es:
|
|
9
|
+
//
|
|
10
|
+
// P(W) = (1/Z) · exp( Σ_i w_i · n_i(W) )
|
|
11
|
+
//
|
|
12
|
+
// donde `n_i(W)` cuenta las grounding instances de `F_i` SATISFECHAS
|
|
13
|
+
// en `W`. Pesos +∞ equivalen a restricciones duras (hard constraints).
|
|
14
|
+
//
|
|
15
|
+
// Referencia: Richardson & Domingos, "Markov Logic Networks" (2006).
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/runtime/markov-logic/types.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,gCAAgC;AAChC,+DAA+D;AAC/D,EAAE;AACF,gEAAgE;AAChE,gEAAgE;AAChE,gDAAgD;AAChD,EAAE;AACF,4CAA4C;AAC5C,EAAE;AACF,qEAAqE;AACrE,uEAAuE;AACvE,EAAE;AACF,qEAAqE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PiProcess } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Decide si dos procesos son estructuralmente congruentes (módulo los
|
|
4
|
+
* axiomas listados arriba + α-equivalencia).
|
|
5
|
+
*
|
|
6
|
+
* Cobertura intencional:
|
|
7
|
+
* - Conmutatividad/asociatividad/nil de | y +.
|
|
8
|
+
* - Renaming de binders.
|
|
9
|
+
* - `(νc) 0 ≡ 0`.
|
|
10
|
+
* Cobertura intencionalmente limitada (excede el scope mínimo del runtime):
|
|
11
|
+
* - Scope extrusion `(νc)(P|Q) ≡ P | (νc) Q`.
|
|
12
|
+
* - Unfold de replicación.
|
|
13
|
+
*/
|
|
14
|
+
export declare function structuralCongruence(a: PiProcess, b: PiProcess): boolean;
|
|
15
|
+
//# sourceMappingURL=congruence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"congruence.d.ts","sourceRoot":"","sources":["../../../src/runtime/pi-calculus/congruence.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAuJzC;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,GAAG,OAAO,CAMxE"}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================
|
|
3
|
+
// π-calculus — congruencia estructural ≡.
|
|
4
|
+
// ============================================================
|
|
5
|
+
// Axiomas estándar:
|
|
6
|
+
// P | 0 ≡ P (nil unitario de |)
|
|
7
|
+
// P | Q ≡ Q | P (conmutatividad de |)
|
|
8
|
+
// (P | Q) | R ≡ P | (Q | R) (asociatividad de |)
|
|
9
|
+
// P + 0 ≡ P
|
|
10
|
+
// P + Q ≡ Q + P
|
|
11
|
+
// (P + Q) + R ≡ P + (Q + R)
|
|
12
|
+
// (νc)(νd) P ≡ (νd)(νc) P (intercambio de scopes)
|
|
13
|
+
// (νc) 0 ≡ 0 (canal vacío sin uso)
|
|
14
|
+
// (νc) (P | Q) ≡ P | (νc) Q si c ∉ fn(P) (scope extrusion)
|
|
15
|
+
// !P ≡ P | !P (unfold de replicación, lo dejamos como opcional)
|
|
16
|
+
// α-conversion sobre binders
|
|
17
|
+
//
|
|
18
|
+
// Implementación: normalizamos ambos procesos a una "forma canónica"
|
|
19
|
+
// (flatten de paralelas y sumas + ordenamiento estructural + drop de
|
|
20
|
+
// `0` unitarios) y luego comparamos por igualdad sintáctica módulo
|
|
21
|
+
// α-renaming sobre binders.
|
|
22
|
+
//
|
|
23
|
+
// No es decisión completa de ≡ (la equivalencia es indecidible en
|
|
24
|
+
// general en presencia de replicación), pero cubre los axiomas
|
|
25
|
+
// básicos suficientes para los tests y propiedades esperadas.
|
|
26
|
+
// ============================================================
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.structuralCongruence = structuralCongruence;
|
|
29
|
+
const names_1 = require("./names");
|
|
30
|
+
/**
|
|
31
|
+
* Normaliza un proceso a forma canónica para comparar ≡.
|
|
32
|
+
*
|
|
33
|
+
* - Aplana `parallel` y `choice` asociativos en listas, descarta `0`s.
|
|
34
|
+
* - Ordena las listas con un orden estructural total y reconstruye en
|
|
35
|
+
* forma asociativa derecha canónica.
|
|
36
|
+
* - Refresca nombres ligados a una secuencia determinista
|
|
37
|
+
* (`#bn0`, `#bn1`, ...) en post-orden para que α-equivalentes
|
|
38
|
+
* colapsen.
|
|
39
|
+
*/
|
|
40
|
+
function canonical(p, counter) {
|
|
41
|
+
// 1. α-normalizar binders en post-orden.
|
|
42
|
+
const renamed = renameBindersCanonical(p, counter);
|
|
43
|
+
// 2. flatten + sort + drop nil.
|
|
44
|
+
return normalize(renamed);
|
|
45
|
+
}
|
|
46
|
+
function renameBindersCanonical(p, counter) {
|
|
47
|
+
switch (p.kind) {
|
|
48
|
+
case 'nil':
|
|
49
|
+
return p;
|
|
50
|
+
case 'input': {
|
|
51
|
+
const cont = renameBindersCanonical(p.cont, counter);
|
|
52
|
+
const fresh = `#bn${counter.n++}`;
|
|
53
|
+
const renamed = (0, names_1.alphaRename)(cont, p.bind, fresh);
|
|
54
|
+
return { kind: 'input', channel: p.channel, bind: fresh, cont: renamed };
|
|
55
|
+
}
|
|
56
|
+
case 'output':
|
|
57
|
+
return {
|
|
58
|
+
kind: 'output',
|
|
59
|
+
channel: p.channel,
|
|
60
|
+
value: p.value,
|
|
61
|
+
cont: renameBindersCanonical(p.cont, counter),
|
|
62
|
+
};
|
|
63
|
+
case 'parallel':
|
|
64
|
+
return {
|
|
65
|
+
kind: 'parallel',
|
|
66
|
+
left: renameBindersCanonical(p.left, counter),
|
|
67
|
+
right: renameBindersCanonical(p.right, counter),
|
|
68
|
+
};
|
|
69
|
+
case 'choice':
|
|
70
|
+
return {
|
|
71
|
+
kind: 'choice',
|
|
72
|
+
left: renameBindersCanonical(p.left, counter),
|
|
73
|
+
right: renameBindersCanonical(p.right, counter),
|
|
74
|
+
};
|
|
75
|
+
case 'new': {
|
|
76
|
+
const body = renameBindersCanonical(p.body, counter);
|
|
77
|
+
const fresh = `#bn${counter.n++}`;
|
|
78
|
+
const renamed = (0, names_1.alphaRename)(body, p.channel, fresh);
|
|
79
|
+
return { kind: 'new', channel: fresh, body: renamed };
|
|
80
|
+
}
|
|
81
|
+
case 'replication':
|
|
82
|
+
return { kind: 'replication', body: renameBindersCanonical(p.body, counter) };
|
|
83
|
+
case 'match':
|
|
84
|
+
return {
|
|
85
|
+
kind: 'match',
|
|
86
|
+
left: p.left,
|
|
87
|
+
right: p.right,
|
|
88
|
+
cont: renameBindersCanonical(p.cont, counter),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function normalize(p) {
|
|
93
|
+
switch (p.kind) {
|
|
94
|
+
case 'nil':
|
|
95
|
+
return p;
|
|
96
|
+
case 'input':
|
|
97
|
+
return { kind: 'input', channel: p.channel, bind: p.bind, cont: normalize(p.cont) };
|
|
98
|
+
case 'output':
|
|
99
|
+
return {
|
|
100
|
+
kind: 'output',
|
|
101
|
+
channel: p.channel,
|
|
102
|
+
value: p.value,
|
|
103
|
+
cont: normalize(p.cont),
|
|
104
|
+
};
|
|
105
|
+
case 'parallel': {
|
|
106
|
+
const parts = flattenParallel(p)
|
|
107
|
+
.map(normalize)
|
|
108
|
+
.filter((q) => q.kind !== 'nil');
|
|
109
|
+
if (parts.length === 0)
|
|
110
|
+
return { kind: 'nil' };
|
|
111
|
+
if (parts.length === 1)
|
|
112
|
+
return parts[0];
|
|
113
|
+
parts.sort((a, b) => structKey(a).localeCompare(structKey(b)));
|
|
114
|
+
return parts.reduceRight((acc, q) => ({ kind: 'parallel', left: q, right: acc }));
|
|
115
|
+
}
|
|
116
|
+
case 'choice': {
|
|
117
|
+
const parts = flattenChoice(p)
|
|
118
|
+
.map(normalize)
|
|
119
|
+
.filter((q) => q.kind !== 'nil');
|
|
120
|
+
if (parts.length === 0)
|
|
121
|
+
return { kind: 'nil' };
|
|
122
|
+
if (parts.length === 1)
|
|
123
|
+
return parts[0];
|
|
124
|
+
parts.sort((a, b) => structKey(a).localeCompare(structKey(b)));
|
|
125
|
+
return parts.reduceRight((acc, q) => ({ kind: 'choice', left: q, right: acc }));
|
|
126
|
+
}
|
|
127
|
+
case 'new': {
|
|
128
|
+
const body = normalize(p.body);
|
|
129
|
+
// (νc) 0 ≡ 0
|
|
130
|
+
if (body.kind === 'nil')
|
|
131
|
+
return { kind: 'nil' };
|
|
132
|
+
return { kind: 'new', channel: p.channel, body };
|
|
133
|
+
}
|
|
134
|
+
case 'replication':
|
|
135
|
+
return { kind: 'replication', body: normalize(p.body) };
|
|
136
|
+
case 'match':
|
|
137
|
+
return {
|
|
138
|
+
kind: 'match',
|
|
139
|
+
left: p.left,
|
|
140
|
+
right: p.right,
|
|
141
|
+
cont: normalize(p.cont),
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function flattenParallel(p) {
|
|
146
|
+
if (p.kind !== 'parallel')
|
|
147
|
+
return [p];
|
|
148
|
+
return [...flattenParallel(p.left), ...flattenParallel(p.right)];
|
|
149
|
+
}
|
|
150
|
+
function flattenChoice(p) {
|
|
151
|
+
if (p.kind !== 'choice')
|
|
152
|
+
return [p];
|
|
153
|
+
return [...flattenChoice(p.left), ...flattenChoice(p.right)];
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Serialización estructural estable para usar como clave de
|
|
157
|
+
* ordenamiento. Determinista bajo igualdad sintáctica.
|
|
158
|
+
*/
|
|
159
|
+
function structKey(p) {
|
|
160
|
+
switch (p.kind) {
|
|
161
|
+
case 'nil':
|
|
162
|
+
return '0';
|
|
163
|
+
case 'input':
|
|
164
|
+
return `in(${p.channel},${p.bind},${structKey(p.cont)})`;
|
|
165
|
+
case 'output':
|
|
166
|
+
return `out(${p.channel},${p.value},${structKey(p.cont)})`;
|
|
167
|
+
case 'parallel':
|
|
168
|
+
return `par(${structKey(p.left)},${structKey(p.right)})`;
|
|
169
|
+
case 'choice':
|
|
170
|
+
return `sum(${structKey(p.left)},${structKey(p.right)})`;
|
|
171
|
+
case 'new':
|
|
172
|
+
return `new(${p.channel},${structKey(p.body)})`;
|
|
173
|
+
case 'replication':
|
|
174
|
+
return `rep(${structKey(p.body)})`;
|
|
175
|
+
case 'match':
|
|
176
|
+
return `mat(${p.left},${p.right},${structKey(p.cont)})`;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Decide si dos procesos son estructuralmente congruentes (módulo los
|
|
181
|
+
* axiomas listados arriba + α-equivalencia).
|
|
182
|
+
*
|
|
183
|
+
* Cobertura intencional:
|
|
184
|
+
* - Conmutatividad/asociatividad/nil de | y +.
|
|
185
|
+
* - Renaming de binders.
|
|
186
|
+
* - `(νc) 0 ≡ 0`.
|
|
187
|
+
* Cobertura intencionalmente limitada (excede el scope mínimo del runtime):
|
|
188
|
+
* - Scope extrusion `(νc)(P|Q) ≡ P | (νc) Q`.
|
|
189
|
+
* - Unfold de replicación.
|
|
190
|
+
*/
|
|
191
|
+
function structuralCongruence(a, b) {
|
|
192
|
+
// Aplicamos scope extrusion repetidamente como pre-paso, después
|
|
193
|
+
// normalizamos y comparamos por structKey.
|
|
194
|
+
const A = canonical(extrudeScopes(a), { n: 0 });
|
|
195
|
+
const B = canonical(extrudeScopes(b), { n: 0 });
|
|
196
|
+
return structKey(A) === structKey(B);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Aplica scope extrusion donde sea posible: `(νc)(P|Q) ≡ P | (νc) Q`
|
|
200
|
+
* cuando `c ∉ fn(P)`. No es óptimo pero alcanza para los axiomas.
|
|
201
|
+
*/
|
|
202
|
+
function extrudeScopes(p) {
|
|
203
|
+
switch (p.kind) {
|
|
204
|
+
case 'nil':
|
|
205
|
+
return p;
|
|
206
|
+
case 'input':
|
|
207
|
+
return { kind: 'input', channel: p.channel, bind: p.bind, cont: extrudeScopes(p.cont) };
|
|
208
|
+
case 'output':
|
|
209
|
+
return {
|
|
210
|
+
kind: 'output',
|
|
211
|
+
channel: p.channel,
|
|
212
|
+
value: p.value,
|
|
213
|
+
cont: extrudeScopes(p.cont),
|
|
214
|
+
};
|
|
215
|
+
case 'parallel':
|
|
216
|
+
return {
|
|
217
|
+
kind: 'parallel',
|
|
218
|
+
left: extrudeScopes(p.left),
|
|
219
|
+
right: extrudeScopes(p.right),
|
|
220
|
+
};
|
|
221
|
+
case 'choice':
|
|
222
|
+
return {
|
|
223
|
+
kind: 'choice',
|
|
224
|
+
left: extrudeScopes(p.left),
|
|
225
|
+
right: extrudeScopes(p.right),
|
|
226
|
+
};
|
|
227
|
+
case 'new': {
|
|
228
|
+
const body = extrudeScopes(p.body);
|
|
229
|
+
if (body.kind === 'parallel') {
|
|
230
|
+
const fnL = (0, names_1.freeNames)(body.left);
|
|
231
|
+
const fnR = (0, names_1.freeNames)(body.right);
|
|
232
|
+
const leftFree = !fnL.has(p.channel);
|
|
233
|
+
const rightFree = !fnR.has(p.channel);
|
|
234
|
+
if (leftFree && rightFree) {
|
|
235
|
+
// Canal restringido pero no usado en ninguna rama: descártalo.
|
|
236
|
+
return { kind: 'parallel', left: body.left, right: body.right };
|
|
237
|
+
}
|
|
238
|
+
if (leftFree) {
|
|
239
|
+
// Empujar (νc) hacia la rama derecha.
|
|
240
|
+
return {
|
|
241
|
+
kind: 'parallel',
|
|
242
|
+
left: body.left,
|
|
243
|
+
right: extrudeScopes({ kind: 'new', channel: p.channel, body: body.right }),
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
if (rightFree) {
|
|
247
|
+
return {
|
|
248
|
+
kind: 'parallel',
|
|
249
|
+
left: extrudeScopes({ kind: 'new', channel: p.channel, body: body.left }),
|
|
250
|
+
right: body.right,
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
// Caso especial: (νc) que liga un canal nunca usado en el cuerpo.
|
|
255
|
+
if (!(0, names_1.freeNames)(body).has(p.channel)) {
|
|
256
|
+
return body;
|
|
257
|
+
}
|
|
258
|
+
return { kind: 'new', channel: p.channel, body };
|
|
259
|
+
}
|
|
260
|
+
case 'replication':
|
|
261
|
+
return { kind: 'replication', body: extrudeScopes(p.body) };
|
|
262
|
+
case 'match':
|
|
263
|
+
return {
|
|
264
|
+
kind: 'match',
|
|
265
|
+
left: p.left,
|
|
266
|
+
right: p.right,
|
|
267
|
+
cont: extrudeScopes(p.cont),
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
//# sourceMappingURL=congruence.js.map
|