@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.
- package/LICENSE +23 -0
- 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 -0
- package/index.d.ts +20 -0
- package/index.mjs +704 -0
- package/node.cjs +116606 -0
- package/node.d.ts +8 -0
- package/node.mjs +53 -0
- package/package.json +69 -4
- 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,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase G5 Typed CAS (Geometry & Cohomology): Exact Ring/Module Localization `R[f^-1]`,
|
|
3
|
+
* Varying-Ring Simplicial Čech Cochain Engine (`d^{p+1} o d^p = 0`), & LCF-Certified
|
|
4
|
+
* Twisting-Sheaf Cohomology `H^i(P^1_k, O(n))` with Serre Duality & Riemann–Roch
|
|
5
|
+
* (`endash/src/cas/localization_cech.ts`).
|
|
6
|
+
*
|
|
7
|
+
* Strict Isolation & Soundness Discipline:
|
|
8
|
+
* - 0 external npm runtime dependencies; 0 floating-point operations.
|
|
9
|
+
* - Lives 100% outside the trusted `endash` kernel (`0 LOC` TCB delta!).
|
|
10
|
+
* - Every twisting-sheaf cohomology computation reifies its SNF witness into the
|
|
11
|
+
* trusted `endash` kernel (`declareTheorem` / `checkTerm`, `axiomsUsed === 0`),
|
|
12
|
+
* deterministically rejecting any non-unit specialization or tampered certificate (`NC-11b`)!
|
|
13
|
+
*/
|
|
14
|
+
import { FreeKernelCertificate, SnfCertificate } from './hnf_snf';
|
|
15
|
+
import { DenseMatrix } from './matrix';
|
|
16
|
+
import { ReifyRingSpec, VerifiedSnfProofBundle, certifySnfInKernel } from './reify_proofs';
|
|
17
|
+
import { BigRat, ExactField, ExactRing } from './rings';
|
|
18
|
+
/** Canonical formal fraction `num / denom^exp` (`exp >= 0`) in `R[denom^-1]`. */
|
|
19
|
+
export interface LocFrac<T> {
|
|
20
|
+
readonly num: T;
|
|
21
|
+
readonly exp: number;
|
|
22
|
+
}
|
|
23
|
+
export interface LocalizedRing<T> extends ExactRing<LocFrac<T>> {
|
|
24
|
+
readonly baseRing: ExactRing<T>;
|
|
25
|
+
readonly denom: T;
|
|
26
|
+
readonly isDegenerateZero: boolean;
|
|
27
|
+
/** Canonical localization map `iota_f : R -> R[f^-1]`, `r |-> r / f^0`. */
|
|
28
|
+
embed(r: T): LocFrac<T>;
|
|
29
|
+
/** Canonical inverse `f^-1 = 1 / f^1` satisfying `embed(denom) * invGen = 1`. */
|
|
30
|
+
readonly invGen: LocFrac<T>;
|
|
31
|
+
/** Construct `num / denom^exp` (`exp >= 0`). */
|
|
32
|
+
frac(num: T, exp: number): LocFrac<T>;
|
|
33
|
+
/** Exact power `denom^k` in `baseRing` (`k >= 0`). */
|
|
34
|
+
denomPow(k: number): T;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Construct the exact localized commutative domain/ring `R[f^-1]` over `baseRing`
|
|
38
|
+
* (assumed cancellation/torsion-free for `f != 0`, e.g. `Z`, `K[x]`, `K[x_1, ..., x_n]`;
|
|
39
|
+
* if `f == 0`, `R[0^-1]` collapses to the degenerate zero ring matching `D(0)`!).
|
|
40
|
+
*/
|
|
41
|
+
export declare function mkLocalizedRing<T>(baseRing: ExactRing<T>, denom: T, exactDivFn?: (a: T, b: T) => T | null): LocalizedRing<T>;
|
|
42
|
+
/**
|
|
43
|
+
* Universal Property of Localization (`LocUniv`, Chapter 22 & 24):
|
|
44
|
+
* Given a ring homomorphism `phi : R -> S` and a candidate inverse `invWitness` for `phi(f)`,
|
|
45
|
+
* verifies `phi(f) * invWitness == 1_S` and `invWitness * phi(f) == 1_S` (**throwing
|
|
46
|
+
* `EndashCasError('NON_UNIT', ...)` on non-units — `NC-11b` Part 2!**), and returns the
|
|
47
|
+
* unique ring homomorphism `phiBar : R[f^-1] -> S` with `phiBar o iota_f = phi`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function liftLocalizedHom<T, S>(locRing: LocalizedRing<T>, targetRing: ExactRing<S>, phi: (r: T) => S, invWitness: S): (x: LocFrac<T>) => S;
|
|
50
|
+
export type SimplexBit = 'skip' | 'keep';
|
|
51
|
+
export interface CechPatch<T> {
|
|
52
|
+
/** Strictly increasing indices `(i_0 < ... < i_p)` in `{0, ..., m - 1}`. */
|
|
53
|
+
readonly indices: readonly number[];
|
|
54
|
+
/** Key `"i_0,...,i_p"`. */
|
|
55
|
+
readonly key: string;
|
|
56
|
+
/** Exact `SimplexFaceCode(p + 1, m)` word (`'keep'` at `i in indices`, `'skip'` otherwise). */
|
|
57
|
+
readonly faceCodeWord: readonly SimplexBit[];
|
|
58
|
+
/** Overlap denominator `f_{i_0} * ... * f_{i_p}`. */
|
|
59
|
+
readonly denom: T;
|
|
60
|
+
/** Localized coordinate ring `R[(f_{i_0} * ... * f_{i_p})^-1]`. */
|
|
61
|
+
readonly ring: LocalizedRing<T>;
|
|
62
|
+
}
|
|
63
|
+
export interface CechCochain<T> {
|
|
64
|
+
readonly degree: number;
|
|
65
|
+
/** Component in `patch.ring` keyed by `patch.key`. */
|
|
66
|
+
readonly values: Readonly<Record<string, LocFrac<T>>>;
|
|
67
|
+
}
|
|
68
|
+
export interface SimplicialCancellationPair<T> {
|
|
69
|
+
/** Target `(p + 3)`-tuple key `K = (k_0 < ... < k_{p+2})`. */
|
|
70
|
+
readonly targetSimplexKey: string;
|
|
71
|
+
/** Source `(p + 1)`-tuple key `K_{hat a, b}` reached by omitting both `a` and `b`. */
|
|
72
|
+
readonly sourceSimplexKey: string;
|
|
73
|
+
/** Simplicial omission positions `0 <= a < b <= p + 2` (`delta_b o delta_a = delta_a o delta_{b-1}`). */
|
|
74
|
+
readonly a: number;
|
|
75
|
+
readonly b: number;
|
|
76
|
+
readonly signFirstBThenA: 1 | -1;
|
|
77
|
+
readonly signFirstAThenBMinus1: 1 | -1;
|
|
78
|
+
readonly termFirstBThenA: LocFrac<T>;
|
|
79
|
+
readonly termFirstAThenBMinus1: LocFrac<T>;
|
|
80
|
+
readonly cancelsToZero: boolean;
|
|
81
|
+
}
|
|
82
|
+
export interface CechDSquaredVerification<T> {
|
|
83
|
+
readonly degree: number;
|
|
84
|
+
readonly dCochain: CechCochain<T>;
|
|
85
|
+
readonly ddCochain: CechCochain<T>;
|
|
86
|
+
readonly isAllZero: boolean;
|
|
87
|
+
readonly cancellationPairs: readonly SimplicialCancellationPair<T>[];
|
|
88
|
+
}
|
|
89
|
+
export interface AffineCechComplex<T> {
|
|
90
|
+
readonly baseRing: ExactRing<T>;
|
|
91
|
+
readonly coverGens: readonly T[];
|
|
92
|
+
readonly numOpens: number;
|
|
93
|
+
patchesAtDegree(p: number): readonly CechPatch<T>[];
|
|
94
|
+
patchByKey(key: string): CechPatch<T>;
|
|
95
|
+
/** Restriction homomorphism `rho^{I}_{J} : R_I -> R_J` when `I` is a subset of `J`. */
|
|
96
|
+
restrict(fromKey: string, toKey: string, val: LocFrac<T>): LocFrac<T>;
|
|
97
|
+
zeroCochain(p: number): CechCochain<T>;
|
|
98
|
+
cochainEq(a: CechCochain<T>, b: CechCochain<T>): boolean;
|
|
99
|
+
isZeroCochain(c: CechCochain<T>): boolean;
|
|
100
|
+
/** Alternating simplicial Čech coboundary `d^p : C^p(U, O) -> C^{p+1}(U, O)`. */
|
|
101
|
+
coboundary(p: number, c: CechCochain<T>): CechCochain<T>;
|
|
102
|
+
}
|
|
103
|
+
export declare function mkAffineCechComplex<T>(baseRing: ExactRing<T>, coverGens: readonly T[], exactDivFn?: (a: T, b: T) => T | null): AffineCechComplex<T>;
|
|
104
|
+
/**
|
|
105
|
+
* Evaluate `d^{p+1}(d^p c)` AND record every simplicial repeated-face cancellation pair
|
|
106
|
+
* `(a < b)` (`delta_b o delta_a = delta_a o delta_{b-1}` with opposite signs `(-1)^{a+b}` vs `-(-1)^{a+b}`)!
|
|
107
|
+
*/
|
|
108
|
+
export declare function verifyCechDSquaredZero<T>(complex: AffineCechComplex<T>, p: number, cochain: CechCochain<T>): CechDSquaredVerification<T>;
|
|
109
|
+
/**
|
|
110
|
+
* Verify that `c0` is a genuine Čech 0-cocycle (`d^0 c0 == 0` on every pairwise overlap `U_i cap U_j`),
|
|
111
|
+
* throwing `EndashCasError('NOT_EXACT_AT_DEGREE', ...)` if any overlap disagrees (`NC-11b` Part 2!).
|
|
112
|
+
*/
|
|
113
|
+
export declare function checkCechZeroCocycle<T>(complex: AffineCechComplex<T>, c0: CechCochain<T>): CechCochain<T>;
|
|
114
|
+
/**
|
|
115
|
+
* Affine Sheaf Gluing via Partition of Unity (`sum_i u_i * f_i = 1_R`, e.g. `x + (1 - x) = 1`):
|
|
116
|
+
* For any verified 0-cocycle `c0 = (r_i / f_i^{e_i})`, raises the partition of unity to an
|
|
117
|
+
* exponent `sum_i g_i * f_i^E = 1_R` (`E >= max_i e_i`), reconstructs the unique global section
|
|
118
|
+
* `s = sum_i g_i * r_i * f_i^{E - e_i} in R`, and verifies `iota_i(s) == c0_i` on every open `D(f_i)`!
|
|
119
|
+
*/
|
|
120
|
+
export declare function glueAffineZeroCocycleWithPartition<T>(complex: AffineCechComplex<T>, c0: CechCochain<T>, partitionCoeffs: readonly T[]): T;
|
|
121
|
+
export interface P1TwistingCechMatrix<K> {
|
|
122
|
+
readonly twist: number;
|
|
123
|
+
readonly minLaurentExp: number;
|
|
124
|
+
readonly maxLaurentExp: number;
|
|
125
|
+
readonly degChart0: number;
|
|
126
|
+
readonly degChart1: number;
|
|
127
|
+
/** Laurent exponents `[E_min, ..., E_max]` indexing rows of `d0Matrix`. */
|
|
128
|
+
readonly rowLaurentExponents: readonly number[];
|
|
129
|
+
/** Column labels `['t^0', ..., 't^{d0}', 'u^0', ..., 'u^{d1}']`. */
|
|
130
|
+
readonly colBasisLabels: readonly string[];
|
|
131
|
+
/** Exact Čech coboundary `d^0_n(p_0(t), p_1(u)) = t^n * p_1(t^-1) - p_0(t)`. */
|
|
132
|
+
readonly d0Matrix: DenseMatrix<K>;
|
|
133
|
+
}
|
|
134
|
+
export interface P1CohomologySectionRep<K> {
|
|
135
|
+
/** Coefficients `[a_0, ..., a_{d0}]` of `p_0(t) = sum_a a_a t^a` on `U_0`. */
|
|
136
|
+
readonly chart0Coeffs: readonly K[];
|
|
137
|
+
/** Coefficients `[b_0, ..., b_{d1}]` of `p_1(u) = sum_b b_b u^b` on `U_1`. */
|
|
138
|
+
readonly chart1Coeffs: readonly K[];
|
|
139
|
+
}
|
|
140
|
+
export interface CertifiedP1TwistingCohomology<K> {
|
|
141
|
+
readonly fieldName: string;
|
|
142
|
+
readonly twist: number;
|
|
143
|
+
readonly cechBlock: P1TwistingCechMatrix<K>;
|
|
144
|
+
readonly snf: SnfCertificate<K>;
|
|
145
|
+
readonly kernelCert: FreeKernelCertificate<K>;
|
|
146
|
+
/**Trusted `endash` kernel SNF proof bundle (`declareTheorem`, `axiomsUsed === 0`!). */
|
|
147
|
+
readonly kernelSnfBundle: VerifiedSnfProofBundle<K>;
|
|
148
|
+
readonly dimH0: number;
|
|
149
|
+
readonly dimH1: number;
|
|
150
|
+
readonly eulerCharacteristic: number;
|
|
151
|
+
/** Basis of `H^0(P^1_k, O(n))` as glued pairs `(p_0(t), p_1(u))`. */
|
|
152
|
+
readonly h0Basis: readonly P1CohomologySectionRep<K>[];
|
|
153
|
+
/** Basis of `H^1(P^1_k, O(n)) = coker(d^0_n)` as Laurent cocycles on `U_0 cap U_1` (`exp -> coeff`). */
|
|
154
|
+
readonly h1LaurentCocycles: readonly Readonly<Record<number, K>>[];
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Build the exact finite-dimensional Čech coboundary matrix `d^0_n` for `O_{P^1_k}(n)`
|
|
158
|
+
* over `U_0 = Spec k[t]`, `U_1 = Spec k[u]` (`u = t^-1`, `d^0_n(p_0, p_1) = t^n p_1(t^-1) - p_0(t)`).
|
|
159
|
+
*
|
|
160
|
+
* Exactness of the window `[E_min, E_max] = [min(0, n) - 1, max(0, n) + 1]`:
|
|
161
|
+
* - For `e > max(0, n)`, only `-p_0(t)` hits `t^e` (bijective on `e > max(0, n)`);
|
|
162
|
+
* - For `e < min(0, n)`, only `+t^n p_1(t^-1)` hits `t^e` (bijective on `e < min(0, n)`);
|
|
163
|
+
* - Hence `ker(d^0_n)` and `coker(d^0_n)` are 100% isomorphic to this `(E_max - E_min + 1)`-row block!
|
|
164
|
+
*/
|
|
165
|
+
export declare function buildP1TwistingCechMatrix<K>(field: ExactField<K>, twist: number): P1TwistingCechMatrix<K>;
|
|
166
|
+
/**
|
|
167
|
+
* Compute `H^0(P^1_k, O(n))` and `H^1(P^1_k, O(n))` AND **verify the SNF witness inside
|
|
168
|
+
* the trusted `endash` kernel (`declareTheorem`, `axiomsUsed === 0`)**!
|
|
169
|
+
*/
|
|
170
|
+
export declare function computeAndCertifyP1TwistingCohomology<K>(spec: ReifyRingSpec<K>, field: ExactField<K>, twist: number, forgedOverrides?: {
|
|
171
|
+
readonly U?: DenseMatrix<K>;
|
|
172
|
+
readonly UInv?: DenseMatrix<K>;
|
|
173
|
+
readonly D?: DenseMatrix<K>;
|
|
174
|
+
readonly V?: DenseMatrix<K>;
|
|
175
|
+
readonly VInv?: DenseMatrix<K>;
|
|
176
|
+
}): CertifiedP1TwistingCohomology<K>;
|
|
177
|
+
export declare function computeAndCertifyP1TwistingCohomologyQ(twist: number, forgedOverrides?: Parameters<typeof certifySnfInKernel<BigRat>>[2]): CertifiedP1TwistingCohomology<BigRat>;
|
|
178
|
+
export declare function computeAndCertifyP1TwistingCohomologyF2(twist: number, forgedOverrides?: Parameters<typeof certifySnfInKernel<bigint>>[2]): CertifiedP1TwistingCohomology<bigint>;
|
|
179
|
+
export interface P1SerreDualityAuditRow {
|
|
180
|
+
readonly n: number;
|
|
181
|
+
readonly dualTwist: number;
|
|
182
|
+
readonly dimH0_n: number;
|
|
183
|
+
readonly dimH1_n: number;
|
|
184
|
+
readonly dimH0_dual: number;
|
|
185
|
+
readonly dimH1_dual: number;
|
|
186
|
+
readonly eulerChar: number;
|
|
187
|
+
readonly serreH0EqDualH1: boolean;
|
|
188
|
+
readonly serreH1EqDualH0: boolean;
|
|
189
|
+
readonly riemannRochHolds: boolean;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Certify `O_{P^1_k}(n)` AND its Serre-dual partner `O_{P^1_k}(-n - 2)` inside the trusted
|
|
193
|
+
* `endash` kernel across every `n in twists`, verifying both Serre duality
|
|
194
|
+
* (`dim H^0(O(n)) = dim H^1(O(-n - 2))`, `dim H^1(O(n)) = dim H^0(O(-n - 2))`)
|
|
195
|
+
* and Riemann–Roch (`chi(O(n)) = n + 1`)!
|
|
196
|
+
*/
|
|
197
|
+
export declare function verifyP1SerreDualityAndRiemannRoch<K>(spec: ReifyRingSpec<K>, field: ExactField<K>, twists?: readonly number[]): {
|
|
198
|
+
readonly resultsByTwist: ReadonlyMap<number, CertifiedP1TwistingCohomology<K>>;
|
|
199
|
+
readonly rows: readonly P1SerreDualityAuditRow[];
|
|
200
|
+
readonly allVerified: boolean;
|
|
201
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase H3 Typed CAS (Part 3): Immutable Dense & Block Matrices over any
|
|
3
|
+
* `ExactRing<T>` + Bird's Division-Free Exact Determinant (`endash/src/cas/matrix.ts`).
|
|
4
|
+
*
|
|
5
|
+
* Strict Isolation & Soundness Discipline:
|
|
6
|
+
* - 0 external npm dependencies, 0 `any` casts, 0 floating-point operations.
|
|
7
|
+
* - Bird (2011) O(n^4) division-free determinant works over EVERY commutative
|
|
8
|
+
* `ExactRing<T>` (Z, Q, F_p, K[x], R[x_1,...,x_d]).
|
|
9
|
+
*/
|
|
10
|
+
import { ExactRing } from './rings';
|
|
11
|
+
export interface DenseMatrix<T> {
|
|
12
|
+
readonly ring: ExactRing<T>;
|
|
13
|
+
readonly rows: number;
|
|
14
|
+
readonly cols: number;
|
|
15
|
+
readonly entries: readonly (readonly T[])[];
|
|
16
|
+
}
|
|
17
|
+
export declare function mkMatrix<T>(ring: ExactRing<T>, rows: number, cols: number, entries: readonly (readonly T[])[]): DenseMatrix<T>;
|
|
18
|
+
export declare function zeroMatrix<T>(ring: ExactRing<T>, rows: number, cols: number): DenseMatrix<T>;
|
|
19
|
+
export declare function identityMatrix<T>(ring: ExactRing<T>, n: number): DenseMatrix<T>;
|
|
20
|
+
export declare function diagMatrix<T>(ring: ExactRing<T>, rows: number, cols: number, diag: readonly T[]): DenseMatrix<T>;
|
|
21
|
+
export declare function fromBigIntMatrix<T>(ring: ExactRing<T>, rows: number, cols: number, data: readonly (readonly bigint[])[]): DenseMatrix<T>;
|
|
22
|
+
export declare function colVector<T>(ring: ExactRing<T>, col: readonly T[]): DenseMatrix<T>;
|
|
23
|
+
export declare function rowVector<T>(ring: ExactRing<T>, row: readonly T[]): DenseMatrix<T>;
|
|
24
|
+
export declare function matGet<T>(M: DenseMatrix<T>, r: number, c: number): T;
|
|
25
|
+
export declare function matGetCol<T>(M: DenseMatrix<T>, c: number): T[];
|
|
26
|
+
export declare function matFromCols<T>(ring: ExactRing<T>, rows: number, cols: readonly (readonly T[])[]): DenseMatrix<T>;
|
|
27
|
+
export declare function matEq<T>(A: DenseMatrix<T>, B: DenseMatrix<T>): boolean;
|
|
28
|
+
export declare function isZeroMatrix<T>(M: DenseMatrix<T>): boolean;
|
|
29
|
+
export declare function isIdentityMatrix<T>(M: DenseMatrix<T>): boolean;
|
|
30
|
+
export declare function matAdd<T>(A: DenseMatrix<T>, B: DenseMatrix<T>): DenseMatrix<T>;
|
|
31
|
+
export declare function matSub<T>(A: DenseMatrix<T>, B: DenseMatrix<T>): DenseMatrix<T>;
|
|
32
|
+
export declare function matNeg<T>(A: DenseMatrix<T>): DenseMatrix<T>;
|
|
33
|
+
export declare function matScale<T>(s: T, A: DenseMatrix<T>): DenseMatrix<T>;
|
|
34
|
+
export declare function matMul<T>(A: DenseMatrix<T>, B: DenseMatrix<T>): DenseMatrix<T>;
|
|
35
|
+
export declare function matTranspose<T>(A: DenseMatrix<T>): DenseMatrix<T>;
|
|
36
|
+
export declare function hstack<T>(A: DenseMatrix<T>, B: DenseMatrix<T>): DenseMatrix<T>;
|
|
37
|
+
export declare function vstack<T>(A: DenseMatrix<T>, B: DenseMatrix<T>): DenseMatrix<T>;
|
|
38
|
+
export declare function blockDiag<T>(A: DenseMatrix<T>, B: DenseMatrix<T>): DenseMatrix<T>;
|
|
39
|
+
export declare function submatrix<T>(A: DenseMatrix<T>, r0: number, r1: number, c0: number, c1: number): DenseMatrix<T>;
|
|
40
|
+
/**
|
|
41
|
+
* Bird (2011) O(n^4) division-free determinant over ANY commutative `ExactRing<T>`.
|
|
42
|
+
*/
|
|
43
|
+
export declare function matDet<T>(A: DenseMatrix<T>): T;
|
|
44
|
+
export declare function isUnimodularPair<T>(U: DenseMatrix<T>, UInv: DenseMatrix<T>): boolean;
|
|
45
|
+
export declare function formatMatrix<T>(M: DenseMatrix<T>): string;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase H3 Typed CAS (Part 6): Constructive Freyd Presented Modules `coker(R_M)`,
|
|
3
|
+
* Kernels, Cokernels, Invariant-Factor Homology `H_n`, Direct Connecting Morphism
|
|
4
|
+
* `delta_n`, & General 6-Term Snake `partial` (`endash/src/cas/modules_complexes.ts`).
|
|
5
|
+
*
|
|
6
|
+
* Works uniformly over ANY `EuclideanDomain<T>` (`IntRing` Z, `UnivariatePolyRing(RatField)` Q[x],
|
|
7
|
+
* `UnivariatePolyRing(mkFpField(p))` F_p[x], `RatField` Q, `mkFpField(p)` F_p).
|
|
8
|
+
*/
|
|
9
|
+
import { SnfCertificate } from './hnf_snf';
|
|
10
|
+
import { DenseMatrix } from './matrix';
|
|
11
|
+
import { EuclideanDomain } from './rings';
|
|
12
|
+
export interface PresentedModule<T> {
|
|
13
|
+
readonly domain: EuclideanDomain<T>;
|
|
14
|
+
readonly freeRank: number;
|
|
15
|
+
/** `freeRank x relCount` relation matrix `R_M`. */
|
|
16
|
+
readonly relations: DenseMatrix<T>;
|
|
17
|
+
}
|
|
18
|
+
export interface PresentedMorphism<T> {
|
|
19
|
+
readonly domain: EuclideanDomain<T>;
|
|
20
|
+
readonly src: PresentedModule<T>;
|
|
21
|
+
readonly dst: PresentedModule<T>;
|
|
22
|
+
/** `dst.freeRank x src.freeRank` generator map `A`. */
|
|
23
|
+
readonly carrier: DenseMatrix<T>;
|
|
24
|
+
/** `dst.relations.cols x src.relations.cols` witness `W` with `A * R_src = R_dst * W`. */
|
|
25
|
+
readonly relWitness: DenseMatrix<T>;
|
|
26
|
+
}
|
|
27
|
+
export interface ModuleClassification<T> {
|
|
28
|
+
readonly freeBettiRank: number;
|
|
29
|
+
readonly torsionFactors: readonly T[];
|
|
30
|
+
readonly isZeroModule: boolean;
|
|
31
|
+
readonly snf: SnfCertificate<T>;
|
|
32
|
+
}
|
|
33
|
+
export declare function mkFreeModule<T>(domain: EuclideanDomain<T>, rank: number): PresentedModule<T>;
|
|
34
|
+
export declare function mkPresentedModule<T>(domain: EuclideanDomain<T>, relations: DenseMatrix<T>): PresentedModule<T>;
|
|
35
|
+
export declare function mkPresentedMorphism<T>(domain: EuclideanDomain<T>, src: PresentedModule<T>, dst: PresentedModule<T>, carrier: DenseMatrix<T>, explicitRelWitness?: DenseMatrix<T>): PresentedMorphism<T>;
|
|
36
|
+
export declare function idPresented<T>(M: PresentedModule<T>): PresentedMorphism<T>;
|
|
37
|
+
export declare function zeroPresentedMorphism<T>(src: PresentedModule<T>, dst: PresentedModule<T>): PresentedMorphism<T>;
|
|
38
|
+
export declare function composePresented<T>(g: PresentedMorphism<T>, f: PresentedMorphism<T>): PresentedMorphism<T>;
|
|
39
|
+
/**
|
|
40
|
+
* Returns witness `H` (`dst.relCount x src.freeRank`) with `f.carrier - g.carrier = R_dst * H`
|
|
41
|
+
* if `f` and `g` represent the same module homomorphism, or `null` otherwise.
|
|
42
|
+
*/
|
|
43
|
+
export declare function morphismEqWitness<T>(f: PresentedMorphism<T>, g: PresentedMorphism<T>): DenseMatrix<T> | null;
|
|
44
|
+
export declare function areMorphismsEqual<T>(f: PresentedMorphism<T>, g: PresentedMorphism<T>): boolean;
|
|
45
|
+
export declare function isZeroMorphism<T>(f: PresentedMorphism<T>): boolean;
|
|
46
|
+
export declare function classifyPresentedModule<T>(M: PresentedModule<T>): ModuleClassification<T>;
|
|
47
|
+
export interface PresentedKernelResult<T> {
|
|
48
|
+
readonly kernel: PresentedModule<T>;
|
|
49
|
+
readonly inclusion: PresentedMorphism<T>;
|
|
50
|
+
/** Lift any `u : T -> src` with `f o u = 0` to `uBar : T -> ker(f)` (`inclusion o uBar = u`). */
|
|
51
|
+
lift(u: PresentedMorphism<T>): PresentedMorphism<T>;
|
|
52
|
+
}
|
|
53
|
+
export interface PresentedCokernelResult<T> {
|
|
54
|
+
readonly cokernel: PresentedModule<T>;
|
|
55
|
+
readonly projection: PresentedMorphism<T>;
|
|
56
|
+
/** Descend any `v : dst -> T` with `v o f = 0` to `vBar : coker(f) -> T` (`vBar o projection = v`). */
|
|
57
|
+
descend(v: PresentedMorphism<T>): PresentedMorphism<T>;
|
|
58
|
+
}
|
|
59
|
+
export declare function presentedCokernel<T>(f: PresentedMorphism<T>): PresentedCokernelResult<T>;
|
|
60
|
+
export declare function presentedKernel<T>(f: PresentedMorphism<T>): PresentedKernelResult<T>;
|
|
61
|
+
/**
|
|
62
|
+
* Exactness test at the middle of `A --f--> B --g--> C`:
|
|
63
|
+
* checks both `g o f = 0` AND `ker(g) subseteq im(f)` (equivalently `H(f, g) == 0`)!
|
|
64
|
+
*/
|
|
65
|
+
export declare function isExactPair<T>(f: PresentedMorphism<T>, g: PresentedMorphism<T>): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Decide whether `p : B -> C` admits a module section `s : C -> B` with `p o s = id_C`.
|
|
68
|
+
* Returns the explicit `PresentedMorphism<T>` section if split, or `null` if nonsplit!
|
|
69
|
+
*/
|
|
70
|
+
export declare function findModuleSection<T>(p: PresentedMorphism<T>): PresentedMorphism<T> | null;
|
|
71
|
+
export interface BoundedChainComplex<T> {
|
|
72
|
+
readonly domain: EuclideanDomain<T>;
|
|
73
|
+
readonly minDeg: number;
|
|
74
|
+
readonly maxDeg: number;
|
|
75
|
+
readonly objects: ReadonlyMap<number, PresentedModule<T>>;
|
|
76
|
+
/** Differential `d_n : C_n -> C_{n-1}` keyed by source degree `n`. */
|
|
77
|
+
readonly differentials: ReadonlyMap<number, PresentedMorphism<T>>;
|
|
78
|
+
}
|
|
79
|
+
export interface HomologyResult<T> {
|
|
80
|
+
readonly degree: number;
|
|
81
|
+
readonly cycles: PresentedKernelResult<T>;
|
|
82
|
+
readonly boundaryLift: PresentedMorphism<T>;
|
|
83
|
+
readonly homologyCokernel: PresentedCokernelResult<T>;
|
|
84
|
+
readonly module: PresentedModule<T>;
|
|
85
|
+
readonly classification: ModuleClassification<T>;
|
|
86
|
+
}
|
|
87
|
+
export declare function mkBoundedChainComplex<T>(domain: EuclideanDomain<T>, minDeg: number, maxDeg: number, objects: ReadonlyMap<number, PresentedModule<T>>, differentials: ReadonlyMap<number, PresentedMorphism<T>>): BoundedChainComplex<T>;
|
|
88
|
+
export declare function chainObjectAt<T>(C: BoundedChainComplex<T>, n: number): PresentedModule<T>;
|
|
89
|
+
export declare function chainDiffAt<T>(C: BoundedChainComplex<T>, n: number): PresentedMorphism<T>;
|
|
90
|
+
export declare function computeHomologyAt<T>(C: BoundedChainComplex<T>, n: number): HomologyResult<T>;
|
|
91
|
+
export declare function inducedHomologyMap<T>(chainMapN: PresentedMorphism<T>, chainMapNMinus1: PresentedMorphism<T>, srcH: HomologyResult<T>, dstH: HomologyResult<T>): PresentedMorphism<T>;
|
|
92
|
+
export interface LesConnectingWindow<T> {
|
|
93
|
+
readonly degree: number;
|
|
94
|
+
readonly hA_n: HomologyResult<T>;
|
|
95
|
+
readonly hB_n: HomologyResult<T>;
|
|
96
|
+
readonly hD_n: HomologyResult<T>;
|
|
97
|
+
readonly hA_nMinus1: HomologyResult<T>;
|
|
98
|
+
readonly hB_nMinus1: HomologyResult<T>;
|
|
99
|
+
readonly hD_nMinus1: HomologyResult<T>;
|
|
100
|
+
readonly iStar_n: PresentedMorphism<T>;
|
|
101
|
+
readonly pStar_n: PresentedMorphism<T>;
|
|
102
|
+
readonly delta_n: PresentedMorphism<T>;
|
|
103
|
+
readonly iStar_nMinus1: PresentedMorphism<T>;
|
|
104
|
+
readonly pStar_nMinus1: PresentedMorphism<T>;
|
|
105
|
+
/** Exactness verified at `(iStar_n, pStar_n)`, `(pStar_n, delta_n)`, `(delta_n, iStar_nMinus1)`, and `(iStar_nMinus1, pStar_nMinus1)`. */
|
|
106
|
+
readonly exactAtAllFourInteriorPositions: boolean;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Compute the direct connecting morphism `delta_n : H_n(D) -> H_{n-1}(A)` for a
|
|
110
|
+
* short exact sequence of bounded chain complexes `0 -> A -> B -> D -> 0` WITHOUT
|
|
111
|
+
* assuming any splitting of `p_n`, and verify 6-term window exactness!
|
|
112
|
+
*/
|
|
113
|
+
export declare function computeLesWindow<T>(A: BoundedChainComplex<T>, B: BoundedChainComplex<T>, D: BoundedChainComplex<T>, iMap: ReadonlyMap<number, PresentedMorphism<T>>, pMap: ReadonlyMap<number, PresentedMorphism<T>>, n: number): LesConnectingWindow<T>;
|
|
114
|
+
export interface SnakeDiagramInput<T> {
|
|
115
|
+
/** Top row `A1 --f--> B1 --g--> C1 -> 0` (`g` surjective, exact at `B1`). */
|
|
116
|
+
readonly f: PresentedMorphism<T>;
|
|
117
|
+
readonly g: PresentedMorphism<T>;
|
|
118
|
+
/** Bottom row `0 -> A2 --fPrime--> B2 --gPrime--> C2` (`fPrime` injective, exact at `B2`). */
|
|
119
|
+
readonly fPrime: PresentedMorphism<T>;
|
|
120
|
+
readonly gPrime: PresentedMorphism<T>;
|
|
121
|
+
/** Commuting vertical maps `alpha : A1 -> A2`, `beta : B1 -> B2`, `gamma : C1 -> C2`. */
|
|
122
|
+
readonly alpha: PresentedMorphism<T>;
|
|
123
|
+
readonly beta: PresentedMorphism<T>;
|
|
124
|
+
readonly gamma: PresentedMorphism<T>;
|
|
125
|
+
}
|
|
126
|
+
export interface SnakeSequenceResult<T> {
|
|
127
|
+
readonly kerAlpha: PresentedKernelResult<T>;
|
|
128
|
+
readonly kerBeta: PresentedKernelResult<T>;
|
|
129
|
+
readonly kerGamma: PresentedKernelResult<T>;
|
|
130
|
+
readonly cokerAlpha: PresentedCokernelResult<T>;
|
|
131
|
+
readonly cokerBeta: PresentedCokernelResult<T>;
|
|
132
|
+
readonly cokerGamma: PresentedCokernelResult<T>;
|
|
133
|
+
readonly kerF: PresentedMorphism<T>;
|
|
134
|
+
readonly kerG: PresentedMorphism<T>;
|
|
135
|
+
/** Snake connecting morphism `partial : ker(gamma) -> coker(alpha)`. */
|
|
136
|
+
readonly snakeDelta: PresentedMorphism<T>;
|
|
137
|
+
readonly cokerFPrime: PresentedMorphism<T>;
|
|
138
|
+
readonly cokerGPrime: PresentedMorphism<T>;
|
|
139
|
+
readonly exactSixTerm: boolean;
|
|
140
|
+
}
|
|
141
|
+
export declare function computeSnakeSequence<T>(sq: SnakeDiagramInput<T>): SnakeSequenceResult<T>;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-Safe Untrusted Computational Group Theory Engine & LCF Witness Builder
|
|
3
|
+
* (`endash/src/cas/perm_coset_cgt.ts`, `0` Node built-ins, `0` `any` casts, `0 LOC` TCB delta).
|
|
4
|
+
*
|
|
5
|
+
* Inspired by `AxiomMath/CFSG` and Bezem–Buchholtz–Cagne–Dundas–Grayson *Symmetry*:
|
|
6
|
+
* 1. Deterministic **Schreier–Sims** Base & Strong Generating Set (BSGS) construction
|
|
7
|
+
* computing exact permutation group orders `|G| = ∏ |O_i|`, constructive word
|
|
8
|
+
* factorizations, membership/non-membership witnesses, and compact derived commutator
|
|
9
|
+
* subgroups `[G, G]` (certifying e.g. `|[A_4, A_4]| = 4` and `[A_5, A_5] = A_5` of order `60`);
|
|
10
|
+
* 2. Deterministic **Todd–Coxeter** HLT/Felsch coset enumeration with union-find coincidence
|
|
11
|
+
* collapse and spanning Schreier representative trees (certifying e.g. `S_3` (`6`),
|
|
12
|
+
* `D_8` (`8`), quaternion `Q_8` (`8`), and icosahedral `⟨r, s | r^2, s^3, (rs)^5⟩ ≅ A_5` (`60`));
|
|
13
|
+
* 3. Reifies compact LCF witnesses checked exclusively inside the trusted `endash` kernel
|
|
14
|
+
* (`PermGroup.{SchreierCert,MemberCert,DerivedOrderCert}` & `CosetEnum.CosetCert`),
|
|
15
|
+
* exposed to `.en` via `by cas_group` (`NC-17b` Part 3).
|
|
16
|
+
*/
|
|
17
|
+
import { Term } from '../ast';
|
|
18
|
+
import { ElabEnv } from '../elab/env';
|
|
19
|
+
export type Perm = readonly number[];
|
|
20
|
+
export declare function idPerm(n: number): Perm;
|
|
21
|
+
export declare function isBijectionPerm(n: number, p: Perm): boolean;
|
|
22
|
+
export declare function permEq(a: Perm, b: Perm): boolean;
|
|
23
|
+
export declare function isIdentityPerm(n: number, p: Perm): boolean;
|
|
24
|
+
/** `(p ∘ q)(x) = p[q[x]]`. */
|
|
25
|
+
export declare function permComp(p: Perm, q: Perm): Perm;
|
|
26
|
+
export declare function permInv(p: Perm): Perm;
|
|
27
|
+
export declare function permCommutator(a: Perm, b: Perm): Perm;
|
|
28
|
+
export declare function permKey(p: Perm): string;
|
|
29
|
+
/** Evaluate `[i_0, ..., i_{r-1}]` right-to-left: `gens[i_0] ∘ ... ∘ gens[i_{r-1}]`. */
|
|
30
|
+
export declare function evalPermWord(n: number, gens: readonly Perm[], word: readonly number[]): Perm;
|
|
31
|
+
/** Invert a word over `symGens = gens ++ map inv gens` (`length = 2 * m`). */
|
|
32
|
+
export declare function invertSymGenWord(mOrigGens: number, word: readonly number[]): readonly number[];
|
|
33
|
+
export interface SchreierSimsResult {
|
|
34
|
+
readonly degree: number;
|
|
35
|
+
readonly gens: readonly Perm[];
|
|
36
|
+
readonly order: number;
|
|
37
|
+
readonly base: readonly number[];
|
|
38
|
+
readonly sgs: readonly Perm[];
|
|
39
|
+
/** Each `sgsWords[r]` expresses `sgs[r]` as a word in `symGens = gens ++ map inv gens`. */
|
|
40
|
+
readonly sgsWords: readonly (readonly number[])[];
|
|
41
|
+
/** Stabilization level `0 <= sgsLevels[r] < base.length` (`sgs[r]` fixes `base[0..lvl-1]`). */
|
|
42
|
+
readonly sgsLevels: readonly number[];
|
|
43
|
+
readonly orbits: readonly (readonly number[])[];
|
|
44
|
+
/** `transvWords[i][t]` expresses `u_{i,t}` as a word in `sgs` using indices with `sgsLevels >= i`. */
|
|
45
|
+
readonly transvWords: readonly (readonly (readonly number[])[])[];
|
|
46
|
+
readonly transv: readonly (readonly Perm[])[];
|
|
47
|
+
}
|
|
48
|
+
export declare function siftWithBsgs(n: number, base: readonly number[], orbits: readonly (readonly number[])[], transv: readonly (readonly Perm[])[], sgsWords: readonly (readonly number[])[], transvWords: readonly (readonly (readonly number[])[])[], mOrigGens: number, startLevel: number, target: Perm): {
|
|
49
|
+
readonly siftedToId: boolean;
|
|
50
|
+
readonly residue: Perm;
|
|
51
|
+
/** If `siftedToId` and `startLevel === 0`, expresses `target` in `symGens`: `target = u_0 u_1 ... u_{k-1}`. */
|
|
52
|
+
readonly wordInSymGens: readonly number[];
|
|
53
|
+
};
|
|
54
|
+
export declare function computeSchreierSims(n: number, gens: readonly Perm[]): SchreierSimsResult;
|
|
55
|
+
export interface PermMembershipResult {
|
|
56
|
+
readonly isMember: boolean;
|
|
57
|
+
readonly wordInSymGens: readonly number[];
|
|
58
|
+
readonly bsgs: SchreierSimsResult;
|
|
59
|
+
}
|
|
60
|
+
export declare function solvePermMembership(n: number, gens: readonly Perm[], target: Perm): PermMembershipResult;
|
|
61
|
+
export interface CommutatorConjTriple {
|
|
62
|
+
readonly cWord: readonly number[];
|
|
63
|
+
readonly uWord: readonly number[];
|
|
64
|
+
readonly vWord: readonly number[];
|
|
65
|
+
}
|
|
66
|
+
export interface DerivedSubgroupResult {
|
|
67
|
+
readonly degree: number;
|
|
68
|
+
readonly gens: readonly Perm[];
|
|
69
|
+
readonly hGens: readonly Perm[];
|
|
70
|
+
readonly hCommWords: readonly (readonly CommutatorConjTriple[])[];
|
|
71
|
+
readonly hBsgs: SchreierSimsResult;
|
|
72
|
+
readonly derivedOrder: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Compute a **compact** normal generating set `hGens` for `[G, G]` (`|hGens| <= log2(|[G, G]|)`):
|
|
76
|
+
* - Only appends a commutator or conjugate `cand` when `cand ∉ ⟨hGens⟩`, so `⟨hGens⟩`
|
|
77
|
+
* doubles in order on every addition (`|hGens| = 2` for `A_4` and `A_5`, instead of `59`!).
|
|
78
|
+
*/
|
|
79
|
+
export declare function computeDerivedSubgroupCertData(n: number, gens: readonly Perm[]): DerivedSubgroupResult;
|
|
80
|
+
export interface ToddCoxeterResult {
|
|
81
|
+
readonly nGens: number;
|
|
82
|
+
readonly relators: readonly (readonly number[])[];
|
|
83
|
+
readonly subWords: readonly (readonly number[])[];
|
|
84
|
+
readonly numCosets: number;
|
|
85
|
+
/** `cosetPerms[j]` is the right-action permutation of generator `j` on `{0, ..., numCosets - 1}`. */
|
|
86
|
+
readonly cosetPerms: readonly Perm[];
|
|
87
|
+
readonly invCosetPerms: readonly Perm[];
|
|
88
|
+
/** `repWords[c]` is a signed-literal word (`2*j` for `x_j`, `2*j+1` for `x_j^-1`) mapping `0 |-> c`. */
|
|
89
|
+
readonly repWords: readonly (readonly number[])[];
|
|
90
|
+
}
|
|
91
|
+
export declare function genLit(genIdx: number, inv?: boolean): number;
|
|
92
|
+
export declare function enumerateToddCoxeter(nGens: number, relators: readonly (readonly number[])[], subWords: readonly (readonly number[])[], maxCosets?: number): ToddCoxeterResult;
|
|
93
|
+
export declare function traceCosetWord(cosetPerms: readonly Perm[], word: readonly number[], startCoset: number): number;
|
|
94
|
+
export declare function buildSymmetricGroupGens(n: number): readonly Perm[];
|
|
95
|
+
/** Dihedral group `D_8 <= Σ_4` generated by 4-cycle `(0 1 2 3)` and reflection `(1 3)`. */
|
|
96
|
+
export declare function buildDihedral8Gens(): readonly Perm[];
|
|
97
|
+
/** Tetrahedral alternating group `A_4 <= Σ_4` generated by `(0 1 2)` and `(1 2 3)`. */
|
|
98
|
+
export declare function buildAlternating4Gens(): readonly Perm[];
|
|
99
|
+
/** Grayson's icosahedral simple group `A_5 <= Σ_5` generated by `(0 1 2 3 4)` and `(0 1)(2 3)`. */
|
|
100
|
+
export declare function buildAlternating5Gens(): readonly Perm[];
|
|
101
|
+
/** `S_3 = ⟨r, s | r^2, s^3, (rs)^2⟩` (`nGens = 2`, order `6`). */
|
|
102
|
+
export declare function buildCoxeterS3Presentation(): {
|
|
103
|
+
readonly nGens: number;
|
|
104
|
+
readonly relators: readonly (readonly number[])[];
|
|
105
|
+
};
|
|
106
|
+
/** `D_8 = ⟨r, s | r^4, s^2, (rs)^2⟩` (`nGens = 2`, order `8`). */
|
|
107
|
+
export declare function buildCoxeterD8Presentation(): {
|
|
108
|
+
readonly nGens: number;
|
|
109
|
+
readonly relators: readonly (readonly number[])[];
|
|
110
|
+
};
|
|
111
|
+
/** Quaternion group `Q_8 = ⟨i, j | i^4 = 1, i^2 j^-2 = 1, i j i j^-1 = 1⟩` (order `8`). */
|
|
112
|
+
export declare function buildQuaternionQ8Presentation(): {
|
|
113
|
+
readonly nGens: number;
|
|
114
|
+
readonly relators: readonly (readonly number[])[];
|
|
115
|
+
};
|
|
116
|
+
/** Icosahedral presentation `⟨r, s | r^2 = 1, s^3 = 1, (rs)^5 = 1⟩ ≅ A_5` (order `60`). */
|
|
117
|
+
export declare function buildIcosahedralA5Presentation(): {
|
|
118
|
+
readonly nGens: number;
|
|
119
|
+
readonly relators: readonly (readonly number[])[];
|
|
120
|
+
};
|
|
121
|
+
export declare function reifyNatList(xs: readonly number[]): Term;
|
|
122
|
+
export declare function reifyNatList2(xss: readonly (readonly number[])[]): Term;
|
|
123
|
+
export declare function reifyNatList3(xsss: readonly (readonly (readonly number[])[])[]): Term;
|
|
124
|
+
export declare function reifyNatList4(xssss: readonly (readonly (readonly (readonly number[])[])[])[]): Term;
|
|
125
|
+
/** Closed non-dependent tuple type for `(base, (sgs, (sgsWords, (sgsLevels, (orbits, transvWords)))))`. */
|
|
126
|
+
export declare function mkSchreierDataTupleType(): Term;
|
|
127
|
+
export declare function packSchreierDataTupleTerm(baseT: Term, sgsT: Term, sgsWordsT: Term, sgsLevelsT: Term, orbitsT: Term, transvWordsT: Term): Term;
|
|
128
|
+
export interface ForgedSchreierOverrides {
|
|
129
|
+
readonly gens?: readonly Perm[];
|
|
130
|
+
readonly claimedOrder?: number;
|
|
131
|
+
readonly base?: readonly number[];
|
|
132
|
+
readonly sgs?: readonly Perm[];
|
|
133
|
+
readonly sgsWords?: readonly (readonly number[])[];
|
|
134
|
+
readonly sgsLevels?: readonly number[];
|
|
135
|
+
readonly orbits?: readonly (readonly number[])[];
|
|
136
|
+
readonly transvWords?: readonly (readonly (readonly number[])[])[];
|
|
137
|
+
}
|
|
138
|
+
export declare function buildSchreierCertWitnessTerm(solved: SchreierSimsResult, overrides?: ForgedSchreierOverrides): {
|
|
139
|
+
readonly certTypeTerm: Term;
|
|
140
|
+
readonly certProofTerm: Term;
|
|
141
|
+
};
|
|
142
|
+
export declare function buildMemberCertWitnessTerm(n: number, gens: readonly Perm[], target: Perm, solved: PermMembershipResult, overrides?: {
|
|
143
|
+
readonly expected?: boolean;
|
|
144
|
+
readonly wordInSymGens?: readonly number[];
|
|
145
|
+
}): {
|
|
146
|
+
readonly certTypeTerm: Term;
|
|
147
|
+
readonly certProofTerm: Term;
|
|
148
|
+
};
|
|
149
|
+
export declare function buildDerivedOrderCertWitnessTerm(solved: DerivedSubgroupResult, overrides?: {
|
|
150
|
+
readonly derivedOrder?: number;
|
|
151
|
+
readonly hGens?: readonly Perm[];
|
|
152
|
+
readonly hCommWords?: readonly (readonly CommutatorConjTriple[])[];
|
|
153
|
+
}): {
|
|
154
|
+
readonly certTypeTerm: Term;
|
|
155
|
+
readonly certProofTerm: Term;
|
|
156
|
+
};
|
|
157
|
+
export declare function buildCosetCertWitnessTerm(solved: ToddCoxeterResult, overrides?: {
|
|
158
|
+
readonly numCosets?: number;
|
|
159
|
+
readonly cosetPerms?: readonly Perm[];
|
|
160
|
+
readonly invCosetPerms?: readonly Perm[];
|
|
161
|
+
readonly repWords?: readonly (readonly number[])[];
|
|
162
|
+
}): {
|
|
163
|
+
readonly certTypeTerm: Term;
|
|
164
|
+
readonly certProofTerm: Term;
|
|
165
|
+
};
|
|
166
|
+
export declare function installCgtTacticsOnly(env: ElabEnv): ElabEnv;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase H3 Typed CAS (Part 2): Univariate Euclidean Polynomials `K[x]` &
|
|
3
|
+
* Multivariate Polynomial Rings `R[x_1, ..., x_n]` (`lex` / `degrevlex`)
|
|
4
|
+
* (`endash/src/cas/poly.ts`).
|
|
5
|
+
*
|
|
6
|
+
* Strict Isolation & Soundness Discipline:
|
|
7
|
+
* - 0 external npm dependencies; exact coefficient rings/fields only.
|
|
8
|
+
* - `UnivariatePolyRing<K>` implements `EuclideanDomain<UniPoly<K>>` over any
|
|
9
|
+
* `ExactField<K>` (e.g. `RatField` Q[x] or `mkFpField(p)` F_p[x]), enabling
|
|
10
|
+
* certificate-producing HNF and SNF uniformly over Z and K[x]!
|
|
11
|
+
*/
|
|
12
|
+
import { EuclideanDomain, ExactField, ExactRing } from './rings';
|
|
13
|
+
/** Canonical dense low-to-high polynomial `coeffs[0] + coeffs[1]*x + ...` with no trailing zeros. */
|
|
14
|
+
export interface UniPoly<K> {
|
|
15
|
+
readonly coeffs: readonly K[];
|
|
16
|
+
}
|
|
17
|
+
export interface UnivariatePolyRing<K> extends EuclideanDomain<UniPoly<K>> {
|
|
18
|
+
readonly field: ExactField<K>;
|
|
19
|
+
readonly varName: string;
|
|
20
|
+
readonly gen: UniPoly<K>;
|
|
21
|
+
constPoly(c: K): UniPoly<K>;
|
|
22
|
+
fromCoeffs(coeffs: readonly K[]): UniPoly<K>;
|
|
23
|
+
degree(p: UniPoly<K>): number;
|
|
24
|
+
leadCoeff(p: UniPoly<K>): K;
|
|
25
|
+
monic(p: UniPoly<K>): UniPoly<K>;
|
|
26
|
+
scale(c: K, p: UniPoly<K>): UniPoly<K>;
|
|
27
|
+
evalAt(p: UniPoly<K>, x: K): K;
|
|
28
|
+
}
|
|
29
|
+
export declare function mkUnivariatePolyRing<K>(field: ExactField<K>, varName?: string): UnivariatePolyRing<K>;
|
|
30
|
+
export type Monomial = readonly number[];
|
|
31
|
+
export type MonomialOrder = 'lex' | 'degrevlex';
|
|
32
|
+
export interface MultiTerm<C> {
|
|
33
|
+
readonly coeff: C;
|
|
34
|
+
readonly exp: Monomial;
|
|
35
|
+
}
|
|
36
|
+
/** Canonical sparse polynomial with nonzero terms sorted strictly descending by `order`. */
|
|
37
|
+
export interface MultiPoly<C> {
|
|
38
|
+
readonly terms: readonly MultiTerm<C>[];
|
|
39
|
+
}
|
|
40
|
+
export interface MultivariateDivisionResult<C> {
|
|
41
|
+
readonly quotients: readonly MultiPoly<C>[];
|
|
42
|
+
readonly remainder: MultiPoly<C>;
|
|
43
|
+
}
|
|
44
|
+
export interface MultivariatePolyRing<C> extends ExactRing<MultiPoly<C>> {
|
|
45
|
+
readonly coeffRing: ExactRing<C>;
|
|
46
|
+
readonly varNames: readonly string[];
|
|
47
|
+
readonly order: MonomialOrder;
|
|
48
|
+
readonly vars: readonly MultiPoly<C>[];
|
|
49
|
+
readonly zeroMonomial: Monomial;
|
|
50
|
+
compareMonomials(a: Monomial, b: Monomial): number;
|
|
51
|
+
monomialAdd(a: Monomial, b: Monomial): Monomial;
|
|
52
|
+
monomialDivides(divisor: Monomial, target: Monomial): boolean;
|
|
53
|
+
monomialSub(target: Monomial, divisor: Monomial): Monomial;
|
|
54
|
+
monomialLcm(a: Monomial, b: Monomial): Monomial;
|
|
55
|
+
constPoly(c: C): MultiPoly<C>;
|
|
56
|
+
monomial(coeff: C, exp: Monomial): MultiPoly<C>;
|
|
57
|
+
fromTerms(terms: readonly MultiTerm<C>[]): MultiPoly<C>;
|
|
58
|
+
leadTerm(p: MultiPoly<C>): MultiTerm<C> | null;
|
|
59
|
+
leadMonomial(p: MultiPoly<C>): Monomial | null;
|
|
60
|
+
leadCoeff(p: MultiPoly<C>): C;
|
|
61
|
+
scale(c: C, p: MultiPoly<C>): MultiPoly<C>;
|
|
62
|
+
mulTerm(t: MultiTerm<C>, p: MultiPoly<C>): MultiPoly<C>;
|
|
63
|
+
/** Exact multivariate division over a field coefficient ring (`f = sum_i q_i * g_i + r`). */
|
|
64
|
+
divRemGenerators(field: ExactField<C>, f: MultiPoly<C>, generators: readonly MultiPoly<C>[]): MultivariateDivisionResult<C>;
|
|
65
|
+
}
|
|
66
|
+
export declare function mkMultivariatePolyRing<C>(coeffRing: ExactRing<C>, varNames: readonly string[], order?: MonomialOrder): MultivariatePolyRing<C>;
|