@polintpro/proposit-core 0.1.3 → 0.1.4
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/dist/cli/commands/analysis.d.ts.map +1 -1
- package/dist/cli/commands/analysis.js +87 -13
- package/dist/cli/commands/analysis.js.map +1 -1
- package/dist/cli/commands/arguments.d.ts.map +1 -1
- package/dist/cli/commands/arguments.js +27 -4
- package/dist/cli/commands/arguments.js.map +1 -1
- package/dist/cli/commands/diff.d.ts +3 -0
- package/dist/cli/commands/diff.d.ts.map +1 -0
- package/dist/cli/commands/diff.js +46 -0
- package/dist/cli/commands/diff.js.map +1 -0
- package/dist/cli/commands/premises.d.ts.map +1 -1
- package/dist/cli/commands/premises.js +22 -13
- package/dist/cli/commands/premises.js.map +1 -1
- package/dist/cli/commands/variables.d.ts.map +1 -1
- package/dist/cli/commands/variables.js +1 -0
- package/dist/cli/commands/variables.js.map +1 -1
- package/dist/cli/commands/versionShow.js +2 -2
- package/dist/cli/commands/versionShow.js.map +1 -1
- package/dist/cli/engine.d.ts +6 -0
- package/dist/cli/engine.d.ts.map +1 -1
- package/dist/cli/engine.js +41 -8
- package/dist/cli/engine.js.map +1 -1
- package/dist/cli/output/diffRenderer.d.ts +4 -0
- package/dist/cli/output/diffRenderer.d.ts.map +1 -0
- package/dist/cli/output/diffRenderer.js +102 -0
- package/dist/cli/output/diffRenderer.js.map +1 -0
- package/dist/cli/router.d.ts.map +1 -1
- package/dist/cli/router.js +1 -0
- package/dist/cli/router.js.map +1 -1
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/core/ArgumentEngine.d.ts +82 -4
- package/dist/lib/core/ArgumentEngine.d.ts.map +1 -1
- package/dist/lib/core/ArgumentEngine.js +102 -18
- package/dist/lib/core/ArgumentEngine.js.map +1 -1
- package/dist/lib/core/ExpressionManager.d.ts +52 -0
- package/dist/lib/core/ExpressionManager.d.ts.map +1 -1
- package/dist/lib/core/ExpressionManager.js +52 -3
- package/dist/lib/core/ExpressionManager.js.map +1 -1
- package/dist/lib/core/PremiseManager.d.ts +17 -4
- package/dist/lib/core/PremiseManager.d.ts.map +1 -1
- package/dist/lib/core/PremiseManager.js +48 -26
- package/dist/lib/core/PremiseManager.js.map +1 -1
- package/dist/lib/core/VariableManager.d.ts +34 -1
- package/dist/lib/core/VariableManager.d.ts.map +1 -1
- package/dist/lib/core/VariableManager.js +26 -0
- package/dist/lib/core/VariableManager.js.map +1 -1
- package/dist/lib/core/diff.d.ts +20 -0
- package/dist/lib/core/diff.d.ts.map +1 -0
- package/dist/lib/core/diff.js +213 -0
- package/dist/lib/core/diff.js.map +1 -0
- package/dist/lib/core/evaluation/shared.d.ts +17 -3
- package/dist/lib/core/evaluation/shared.d.ts.map +1 -1
- package/dist/lib/core/evaluation/shared.js +34 -2
- package/dist/lib/core/evaluation/shared.js.map +1 -1
- package/dist/lib/core/import.d.ts +14 -0
- package/dist/lib/core/import.d.ts.map +1 -0
- package/dist/lib/core/import.js +217 -0
- package/dist/lib/core/import.js.map +1 -0
- package/dist/lib/core/parser/formula-gen.js +850 -0
- package/dist/lib/core/parser/formula.d.ts +23 -0
- package/dist/lib/core/parser/formula.d.ts.map +1 -0
- package/dist/lib/core/parser/formula.js +7 -0
- package/dist/lib/core/parser/formula.js.map +1 -0
- package/dist/lib/index.d.ts +9 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +8 -0
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/schemata/analysis.d.ts +2 -1
- package/dist/lib/schemata/analysis.d.ts.map +1 -1
- package/dist/lib/schemata/analysis.js +5 -2
- package/dist/lib/schemata/analysis.js.map +1 -1
- package/dist/lib/schemata/argument.d.ts +13 -4
- package/dist/lib/schemata/argument.d.ts.map +1 -1
- package/dist/lib/schemata/argument.js +10 -2
- package/dist/lib/schemata/argument.js.map +1 -1
- package/dist/lib/schemata/import.d.ts +33 -0
- package/dist/lib/schemata/import.d.ts.map +1 -0
- package/dist/lib/schemata/import.js +18 -0
- package/dist/lib/schemata/import.js.map +1 -0
- package/dist/lib/schemata/index.d.ts +1 -0
- package/dist/lib/schemata/index.d.ts.map +1 -1
- package/dist/lib/schemata/index.js +1 -0
- package/dist/lib/schemata/index.js.map +1 -1
- package/dist/lib/schemata/propositional.d.ts +13 -2
- package/dist/lib/schemata/propositional.d.ts.map +1 -1
- package/dist/lib/schemata/propositional.js +25 -7
- package/dist/lib/schemata/propositional.js.map +1 -1
- package/dist/lib/types/diff.d.ts +56 -0
- package/dist/lib/types/diff.d.ts.map +1 -0
- package/dist/lib/types/diff.js +2 -0
- package/dist/lib/types/diff.js.map +1 -0
- package/dist/lib/types/evaluation.d.ts +96 -29
- package/dist/lib/types/evaluation.d.ts.map +1 -1
- package/dist/lib/utils/collections.d.ts +6 -0
- package/dist/lib/utils/collections.d.ts.map +1 -1
- package/dist/lib/utils/collections.js +6 -0
- package/dist/lib/utils/collections.js.map +1 -1
- package/dist/lib/utils.d.ts +7 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +7 -5
- package/dist/lib/utils.js.map +1 -1
- package/package.json +14 -2
|
@@ -1,105 +1,172 @@
|
|
|
1
1
|
import type { TCoreArgument, TCoreArgumentRoleState, TCorePremise } from "../schemata/index.js";
|
|
2
|
+
/** Role that a premise plays in an argument. */
|
|
2
3
|
export type TCorePremiseRole = "supporting" | "conclusion";
|
|
3
4
|
export type { TCoreArgumentRoleState };
|
|
4
5
|
export interface TCoreArgumentEngineData {
|
|
6
|
+
/** Snapshot of the argument metadata managed by the engine. */
|
|
5
7
|
argument: TCoreArgument;
|
|
8
|
+
/** Serialized premise snapshots (one per premise manager). */
|
|
6
9
|
premises: TCorePremise[];
|
|
10
|
+
/** Current role assignments for the premises in this engine. */
|
|
7
11
|
roles: TCoreArgumentRoleState;
|
|
8
12
|
}
|
|
9
|
-
|
|
13
|
+
/** Three-valued truth value: true, false, or null (unset/unknown). */
|
|
14
|
+
export type TCoreTrivalentValue = boolean | null;
|
|
15
|
+
/** Maps variable IDs to three-valued truth values. */
|
|
16
|
+
export type TCoreVariableAssignment = Record<string, TCoreTrivalentValue>;
|
|
17
|
+
/** Full expression assignment: variable truth values and rejected expression IDs. */
|
|
18
|
+
export interface TCoreExpressionAssignment {
|
|
19
|
+
/** Variable ID → true/false/null (null = unset/not sure). */
|
|
20
|
+
variables: TCoreVariableAssignment;
|
|
21
|
+
/** Expression IDs the user rejects (evaluate to false, children skipped). */
|
|
22
|
+
rejectedExpressionIds: string[];
|
|
23
|
+
}
|
|
24
|
+
/** Severity level for validation issues. */
|
|
10
25
|
export type TCoreValidationSeverity = "error" | "warning";
|
|
26
|
+
/** Machine-readable codes for all validation issues. */
|
|
11
27
|
export type TCoreValidationCode = "ARGUMENT_NO_CONCLUSION" | "ARGUMENT_CONCLUSION_NOT_FOUND" | "ARGUMENT_SUPPORTING_PREMISE_NOT_FOUND" | "ARGUMENT_ROLE_OVERLAP" | "ARGUMENT_VARIABLE_ID_SYMBOL_MISMATCH" | "ARGUMENT_VARIABLE_SYMBOL_AMBIGUOUS" | "PREMISE_EMPTY" | "PREMISE_ROOT_MISSING" | "PREMISE_ROOT_MISMATCH" | "EXPR_CHILD_COUNT_INVALID" | "EXPR_BINARY_POSITIONS_INVALID" | "EXPR_VARIABLE_UNDECLARED" | "ASSIGNMENT_MISSING_VARIABLE" | "ASSIGNMENT_UNKNOWN_VARIABLE";
|
|
12
28
|
export interface TCoreValidationIssue {
|
|
29
|
+
/** Machine-readable issue code for callers/tests/UI logic. */
|
|
13
30
|
code: TCoreValidationCode;
|
|
31
|
+
/** Severity level; `error` blocks evaluation/validity checks. */
|
|
14
32
|
severity: TCoreValidationSeverity;
|
|
33
|
+
/** Human-readable explanation of the issue. */
|
|
15
34
|
message: string;
|
|
35
|
+
/** Premise associated with the issue, when applicable. */
|
|
16
36
|
premiseId?: string;
|
|
37
|
+
/** Expression associated with the issue, when applicable. */
|
|
17
38
|
expressionId?: string;
|
|
39
|
+
/** Variable associated with the issue, when applicable. */
|
|
18
40
|
variableId?: string;
|
|
19
41
|
}
|
|
20
42
|
export interface TCoreValidationResult {
|
|
43
|
+
/** `true` iff no `error`-severity issues are present. */
|
|
21
44
|
ok: boolean;
|
|
45
|
+
/** Full list of validation findings (errors and warnings). */
|
|
22
46
|
issues: TCoreValidationIssue[];
|
|
23
47
|
}
|
|
24
48
|
export interface TCoreDirectionalVacuity {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
49
|
+
/** Truth value of the antecedent for this directional implication view. */
|
|
50
|
+
antecedentTrue: TCoreTrivalentValue;
|
|
51
|
+
/** Truth value of the consequent for this directional implication view. */
|
|
52
|
+
consequentTrue: TCoreTrivalentValue;
|
|
53
|
+
/** Result of evaluating `antecedent -> consequent`. */
|
|
54
|
+
implicationValue: TCoreTrivalentValue;
|
|
55
|
+
/** `true` iff the implication is true because the antecedent is false; `null` if indeterminate. */
|
|
56
|
+
isVacuouslyTrue: TCoreTrivalentValue;
|
|
57
|
+
/** `true` iff the antecedent was true (the implication "fired"); `null` if indeterminate. */
|
|
58
|
+
fired: TCoreTrivalentValue;
|
|
30
59
|
}
|
|
31
60
|
export type TCorePremiseInferenceDiagnostic = {
|
|
32
61
|
kind: "implies";
|
|
33
62
|
premiseId: string;
|
|
34
63
|
rootExpressionId: string;
|
|
35
|
-
leftValue:
|
|
36
|
-
rightValue:
|
|
37
|
-
rootValue:
|
|
38
|
-
antecedentTrue:
|
|
39
|
-
consequentTrue:
|
|
40
|
-
isVacuouslyTrue:
|
|
41
|
-
fired:
|
|
42
|
-
firedAndHeld:
|
|
64
|
+
leftValue: TCoreTrivalentValue;
|
|
65
|
+
rightValue: TCoreTrivalentValue;
|
|
66
|
+
rootValue: TCoreTrivalentValue;
|
|
67
|
+
antecedentTrue: TCoreTrivalentValue;
|
|
68
|
+
consequentTrue: TCoreTrivalentValue;
|
|
69
|
+
isVacuouslyTrue: TCoreTrivalentValue;
|
|
70
|
+
fired: TCoreTrivalentValue;
|
|
71
|
+
firedAndHeld: TCoreTrivalentValue;
|
|
43
72
|
} | {
|
|
44
73
|
kind: "iff";
|
|
45
74
|
premiseId: string;
|
|
46
75
|
rootExpressionId: string;
|
|
47
|
-
leftValue:
|
|
48
|
-
rightValue:
|
|
49
|
-
rootValue:
|
|
76
|
+
leftValue: TCoreTrivalentValue;
|
|
77
|
+
rightValue: TCoreTrivalentValue;
|
|
78
|
+
rootValue: TCoreTrivalentValue;
|
|
50
79
|
leftToRight: TCoreDirectionalVacuity;
|
|
51
80
|
rightToLeft: TCoreDirectionalVacuity;
|
|
52
|
-
bothSidesTrue:
|
|
53
|
-
bothSidesFalse:
|
|
81
|
+
bothSidesTrue: TCoreTrivalentValue;
|
|
82
|
+
bothSidesFalse: TCoreTrivalentValue;
|
|
54
83
|
};
|
|
55
84
|
export interface TCorePremiseEvaluationResult {
|
|
85
|
+
/** ID of the evaluated premise. */
|
|
56
86
|
premiseId: string;
|
|
87
|
+
/** Premise classification derived from the root expression. */
|
|
57
88
|
premiseType: "inference" | "constraint";
|
|
89
|
+
/** Root expression ID, if the premise has a root. */
|
|
58
90
|
rootExpressionId?: string;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
91
|
+
/** Truth value of the root expression, if the premise was evaluable. */
|
|
92
|
+
rootValue?: TCoreTrivalentValue;
|
|
93
|
+
/** Per-expression truth values keyed by expression ID. */
|
|
94
|
+
expressionValues: Record<string, TCoreTrivalentValue>;
|
|
95
|
+
/** Referenced variable truth values keyed by variable ID. */
|
|
96
|
+
variableValues: Record<string, TCoreTrivalentValue>;
|
|
97
|
+
/** Inference-specific diagnostics for `implies`/`iff` roots. */
|
|
62
98
|
inferenceDiagnostic?: TCorePremiseInferenceDiagnostic;
|
|
63
99
|
}
|
|
64
100
|
export interface TCoreArgumentEvaluationOptions {
|
|
101
|
+
/** Reject assignment keys that are not referenced by the evaluated premises. */
|
|
65
102
|
strictUnknownAssignmentKeys?: boolean;
|
|
103
|
+
/** Include per-expression truth maps in premise results (may be verbose). */
|
|
66
104
|
includeExpressionValues?: boolean;
|
|
105
|
+
/** Include inference diagnostics in premise results. */
|
|
67
106
|
includeDiagnostics?: boolean;
|
|
107
|
+
/** Run argument/premise evaluability validation before evaluating. */
|
|
68
108
|
validateFirst?: boolean;
|
|
69
109
|
}
|
|
70
110
|
export interface TCoreArgumentEvaluationResult {
|
|
111
|
+
/** `false` means evaluation could not be completed (typically validation failure). */
|
|
71
112
|
ok: boolean;
|
|
113
|
+
/** Validation output when `ok === false`, or when validation was requested and included. */
|
|
72
114
|
validation?: TCoreValidationResult;
|
|
73
|
-
assignment
|
|
115
|
+
/** The assignment used for this evaluation. */
|
|
116
|
+
assignment?: TCoreExpressionAssignment;
|
|
117
|
+
/** All variable IDs referenced across evaluated supporting/conclusion/constraint premises. */
|
|
74
118
|
referencedVariableIds?: string[];
|
|
119
|
+
/** Evaluation result for the designated conclusion premise. */
|
|
75
120
|
conclusion?: TCorePremiseEvaluationResult;
|
|
121
|
+
/** Evaluation results for premises designated as supporting the argument. */
|
|
76
122
|
supportingPremises?: TCorePremiseEvaluationResult[];
|
|
123
|
+
/** Evaluation results for constraint premises (used to determine admissibility). */
|
|
77
124
|
constraintPremises?: TCorePremiseEvaluationResult[];
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
125
|
+
/** `true` iff all constraint premises evaluate to true under the assignment. */
|
|
126
|
+
isAdmissibleAssignment?: TCoreTrivalentValue;
|
|
127
|
+
/** `true` iff every supporting premise evaluates to true. */
|
|
128
|
+
allSupportingPremisesTrue?: TCoreTrivalentValue;
|
|
129
|
+
/** The truth value of the conclusion premise root expression. */
|
|
130
|
+
conclusionTrue?: TCoreTrivalentValue;
|
|
131
|
+
/** `true` iff constraints are satisfied, all supporting premises are true, and the conclusion is false. */
|
|
132
|
+
isCounterexample?: TCoreTrivalentValue;
|
|
133
|
+
/** Convenience inverse of `isCounterexample` for the evaluated assignment. */
|
|
134
|
+
preservesTruthUnderAssignment?: TCoreTrivalentValue;
|
|
83
135
|
}
|
|
84
136
|
export interface TCoreValidityCheckOptions {
|
|
137
|
+
/** Stop at first counterexample or continue exhaustively. */
|
|
85
138
|
mode?: "firstCounterexample" | "exhaustive";
|
|
139
|
+
/** Safety limit for the number of variables used in truth-table generation. */
|
|
86
140
|
maxVariables?: number;
|
|
141
|
+
/** Safety limit for generated assignments checked before truncating. */
|
|
87
142
|
maxAssignmentsChecked?: number;
|
|
143
|
+
/** Include full evaluation payloads for captured counterexamples. */
|
|
88
144
|
includeCounterexampleEvaluations?: boolean;
|
|
145
|
+
/** Run evaluability validation before truth-table search. */
|
|
89
146
|
validateFirst?: boolean;
|
|
90
147
|
}
|
|
91
148
|
export interface TCoreCounterexample {
|
|
92
|
-
|
|
149
|
+
/** Assignment under which the argument fails to preserve truth. */
|
|
150
|
+
assignment: TCoreExpressionAssignment;
|
|
151
|
+
/** Full argument evaluation result for that assignment. */
|
|
93
152
|
result: TCoreArgumentEvaluationResult;
|
|
94
153
|
}
|
|
95
154
|
export interface TCoreValidityCheckResult {
|
|
155
|
+
/** `false` means the validity check could not run to completion. */
|
|
96
156
|
ok: boolean;
|
|
157
|
+
/** Validation output when `ok === false`. */
|
|
97
158
|
validation?: TCoreValidationResult;
|
|
159
|
+
/** Validity result when known; may be omitted if truncated before conclusion. */
|
|
98
160
|
isValid?: boolean;
|
|
161
|
+
/** Variable IDs used to generate the checked assignments. */
|
|
99
162
|
checkedVariableIds?: string[];
|
|
163
|
+
/** Total number of assignments evaluated (including inadmissible ones). */
|
|
100
164
|
numAssignmentsChecked?: number;
|
|
165
|
+
/** Number of assignments satisfying all constraints. */
|
|
101
166
|
numAdmissibleAssignments?: number;
|
|
167
|
+
/** Counterexamples found (one or many depending on mode/options). */
|
|
102
168
|
counterexamples?: TCoreCounterexample[];
|
|
169
|
+
/** `true` iff checking stopped due to a configured limit. */
|
|
103
170
|
truncated?: boolean;
|
|
104
171
|
}
|
|
105
172
|
//# sourceMappingURL=evaluation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluation.d.ts","sourceRoot":"","sources":["../../../src/lib/types/evaluation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,aAAa,EACb,sBAAsB,EACtB,YAAY,EACf,MAAM,sBAAsB,CAAA;AAE7B,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,YAAY,CAAA;AAE1D,YAAY,EAAE,sBAAsB,EAAE,CAAA;AAEtC,MAAM,WAAW,uBAAuB;
|
|
1
|
+
{"version":3,"file":"evaluation.d.ts","sourceRoot":"","sources":["../../../src/lib/types/evaluation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,aAAa,EACb,sBAAsB,EACtB,YAAY,EACf,MAAM,sBAAsB,CAAA;AAE7B,gDAAgD;AAChD,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,YAAY,CAAA;AAE1D,YAAY,EAAE,sBAAsB,EAAE,CAAA;AAEtC,MAAM,WAAW,uBAAuB;IACpC,+DAA+D;IAC/D,QAAQ,EAAE,aAAa,CAAA;IACvB,8DAA8D;IAC9D,QAAQ,EAAE,YAAY,EAAE,CAAA;IACxB,gEAAgE;IAChE,KAAK,EAAE,sBAAsB,CAAA;CAChC;AAED,sEAAsE;AACtE,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,IAAI,CAAA;AAEhD,sDAAsD;AACtD,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAA;AAEzE,qFAAqF;AACrF,MAAM,WAAW,yBAAyB;IACtC,6DAA6D;IAC7D,SAAS,EAAE,uBAAuB,CAAA;IAClC,6EAA6E;IAC7E,qBAAqB,EAAE,MAAM,EAAE,CAAA;C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CAAA;IACX,6CAA6C;IAC7C,UAAU,CAAC,EAAE,qBAAqB,CAAA;IAClC,iFAAiF;IACjF,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,6DAA6D;IAC7D,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B,2EAA2E;IAC3E,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,wDAAwD;IACxD,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,qEAAqE;IACrE,eAAe,CAAC,EAAE,mBAAmB,EAAE,CAAA;IACvC,6DAA6D;IAC7D,SAAS,CAAC,EAAE,OAAO,CAAA;CACtB"}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the value for `key` from `map`, creating and inserting it via
|
|
3
|
+
* `makeDefault` if absent.
|
|
4
|
+
*/
|
|
1
5
|
export declare function getOrCreate<K, V>(map: Map<K, V>, key: K, makeDefault: () => V): V;
|
|
6
|
+
/** Returns a shallow-copied array of items sorted by `id` in lexicographic order. */
|
|
2
7
|
export declare function sortedCopyById<T extends {
|
|
3
8
|
id: string;
|
|
4
9
|
}>(items: T[]): T[];
|
|
10
|
+
/** Deduplicates and sorts an iterable of strings. */
|
|
5
11
|
export declare function sortedUnique(values: Iterable<string>): string[];
|
|
6
12
|
//# sourceMappingURL=collections.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/collections.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,EAC5B,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EACd,GAAG,EAAE,CAAC,EACN,WAAW,EAAE,MAAM,CAAC,GACrB,CAAC,CASH;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAIxE;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAE/D"}
|
|
1
|
+
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/collections.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,EAC5B,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EACd,GAAG,EAAE,CAAC,EACN,WAAW,EAAE,MAAM,CAAC,GACrB,CAAC,CASH;AAED,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAIxE;AAED,qDAAqD;AACrD,wBAAgB,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAE/D"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the value for `key` from `map`, creating and inserting it via
|
|
3
|
+
* `makeDefault` if absent.
|
|
4
|
+
*/
|
|
1
5
|
export function getOrCreate(map, key, makeDefault) {
|
|
2
6
|
const existing = map.get(key);
|
|
3
7
|
if (existing !== undefined) {
|
|
@@ -7,11 +11,13 @@ export function getOrCreate(map, key, makeDefault) {
|
|
|
7
11
|
map.set(key, value);
|
|
8
12
|
return value;
|
|
9
13
|
}
|
|
14
|
+
/** Returns a shallow-copied array of items sorted by `id` in lexicographic order. */
|
|
10
15
|
export function sortedCopyById(items) {
|
|
11
16
|
return [...items]
|
|
12
17
|
.map((item) => ({ ...item }))
|
|
13
18
|
.sort((a, b) => a.id.localeCompare(b.id));
|
|
14
19
|
}
|
|
20
|
+
/** Deduplicates and sorts an iterable of strings. */
|
|
15
21
|
export function sortedUnique(values) {
|
|
16
22
|
return Array.from(new Set(values)).sort((a, b) => a.localeCompare(b));
|
|
17
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.js","sourceRoot":"","sources":["../../../src/lib/utils/collections.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,CACvB,GAAc,EACd,GAAM,EACN,WAAoB;IAEpB,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC7B,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,QAAQ,CAAA;IACnB,CAAC;IAED,MAAM,KAAK,GAAG,WAAW,EAAE,CAAA;IAC3B,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACnB,OAAO,KAAK,CAAA;AAChB,CAAC;AAED,MAAM,UAAU,cAAc,CAA2B,KAAU;IAC/D,OAAO,CAAC,GAAG,KAAK,CAAC;SACZ,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;SAC5B,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AACjD,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAwB;IACjD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;AACzE,CAAC"}
|
|
1
|
+
{"version":3,"file":"collections.js","sourceRoot":"","sources":["../../../src/lib/utils/collections.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,WAAW,CACvB,GAAc,EACd,GAAM,EACN,WAAoB;IAEpB,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC7B,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,QAAQ,CAAA;IACnB,CAAC;IAED,MAAM,KAAK,GAAG,WAAW,EAAE,CAAA;IAC3B,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACnB,OAAO,KAAK,CAAA;AAChB,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,cAAc,CAA2B,KAAU;IAC/D,OAAO,CAAC,GAAG,KAAK,CAAC;SACZ,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;SAC5B,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AACjD,CAAC;AAED,qDAAqD;AACrD,MAAM,UAAU,YAAY,CAAC,MAAwB;IACjD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;AACzE,CAAC"}
|
package/dist/lib/utils.d.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
type DefaultValueFactory<K, V> = (key?: K) => V;
|
|
2
|
+
/**
|
|
3
|
+
* A `Map` subclass that auto-creates values for missing keys using a
|
|
4
|
+
* factory function. Optionally enforces an LRU-style size limit by
|
|
5
|
+
* evicting the oldest entry when the limit is reached.
|
|
6
|
+
*/
|
|
2
7
|
export declare class DefaultMap<K, V> extends Map<K, V> {
|
|
3
8
|
private mkDefault;
|
|
4
9
|
private limit;
|
|
5
10
|
constructor(mkDefault: DefaultValueFactory<K, V>, entries?: Iterable<[K, V]>, limit?: number);
|
|
11
|
+
/** Returns the value for `key`, creating it via the factory if absent. */
|
|
6
12
|
get(key: K): V;
|
|
13
|
+
/** Sets `key` to `value`, evicting the oldest entry if the size limit is reached. */
|
|
7
14
|
set(key: K, value: V): this;
|
|
8
15
|
}
|
|
9
16
|
export {};
|
package/dist/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,KAAK,mBAAmB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,KAAK,mBAAmB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;AAE/C;;;;GAIG;AACH,qBAAa,UAAU,CAAC,CAAC,EAAE,CAAC,CAAE,SAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;IAC3C,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,KAAK,CAAQ;gBAGjB,SAAS,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,EACpC,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAC1B,KAAK,SAAK;IAOd,0EAA0E;IACnE,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC;IAOrB,qFAAqF;IAC9E,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC;CAS9B"}
|
package/dist/lib/utils.js
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A `Map` subclass that auto-creates values for missing keys using a
|
|
3
|
+
* factory function. Optionally enforces an LRU-style size limit by
|
|
4
|
+
* evicting the oldest entry when the limit is reached.
|
|
5
|
+
*/
|
|
1
6
|
export class DefaultMap extends Map {
|
|
2
7
|
mkDefault;
|
|
3
8
|
limit;
|
|
4
9
|
constructor(mkDefault, entries, limit = -1) {
|
|
5
|
-
/**
|
|
6
|
-
* mkDefault is a function which (optionally) takes one argument, a value passed as the key,
|
|
7
|
-
* and returns a value which to use if that key is not present in the map. The function may
|
|
8
|
-
* throw an error if the key is invalid or forbidden to limit the scope of values in the map.
|
|
9
|
-
*/
|
|
10
10
|
super(entries);
|
|
11
11
|
this.mkDefault = mkDefault;
|
|
12
12
|
this.limit = limit;
|
|
13
13
|
}
|
|
14
|
+
/** Returns the value for `key`, creating it via the factory if absent. */
|
|
14
15
|
get(key) {
|
|
15
16
|
if (!this.has(key)) {
|
|
16
17
|
this.set(key, this.mkDefault(key));
|
|
17
18
|
}
|
|
18
19
|
return super.get(key);
|
|
19
20
|
}
|
|
21
|
+
/** Sets `key` to `value`, evicting the oldest entry if the size limit is reached. */
|
|
20
22
|
set(key, value) {
|
|
21
23
|
if (this.limit >= 0 && this.size + 1 >= this.limit) {
|
|
22
24
|
// Remove the oldest entry when the limit is reached
|
package/dist/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,OAAO,UAAiB,SAAQ,GAAS;IACnC,SAAS,CAA2B;IACpC,KAAK,CAAQ;IAErB,YACI,SAAoC,EACpC,OAA0B,EAC1B,KAAK,GAAG,CAAC,CAAC;QAEV,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACtB,CAAC;IAED,0EAA0E;IACnE,GAAG,CAAC,GAAM;QACb,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACjB,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAA;QACtC,CAAC;QACD,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAE,CAAA;IAC1B,CAAC;IAED,qFAAqF;IAC9E,GAAG,CAAC,GAAM,EAAE,KAAQ;QACvB,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACjD,oDAAoD;YACpD,mFAAmF;YACnF,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAA;YAC1C,IAAI,SAAS,KAAK,SAAS;gBAAE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;QACvD,CAAC;QACD,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IAChC,CAAC;CACJ"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polintpro/proposit-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Core engine for building and manipulating propositional logic arguments.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"propositional-logic",
|
|
8
|
+
"logic-engine",
|
|
9
|
+
"argument",
|
|
10
|
+
"validation",
|
|
11
|
+
"formal-logic"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/polintpro/proposit-core",
|
|
6
14
|
"type": "module",
|
|
7
15
|
"main": "./dist/index.js",
|
|
8
16
|
"types": "./dist/index.d.ts",
|
|
@@ -26,9 +34,11 @@
|
|
|
26
34
|
"access": "public"
|
|
27
35
|
},
|
|
28
36
|
"devDependencies": {
|
|
37
|
+
"@types/js-yaml": "^4.0.9",
|
|
29
38
|
"@types/node": "^25.2.3",
|
|
30
39
|
"eslint": "^9.39.2",
|
|
31
40
|
"globals": "^16.5.0",
|
|
41
|
+
"peggy": "^5.0.6",
|
|
32
42
|
"prettier": "^3.8.1",
|
|
33
43
|
"typescript": "^5.9.3",
|
|
34
44
|
"typescript-eslint": "^8.55.0",
|
|
@@ -36,10 +46,12 @@
|
|
|
36
46
|
},
|
|
37
47
|
"dependencies": {
|
|
38
48
|
"commander": "^14.0.3",
|
|
49
|
+
"js-yaml": "^4.1.1",
|
|
39
50
|
"typebox": "^1.1.0"
|
|
40
51
|
},
|
|
41
52
|
"scripts": {
|
|
42
|
-
"
|
|
53
|
+
"generate:parser": "peggy --format es -o src/lib/core/parser/formula-gen.js src/lib/core/parser/formula.peggy",
|
|
54
|
+
"build": "pnpm run generate:parser && pnpm tsc -p tsconfig.build.json && cp src/lib/core/parser/formula-gen.js dist/lib/core/parser/formula-gen.js",
|
|
43
55
|
"typecheck": "pnpm tsc -p tsconfig.json",
|
|
44
56
|
"lint": "pnpm run prettify:check && pnpm eslint .",
|
|
45
57
|
"prettify": "pnpm prettier -w .",
|