@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,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runWithCoverage = runWithCoverage;
|
|
4
|
+
async function runWithCoverage(suite, runner) {
|
|
5
|
+
let passing = 0;
|
|
6
|
+
let failing = 0;
|
|
7
|
+
let errored = 0;
|
|
8
|
+
const tagDistribution = new Map();
|
|
9
|
+
for (const c of suite.cases) {
|
|
10
|
+
for (const t of c.tags ?? []) {
|
|
11
|
+
tagDistribution.set(t, (tagDistribution.get(t) ?? 0) + 1);
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
const ok = await runner(c);
|
|
15
|
+
if (ok)
|
|
16
|
+
passing += 1;
|
|
17
|
+
else
|
|
18
|
+
failing += 1;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
errored += 1;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
totalCases: suite.cases.length,
|
|
26
|
+
passing,
|
|
27
|
+
failing,
|
|
28
|
+
errored,
|
|
29
|
+
tagDistribution
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=coverage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage.js","sourceRoot":"","sources":["../../../src/tooling/test-harness/coverage.ts"],"names":[],"mappings":";;AAEA,0CA6BC;AA7BM,KAAK,UAAU,eAAe,CACnC,KAAmB,EACnB,MAA4C;IAE5C,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,MAAM,eAAe,GAAG,IAAI,GAAG,EAAkB,CAAC;IAElD,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAC5B,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;YAC7B,eAAe,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5D,CAAC;QACD,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,CAAC,CAAC,CAAC;YAC3B,IAAI,EAAE;gBAAE,OAAO,IAAI,CAAC,CAAC;;gBAChB,OAAO,IAAI,CAAC,CAAC;QACpB,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO;QACL,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM;QAC9B,OAAO;QACP,OAAO;QACP,OAAO;QACP,eAAe;KAChB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function nats(max: number): Generator<number>;
|
|
2
|
+
export declare function range(start: number, end: number, step?: number): Generator<number>;
|
|
3
|
+
export declare function randomInts(seed: number, count: number, max: number): Generator<number>;
|
|
4
|
+
export declare function take<T>(gen: Iterable<T>, n: number): T[];
|
|
5
|
+
export declare function toArray<T>(gen: Iterable<T>): T[];
|
|
6
|
+
//# sourceMappingURL=generators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators.d.ts","sourceRoot":"","sources":["../../../src/tooling/test-harness/generators.ts"],"names":[],"mappings":"AAAA,wBAAiB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAMpD;AAED,wBAAiB,KAAK,CACpB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,MAAM,GACZ,SAAS,CAAC,MAAM,CAAC,CAYnB;AAaD,wBAAiB,UAAU,CACzB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,GACV,SAAS,CAAC,MAAM,CAAC,CAOnB;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,CAUxD;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAEhD"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nats = nats;
|
|
4
|
+
exports.range = range;
|
|
5
|
+
exports.randomInts = randomInts;
|
|
6
|
+
exports.take = take;
|
|
7
|
+
exports.toArray = toArray;
|
|
8
|
+
function* nats(max) {
|
|
9
|
+
if (!Number.isFinite(max) || max < 0)
|
|
10
|
+
return;
|
|
11
|
+
const cap = Math.floor(max);
|
|
12
|
+
for (let i = 0; i <= cap; i += 1) {
|
|
13
|
+
yield i;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function* range(start, end, step) {
|
|
17
|
+
const s = step ?? 1;
|
|
18
|
+
if (s === 0 || !Number.isFinite(s))
|
|
19
|
+
return;
|
|
20
|
+
if (s > 0) {
|
|
21
|
+
for (let i = start; i < end; i += s) {
|
|
22
|
+
yield i;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
for (let i = start; i > end; i += s) {
|
|
27
|
+
yield i;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function mulberry32(seed) {
|
|
32
|
+
let a = seed >>> 0;
|
|
33
|
+
return () => {
|
|
34
|
+
a = (a + 0x6d2b79f5) >>> 0;
|
|
35
|
+
let t = a;
|
|
36
|
+
t = Math.imul(t ^ (t >>> 15), t | 1);
|
|
37
|
+
t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
|
|
38
|
+
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function* randomInts(seed, count, max) {
|
|
42
|
+
if (count <= 0)
|
|
43
|
+
return;
|
|
44
|
+
const rng = mulberry32(seed);
|
|
45
|
+
const cap = Math.max(1, Math.floor(max));
|
|
46
|
+
for (let i = 0; i < count; i += 1) {
|
|
47
|
+
yield Math.floor(rng() * cap);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function take(gen, n) {
|
|
51
|
+
const out = [];
|
|
52
|
+
if (n <= 0)
|
|
53
|
+
return out;
|
|
54
|
+
let i = 0;
|
|
55
|
+
for (const v of gen) {
|
|
56
|
+
if (i >= n)
|
|
57
|
+
break;
|
|
58
|
+
out.push(v);
|
|
59
|
+
i += 1;
|
|
60
|
+
}
|
|
61
|
+
return out;
|
|
62
|
+
}
|
|
63
|
+
function toArray(gen) {
|
|
64
|
+
return Array.from(gen);
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=generators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators.js","sourceRoot":"","sources":["../../../src/tooling/test-harness/generators.ts"],"names":[],"mappings":";;AAAA,oBAMC;AAED,sBAgBC;AAaD,gCAWC;AAED,oBAUC;AAED,0BAEC;AAhED,QAAe,CAAC,CAAC,IAAI,CAAC,GAAW;IAC/B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC;QAAE,OAAO;IAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACjC,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC;AAED,QAAe,CAAC,CAAC,KAAK,CACpB,KAAa,EACb,GAAW,EACX,IAAa;IAEb,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC;IACpB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAAE,OAAO;IAC3C,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACV,KAAK,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YACpC,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;SAAM,CAAC;QACN,KAAK,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YACpC,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,UA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CAAC,IAAI,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,IAAI,CAAC;YAAE,MAAM;QAClB,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACZ,CAAC,IAAI,CAAC,CAAC;IACT,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAgB,OAAO,CAAI,GAAgB;IACzC,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { CombineMode, CoverageReport, CrossProductOptions, Snapshot, SnapshotComparison, TestCase, TestSuite } from './types';
|
|
2
|
+
export { crossProduct, filter, filterByTags, makeSuite, parameterize, tag } from './combinators';
|
|
3
|
+
export { nats, randomInts, range, take, toArray } from './generators';
|
|
4
|
+
export { runWithCoverage } from './coverage';
|
|
5
|
+
export { compareSnapshot, snapshotHash, takeSnapshot } from './snapshot';
|
|
6
|
+
export { mutateBoolean, mutateNumber, mutateString } from './mutation';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tooling/test-harness/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,QAAQ,EACR,kBAAkB,EAClB,QAAQ,EACR,SAAS,EACV,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,GAAG,EACJ,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,IAAI,EACJ,UAAU,EACV,KAAK,EACL,IAAI,EACJ,OAAO,EACR,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,EACL,eAAe,EACf,YAAY,EACZ,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,aAAa,EACb,YAAY,EACZ,YAAY,EACb,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mutateString = exports.mutateNumber = exports.mutateBoolean = exports.takeSnapshot = exports.snapshotHash = exports.compareSnapshot = exports.runWithCoverage = exports.toArray = exports.take = exports.range = exports.randomInts = exports.nats = exports.tag = exports.parameterize = exports.makeSuite = exports.filterByTags = exports.filter = exports.crossProduct = void 0;
|
|
4
|
+
var combinators_1 = require("./combinators");
|
|
5
|
+
Object.defineProperty(exports, "crossProduct", { enumerable: true, get: function () { return combinators_1.crossProduct; } });
|
|
6
|
+
Object.defineProperty(exports, "filter", { enumerable: true, get: function () { return combinators_1.filter; } });
|
|
7
|
+
Object.defineProperty(exports, "filterByTags", { enumerable: true, get: function () { return combinators_1.filterByTags; } });
|
|
8
|
+
Object.defineProperty(exports, "makeSuite", { enumerable: true, get: function () { return combinators_1.makeSuite; } });
|
|
9
|
+
Object.defineProperty(exports, "parameterize", { enumerable: true, get: function () { return combinators_1.parameterize; } });
|
|
10
|
+
Object.defineProperty(exports, "tag", { enumerable: true, get: function () { return combinators_1.tag; } });
|
|
11
|
+
var generators_1 = require("./generators");
|
|
12
|
+
Object.defineProperty(exports, "nats", { enumerable: true, get: function () { return generators_1.nats; } });
|
|
13
|
+
Object.defineProperty(exports, "randomInts", { enumerable: true, get: function () { return generators_1.randomInts; } });
|
|
14
|
+
Object.defineProperty(exports, "range", { enumerable: true, get: function () { return generators_1.range; } });
|
|
15
|
+
Object.defineProperty(exports, "take", { enumerable: true, get: function () { return generators_1.take; } });
|
|
16
|
+
Object.defineProperty(exports, "toArray", { enumerable: true, get: function () { return generators_1.toArray; } });
|
|
17
|
+
var coverage_1 = require("./coverage");
|
|
18
|
+
Object.defineProperty(exports, "runWithCoverage", { enumerable: true, get: function () { return coverage_1.runWithCoverage; } });
|
|
19
|
+
var snapshot_1 = require("./snapshot");
|
|
20
|
+
Object.defineProperty(exports, "compareSnapshot", { enumerable: true, get: function () { return snapshot_1.compareSnapshot; } });
|
|
21
|
+
Object.defineProperty(exports, "snapshotHash", { enumerable: true, get: function () { return snapshot_1.snapshotHash; } });
|
|
22
|
+
Object.defineProperty(exports, "takeSnapshot", { enumerable: true, get: function () { return snapshot_1.takeSnapshot; } });
|
|
23
|
+
var mutation_1 = require("./mutation");
|
|
24
|
+
Object.defineProperty(exports, "mutateBoolean", { enumerable: true, get: function () { return mutation_1.mutateBoolean; } });
|
|
25
|
+
Object.defineProperty(exports, "mutateNumber", { enumerable: true, get: function () { return mutation_1.mutateNumber; } });
|
|
26
|
+
Object.defineProperty(exports, "mutateString", { enumerable: true, get: function () { return mutation_1.mutateString; } });
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tooling/test-harness/index.ts"],"names":[],"mappings":";;;AAUA,6CAOuB;AANrB,2GAAA,YAAY,OAAA;AACZ,qGAAA,MAAM,OAAA;AACN,2GAAA,YAAY,OAAA;AACZ,wGAAA,SAAS,OAAA;AACT,2GAAA,YAAY,OAAA;AACZ,kGAAA,GAAG,OAAA;AAGL,2CAMsB;AALpB,kGAAA,IAAI,OAAA;AACJ,wGAAA,UAAU,OAAA;AACV,mGAAA,KAAK,OAAA;AACL,kGAAA,IAAI,OAAA;AACJ,qGAAA,OAAO,OAAA;AAGT,uCAA6C;AAApC,2GAAA,eAAe,OAAA;AAExB,uCAIoB;AAHlB,2GAAA,eAAe,OAAA;AACf,wGAAA,YAAY,OAAA;AACZ,wGAAA,YAAY,OAAA;AAGd,uCAIoB;AAHlB,yGAAA,aAAa,OAAA;AACb,wGAAA,YAAY,OAAA;AACZ,wGAAA,YAAY,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutation.d.ts","sourceRoot":"","sources":["../../../src/tooling/test-harness/mutation.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAEhD;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAchD;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,CAEnD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mutateNumber = mutateNumber;
|
|
4
|
+
exports.mutateString = mutateString;
|
|
5
|
+
exports.mutateBoolean = mutateBoolean;
|
|
6
|
+
function mutateNumber(n) {
|
|
7
|
+
return [n + 1, n - 1, 0, -n, 2 * n];
|
|
8
|
+
}
|
|
9
|
+
function mutateString(s) {
|
|
10
|
+
const out = [];
|
|
11
|
+
out.push('');
|
|
12
|
+
out.push(`${s} `);
|
|
13
|
+
if (s.length > 0) {
|
|
14
|
+
out.push(s.slice(0, -1));
|
|
15
|
+
out.push(s.slice(1));
|
|
16
|
+
out.push(s.toUpperCase() === s ? s.toLowerCase() : s.toUpperCase());
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
out.push('x');
|
|
20
|
+
out.push('xx');
|
|
21
|
+
out.push('X');
|
|
22
|
+
}
|
|
23
|
+
return out;
|
|
24
|
+
}
|
|
25
|
+
function mutateBoolean(b) {
|
|
26
|
+
return [!b];
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=mutation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutation.js","sourceRoot":"","sources":["../../../src/tooling/test-harness/mutation.ts"],"names":[],"mappings":";;AAAA,oCAEC;AAED,oCAcC;AAED,sCAEC;AAtBD,SAAgB,YAAY,CAAC,CAAS;IACpC,OAAO,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AACtC,CAAC;AAED,SAAgB,YAAY,CAAC,CAAS;IACpC,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACb,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAClB,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACjB,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACzB,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACrB,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;IACtE,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACd,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACf,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAgB,aAAa,CAAC,CAAU;IACtC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Snapshot, SnapshotComparison } from './types';
|
|
2
|
+
export declare function snapshotHash(input: unknown, output: unknown): string;
|
|
3
|
+
export declare function takeSnapshot(input: unknown, output: unknown): Snapshot;
|
|
4
|
+
export declare function compareSnapshot(snap: Snapshot, current: unknown): SnapshotComparison;
|
|
5
|
+
//# sourceMappingURL=snapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../../src/tooling/test-harness/snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAuD5D,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAEpE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,QAAQ,CAMtE;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,OAAO,GACf,kBAAkB,CAUpB"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.snapshotHash = snapshotHash;
|
|
4
|
+
exports.takeSnapshot = takeSnapshot;
|
|
5
|
+
exports.compareSnapshot = compareSnapshot;
|
|
6
|
+
function stableStringify(value) {
|
|
7
|
+
const seen = new WeakSet();
|
|
8
|
+
const walk = (v) => {
|
|
9
|
+
if (v === null)
|
|
10
|
+
return null;
|
|
11
|
+
if (typeof v === 'undefined')
|
|
12
|
+
return '__undefined__';
|
|
13
|
+
if (typeof v === 'bigint')
|
|
14
|
+
return `__bigint__:${v.toString()}`;
|
|
15
|
+
if (typeof v === 'function')
|
|
16
|
+
return `__fn__:${v.name || 'anon'}`;
|
|
17
|
+
if (typeof v === 'symbol')
|
|
18
|
+
return `__sym__:${v.toString()}`;
|
|
19
|
+
if (typeof v !== 'object')
|
|
20
|
+
return v;
|
|
21
|
+
if (seen.has(v))
|
|
22
|
+
return '__cycle__';
|
|
23
|
+
seen.add(v);
|
|
24
|
+
if (Array.isArray(v)) {
|
|
25
|
+
return v.map(walk);
|
|
26
|
+
}
|
|
27
|
+
if (v instanceof Map) {
|
|
28
|
+
const entries = [];
|
|
29
|
+
for (const [k, val] of v.entries())
|
|
30
|
+
entries.push([k, val]);
|
|
31
|
+
entries.sort((a, b) => {
|
|
32
|
+
const ka = String(a[0]);
|
|
33
|
+
const kb = String(b[0]);
|
|
34
|
+
return ka < kb ? -1 : ka > kb ? 1 : 0;
|
|
35
|
+
});
|
|
36
|
+
return { __map__: entries.map(([k, val]) => [walk(k), walk(val)]) };
|
|
37
|
+
}
|
|
38
|
+
if (v instanceof Set) {
|
|
39
|
+
const arr = Array.from(v.values()).map(walk);
|
|
40
|
+
arr.sort((a, b) => {
|
|
41
|
+
const sa = JSON.stringify(a);
|
|
42
|
+
const sb = JSON.stringify(b);
|
|
43
|
+
return sa < sb ? -1 : sa > sb ? 1 : 0;
|
|
44
|
+
});
|
|
45
|
+
return { __set__: arr };
|
|
46
|
+
}
|
|
47
|
+
const obj = v;
|
|
48
|
+
const keys = Object.keys(obj).sort();
|
|
49
|
+
const out = {};
|
|
50
|
+
for (const k of keys) {
|
|
51
|
+
out[k] = walk(obj[k]);
|
|
52
|
+
}
|
|
53
|
+
return out;
|
|
54
|
+
};
|
|
55
|
+
return JSON.stringify(walk(value));
|
|
56
|
+
}
|
|
57
|
+
function fnv1a(s) {
|
|
58
|
+
let h = 0x811c9dc5;
|
|
59
|
+
for (let i = 0; i < s.length; i += 1) {
|
|
60
|
+
h ^= s.charCodeAt(i);
|
|
61
|
+
h = (h + ((h << 1) + (h << 4) + (h << 7) + (h << 8) + (h << 24))) >>> 0;
|
|
62
|
+
}
|
|
63
|
+
return h.toString(16).padStart(8, '0');
|
|
64
|
+
}
|
|
65
|
+
function snapshotHash(input, output) {
|
|
66
|
+
return fnv1a(`${stableStringify(input)}|${stableStringify(output)}`);
|
|
67
|
+
}
|
|
68
|
+
function takeSnapshot(input, output) {
|
|
69
|
+
return {
|
|
70
|
+
input,
|
|
71
|
+
output,
|
|
72
|
+
hash: snapshotHash(input, output)
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function compareSnapshot(snap, current) {
|
|
76
|
+
const expected = stableStringify(snap.output);
|
|
77
|
+
const actual = stableStringify(current);
|
|
78
|
+
if (expected === actual) {
|
|
79
|
+
return { match: true };
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
match: false,
|
|
83
|
+
diff: `expected: ${expected}\nactual: ${actual}`
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=snapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../../src/tooling/test-harness/snapshot.ts"],"names":[],"mappings":";;AAuDA,oCAEC;AAED,oCAMC;AAED,0CAaC;AA9ED,SAAS,eAAe,CAAC,KAAc;IACrC,MAAM,IAAI,GAAG,IAAI,OAAO,EAAU,CAAC;IACnC,MAAM,IAAI,GAAG,CAAC,CAAU,EAAW,EAAE;QACnC,IAAI,CAAC,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QAC5B,IAAI,OAAO,CAAC,KAAK,WAAW;YAAE,OAAO,eAAe,CAAC;QACrD,IAAI,OAAO,CAAC,KAAK,QAAQ;YAAE,OAAO,cAAc,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;QAC/D,IAAI,OAAO,CAAC,KAAK,UAAU;YAAE,OAAO,UAAU,CAAC,CAAC,IAAI,IAAI,MAAM,EAAE,CAAC;QACjE,IAAI,OAAO,CAAC,KAAK,QAAQ;YAAE,OAAO,WAAW,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;QAC5D,IAAI,OAAO,CAAC,KAAK,QAAQ;YAAE,OAAO,CAAC,CAAC;QACpC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAW,CAAC;YAAE,OAAO,WAAW,CAAC;QAC9C,IAAI,CAAC,GAAG,CAAC,CAAW,CAAC,CAAC;QACtB,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YACrB,OAAO,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;QACD,IAAI,CAAC,YAAY,GAAG,EAAE,C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O,KAAK,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,IAAI,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AACvE,CAAC;AAED,SAAgB,YAAY,CAAC,KAAc,EAAE,MAAe;IAC1D,OAAO;QACL,KAAK;QACL,MAAM;QACN,IAAI,EAAE,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC;KAClC,CAAC;AACJ,CAAC;AAED,SAAgB,eAAe,CAC7B,IAAc,EACd,OAAgB;IAEhB,MAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IACxC,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;QACxB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;IACD,OAAO;QACL,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,aAAa,QAAQ,eAAe,MAAM,EAAE;KACnD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface TestCase<T> {
|
|
2
|
+
name: string;
|
|
3
|
+
input: T;
|
|
4
|
+
expected?: unknown;
|
|
5
|
+
tags?: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface TestSuite<T> {
|
|
8
|
+
name: string;
|
|
9
|
+
cases: TestCase<T>[];
|
|
10
|
+
}
|
|
11
|
+
export type CombineMode = 'union' | 'intersect' | 'cartesian';
|
|
12
|
+
export interface CrossProductOptions {
|
|
13
|
+
combine: CombineMode;
|
|
14
|
+
filterTags?: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface CoverageReport {
|
|
17
|
+
totalCases: number;
|
|
18
|
+
passing: number;
|
|
19
|
+
failing: number;
|
|
20
|
+
errored: number;
|
|
21
|
+
tagDistribution: Map<string, number>;
|
|
22
|
+
}
|
|
23
|
+
export interface Snapshot {
|
|
24
|
+
input: unknown;
|
|
25
|
+
output: unknown;
|
|
26
|
+
hash: string;
|
|
27
|
+
}
|
|
28
|
+
export interface SnapshotComparison {
|
|
29
|
+
match: boolean;
|
|
30
|
+
diff?: string;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tooling/test-harness/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;CACtB;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,WAAW,GAAG,WAAW,CAAC;AAE9D,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,WAAW,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/tooling/test-harness/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CubeTerm } from './types';
|
|
2
|
+
export type UntypedTerm = {
|
|
3
|
+
kind: 'var';
|
|
4
|
+
name: string;
|
|
5
|
+
} | {
|
|
6
|
+
kind: 'abs';
|
|
7
|
+
param: string;
|
|
8
|
+
body: UntypedTerm;
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'app';
|
|
11
|
+
fn: UntypedTerm;
|
|
12
|
+
arg: UntypedTerm;
|
|
13
|
+
};
|
|
14
|
+
export interface EraseError {
|
|
15
|
+
error: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function isEraseError(r: UntypedTerm | EraseError): r is EraseError;
|
|
18
|
+
/**
|
|
19
|
+
* Borrado total a λ-cálculo no tipado. Sorts y Π no tienen
|
|
20
|
+
* representante runtime — si aparecen como sub-término principal,
|
|
21
|
+
* el resultado es un error de borrado.
|
|
22
|
+
*/
|
|
23
|
+
export declare function erase(term: CubeTerm): UntypedTerm | EraseError;
|
|
24
|
+
/** Serialización legible del λ-untyped. */
|
|
25
|
+
export declare function untypedToString(t: UntypedTerm): string;
|
|
26
|
+
//# sourceMappingURL=erase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erase.d.ts","sourceRoot":"","sources":["../../../src/type-theory/lambda-cube/erase.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC7B;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE,GACjD;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,EAAE,EAAE,WAAW,CAAC;IAAC,GAAG,EAAE,WAAW,CAAA;CAAE,CAAC;AAEvD,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,WAAW,GAAG,UAAU,GAAG,CAAC,IAAI,UAAU,CAEzE;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,QAAQ,GAAG,WAAW,GAAG,UAAU,CAqB9D;AAED,2CAA2C;AAC3C,wBAAgB,eAAe,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,CAWtD"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================
|
|
3
|
+
// Lambda Cube — Erasure a λ-cálculo no tipado
|
|
4
|
+
// ============================================================
|
|
5
|
+
//
|
|
6
|
+
// La función de borrado (erasure / type-erasure) traduce un término
|
|
7
|
+
// del cubo a un λ-término puro:
|
|
8
|
+
//
|
|
9
|
+
// |x| = x
|
|
10
|
+
// |s| = ⊥ (sorts no tienen representante runtime)
|
|
11
|
+
// |λ x:A. b| = λ x. |b|
|
|
12
|
+
// |Π x:A. B| = ⊥ (los Π son tipos, no se ejecutan)
|
|
13
|
+
// |f a| = |f| |a|
|
|
14
|
+
//
|
|
15
|
+
// El erasure preserva β: si `t →β t'` en el cubo entonces
|
|
16
|
+
// `|t| →β |t'|` en λ-untyped. Esa es la base de la "phase distinction"
|
|
17
|
+
// estándar de los sistemas de tipos polimórficos.
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.isEraseError = isEraseError;
|
|
20
|
+
exports.erase = erase;
|
|
21
|
+
exports.untypedToString = untypedToString;
|
|
22
|
+
function isEraseError(r) {
|
|
23
|
+
return typeof r === 'object' && r !== null && 'error' in r && typeof r.error === 'string';
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Borrado total a λ-cálculo no tipado. Sorts y Π no tienen
|
|
27
|
+
* representante runtime — si aparecen como sub-término principal,
|
|
28
|
+
* el resultado es un error de borrado.
|
|
29
|
+
*/
|
|
30
|
+
function erase(term) {
|
|
31
|
+
switch (term.kind) {
|
|
32
|
+
case 'var':
|
|
33
|
+
return { kind: 'var', name: term.name };
|
|
34
|
+
case 'sort':
|
|
35
|
+
return { error: `no se puede borrar el sort '${term.sort}' a λ-untyped` };
|
|
36
|
+
case 'pi':
|
|
37
|
+
return { error: `no se puede borrar un Π-type a λ-untyped` };
|
|
38
|
+
case 'lam': {
|
|
39
|
+
const body = erase(term.body);
|
|
40
|
+
if (isEraseError(body))
|
|
41
|
+
return body;
|
|
42
|
+
return { kind: 'abs', param: term.bind, body };
|
|
43
|
+
}
|
|
44
|
+
case 'app': {
|
|
45
|
+
const fn = erase(term.fn);
|
|
46
|
+
if (isEraseError(fn))
|
|
47
|
+
return fn;
|
|
48
|
+
const arg = erase(term.arg);
|
|
49
|
+
if (isEraseError(arg))
|
|
50
|
+
return arg;
|
|
51
|
+
return { kind: 'app', fn, arg };
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** Serialización legible del λ-untyped. */
|
|
56
|
+
function untypedToString(t) {
|
|
57
|
+
switch (t.kind) {
|
|
58
|
+
case 'var':
|
|
59
|
+
return t.name;
|
|
60
|
+
case 'abs':
|
|
61
|
+
return `(λ${t.param}. ${untypedToString(t.body)})`;
|
|
62
|
+
case 'app': {
|
|
63
|
+
const arg = t.arg.kind === 'app' ? `(${untypedToString(t.arg)})` : untypedToString(t.arg);
|
|
64
|
+
return `(${untypedToString(t.fn)} ${arg})`;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=erase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erase.js","sourceRoot":"","sources":["../../../src/type-theory/lambda-cube/erase.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,8CAA8C;AAC9C,+DAA+D;AAC/D,EAAE;AACF,oEAAoE;AACpE,gCAAgC;AAChC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CAAC,GAAG,CAAC;gBAAE,OAAO,GAAG,CAAC;YAClC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC;QAClC,CAAC;IACH,CAAC;AACH,CAAC;AAED,2CAA2C;AAC3C,SAAgB,eAAe,CAAC,CAAc;IAC5C,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;QACf,KAAK,KAAK;YACR,OAAO,CAAC,CAAC,IAAI,CAAC;QAChB,KAAK,KAAK;YACR,OAAO,KAAK,CAAC,CAAC,KAAK,KAAK,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QACrD,KAAK,KAAK,CAAC,CAAC,CAAC;YACX,MAAM,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YAC1F,OAAO,IAAI,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,GAAG,GAAG,CAAC;QAC7C,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type CubeTerm } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Identidad polimórfica: λ X:*. λ x:X. x ∈ λ2.
|
|
4
|
+
* Tipo: Π X:*. X → X.
|
|
5
|
+
*/
|
|
6
|
+
export declare function polymorphicIdentity(): CubeTerm;
|
|
7
|
+
/** Tipo de la identidad polimórfica: Π X:*. X → X. */
|
|
8
|
+
export declare function polymorphicIdentityType(): CubeTerm;
|
|
9
|
+
/**
|
|
10
|
+
* Encoding Church de un natural `n` en System F:
|
|
11
|
+
* n = λ X:*. λ s:X→X. λ z:X. s (s (... (s z) ...)) con n aplicaciones
|
|
12
|
+
*
|
|
13
|
+
* Tipo: Π X:*. (X → X) → X → X.
|
|
14
|
+
*/
|
|
15
|
+
export declare function churchNumeral(n: number): CubeTerm;
|
|
16
|
+
/** Tipo de un natural Church: Π X:*. (X → X) → X → X. */
|
|
17
|
+
export declare function churchNumeralType(): CubeTerm;
|
|
18
|
+
/**
|
|
19
|
+
* Tipo polimórfico de pares: Π A:*. Π B:*. (Π C:*. (A → B → C) → C) → ...
|
|
20
|
+
* En la versión sencilla devolvemos solo el tipo de "Pair A B":
|
|
21
|
+
*
|
|
22
|
+
* Π A:*. Π B:*. Π C:*. (A → B → C) → C
|
|
23
|
+
*/
|
|
24
|
+
export declare function churchPairType(): CubeTerm;
|
|
25
|
+
/**
|
|
26
|
+
* Esquema de "lista dependiente": dado un tipo de vectores indexado
|
|
27
|
+
* por `Nat`, devolvemos el Π típico
|
|
28
|
+
*
|
|
29
|
+
* Π n : Nat. Vector n
|
|
30
|
+
*
|
|
31
|
+
* Requiere que el contexto declare `Nat : *` y `Vector : Nat → *`.
|
|
32
|
+
* Atención: ambos extremos son `*`, así que esta Π usa la regla
|
|
33
|
+
* (*,*) y queda legal incluso en λ→ una vez que `Vector` está en el
|
|
34
|
+
* contexto. El sabor "dependiente" viene del hecho de que el
|
|
35
|
+
* codominio menciona el binder `n`.
|
|
36
|
+
*/
|
|
37
|
+
export declare function dependentList(): CubeTerm;
|
|
38
|
+
/**
|
|
39
|
+
* Predicado sobre `Nat`: `Π n:Nat. *`. Domino `Nat : *` y codominio
|
|
40
|
+
* `*` (cuyo sort es `◻`). Esa es justo la formación (*,◻) — exclusiva
|
|
41
|
+
* de los vértices con tipos dependientes (λP, λP2, λPω, λC).
|
|
42
|
+
*
|
|
43
|
+
* Requiere `Nat : *` en el contexto.
|
|
44
|
+
*/
|
|
45
|
+
export declare function predicateOverNat(): CubeTerm;
|
|
46
|
+
/**
|
|
47
|
+
* Operador de tipo `id-type`: λ A:*. A → A en λω.
|
|
48
|
+
* Tipo: * → *.
|
|
49
|
+
*/
|
|
50
|
+
export declare function typeLevelIdentity(): CubeTerm;
|
|
51
|
+
/** Tipo del operador `typeLevelIdentity`: * → *. */
|
|
52
|
+
export declare function typeLevelIdentityKind(): CubeTerm;
|
|
53
|
+
/**
|
|
54
|
+
* En el Calculus of Constructions, el tipo polimórfico
|
|
55
|
+
* Π A:*. A → A
|
|
56
|
+
* vive en el universo `*`.
|
|
57
|
+
*/
|
|
58
|
+
export declare function cocPolyIdentityType(): CubeTerm;
|
|
59
|
+
//# sourceMappingURL=examples.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"examples.d.ts","sourceRoot":"","sources":["../../../src/type-theory/lambda-cube/examples.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,QAAQ,EAAwC,MAAM,SAAS,CAAC;AAE9E;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,QAAQ,CAE9C;AAED,sDAAsD;AACtD,wBAAgB,uBAAuB,IAAI,QAAQ,CAElD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,QAAQ,CAUjD;AAED,yDAAyD;AACzD,wBAAgB,iBAAiB,IAAI,QAAQ,CAG5C;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,QAAQ,CAKzC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,IAAI,QAAQ,CAExC;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,IAAI,QAAQ,CAE3C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,QAAQ,CAE5C;AAED,oDAAoD;AACpD,wBAAgB,qBAAqB,IAAI,QAAQ,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,QAAQ,CAE9C"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================
|
|
3
|
+
// Lambda Cube — Términos canónicos
|
|
4
|
+
// ============================================================
|
|
5
|
+
//
|
|
6
|
+
// Construcciones clásicas de cada vértice del cubo. Cada función
|
|
7
|
+
// devuelve un `CubeTerm` directamente; el tipo correspondiente es
|
|
8
|
+
// inferible con `inferType` en el sistema apropiado.
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.polymorphicIdentity = polymorphicIdentity;
|
|
11
|
+
exports.polymorphicIdentityType = polymorphicIdentityType;
|
|
12
|
+
exports.churchNumeral = churchNumeral;
|
|
13
|
+
exports.churchNumeralType = churchNumeralType;
|
|
14
|
+
exports.churchPairType = churchPairType;
|
|
15
|
+
exports.dependentList = dependentList;
|
|
16
|
+
exports.predicateOverNat = predicateOverNat;
|
|
17
|
+
exports.typeLevelIdentity = typeLevelIdentity;
|
|
18
|
+
exports.typeLevelIdentityKind = typeLevelIdentityKind;
|
|
19
|
+
exports.cocPolyIdentityType = cocPolyIdentityType;
|
|
20
|
+
const types_1 = require("./types");
|
|
21
|
+
/**
|
|
22
|
+
* Identidad polimórfica: λ X:*. λ x:X. x ∈ λ2.
|
|
23
|
+
* Tipo: Π X:*. X → X.
|
|
24
|
+
*/
|
|
25
|
+
function polymorphicIdentity() {
|
|
26
|
+
return (0, types_1.cLam)('X', types_1.cStar, (0, types_1.cLam)('x', (0, types_1.cVar)('X'), (0, types_1.cVar)('x')));
|
|
27
|
+
}
|
|
28
|
+
/** Tipo de la identidad polimórfica: Π X:*. X → X. */
|
|
29
|
+
function polymorphicIdentityType() {
|
|
30
|
+
return (0, types_1.cPi)('X', types_1.cStar, (0, types_1.cArrow)((0, types_1.cVar)('X'), (0, types_1.cVar)('X')));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Encoding Church de un natural `n` en System F:
|
|
34
|
+
* n = λ X:*. λ s:X→X. λ z:X. s (s (... (s z) ...)) con n aplicaciones
|
|
35
|
+
*
|
|
36
|
+
* Tipo: Π X:*. (X → X) → X → X.
|
|
37
|
+
*/
|
|
38
|
+
function churchNumeral(n) {
|
|
39
|
+
if (!Number.isInteger(n) || n < 0) {
|
|
40
|
+
throw new Error(`churchNumeral requiere natural ≥ 0, recibió ${n}`);
|
|
41
|
+
}
|
|
42
|
+
const X = (0, types_1.cVar)('X');
|
|
43
|
+
let body = (0, types_1.cVar)('z');
|
|
44
|
+
for (let i = 0; i < n; i++) {
|
|
45
|
+
body = (0, types_1.cApp)((0, types_1.cVar)('s'), body);
|
|
46
|
+
}
|
|
47
|
+
return (0, types_1.cLam)('X', types_1.cStar, (0, types_1.cLam)('s', (0, types_1.cArrow)(X, X), (0, types_1.cLam)('z', X, body)));
|
|
48
|
+
}
|
|
49
|
+
/** Tipo de un natural Church: Π X:*. (X → X) → X → X. */
|
|
50
|
+
function churchNumeralType() {
|
|
51
|
+
const X = (0, types_1.cVar)('X');
|
|
52
|
+
return (0, types_1.cPi)('X', types_1.cStar, (0, types_1.cArrow)((0, types_1.cArrow)(X, X), (0, types_1.cArrow)(X, X)));
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Tipo polimórfico de pares: Π A:*. Π B:*. (Π C:*. (A → B → C) → C) → ...
|
|
56
|
+
* En la versión sencilla devolvemos solo el tipo de "Pair A B":
|
|
57
|
+
*
|
|
58
|
+
* Π A:*. Π B:*. Π C:*. (A → B → C) → C
|
|
59
|
+
*/
|
|
60
|
+
function churchPairType() {
|
|
61
|
+
const A = (0, types_1.cVar)('A');
|
|
62
|
+
const B = (0, types_1.cVar)('B');
|
|
63
|
+
const C = (0, types_1.cVar)('C');
|
|
64
|
+
return (0, types_1.cPi)('A', types_1.cStar, (0, types_1.cPi)('B', types_1.cStar, (0, types_1.cPi)('C', types_1.cStar, (0, types_1.cArrow)((0, types_1.cArrow)(A, (0, types_1.cArrow)(B, C)), C))));
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Esquema de "lista dependiente": dado un tipo de vectores indexado
|
|
68
|
+
* por `Nat`, devolvemos el Π típico
|
|
69
|
+
*
|
|
70
|
+
* Π n : Nat. Vector n
|
|
71
|
+
*
|
|
72
|
+
* Requiere que el contexto declare `Nat : *` y `Vector : Nat → *`.
|
|
73
|
+
* Atención: ambos extremos son `*`, así que esta Π usa la regla
|
|
74
|
+
* (*,*) y queda legal incluso en λ→ una vez que `Vector` está en el
|
|
75
|
+
* contexto. El sabor "dependiente" viene del hecho de que el
|
|
76
|
+
* codominio menciona el binder `n`.
|
|
77
|
+
*/
|
|
78
|
+
function dependentList() {
|
|
79
|
+
return (0, types_1.cPi)('n', (0, types_1.cVar)('Nat'), (0, types_1.cApp)((0, types_1.cVar)('Vector'), (0, types_1.cVar)('n')));
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Predicado sobre `Nat`: `Π n:Nat. *`. Domino `Nat : *` y codominio
|
|
83
|
+
* `*` (cuyo sort es `◻`). Esa es justo la formación (*,◻) — exclusiva
|
|
84
|
+
* de los vértices con tipos dependientes (λP, λP2, λPω, λC).
|
|
85
|
+
*
|
|
86
|
+
* Requiere `Nat : *` en el contexto.
|
|
87
|
+
*/
|
|
88
|
+
function predicateOverNat() {
|
|
89
|
+
return (0, types_1.cPi)('n', (0, types_1.cVar)('Nat'), types_1.cStar);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Operador de tipo `id-type`: λ A:*. A → A en λω.
|
|
93
|
+
* Tipo: * → *.
|
|
94
|
+
*/
|
|
95
|
+
function typeLevelIdentity() {
|
|
96
|
+
return (0, types_1.cLam)('A', types_1.cStar, (0, types_1.cArrow)((0, types_1.cVar)('A'), (0, types_1.cVar)('A')));
|
|
97
|
+
}
|
|
98
|
+
/** Tipo del operador `typeLevelIdentity`: * → *. */
|
|
99
|
+
function typeLevelIdentityKind() {
|
|
100
|
+
return (0, types_1.cArrow)(types_1.cStar, types_1.cStar);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* En el Calculus of Constructions, el tipo polimórfico
|
|
104
|
+
* Π A:*. A → A
|
|
105
|
+
* vive en el universo `*`.
|
|
106
|
+
*/
|
|
107
|
+
function cocPolyIdentityType() {
|
|
108
|
+
return (0, types_1.cPi)('A', types_1.cStar, (0, types_1.cArrow)((0, types_1.cVar)('A'), (0, types_1.cVar)('A')));
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=examples.js.map
|