@proposit/proposit-core 0.12.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/README.md +104 -93
  2. package/dist/cli/commands/premises.d.ts.map +1 -1
  3. package/dist/cli/commands/premises.js +28 -24
  4. package/dist/cli/commands/premises.js.map +1 -1
  5. package/dist/cli/commands/repair.d.ts.map +1 -1
  6. package/dist/cli/commands/repair.js +4 -2
  7. package/dist/cli/commands/repair.js.map +1 -1
  8. package/dist/cli/commands/validate.d.ts.map +1 -1
  9. package/dist/cli/commands/validate.js +7 -1
  10. package/dist/cli/commands/validate.js.map +1 -1
  11. package/dist/cli/engine.d.ts.map +1 -1
  12. package/dist/cli/engine.js +7 -25
  13. package/dist/cli/engine.js.map +1 -1
  14. package/dist/cli/import.d.ts.map +1 -1
  15. package/dist/cli/import.js +66 -28
  16. package/dist/cli/import.js.map +1 -1
  17. package/dist/cli/schemata.d.ts.map +1 -1
  18. package/dist/cli/schemata.js +4 -3
  19. package/dist/cli/schemata.js.map +1 -1
  20. package/dist/extensions/basics/schemata.d.ts +56 -2
  21. package/dist/extensions/basics/schemata.d.ts.map +1 -1
  22. package/dist/extensions/basics/schemata.js +54 -23
  23. package/dist/extensions/basics/schemata.js.map +1 -1
  24. package/dist/lib/core/argument-engine.d.ts +275 -10
  25. package/dist/lib/core/argument-engine.d.ts.map +1 -1
  26. package/dist/lib/core/argument-engine.js +442 -82
  27. package/dist/lib/core/argument-engine.js.map +1 -1
  28. package/dist/lib/core/argument-library.d.ts +5 -1
  29. package/dist/lib/core/argument-library.d.ts.map +1 -1
  30. package/dist/lib/core/argument-library.js +7 -3
  31. package/dist/lib/core/argument-library.js.map +1 -1
  32. package/dist/lib/core/claim-axiom-library.d.ts +3 -3
  33. package/dist/lib/core/claim-axiom-library.d.ts.map +1 -1
  34. package/dist/lib/core/claim-axiom-library.js +2 -2
  35. package/dist/lib/core/claim-axiom-library.js.map +1 -1
  36. package/dist/lib/core/claim-citation-library.d.ts +3 -3
  37. package/dist/lib/core/claim-citation-library.d.ts.map +1 -1
  38. package/dist/lib/core/claim-citation-library.js +2 -2
  39. package/dist/lib/core/claim-citation-library.js.map +1 -1
  40. package/dist/lib/core/expression-manager.d.ts +68 -73
  41. package/dist/lib/core/expression-manager.d.ts.map +1 -1
  42. package/dist/lib/core/expression-manager.js +242 -762
  43. package/dist/lib/core/expression-manager.js.map +1 -1
  44. package/dist/lib/core/fork.d.ts +5 -1
  45. package/dist/lib/core/fork.d.ts.map +1 -1
  46. package/dist/lib/core/fork.js +16 -6
  47. package/dist/lib/core/fork.js.map +1 -1
  48. package/dist/lib/core/interfaces/argument-engine.interfaces.d.ts +68 -7
  49. package/dist/lib/core/interfaces/argument-engine.interfaces.d.ts.map +1 -1
  50. package/dist/lib/core/interfaces/library.interfaces.d.ts +9 -6
  51. package/dist/lib/core/interfaces/library.interfaces.d.ts.map +1 -1
  52. package/dist/lib/core/interfaces/premise-engine.interfaces.d.ts +50 -47
  53. package/dist/lib/core/interfaces/premise-engine.interfaces.d.ts.map +1 -1
  54. package/dist/lib/core/premise-engine.d.ts +80 -11
  55. package/dist/lib/core/premise-engine.d.ts.map +1 -1
  56. package/dist/lib/core/premise-engine.js +232 -80
  57. package/dist/lib/core/premise-engine.js.map +1 -1
  58. package/dist/lib/core/proposit-core.d.ts +5 -5
  59. package/dist/lib/core/proposit-core.d.ts.map +1 -1
  60. package/dist/lib/core/proposit-core.js +13 -3
  61. package/dist/lib/core/proposit-core.js.map +1 -1
  62. package/dist/lib/grammar/an-rules.d.ts +158 -0
  63. package/dist/lib/grammar/an-rules.d.ts.map +1 -0
  64. package/dist/lib/grammar/an-rules.js +778 -0
  65. package/dist/lib/grammar/an-rules.js.map +1 -0
  66. package/dist/lib/grammar/auto-normalize.d.ts +14 -0
  67. package/dist/lib/grammar/auto-normalize.d.ts.map +1 -0
  68. package/dist/lib/grammar/auto-normalize.js +35 -0
  69. package/dist/lib/grammar/auto-normalize.js.map +1 -0
  70. package/dist/lib/grammar/bounded-subtree.d.ts +30 -0
  71. package/dist/lib/grammar/bounded-subtree.d.ts.map +1 -0
  72. package/dist/lib/grammar/bounded-subtree.js +74 -0
  73. package/dist/lib/grammar/bounded-subtree.js.map +1 -0
  74. package/dist/lib/grammar/naked-q.d.ts +20 -0
  75. package/dist/lib/grammar/naked-q.d.ts.map +1 -0
  76. package/dist/lib/grammar/naked-q.js +58 -0
  77. package/dist/lib/grammar/naked-q.js.map +1 -0
  78. package/dist/lib/grammar/normalize.d.ts +12 -0
  79. package/dist/lib/grammar/normalize.d.ts.map +1 -0
  80. package/dist/lib/grammar/normalize.js +45 -0
  81. package/dist/lib/grammar/normalize.js.map +1 -0
  82. package/dist/lib/grammar/populate-from.d.ts +25 -0
  83. package/dist/lib/grammar/populate-from.d.ts.map +1 -0
  84. package/dist/lib/grammar/populate-from.js +252 -0
  85. package/dist/lib/grammar/populate-from.js.map +1 -0
  86. package/dist/lib/grammar/repair.d.ts +65 -0
  87. package/dist/lib/grammar/repair.d.ts.map +1 -0
  88. package/dist/lib/grammar/repair.js +251 -0
  89. package/dist/lib/grammar/repair.js.map +1 -0
  90. package/dist/lib/grammar/types.d.ts +17 -0
  91. package/dist/lib/grammar/types.d.ts.map +1 -0
  92. package/dist/lib/grammar/types.js +82 -0
  93. package/dist/lib/grammar/types.js.map +1 -0
  94. package/dist/lib/grammar/validate.d.ts +4 -0
  95. package/dist/lib/grammar/validate.d.ts.map +1 -0
  96. package/dist/lib/grammar/validate.js +28 -0
  97. package/dist/lib/grammar/validate.js.map +1 -0
  98. package/dist/lib/grammar/validators/context.d.ts +11 -0
  99. package/dist/lib/grammar/validators/context.d.ts.map +1 -0
  100. package/dist/lib/grammar/validators/context.js +5 -0
  101. package/dist/lib/grammar/validators/context.js.map +1 -0
  102. package/dist/lib/grammar/validators/derivable.d.ts +63 -0
  103. package/dist/lib/grammar/validators/derivable.d.ts.map +1 -0
  104. package/dist/lib/grammar/validators/derivable.js +502 -0
  105. package/dist/lib/grammar/validators/derivable.js.map +1 -0
  106. package/dist/lib/grammar/validators/evaluable.d.ts +48 -0
  107. package/dist/lib/grammar/validators/evaluable.d.ts.map +1 -0
  108. package/dist/lib/grammar/validators/evaluable.js +226 -0
  109. package/dist/lib/grammar/validators/evaluable.js.map +1 -0
  110. package/dist/lib/grammar/validators/presentable.d.ts +45 -0
  111. package/dist/lib/grammar/validators/presentable.d.ts.map +1 -0
  112. package/dist/lib/grammar/validators/presentable.js +231 -0
  113. package/dist/lib/grammar/validators/presentable.js.map +1 -0
  114. package/dist/lib/grammar/validators/structural.d.ts +103 -0
  115. package/dist/lib/grammar/validators/structural.d.ts.map +1 -0
  116. package/dist/lib/grammar/validators/structural.js +602 -0
  117. package/dist/lib/grammar/validators/structural.js.map +1 -0
  118. package/dist/lib/index.d.ts +4 -3
  119. package/dist/lib/index.d.ts.map +1 -1
  120. package/dist/lib/index.js +2 -2
  121. package/dist/lib/index.js.map +1 -1
  122. package/dist/lib/parsing/argument-parser.d.ts +8 -5
  123. package/dist/lib/parsing/argument-parser.d.ts.map +1 -1
  124. package/dist/lib/parsing/argument-parser.js +204 -42
  125. package/dist/lib/parsing/argument-parser.js.map +1 -1
  126. package/dist/lib/parsing/clamp-max-lengths.d.ts.map +1 -1
  127. package/dist/lib/parsing/clamp-max-lengths.js +10 -4
  128. package/dist/lib/parsing/clamp-max-lengths.js.map +1 -1
  129. package/dist/lib/parsing/prompt-builder.d.ts.map +1 -1
  130. package/dist/lib/parsing/prompt-builder.js +13 -15
  131. package/dist/lib/parsing/prompt-builder.js.map +1 -1
  132. package/dist/lib/parsing/schemata.d.ts +0 -3
  133. package/dist/lib/parsing/schemata.d.ts.map +1 -1
  134. package/dist/lib/parsing/schemata.js +25 -13
  135. package/dist/lib/parsing/schemata.js.map +1 -1
  136. package/dist/lib/parsing/types.d.ts +1 -1
  137. package/dist/lib/parsing/types.d.ts.map +1 -1
  138. package/dist/lib/schemata/claim.d.ts +8 -0
  139. package/dist/lib/schemata/claim.d.ts.map +1 -1
  140. package/dist/lib/schemata/claim.js +17 -7
  141. package/dist/lib/schemata/claim.js.map +1 -1
  142. package/dist/lib/schemata/import.d.ts.map +1 -1
  143. package/dist/lib/schemata/import.js +2 -5
  144. package/dist/lib/schemata/import.js.map +1 -1
  145. package/dist/lib/schemata/index.d.ts +0 -2
  146. package/dist/lib/schemata/index.d.ts.map +1 -1
  147. package/dist/lib/schemata/index.js +0 -2
  148. package/dist/lib/schemata/index.js.map +1 -1
  149. package/dist/lib/types/evaluation.d.ts +1 -1
  150. package/dist/lib/types/evaluation.d.ts.map +1 -1
  151. package/dist/lib/types/fork.d.ts +12 -3
  152. package/dist/lib/types/fork.d.ts.map +1 -1
  153. package/dist/lib/types/validation.d.ts +0 -6
  154. package/dist/lib/types/validation.d.ts.map +1 -1
  155. package/dist/lib/types/validation.js +23 -6
  156. package/dist/lib/types/validation.js.map +1 -1
  157. package/dist/lib/utils/lookup.d.ts +2 -2
  158. package/dist/lib/utils/lookup.js +2 -2
  159. package/package.json +1 -1
  160. package/dist/lib/core/managed-derivation-premise-engine.d.ts +0 -172
  161. package/dist/lib/core/managed-derivation-premise-engine.d.ts.map +0 -1
  162. package/dist/lib/core/managed-derivation-premise-engine.js +0 -550
  163. package/dist/lib/core/managed-derivation-premise-engine.js.map +0 -1
  164. package/dist/lib/schemata/claim-axiom.d.ts +0 -11
  165. package/dist/lib/schemata/claim-axiom.d.ts.map +0 -1
  166. package/dist/lib/schemata/claim-axiom.js +0 -9
  167. package/dist/lib/schemata/claim-axiom.js.map +0 -1
  168. package/dist/lib/schemata/claim-citation.d.ts +0 -11
  169. package/dist/lib/schemata/claim-citation.d.ts.map +0 -1
  170. package/dist/lib/schemata/claim-citation.js +0 -9
  171. package/dist/lib/schemata/claim-citation.js.map +0 -1
  172. package/dist/lib/types/grammar.d.ts +0 -83
  173. package/dist/lib/types/grammar.d.ts.map +0 -1
  174. package/dist/lib/types/grammar.js +0 -24
  175. package/dist/lib/types/grammar.js.map +0 -1
@@ -1,550 +0,0 @@
1
- import {} from "../schemata/index.js";
2
- import { PremiseEngine } from "./premise-engine.js";
3
- import { VariableManager } from "./variable-manager.js";
4
- import { defaultGenerateId, } from "./argument-engine.js";
5
- import {} from "../types/grammar.js";
6
- import { DERIVATION_TYPE_MISMATCH, DERIVATION_STRUCTURE_INVALID, DERIVATION_CONSEQUENT_LOCKED, DERIVATION_ROOT_OPERATOR_INVALID, DERIVATION_ANTECEDENT_NON_EMPTY, } from "../types/validation.js";
7
- import { InvariantViolationError } from "./invariant-violation-error.js";
8
- import { validateDerivationStructure } from "../utils/derivation-validation.js";
9
- /**
10
- * A managed engine for derivation premises that enforces structural rules
11
- * from the v0.11.0 spec on construction and on snapshot restoration.
12
- *
13
- * Construction validates the premise type (`DERIVATION_TYPE_MISMATCH` if the
14
- * premise isn't `type: "derivation"`). Full expression-tree structural
15
- * validation (`DERIVATION_STRUCTURE_INVALID`) runs in `fromSnapshot` — after
16
- * expressions are loaded — and will be called from mutation overrides in
17
- * Task 6.
18
- *
19
- * Note: The constructor only validates the premise type, not the expression
20
- * tree, because `PremiseEngine` is always constructed before expressions are
21
- * loaded (expressions are added separately via mutations or `loadExpressions`).
22
- * Structural validation at the end of `fromSnapshot` catches tampered
23
- * snapshots, and Task 6 mutation overrides will enforce it on every change.
24
- *
25
- * The classic `PremiseEngine` is permissive and allows mutations that leave a
26
- * derivation premise temporarily or permanently invalid. The managed engine
27
- * wraps it for safe, structurally-enforced editing.
28
- *
29
- * Use `ManagedDerivationPremiseEngine.fromSnapshot(...)` to restore from a
30
- * serialized snapshot — the validation pass catches tampered snapshots.
31
- */
32
- export class ManagedDerivationPremiseEngine extends PremiseEngine {
33
- /**
34
- * Captured from `config.generateId` (or the default UUID generator) for
35
- * use in `populateFromSupports`, which needs to mint new expression IDs.
36
- * Stored separately because `PremiseEngine`'s generateId is private.
37
- * Not `readonly` because `fromSnapshot` re-injects it after the prototype
38
- * upgrade.
39
- */
40
- generateIdFn;
41
- constructor(premise, deps, config) {
42
- super(premise, deps, config);
43
- this.generateIdFn = config?.generateId ?? defaultGenerateId;
44
- // Validate premise type immediately — no expressions needed.
45
- // Structural validation (assertWellFormed) is deferred to fromSnapshot
46
- // and mutation overrides because PremiseEngine is always constructed
47
- // before expressions are loaded.
48
- this.assertDerivationType();
49
- }
50
- /**
51
- * Restore a `ManagedDerivationPremiseEngine` from a serialized snapshot,
52
- * applying both derivation-type and structural validation. Throws on
53
- * tampered or structurally invalid snapshots.
54
- *
55
- * Delegates to `PremiseEngine.fromSnapshot` for the full restoration logic
56
- * (including the private `rebuildVariableIndex` pass), then upgrades the
57
- * prototype and validates. TypeScript's static methods do not support
58
- * `super`, so the parent is called by name and the result is recast.
59
- */
60
- static fromSnapshot(snapshot, argument, variables, expressionIndex, grammarConfig, generateId) {
61
- // Validate type before doing the full restore work.
62
- const premiseType = snapshot.premise.type;
63
- if (premiseType !== "derivation") {
64
- throw new InvariantViolationError([
65
- {
66
- code: DERIVATION_TYPE_MISMATCH,
67
- message: `${DERIVATION_TYPE_MISMATCH}: ManagedDerivationPremiseEngine requires a premise with type "derivation" (got "${premiseType}")`,
68
- entityType: "premise",
69
- entityId: snapshot.premise.id,
70
- },
71
- ]);
72
- }
73
- // Delegate to the parent's static fromSnapshot to get a fully restored
74
- // engine, including the private rebuildVariableIndex pass.
75
- const pe = PremiseEngine.fromSnapshot(snapshot, argument, variables, expressionIndex, grammarConfig, generateId);
76
- // Upgrade the instance prototype so it becomes a
77
- // ManagedDerivationPremiseEngine with all subclass methods available.
78
- Object.setPrototypeOf(pe, ManagedDerivationPremiseEngine.prototype);
79
- const engine = pe;
80
- // Inject the generateId captured from config (or the default) so that
81
- // populateFromSupports can mint new expression IDs.
82
- engine.generateIdFn = generateId ?? defaultGenerateId;
83
- // Validate the full tree — expressions are fully loaded at this point.
84
- // (Type was already checked at the top before delegating to the parent.)
85
- engine.assertWellFormed();
86
- return engine;
87
- }
88
- /**
89
- * Validate that the wrapped premise has `type === "derivation"`.
90
- * @throws InvariantViolationError with code `DERIVATION_TYPE_MISMATCH`
91
- */
92
- assertDerivationType() {
93
- const premise = this.premise;
94
- if (premise.type !== "derivation") {
95
- throw new InvariantViolationError([
96
- {
97
- code: DERIVATION_TYPE_MISMATCH,
98
- message: `${DERIVATION_TYPE_MISMATCH}: ManagedDerivationPremiseEngine requires a premise with type "derivation" (got "${premise.type}")`,
99
- entityType: "premise",
100
- entityId: premise.id,
101
- },
102
- ]);
103
- }
104
- }
105
- /**
106
- * Validate that the expression tree conforms to the derivation rules from
107
- * the v0.11.0 spec (naked-Q or IMPLIES/IFF with Q as consequent).
108
- * @throws InvariantViolationError with code `DERIVATION_STRUCTURE_INVALID`
109
- */
110
- assertWellFormed() {
111
- const result = validateDerivationStructure(this.premise, this.expressions.toArray(), this.variables.toArray());
112
- if (result.violations.length > 0) {
113
- // Prefix each violation message with the code so the thrown Error's
114
- // message text is searchable by code (InvariantViolationError uses
115
- // violations[0].message as the Error message when there is exactly
116
- // one violation).
117
- const prefixed = result.violations.map((v) => ({
118
- ...v,
119
- message: `${DERIVATION_STRUCTURE_INVALID}: ${v.message}`,
120
- }));
121
- throw new InvariantViolationError(prefixed);
122
- }
123
- }
124
- // -------------------------------------------------------------------------
125
- // Mutation overrides — enforce derivation invariants on every change
126
- // -------------------------------------------------------------------------
127
- addExpression(expression) {
128
- const result = super.addExpression(expression);
129
- this.assertWellFormed();
130
- return result;
131
- }
132
- appendExpression(parentId, expression) {
133
- const result = super.appendExpression(parentId, expression);
134
- this.assertWellFormed();
135
- return result;
136
- }
137
- addExpressionRelative(siblingId, relativePosition, expression) {
138
- const result = super.addExpressionRelative(siblingId, relativePosition, expression);
139
- this.assertWellFormed();
140
- return result;
141
- }
142
- updateExpression(expressionId, updates) {
143
- this.assertConsequentNotMutated(expressionId, updates);
144
- const result = super.updateExpression(expressionId, updates);
145
- this.assertWellFormed();
146
- return result;
147
- }
148
- removeExpression(expressionId, deleteSubtree) {
149
- this.assertNotConsequentExpression(expressionId);
150
- const result = super.removeExpression(expressionId, deleteSubtree);
151
- this.assertWellFormed();
152
- return result;
153
- }
154
- insertExpression(expression, leftNodeId, rightNodeId) {
155
- this.assertNotConsequentSlot(expression);
156
- const result = super.insertExpression(expression, leftNodeId, rightNodeId);
157
- this.assertWellFormed();
158
- return result;
159
- }
160
- toggleNegation(expressionId, extraFields) {
161
- this.assertNotConsequentExpression(expressionId);
162
- const result = super.toggleNegation(expressionId, extraFields);
163
- this.assertWellFormed();
164
- return result;
165
- }
166
- wrapExpression(operator, newSibling, leftNodeId, rightNodeId) {
167
- // wrapExpression rejects calls without exactly one of leftNodeId/rightNodeId,
168
- // so the !-assertion is safe: at least one of the two is always defined here.
169
- this.assertNotConsequentExpression((leftNodeId ?? rightNodeId));
170
- const result = super.wrapExpression(operator, newSibling, leftNodeId, rightNodeId);
171
- this.assertWellFormed();
172
- return result;
173
- }
174
- changeOperator(expressionId, newOperator, sourceChildId, targetChildId, extraFields) {
175
- this.assertRootOperatorChangeValid(expressionId, newOperator);
176
- const result = super.changeOperator(expressionId, newOperator, sourceChildId, targetChildId, extraFields);
177
- this.assertWellFormed();
178
- return result;
179
- }
180
- normalizeExpressions() {
181
- const result = super.normalizeExpressions();
182
- // Post-validate: normalization could destroy the consequent structure.
183
- // assertWellFormed throws DERIVATION_STRUCTURE_INVALID if so.
184
- this.assertWellFormed();
185
- return result;
186
- }
187
- loadExpressions(expressions) {
188
- // Pre-validate the proposed expression set BEFORE mutation because
189
- // loadExpressions is a bulk replace — we need to reject the whole set
190
- // atomically rather than rolling back after the fact.
191
- const premise = this.premise;
192
- const validationResult = validateDerivationStructure(premise,
193
- // TExpressionInput strips checksum fields, but validateDerivationStructure
194
- // only reads parentId, type, variableId, operator, position, premiseId —
195
- // all of which are present on TExpressionInput.
196
- expressions, this.variables.toArray());
197
- if (validationResult.violations.length > 0) {
198
- const prefixed = validationResult.violations.map((v) => ({
199
- ...v,
200
- message: `${DERIVATION_STRUCTURE_INVALID}: ${v.message}`,
201
- }));
202
- throw new InvariantViolationError(prefixed);
203
- }
204
- super.loadExpressions(expressions);
205
- }
206
- // -------------------------------------------------------------------------
207
- // Public one-shot helpers
208
- // -------------------------------------------------------------------------
209
- /**
210
- * One-shot helper that builds the antecedent of this derivation premise
211
- * from the current global support (citations + axiom invocations) of the
212
- * derived claim.
213
- *
214
- * Behavior by total support count `n = citations + axioms`:
215
- * - n = 0: no change. Premise stays in its current form (typically
216
- * naked-Q, indicating "no support given").
217
- * - n = 1: `IMPLIES(VarExpr(S1), Q)`.
218
- * - n ≥ 2: `IMPLIES(formula(OR(VarExpr(S1), …, VarExpr(Sn))), Q)`.
219
- * Citations come first, axioms second; source order preserved within
220
- * each. The formula buffer between IMPLIES and OR is auto-inserted by
221
- * the engine's standard grammar. A supporting claim referenced by
222
- * multiple connections — for example, two citations from this derived
223
- * claim to the same supporting claim — appears exactly once in the
224
- * antecedent, at its first source-order position.
225
- *
226
- * Materializes a claim-bound variable for each supporting claim via
227
- * `argumentEngine.ensureClaimBoundVariable(supportingClaimId)`.
228
- *
229
- * **Tree construction approach:** Mutations are performed via `super.*`
230
- * calls, bypassing this class's overrides (which call `assertWellFormed()`
231
- * after every mutation and would reject intermediate states during
232
- * multi-step construction). Standard grammar is used throughout — the
233
- * engine's `wrapInsertFormula` rule inserts a formula buffer between
234
- * IMPLIES and OR for n ≥ 2 automatically. `assertWellFormed()` is called
235
- * at the end to validate the final state.
236
- *
237
- * @throws InvariantViolationError(DERIVATION_ANTECEDENT_NON_EMPTY) when
238
- * the antecedent slot is already filled.
239
- *
240
- * @since 0.12.0
241
- */
242
- populateFromSupports(citationLib, axiomLib, argumentEngine) {
243
- const premise = this.premise;
244
- const derivedClaimId = premise.derivedClaimId;
245
- // 1. Reject if antecedent is already non-empty.
246
- const rootId = this.rootExpressionId;
247
- if (rootId !== undefined) {
248
- const root = this.expressions.getExpression(rootId);
249
- if (root &&
250
- root.type === "operator" &&
251
- (root.operator === "implies" || root.operator === "iff")) {
252
- // Sort children by position; lowest-position child is the antecedent.
253
- const children = this.expressions
254
- .getChildExpressions(rootId)
255
- .sort((a, b) => a.position - b.position);
256
- const antecedent = children[0];
257
- if (antecedent) {
258
- throw new InvariantViolationError([
259
- {
260
- code: DERIVATION_ANTECEDENT_NON_EMPTY,
261
- message: `${DERIVATION_ANTECEDENT_NON_EMPTY}: derivation premise already has a non-empty antecedent`,
262
- entityType: "premise",
263
- entityId: premise.id,
264
- premiseId: premise.id,
265
- },
266
- ]);
267
- }
268
- }
269
- }
270
- // 2. Collect supporting connections from both libraries (citations
271
- // first, axioms second; source order preserved within each).
272
- const citationConnections = citationLib.getConnectionsForClaim(derivedClaimId);
273
- const axiomConnections = axiomLib.getConnectionsForClaim(derivedClaimId);
274
- const totalCount = citationConnections.length + axiomConnections.length;
275
- if (totalCount === 0)
276
- return;
277
- // 3. Dedupe by supportingClaimId in source order: a claim referenced by
278
- // multiple connections (e.g., two citations from this derived claim to
279
- // the same supporting claim) contributes exactly one OR child. Citation
280
- // duplicates collapse first, then axiom duplicates collapse against the
281
- // citation set (axioms keep their relative order behind citations).
282
- const seenSupportingIds = new Set();
283
- const orderedSupportingIds = [];
284
- for (const conn of citationConnections) {
285
- if (!seenSupportingIds.has(conn.supportingClaimId)) {
286
- seenSupportingIds.add(conn.supportingClaimId);
287
- orderedSupportingIds.push(conn.supportingClaimId);
288
- }
289
- }
290
- for (const conn of axiomConnections) {
291
- if (!seenSupportingIds.has(conn.supportingClaimId)) {
292
- seenSupportingIds.add(conn.supportingClaimId);
293
- orderedSupportingIds.push(conn.supportingClaimId);
294
- }
295
- }
296
- // 4. Materialize claim-bound variables for each unique supporting claim.
297
- // ensureClaimBoundVariable is idempotent, but the array also being unique
298
- // ensures buildAntecedentFromSupportingVariables emits one OR child per
299
- // distinct supporting claim.
300
- const supportingVariables = orderedSupportingIds.map((claimId) => argumentEngine.ensureClaimBoundVariable(claimId));
301
- for (const sv of supportingVariables) {
302
- if (!this.variables.hasVariable(sv.id)) {
303
- this.variables.addVariable(sv);
304
- }
305
- }
306
- // 4. Build the antecedent expression tree.
307
- this.buildAntecedentFromSupportingVariables(supportingVariables);
308
- // 5. Validate the final tree is well-formed.
309
- this.assertWellFormed();
310
- }
311
- /**
312
- * Build the antecedent expression tree from a list of already-materialized
313
- * supporting variables. Shared between populate helpers.
314
- *
315
- * - n=0 → no-op (caller decides whether to leave the naked-Q form intact).
316
- * - n=1 → IMPLIES(VarExpr(S1), Q) using wrapExpression with rightNodeId=Q.
317
- * - n≥2 → IMPLIES(formula(OR(S1, ..., Sn)), Q) via wrapExpression + appendExpression.
318
- *
319
- * Uses `super.*` mutation calls to bypass this class's overrides during
320
- * multi-step construction. Caller is responsible for the final
321
- * `assertWellFormed()`.
322
- */
323
- buildAntecedentFromSupportingVariables(supportingVars) {
324
- if (supportingVars.length === 0)
325
- return;
326
- const argId = this.premise.argumentId;
327
- const argVersion = this.premise.argumentVersion;
328
- const premiseId = this.premise.id;
329
- // qRootExprId is the ID of the current naked-Q root variable expression.
330
- const qRootExprId = this.rootExpressionId;
331
- if (supportingVars.length === 1) {
332
- // n = 1: wrap naked-Q with IMPLIES using rightNodeId so that Q lands
333
- // at the midpoint (consequent) position and S1 lands at initial.
334
- const impliesId = this.generateIdFn();
335
- const s1ExprId = this.generateIdFn();
336
- const impliesOp = {
337
- id: impliesId,
338
- argumentId: argId,
339
- argumentVersion: argVersion,
340
- premiseId,
341
- parentId: null,
342
- type: "operator",
343
- operator: "implies",
344
- };
345
- const s1VarExpr = {
346
- id: s1ExprId,
347
- argumentId: argId,
348
- argumentVersion: argVersion,
349
- premiseId,
350
- parentId: null, // wrapExpression sets the parentId internally
351
- type: "variable",
352
- variableId: supportingVars[0].id,
353
- };
354
- // rightNodeId=qRootExprId: existing node (Q) → midpoint (consequent),
355
- // newSibling (S1) → initial (antecedent).
356
- super.wrapExpression(impliesOp, s1VarExpr, undefined, qRootExprId);
357
- }
358
- else {
359
- // n ≥ 2: build IMPLIES(formula(OR(S1,...,Sn)), Q). Standard grammar
360
- // throughout — the engine's wrapInsertFormula rule auto-inserts a
361
- // formula buffer between IMPLIES and OR. The OR keeps its original
362
- // ID, so subsequent appendExpression(orId, ...) calls still attach
363
- // the supporting variables to the same OR node.
364
- const impliesId = this.generateIdFn();
365
- const orId = this.generateIdFn();
366
- const impliesOp = {
367
- id: impliesId,
368
- argumentId: argId,
369
- argumentVersion: argVersion,
370
- premiseId,
371
- parentId: null,
372
- type: "operator",
373
- operator: "implies",
374
- };
375
- const orOp = {
376
- id: orId,
377
- argumentId: argId,
378
- argumentVersion: argVersion,
379
- premiseId,
380
- parentId: null, // wrapExpression sets the parentId internally
381
- type: "operator",
382
- operator: "or",
383
- };
384
- // rightNodeId=qRootExprId: Q → midpoint (consequent), OR → initial (antecedent).
385
- super.wrapExpression(impliesOp, orOp, undefined, qRootExprId);
386
- // Append each supporting variable expression as a child of OR.
387
- for (const sourceVar of supportingVars) {
388
- const srcExprId = this.generateIdFn();
389
- const srcVarExpr = {
390
- id: srcExprId,
391
- argumentId: argId,
392
- argumentVersion: argVersion,
393
- premiseId,
394
- parentId: orId,
395
- type: "variable",
396
- variableId: sourceVar.id,
397
- };
398
- super.appendExpression(orId, srcVarExpr);
399
- }
400
- }
401
- }
402
- // -------------------------------------------------------------------------
403
- // Private helpers
404
- // -------------------------------------------------------------------------
405
- /**
406
- * Returns the ID of the consequent expression, or `undefined` if the tree
407
- * has no root yet.
408
- *
409
- * - Naked form (root is a variable expression): the root IS the consequent.
410
- * - Implication/biconditional form (root is `implies`/`iff`): the position-1
411
- * child of the root is the consequent.
412
- */
413
- getConsequentExpressionId() {
414
- const rootId = this.rootExpressionId;
415
- if (rootId === undefined) {
416
- return undefined;
417
- }
418
- const root = this.expressions.getExpression(rootId);
419
- if (!root) {
420
- return undefined;
421
- }
422
- if (root.type === "variable") {
423
- // Naked form — root IS the consequent.
424
- return rootId;
425
- }
426
- if (root.type === "operator" &&
427
- (root.operator === "implies" || root.operator === "iff")) {
428
- // Implication/biconditional form — position-1 child is the consequent.
429
- const children = this.expressions
430
- .getChildExpressions(rootId)
431
- .sort((a, b) => a.position - b.position);
432
- return children[1]?.id;
433
- }
434
- return undefined;
435
- }
436
- /**
437
- * Reject an `insertExpression` call that would place a new node into the
438
- * consequent slot of the root `implies`/`iff`.
439
- *
440
- * Detection is by parentId + position on the input: we block when
441
- * `expression.parentId === rootId` AND `expression.position >= consequent.position`.
442
- * For `implies`/`iff` the consequent sits at position 1, so this blocks
443
- * insertions into position 1 (which would displace the consequent) and
444
- * positions beyond (which would exceed arity 2). Insertions at position 0
445
- * (antecedent slot) pass through.
446
- */
447
- assertNotConsequentSlot(expression) {
448
- const rootId = this.rootExpressionId;
449
- if (rootId === undefined) {
450
- return;
451
- }
452
- const root = this.expressions.getExpression(rootId);
453
- if (!root ||
454
- root.type !== "operator" ||
455
- (root.operator !== "implies" && root.operator !== "iff")) {
456
- return;
457
- }
458
- // The consequent is the position-1 child of the root operator.
459
- const consequentId = this.getConsequentExpressionId();
460
- if (!consequentId) {
461
- return;
462
- }
463
- // Block if the incoming expression is being inserted directly under root
464
- // with position 1 (i.e., it claims the consequent slot).
465
- if (expression.parentId === rootId) {
466
- // Determine the consequent's current position to compare.
467
- const consequentExpr = this.expressions.getExpression(consequentId);
468
- if (consequentExpr &&
469
- expression.position >= consequentExpr.position) {
470
- throw new InvariantViolationError([
471
- {
472
- code: DERIVATION_CONSEQUENT_LOCKED,
473
- message: `${DERIVATION_CONSEQUENT_LOCKED}: Cannot insert an expression into the consequent slot of a derivation premise`,
474
- entityType: "expression",
475
- entityId: expression.id,
476
- premiseId: this.premise.id,
477
- },
478
- ]);
479
- }
480
- }
481
- }
482
- /**
483
- * Reject `removeExpression` and `toggleNegation` calls on the consequent
484
- * expression.
485
- */
486
- assertNotConsequentExpression(exprId) {
487
- const consequentId = this.getConsequentExpressionId();
488
- if (consequentId !== undefined && exprId === consequentId) {
489
- throw new InvariantViolationError([
490
- {
491
- code: DERIVATION_CONSEQUENT_LOCKED,
492
- message: `${DERIVATION_CONSEQUENT_LOCKED}: Cannot remove or negate the consequent expression of a derivation premise`,
493
- entityType: "expression",
494
- entityId: exprId,
495
- premiseId: this.premise.id,
496
- },
497
- ]);
498
- }
499
- }
500
- /**
501
- * Reject `updateExpression` calls that change the consequent's `variableId`
502
- * or `type`.
503
- */
504
- assertConsequentNotMutated(exprId, updates) {
505
- const consequentId = this.getConsequentExpressionId();
506
- if (consequentId === undefined || exprId !== consequentId) {
507
- return;
508
- }
509
- if (updates.variableId !== undefined ||
510
- updates.operator !== undefined) {
511
- throw new InvariantViolationError([
512
- {
513
- code: DERIVATION_CONSEQUENT_LOCKED,
514
- message: `${DERIVATION_CONSEQUENT_LOCKED}: Cannot change the variable or operator of the consequent expression of a derivation premise`,
515
- entityType: "expression",
516
- entityId: exprId,
517
- premiseId: this.premise.id,
518
- },
519
- ]);
520
- }
521
- }
522
- /**
523
- * Reject `changeOperator` calls that would swap the root `implies`/`iff`
524
- * to a non-implication operator (`and`, `or`, `not`).
525
- */
526
- assertRootOperatorChangeValid(exprId, newOperator) {
527
- const rootId = this.rootExpressionId;
528
- if (rootId === undefined || exprId !== rootId) {
529
- return;
530
- }
531
- const root = this.expressions.getExpression(rootId);
532
- if (!root ||
533
- root.type !== "operator" ||
534
- (root.operator !== "implies" && root.operator !== "iff")) {
535
- return;
536
- }
537
- if (newOperator !== "implies" && newOperator !== "iff") {
538
- throw new InvariantViolationError([
539
- {
540
- code: DERIVATION_ROOT_OPERATOR_INVALID,
541
- message: `${DERIVATION_ROOT_OPERATOR_INVALID}: Cannot change a derivation premise's root operator from "${root.operator}" to "${newOperator}" — only implies↔iff swaps are permitted`,
542
- entityType: "expression",
543
- entityId: exprId,
544
- premiseId: this.premise.id,
545
- },
546
- ]);
547
- }
548
- }
549
- }
550
- //# sourceMappingURL=managed-derivation-premise-engine.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"managed-derivation-premise-engine.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AC,EAAE;iBAC/C;aACJ,CAAC,CAAA;QACN,CAAC;IACL,CAAC;CACJ"}
@@ -1,11 +0,0 @@
1
- import Type, { type Static } from "typebox";
2
- export declare const CoreClaimAxiomSchema: Type.TObject<{
3
- id: Type.TString;
4
- claimId: Type.TString;
5
- claimVersion: Type.TNumber;
6
- supportingClaimId: Type.TString;
7
- supportingClaimVersion: Type.TNumber;
8
- checksum: Type.TString;
9
- }>;
10
- export type TCoreClaimAxiom = Static<typeof CoreClaimAxiomSchema>;
11
- //# sourceMappingURL=claim-axiom.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"claim-axiom.d.ts","sourceRoot":"","sources":["../../../src/lib/schemata/claim-axiom.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAA;AAG3C,eAAO,MAAM,oBAAoB;;;;;;;EAShC,CAAA;AACD,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAA"}
@@ -1,9 +0,0 @@
1
- import Type, {} from "typebox";
2
- import { CoreClaimConnectionSchema } from "./claim-connection.js";
3
- export const CoreClaimAxiomSchema = Type.Object({
4
- ...CoreClaimConnectionSchema.properties,
5
- }, {
6
- additionalProperties: true,
7
- description: "A directional axiom-invocation edge: the claim at supportingClaimId (type='axiomatic') supports the claim at claimId (type='normal'). Extended via additionalProperties for app-level fields.",
8
- });
9
- //# sourceMappingURL=claim-axiom.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"claim-axiom.js","sourceRoot":"","sources":["../../../src/lib/schemata/claim-axiom.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EAAe,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AAEjE,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,MAAM,CAC3C;IACI,GAAG,yBAAyB,CAAC,UAAU;CAC1C,EACD;IACI,oBAAoB,EAAE,IAAI;IAC1B,WAAW,EACP,+LAA+L;CACtM,CACJ,CAAA"}
@@ -1,11 +0,0 @@
1
- import Type, { type Static } from "typebox";
2
- export declare const CoreClaimCitationSchema: Type.TObject<{
3
- id: Type.TString;
4
- claimId: Type.TString;
5
- claimVersion: Type.TNumber;
6
- supportingClaimId: Type.TString;
7
- supportingClaimVersion: Type.TNumber;
8
- checksum: Type.TString;
9
- }>;
10
- export type TCoreClaimCitation = Static<typeof CoreClaimCitationSchema>;
11
- //# sourceMappingURL=claim-citation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"claim-citation.d.ts","sourceRoot":"","sources":["../../../src/lib/schemata/claim-citation.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAA;AAG3C,eAAO,MAAM,uBAAuB;;;;;;;EASnC,CAAA;AACD,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,OAAO,uBAAuB,CAAC,CAAA"}
@@ -1,9 +0,0 @@
1
- import Type, {} from "typebox";
2
- import { CoreClaimConnectionSchema } from "./claim-connection.js";
3
- export const CoreClaimCitationSchema = Type.Object({
4
- ...CoreClaimConnectionSchema.properties,
5
- }, {
6
- additionalProperties: true,
7
- description: "A directional citation edge: the claim at supportingClaimId is cited as evidence for the claim at claimId. The supporting-side endpoint must reference a claim with type='citation'. Extended via additionalProperties for app-level fields.",
8
- });
9
- //# sourceMappingURL=claim-citation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"claim-citation.js","sourceRoot":"","sources":["../../../src/lib/schemata/claim-citation.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EAAe,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AAEjE,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC,MAAM,CAC9C;IACI,GAAG,yBAAyB,CAAC,UAAU;CAC1C,EACD;IACI,oBAAoB,EAAE,IAAI;IAC1B,WAAW,EACP,8OAA8O;CACrP,CACJ,CAAA"}