@hotdocx/endash-kernel 0.1.0-preview.0 → 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.
- package/LICENSE +9 -1
- package/README.md +24 -2
- package/bin/endash-cli.cjs +4 -0
- package/bin/endash-mcp.cjs +7 -0
- package/browser.d.ts +44 -0
- package/endash-browser.js +698 -0
- package/index.cjs +704 -14
- package/index.d.ts +19 -11
- package/index.mjs +704 -14
- package/node.cjs +116606 -0
- package/node.d.ts +8 -0
- package/node.mjs +53 -0
- package/package.json +51 -7
- package/types/ast.d.ts +964 -0
- package/types/book/book_compiler.d.ts +57 -0
- package/types/book/html_renderer.d.ts +27 -0
- package/types/book/literate_en.d.ts +40 -0
- package/types/book/schema.d.ts +279 -0
- package/types/browser.d.ts +44 -0
- package/types/builders.d.ts +191 -0
- package/types/cache/core_snapshot.d.ts +259 -0
- package/types/cas/bar_hochschild.d.ts +106 -0
- package/types/cas/cotangent_deformation.d.ts +100 -0
- package/types/cas/cyclic_homology.d.ts +100 -0
- package/types/cas/derham_hkr.d.ts +117 -0
- package/types/cas/ext_algebra.d.ts +112 -0
- package/types/cas/groebner_syzygy.d.ts +43 -0
- package/types/cas/hilbert_proj_ag.d.ts +97 -0
- package/types/cas/hnf_snf.d.ts +49 -0
- package/types/cas/lefschetz_weil.d.ts +114 -0
- package/types/cas/localization_cech.d.ts +201 -0
- package/types/cas/matrix.d.ts +45 -0
- package/types/cas/modules_complexes.d.ts +141 -0
- package/types/cas/perm_coset_cgt.d.ts +166 -0
- package/types/cas/poly.d.ts +66 -0
- package/types/cas/reify_proofs.d.ts +104 -0
- package/types/cas/resolutions_spectral_seq.d.ts +193 -0
- package/types/cas/rings.d.ts +70 -0
- package/types/cas/smith_resultant_gauss.d.ts +164 -0
- package/types/cas/theta_stepanov.d.ts +182 -0
- package/types/check.d.ts +65 -0
- package/types/cli/endash_cli.d.ts +19 -0
- package/types/context.d.ts +110 -0
- package/types/duality.d.ts +76 -0
- package/types/elab/elab_ast.d.ts +274 -0
- package/types/elab/elaborate.d.ts +106 -0
- package/types/elab/env.d.ts +170 -0
- package/types/elab/match.d.ts +123 -0
- package/types/elab/pretty.d.ts +14 -0
- package/types/elab/structure.d.ts +46 -0
- package/types/elab/tactics.d.ts +238 -0
- package/types/elab/typeclass.d.ts +31 -0
- package/types/elab/unify.d.ts +166 -0
- package/types/eval.d.ts +28 -0
- package/types/index.d.ts +98 -0
- package/types/kernel_ops.d.ts +196 -0
- package/types/mcp/endash_mcp_server.d.ts +63 -0
- package/types/module/comparator.d.ts +86 -0
- package/types/module/desugar.d.ts +94 -0
- package/types/module/goal_inspector.d.ts +104 -0
- package/types/module/loader.d.ts +105 -0
- package/types/module/node_fs_provider.d.ts +26 -0
- package/types/module/package_builder.d.ts +83 -0
- package/types/module/proof_graph.d.ts +80 -0
- package/types/module/quasiquote.d.ts +37 -0
- package/types/module/stdlib_fresh_builders.d.ts +10 -0
- package/types/module/stdlib_tactic_hooks.d.ts +20 -0
- package/types/parser/lexer.d.ts +12 -0
- package/types/parser/parser.d.ts +78 -0
- package/types/parser/pratt.d.ts +17 -0
- package/types/parser/span.d.ts +26 -0
- package/types/parser/surface_ast.d.ts +501 -0
- package/types/stdlib_types.d.ts +113 -0
- package/types/value.d.ts +942 -0
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Located Surface AST for `.en` Modules, Lean 4-Style Expressions/Tactics,
|
|
3
|
+
* Functorial Extensions, and `en\`...\`` TypeScript Quasiquotes (`endash/src/parser/surface_ast.ts`).
|
|
4
|
+
*/
|
|
5
|
+
import { Plicity } from '../elab/elab_ast';
|
|
6
|
+
import { SourceSpan } from './span';
|
|
7
|
+
export interface SurfaceBinder {
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly plicity: Plicity;
|
|
10
|
+
readonly ty?: SurfaceExpr;
|
|
11
|
+
readonly span: SourceSpan;
|
|
12
|
+
}
|
|
13
|
+
export interface SurfaceArg {
|
|
14
|
+
readonly plicity?: Plicity;
|
|
15
|
+
readonly name?: string;
|
|
16
|
+
readonly value: SurfaceExpr;
|
|
17
|
+
readonly span: SourceSpan;
|
|
18
|
+
}
|
|
19
|
+
export type SurfacePattern = {
|
|
20
|
+
readonly tag: 'sp-wild';
|
|
21
|
+
readonly span: SourceSpan;
|
|
22
|
+
} | {
|
|
23
|
+
readonly tag: 'sp-var';
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly span: SourceSpan;
|
|
26
|
+
} | {
|
|
27
|
+
readonly tag: 'sp-nat';
|
|
28
|
+
readonly value: number;
|
|
29
|
+
readonly span: SourceSpan;
|
|
30
|
+
} | {
|
|
31
|
+
readonly tag: 'sp-bool';
|
|
32
|
+
readonly value: boolean;
|
|
33
|
+
readonly span: SourceSpan;
|
|
34
|
+
} | {
|
|
35
|
+
readonly tag: 'sp-nil';
|
|
36
|
+
readonly span: SourceSpan;
|
|
37
|
+
} | {
|
|
38
|
+
readonly tag: 'sp-cons';
|
|
39
|
+
readonly head: SurfacePattern;
|
|
40
|
+
readonly tail: SurfacePattern;
|
|
41
|
+
readonly span: SourceSpan;
|
|
42
|
+
} | {
|
|
43
|
+
readonly tag: 'sp-tuple';
|
|
44
|
+
readonly items: readonly SurfacePattern[];
|
|
45
|
+
readonly span: SourceSpan;
|
|
46
|
+
} | {
|
|
47
|
+
readonly tag: 'sp-ctor';
|
|
48
|
+
readonly ctor: string;
|
|
49
|
+
readonly args: readonly SurfacePattern[];
|
|
50
|
+
readonly span: SourceSpan;
|
|
51
|
+
};
|
|
52
|
+
export interface SurfaceMatchArm {
|
|
53
|
+
readonly patterns: readonly SurfacePattern[];
|
|
54
|
+
readonly rhs: SurfaceExpr;
|
|
55
|
+
readonly span: SourceSpan;
|
|
56
|
+
}
|
|
57
|
+
export interface SurfaceTacticArm {
|
|
58
|
+
readonly ctor: string;
|
|
59
|
+
readonly binders: readonly string[];
|
|
60
|
+
readonly tactics: readonly SurfaceTactic[];
|
|
61
|
+
readonly span: SourceSpan;
|
|
62
|
+
}
|
|
63
|
+
export type SurfaceLevelExpr = {
|
|
64
|
+
readonly tag: 'sl-nat';
|
|
65
|
+
readonly value: number;
|
|
66
|
+
} | {
|
|
67
|
+
readonly tag: 'sl-var';
|
|
68
|
+
readonly name: string;
|
|
69
|
+
} | {
|
|
70
|
+
readonly tag: 'sl-add';
|
|
71
|
+
readonly base: SurfaceLevelExpr;
|
|
72
|
+
readonly offset: number;
|
|
73
|
+
} | {
|
|
74
|
+
readonly tag: 'sl-max';
|
|
75
|
+
readonly lhs: SurfaceLevelExpr;
|
|
76
|
+
readonly rhs: SurfaceLevelExpr;
|
|
77
|
+
};
|
|
78
|
+
export interface SurfaceCalcStep {
|
|
79
|
+
readonly rel: '=' | '≃';
|
|
80
|
+
readonly rhs: SurfaceExpr;
|
|
81
|
+
readonly proof: SurfaceExpr;
|
|
82
|
+
readonly span: SourceSpan;
|
|
83
|
+
}
|
|
84
|
+
export type SurfaceTactic = {
|
|
85
|
+
readonly tag: 'st-focus';
|
|
86
|
+
readonly tactics: readonly SurfaceTactic[];
|
|
87
|
+
readonly span: SourceSpan;
|
|
88
|
+
} | {
|
|
89
|
+
readonly tag: 'st-intro';
|
|
90
|
+
readonly names: readonly string[];
|
|
91
|
+
readonly span: SourceSpan;
|
|
92
|
+
} | {
|
|
93
|
+
readonly tag: 'st-ext';
|
|
94
|
+
readonly names: readonly string[];
|
|
95
|
+
readonly span: SourceSpan;
|
|
96
|
+
} | {
|
|
97
|
+
readonly tag: 'st-congr';
|
|
98
|
+
readonly depth?: number;
|
|
99
|
+
readonly span: SourceSpan;
|
|
100
|
+
} | {
|
|
101
|
+
readonly tag: 'st-obtain';
|
|
102
|
+
readonly names: readonly string[];
|
|
103
|
+
readonly ty?: SurfaceExpr;
|
|
104
|
+
readonly expr: SurfaceExpr;
|
|
105
|
+
readonly span: SourceSpan;
|
|
106
|
+
} | {
|
|
107
|
+
readonly tag: 'st-calc';
|
|
108
|
+
readonly start: SurfaceExpr;
|
|
109
|
+
readonly steps: readonly SurfaceCalcStep[];
|
|
110
|
+
readonly span: SourceSpan;
|
|
111
|
+
} | {
|
|
112
|
+
readonly tag: 'st-assumption';
|
|
113
|
+
readonly span: SourceSpan;
|
|
114
|
+
} | {
|
|
115
|
+
readonly tag: 'st-rfl';
|
|
116
|
+
readonly span: SourceSpan;
|
|
117
|
+
} | {
|
|
118
|
+
readonly tag: 'st-symm';
|
|
119
|
+
readonly span: SourceSpan;
|
|
120
|
+
} | {
|
|
121
|
+
readonly tag: 'st-split';
|
|
122
|
+
readonly span: SourceSpan;
|
|
123
|
+
} | {
|
|
124
|
+
readonly tag: 'st-left';
|
|
125
|
+
readonly span: SourceSpan;
|
|
126
|
+
} | {
|
|
127
|
+
readonly tag: 'st-right';
|
|
128
|
+
readonly span: SourceSpan;
|
|
129
|
+
} | {
|
|
130
|
+
readonly tag: 'st-exfalso';
|
|
131
|
+
readonly span: SourceSpan;
|
|
132
|
+
} | {
|
|
133
|
+
readonly tag: 'st-contradiction';
|
|
134
|
+
readonly span: SourceSpan;
|
|
135
|
+
} | {
|
|
136
|
+
readonly tag: 'st-decide';
|
|
137
|
+
readonly span: SourceSpan;
|
|
138
|
+
} | {
|
|
139
|
+
readonly tag: 'st-sorry';
|
|
140
|
+
readonly label?: string;
|
|
141
|
+
readonly span: SourceSpan;
|
|
142
|
+
} | {
|
|
143
|
+
readonly tag: 'st-exact';
|
|
144
|
+
readonly expr: SurfaceExpr;
|
|
145
|
+
readonly span: SourceSpan;
|
|
146
|
+
} | {
|
|
147
|
+
readonly tag: 'st-refine';
|
|
148
|
+
readonly expr: SurfaceExpr;
|
|
149
|
+
readonly span: SourceSpan;
|
|
150
|
+
} | {
|
|
151
|
+
readonly tag: 'st-apply';
|
|
152
|
+
readonly expr: SurfaceExpr;
|
|
153
|
+
readonly span: SourceSpan;
|
|
154
|
+
} | {
|
|
155
|
+
readonly tag: 'st-trans';
|
|
156
|
+
readonly mid: SurfaceExpr;
|
|
157
|
+
readonly span: SourceSpan;
|
|
158
|
+
} | {
|
|
159
|
+
readonly tag: 'st-congrArg';
|
|
160
|
+
readonly fn: SurfaceExpr;
|
|
161
|
+
readonly span: SourceSpan;
|
|
162
|
+
} | {
|
|
163
|
+
readonly tag: 'st-funext';
|
|
164
|
+
readonly names: readonly string[];
|
|
165
|
+
readonly span: SourceSpan;
|
|
166
|
+
} | {
|
|
167
|
+
readonly tag: 'st-injection';
|
|
168
|
+
readonly hyp: string;
|
|
169
|
+
readonly names?: readonly [string, string];
|
|
170
|
+
readonly span: SourceSpan;
|
|
171
|
+
} | {
|
|
172
|
+
readonly tag: 'st-have';
|
|
173
|
+
readonly name: string;
|
|
174
|
+
readonly ty: SurfaceExpr;
|
|
175
|
+
readonly proof: SurfaceExpr;
|
|
176
|
+
readonly span: SourceSpan;
|
|
177
|
+
} | {
|
|
178
|
+
readonly tag: 'st-rw';
|
|
179
|
+
readonly rules: readonly {
|
|
180
|
+
readonly reverse: boolean;
|
|
181
|
+
readonly lemma: SurfaceExpr;
|
|
182
|
+
}[];
|
|
183
|
+
readonly atHyp?: string;
|
|
184
|
+
readonly span: SourceSpan;
|
|
185
|
+
} | {
|
|
186
|
+
readonly tag: 'st-simp';
|
|
187
|
+
readonly only: boolean;
|
|
188
|
+
readonly extraLemmas: readonly SurfaceExpr[];
|
|
189
|
+
readonly atHyp?: string;
|
|
190
|
+
readonly span: SourceSpan;
|
|
191
|
+
} | {
|
|
192
|
+
readonly tag: 'st-cbn';
|
|
193
|
+
readonly mode: 'default' | 'block' | 'only';
|
|
194
|
+
readonly filterNames: readonly string[];
|
|
195
|
+
readonly atHyp?: string;
|
|
196
|
+
readonly span: SourceSpan;
|
|
197
|
+
} | {
|
|
198
|
+
readonly tag: 'st-dsimp';
|
|
199
|
+
readonly only: boolean;
|
|
200
|
+
readonly filterNames: readonly string[];
|
|
201
|
+
readonly atHyp?: string;
|
|
202
|
+
readonly span: SourceSpan;
|
|
203
|
+
} | {
|
|
204
|
+
readonly tag: 'st-unfold';
|
|
205
|
+
readonly names: readonly string[];
|
|
206
|
+
readonly atHyp?: string;
|
|
207
|
+
readonly span: SourceSpan;
|
|
208
|
+
} | {
|
|
209
|
+
readonly tag: 'st-cases';
|
|
210
|
+
readonly scrutinee: SurfaceExpr;
|
|
211
|
+
readonly eqName?: string;
|
|
212
|
+
readonly arms: readonly SurfaceTacticArm[];
|
|
213
|
+
readonly span: SourceSpan;
|
|
214
|
+
} | {
|
|
215
|
+
readonly tag: 'st-induction';
|
|
216
|
+
readonly target: string;
|
|
217
|
+
readonly generalizing: readonly string[];
|
|
218
|
+
readonly arms: readonly SurfaceTacticArm[];
|
|
219
|
+
readonly span: SourceSpan;
|
|
220
|
+
} | {
|
|
221
|
+
readonly tag: 'st-custom';
|
|
222
|
+
readonly name: string;
|
|
223
|
+
readonly args: readonly SurfaceExpr[];
|
|
224
|
+
readonly span: SourceSpan;
|
|
225
|
+
};
|
|
226
|
+
export type SurfaceExpr = {
|
|
227
|
+
readonly tag: 's-ident';
|
|
228
|
+
readonly name: string;
|
|
229
|
+
readonly explicitAll?: boolean;
|
|
230
|
+
readonly span: SourceSpan;
|
|
231
|
+
} | {
|
|
232
|
+
/** Quasiquote interpolation slot (`en\`... ${term} ...\``). */
|
|
233
|
+
readonly tag: 's-splice';
|
|
234
|
+
readonly index: number;
|
|
235
|
+
readonly span: SourceSpan;
|
|
236
|
+
} | {
|
|
237
|
+
readonly tag: 's-hole';
|
|
238
|
+
readonly name?: string;
|
|
239
|
+
readonly span: SourceSpan;
|
|
240
|
+
} | {
|
|
241
|
+
readonly tag: 's-sorry';
|
|
242
|
+
readonly label?: string;
|
|
243
|
+
readonly span: SourceSpan;
|
|
244
|
+
} | {
|
|
245
|
+
readonly tag: 's-nat-lit';
|
|
246
|
+
readonly value: number;
|
|
247
|
+
readonly span: SourceSpan;
|
|
248
|
+
} | {
|
|
249
|
+
readonly tag: 's-bool-lit';
|
|
250
|
+
readonly value: boolean;
|
|
251
|
+
readonly span: SourceSpan;
|
|
252
|
+
} | {
|
|
253
|
+
readonly tag: 's-unit-lit';
|
|
254
|
+
readonly span: SourceSpan;
|
|
255
|
+
} | {
|
|
256
|
+
readonly tag: 's-list-lit';
|
|
257
|
+
readonly elems: readonly SurfaceExpr[];
|
|
258
|
+
readonly span: SourceSpan;
|
|
259
|
+
} | {
|
|
260
|
+
readonly tag: 's-universe';
|
|
261
|
+
readonly kind: 'Type' | 'Grpd' | 'StrictCat' | 'GrayCat';
|
|
262
|
+
readonly level: number;
|
|
263
|
+
readonly levelExpr?: SurfaceLevelExpr;
|
|
264
|
+
readonly span: SourceSpan;
|
|
265
|
+
} | {
|
|
266
|
+
readonly tag: 's-pi';
|
|
267
|
+
readonly binders: readonly SurfaceBinder[];
|
|
268
|
+
readonly body: SurfaceExpr;
|
|
269
|
+
readonly span: SourceSpan;
|
|
270
|
+
} | {
|
|
271
|
+
readonly tag: 's-arrow';
|
|
272
|
+
readonly lhs: SurfaceExpr;
|
|
273
|
+
readonly rhs: SurfaceExpr;
|
|
274
|
+
readonly span: SourceSpan;
|
|
275
|
+
} | {
|
|
276
|
+
readonly tag: 's-lam';
|
|
277
|
+
readonly binders: readonly SurfaceBinder[];
|
|
278
|
+
readonly body: SurfaceExpr;
|
|
279
|
+
readonly span: SourceSpan;
|
|
280
|
+
} | {
|
|
281
|
+
/**
|
|
282
|
+
* Bunched functorial abstraction `fun^f (x : A, y : B; z : C) => body`
|
|
283
|
+
* (`,` = Cartesian `Cart` bunch; `;` = ordered Gray/dependent stage).
|
|
284
|
+
*/
|
|
285
|
+
readonly tag: 's-fun-lam';
|
|
286
|
+
readonly stages: readonly (readonly SurfaceBinder[])[];
|
|
287
|
+
readonly codCat?: SurfaceExpr;
|
|
288
|
+
readonly body: SurfaceExpr;
|
|
289
|
+
readonly span: SourceSpan;
|
|
290
|
+
} | {
|
|
291
|
+
readonly tag: 's-sigma';
|
|
292
|
+
readonly pol?: '+' | '-';
|
|
293
|
+
readonly binders: readonly SurfaceBinder[];
|
|
294
|
+
readonly body: SurfaceExpr;
|
|
295
|
+
readonly span: SourceSpan;
|
|
296
|
+
} | {
|
|
297
|
+
readonly tag: 's-app';
|
|
298
|
+
readonly fn: SurfaceExpr;
|
|
299
|
+
readonly args: readonly SurfaceArg[];
|
|
300
|
+
readonly span: SourceSpan;
|
|
301
|
+
} | {
|
|
302
|
+
readonly tag: 's-infix';
|
|
303
|
+
readonly op: string;
|
|
304
|
+
readonly lhs: SurfaceExpr;
|
|
305
|
+
readonly rhs: SurfaceExpr;
|
|
306
|
+
readonly span: SourceSpan;
|
|
307
|
+
} | {
|
|
308
|
+
readonly tag: 's-prefix';
|
|
309
|
+
readonly op: string;
|
|
310
|
+
readonly arg: SurfaceExpr;
|
|
311
|
+
readonly span: SourceSpan;
|
|
312
|
+
} | {
|
|
313
|
+
readonly tag: 's-proj';
|
|
314
|
+
readonly target: SurfaceExpr;
|
|
315
|
+
readonly field: string;
|
|
316
|
+
readonly span: SourceSpan;
|
|
317
|
+
} | {
|
|
318
|
+
/** Anonymous constructor `⟨a, b, ...⟩` or tuple `(a, b, ...)`. */
|
|
319
|
+
readonly tag: 's-tuple';
|
|
320
|
+
readonly kind: 'angle' | 'paren';
|
|
321
|
+
readonly items: readonly SurfaceExpr[];
|
|
322
|
+
readonly span: SourceSpan;
|
|
323
|
+
} | {
|
|
324
|
+
readonly tag: 's-let';
|
|
325
|
+
readonly name: string;
|
|
326
|
+
readonly ty?: SurfaceExpr;
|
|
327
|
+
readonly val: SurfaceExpr;
|
|
328
|
+
readonly body: SurfaceExpr;
|
|
329
|
+
readonly span: SourceSpan;
|
|
330
|
+
} | {
|
|
331
|
+
readonly tag: 's-let-pat';
|
|
332
|
+
readonly names: readonly string[];
|
|
333
|
+
readonly ty?: SurfaceExpr;
|
|
334
|
+
readonly val: SurfaceExpr;
|
|
335
|
+
readonly body: SurfaceExpr;
|
|
336
|
+
readonly span: SourceSpan;
|
|
337
|
+
} | {
|
|
338
|
+
readonly tag: 's-calc';
|
|
339
|
+
readonly start: SurfaceExpr;
|
|
340
|
+
readonly steps: readonly SurfaceCalcStep[];
|
|
341
|
+
readonly span: SourceSpan;
|
|
342
|
+
} | {
|
|
343
|
+
readonly tag: 's-if';
|
|
344
|
+
readonly cond: SurfaceExpr;
|
|
345
|
+
readonly thenBr: SurfaceExpr;
|
|
346
|
+
readonly elseBr: SurfaceExpr;
|
|
347
|
+
readonly span: SourceSpan;
|
|
348
|
+
} | {
|
|
349
|
+
readonly tag: 's-ann';
|
|
350
|
+
readonly expr: SurfaceExpr;
|
|
351
|
+
readonly ty: SurfaceExpr;
|
|
352
|
+
readonly span: SourceSpan;
|
|
353
|
+
} | {
|
|
354
|
+
readonly tag: 's-match';
|
|
355
|
+
readonly scrutinees: readonly SurfaceExpr[];
|
|
356
|
+
readonly returnTy?: SurfaceExpr;
|
|
357
|
+
readonly arms: readonly SurfaceMatchArm[];
|
|
358
|
+
readonly span: SourceSpan;
|
|
359
|
+
} | {
|
|
360
|
+
readonly tag: 's-by';
|
|
361
|
+
readonly tactics: readonly SurfaceTactic[];
|
|
362
|
+
readonly span: SourceSpan;
|
|
363
|
+
} | {
|
|
364
|
+
/** Categorical Hom `a ->[C] b` or `a ~> b`. */
|
|
365
|
+
readonly tag: 's-hom';
|
|
366
|
+
readonly cat?: SurfaceExpr;
|
|
367
|
+
readonly src: SurfaceExpr;
|
|
368
|
+
readonly dst: SurfaceExpr;
|
|
369
|
+
readonly span: SourceSpan;
|
|
370
|
+
};
|
|
371
|
+
export type SurfaceAttr = {
|
|
372
|
+
readonly kind: 'simp';
|
|
373
|
+
readonly priority?: number;
|
|
374
|
+
readonly span: SourceSpan;
|
|
375
|
+
} | {
|
|
376
|
+
readonly kind: 'instance';
|
|
377
|
+
readonly priority?: number;
|
|
378
|
+
readonly span: SourceSpan;
|
|
379
|
+
} | {
|
|
380
|
+
readonly kind: 'transparency';
|
|
381
|
+
readonly mode: 'reducible' | 'semireducible' | 'simpl_nomatch' | 'irreducible';
|
|
382
|
+
readonly span: SourceSpan;
|
|
383
|
+
} | {
|
|
384
|
+
readonly kind: 'xref';
|
|
385
|
+
readonly namespace: 'tag' | 'book' | 'ha' | 'ega' | 'sga' | 'weil' | 'rh' | 'kerodon' | 'stacks' | 'cisinski' | 'mathlib' | 'symmetry' | 'vol0' | 'vol1' | 'vol2';
|
|
386
|
+
readonly code: string;
|
|
387
|
+
readonly title?: string;
|
|
388
|
+
readonly span: SourceSpan;
|
|
389
|
+
};
|
|
390
|
+
export type SurfaceFixity = 'infixl' | 'infixr' | 'infix' | 'prefix';
|
|
391
|
+
export interface OperatorSpec {
|
|
392
|
+
readonly symbol: string;
|
|
393
|
+
readonly fixity: SurfaceFixity;
|
|
394
|
+
readonly precedence: number;
|
|
395
|
+
readonly targetName: string;
|
|
396
|
+
}
|
|
397
|
+
export type SurfaceCommand = {
|
|
398
|
+
readonly tag: 'sc-universe';
|
|
399
|
+
readonly names: readonly string[];
|
|
400
|
+
readonly span: SourceSpan;
|
|
401
|
+
} | {
|
|
402
|
+
readonly tag: 'sc-import';
|
|
403
|
+
readonly modules: readonly string[];
|
|
404
|
+
readonly span: SourceSpan;
|
|
405
|
+
} | {
|
|
406
|
+
readonly tag: 'sc-namespace';
|
|
407
|
+
readonly name: string;
|
|
408
|
+
readonly commands: readonly SurfaceCommand[];
|
|
409
|
+
readonly span: SourceSpan;
|
|
410
|
+
} | {
|
|
411
|
+
readonly tag: 'sc-section';
|
|
412
|
+
readonly name?: string;
|
|
413
|
+
readonly commands: readonly SurfaceCommand[];
|
|
414
|
+
readonly span: SourceSpan;
|
|
415
|
+
} | {
|
|
416
|
+
readonly tag: 'sc-open';
|
|
417
|
+
readonly namespaces: readonly string[];
|
|
418
|
+
readonly span: SourceSpan;
|
|
419
|
+
} | {
|
|
420
|
+
readonly tag: 'sc-def';
|
|
421
|
+
readonly attrs: readonly SurfaceAttr[];
|
|
422
|
+
readonly isAbbrev: boolean;
|
|
423
|
+
readonly name: string;
|
|
424
|
+
readonly binders: readonly SurfaceBinder[];
|
|
425
|
+
readonly ty?: SurfaceExpr;
|
|
426
|
+
readonly body: SurfaceExpr;
|
|
427
|
+
readonly span: SourceSpan;
|
|
428
|
+
} | {
|
|
429
|
+
readonly tag: 'sc-theorem';
|
|
430
|
+
readonly attrs: readonly SurfaceAttr[];
|
|
431
|
+
readonly name: string;
|
|
432
|
+
readonly binders: readonly SurfaceBinder[];
|
|
433
|
+
readonly ty: SurfaceExpr;
|
|
434
|
+
readonly proof: SurfaceExpr;
|
|
435
|
+
readonly span: SourceSpan;
|
|
436
|
+
} | {
|
|
437
|
+
readonly tag: 'sc-axiom';
|
|
438
|
+
readonly name: string;
|
|
439
|
+
readonly binders: readonly SurfaceBinder[];
|
|
440
|
+
readonly ty: SurfaceExpr;
|
|
441
|
+
readonly span: SourceSpan;
|
|
442
|
+
} | {
|
|
443
|
+
readonly tag: 'sc-structure';
|
|
444
|
+
readonly attrs?: readonly SurfaceAttr[];
|
|
445
|
+
readonly isClass: boolean;
|
|
446
|
+
readonly name: string;
|
|
447
|
+
readonly params: readonly SurfaceBinder[];
|
|
448
|
+
readonly parents: readonly SurfaceExpr[];
|
|
449
|
+
readonly fields: readonly {
|
|
450
|
+
readonly name: string;
|
|
451
|
+
readonly ty: SurfaceExpr;
|
|
452
|
+
readonly span: SourceSpan;
|
|
453
|
+
}[];
|
|
454
|
+
readonly span: SourceSpan;
|
|
455
|
+
} | {
|
|
456
|
+
readonly tag: 'sc-instance';
|
|
457
|
+
readonly attrs?: readonly SurfaceAttr[];
|
|
458
|
+
readonly name?: string;
|
|
459
|
+
readonly priority?: number;
|
|
460
|
+
readonly binders: readonly SurfaceBinder[];
|
|
461
|
+
readonly targetTy: SurfaceExpr;
|
|
462
|
+
readonly fields?: readonly {
|
|
463
|
+
readonly name: string;
|
|
464
|
+
readonly val: SurfaceExpr;
|
|
465
|
+
readonly span: SourceSpan;
|
|
466
|
+
}[];
|
|
467
|
+
readonly directBody?: SurfaceExpr;
|
|
468
|
+
readonly span: SourceSpan;
|
|
469
|
+
} | {
|
|
470
|
+
readonly tag: 'sc-notation';
|
|
471
|
+
readonly spec: OperatorSpec;
|
|
472
|
+
readonly span: SourceSpan;
|
|
473
|
+
} | {
|
|
474
|
+
readonly tag: 'sc-check';
|
|
475
|
+
readonly expr: SurfaceExpr;
|
|
476
|
+
readonly span: SourceSpan;
|
|
477
|
+
} | {
|
|
478
|
+
readonly tag: 'sc-eval';
|
|
479
|
+
readonly expr: SurfaceExpr;
|
|
480
|
+
readonly span: SourceSpan;
|
|
481
|
+
} | {
|
|
482
|
+
readonly tag: 'sc-probe';
|
|
483
|
+
readonly mode: 'default' | 'block' | 'only';
|
|
484
|
+
readonly filterNames: readonly string[];
|
|
485
|
+
readonly expr: SurfaceExpr;
|
|
486
|
+
readonly span: SourceSpan;
|
|
487
|
+
} | {
|
|
488
|
+
readonly tag: 'sc-print-axioms';
|
|
489
|
+
readonly name: string;
|
|
490
|
+
readonly span: SourceSpan;
|
|
491
|
+
} | {
|
|
492
|
+
readonly tag: 'sc-tags';
|
|
493
|
+
readonly filter?: string;
|
|
494
|
+
readonly strictCode?: string;
|
|
495
|
+
readonly span: SourceSpan;
|
|
496
|
+
};
|
|
497
|
+
export interface SurfaceModule {
|
|
498
|
+
readonly file: string;
|
|
499
|
+
readonly commands: readonly SurfaceCommand[];
|
|
500
|
+
readonly span: SourceSpan;
|
|
501
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical MLTT Equivalence, Truncation, and Categorical Discreteness Types
|
|
3
|
+
* shared between `WalkingIsOneCat` typing/evaluation and `src/stdlib/equiv.ts`.
|
|
4
|
+
*
|
|
5
|
+
* Notice that NONE of `IsEquivMap`, `TypeEquiv`, `IsSetGrpd`, `IsDiscreteCat`, or
|
|
6
|
+
* `IsNCat` requires a special kernel type former: all five are pure `SigmaGrpd` /
|
|
7
|
+
* `PiGrpd` / `EqGrpd` / `Nat` definitions!
|
|
8
|
+
*/
|
|
9
|
+
import { VCat, VFun, VGrpd, Value } from './value';
|
|
10
|
+
/**
|
|
11
|
+
* `IsEquivMap(A, B, f)` :=
|
|
12
|
+
* `Sigma (g : B -> A), (Pi (x : A), g(f(x)) =_A x) x (Pi (y : B), f(g(y)) =_B y)`
|
|
13
|
+
*/
|
|
14
|
+
export declare function isEquivMapSemanticType(A: VGrpd, B: VGrpd, f: Value): VGrpd;
|
|
15
|
+
/** `TypeEquiv(A, B)` := `Sigma (f : A -> B), IsEquivMap(A, B, f)` */
|
|
16
|
+
export declare function typeEquivSemanticType(A: VGrpd, B: VGrpd): VGrpd;
|
|
17
|
+
/** `IsSetGrpd(A)` := `Pi (x y : A) (p q : x =_A y), p =_{x=y} q` */
|
|
18
|
+
export declare function isSetGrpdSemanticType(A: VGrpd): VGrpd;
|
|
19
|
+
/** `IsGroupoidGrpd(A)` := `Pi (x y : A), IsSetGrpd(x =_A y)` (HoTT 1-type truncation) */
|
|
20
|
+
export declare function isGroupoidGrpdSemanticType(A: VGrpd): VGrpd;
|
|
21
|
+
/**
|
|
22
|
+
* `IsGroupoidalCat1(C)` :=
|
|
23
|
+
* `Pi (x y : Obj C), IsEquivMap(x =_{Obj C} y, Obj(Hom_C(x, y)), p |-> Core_incl(C)[p])`
|
|
24
|
+
*/
|
|
25
|
+
export declare function isGroupoidalCatSemanticType(C: VCat): VGrpd;
|
|
26
|
+
/** `IsDiscreteCat(C)` := `IsSetGrpd(Obj C) x IsGroupoidalCat1(C)` */
|
|
27
|
+
export declare function isDiscreteCatSemanticType(C: VCat): VGrpd;
|
|
28
|
+
/**
|
|
29
|
+
* `IsNCat(n, C)` defined recursively on `n`:
|
|
30
|
+
* `IsNCat(0, C) = IsDiscreteCat(C)`
|
|
31
|
+
* `IsNCat(n+1, C) = Pi (x y : Obj C), IsNCat(n, Hom_C(x, y))`
|
|
32
|
+
*/
|
|
33
|
+
export declare function isNCatSemanticType(n: number, C: VCat): VGrpd;
|
|
34
|
+
/** Extract `hom_to_path : Obj(Hom_C(x, y)) -> (x =_{Obj C} y)` from `disc : IsDiscreteCat(C)`. */
|
|
35
|
+
export declare function extractHomToPathVal(C: VCat, disc: Value, x: Value, y: Value, alpha: Value): Value;
|
|
36
|
+
export declare function mkWalkingIsOneCatVal(walkingEndCat: VCat): Value;
|
|
37
|
+
export declare function mkWalkingArrowIsOneCatVal(walkingArrowCat: VCat): Value;
|
|
38
|
+
/** `IsPropGrpd(P)` := `Pi (p : P) (q : P), p =_P q`. */
|
|
39
|
+
export declare function isPropGrpdSemanticType(P: VGrpd): VGrpd;
|
|
40
|
+
/**
|
|
41
|
+
* `Sieve(K, U)` :=
|
|
42
|
+
* `Sigma (R0 : Pi (V : Obj K), Hom_K(V, U) -> Grpd 0),`
|
|
43
|
+
* ` (Pi (V : Obj K) (f : Hom_K(V, U)), IsPropGrpd(R0 V f)) x`
|
|
44
|
+
* ` (Pi (V W : Obj K) (f : Hom_K(V, U)) (g : Hom_K(W, V)), R0 V f -> R0 W (f o_K g))`
|
|
45
|
+
*/
|
|
46
|
+
export declare function sieveSemanticType(site: VCat, U: Value): VGrpd;
|
|
47
|
+
/** Pullback sieve `p^* R : Sieve(K, V)` along `p : Hom_K(V, U0)` (`(id_U)^* R ≡ R` by `refl`!). */
|
|
48
|
+
export declare function pullbackSieveVal(site: VCat, U0: Value, V: Value, p: Value, R: Value): Value;
|
|
49
|
+
/**
|
|
50
|
+
* `SiteCovData(K)` :=
|
|
51
|
+
* `Sigma (isCov : Pi (U : Obj K), Sieve(K, U) -> Grpd 0),`
|
|
52
|
+
* ` Pi (U V : Obj K) (p : Hom_K(V, U)) (R : Sieve(K, U)), isCov U R -> isCov V (p^* R)`
|
|
53
|
+
*/
|
|
54
|
+
export declare function siteCovDataSemanticType(site: VCat): VGrpd;
|
|
55
|
+
export declare function evalIsCovAt(site: VCat, covVal: Value, U: Value, R: Value): VGrpd;
|
|
56
|
+
export declare function evalPullbackCovProof(site: VCat, covVal: Value, U0: Value, V: Value, p: Value, R: Value, c: Value): Value;
|
|
57
|
+
export declare function evalPshRestr(F: VFun, U: Value, V: Value, f: Value, x: Value): Value;
|
|
58
|
+
/** `Match_F(U, R)` for `F : Functor(Op(K), GrpdCat(0))` and `R : Sieve(K, U)`. */
|
|
59
|
+
export declare function pshMatchingSemanticType(site: VCat, F: VFun, U: Value, R: Value): VGrpd;
|
|
60
|
+
/** Canonical matching family `ρ_{F, U, R}(s) : Match_F(U, R)` induced by `s : F[U]`. */
|
|
61
|
+
export declare function pshToMatchVal(site: VCat, F: VFun, U: Value, R: Value, s: Value): Value;
|
|
62
|
+
/** Pullback matching family `p^* m : Match_F(V, p^* R)` along `p : Hom_K(V, U0)`. */
|
|
63
|
+
export declare function pullbackMatchVal(site: VCat, U0: Value, V: Value, p: Value, R: Value, m: Value): Value;
|
|
64
|
+
/** Yoneda-reindexed restriction `(a_J P)[q](s) : (a_J P)[V]` along `q : Hom_K(V, U)`. */
|
|
65
|
+
export declare function sheafRestrVal(site: VCat, covVal: Value, pshFun: VFun, U: Value, V: Value, q: Value, rawS: Value): Value;
|
|
66
|
+
/** Presheaf functor `sheafifyFunVal(K, cov, P) : Functor(Op(K), GrpdCat(0))`. */
|
|
67
|
+
export declare function sheafifyFunVal(site: VCat, covVal: Value, pshFun: VFun): VFun;
|
|
68
|
+
/** Pointwise binary product presheaf `(P × Q)[U] ≡ P[U] × Q[U]` in `Functor(Op(site), GrpdCat(0))`. */
|
|
69
|
+
export declare function pshProdFunVal(site: VCat, fstPsh: VFun, sndPsh: VFun): VFun;
|
|
70
|
+
/**
|
|
71
|
+
* Yoneda-reindexed internal exponential presheaf `Y^X : Functor(Op(site), GrpdCat(0))`:
|
|
72
|
+
* `(Y^X)[U] ≡ Σ (m0 : Π V : Obj site, Hom_site(V, U) -> X[V] -> Y[V]), NatLaw(m0)`
|
|
73
|
+
* whose restriction along `p : Hom_site(U1, U)` precomposes `f1 ↦ p ∘_site f1` (`refl` functoriality!).
|
|
74
|
+
*/
|
|
75
|
+
export declare function pshExpFunVal(site: VCat, domPsh: VFun, codPsh: VFun): VFun;
|
|
76
|
+
export declare function mkSheafGlueVal(site: VCat, covVal: Value, pshFun: VFun, baseObj: Value, targetObj: Value, reindex: Value, sieve: Value, covProof: Value, match: Value): Value;
|
|
77
|
+
export declare function sheafPullbackTypeAndVal(site: VCat, covVal: Value, pshFun: VFun, baseObj: Value, targetObj: Value, reindex: Value, sieve: Value, covProof: Value, match: Value): {
|
|
78
|
+
readonly ty: VGrpd;
|
|
79
|
+
readonly val: Value;
|
|
80
|
+
};
|
|
81
|
+
export declare function sheafSilentTypeAndVal(site: VCat, covVal: Value, pshFun: VFun, obj: Value, sieve: Value, covProof: Value, sec: Value): {
|
|
82
|
+
readonly ty: VGrpd;
|
|
83
|
+
readonly val: Value;
|
|
84
|
+
};
|
|
85
|
+
/** `IsSetPsh(K, Y)` := `Pi (U : Obj K), IsSetGrpd(Y[U])`. */
|
|
86
|
+
export declare function isSetPshSemanticType(site: VCat, Y: VFun): VGrpd;
|
|
87
|
+
/** `IsSheaf(K, cov, Y)` := `Pi (U : Obj K) (R : Sieve(K, U)), isCov(U, R) -> IsEquivMap(Y[U], Match_Y(U, R), rho)`. */
|
|
88
|
+
export declare function isSheafSemanticType(site: VCat, covVal: Value, Y: VFun): VGrpd;
|
|
89
|
+
/**
|
|
90
|
+
* `PshHom(K, F, G)` :=
|
|
91
|
+
* `Sigma (map : Pi (U : Obj K), F[U] -> G[U]),`
|
|
92
|
+
* ` Pi (U V : Obj K) (f : Hom_K(V, U)) (x : F[U]), G[f](map U x) =_{G[V]} map V (F[f](x))`
|
|
93
|
+
*/
|
|
94
|
+
export declare function pshHomSemanticType(site: VCat, F: VFun, G: VFun): VGrpd;
|
|
95
|
+
export declare function sheafRecTypeAndVal(site: VCat, covVal: Value, pshFun: VFun, targetPshFun: VFun, targetIsSet: Value, targetIsSheaf: Value, baseHom: Value): {
|
|
96
|
+
readonly ty: VGrpd;
|
|
97
|
+
readonly val: Value;
|
|
98
|
+
};
|
|
99
|
+
export declare function groupoidifyRecBetaTypeAndVal(cat: VCat, targetGrpd: VGrpd, fun: VFun, src: Value, dst: Value, arrow: Value): {
|
|
100
|
+
readonly ty: VGrpd;
|
|
101
|
+
readonly val: Value;
|
|
102
|
+
};
|
|
103
|
+
export declare function groupoidifyHomotopySignature(cat: VCat, targetGrpd: VGrpd, lhsMap: Value, rhsMap: Value, ptEqVal?: Value): {
|
|
104
|
+
readonly grpC: VGrpd;
|
|
105
|
+
readonly is1GrpdTy: VGrpd;
|
|
106
|
+
readonly mapTy: VGrpd;
|
|
107
|
+
readonly ptEqTy: VGrpd;
|
|
108
|
+
readonly mkEdgeNatTy: (ptEq: Value) => VGrpd;
|
|
109
|
+
};
|
|
110
|
+
export declare function groupoidifyHomotopyTypeAndVal(cat: VCat, targetGrpd: VGrpd, targetIs1Grpd: Value, lhsMap: Value, rhsMap: Value, ptEq: Value, edgeNat: Value, rawScrutinee: Value): {
|
|
111
|
+
readonly ty: VGrpd;
|
|
112
|
+
readonly val: Value;
|
|
113
|
+
};
|