@hotdocx/endash-kernel 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +24 -2
  3. package/bin/endash-cli.cjs +4 -0
  4. package/bin/endash-mcp.cjs +7 -0
  5. package/browser.d.ts +44 -0
  6. package/endash-browser.js +698 -0
  7. package/index.cjs +704 -0
  8. package/index.d.ts +20 -0
  9. package/index.mjs +704 -0
  10. package/node.cjs +116606 -0
  11. package/node.d.ts +8 -0
  12. package/node.mjs +53 -0
  13. package/package.json +69 -4
  14. package/types/ast.d.ts +964 -0
  15. package/types/book/book_compiler.d.ts +57 -0
  16. package/types/book/html_renderer.d.ts +27 -0
  17. package/types/book/literate_en.d.ts +40 -0
  18. package/types/book/schema.d.ts +279 -0
  19. package/types/browser.d.ts +44 -0
  20. package/types/builders.d.ts +191 -0
  21. package/types/cache/core_snapshot.d.ts +259 -0
  22. package/types/cas/bar_hochschild.d.ts +106 -0
  23. package/types/cas/cotangent_deformation.d.ts +100 -0
  24. package/types/cas/cyclic_homology.d.ts +100 -0
  25. package/types/cas/derham_hkr.d.ts +117 -0
  26. package/types/cas/ext_algebra.d.ts +112 -0
  27. package/types/cas/groebner_syzygy.d.ts +43 -0
  28. package/types/cas/hilbert_proj_ag.d.ts +97 -0
  29. package/types/cas/hnf_snf.d.ts +49 -0
  30. package/types/cas/lefschetz_weil.d.ts +114 -0
  31. package/types/cas/localization_cech.d.ts +201 -0
  32. package/types/cas/matrix.d.ts +45 -0
  33. package/types/cas/modules_complexes.d.ts +141 -0
  34. package/types/cas/perm_coset_cgt.d.ts +166 -0
  35. package/types/cas/poly.d.ts +66 -0
  36. package/types/cas/reify_proofs.d.ts +104 -0
  37. package/types/cas/resolutions_spectral_seq.d.ts +193 -0
  38. package/types/cas/rings.d.ts +70 -0
  39. package/types/cas/smith_resultant_gauss.d.ts +164 -0
  40. package/types/cas/theta_stepanov.d.ts +182 -0
  41. package/types/check.d.ts +65 -0
  42. package/types/cli/endash_cli.d.ts +19 -0
  43. package/types/context.d.ts +110 -0
  44. package/types/duality.d.ts +76 -0
  45. package/types/elab/elab_ast.d.ts +274 -0
  46. package/types/elab/elaborate.d.ts +106 -0
  47. package/types/elab/env.d.ts +170 -0
  48. package/types/elab/match.d.ts +123 -0
  49. package/types/elab/pretty.d.ts +14 -0
  50. package/types/elab/structure.d.ts +46 -0
  51. package/types/elab/tactics.d.ts +238 -0
  52. package/types/elab/typeclass.d.ts +31 -0
  53. package/types/elab/unify.d.ts +166 -0
  54. package/types/eval.d.ts +28 -0
  55. package/types/index.d.ts +98 -0
  56. package/types/kernel_ops.d.ts +196 -0
  57. package/types/mcp/endash_mcp_server.d.ts +63 -0
  58. package/types/module/comparator.d.ts +86 -0
  59. package/types/module/desugar.d.ts +94 -0
  60. package/types/module/goal_inspector.d.ts +104 -0
  61. package/types/module/loader.d.ts +105 -0
  62. package/types/module/node_fs_provider.d.ts +26 -0
  63. package/types/module/package_builder.d.ts +83 -0
  64. package/types/module/proof_graph.d.ts +80 -0
  65. package/types/module/quasiquote.d.ts +37 -0
  66. package/types/module/stdlib_fresh_builders.d.ts +10 -0
  67. package/types/module/stdlib_tactic_hooks.d.ts +20 -0
  68. package/types/parser/lexer.d.ts +12 -0
  69. package/types/parser/parser.d.ts +78 -0
  70. package/types/parser/pratt.d.ts +17 -0
  71. package/types/parser/span.d.ts +26 -0
  72. package/types/parser/surface_ast.d.ts +501 -0
  73. package/types/stdlib_types.d.ts +113 -0
  74. package/types/value.d.ts +942 -0
@@ -0,0 +1,942 @@
1
+ /**
2
+ * Semantic Value Domain for `endash` Normalization by Evaluation (NbE).
3
+ *
4
+ * All types in `endash` are represented as `VGrpd` values; categories carry an
5
+ * inner canonical `VCatCore` paired with an exact `Duality` bitstream `{ diff, tail }`;
6
+ * paths and directed cells use flat diagrammatic spines `x_0 --a_1--> ... --a_k--> x_k`.
7
+ */
8
+ import { SigmaPolarity } from './ast';
9
+ import { Duality, TransfMode } from './duality';
10
+ export type VGluedStep = {
11
+ readonly kind: 'app';
12
+ readonly arg: Value;
13
+ readonly argTy: VGrpd;
14
+ } | {
15
+ readonly kind: 'fst';
16
+ } | {
17
+ readonly kind: 'snd';
18
+ };
19
+ export interface VGluedHead {
20
+ readonly name: string;
21
+ readonly height: number;
22
+ readonly rootVal: Value;
23
+ readonly rootTy: VGrpd;
24
+ readonly steps: readonly VGluedStep[];
25
+ readonly unfolded: () => Value;
26
+ }
27
+ export type VGrpdCore = {
28
+ readonly tag: 'v-grpd-u';
29
+ readonly level: number;
30
+ } | {
31
+ readonly tag: 'v-strict-cat-u';
32
+ readonly level: number;
33
+ } | {
34
+ readonly tag: 'v-gray-cat-u';
35
+ readonly level: number;
36
+ } | {
37
+ readonly tag: 'v-empty';
38
+ } | {
39
+ readonly tag: 'v-unit';
40
+ } | {
41
+ readonly tag: 'v-bool';
42
+ } | {
43
+ readonly tag: 'v-nat';
44
+ } | {
45
+ readonly tag: 'v-circle-grpd';
46
+ } | {
47
+ readonly tag: 'v-groupoidify-grpd';
48
+ readonly cat: VCat;
49
+ } | {
50
+ readonly tag: 'v-pushout-grpd';
51
+ readonly level: number;
52
+ readonly leftTy: VGrpd;
53
+ readonly rightTy: VGrpd;
54
+ readonly spanTy: VGrpd;
55
+ readonly leftMap: Value;
56
+ readonly rightMap: Value;
57
+ } | {
58
+ readonly tag: 'v-trunc0-grpd';
59
+ readonly level: number;
60
+ readonly inner: VGrpd;
61
+ } | {
62
+ /** Fibre `(a_J P)[obj] : Grpd 0` of the Yoneda-reindexed `Sheafify` presheaf HIT. */
63
+ readonly tag: 'v-sheafify-sec';
64
+ readonly site: VCat;
65
+ readonly covTy: VGrpd;
66
+ readonly covVal: Value;
67
+ readonly pshFun: VFun;
68
+ readonly obj: Value;
69
+ } | {
70
+ readonly tag: 'v-sum-grpd';
71
+ readonly left: VGrpd;
72
+ readonly right: VGrpd;
73
+ } | {
74
+ readonly tag: 'v-list-grpd';
75
+ readonly elem: VGrpd;
76
+ } | {
77
+ readonly tag: 'v-pi-grpd';
78
+ readonly nameHint: string;
79
+ readonly dom: VGrpd;
80
+ readonly cod: (arg: Value) => VGrpd;
81
+ } | {
82
+ readonly tag: 'v-sigma-grpd';
83
+ readonly nameHint: string;
84
+ readonly fst: VGrpd;
85
+ readonly snd: (fstVal: Value) => VGrpd;
86
+ } | {
87
+ readonly tag: 'v-eq-grpd';
88
+ readonly ty: VGrpd;
89
+ readonly lhs: Value;
90
+ readonly rhs: Value;
91
+ } | {
92
+ readonly tag: 'v-functor-type';
93
+ readonly dom: VCat;
94
+ readonly cod: VCat;
95
+ } | {
96
+ readonly tag: 'v-transf-type';
97
+ readonly mode: TransfMode;
98
+ readonly dom: VCat;
99
+ readonly cod: VCat;
100
+ readonly src: VFun;
101
+ readonly dst: VFun;
102
+ } | {
103
+ /** Modification type `Hom(TransfCat(mode, A, B, F, G), eps, eta)`. */
104
+ readonly tag: 'v-modif-type';
105
+ readonly mode: TransfMode;
106
+ readonly dom: VCat;
107
+ readonly cod: VCat;
108
+ readonly srcFun: VFun;
109
+ readonly dstFun: VFun;
110
+ readonly lhsTransf: VTransf;
111
+ readonly rhsTransf: VTransf;
112
+ } | {
113
+ readonly tag: 'v-walking-end-obj';
114
+ } | {
115
+ readonly tag: 'v-walking-arrow-obj';
116
+ } | {
117
+ /** Objects of an atomic/neutral category `C`. */
118
+ readonly tag: 'v-neutral-obj-type';
119
+ readonly catNe: VNeutral;
120
+ } | {
121
+ /**
122
+ * Cell carrier `Obj(Hom_C(src, dst))` for base/neutral/WalkingEnd categories
123
+ * whose morphisms are normalized Došen spines (`VCellSpine`).
124
+ */
125
+ readonly tag: 'v-cell-type';
126
+ readonly homCore: VBaseCellCatCore;
127
+ } | {
128
+ readonly tag: 'v-neutral-grpd';
129
+ readonly ne: VNeutral;
130
+ };
131
+ export type VGrpdWhnf = VGrpdCore & {
132
+ readonly glued?: VGluedHead;
133
+ };
134
+ export type VGrpd = VGrpdWhnf | {
135
+ readonly tag: 'v-glued-grpd';
136
+ readonly glued: VGluedHead;
137
+ readonly force: () => VGrpd;
138
+ };
139
+ export interface VCat {
140
+ readonly core: VCatCore;
141
+ readonly dual: Duality;
142
+ readonly level: number;
143
+ readonly isStrict: boolean;
144
+ }
145
+ export type VBaseCellCatCore = {
146
+ readonly tag: 'c-walking-hom';
147
+ readonly dim: number;
148
+ readonly parent?: VBaseCellCatCore;
149
+ readonly src: Value;
150
+ readonly dst: Value;
151
+ } | {
152
+ readonly tag: 'c-walking-arrow-hom';
153
+ readonly dim: number;
154
+ readonly parent?: VBaseCellCatCore;
155
+ readonly src: Value;
156
+ readonly dst: Value;
157
+ } | {
158
+ readonly tag: 'c-neutral-hom';
159
+ readonly rootCatNe: VNeutral;
160
+ readonly rootIsStrict: boolean;
161
+ readonly level: number;
162
+ readonly dim: number;
163
+ readonly parent?: VBaseCellCatCore;
164
+ readonly src: Value;
165
+ readonly dst: Value;
166
+ };
167
+ export type VCatCore = {
168
+ readonly tag: 'c-cat-cart';
169
+ readonly level: number;
170
+ } | {
171
+ readonly tag: 'c-cat-lax';
172
+ readonly level: number;
173
+ } | {
174
+ readonly tag: 'c-grpd-cat';
175
+ readonly level: number;
176
+ } | {
177
+ readonly tag: 'c-terminal';
178
+ } | {
179
+ readonly tag: 'c-product';
180
+ readonly fst: VCat;
181
+ readonly snd: VCat;
182
+ } | {
183
+ readonly tag: 'c-join';
184
+ readonly left: VCat;
185
+ readonly right: VCat;
186
+ } | {
187
+ readonly tag: 'c-path';
188
+ readonly grpd: VGrpd;
189
+ } | {
190
+ readonly tag: 'c-functor';
191
+ readonly mode: TransfMode;
192
+ readonly dom: VCat;
193
+ readonly cod: VCat;
194
+ } | {
195
+ readonly tag: 'c-transf';
196
+ readonly mode: TransfMode;
197
+ readonly dom: VCat;
198
+ readonly cod: VCat;
199
+ readonly src: VFun;
200
+ readonly dst: VFun;
201
+ } | {
202
+ readonly tag: 'c-modif';
203
+ readonly mode: TransfMode;
204
+ readonly dom: VCat;
205
+ readonly cod: VCat;
206
+ readonly srcFun: VFun;
207
+ readonly dstFun: VFun;
208
+ readonly lhsTransf: VTransf;
209
+ readonly rhsTransf: VTransf;
210
+ } | {
211
+ readonly tag: 'c-sigma';
212
+ readonly pol: SigmaPolarity;
213
+ readonly base: VCat;
214
+ readonly fam: VFun;
215
+ } | {
216
+ readonly tag: 'c-walking-end';
217
+ } | {
218
+ readonly tag: 'c-walking-arrow';
219
+ } | VBaseCellCatCore | {
220
+ readonly tag: 'c-neutral';
221
+ readonly ne: VNeutral;
222
+ readonly level: number;
223
+ readonly isStrict: boolean;
224
+ };
225
+ export interface VFun {
226
+ readonly tag: 'v-fun';
227
+ readonly dom: VCat;
228
+ readonly cod: VCat;
229
+ readonly atObj: (x: Value) => Value;
230
+ readonly atHom: (src: Value, dst: Value) => VFun;
231
+ /** Present iff this functor is a neutral variable/expression (triggers inward spine fusion). */
232
+ readonly neutralHead?: VNeutral;
233
+ /** Optional structural provenance for quoting presheaf/join combinators. */
234
+ readonly pshForm?: {
235
+ readonly tag: 'psh-prod';
236
+ readonly site: VCat;
237
+ readonly fstPsh: VFun;
238
+ readonly sndPsh: VFun;
239
+ } | {
240
+ readonly tag: 'psh-exp';
241
+ readonly site: VCat;
242
+ readonly domPsh: VFun;
243
+ readonly codPsh: VFun;
244
+ } | {
245
+ readonly tag: 'join-inl';
246
+ readonly left: VCat;
247
+ readonly right: VCat;
248
+ } | {
249
+ readonly tag: 'join-inr';
250
+ readonly left: VCat;
251
+ readonly right: VCat;
252
+ };
253
+ }
254
+ export interface VTransf {
255
+ readonly tag: 'v-transf';
256
+ readonly mode: TransfMode;
257
+ readonly dom: VCat;
258
+ readonly cod: VCat;
259
+ readonly src: VFun;
260
+ readonly dst: VFun;
261
+ readonly atObj: (x: Value) => Value;
262
+ /**
263
+ * Returns the laxity transformation `Hom_dom(x, y) -> Hom_cod(src[x], dst[y])`
264
+ * obeying the strict associative Leibniz spine law.
265
+ */
266
+ readonly laxity: (x: Value, y: Value) => VTransf;
267
+ readonly neutralHead?: VNeutral;
268
+ }
269
+ export interface VModif {
270
+ readonly tag: 'v-modif';
271
+ readonly mode: TransfMode;
272
+ readonly dom: VCat;
273
+ readonly cod: VCat;
274
+ readonly srcFun: VFun;
275
+ readonly dstFun: VFun;
276
+ readonly lhsTransf: VTransf;
277
+ readonly rhsTransf: VTransf;
278
+ readonly atObj: (x: Value) => Value;
279
+ }
280
+ /** Diagrammatic path atom `lhs =_ty rhs` inside `VPathSpine`. */
281
+ export type VPathAtom = {
282
+ readonly tag: 'p-neutral';
283
+ readonly ne: VNeutral;
284
+ readonly inv: boolean;
285
+ readonly lhs: Value;
286
+ readonly rhs: Value;
287
+ } | {
288
+ readonly tag: 'p-ap';
289
+ readonly dom: VGrpd;
290
+ readonly cod: VGrpd;
291
+ readonly fn: (v: Value) => Value;
292
+ readonly inner: VPathAtom;
293
+ readonly lhs: Value;
294
+ readonly rhs: Value;
295
+ } | {
296
+ readonly tag: 'p-strict-nat';
297
+ readonly dom: VCat;
298
+ readonly cod: VCat;
299
+ readonly srcFun: VFun;
300
+ readonly dstFun: VFun;
301
+ readonly strictTransf: VTransf;
302
+ readonly srcObj: Value;
303
+ readonly dstObj: Value;
304
+ readonly arrow: Value;
305
+ readonly inv: boolean;
306
+ readonly lhs: Value;
307
+ readonly rhs: Value;
308
+ } | {
309
+ readonly tag: 'p-ua';
310
+ readonly level: number;
311
+ readonly fwdDom: VGrpd;
312
+ readonly fwdCod: VGrpd;
313
+ readonly toFn: Value;
314
+ readonly fromFn: Value;
315
+ readonly retrProof: Value;
316
+ readonly sectProof: Value;
317
+ readonly inv: boolean;
318
+ readonly lhs: Value;
319
+ readonly rhs: Value;
320
+ } | {
321
+ readonly tag: 'p-funext';
322
+ readonly nameHint: string;
323
+ readonly dom: VGrpd;
324
+ readonly cod: (x: Value) => VGrpd;
325
+ readonly lhsFn: Value;
326
+ readonly rhsFn: Value;
327
+ readonly homotopy: Value;
328
+ readonly inv: boolean;
329
+ readonly lhs: Value;
330
+ readonly rhs: Value;
331
+ } | {
332
+ readonly tag: 'p-circle-loop';
333
+ readonly inv: boolean;
334
+ readonly lhs: Value;
335
+ readonly rhs: Value;
336
+ };
337
+ /** Flat associative path spine `lhs = x_0 --atoms[0]--> ... --atoms[k-1]--> x_k = rhs`. */
338
+ export interface VPathSpine {
339
+ readonly tag: 'v-path-spine';
340
+ readonly ty: VGrpd;
341
+ readonly lhs: Value;
342
+ readonly rhs: Value;
343
+ readonly atoms: readonly VPathAtom[];
344
+ }
345
+ /** Diagrammatic atomic cell `src -> dst` inside `VCellSpine`. */
346
+ export type VCellAtom = {
347
+ readonly tag: 'ca-walking-loop';
348
+ readonly src: Value;
349
+ readonly dst: Value;
350
+ } | {
351
+ readonly tag: 'ca-walking-arrow-seg';
352
+ readonly src: Value;
353
+ readonly dst: Value;
354
+ } | {
355
+ readonly tag: 'ca-neutral';
356
+ readonly ne: VNeutral;
357
+ readonly src: Value;
358
+ readonly dst: Value;
359
+ } | {
360
+ /** Neutral functor `fun` (with `fun.neutralHead` defined) applied to non-identity `arg`. */
361
+ readonly tag: 'ca-fapp';
362
+ readonly fun: VFun;
363
+ readonly funNe: VNeutral;
364
+ readonly argSrc: Value;
365
+ readonly argDst: Value;
366
+ readonly arg: Value;
367
+ readonly src: Value;
368
+ readonly dst: Value;
369
+ } | {
370
+ /** `Core_incl(cat)` applied to a single non-refl path atom `pathAtom : src = dst`. */
371
+ readonly tag: 'ca-core-incl';
372
+ readonly cat: VCat;
373
+ readonly pathAtom: VPathAtom;
374
+ readonly src: Value;
375
+ readonly dst: Value;
376
+ };
377
+ /** Flat associative Došen cell spine `src = x_0 --atoms[0]--> ... --atoms[k-1]--> x_k = dst`. */
378
+ export interface VCellSpine {
379
+ readonly tag: 'v-cell-spine';
380
+ readonly homCore: VBaseCellCatCore;
381
+ readonly src: Value;
382
+ readonly dst: Value;
383
+ readonly atoms: readonly VCellAtom[];
384
+ }
385
+ export type VNeutral = {
386
+ readonly tag: 'n-obj-var';
387
+ readonly level: number;
388
+ readonly name: string;
389
+ readonly ty: VGrpd;
390
+ } | {
391
+ readonly tag: 'n-fun-var';
392
+ readonly level: number;
393
+ readonly name: string;
394
+ readonly cat: VCat;
395
+ } | {
396
+ readonly tag: 'n-global-opaque';
397
+ readonly name: string;
398
+ readonly ty: VGrpd;
399
+ } | {
400
+ readonly tag: 'n-app-grpd';
401
+ readonly fn: VNeutral;
402
+ readonly arg: Value;
403
+ readonly argTy: VGrpd;
404
+ } | {
405
+ readonly tag: 'n-fst-grpd';
406
+ readonly pair: VNeutral;
407
+ } | {
408
+ readonly tag: 'n-snd-grpd';
409
+ readonly pair: VNeutral;
410
+ } | {
411
+ readonly tag: 'n-empty-elim';
412
+ readonly motive: (v: Value) => VGrpd;
413
+ readonly scrutinee: VNeutral;
414
+ } | {
415
+ readonly tag: 'n-bool-elim';
416
+ readonly motive: (v: Value) => VGrpd;
417
+ readonly falseCase: Value;
418
+ readonly trueCase: Value;
419
+ readonly scrutinee: VNeutral;
420
+ } | {
421
+ readonly tag: 'n-nat-elim';
422
+ readonly motive: (v: Value) => VGrpd;
423
+ readonly zeroCase: Value;
424
+ readonly succCase: (n: Value, ih: Value) => Value;
425
+ readonly scrutinee: VNeutral;
426
+ } | {
427
+ readonly tag: 'n-sum-elim';
428
+ readonly leftTy: VGrpd;
429
+ readonly rightTy: VGrpd;
430
+ readonly motive: (v: Value) => VGrpd;
431
+ readonly inlCase: (a: Value) => Value;
432
+ readonly inrCase: (b: Value) => Value;
433
+ readonly scrutinee: VNeutral;
434
+ } | {
435
+ readonly tag: 'n-list-elim';
436
+ readonly elemTy: VGrpd;
437
+ readonly motive: (v: Value) => VGrpd;
438
+ readonly nilCase: Value;
439
+ readonly consCase: (h: Value, t: Value, ih: Value) => Value;
440
+ readonly scrutinee: VNeutral;
441
+ } | {
442
+ readonly tag: 'n-eq-j';
443
+ readonly ty: VGrpd;
444
+ readonly base: Value;
445
+ readonly motive: (y: Value, p: Value) => VGrpd;
446
+ readonly reflCase: Value;
447
+ readonly target: Value;
448
+ readonly path: VPathSpine;
449
+ } | {
450
+ readonly tag: 'n-fapp0';
451
+ readonly funNe: VNeutral;
452
+ readonly dom: VCat;
453
+ readonly cod: VCat;
454
+ readonly arg: Value;
455
+ } | {
456
+ readonly tag: 'n-fapp1';
457
+ readonly funNe: VNeutral;
458
+ readonly dom: VCat;
459
+ readonly cod: VCat;
460
+ readonly src: Value;
461
+ readonly dst: Value;
462
+ } | {
463
+ readonly tag: 'n-dual-fun';
464
+ readonly dual: Duality;
465
+ readonly innerNe: VNeutral;
466
+ } | {
467
+ readonly tag: 'n-tapp0';
468
+ readonly transfNe: VNeutral;
469
+ readonly mode: TransfMode;
470
+ readonly dom: VCat;
471
+ readonly cod: VCat;
472
+ readonly arg: Value;
473
+ readonly srcFun?: VFun;
474
+ readonly dstFun?: VFun;
475
+ } | {
476
+ readonly tag: 'n-tlaxity-atom';
477
+ readonly transfNe: VNeutral;
478
+ readonly mode: 'lax' | 'oplax';
479
+ readonly dom: VCat;
480
+ readonly cod: VCat;
481
+ readonly srcObj: Value;
482
+ readonly dstObj: Value;
483
+ readonly atom: VCellAtom;
484
+ } | {
485
+ readonly tag: 'n-walking-is-one-cat';
486
+ readonly x: Value;
487
+ readonly y: Value;
488
+ } | {
489
+ readonly tag: 'n-walking-arrow-is-one-cat';
490
+ readonly x: Value;
491
+ readonly y: Value;
492
+ } | {
493
+ readonly tag: 'n-walking-arrow-rec';
494
+ readonly cod: VCat;
495
+ readonly zeroObj: Value;
496
+ readonly oneObj: Value;
497
+ readonly segCell: Value;
498
+ } | {
499
+ readonly tag: 'n-walking-arrow-ind-transf';
500
+ readonly mode: 'lax' | 'oplax';
501
+ readonly cod: VCat;
502
+ readonly srcFun: VFun;
503
+ readonly dstFun: VFun;
504
+ readonly zeroCell: Value;
505
+ readonly oneCell: Value;
506
+ readonly segCell: Value;
507
+ } | {
508
+ readonly tag: 'n-walking-arrow-ind-laxity';
509
+ readonly mode: 'lax' | 'oplax';
510
+ readonly cod: VCat;
511
+ readonly srcFun: VFun;
512
+ readonly dstFun: VFun;
513
+ readonly zeroCell: Value;
514
+ readonly oneCell: Value;
515
+ readonly segCell: Value;
516
+ readonly srcObj: Value;
517
+ readonly dstObj: Value;
518
+ readonly atomNe: VNeutral;
519
+ } | {
520
+ readonly tag: 'n-walking-ind-fibre';
521
+ readonly srcFam: VFun;
522
+ readonly dstFam: VFun;
523
+ readonly baseFun: VFun;
524
+ readonly loopCoherence: VTransf;
525
+ readonly objNe: VNeutral;
526
+ } | {
527
+ readonly tag: 'n-walking-ind-laxity';
528
+ readonly srcFam: VFun;
529
+ readonly dstFam: VFun;
530
+ readonly baseFun: VFun;
531
+ readonly loopCoherence: VTransf;
532
+ readonly srcObj: Value;
533
+ readonly dstObj: Value;
534
+ readonly atomNe: VNeutral;
535
+ } | {
536
+ readonly tag: 'n-whisker';
537
+ readonly side: 'post' | 'pre';
538
+ readonly cat: VCat;
539
+ readonly a: Value;
540
+ readonly b: Value;
541
+ readonly c: Value;
542
+ readonly arrow: Value;
543
+ readonly h0: Value;
544
+ readonly h1: Value;
545
+ } | {
546
+ readonly tag: 'n-coe-atom';
547
+ readonly level: number;
548
+ readonly atom: VPathAtom;
549
+ readonly val: Value;
550
+ } | {
551
+ readonly tag: 'n-happly-atom';
552
+ readonly nameHint: string;
553
+ readonly dom: VGrpd;
554
+ readonly cod: (x: Value) => VGrpd;
555
+ readonly atom: VPathAtom;
556
+ readonly arg: Value;
557
+ } | {
558
+ readonly tag: 'n-circle-is-groupoid';
559
+ } | {
560
+ readonly tag: 'n-circle-ind';
561
+ readonly nameHint: string;
562
+ readonly motiveLevel: number;
563
+ readonly motive: (x: Value) => VGrpd;
564
+ readonly baseCase: Value;
565
+ readonly loopCase: Value;
566
+ readonly scrutinee: VNeutral;
567
+ } | {
568
+ readonly tag: 'n-circle-ind-loop-beta';
569
+ readonly nameHint: string;
570
+ readonly motiveLevel: number;
571
+ readonly motive: (x: Value) => VGrpd;
572
+ readonly baseCase: Value;
573
+ readonly loopCase: Value;
574
+ } | {
575
+ readonly tag: 'n-sheaf-restr';
576
+ readonly site: VCat;
577
+ readonly covTy: VGrpd;
578
+ readonly covVal: Value;
579
+ readonly pshFun: VFun;
580
+ readonly srcObj: Value;
581
+ readonly dstObj: Value;
582
+ readonly arrow: Value;
583
+ readonly innerNe: VNeutral;
584
+ } | {
585
+ readonly tag: 'n-sheaf-is-set';
586
+ readonly site: VCat;
587
+ readonly covTy: VGrpd;
588
+ readonly covVal: Value;
589
+ readonly pshFun: VFun;
590
+ readonly obj: Value;
591
+ } | {
592
+ readonly tag: 'n-sheaf-pullback';
593
+ readonly site: VCat;
594
+ readonly covTy: VGrpd;
595
+ readonly covVal: Value;
596
+ readonly pshFun: VFun;
597
+ readonly baseObj: Value;
598
+ readonly targetObj: Value;
599
+ readonly reindex: Value;
600
+ readonly sieveTy: VGrpd;
601
+ readonly sieve: Value;
602
+ readonly isCovTy: VGrpd;
603
+ readonly covProof: Value;
604
+ readonly matchTy: VGrpd;
605
+ readonly match: Value;
606
+ } | {
607
+ readonly tag: 'n-sheaf-silent';
608
+ readonly site: VCat;
609
+ readonly covTy: VGrpd;
610
+ readonly covVal: Value;
611
+ readonly pshFun: VFun;
612
+ readonly secTy: VGrpd;
613
+ readonly obj: Value;
614
+ readonly sieveTy: VGrpd;
615
+ readonly sieve: Value;
616
+ readonly isCovTy: VGrpd;
617
+ readonly covProof: Value;
618
+ readonly sec: Value;
619
+ } | {
620
+ readonly tag: 'n-sheaf-rho-nat';
621
+ readonly secW: VGrpd;
622
+ readonly lhs: Value;
623
+ readonly rhs: Value;
624
+ } | {
625
+ readonly tag: 'n-sheaf-rec-head';
626
+ readonly site: VCat;
627
+ readonly covTy: VGrpd;
628
+ readonly covVal: Value;
629
+ readonly pshTy: VGrpd;
630
+ readonly pshFun: VFun;
631
+ readonly targetPshFun: VFun;
632
+ readonly isSetTy: VGrpd;
633
+ readonly targetIsSet: Value;
634
+ readonly isSheafTy: VGrpd;
635
+ readonly targetIsSheaf: Value;
636
+ readonly baseHomTy: VGrpd;
637
+ readonly baseHom: Value;
638
+ } | {
639
+ readonly tag: 'n-sheaf-rec-map';
640
+ readonly head: VNeutral;
641
+ readonly site: VCat;
642
+ readonly obj: Value;
643
+ readonly scrutinee: VNeutral;
644
+ } | {
645
+ readonly tag: 'n-sheaf-rec-nat';
646
+ readonly head: VNeutral;
647
+ readonly site: VCat;
648
+ readonly srcObj: Value;
649
+ readonly dstObj: Value;
650
+ readonly arrow: Value;
651
+ readonly secTy: VGrpd;
652
+ readonly sec: Value;
653
+ } | {
654
+ readonly tag: 'n-sheaf-rec-uniq';
655
+ readonly head: VNeutral;
656
+ readonly site: VCat;
657
+ readonly psiTy: VGrpd;
658
+ readonly psi: Value;
659
+ readonly agreeTy: VGrpd;
660
+ readonly agree: Value;
661
+ readonly obj: Value;
662
+ readonly secTy: VGrpd;
663
+ readonly sec: Value;
664
+ } | {
665
+ readonly tag: 'n-groupoidify-unit';
666
+ readonly cat: VCat;
667
+ } | {
668
+ readonly tag: 'n-groupoidify-is-groupoid';
669
+ readonly cat: VCat;
670
+ } | {
671
+ readonly tag: 'n-groupoidify-rec';
672
+ readonly cat: VCat;
673
+ readonly targetGrpd: VGrpd;
674
+ readonly fun: VFun;
675
+ readonly scrutinee: VNeutral;
676
+ } | {
677
+ readonly tag: 'n-groupoidify-rec-beta';
678
+ readonly cat: VCat;
679
+ readonly targetGrpd: VGrpd;
680
+ readonly fun: VFun;
681
+ readonly src: Value;
682
+ readonly dst: Value;
683
+ readonly arrow: Value;
684
+ } | {
685
+ readonly tag: 'n-groupoidify-homotopy';
686
+ readonly cat: VCat;
687
+ readonly targetGrpd: VGrpd;
688
+ readonly is1GrpdTy: VGrpd;
689
+ readonly targetIs1Grpd: Value;
690
+ readonly lhsMap: Value;
691
+ readonly rhsMap: Value;
692
+ readonly ptEqTy: VGrpd;
693
+ readonly ptEq: Value;
694
+ readonly edgeNatTy: VGrpd;
695
+ readonly edgeNat: Value;
696
+ readonly scrutinee: VNeutral;
697
+ } | {
698
+ readonly tag: 'n-join-id';
699
+ readonly left: VCat;
700
+ readonly right: VCat;
701
+ readonly dual: Duality;
702
+ readonly obj: Value;
703
+ } | {
704
+ readonly tag: 'n-join-comp';
705
+ readonly left: VCat;
706
+ readonly right: VCat;
707
+ readonly x: Value;
708
+ readonly y: Value;
709
+ readonly z: Value;
710
+ readonly second: Value;
711
+ readonly first: Value;
712
+ } | {
713
+ readonly tag: 'n-join-elim-fun';
714
+ readonly left: VCat;
715
+ readonly right: VCat;
716
+ readonly cod: VCat;
717
+ readonly leftFun: VFun;
718
+ readonly rightFun: VFun;
719
+ readonly crossTy: VGrpd;
720
+ readonly crossTransf: VTransf;
721
+ } | {
722
+ readonly tag: 'n-join-observe-cross';
723
+ readonly left: VCat;
724
+ readonly right: VCat;
725
+ readonly cod: VCat;
726
+ readonly fun: VFun;
727
+ } | {
728
+ readonly tag: 'n-join-cone-1cat';
729
+ readonly left: VCat;
730
+ readonly right: VCat;
731
+ readonly cod: VCat;
732
+ readonly isOneCatTy: VGrpd;
733
+ readonly codIsOneCat: Value;
734
+ readonly leftFun: VFun;
735
+ readonly rightFun: VFun;
736
+ readonly crossCellTy: VGrpd;
737
+ readonly crossCell: Value;
738
+ readonly leftNatTy: VGrpd;
739
+ readonly leftNat: Value;
740
+ readonly rightNatTy: VGrpd;
741
+ readonly rightNat: Value;
742
+ } | {
743
+ readonly tag: 'n-ua-id-loop';
744
+ readonly level: number;
745
+ readonly ty: VGrpd;
746
+ readonly homotopy: Value;
747
+ } | {
748
+ readonly tag: 'n-ua-id-loop-beta';
749
+ readonly level: number;
750
+ readonly ty: VGrpd;
751
+ readonly homotopy: Value;
752
+ readonly arg: Value;
753
+ } | {
754
+ readonly tag: 'n-pushout-glue';
755
+ readonly pushoutTy: Extract<VGrpd, {
756
+ tag: 'v-pushout-grpd';
757
+ }>;
758
+ readonly point: Value;
759
+ } | {
760
+ readonly tag: 'n-pushout-ind';
761
+ readonly pushoutTy: Extract<VGrpd, {
762
+ tag: 'v-pushout-grpd';
763
+ }>;
764
+ readonly motiveNameHint: string;
765
+ readonly motiveLevel: number;
766
+ readonly motive: (u: Value) => VGrpd;
767
+ readonly inlNameHint: string;
768
+ readonly inlCase: (a: Value) => Value;
769
+ readonly inrNameHint: string;
770
+ readonly inrCase: (b: Value) => Value;
771
+ readonly glueNameHint: string;
772
+ readonly glueCase: (c: Value) => Value;
773
+ readonly scrutinee: VNeutral;
774
+ } | {
775
+ readonly tag: 'n-pushout-ind-glue-beta';
776
+ readonly pushoutTy: Extract<VGrpd, {
777
+ tag: 'v-pushout-grpd';
778
+ }>;
779
+ readonly motiveNameHint: string;
780
+ readonly motiveLevel: number;
781
+ readonly motive: (u: Value) => VGrpd;
782
+ readonly inlNameHint: string;
783
+ readonly inlCase: (a: Value) => Value;
784
+ readonly inrNameHint: string;
785
+ readonly inrCase: (b: Value) => Value;
786
+ readonly glueNameHint: string;
787
+ readonly glueCase: (c: Value) => Value;
788
+ readonly point: Value;
789
+ } | {
790
+ readonly tag: 'n-trunc0-is-set';
791
+ readonly inner: VGrpd;
792
+ } | {
793
+ readonly tag: 'n-trunc0-ind';
794
+ readonly truncTy: Extract<VGrpd, {
795
+ tag: 'v-trunc0-grpd';
796
+ }>;
797
+ readonly motiveNameHint: string;
798
+ readonly motiveLevel: number;
799
+ readonly motive: (u: Value) => VGrpd;
800
+ readonly isSetMotiveTy: VGrpd;
801
+ readonly isSetMotive: Value;
802
+ readonly inNameHint: string;
803
+ readonly inCase: (x: Value) => Value;
804
+ readonly scrutinee: VNeutral;
805
+ };
806
+ export type Value = VGrpd | {
807
+ readonly tag: 'v-cat-val';
808
+ readonly cat: VCat;
809
+ } | {
810
+ readonly tag: 'v-tt';
811
+ } | {
812
+ readonly tag: 'v-false';
813
+ } | {
814
+ readonly tag: 'v-true';
815
+ } | {
816
+ readonly tag: 'v-zero';
817
+ } | {
818
+ readonly tag: 'v-succ';
819
+ readonly pred: Value;
820
+ } | {
821
+ readonly tag: 'v-nat-lit';
822
+ readonly val: bigint;
823
+ } | {
824
+ readonly tag: 'v-circle-base';
825
+ } | {
826
+ readonly tag: 'v-groupoidify-pt';
827
+ readonly cat: VCat;
828
+ readonly obj: Value;
829
+ } | {
830
+ readonly tag: 'v-pushout-inl';
831
+ readonly val: Value;
832
+ } | {
833
+ readonly tag: 'v-pushout-inr';
834
+ readonly val: Value;
835
+ } | {
836
+ readonly tag: 'v-trunc0-in';
837
+ readonly val: Value;
838
+ } | {
839
+ readonly tag: 'v-sheaf-ret';
840
+ readonly obj: Value;
841
+ readonly val: Value;
842
+ } | {
843
+ readonly tag: 'v-sheaf-glue';
844
+ readonly baseObj: Value;
845
+ readonly targetObj: Value;
846
+ readonly reindex: Value;
847
+ readonly sieveTy: VGrpd;
848
+ readonly sieve: Value;
849
+ readonly isCovTy: VGrpd;
850
+ readonly covProof: Value;
851
+ readonly matchTy: VGrpd;
852
+ readonly match: Value;
853
+ } | {
854
+ readonly tag: 'v-inl';
855
+ readonly val: Value;
856
+ } | {
857
+ readonly tag: 'v-inr';
858
+ readonly val: Value;
859
+ } | {
860
+ readonly tag: 'v-nil';
861
+ } | {
862
+ readonly tag: 'v-cons';
863
+ readonly head: Value;
864
+ readonly tail: Value;
865
+ } | {
866
+ readonly tag: 'v-lam-grpd';
867
+ readonly nameHint: string;
868
+ readonly dom: VGrpd;
869
+ readonly fn: (arg: Value) => Value;
870
+ readonly neutralHead?: VNeutral;
871
+ } | {
872
+ readonly tag: 'v-pair';
873
+ readonly fst: Value;
874
+ readonly snd: Value;
875
+ readonly neutralHead?: VNeutral;
876
+ readonly neutralSigmaTy?: Extract<VGrpdWhnf, {
877
+ tag: 'v-sigma-grpd';
878
+ }>;
879
+ } | {
880
+ readonly tag: 'v-glued';
881
+ readonly glued: VGluedHead;
882
+ readonly ty: VGrpd;
883
+ readonly force: () => Value;
884
+ } | VPathSpine | VFun | VTransf | VModif | {
885
+ readonly tag: 'v-walking-base';
886
+ } | {
887
+ readonly tag: 'v-walking-arrow-zero';
888
+ } | {
889
+ readonly tag: 'v-walking-arrow-one';
890
+ } | VCellSpine | {
891
+ /**
892
+ * Generic functorial variable image under `Path_map(fn)` (`Path(domGrpd) -> Path(codGrpd)`),
893
+ * enabling exact `O(1)` conversion of functors out of `Path(X)`!
894
+ */
895
+ readonly tag: 'v-fun-path-var';
896
+ readonly varLevel: number;
897
+ readonly domGrpd: VGrpd;
898
+ readonly codGrpd: VGrpd;
899
+ readonly fn: (v: Value) => Value;
900
+ } | {
901
+ /**
902
+ * Generic functorial variable image under `Core_incl(cat) o Path_map(fn)` (`Path(domGrpd) -> cat`),
903
+ * fusing under any strict functor `G : cat -> D` to `x0 => G.atObj(fn(x0))`!
904
+ */
905
+ readonly tag: 'v-fun-core-path-var';
906
+ readonly varLevel: number;
907
+ readonly domGrpd: VGrpd;
908
+ readonly cat: VCat;
909
+ readonly fn: (v: Value) => Value;
910
+ } | {
911
+ readonly tag: 'v-neutral';
912
+ readonly ne: VNeutral;
913
+ };
914
+ export interface EnvLookup {
915
+ get(key: number | string): Value | undefined;
916
+ has(key: number | string): boolean;
917
+ }
918
+ /**
919
+ * O(1)-global-sharing NbE evaluation environment: keeps the immutable global
920
+ * valuation map by reference (`0` copying across binders) and copies only local
921
+ * binder entries (`0..10` entries).
922
+ */
923
+ export declare class SplitEvalEnv implements EnvLookup {
924
+ readonly globals: ReadonlyMap<string, Value>;
925
+ readonly locals: ReadonlyMap<number, Value>;
926
+ constructor(globals: ReadonlyMap<string, Value>, locals?: ReadonlyMap<number, Value>);
927
+ get(key: number | string): Value | undefined;
928
+ has(key: number | string): boolean;
929
+ extend(varId: number, val: Value): SplitEvalEnv;
930
+ }
931
+ export type Env = EnvLookup;
932
+ /** Environment for structural `lift` (`x0 --p--> x1` in `Hom_A`). */
933
+ export interface LiftEntry {
934
+ readonly lhs: Value;
935
+ readonly rhs: Value;
936
+ /** `arrow` is defined iff this variable varies along the lifted direction (`undefined` = constant!). */
937
+ readonly arrow?: {
938
+ readonly cat: VCat;
939
+ readonly cell: Value;
940
+ };
941
+ }
942
+ export type LiftEnv = ReadonlyMap<number, LiftEntry>;