@polintpro/proposit-core 0.2.3 → 0.2.5

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 (48) hide show
  1. package/README.md +14 -11
  2. package/dist/index.d.ts +3 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +1 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/lib/core/ArgumentEngine.d.ts +23 -19
  7. package/dist/lib/core/ArgumentEngine.d.ts.map +1 -1
  8. package/dist/lib/core/ArgumentEngine.js +11 -11
  9. package/dist/lib/core/ArgumentEngine.js.map +1 -1
  10. package/dist/lib/core/ChangeCollector.d.ts +13 -14
  11. package/dist/lib/core/ChangeCollector.d.ts.map +1 -1
  12. package/dist/lib/core/ChangeCollector.js.map +1 -1
  13. package/dist/lib/core/ExpressionManager.d.ts +15 -13
  14. package/dist/lib/core/ExpressionManager.d.ts.map +1 -1
  15. package/dist/lib/core/ExpressionManager.js +52 -22
  16. package/dist/lib/core/ExpressionManager.js.map +1 -1
  17. package/dist/lib/core/PremiseManager.d.ts +21 -20
  18. package/dist/lib/core/PremiseManager.d.ts.map +1 -1
  19. package/dist/lib/core/PremiseManager.js +19 -24
  20. package/dist/lib/core/PremiseManager.js.map +1 -1
  21. package/dist/lib/core/VariableManager.d.ts +7 -8
  22. package/dist/lib/core/VariableManager.d.ts.map +1 -1
  23. package/dist/lib/core/VariableManager.js +4 -1
  24. package/dist/lib/core/VariableManager.js.map +1 -1
  25. package/dist/lib/core/diff.d.ts +1 -1
  26. package/dist/lib/core/diff.d.ts.map +1 -1
  27. package/dist/lib/core/diff.js +19 -11
  28. package/dist/lib/core/diff.js.map +1 -1
  29. package/dist/lib/schemata/propositional.d.ts.map +1 -1
  30. package/dist/lib/schemata/propositional.js +0 -1
  31. package/dist/lib/schemata/propositional.js.map +1 -1
  32. package/dist/lib/schemata/shared.d.ts +4 -0
  33. package/dist/lib/schemata/shared.d.ts.map +1 -1
  34. package/dist/lib/types/diff.d.ts +15 -15
  35. package/dist/lib/types/diff.d.ts.map +1 -1
  36. package/dist/lib/types/mutation.d.ts +7 -20
  37. package/dist/lib/types/mutation.d.ts.map +1 -1
  38. package/dist/lib/utils/position.d.ts +9 -3
  39. package/dist/lib/utils/position.d.ts.map +1 -1
  40. package/dist/lib/utils/position.js +9 -4
  41. package/dist/lib/utils/position.js.map +1 -1
  42. package/package.json +3 -2
  43. package/skills/proposit-core/SKILL.md +35 -0
  44. package/skills/proposit-core/docs/api-usage.md +442 -0
  45. package/skills/proposit-core/docs/architecture.md +256 -0
  46. package/skills/proposit-core/docs/cli.md +304 -0
  47. package/skills/proposit-core/docs/testing.md +281 -0
  48. package/skills/proposit-core/docs/types-schemas.md +648 -0
@@ -0,0 +1,648 @@
1
+ # Types & Schemas Reference
2
+
3
+ Quick-reference for all exported types. For API usage, see [api-usage.md](./api-usage.md).
4
+
5
+ ---
6
+
7
+ ## 1. Expression Types
8
+
9
+ **Source:** `src/lib/schemata/propositional.ts`, `src/lib/core/ExpressionManager.ts`
10
+
11
+ ### `TCorePropositionalExpression<T>`
12
+
13
+ Discriminated union on `type`. Generic parameter `T` narrows the union (defaults to all three).
14
+
15
+ **Common fields (all variants):**
16
+
17
+ | Field | Type | Notes |
18
+ | ----------------- | ---------------- | ------------------------------- |
19
+ | `id` | `string` | UUID |
20
+ | `argumentId` | `string` | UUID |
21
+ | `argumentVersion` | `number` | |
22
+ | `parentId` | `string \| null` | `null` for root expressions |
23
+ | `position` | `number` | `>= 0`, ordering among siblings |
24
+ | `checksum` | `string` | Entity-level checksum |
25
+
26
+ **Variant-specific fields:**
27
+
28
+ | Variant | `type` | Extra field | Field type |
29
+ | ------------ | ------------ | ------------ | -------------------------- |
30
+ | `"variable"` | `"variable"` | `variableId` | `string` (UUID) |
31
+ | `"operator"` | `"operator"` | `operator` | `TCoreLogicalOperatorType` |
32
+ | `"formula"` | `"formula"` | _(none)_ | |
33
+
34
+ **Narrowing:** `TCorePropositionalExpression<"variable">` gives only the variable variant. Aliases: `TCorePropositionalVariableExpression`, `TCoreOperatorExpression`, `TCoreFormulaExpression`.
35
+
36
+ ### `TExpressionInput`
37
+
38
+ Same as `TCorePropositionalExpression` but with `checksum` omitted. Preserves discriminated-union narrowing via distributive conditional type. Used as input for `addExpression`, `insertExpression`, and as the internal storage type.
39
+
40
+ ```typescript
41
+ type TExpressionInput = Omit<TCorePropositionalExpression<T>, "checksum"> // for each T
42
+ ```
43
+
44
+ ### `TExpressionWithoutPosition`
45
+
46
+ Same as `TCorePropositionalExpression` but with both `position` and `checksum` omitted. Used as input for `appendExpression` and `addExpressionRelative`.
47
+
48
+ ```typescript
49
+ type TExpressionWithoutPosition = Omit<
50
+ TCorePropositionalExpression<T>,
51
+ "position" | "checksum"
52
+ >
53
+ ```
54
+
55
+ ### `TExpressionUpdate`
56
+
57
+ ```typescript
58
+ interface TExpressionUpdate {
59
+ position?: number
60
+ variableId?: string
61
+ operator?: TCoreLogicalOperatorType
62
+ }
63
+ ```
64
+
65
+ Used by `updateExpression(id, updates)`. Only set fields are applied. Forbidden fields (`id`, `parentId`, `type`, `argumentId`, `argumentVersion`, `checksum`) throw if present.
66
+
67
+ ---
68
+
69
+ ## 2. Variable Type
70
+
71
+ **Source:** `src/lib/schemata/propositional.ts`
72
+
73
+ ### `TCorePropositionalVariable`
74
+
75
+ ```typescript
76
+ interface TCorePropositionalVariable {
77
+ id: string // UUID
78
+ argumentId: string // UUID
79
+ argumentVersion: number
80
+ symbol: string // e.g. "P", "Q"
81
+ checksum: string
82
+ }
83
+ ```
84
+
85
+ Schema has `additionalProperties: true` -- extra fields survive round-trips.
86
+
87
+ ### `TVariableInput` (internal)
88
+
89
+ `Omit<TCorePropositionalVariable, "checksum">`. Used as input for `addVariable` and as internal storage in `VariableManager`. Not publicly exported from the package index.
90
+
91
+ ---
92
+
93
+ ## 3. Premise Type
94
+
95
+ **Source:** `src/lib/schemata/propositional.ts`
96
+
97
+ ### `TCorePremise`
98
+
99
+ ```typescript
100
+ interface TCorePremise {
101
+ id: string // UUID
102
+ rootExpressionId?: string // UUID, present if premise has expressions
103
+ variables: string[] // IDs of referenced variables
104
+ expressions: TCorePropositionalExpression[] // full expression tree
105
+ checksum: string
106
+ }
107
+ ```
108
+
109
+ Schema has `additionalProperties: true` -- extra fields survive round-trips.
110
+
111
+ Returned by `PremiseManager.toData()` and included in `TCoreArgumentEngineData.premises`.
112
+
113
+ ---
114
+
115
+ ## 4. Argument Types
116
+
117
+ **Source:** `src/lib/schemata/argument.ts`
118
+
119
+ ### `TCoreArgument`
120
+
121
+ ```typescript
122
+ interface TCoreArgument {
123
+ id: string // UUID
124
+ version: number
125
+ checksum: string
126
+ }
127
+ ```
128
+
129
+ Schema has `additionalProperties: true` -- extra fields survive round-trips.
130
+
131
+ ### `TCoreArgumentRoleState`
132
+
133
+ ```typescript
134
+ interface TCoreArgumentRoleState {
135
+ conclusionPremiseId?: string // UUID
136
+ }
137
+ ```
138
+
139
+ Supporting premises are derived dynamically (any inference premise that is not the conclusion). There is no `supportingPremiseIds` field.
140
+
141
+ ---
142
+
143
+ ## 5. Logical Operators
144
+
145
+ **Source:** `src/lib/schemata/propositional.ts`
146
+
147
+ ### `TCoreLogicalOperatorType`
148
+
149
+ ```typescript
150
+ type TCoreLogicalOperatorType = "not" | "and" | "or" | "implies" | "iff"
151
+ ```
152
+
153
+ **Arity and placement rules:**
154
+
155
+ | Operator | Arity | Root-only? |
156
+ | --------- | --------------- | ---------- |
157
+ | `not` | unary (1 child) | No |
158
+ | `and` | variadic (2+) | No |
159
+ | `or` | variadic (2+) | No |
160
+ | `implies` | binary (2) | Yes |
161
+ | `iff` | binary (2) | Yes |
162
+
163
+ **Permitted `updateExpression` swaps:** `and` <-> `or`, `implies` <-> `iff`. `not` cannot be changed.
164
+
165
+ ---
166
+
167
+ ## 6. Evaluation Types
168
+
169
+ **Source:** `src/lib/types/evaluation.ts`
170
+
171
+ ### Core value types
172
+
173
+ ```typescript
174
+ type TCoreTrivalentValue = boolean | null // null = unknown/unset
175
+ type TCoreVariableAssignment = Record<string, TCoreTrivalentValue> // variable ID -> value
176
+ ```
177
+
178
+ ### `TCoreExpressionAssignment`
179
+
180
+ Input to `evaluate()` methods.
181
+
182
+ ```typescript
183
+ interface TCoreExpressionAssignment {
184
+ variables: TCoreVariableAssignment
185
+ rejectedExpressionIds: string[] // these evaluate to false, children skipped
186
+ }
187
+ ```
188
+
189
+ ### `TCoreValidationResult` / `TCoreValidationIssue`
190
+
191
+ ```typescript
192
+ interface TCoreValidationResult {
193
+ ok: boolean
194
+ issues: TCoreValidationIssue[]
195
+ }
196
+
197
+ interface TCoreValidationIssue {
198
+ code: TCoreValidationCode
199
+ severity: "error" | "warning"
200
+ message: string
201
+ premiseId?: string
202
+ expressionId?: string
203
+ variableId?: string
204
+ }
205
+ ```
206
+
207
+ ### `TCoreValidationCode`
208
+
209
+ Machine-readable strings:
210
+
211
+ - `ARGUMENT_NO_CONCLUSION`, `ARGUMENT_CONCLUSION_NOT_FOUND`
212
+ - `ARGUMENT_VARIABLE_ID_SYMBOL_MISMATCH`, `ARGUMENT_VARIABLE_SYMBOL_AMBIGUOUS`
213
+ - `PREMISE_EMPTY`, `PREMISE_ROOT_MISSING`, `PREMISE_ROOT_MISMATCH`
214
+ - `EXPR_CHILD_COUNT_INVALID`, `EXPR_BINARY_POSITIONS_INVALID`, `EXPR_VARIABLE_UNDECLARED`
215
+ - `ASSIGNMENT_MISSING_VARIABLE`, `ASSIGNMENT_UNKNOWN_VARIABLE`
216
+
217
+ ### `TCorePremiseEvaluationResult`
218
+
219
+ Returned per-premise by `ArgumentEngine.evaluate()`.
220
+
221
+ ```typescript
222
+ interface TCorePremiseEvaluationResult {
223
+ premiseId: string
224
+ premiseType: "inference" | "constraint"
225
+ rootExpressionId?: string
226
+ rootValue?: TCoreTrivalentValue
227
+ expressionValues: Record<string, TCoreTrivalentValue>
228
+ variableValues: Record<string, TCoreTrivalentValue>
229
+ inferenceDiagnostic?: TCorePremiseInferenceDiagnostic
230
+ }
231
+ ```
232
+
233
+ ### `TCorePremiseInferenceDiagnostic`
234
+
235
+ Discriminated union on `kind`:
236
+
237
+ - `kind: "implies"` -- has `leftValue`, `rightValue`, `rootValue`, `antecedentTrue`, `consequentTrue`, `isVacuouslyTrue`, `fired`, `firedAndHeld`
238
+ - `kind: "iff"` -- has `leftValue`, `rightValue`, `rootValue`, `leftToRight: TCoreDirectionalVacuity`, `rightToLeft: TCoreDirectionalVacuity`, `bothSidesTrue`, `bothSidesFalse`
239
+
240
+ Both variants include `premiseId` and `rootExpressionId`.
241
+
242
+ ### `TCoreDirectionalVacuity`
243
+
244
+ ```typescript
245
+ interface TCoreDirectionalVacuity {
246
+ antecedentTrue: TCoreTrivalentValue
247
+ consequentTrue: TCoreTrivalentValue
248
+ implicationValue: TCoreTrivalentValue
249
+ isVacuouslyTrue: TCoreTrivalentValue
250
+ fired: TCoreTrivalentValue
251
+ }
252
+ ```
253
+
254
+ ### `TCoreArgumentEvaluationResult`
255
+
256
+ Top-level result from `ArgumentEngine.evaluate()`.
257
+
258
+ ```typescript
259
+ interface TCoreArgumentEvaluationResult {
260
+ ok: boolean
261
+ validation?: TCoreValidationResult
262
+ assignment?: TCoreExpressionAssignment
263
+ referencedVariableIds?: string[]
264
+ conclusion?: TCorePremiseEvaluationResult
265
+ supportingPremises?: TCorePremiseEvaluationResult[]
266
+ constraintPremises?: TCorePremiseEvaluationResult[]
267
+ isAdmissibleAssignment?: TCoreTrivalentValue
268
+ allSupportingPremisesTrue?: TCoreTrivalentValue
269
+ conclusionTrue?: TCoreTrivalentValue
270
+ isCounterexample?: TCoreTrivalentValue
271
+ preservesTruthUnderAssignment?: TCoreTrivalentValue
272
+ }
273
+ ```
274
+
275
+ ### `TCoreArgumentEvaluationOptions`
276
+
277
+ ```typescript
278
+ interface TCoreArgumentEvaluationOptions {
279
+ strictUnknownAssignmentKeys?: boolean
280
+ includeExpressionValues?: boolean
281
+ includeDiagnostics?: boolean
282
+ validateFirst?: boolean
283
+ }
284
+ ```
285
+
286
+ ### `TCoreValidityCheckResult`
287
+
288
+ Top-level result from `ArgumentEngine.checkValidity()`.
289
+
290
+ ```typescript
291
+ interface TCoreValidityCheckResult {
292
+ ok: boolean
293
+ validation?: TCoreValidationResult
294
+ isValid?: boolean
295
+ checkedVariableIds?: string[]
296
+ numAssignmentsChecked?: number
297
+ numAdmissibleAssignments?: number
298
+ counterexamples?: TCoreCounterexample[]
299
+ truncated?: boolean
300
+ }
301
+ ```
302
+
303
+ ### `TCoreCounterexample`
304
+
305
+ ```typescript
306
+ interface TCoreCounterexample {
307
+ assignment: TCoreExpressionAssignment
308
+ result: TCoreArgumentEvaluationResult
309
+ }
310
+ ```
311
+
312
+ ### `TCoreValidityCheckOptions`
313
+
314
+ ```typescript
315
+ interface TCoreValidityCheckOptions {
316
+ mode?: "firstCounterexample" | "exhaustive"
317
+ maxVariables?: number
318
+ maxAssignmentsChecked?: number
319
+ includeCounterexampleEvaluations?: boolean
320
+ validateFirst?: boolean
321
+ }
322
+ ```
323
+
324
+ ### `TCoreArgumentEngineData`
325
+
326
+ Returned by `ArgumentEngine.toData()`.
327
+
328
+ ```typescript
329
+ interface TCoreArgumentEngineData {
330
+ argument: TCoreArgument
331
+ premises: TCorePremise[]
332
+ roles: TCoreArgumentRoleState
333
+ }
334
+ ```
335
+
336
+ ---
337
+
338
+ ## 7. Mutation Types
339
+
340
+ **Source:** `src/lib/types/mutation.ts`
341
+
342
+ ### `TCoreMutationResult<T>`
343
+
344
+ Wrapper returned by all mutating methods on `PremiseManager` and `ArgumentEngine`.
345
+
346
+ ```typescript
347
+ interface TCoreMutationResult<T> {
348
+ result: T // direct answer (e.g. the removed expression)
349
+ changes: TCoreChangeset // all side effects
350
+ }
351
+ ```
352
+
353
+ ### `TCoreChangeset`
354
+
355
+ Only affected categories are present.
356
+
357
+ ```typescript
358
+ interface TCoreChangeset {
359
+ expressions?: TCoreEntityChanges<TCorePropositionalExpression>
360
+ variables?: TCoreEntityChanges<TCorePropositionalVariable>
361
+ premises?: TCoreEntityChanges<TCorePremise>
362
+ roles?: TCoreArgumentRoleState // new role state (present only when roles changed)
363
+ argument?: TCoreArgument // new argument (present only when argument changed)
364
+ }
365
+ ```
366
+
367
+ ### `TCoreEntityChanges<T>`
368
+
369
+ ```typescript
370
+ interface TCoreEntityChanges<T> {
371
+ added: T[]
372
+ modified: T[]
373
+ removed: T[]
374
+ }
375
+ ```
376
+
377
+ ### `TCoreRawChangeset` (internal)
378
+
379
+ Same shape as `TCoreChangeset` but uses `TExpressionInput` and `TVariableInput` (no checksums). Used internally by `ChangeCollector`; converted to `TCoreChangeset` via `attachChangesetChecksums()` before returning to callers.
380
+
381
+ ---
382
+
383
+ ## 8. Diff Types
384
+
385
+ **Source:** `src/lib/types/diff.ts`
386
+
387
+ ### `TCoreArgumentDiff`
388
+
389
+ Top-level result from `diffArguments(engineA, engineB, options?)`.
390
+
391
+ ```typescript
392
+ interface TCoreArgumentDiff {
393
+ argument: TCoreEntityFieldDiff<TCoreArgument>
394
+ variables: TCoreEntitySetDiff<TCorePropositionalVariable>
395
+ premises: TCorePremiseSetDiff
396
+ roles: TCoreRoleDiff
397
+ }
398
+ ```
399
+
400
+ ### `TCoreFieldChange`
401
+
402
+ ```typescript
403
+ interface TCoreFieldChange {
404
+ field: string
405
+ before: unknown
406
+ after: unknown
407
+ }
408
+ ```
409
+
410
+ ### `TCoreEntityFieldDiff<T>`
411
+
412
+ Field-level diff for a single matched entity.
413
+
414
+ ```typescript
415
+ interface TCoreEntityFieldDiff<T> {
416
+ before: T
417
+ after: T
418
+ changes: TCoreFieldChange[]
419
+ }
420
+ ```
421
+
422
+ ### `TCoreEntitySetDiff<T>`
423
+
424
+ Set-level diff for a collection of ID-keyed entities.
425
+
426
+ ```typescript
427
+ interface TCoreEntitySetDiff<T extends { id: string }> {
428
+ added: T[]
429
+ removed: T[]
430
+ modified: TCoreEntityFieldDiff<T>[]
431
+ }
432
+ ```
433
+
434
+ ### `TCorePremiseDiff`
435
+
436
+ Extends `TCoreEntityFieldDiff<TCorePremise>` with nested expression diffs.
437
+
438
+ ```typescript
439
+ interface TCorePremiseDiff extends TCoreEntityFieldDiff<TCorePremise> {
440
+ expressions: TCoreEntitySetDiff<TCorePropositionalExpression>
441
+ }
442
+ ```
443
+
444
+ ### `TCorePremiseSetDiff`
445
+
446
+ ```typescript
447
+ interface TCorePremiseSetDiff {
448
+ added: TCorePremise[]
449
+ removed: TCorePremise[]
450
+ modified: TCorePremiseDiff[]
451
+ }
452
+ ```
453
+
454
+ ### `TCoreRoleDiff`
455
+
456
+ ```typescript
457
+ interface TCoreRoleDiff {
458
+ conclusion: { before: string | undefined; after: string | undefined }
459
+ }
460
+ ```
461
+
462
+ ### `TCoreFieldComparator<T>`
463
+
464
+ ```typescript
465
+ type TCoreFieldComparator<T> = (before: T, after: T) => TCoreFieldChange[]
466
+ ```
467
+
468
+ ### `TCoreDiffOptions`
469
+
470
+ Per-entity comparator overrides for `diffArguments`.
471
+
472
+ ```typescript
473
+ interface TCoreDiffOptions {
474
+ compareArgument?: TCoreFieldComparator<TCoreArgument>
475
+ compareVariable?: TCoreFieldComparator<TCorePropositionalVariable>
476
+ comparePremise?: TCoreFieldComparator<TCorePremise>
477
+ compareExpression?: TCoreFieldComparator<TCorePropositionalExpression>
478
+ }
479
+ ```
480
+
481
+ ---
482
+
483
+ ## 9. Relationship Types
484
+
485
+ **Source:** `src/lib/types/relationships.ts`
486
+
487
+ ### `TCoreVariableAppearance`
488
+
489
+ ```typescript
490
+ interface TCoreVariableAppearance {
491
+ variableId: string
492
+ side: "antecedent" | "consequent" // TCorePremiseSide
493
+ polarity: "positive" | "negative" // TCoreVariablePolarity
494
+ }
495
+ ```
496
+
497
+ ### `TCorePremiseProfile`
498
+
499
+ Returned by `buildPremiseProfile()`.
500
+
501
+ ```typescript
502
+ interface TCorePremiseProfile {
503
+ premiseId: string
504
+ isInference: boolean
505
+ appearances: TCoreVariableAppearance[]
506
+ }
507
+ ```
508
+
509
+ ### `TCorePremiseRelationshipType`
510
+
511
+ ```typescript
512
+ type TCorePremiseRelationshipType =
513
+ | "supporting"
514
+ | "contradicting"
515
+ | "restricting"
516
+ | "downstream"
517
+ | "unrelated"
518
+ ```
519
+
520
+ ### `TCoreVariableRelationship`
521
+
522
+ ```typescript
523
+ interface TCoreVariableRelationship {
524
+ variableId: string
525
+ relationship: "supporting" | "contradicting" | "restricting"
526
+ }
527
+ ```
528
+
529
+ ### `TCorePremiseRelationResult`
530
+
531
+ ```typescript
532
+ interface TCorePremiseRelationResult {
533
+ premiseId: string
534
+ relationship: TCorePremiseRelationshipType
535
+ variableDetails: TCoreVariableRelationship[]
536
+ transitive: boolean
537
+ }
538
+ ```
539
+
540
+ ### `TCorePremiseRelationshipAnalysis`
541
+
542
+ Top-level result from `analyzePremiseRelationships()`.
543
+
544
+ ```typescript
545
+ interface TCorePremiseRelationshipAnalysis {
546
+ focusedPremiseId: string
547
+ premises: TCorePremiseRelationResult[]
548
+ }
549
+ ```
550
+
551
+ ---
552
+
553
+ ## 10. Checksum Types
554
+
555
+ **Source:** `src/lib/types/checksum.ts`, `src/lib/consts.ts`
556
+
557
+ ### `TCoreChecksumConfig`
558
+
559
+ ```typescript
560
+ interface TCoreChecksumConfig {
561
+ expressionFields?: Set<string>
562
+ variableFields?: Set<string>
563
+ premiseFields?: Set<string>
564
+ argumentFields?: Set<string>
565
+ roleFields?: Set<string>
566
+ }
567
+ ```
568
+
569
+ ### `DEFAULT_CHECKSUM_CONFIG`
570
+
571
+ ```typescript
572
+ {
573
+ expressionFields: Set(["id", "type", "parentId", "position", "argumentId", "argumentVersion", "variableId", "operator"]),
574
+ variableFields: Set(["id", "symbol", "argumentId", "argumentVersion"]),
575
+ premiseFields: Set(["id", "rootExpressionId"]),
576
+ argumentFields: Set(["id", "version"]),
577
+ roleFields: Set(["conclusionPremiseId"]),
578
+ }
579
+ ```
580
+
581
+ ### `createChecksumConfig(additional)`
582
+
583
+ Merges additional fields into defaults (union, not replace). Pass to `ArgumentEngine` constructor via `options.checksumConfig`.
584
+
585
+ ---
586
+
587
+ ## 11. Analysis File Type
588
+
589
+ **Source:** `src/lib/schemata/analysis.ts`
590
+
591
+ ### `TCoreAnalysisFile`
592
+
593
+ ```typescript
594
+ interface TCoreAnalysisFile {
595
+ argumentId: string
596
+ argumentVersion: number
597
+ assignments: Record<string, boolean | null> // variable symbol -> value
598
+ rejectedExpressionIds: string[]
599
+ }
600
+ ```
601
+
602
+ Used by CLI analysis commands. Not directly used by the library API.
603
+
604
+ ---
605
+
606
+ ## 12. Formula Parser Types
607
+
608
+ **Source:** `src/lib/core/parser/formula.ts`
609
+
610
+ ### `FormulaAST`
611
+
612
+ Returned by `parseFormula(input)`.
613
+
614
+ ```typescript
615
+ type FormulaAST =
616
+ | { type: "variable"; name: string }
617
+ | { type: "not"; operand: FormulaAST }
618
+ | { type: "and"; operands: FormulaAST[] }
619
+ | { type: "or"; operands: FormulaAST[] }
620
+ | { type: "implies"; left: FormulaAST; right: FormulaAST }
621
+ | { type: "iff"; left: FormulaAST; right: FormulaAST }
622
+ ```
623
+
624
+ ---
625
+
626
+ ## 13. Position Constants
627
+
628
+ **Source:** `src/lib/utils/position.ts`
629
+
630
+ ```typescript
631
+ const POSITION_MIN = 0
632
+ const POSITION_MAX = Number.MAX_SAFE_INTEGER // 9007199254740991
633
+ const POSITION_INITIAL = Math.floor(POSITION_MAX / 2) // 4503599627370495
634
+ function midpoint(a: number, b: number): number // a + (b - a) / 2
635
+ ```
636
+
637
+ Used internally for sibling ordering. Callers typically use `appendExpression` or `addExpressionRelative` rather than computing positions directly.
638
+
639
+ ---
640
+
641
+ ## 14. Schema System Notes
642
+
643
+ - **Typebox-based.** Schemas defined with `Type.*` from `@sinclair/typebox`. Types extracted via `Static<typeof Schema>`.
644
+ - **Validation:** `Value.Parse(Schema, raw)` from `@sinclair/typebox/value` throws on invalid data. `Value.Check` returns `boolean`.
645
+ - **`additionalProperties: true`** on `CorePropositionalVariableSchema`, `CorePremiseSchema`, and `CoreArgumentSchema`. Extra fields survive round-trips through `Value.Parse`.
646
+ - **Expression schemas** use `Type.Interface` (intersection-like) to extend the base schema. They do not set `additionalProperties`.
647
+ - **`Nullable(T)`** helper produces `Type.Union([T, Type.Null()])` with `default: null`.
648
+ - **`UUID`** is `Type.String()` (no format enforcement at the schema level).