@stevenvo780/st-lang 4.11.0 → 4.13.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/proof-systems/fol-prover-advanced/index.d.ts +7 -0
- package/dist/proof-systems/fol-prover-advanced/index.d.ts.map +1 -0
- package/dist/proof-systems/fol-prover-advanced/index.js +34 -0
- package/dist/proof-systems/fol-prover-advanced/index.js.map +1 -0
- package/dist/proof-systems/fol-prover-advanced/ordering.d.ts +34 -0
- package/dist/proof-systems/fol-prover-advanced/ordering.d.ts.map +1 -0
- package/dist/proof-systems/fol-prover-advanced/ordering.js +197 -0
- package/dist/proof-systems/fol-prover-advanced/ordering.js.map +1 -0
- package/dist/proof-systems/fol-prover-advanced/prover.d.ts +22 -0
- package/dist/proof-systems/fol-prover-advanced/prover.d.ts.map +1 -0
- package/dist/proof-systems/fol-prover-advanced/prover.js +219 -0
- package/dist/proof-systems/fol-prover-advanced/prover.js.map +1 -0
- package/dist/proof-systems/fol-prover-advanced/resolve.d.ts +43 -0
- package/dist/proof-systems/fol-prover-advanced/resolve.d.ts.map +1 -0
- package/dist/proof-systems/fol-prover-advanced/resolve.js +297 -0
- package/dist/proof-systems/fol-prover-advanced/resolve.js.map +1 -0
- package/dist/proof-systems/fol-prover-advanced/subsumption.d.ts +28 -0
- package/dist/proof-systems/fol-prover-advanced/subsumption.d.ts.map +1 -0
- package/dist/proof-systems/fol-prover-advanced/subsumption.js +172 -0
- package/dist/proof-systems/fol-prover-advanced/subsumption.js.map +1 -0
- package/dist/proof-systems/fol-prover-advanced/types.d.ts +68 -0
- package/dist/proof-systems/fol-prover-advanced/types.d.ts.map +1 -0
- package/dist/proof-systems/fol-prover-advanced/types.js +12 -0
- package/dist/proof-systems/fol-prover-advanced/types.js.map +1 -0
- package/dist/proof-systems/fol-prover-advanced/unify.d.ts +15 -0
- package/dist/proof-systems/fol-prover-advanced/unify.d.ts.map +1 -0
- package/dist/proof-systems/fol-prover-advanced/unify.js +144 -0
- package/dist/proof-systems/fol-prover-advanced/unify.js.map +1 -0
- package/dist/reasoning/combinatorics/basic-counts.d.ts +6 -0
- package/dist/reasoning/combinatorics/basic-counts.d.ts.map +1 -0
- package/dist/reasoning/combinatorics/basic-counts.js +82 -0
- package/dist/reasoning/combinatorics/basic-counts.js.map +1 -0
- package/dist/reasoning/combinatorics/bigint-helpers.d.ts +5 -0
- package/dist/reasoning/combinatorics/bigint-helpers.d.ts.map +1 -0
- package/dist/reasoning/combinatorics/bigint-helpers.js +8 -0
- package/dist/reasoning/combinatorics/bigint-helpers.js.map +1 -0
- package/dist/reasoning/combinatorics/burnside.d.ts +15 -0
- package/dist/reasoning/combinatorics/burnside.d.ts.map +1 -0
- package/dist/reasoning/combinatorics/burnside.js +91 -0
- package/dist/reasoning/combinatorics/burnside.js.map +1 -0
- package/dist/reasoning/combinatorics/generating-functions.d.ts +12 -0
- package/dist/reasoning/combinatorics/generating-functions.d.ts.map +1 -0
- package/dist/reasoning/combinatorics/generating-functions.js +67 -0
- package/dist/reasoning/combinatorics/generating-functions.js.map +1 -0
- package/dist/reasoning/combinatorics/generators.d.ts +5 -0
- package/dist/reasoning/combinatorics/generators.d.ts.map +1 -0
- package/dist/reasoning/combinatorics/generators.js +111 -0
- package/dist/reasoning/combinatorics/generators.js.map +1 -0
- package/dist/reasoning/combinatorics/inclusion-exclusion.d.ts +8 -0
- package/dist/reasoning/combinatorics/inclusion-exclusion.d.ts.map +1 -0
- package/dist/reasoning/combinatorics/inclusion-exclusion.js +45 -0
- package/dist/reasoning/combinatorics/inclusion-exclusion.js.map +1 -0
- package/dist/reasoning/combinatorics/index.d.ts +10 -0
- package/dist/reasoning/combinatorics/index.d.ts.map +1 -0
- package/dist/reasoning/combinatorics/index.js +44 -0
- package/dist/reasoning/combinatorics/index.js.map +1 -0
- package/dist/reasoning/combinatorics/partitions.d.ts +4 -0
- package/dist/reasoning/combinatorics/partitions.d.ts.map +1 -0
- package/dist/reasoning/combinatorics/partitions.js +90 -0
- package/dist/reasoning/combinatorics/partitions.js.map +1 -0
- package/dist/reasoning/combinatorics/permutations.d.ts +6 -0
- package/dist/reasoning/combinatorics/permutations.d.ts.map +1 -0
- package/dist/reasoning/combinatorics/permutations.js +124 -0
- package/dist/reasoning/combinatorics/permutations.js.map +1 -0
- package/dist/reasoning/combinatorics/set-partitions.d.ts +3 -0
- package/dist/reasoning/combinatorics/set-partitions.d.ts.map +1 -0
- package/dist/reasoning/combinatorics/set-partitions.js +46 -0
- package/dist/reasoning/combinatorics/set-partitions.js.map +1 -0
- package/dist/reasoning/combinatorics/special-numbers.d.ts +7 -0
- package/dist/reasoning/combinatorics/special-numbers.d.ts.map +1 -0
- package/dist/reasoning/combinatorics/special-numbers.js +128 -0
- package/dist/reasoning/combinatorics/special-numbers.js.map +1 -0
- package/dist/reasoning/constructive-analysis/cauchy.d.ts +51 -0
- package/dist/reasoning/constructive-analysis/cauchy.d.ts.map +1 -0
- package/dist/reasoning/constructive-analysis/cauchy.js +77 -0
- package/dist/reasoning/constructive-analysis/cauchy.js.map +1 -0
- package/dist/reasoning/constructive-analysis/compact.d.ts +35 -0
- package/dist/reasoning/constructive-analysis/compact.d.ts.map +1 -0
- package/dist/reasoning/constructive-analysis/compact.js +61 -0
- package/dist/reasoning/constructive-analysis/compact.js.map +1 -0
- package/dist/reasoning/constructive-analysis/continuity.d.ts +62 -0
- package/dist/reasoning/constructive-analysis/continuity.d.ts.map +1 -0
- package/dist/reasoning/constructive-analysis/continuity.js +112 -0
- package/dist/reasoning/constructive-analysis/continuity.js.map +1 -0
- package/dist/reasoning/constructive-analysis/index.d.ts +24 -0
- package/dist/reasoning/constructive-analysis/index.d.ts.map +1 -0
- package/dist/reasoning/constructive-analysis/index.js +36 -0
- package/dist/reasoning/constructive-analysis/index.js.map +1 -0
- package/dist/reasoning/constructive-analysis/integral.d.ts +31 -0
- package/dist/reasoning/constructive-analysis/integral.d.ts.map +1 -0
- package/dist/reasoning/constructive-analysis/integral.js +59 -0
- package/dist/reasoning/constructive-analysis/integral.js.map +1 -0
- package/dist/reasoning/constructive-analysis/ivt.d.ts +41 -0
- package/dist/reasoning/constructive-analysis/ivt.d.ts.map +1 -0
- package/dist/reasoning/constructive-analysis/ivt.js +115 -0
- package/dist/reasoning/constructive-analysis/ivt.js.map +1 -0
- package/dist/reasoning/constructive-reals/index.d.ts +23 -0
- package/dist/reasoning/constructive-reals/index.d.ts.map +1 -1
- package/dist/reasoning/constructive-reals/index.js +52 -1
- package/dist/reasoning/constructive-reals/index.js.map +1 -1
- package/dist/reasoning/datalog/index.d.ts +131 -0
- package/dist/reasoning/datalog/index.d.ts.map +1 -0
- package/dist/reasoning/datalog/index.js +706 -0
- package/dist/reasoning/datalog/index.js.map +1 -0
- package/dist/reasoning/galois-fields/index.d.ts +29 -0
- package/dist/reasoning/galois-fields/index.d.ts.map +1 -0
- package/dist/reasoning/galois-fields/index.js +522 -0
- package/dist/reasoning/galois-fields/index.js.map +1 -0
- package/dist/reasoning/lattice/index.d.ts +165 -0
- package/dist/reasoning/lattice/index.d.ts.map +1 -0
- package/dist/reasoning/lattice/index.js +587 -0
- package/dist/reasoning/lattice/index.js.map +1 -0
- package/dist/reasoning/linear-algebra/index.d.ts +69 -0
- package/dist/reasoning/linear-algebra/index.d.ts.map +1 -0
- package/dist/reasoning/linear-algebra/index.js +859 -0
- package/dist/reasoning/linear-algebra/index.js.map +1 -0
- package/dist/reasoning/polynomial-ring/index.d.ts +30 -0
- package/dist/reasoning/polynomial-ring/index.d.ts.map +1 -0
- package/dist/reasoning/polynomial-ring/index.js +797 -0
- package/dist/reasoning/polynomial-ring/index.js.map +1 -0
- package/dist/reasoning/set-theory/hf-functions.d.ts +35 -0
- package/dist/reasoning/set-theory/hf-functions.d.ts.map +1 -0
- package/dist/reasoning/set-theory/hf-functions.js +147 -0
- package/dist/reasoning/set-theory/hf-functions.js.map +1 -0
- package/dist/reasoning/set-theory/hf-sets.d.ts +79 -0
- package/dist/reasoning/set-theory/hf-sets.d.ts.map +1 -0
- package/dist/reasoning/set-theory/hf-sets.js +338 -0
- package/dist/reasoning/set-theory/hf-sets.js.map +1 -0
- package/dist/reasoning/set-theory/index.d.ts +7 -0
- package/dist/reasoning/set-theory/index.d.ts.map +1 -0
- package/dist/reasoning/set-theory/index.js +44 -0
- package/dist/reasoning/set-theory/index.js.map +1 -0
- package/dist/reasoning/set-theory/zfc-axioms.d.ts +59 -0
- package/dist/reasoning/set-theory/zfc-axioms.d.ts.map +1 -0
- package/dist/reasoning/set-theory/zfc-axioms.js +245 -0
- package/dist/reasoning/set-theory/zfc-axioms.js.map +1 -0
- package/dist/tests/proof-systems/fol-prover-advanced/prover.test.d.ts +2 -0
- package/dist/tests/proof-systems/fol-prover-advanced/prover.test.d.ts.map +1 -0
- package/dist/tests/proof-systems/fol-prover-advanced/prover.test.js +253 -0
- package/dist/tests/proof-systems/fol-prover-advanced/prover.test.js.map +1 -0
- package/dist/tests/reasoning/combinatorics/combinatorics.test.d.ts +2 -0
- package/dist/tests/reasoning/combinatorics/combinatorics.test.d.ts.map +1 -0
- package/dist/tests/reasoning/combinatorics/combinatorics.test.js +256 -0
- package/dist/tests/reasoning/combinatorics/combinatorics.test.js.map +1 -0
- package/dist/tests/reasoning/constructive-analysis/constructive-analysis.test.d.ts +2 -0
- package/dist/tests/reasoning/constructive-analysis/constructive-analysis.test.d.ts.map +1 -0
- package/dist/tests/reasoning/constructive-analysis/constructive-analysis.test.js +174 -0
- package/dist/tests/reasoning/constructive-analysis/constructive-analysis.test.js.map +1 -0
- package/dist/tests/reasoning/datalog/datalog.test.d.ts +2 -0
- package/dist/tests/reasoning/datalog/datalog.test.d.ts.map +1 -0
- package/dist/tests/reasoning/datalog/datalog.test.js +333 -0
- package/dist/tests/reasoning/datalog/datalog.test.js.map +1 -0
- package/dist/tests/reasoning/galois-fields/galois-fields.test.d.ts +2 -0
- package/dist/tests/reasoning/galois-fields/galois-fields.test.d.ts.map +1 -0
- package/dist/tests/reasoning/galois-fields/galois-fields.test.js +226 -0
- package/dist/tests/reasoning/galois-fields/galois-fields.test.js.map +1 -0
- package/dist/tests/reasoning/lattice/lattice.test.d.ts +2 -0
- package/dist/tests/reasoning/lattice/lattice.test.d.ts.map +1 -0
- package/dist/tests/reasoning/lattice/lattice.test.js +238 -0
- package/dist/tests/reasoning/lattice/lattice.test.js.map +1 -0
- package/dist/tests/reasoning/linear-algebra/linear-algebra.test.d.ts +2 -0
- package/dist/tests/reasoning/linear-algebra/linear-algebra.test.d.ts.map +1 -0
- package/dist/tests/reasoning/linear-algebra/linear-algebra.test.js +369 -0
- package/dist/tests/reasoning/linear-algebra/linear-algebra.test.js.map +1 -0
- package/dist/tests/reasoning/polynomial-ring/polynomial-ring.test.d.ts +2 -0
- package/dist/tests/reasoning/polynomial-ring/polynomial-ring.test.d.ts.map +1 -0
- package/dist/tests/reasoning/polynomial-ring/polynomial-ring.test.js +230 -0
- package/dist/tests/reasoning/polynomial-ring/polynomial-ring.test.js.map +1 -0
- package/dist/tests/reasoning/set-theory/hf-functions.test.d.ts +2 -0
- package/dist/tests/reasoning/set-theory/hf-functions.test.d.ts.map +1 -0
- package/dist/tests/reasoning/set-theory/hf-functions.test.js +122 -0
- package/dist/tests/reasoning/set-theory/hf-functions.test.js.map +1 -0
- package/dist/tests/reasoning/set-theory/hf-sets.test.d.ts +2 -0
- package/dist/tests/reasoning/set-theory/hf-sets.test.d.ts.map +1 -0
- package/dist/tests/reasoning/set-theory/hf-sets.test.js +177 -0
- package/dist/tests/reasoning/set-theory/hf-sets.test.js.map +1 -0
- package/dist/tests/reasoning/set-theory/zfc-axioms.test.d.ts +2 -0
- package/dist/tests/reasoning/set-theory/zfc-axioms.test.d.ts.map +1 -0
- package/dist/tests/reasoning/set-theory/zfc-axioms.test.js +56 -0
- package/dist/tests/reasoning/set-theory/zfc-axioms.test.js.map +1 -0
- package/dist/tests/tooling/doc-gen/doc-gen.test.d.ts +2 -0
- package/dist/tests/tooling/doc-gen/doc-gen.test.d.ts.map +1 -0
- package/dist/tests/tooling/doc-gen/doc-gen.test.js +350 -0
- package/dist/tests/tooling/doc-gen/doc-gen.test.js.map +1 -0
- package/dist/tests/tooling/test-harness/test-harness.test.d.ts +2 -0
- package/dist/tests/tooling/test-harness/test-harness.test.d.ts.map +1 -0
- package/dist/tests/tooling/test-harness/test-harness.test.js +208 -0
- package/dist/tests/tooling/test-harness/test-harness.test.js.map +1 -0
- package/dist/tests/type-theory/lambda-cube/lambda-cube.test.d.ts +2 -0
- package/dist/tests/type-theory/lambda-cube/lambda-cube.test.d.ts.map +1 -0
- package/dist/tests/type-theory/lambda-cube/lambda-cube.test.js +266 -0
- package/dist/tests/type-theory/lambda-cube/lambda-cube.test.js.map +1 -0
- package/dist/tooling/doc-gen/extract.d.ts +13 -0
- package/dist/tooling/doc-gen/extract.d.ts.map +1 -0
- package/dist/tooling/doc-gen/extract.js +379 -0
- package/dist/tooling/doc-gen/extract.js.map +1 -0
- package/dist/tooling/doc-gen/generate.d.ts +9 -0
- package/dist/tooling/doc-gen/generate.d.ts.map +1 -0
- package/dist/tooling/doc-gen/generate.js +116 -0
- package/dist/tooling/doc-gen/generate.js.map +1 -0
- package/dist/tooling/doc-gen/index.d.ts +7 -0
- package/dist/tooling/doc-gen/index.d.ts.map +1 -0
- package/dist/tooling/doc-gen/index.js +39 -0
- package/dist/tooling/doc-gen/index.js.map +1 -0
- package/dist/tooling/doc-gen/jsdoc.d.ts +31 -0
- package/dist/tooling/doc-gen/jsdoc.d.ts.map +1 -0
- package/dist/tooling/doc-gen/jsdoc.js +140 -0
- package/dist/tooling/doc-gen/jsdoc.js.map +1 -0
- package/dist/tooling/doc-gen/render.d.ts +29 -0
- package/dist/tooling/doc-gen/render.d.ts.map +1 -0
- package/dist/tooling/doc-gen/render.js +206 -0
- package/dist/tooling/doc-gen/render.js.map +1 -0
- package/dist/tooling/doc-gen/types.d.ts +51 -0
- package/dist/tooling/doc-gen/types.d.ts.map +1 -0
- package/dist/tooling/doc-gen/types.js +10 -0
- package/dist/tooling/doc-gen/types.js.map +1 -0
- package/dist/tooling/test-harness/combinators.d.ts +14 -0
- package/dist/tooling/test-harness/combinators.d.ts.map +1 -0
- package/dist/tooling/test-harness/combinators.js +122 -0
- package/dist/tooling/test-harness/combinators.js.map +1 -0
- package/dist/tooling/test-harness/coverage.d.ts +3 -0
- package/dist/tooling/test-harness/coverage.d.ts.map +1 -0
- package/dist/tooling/test-harness/coverage.js +32 -0
- package/dist/tooling/test-harness/coverage.js.map +1 -0
- package/dist/tooling/test-harness/generators.d.ts +6 -0
- package/dist/tooling/test-harness/generators.d.ts.map +1 -0
- package/dist/tooling/test-harness/generators.js +66 -0
- package/dist/tooling/test-harness/generators.js.map +1 -0
- package/dist/tooling/test-harness/index.d.ts +7 -0
- package/dist/tooling/test-harness/index.d.ts.map +1 -0
- package/dist/tooling/test-harness/index.js +27 -0
- package/dist/tooling/test-harness/index.js.map +1 -0
- package/dist/tooling/test-harness/mutation.d.ts +4 -0
- package/dist/tooling/test-harness/mutation.d.ts.map +1 -0
- package/dist/tooling/test-harness/mutation.js +28 -0
- package/dist/tooling/test-harness/mutation.js.map +1 -0
- package/dist/tooling/test-harness/snapshot.d.ts +5 -0
- package/dist/tooling/test-harness/snapshot.d.ts.map +1 -0
- package/dist/tooling/test-harness/snapshot.js +86 -0
- package/dist/tooling/test-harness/snapshot.js.map +1 -0
- package/dist/tooling/test-harness/types.d.ts +32 -0
- package/dist/tooling/test-harness/types.d.ts.map +1 -0
- package/dist/tooling/test-harness/types.js +3 -0
- package/dist/tooling/test-harness/types.js.map +1 -0
- package/dist/type-theory/lambda-cube/erase.d.ts +26 -0
- package/dist/type-theory/lambda-cube/erase.d.ts.map +1 -0
- package/dist/type-theory/lambda-cube/erase.js +68 -0
- package/dist/type-theory/lambda-cube/erase.js.map +1 -0
- package/dist/type-theory/lambda-cube/examples.d.ts +59 -0
- package/dist/type-theory/lambda-cube/examples.d.ts.map +1 -0
- package/dist/type-theory/lambda-cube/examples.js +110 -0
- package/dist/type-theory/lambda-cube/examples.js.map +1 -0
- package/dist/type-theory/lambda-cube/index.d.ts +11 -0
- package/dist/type-theory/lambda-cube/index.d.ts.map +1 -0
- package/dist/type-theory/lambda-cube/index.js +64 -0
- package/dist/type-theory/lambda-cube/index.js.map +1 -0
- package/dist/type-theory/lambda-cube/normalize.d.ts +17 -0
- package/dist/type-theory/lambda-cube/normalize.d.ts.map +1 -0
- package/dist/type-theory/lambda-cube/normalize.js +134 -0
- package/dist/type-theory/lambda-cube/normalize.js.map +1 -0
- package/dist/type-theory/lambda-cube/rules.d.ts +26 -0
- package/dist/type-theory/lambda-cube/rules.d.ts.map +1 -0
- package/dist/type-theory/lambda-cube/rules.js +67 -0
- package/dist/type-theory/lambda-cube/rules.js.map +1 -0
- package/dist/type-theory/lambda-cube/typecheck.d.ts +20 -0
- package/dist/type-theory/lambda-cube/typecheck.d.ts.map +1 -0
- package/dist/type-theory/lambda-cube/typecheck.js +168 -0
- package/dist/type-theory/lambda-cube/typecheck.js.map +1 -0
- package/dist/type-theory/lambda-cube/types.d.ts +40 -0
- package/dist/type-theory/lambda-cube/types.d.ts.map +1 -0
- package/dist/type-theory/lambda-cube/types.js +192 -0
- package/dist/type-theory/lambda-cube/types.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"examples.js","sourceRoot":"","sources":["../../../src/type-theory/lambda-cube/examples.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,mCAAmC;AACnC,+DAA+D;AAC/D,EAAE;AACF,iEAAiE;AACjE,kEAAkE;AAClE,qDAAqD;;AAQrD,kDAEC;AAGD,0DAEC;AAQD,sCAUC;AAGD,8CAGC;AAQD,wCAKC;AAcD,sCAEC;AASD,4CAEC;AAMD,8CAEC;AAGD,sDAEC;AAOD,kDAEC;AAnGD,mCAA8E;AAE9E;;;GAGG;AACH,SAAgB,mBAAmB;IACjC,OAAO,IAAA,YAAI,EAAC,GAA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xD,CAAC;AAED,oDAAoD;AACpD,SAAgB,qBAAqB;IACnC,OAAO,IAAA,cAAM,EAAC,aAAK,EAAE,aAAK,CAAC,CAAC;AAC9B,CAAC;AAED;;;;GAIG;AACH,SAAgB,mBAAmB;IACjC,OAAO,IAAA,WAAG,EAAC,GAAG,EAAE,aAAK,EAAE,IAAA,cAAM,EAAC,IAAA,YAAI,EAAC,GAAG,CAAC,EAAE,IAAA,YAAI,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type { Sort, CubeSystem, CubeTerm, CubeContext } from './types';
|
|
2
|
+
export { cVar, cSort, cStar, cBox, cPi, cLam, cApp, cArrow, occursFree, freeVars, termToString, alphaEq, emptyContext, extendContext, } from './types';
|
|
3
|
+
export type { FormationRule, CubeRules } from './rules';
|
|
4
|
+
export { SYSTEMS, hasRule, rulesOf, AXIOMS, axiomFor } from './rules';
|
|
5
|
+
export { substitute, reduceStep, normalize, alphaBetaEq, isNormal } from './normalize';
|
|
6
|
+
export type { InferError, InferResult } from './typecheck';
|
|
7
|
+
export { inferType, checkType, isInferError, isClosedUnder } from './typecheck';
|
|
8
|
+
export type { UntypedTerm, EraseError } from './erase';
|
|
9
|
+
export { erase, isEraseError, untypedToString } from './erase';
|
|
10
|
+
export { polymorphicIdentity, polymorphicIdentityType, churchNumeral, churchNumeralType, churchPairType, dependentList, predicateOverNat, typeLevelIdentity, typeLevelIdentityKind, cocPolyIdentityType, } from './examples';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/type-theory/lambda-cube/index.ts"],"names":[],"mappings":"AAcA,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACvE,OAAO,EACL,IAAI,EACJ,KAAK,EACL,KAAK,EACL,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,aAAa,GACd,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvF,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEhF,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/D,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================
|
|
3
|
+
// Lambda Cube (Barendregt) — API pública
|
|
4
|
+
// ============================================================
|
|
5
|
+
//
|
|
6
|
+
// Implementación uniforme de los 8 vértices del cubo λ como un Pure
|
|
7
|
+
// Type System (PTS) parametrizado por el conjunto de reglas de
|
|
8
|
+
// formación. Permite:
|
|
9
|
+
//
|
|
10
|
+
// - inferType / checkType en cualquier vértice (λ→, λ2, λω, λC, ...).
|
|
11
|
+
// - normalize por β-reducción (call-by-name).
|
|
12
|
+
// - erase a λ-cálculo no tipado.
|
|
13
|
+
// - Construcciones canónicas: identity polimórfico, Church numerals,
|
|
14
|
+
// id-type operator, dependent list schema, etc.
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.cocPolyIdentityType = exports.typeLevelIdentityKind = exports.typeLevelIdentity = exports.predicateOverNat = exports.dependentList = exports.churchPairType = exports.churchNumeralType = exports.churchNumeral = exports.polymorphicIdentityType = exports.polymorphicIdentity = exports.untypedToString = exports.isEraseError = exports.erase = exports.isClosedUnder = exports.isInferError = exports.checkType = exports.inferType = exports.isNormal = exports.alphaBetaEq = exports.normalize = exports.reduceStep = exports.substitute = exports.axiomFor = exports.AXIOMS = exports.rulesOf = exports.hasRule = exports.SYSTEMS = exports.extendContext = exports.emptyContext = exports.alphaEq = exports.termToString = exports.freeVars = exports.occursFree = exports.cArrow = exports.cApp = exports.cLam = exports.cPi = exports.cBox = exports.cStar = exports.cSort = exports.cVar = void 0;
|
|
17
|
+
var types_1 = require("./types");
|
|
18
|
+
Object.defineProperty(exports, "cVar", { enumerable: true, get: function () { return types_1.cVar; } });
|
|
19
|
+
Object.defineProperty(exports, "cSort", { enumerable: true, get: function () { return types_1.cSort; } });
|
|
20
|
+
Object.defineProperty(exports, "cStar", { enumerable: true, get: function () { return types_1.cStar; } });
|
|
21
|
+
Object.defineProperty(exports, "cBox", { enumerable: true, get: function () { return types_1.cBox; } });
|
|
22
|
+
Object.defineProperty(exports, "cPi", { enumerable: true, get: function () { return types_1.cPi; } });
|
|
23
|
+
Object.defineProperty(exports, "cLam", { enumerable: true, get: function () { return types_1.cLam; } });
|
|
24
|
+
Object.defineProperty(exports, "cApp", { enumerable: true, get: function () { return types_1.cApp; } });
|
|
25
|
+
Object.defineProperty(exports, "cArrow", { enumerable: true, get: function () { return types_1.cArrow; } });
|
|
26
|
+
Object.defineProperty(exports, "occursFree", { enumerable: true, get: function () { return types_1.occursFree; } });
|
|
27
|
+
Object.defineProperty(exports, "freeVars", { enumerable: true, get: function () { return types_1.freeVars; } });
|
|
28
|
+
Object.defineProperty(exports, "termToString", { enumerable: true, get: function () { return types_1.termToString; } });
|
|
29
|
+
Object.defineProperty(exports, "alphaEq", { enumerable: true, get: function () { return types_1.alphaEq; } });
|
|
30
|
+
Object.defineProperty(exports, "emptyContext", { enumerable: true, get: function () { return types_1.emptyContext; } });
|
|
31
|
+
Object.defineProperty(exports, "extendContext", { enumerable: true, get: function () { return types_1.extendContext; } });
|
|
32
|
+
var rules_1 = require("./rules");
|
|
33
|
+
Object.defineProperty(exports, "SYSTEMS", { enumerable: true, get: function () { return rules_1.SYSTEMS; } });
|
|
34
|
+
Object.defineProperty(exports, "hasRule", { enumerable: true, get: function () { return rules_1.hasRule; } });
|
|
35
|
+
Object.defineProperty(exports, "rulesOf", { enumerable: true, get: function () { return rules_1.rulesOf; } });
|
|
36
|
+
Object.defineProperty(exports, "AXIOMS", { enumerable: true, get: function () { return rules_1.AXIOMS; } });
|
|
37
|
+
Object.defineProperty(exports, "axiomFor", { enumerable: true, get: function () { return rules_1.axiomFor; } });
|
|
38
|
+
var normalize_1 = require("./normalize");
|
|
39
|
+
Object.defineProperty(exports, "substitute", { enumerable: true, get: function () { return normalize_1.substitute; } });
|
|
40
|
+
Object.defineProperty(exports, "reduceStep", { enumerable: true, get: function () { return normalize_1.reduceStep; } });
|
|
41
|
+
Object.defineProperty(exports, "normalize", { enumerable: true, get: function () { return normalize_1.normalize; } });
|
|
42
|
+
Object.defineProperty(exports, "alphaBetaEq", { enumerable: true, get: function () { return normalize_1.alphaBetaEq; } });
|
|
43
|
+
Object.defineProperty(exports, "isNormal", { enumerable: true, get: function () { return normalize_1.isNormal; } });
|
|
44
|
+
var typecheck_1 = require("./typecheck");
|
|
45
|
+
Object.defineProperty(exports, "inferType", { enumerable: true, get: function () { return typecheck_1.inferType; } });
|
|
46
|
+
Object.defineProperty(exports, "checkType", { enumerable: true, get: function () { return typecheck_1.checkType; } });
|
|
47
|
+
Object.defineProperty(exports, "isInferError", { enumerable: true, get: function () { return typecheck_1.isInferError; } });
|
|
48
|
+
Object.defineProperty(exports, "isClosedUnder", { enumerable: true, get: function () { return typecheck_1.isClosedUnder; } });
|
|
49
|
+
var erase_1 = require("./erase");
|
|
50
|
+
Object.defineProperty(exports, "erase", { enumerable: true, get: function () { return erase_1.erase; } });
|
|
51
|
+
Object.defineProperty(exports, "isEraseError", { enumerable: true, get: function () { return erase_1.isEraseError; } });
|
|
52
|
+
Object.defineProperty(exports, "untypedToString", { enumerable: true, get: function () { return erase_1.untypedToString; } });
|
|
53
|
+
var examples_1 = require("./examples");
|
|
54
|
+
Object.defineProperty(exports, "polymorphicIdentity", { enumerable: true, get: function () { return examples_1.polymorphicIdentity; } });
|
|
55
|
+
Object.defineProperty(exports, "polymorphicIdentityType", { enumerable: true, get: function () { return examples_1.polymorphicIdentityType; } });
|
|
56
|
+
Object.defineProperty(exports, "churchNumeral", { enumerable: true, get: function () { return examples_1.churchNumeral; } });
|
|
57
|
+
Object.defineProperty(exports, "churchNumeralType", { enumerable: true, get: function () { return examples_1.churchNumeralType; } });
|
|
58
|
+
Object.defineProperty(exports, "churchPairType", { enumerable: true, get: function () { return examples_1.churchPairType; } });
|
|
59
|
+
Object.defineProperty(exports, "dependentList", { enumerable: true, get: function () { return examples_1.dependentList; } });
|
|
60
|
+
Object.defineProperty(exports, "predicateOverNat", { enumerable: true, get: function () { return examples_1.predicateOverNat; } });
|
|
61
|
+
Object.defineProperty(exports, "typeLevelIdentity", { enumerable: true, get: function () { return examples_1.typeLevelIdentity; } });
|
|
62
|
+
Object.defineProperty(exports, "typeLevelIdentityKind", { enumerable: true, get: function () { return examples_1.typeLevelIdentityKind; } });
|
|
63
|
+
Object.defineProperty(exports, "cocPolyIdentityType", { enumerable: true, get: function () { return examples_1.cocPolyIdentityType; } });
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/type-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,yGAAA,aAAa,OAAA;AACb,4GAAA,gBAAgB,OAAA;AAChB,6GAAA,iBAAiB,OAAA;AACjB,iHAAA,qBAAqB,OAAA;AACrB,+GAAA,mBAAmB,OAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CubeSystem } from './types';
|
|
2
|
+
import { type CubeTerm } from './types';
|
|
3
|
+
/** Sustitución capture-avoiding: term[value/name]. */
|
|
4
|
+
export declare function substitute(term: CubeTerm, name: string, value: CubeTerm): CubeTerm;
|
|
5
|
+
/**
|
|
6
|
+
* Un paso de β-reducción top-down (call-by-name): si el término es
|
|
7
|
+
* `(λ x:A. b) arg`, devuelve `b[arg/x]`. Si no hay redex top-level,
|
|
8
|
+
* intenta reducir en sub-términos.
|
|
9
|
+
*/
|
|
10
|
+
export declare function reduceStep(term: CubeTerm): CubeTerm | undefined;
|
|
11
|
+
/** Normaliza por reducción a normal-form. `maxSteps` evita loops divergentes. */
|
|
12
|
+
export declare function normalize(term: CubeTerm, _system: CubeSystem, maxSteps?: number): CubeTerm;
|
|
13
|
+
/** ¿Dos términos son iguales módulo α y β? */
|
|
14
|
+
export declare function alphaBetaEq(a: CubeTerm, b: CubeTerm, system: CubeSystem): boolean;
|
|
15
|
+
/** ¿El término está en forma normal (no quedan β-redex)? */
|
|
16
|
+
export declare function isNormal(term: CubeTerm): boolean;
|
|
17
|
+
//# sourceMappingURL=normalize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../src/type-theory/lambda-cube/normalize.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,KAAK,QAAQ,EAAqB,MAAM,SAAS,CAAC;AAU3D,sDAAsD;AACtD,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,QAAQ,CA2BlF;AA0BD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAgC/D;AAED,iFAAiF;AACjF,wBAAgB,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,SAAO,GAAG,QAAQ,CAQxF;AAED,8CAA8C;AAC9C,wBAAgB,WAAW,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAKjF;AAED,4DAA4D;AAC5D,wBAAgB,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAEhD"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================
|
|
3
|
+
// Lambda Cube — Sustitución capture-avoiding + β-normalización
|
|
4
|
+
// ============================================================
|
|
5
|
+
//
|
|
6
|
+
// Al ser un Pure Type System, tipos y términos comparten sintaxis.
|
|
7
|
+
// La β-reducción ocurre en cualquier sub-término, así que normalize
|
|
8
|
+
// también reduce dentro de Π y dentro del dominio de λ.
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.substitute = substitute;
|
|
11
|
+
exports.reduceStep = reduceStep;
|
|
12
|
+
exports.normalize = normalize;
|
|
13
|
+
exports.alphaBetaEq = alphaBetaEq;
|
|
14
|
+
exports.isNormal = isNormal;
|
|
15
|
+
const types_1 = require("./types");
|
|
16
|
+
let freshCounter = 0;
|
|
17
|
+
function fresh(base, avoid) {
|
|
18
|
+
let candidate = `${base}#${freshCounter++}`;
|
|
19
|
+
while (avoid.has(candidate))
|
|
20
|
+
candidate = `${base}#${freshCounter++}`;
|
|
21
|
+
return candidate;
|
|
22
|
+
}
|
|
23
|
+
/** Sustitución capture-avoiding: term[value/name]. */
|
|
24
|
+
function substitute(term, name, value) {
|
|
25
|
+
switch (term.kind) {
|
|
26
|
+
case 'var':
|
|
27
|
+
return term.name === name ? value : term;
|
|
28
|
+
case 'sort':
|
|
29
|
+
return term;
|
|
30
|
+
case 'pi':
|
|
31
|
+
return substBinder(term.bind, term.domain, term.codomain, name, value, (b, d, c) => ({
|
|
32
|
+
kind: 'pi',
|
|
33
|
+
bind: b,
|
|
34
|
+
domain: d,
|
|
35
|
+
codomain: c,
|
|
36
|
+
}));
|
|
37
|
+
case 'lam':
|
|
38
|
+
return substBinder(term.bind, term.domain, term.body, name, value, (b, d, c) => ({
|
|
39
|
+
kind: 'lam',
|
|
40
|
+
bind: b,
|
|
41
|
+
domain: d,
|
|
42
|
+
body: c,
|
|
43
|
+
}));
|
|
44
|
+
case 'app':
|
|
45
|
+
return {
|
|
46
|
+
kind: 'app',
|
|
47
|
+
fn: substitute(term.fn, name, value),
|
|
48
|
+
arg: substitute(term.arg, name, value),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function substBinder(bind, dom, body, name, value, build) {
|
|
53
|
+
const newDom = substitute(dom, name, value);
|
|
54
|
+
// Si el binder coincide con `name`, `body` no contiene `name` libre.
|
|
55
|
+
if (bind === name) {
|
|
56
|
+
return build(bind, newDom, body);
|
|
57
|
+
}
|
|
58
|
+
const fv = (0, types_1.freeVars)(value);
|
|
59
|
+
if (fv.has(bind)) {
|
|
60
|
+
const newBind = fresh(bind, new Set([...fv, ...(0, types_1.freeVars)(body), name]));
|
|
61
|
+
const renamed = substitute(body, bind, { kind: 'var', name: newBind });
|
|
62
|
+
return build(newBind, newDom, substitute(renamed, name, value));
|
|
63
|
+
}
|
|
64
|
+
return build(bind, newDom, substitute(body, name, value));
|
|
65
|
+
}
|
|
66
|
+
// ---------- β-reducción ----------
|
|
67
|
+
/**
|
|
68
|
+
* Un paso de β-reducción top-down (call-by-name): si el término es
|
|
69
|
+
* `(λ x:A. b) arg`, devuelve `b[arg/x]`. Si no hay redex top-level,
|
|
70
|
+
* intenta reducir en sub-términos.
|
|
71
|
+
*/
|
|
72
|
+
function reduceStep(term) {
|
|
73
|
+
switch (term.kind) {
|
|
74
|
+
case 'var':
|
|
75
|
+
case 'sort':
|
|
76
|
+
return undefined;
|
|
77
|
+
case 'app': {
|
|
78
|
+
// β-redex top-level
|
|
79
|
+
if (term.fn.kind === 'lam') {
|
|
80
|
+
return substitute(term.fn.body, term.fn.bind, term.arg);
|
|
81
|
+
}
|
|
82
|
+
// Reducir fn primero (call-by-name)
|
|
83
|
+
const fnRed = reduceStep(term.fn);
|
|
84
|
+
if (fnRed)
|
|
85
|
+
return { kind: 'app', fn: fnRed, arg: term.arg };
|
|
86
|
+
const argRed = reduceStep(term.arg);
|
|
87
|
+
if (argRed)
|
|
88
|
+
return { kind: 'app', fn: term.fn, arg: argRed };
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
case 'pi': {
|
|
92
|
+
const dom = reduceStep(term.domain);
|
|
93
|
+
if (dom)
|
|
94
|
+
return { kind: 'pi', bind: term.bind, domain: dom, codomain: term.codomain };
|
|
95
|
+
const cod = reduceStep(term.codomain);
|
|
96
|
+
if (cod)
|
|
97
|
+
return { kind: 'pi', bind: term.bind, domain: term.domain, codomain: cod };
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
case 'lam': {
|
|
101
|
+
const dom = reduceStep(term.domain);
|
|
102
|
+
if (dom)
|
|
103
|
+
return { kind: 'lam', bind: term.bind, domain: dom, body: term.body };
|
|
104
|
+
const body = reduceStep(term.body);
|
|
105
|
+
if (body)
|
|
106
|
+
return { kind: 'lam', bind: term.bind, domain: term.domain, body };
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/** Normaliza por reducción a normal-form. `maxSteps` evita loops divergentes. */
|
|
112
|
+
function normalize(term, _system, maxSteps = 1000) {
|
|
113
|
+
let current = term;
|
|
114
|
+
for (let i = 0; i < maxSteps; i++) {
|
|
115
|
+
const next = reduceStep(current);
|
|
116
|
+
if (next === undefined)
|
|
117
|
+
return current;
|
|
118
|
+
current = next;
|
|
119
|
+
}
|
|
120
|
+
return current;
|
|
121
|
+
}
|
|
122
|
+
/** ¿Dos términos son iguales módulo α y β? */
|
|
123
|
+
function alphaBetaEq(a, b, system) {
|
|
124
|
+
if ((0, types_1.alphaEq)(a, b))
|
|
125
|
+
return true;
|
|
126
|
+
const na = normalize(a, system);
|
|
127
|
+
const nb = normalize(b, system);
|
|
128
|
+
return (0, types_1.alphaEq)(na, nb);
|
|
129
|
+
}
|
|
130
|
+
/** ¿El término está en forma normal (no quedan β-redex)? */
|
|
131
|
+
function isNormal(term) {
|
|
132
|
+
return reduceStep(term) === undefined;
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=normalize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../../src/type-theory/lambda-cube/normalize.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,+DAA+D;AAC/D,+DAA+D;AAC/D,EAAE;AACF,mEAAmE;AACnE,oEAAoE;AACpE,wDAAwD;;AAcxD,gCA2BC;AA+BD,gCAgCC;AAGD,8BAQC;AAGD,kCAKC;AAGD,4BAEC;AA7HD,mCAA2D;AAE3D,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB,SAAS,KAAK,CAAC,IAAY,EAAE,KAAkB;IAC7C,IAAI,SAAS,GAAG,GAAG,IAAI,IAAI,YAAY,EAAE,EAAE,CAAC;IAC5C,OAAO,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC;QAAE,SAAS,GAAG,GAAG,IAAI,IAAI,YAAY,EAAE,EAAE,CAAC;IACrE,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,sDAAsD;AACtD,SAAgB,UAAU,CAAC,IAAc,EAAE,IAAY,EAAE,KAAe;IACtE,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,KAAK;YACR,OAAO,IAAI,CAAC,IAAI,KA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OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;YAC7E,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;AACH,CAAC;AAED,iFAAiF;AACjF,SAAgB,SAAS,CAAC,IAAc,EAAE,OAAmB,EAAE,QAAQ,GAAG,IAAI;IAC5E,IAAI,OAAO,GAAG,IAAI,CAAC;IACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;QACjC,IAAI,IAAI,KAAK,SAAS;YAAE,OAAO,OAAO,CAAC;QACvC,OAAO,GAAG,IAAI,CAAC;IACjB,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,8CAA8C;AAC9C,SAAgB,WAAW,CAAC,CAAW,EAAE,CAAW,EAAE,MAAkB;IACtE,IAAI,IAAA,eAAO,EAAC,CAAC,EAAE,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAC/B,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAChC,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAChC,OAAO,IAAA,eAAO,EAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AACzB,CAAC;AAED,4DAA4D;AAC5D,SAAgB,QAAQ,CAAC,IAAc;IACrC,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CubeSystem, Sort } from './types';
|
|
2
|
+
export interface FormationRule {
|
|
3
|
+
from: Sort;
|
|
4
|
+
to: Sort;
|
|
5
|
+
}
|
|
6
|
+
export interface CubeRules {
|
|
7
|
+
formationRules: FormationRule[];
|
|
8
|
+
}
|
|
9
|
+
export declare const SYSTEMS: Record<CubeSystem, CubeRules>;
|
|
10
|
+
/** ¿El par (s1, s2) está en las reglas de formación de `system`? */
|
|
11
|
+
export declare function hasRule(system: CubeSystem, from: Sort, to: Sort): boolean;
|
|
12
|
+
/** Conjunto de pares de formación de un sistema, en orden canónico. */
|
|
13
|
+
export declare function rulesOf(system: CubeSystem): FormationRule[];
|
|
14
|
+
/**
|
|
15
|
+
* Reglas de axioma. En el cubo Barendregt clásico el único axioma es
|
|
16
|
+
* * : ◻
|
|
17
|
+
* (no hay jerarquía de universos: ◻ no tiene tipo propio, por eso los
|
|
18
|
+
* términos del cubo no pueden anidar ◻ : ?). Si se intentara tipar ◻
|
|
19
|
+
* directamente, el typechecker reportará error.
|
|
20
|
+
*/
|
|
21
|
+
export declare const AXIOMS: Array<{
|
|
22
|
+
sort: Sort;
|
|
23
|
+
type: Sort;
|
|
24
|
+
}>;
|
|
25
|
+
export declare function axiomFor(sort: Sort): Sort | undefined;
|
|
26
|
+
//# sourceMappingURL=rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../src/type-theory/lambda-cube/rules.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEhD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,IAAI,CAAC;IACX,EAAE,EAAE,IAAI,CAAC;CACV;AAED,MAAM,WAAW,SAAS;IACxB,cAAc,EAAE,aAAa,EAAE,CAAC;CACjC;AAOD,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,SAAS,CASjD,CAAC;AAEF,oEAAoE;AACpE,wBAAgB,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,GAAG,OAAO,CAMzE;AAED,uEAAuE;AACvE,wBAAgB,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,aAAa,EAAE,CAE3D;AAED;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,CAA8B,CAAC;AAEpF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,CAKrD"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================
|
|
3
|
+
// Lambda Cube — Pure Type System rules per vértice
|
|
4
|
+
// ============================================================
|
|
5
|
+
//
|
|
6
|
+
// Cada sistema del cubo se identifica por su conjunto de reglas de
|
|
7
|
+
// formación (s1, s2): bajo qué sorts es legal formar `Π x:A. B` donde
|
|
8
|
+
// `A : s1` y `B : s2`.
|
|
9
|
+
//
|
|
10
|
+
// La regla común a todos los sistemas es (*, *) — la flecha sobre
|
|
11
|
+
// términos del λ-cálculo simplemente tipado. Las otras tres se
|
|
12
|
+
// "encienden" según la posición en el cubo:
|
|
13
|
+
//
|
|
14
|
+
// eje X (◻, *) — polimorfismo: cuantificar sobre tipos
|
|
15
|
+
// eje Y (◻, ◻) — operadores de tipo: funciones type→type
|
|
16
|
+
// eje Z (*, ◻) — tipos dependientes: tipo que depende de un valor
|
|
17
|
+
//
|
|
18
|
+
// Cualquier subconjunto que contenga (*, *) da un PTS coherente.
|
|
19
|
+
// El número total de vértices es 2^3 = 8.
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.AXIOMS = exports.SYSTEMS = void 0;
|
|
22
|
+
exports.hasRule = hasRule;
|
|
23
|
+
exports.rulesOf = rulesOf;
|
|
24
|
+
exports.axiomFor = axiomFor;
|
|
25
|
+
const BASE = { from: '*', to: '*' };
|
|
26
|
+
const POLY = { from: '◻', to: '*' };
|
|
27
|
+
const OPS = { from: '◻', to: '◻' };
|
|
28
|
+
const DEP = { from: '*', to: '◻' };
|
|
29
|
+
exports.SYSTEMS = {
|
|
30
|
+
lambda: { formationRules: [BASE] },
|
|
31
|
+
lambda2: { formationRules: [BASE, POLY] },
|
|
32
|
+
'lambda-omega-bar': { formationRules: [BASE, OPS] },
|
|
33
|
+
'lambda-omega': { formationRules: [BASE, POLY, OPS] },
|
|
34
|
+
'lambda-P': { formationRules: [BASE, DEP] },
|
|
35
|
+
'lambda-P2': { formationRules: [BASE, POLY, DEP] },
|
|
36
|
+
'lambda-P-omega': { formationRules: [BASE, OPS, DEP] },
|
|
37
|
+
'lambda-C': { formationRules: [BASE, POLY, OPS, DEP] },
|
|
38
|
+
};
|
|
39
|
+
/** ¿El par (s1, s2) está en las reglas de formación de `system`? */
|
|
40
|
+
function hasRule(system, from, to) {
|
|
41
|
+
const rules = exports.SYSTEMS[system].formationRules;
|
|
42
|
+
for (const r of rules) {
|
|
43
|
+
if (r.from === from && r.to === to)
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
/** Conjunto de pares de formación de un sistema, en orden canónico. */
|
|
49
|
+
function rulesOf(system) {
|
|
50
|
+
return exports.SYSTEMS[system].formationRules;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Reglas de axioma. En el cubo Barendregt clásico el único axioma es
|
|
54
|
+
* * : ◻
|
|
55
|
+
* (no hay jerarquía de universos: ◻ no tiene tipo propio, por eso los
|
|
56
|
+
* términos del cubo no pueden anidar ◻ : ?). Si se intentara tipar ◻
|
|
57
|
+
* directamente, el typechecker reportará error.
|
|
58
|
+
*/
|
|
59
|
+
exports.AXIOMS = [{ sort: '*', type: '◻' }];
|
|
60
|
+
function axiomFor(sort) {
|
|
61
|
+
for (const a of exports.AXIOMS) {
|
|
62
|
+
if (a.sort === sort)
|
|
63
|
+
return a.type;
|
|
64
|
+
}
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMapp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,EAAE;IAClD,gBAAgB,EAAE,EAAE,cAAc,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE;IACtD,UAAU,EAAE,EAAE,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE;CACvD,CAAC;AAEF,oEAAoE;AACpE,SAAgB,OAAO,CAAC,MAAkB,EAAE,IAAU,EAAE,EAAQ;IAC9D,MAAM,KAAK,GAAG,eAAO,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC;IAC7C,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE;YAAE,OAAO,IAAI,CAAC;IAClD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,uEAAuE;AACvE,SAAgB,OAAO,CAAC,MAAkB;IACxC,OAAO,eAAO,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC;AACxC,CAAC;AAED;;;;;;GAMG;AACU,QAAA,MAAM,GAAsC,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;AAEpF,SAAgB,QAAQ,CAAC,IAAU;IACjC,KAAK,MAAM,CAAC,IAAI,cAAM,EAAE,CAAC;QACvB,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI;YAAE,OAAO,CAAC,CAAC,IAAI,CAAC;IACrC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type CubeTerm, type CubeContext } from './types';
|
|
2
|
+
import type { CubeSystem } from './types';
|
|
3
|
+
export type InferError = {
|
|
4
|
+
error: string;
|
|
5
|
+
};
|
|
6
|
+
export type InferResult = CubeTerm | InferError;
|
|
7
|
+
export declare function isInferError(r: InferResult): r is InferError;
|
|
8
|
+
/**
|
|
9
|
+
* Infiere el tipo de `term` bajo `ctx` en el sistema dado. Devuelve
|
|
10
|
+
* el tipo, o `{ error }` si no es tipable.
|
|
11
|
+
*/
|
|
12
|
+
export declare function inferType(term: CubeTerm, ctx?: CubeContext, system?: CubeSystem): InferResult;
|
|
13
|
+
/**
|
|
14
|
+
* Verifica que `term` tiene tipo `expected` bajo `ctx` en `system`.
|
|
15
|
+
* Igualdad de tipos: módulo α y β.
|
|
16
|
+
*/
|
|
17
|
+
export declare function checkType(term: CubeTerm, expected: CubeTerm, ctx?: CubeContext, system?: CubeSystem): boolean;
|
|
18
|
+
/** ¿Las variables libres del término tienen todas un binding en `ctx`? */
|
|
19
|
+
export declare function isClosedUnder(term: CubeTerm, ctx: CubeContext): boolean;
|
|
20
|
+
//# sourceMappingURL=typecheck.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typecheck.d.ts","sourceRoot":"","sources":["../../../src/type-theory/lambda-cube/typecheck.ts"],"names":[],"mappings":"AAkCA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,WAAW,EAMjB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C,MAAM,MAAM,UAAU,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAC3C,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEhD,wBAAgB,YAAY,CAAC,CAAC,EAAE,WAAW,GAAG,CAAC,IAAI,UAAU,CAE5D;AAWD;;;GAGG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,QAAQ,EACd,GAAG,GAAE,WAAuB,EAC5B,MAAM,GAAE,UAAuB,GAC9B,WAAW,CAoFb;AAED;;;GAGG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,QAAQ,EACd,QAAQ,EAAE,QAAQ,EAClB,GAAG,GAAE,WAAuB,EAC5B,MAAM,GAAE,UAAuB,GAC9B,OAAO,CAIT;AAED,0EAA0E;AAC1E,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,WAAW,GAAG,OAAO,CAKvE"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================
|
|
3
|
+
// Lambda Cube — Pure Type System type-checker
|
|
4
|
+
// ============================================================
|
|
5
|
+
//
|
|
6
|
+
// Algoritmo bidireccional uniforme para los 8 vértices del cubo. El
|
|
7
|
+
// sistema activo se pasa como parámetro y restringe qué Π / λ son
|
|
8
|
+
// legales mediante sus reglas de formación.
|
|
9
|
+
//
|
|
10
|
+
// Reglas PTS (versión cubo de Barendregt):
|
|
11
|
+
//
|
|
12
|
+
// AX: ⊢ * : ◻
|
|
13
|
+
// VAR: Γ, x:A ⊢ x : A (si A está bien formado)
|
|
14
|
+
// APP: Γ ⊢ f : (Π x:A. B)
|
|
15
|
+
// Γ ⊢ a : A
|
|
16
|
+
// ───────────────────
|
|
17
|
+
// Γ ⊢ f a : B[a/x]
|
|
18
|
+
//
|
|
19
|
+
// LAM: Γ, x:A ⊢ b : B
|
|
20
|
+
// Γ ⊢ (Π x:A. B) : s (well-formed)
|
|
21
|
+
// ───────────────────────────
|
|
22
|
+
// Γ ⊢ (λ x:A. b) : (Π x:A. B)
|
|
23
|
+
//
|
|
24
|
+
// PI: Γ ⊢ A : s1
|
|
25
|
+
// Γ, x:A ⊢ B : s2
|
|
26
|
+
// (s1, s2) ∈ R(system)
|
|
27
|
+
// ───────────────────────
|
|
28
|
+
// Γ ⊢ (Π x:A. B) : s2
|
|
29
|
+
//
|
|
30
|
+
// CONV: Γ ⊢ t : A, A =βη B, Γ ⊢ B : s
|
|
31
|
+
// ──────────────────────────────────
|
|
32
|
+
// Γ ⊢ t : B
|
|
33
|
+
//
|
|
34
|
+
// Sin η, sin universos jerárquicos.
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.isInferError = isInferError;
|
|
37
|
+
exports.inferType = inferType;
|
|
38
|
+
exports.checkType = checkType;
|
|
39
|
+
exports.isClosedUnder = isClosedUnder;
|
|
40
|
+
const types_1 = require("./types");
|
|
41
|
+
const rules_1 = require("./rules");
|
|
42
|
+
const normalize_1 = require("./normalize");
|
|
43
|
+
function isInferError(r) {
|
|
44
|
+
return typeof r === 'object' && r !== null && 'error' in r && typeof r.error === 'string';
|
|
45
|
+
}
|
|
46
|
+
/** Whnf parcial: normaliza solo lo necesario para revelar el head. */
|
|
47
|
+
function whnf(term, system) {
|
|
48
|
+
return (0, normalize_1.normalize)(term, system);
|
|
49
|
+
}
|
|
50
|
+
function getSort(term) {
|
|
51
|
+
return term.kind === 'sort' ? term.sort : undefined;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Infiere el tipo de `term` bajo `ctx` en el sistema dado. Devuelve
|
|
55
|
+
* el tipo, o `{ error }` si no es tipable.
|
|
56
|
+
*/
|
|
57
|
+
function inferType(term, ctx = new Map(), system = 'lambda-C') {
|
|
58
|
+
switch (term.kind) {
|
|
59
|
+
case 'sort': {
|
|
60
|
+
const axiom = (0, rules_1.axiomFor)(term.sort);
|
|
61
|
+
if (axiom === undefined) {
|
|
62
|
+
return { error: `sort '${term.sort}' no tiene axioma de tipado` };
|
|
63
|
+
}
|
|
64
|
+
return (0, types_1.cSort)(axiom);
|
|
65
|
+
}
|
|
66
|
+
case 'var': {
|
|
67
|
+
const t = ctx.get(term.name);
|
|
68
|
+
if (!t)
|
|
69
|
+
return { error: `variable libre sin tipo: ${term.name}` };
|
|
70
|
+
return t;
|
|
71
|
+
}
|
|
72
|
+
case 'pi': {
|
|
73
|
+
// (PI) Γ ⊢ A : s1 ; Γ, x:A ⊢ B : s2 ; (s1,s2) ∈ R
|
|
74
|
+
const domType = inferType(term.domain, ctx, system);
|
|
75
|
+
if (isInferError(domType))
|
|
76
|
+
return domType;
|
|
77
|
+
const s1 = getSort(whnf(domType, system));
|
|
78
|
+
if (!s1) {
|
|
79
|
+
return {
|
|
80
|
+
error: `dominio de Π debe ser un sort, pero ${(0, types_1.termToString)(term.domain)} : ${(0, types_1.termToString)(domType)}`,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const ctx2 = (0, types_1.extendContext)(ctx, term.bind, term.domain);
|
|
84
|
+
const codType = inferType(term.codomain, ctx2, system);
|
|
85
|
+
if (isInferError(codType))
|
|
86
|
+
return codType;
|
|
87
|
+
const s2 = getSort(whnf(codType, system));
|
|
88
|
+
if (!s2) {
|
|
89
|
+
return {
|
|
90
|
+
error: `codominio de Π debe ser un sort, pero ${(0, types_1.termToString)(term.codomain)} : ${(0, types_1.termToString)(codType)}`,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
if (!(0, rules_1.hasRule)(system, s1, s2)) {
|
|
94
|
+
return {
|
|
95
|
+
error: `regla de formación (${s1}, ${s2}) no disponible en el sistema ${system}`,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
return (0, types_1.cSort)(s2);
|
|
99
|
+
}
|
|
100
|
+
case 'lam': {
|
|
101
|
+
// (LAM) Γ, x:A ⊢ b : B ; Γ ⊢ Π x:A. B : s
|
|
102
|
+
const domType = inferType(term.domain, ctx, system);
|
|
103
|
+
if (isInferError(domType))
|
|
104
|
+
return domType;
|
|
105
|
+
const s1 = getSort(whnf(domType, system));
|
|
106
|
+
if (!s1) {
|
|
107
|
+
return {
|
|
108
|
+
error: `parámetro de λ debe tener un tipo (sort), pero ${(0, types_1.termToString)(term.domain)} : ${(0, types_1.termToString)(domType)}`,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
const ctx2 = (0, types_1.extendContext)(ctx, term.bind, term.domain);
|
|
112
|
+
const bodyType = inferType(term.body, ctx2, system);
|
|
113
|
+
if (isInferError(bodyType))
|
|
114
|
+
return bodyType;
|
|
115
|
+
// El Π reconstruido debe ser bien-formado en el sistema activo.
|
|
116
|
+
const piType = {
|
|
117
|
+
kind: 'pi',
|
|
118
|
+
bind: term.bind,
|
|
119
|
+
domain: term.domain,
|
|
120
|
+
codomain: bodyType,
|
|
121
|
+
};
|
|
122
|
+
const piSort = inferType(piType, ctx, system);
|
|
123
|
+
if (isInferError(piSort))
|
|
124
|
+
return piSort;
|
|
125
|
+
return piType;
|
|
126
|
+
}
|
|
127
|
+
case 'app': {
|
|
128
|
+
// (APP) f : (Π x:A. B) ; a : A ⟹ f a : B[a/x]
|
|
129
|
+
const fnType = inferType(term.fn, ctx, system);
|
|
130
|
+
if (isInferError(fnType))
|
|
131
|
+
return fnType;
|
|
132
|
+
const fnWhnf = whnf(fnType, system);
|
|
133
|
+
if (fnWhnf.kind !== 'pi') {
|
|
134
|
+
return {
|
|
135
|
+
error: `aplicación requiere función Π, pero ${(0, types_1.termToString)(term.fn)} : ${(0, types_1.termToString)(fnType)}`,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
const argType = inferType(term.arg, ctx, system);
|
|
139
|
+
if (isInferError(argType))
|
|
140
|
+
return argType;
|
|
141
|
+
if (!(0, normalize_1.alphaBetaEq)(argType, fnWhnf.domain, system)) {
|
|
142
|
+
return {
|
|
143
|
+
error: `argumento incompatible: esperaba ${(0, types_1.termToString)(fnWhnf.domain)}, recibió ${(0, types_1.termToString)(argType)}`,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
return (0, normalize_1.substitute)(fnWhnf.codomain, fnWhnf.bind, term.arg);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Verifica que `term` tiene tipo `expected` bajo `ctx` en `system`.
|
|
152
|
+
* Igualdad de tipos: módulo α y β.
|
|
153
|
+
*/
|
|
154
|
+
function checkType(term, expected, ctx = new Map(), system = 'lambda-C') {
|
|
155
|
+
const actual = inferType(term, ctx, system);
|
|
156
|
+
if (isInferError(actual))
|
|
157
|
+
return false;
|
|
158
|
+
return (0, normalize_1.alphaBetaEq)(actual, expected, system);
|
|
159
|
+
}
|
|
160
|
+
/** ¿Las variables libres del término tienen todas un binding en `ctx`? */
|
|
161
|
+
function isClosedUnder(term, ctx) {
|
|
162
|
+
for (const fv of (0, types_1.freeVars)(term)) {
|
|
163
|
+
if (!ctx.has(fv))
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=typecheck.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typecheck.js","sourceRoot":"","sources":["../../../src/type-theory/lambda-cube/typecheck.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,8CAA8C;AAC9C,+DAA+D;AAC/D,EAAE;AACF,oEAAoE;AACpE,kEAAkE;AAClE,4CAA4C;AAC5C,EAAE;AACF,2CAA2C;AAC3C,EAAE;AACF,sBAAsB;AACtB,uEAAuE;AACvE,iCAAiC;AACjC,wBAAwB;AACxB,kCAAkC;AAClC,+BAA+B;AAC/B,EAAE;AACF,6BAA6B;AAC7B,8DAA8D;AAC9D,0CAA0C;AAC1C,0CAA0C;AAC1C,EAAE;AACF,yBAAyB;AACzB,8BAA8B;AAC9B,mCAAmC;AACnC,sCAAsC;AACtC,kCAAkC;AAClC,EAAE;AACF,8CAA8C;AAC9C,iDAAiD;AACjD,wBAAwB;AACxB,EAAE;AACF,oCAAoC;;AAkBpC,oCAEC;AAeD,8BAwFC;AAMD,8BASC;AAGD,sCAKC;AAhJD,mCAQiB;AAEjB,mCAA4C;AAC5C,2CAAiE;AAKjE,SAAgB,YAAY,CAAC,CAAc;IACzC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,OAAO,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC;AAC5F,CAAC;AAED,sEAAsE;AACtE,SAAS,IAAI,CAAC,IAAc,EAAE,MAAkB;IAC9C,OAAO,IAAA,qBAAS,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACjC,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| 'lambda-P' | 'lambda-P2' | 'lambda-P-omega' | 'lambda-C';
|
|
3
|
+
export type CubeTerm = {
|
|
4
|
+
kind: 'var';
|
|
5
|
+
name: string;
|
|
6
|
+
} | {
|
|
7
|
+
kind: 'sort';
|
|
8
|
+
sort: Sort;
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'pi';
|
|
11
|
+
bind: string;
|
|
12
|
+
domain: CubeTerm;
|
|
13
|
+
codomain: CubeTerm;
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'lam';
|
|
16
|
+
bind: string;
|
|
17
|
+
domain: CubeTerm;
|
|
18
|
+
body: CubeTerm;
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'app';
|
|
21
|
+
fn: CubeTerm;
|
|
22
|
+
arg: CubeTerm;
|
|
23
|
+
};
|
|
24
|
+
export declare const cVar: (name: string) => CubeTerm;
|
|
25
|
+
export declare const cSort: (sort: Sort) => CubeTerm;
|
|
26
|
+
export declare const cStar: CubeTerm;
|
|
27
|
+
export declare const cBox: CubeTerm;
|
|
28
|
+
export declare const cPi: (bind: string, domain: CubeTerm, codomain: CubeTerm) => CubeTerm;
|
|
29
|
+
export declare const cLam: (bind: string, domain: CubeTerm, body: CubeTerm) => CubeTerm;
|
|
30
|
+
export declare const cApp: (fn: CubeTerm, arg: CubeTerm) => CubeTerm;
|
|
31
|
+
/** Flecha no-dependiente: Π (_ : A). B, cuando B no menciona el binder. */
|
|
32
|
+
export declare const cArrow: (from: CubeTerm, to: CubeTerm) => CubeTerm;
|
|
33
|
+
export declare function occursFree(name: string, term: CubeTerm): boolean;
|
|
34
|
+
export declare function freeVars(term: CubeTerm, acc?: Set<string>): Set<string>;
|
|
35
|
+
export declare function termToString(t: CubeTerm): string;
|
|
36
|
+
export declare function alphaEq(a: CubeTerm, b: CubeTerm): boolean;
|
|
37
|
+
export type CubeContext = Map<string, CubeTerm>;
|
|
38
|
+
export declare function emptyContext(): CubeContext;
|
|
39
|
+
export declare function extendContext(ctx: CubeContext, name: string, type: CubeTerm): CubeContext;
|
|
40
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/type-theory/lambda-cube/types.ts"],"names":[],"mappings":"AAsCA,MAAM,MAAM,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC;AAE7B,MAAM,MAAM,UAAU,GAClB,QAAQ,GACR,SAAS,GACT,kBAAkB,GAClB,cAAc,GACd,UAAU,GACV,WAAW,GACX,gBAAgB,GAChB,UAAU,CAAC;AAEf,MAAM,MAAM,QAAQ,GAChB;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC7B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,GAC5B;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,GAClE;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,GAC/D;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,EAAE,EAAE,QAAQ,CAAC;IAAC,GAAG,EAAE,QAAQ,CAAA;CAAE,CAAC;AAIjD,eAAO,MAAM,IAAI,GAAI,MAAM,MAAM,KAAG,QAAmC,CAAC;AACxE,eAAO,MAAM,KAAK,GAAI,MAAM,IAAI,KAAG,QAAoC,CAAC;AACxE,eAAO,MAAM,KAAK,EAAE,QAAsC,CAAC;AAC3D,eAAO,MAAM,IAAI,EAAE,QAAsC,CAAC;AAC1D,eAAO,MAAM,GAAG,GAAI,MAAM,MAAM,EAAE,QAAQ,QAAQ,EAAE,UAAU,QAAQ,KAAG,QAKvE,CAAC;AACH,e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