@lucern/confidence 0.3.0-alpha.0 → 0.3.0-alpha.1
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/README.md +5 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +214 -87
- package/dist/index.js.map +1 -1
- package/dist/v1/codec.d.ts +42 -0
- package/dist/v1/codec.js +62 -0
- package/dist/v1/codec.js.map +1 -0
- package/dist/v1/index.d.ts +5 -3
- package/dist/v1/index.js +214 -87
- package/dist/v1/index.js.map +1 -1
- package/dist/v1/operations/approximation.js +30 -21
- package/dist/v1/operations/approximation.js.map +1 -1
- package/dist/v1/operations/bridge/index.d.ts +3 -3
- package/dist/v1/operations/bridge/index.js +27 -13
- package/dist/v1/operations/bridge/index.js.map +1 -1
- package/dist/v1/operations/canonical.d.ts +2 -2
- package/dist/v1/operations/canonical.js +16 -19
- package/dist/v1/operations/canonical.js.map +1 -1
- package/dist/v1/operations/contradiction/detectTupleContradiction.js.map +1 -1
- package/dist/v1/operations/contradiction/index.js.map +1 -1
- package/dist/v1/operations/dynamics/cascade.js +19 -6
- package/dist/v1/operations/dynamics/cascade.js.map +1 -1
- package/dist/v1/operations/dynamics/decay.js +5 -4
- package/dist/v1/operations/dynamics/decay.js.map +1 -1
- package/dist/v1/operations/dynamics/defeat.js +22 -17
- package/dist/v1/operations/dynamics/defeat.js.map +1 -1
- package/dist/v1/operations/dynamics/propagation.js +66 -33
- package/dist/v1/operations/dynamics/propagation.js.map +1 -1
- package/dist/v1/operations/dynamics/revision.d.ts +6 -6
- package/dist/v1/operations/dynamics/revision.js +31 -19
- package/dist/v1/operations/dynamics/revision.js.map +1 -1
- package/dist/v1/operations/index.js +9 -5
- package/dist/v1/operations/index.js.map +1 -1
- package/dist/v1/operations/lucern.d.ts +4 -2
- package/dist/v1/operations/lucern.js +179 -76
- package/dist/v1/operations/lucern.js.map +1 -1
- package/dist/v1/operations/operatorTaxonomy.d.ts +23 -1
- package/dist/v1/operations/operatorTaxonomy.js +28 -0
- package/dist/v1/operations/operatorTaxonomy.js.map +1 -1
- package/dist/v1/operations/scoring.d.ts +30 -12
- package/dist/v1/operations/scoring.js +82 -40
- package/dist/v1/operations/scoring.js.map +1 -1
- package/dist/v1/operations/subjectiveLogic/index.d.ts +20 -19
- package/dist/v1/operations/subjectiveLogic/index.js +11 -10
- package/dist/v1/operations/subjectiveLogic/index.js.map +1 -1
- package/dist/v1/operations/temporalDecay.js +9 -5
- package/dist/v1/operations/temporalDecay.js.map +1 -1
- package/dist/v1/types.d.ts +5 -1
- package/package.json +5 -1
|
@@ -13,6 +13,7 @@ var SL_APPROXIMATION_OPERATOR_NAMES = [
|
|
|
13
13
|
|
|
14
14
|
// src/v1/operations/canonical.ts
|
|
15
15
|
var SL_CANONICAL_OPERATOR_NAMES = [
|
|
16
|
+
"mkOpinion",
|
|
16
17
|
"opinion",
|
|
17
18
|
"vacuous",
|
|
18
19
|
"dogmatic",
|
|
@@ -30,6 +31,8 @@ var SL_CANONICAL_OPERATOR_NAMES = [
|
|
|
30
31
|
// src/v1/operations/lucern.ts
|
|
31
32
|
var LUCERN_SPECIFIC_OPERATOR_NAMES = [
|
|
32
33
|
"clamp01",
|
|
34
|
+
"fromStorage",
|
|
35
|
+
"toStorage",
|
|
33
36
|
"toStoredOpinionFields",
|
|
34
37
|
"readOpinionFromRecord",
|
|
35
38
|
"opinionFromScalar",
|
|
@@ -50,6 +53,7 @@ var LUCERN_SPECIFIC_OPERATOR_NAMES = [
|
|
|
50
53
|
"propagateAllEdges",
|
|
51
54
|
"bayesianUpdate",
|
|
52
55
|
"reviseConfidence",
|
|
56
|
+
"reviseConfidenceOpinion",
|
|
53
57
|
"computeBaseDecay",
|
|
54
58
|
"computeDeadlineUrgency",
|
|
55
59
|
"computeEffectiveDecay",
|
|
@@ -89,6 +93,12 @@ var PUBLIC_OPERATOR_EXPORT_NAMES = [
|
|
|
89
93
|
...LUCERN_SPECIFIC_OPERATOR_NAMES
|
|
90
94
|
];
|
|
91
95
|
var OPERATOR_TAXONOMY_ENTRIES = [
|
|
96
|
+
{
|
|
97
|
+
operator: "mkOpinion",
|
|
98
|
+
tag: "SL_CANONICAL",
|
|
99
|
+
sourceModule: "operations/subjectiveLogic/index.ts",
|
|
100
|
+
rationale: "Constructs the canonical binomial SL opinion tuple and normalizes it into valid mass components."
|
|
101
|
+
},
|
|
92
102
|
{
|
|
93
103
|
operator: "opinion",
|
|
94
104
|
tag: "SL_CANONICAL",
|
|
@@ -221,6 +231,18 @@ var OPERATOR_TAXONOMY_ENTRIES = [
|
|
|
221
231
|
sourceModule: "operations/scoring.ts",
|
|
222
232
|
rationale: "Implementation helper for Lucern APIs; it has no direct J\xF8sang operator analogue."
|
|
223
233
|
},
|
|
234
|
+
{
|
|
235
|
+
operator: "fromStorage",
|
|
236
|
+
tag: "LUCERN_SPECIFIC",
|
|
237
|
+
sourceModule: "codec.ts",
|
|
238
|
+
rationale: "Reads Lucern storage fields into a normalized opinion and reports repair metadata; it is storage glue, not SL algebra."
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
operator: "toStorage",
|
|
242
|
+
tag: "LUCERN_SPECIFIC",
|
|
243
|
+
sourceModule: "codec.ts",
|
|
244
|
+
rationale: "Serializes a normalized opinion into Lucern storage fields rather than implementing an SL algebra operator."
|
|
245
|
+
},
|
|
224
246
|
{
|
|
225
247
|
operator: "toStoredOpinionFields",
|
|
226
248
|
tag: "LUCERN_SPECIFIC",
|
|
@@ -341,6 +363,12 @@ var OPERATOR_TAXONOMY_ENTRIES = [
|
|
|
341
363
|
sourceModule: "operations/dynamics/revision.ts",
|
|
342
364
|
rationale: "Lucern wrapper around the scalar Bayesian revision helper rather than a direct SL operator."
|
|
343
365
|
},
|
|
366
|
+
{
|
|
367
|
+
operator: "reviseConfidenceOpinion",
|
|
368
|
+
tag: "LUCERN_SPECIFIC",
|
|
369
|
+
sourceModule: "operations/dynamics/revision.ts",
|
|
370
|
+
rationale: "Lucern revision helper that exposes the Beta-bridge opinion behind scalar confidence revision."
|
|
371
|
+
},
|
|
344
372
|
{
|
|
345
373
|
operator: "computeBaseDecay",
|
|
346
374
|
tag: "LUCERN_SPECIFIC",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/v1/operations/approximation.ts","../../../src/v1/operations/canonical.ts","../../../src/v1/operations/lucern.ts","../../../src/v1/operations/operatorTaxonomy.ts"],"names":[],"mappings":";AAAO,IAAM,+BAAA,GAAkC;AAAA,EAC7C,kBAAA;AAAA,EACA,iBAAA;AAAA,EACA,sBAAA;AAAA,EACA,sBAAA;AAAA,EACA,yBAAA;AAAA,EACA,iBAAA;AAAA,EACA,iBAAA;AAAA,EACA,yBAAA;AAAA,EACA;AACF,CAAA;;;ACVO,IAAM,2BAAA,GAA8B;AAAA,EACzC,SAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA,SAAA;AAAA,EACA,eAAA;AAAA,EACA,QAAA;AAAA,EACA,sBAAA;AAAA,EACA,uBAAA;AAAA,EACA,kBAAA;AAAA,EACA,qBAAA;AAAA,EACA,qBAAA;AAAA,EACA;AACF,CAAA;;;ACbO,IAAM,8BAAA,GAAiC;AAAA,EAC5C,SAAA;AAAA,EACA,uBAAA;AAAA,EACA,uBAAA;AAAA,EACA,mBAAA;AAAA,EACA,eAAA;AAAA,EACA,mBAAA;AAAA,EACA,4BAAA;AAAA,EACA,mCAAA;AAAA,EACA,0BAAA;AAAA,EACA,sCAAA;AAAA,EACA,iBAAA;AAAA,EACA,kBAAA;AAAA,EACA,iBAAA;AAAA,EACA,cAAA;AAAA,EACA,iBAAA;AAAA,EACA,uBAAA;AAAA,EACA,8BAAA;AAAA,EACA,sBAAA;AAAA,EACA,mBAAA;AAAA,EACA,gBAAA;AAAA,EACA,kBAAA;AAAA,EACA,kBAAA;AAAA,EACA,wBAAA;AAAA,EACA,uBAAA;AAAA,EACA,sBAAA;AAAA,EACA,OAAA;AAAA,EACA,sBA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AA,EAAiB;AACnB,CAAC","file":"operatorTaxonomy.js","sourcesContent":["export const SL_APPROXIMATION_OPERATOR_NAMES = [\n \"cumulativeFusion\",\n \"averagingFusion\",\n \"conditionalAbduction\",\n \"opinionFromDirichlet\",\n \"projectDirichletOpinion\",\n \"opinionFromBeta\",\n \"betaFromOpinion\",\n \"dampedDependencyOpinion\",\n \"dampedDependencyCascade\",\n] as const;\n\nexport {\n cumulativeFusion,\n averagingFusion,\n conditionalAbduction,\n} from \"./subjectiveLogic\";\nexport {\n opinionFromDirichlet,\n projectDirichletOpinion,\n opinionFromBeta,\n betaFromOpinion,\n} from \"./bridge\";\nexport {\n dampedDependencyOpinion,\n dampedDependencyCascade,\n} from \"./dynamics/cascade\";\n","export const SL_CANONICAL_OPERATOR_NAMES = [\n \"opinion\",\n \"vacuous\",\n \"dogmatic\",\n \"project\",\n \"trustDiscount\",\n \"negate\",\n \"conditionalDeduction\",\n \"confidenceFromOpinion\",\n \"confidenceFromSL\",\n \"opinionFromBaseRate\",\n \"opinionFromDogmatic\",\n \"opinionFromProjected\",\n] as const;\n\nexport {\n opinion,\n vacuous,\n dogmatic,\n project,\n trustDiscount,\n negate,\n conditionalDeduction,\n} from \"./subjectiveLogic\";\nexport {\n confidenceFromOpinion,\n confidenceFromSL,\n opinionFromBaseRate,\n opinionFromDogmatic,\n opinionFromProjected,\n} from \"./scoring\";\n","export const LUCERN_SPECIFIC_OPERATOR_NAMES = [\n \"clamp01\",\n \"toStoredOpinionFields\",\n \"readOpinionFromRecord\",\n \"opinionFromScalar\",\n \"temporalDecay\",\n \"toDogmaticOpinion\",\n \"hasProjectedOpinionChanged\",\n \"normalizeTupleContradictionPolicy\",\n \"detectTupleContradiction\",\n \"evaluateTupleContradictionTransition\",\n \"confidenceLevel\",\n \"constraintFusion\",\n \"evidenceBalance\",\n \"areTensioned\",\n \"informationGain\",\n \"isPropagationEdgeType\",\n \"getPropagationTraversalSpecs\",\n \"propagateThroughEdge\",\n \"propagateAllEdges\",\n \"bayesianUpdate\",\n \"reviseConfidence\",\n \"computeBaseDecay\",\n \"computeDeadlineUrgency\",\n \"computeEffectiveDecay\",\n \"getRescoringSchedule\",\n \"decay\",\n \"applyNegativeSupport\",\n \"applyNegativeEvidence\",\n \"deriveContractStatus\",\n \"deriveVerificationTrigger\",\n \"deriveContractModulationPlan\",\n \"createInheritedContractRecord\",\n \"normalizeEvidentialAction\",\n \"parseComparisonOperator\",\n \"parseNumericThreshold\",\n \"pickFiniteNumber\",\n \"getEvaluatorInputRecord\",\n \"parseEvidentialEvaluatorConfig\",\n \"compareMetricValue\",\n \"resolveComparisonResult\",\n \"buildComparisonRationale\",\n \"buildEvidentialRationale\",\n \"parseMetricCheckerConfig\",\n \"parseReferenceCheckCounterConfig\",\n \"parseTemporalDeadlineConfig\",\n \"parseMarketIndexComparatorConfig\",\n] as const;\n\nexport {\n clamp01,\n toStoredOpinionFields,\n readOpinionFromRecord,\n opinionFromScalar,\n toDogmaticOpinion,\n hasProjectedOpinionChanged,\n} from \"./scoring\";\nexport { temporalDecay } from \"./temporalDecay\";\nexport {\n normalizeTupleContradictionPolicy,\n detectTupleContradiction,\n evaluateTupleContradictionTransition,\n} from \"./contradiction\";\nexport {\n confidenceLevel,\n constraintFusion,\n evidenceBalance,\n areTensioned,\n informationGain,\n} from \"./subjectiveLogic\";\nexport {\n isPropagationEdgeType,\n getPropagationTraversalSpecs,\n propagateThroughEdge,\n propagateAllEdges,\n} from \"./dynamics/propagation\";\nexport { bayesianUpdate, reviseConfidence } from \"./dynamics/revision\";\nexport {\n computeBaseDecay,\n computeDeadlineUrgency,\n computeEffectiveDecay,\n getRescoringSchedule,\n decay,\n} from \"./dynamics/decay\";\nexport { applyNegativeSupport, applyNegativeEvidence } from \"./dynamics/defeat\";\nexport {\n deriveContractStatus,\n deriveVerificationTrigger,\n deriveContractModulationPlan,\n createInheritedContractRecord,\n normalizeEvidentialAction,\n parseComparisonOperator,\n parseNumericThreshold,\n pickFiniteNumber,\n getEvaluatorInputRecord,\n parseEvidentialEvaluatorConfig,\n compareMetricValue,\n resolveComparisonResult,\n buildComparisonRationale,\n buildEvidentialRationale,\n parseMetricCheckerConfig,\n parseReferenceCheckCounterConfig,\n parseTemporalDeadlineConfig,\n parseMarketIndexComparatorConfig,\n} from \"./contracts/epistemicContract\";\n","import { SL_APPROXIMATION_OPERATOR_NAMES } from \"./approximation\";\nimport { SL_CANONICAL_OPERATOR_NAMES } from \"./canonical\";\nimport { LUCERN_SPECIFIC_OPERATOR_NAMES } from \"./lucern\";\n\nexport const OPERATOR_TAXONOMY_TAGS = [\n \"SL_CANONICAL\",\n \"SL_APPROXIMATION\",\n \"LUCERN_SPECIFIC\",\n] as const;\n\nexport type OperatorTaxonomyTag = (typeof OPERATOR_TAXONOMY_TAGS)[number];\nexport type ConfidenceOperatorName =\n | (typeof SL_CANONICAL_OPERATOR_NAMES)[number]\n | (typeof SL_APPROXIMATION_OPERATOR_NAMES)[number]\n | (typeof LUCERN_SPECIFIC_OPERATOR_NAMES)[number];\n\nexport type OperatorTaxonomyEntry = {\n readonly operator: ConfidenceOperatorName;\n readonly tag: OperatorTaxonomyTag;\n readonly sourceModule: string;\n readonly rationale: string;\n};\n\nexport const PUBLIC_OPERATOR_EXPORT_NAMES = [\n ...SL_CANONICAL_OPERATOR_NAMES,\n ...SL_APPROXIMATION_OPERATOR_NAMES,\n ...LUCERN_SPECIFIC_OPERATOR_NAMES,\n] as const;\n\nexport const OPERATOR_TAXONOMY_ENTRIES = [\n {\n operator: \"opinion\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Constructs the canonical binomial SL opinion tuple and normalizes it into valid mass components.\",\n },\n {\n operator: \"vacuous\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Builds the canonical vacuous opinion with full uncertainty and an explicit base rate.\",\n },\n {\n operator: \"dogmatic\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Builds the canonical dogmatic opinion with zero uncertainty at a projected probability.\",\n },\n {\n operator: \"project\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Implements the canonical SL projected probability formula P = b + a*u.\",\n },\n {\n operator: \"trustDiscount\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Implements standard trust discounting by attenuating belief/disbelief mass and returning the remainder to uncertainty.\",\n },\n {\n operator: \"negate\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Implements canonical opinion negation by swapping belief and disbelief and complementing the base rate.\",\n },\n {\n operator: \"confidenceFromOpinion\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/scoring.ts\",\n rationale:\n \"Projects a stored opinion into its canonical scalar probability without adding Lucern-specific heuristics.\",\n },\n {\n operator: \"confidenceFromSL\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/scoring.ts\",\n rationale:\n \"Thin wrapper over the canonical SL projection formula for callers that provide tuple components directly.\",\n },\n {\n operator: \"opinionFromBaseRate\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/scoring.ts\",\n rationale:\n \"Constructs the canonical vacuous opinion from a prior/base-rate probability.\",\n },\n {\n operator: \"opinionFromDogmatic\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/scoring.ts\",\n rationale:\n \"Constructs the canonical dogmatic opinion from a projected probability and base rate.\",\n },\n {\n operator: \"opinionFromProjected\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/scoring.ts\",\n rationale:\n \"Reconstructs a valid opinion from projected probability plus explicit uncertainty without changing the SL tuple semantics.\",\n },\n {\n operator: \"cumulativeFusion\",\n tag: \"SL_APPROXIMATION\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Implements the cumulative fusion family, but Lucern averages base rates and special-cases dogmatic pairs instead of claiming a verbatim textbook transcription.\",\n },\n {\n operator: \"averagingFusion\",\n tag: \"SL_APPROXIMATION\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Implements the averaging fusion family with Lucern-specific base-rate averaging and dogmatic shortcuts.\",\n },\n {\n operator: \"conditionalDeduction\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Implements textbook Jøsang conditional deduction over (b, d, u, a) tuples with explicit child base-rate derivation and uncertainty correction.\",\n },\n {\n operator: \"conditionalAbduction\",\n tag: \"SL_APPROXIMATION\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Implements inverse conditional reasoning through projected probabilities and a Lucern uncertainty floor rather than a full subjective-network derivation.\",\n },\n {\n operator: \"opinionFromDirichlet\",\n tag: \"SL_APPROXIMATION\",\n sourceModule: \"operations/bridge/index.ts\",\n rationale:\n \"Bridges multinomial Dirichlet-style evidence counts into opinion mass with a configurable non-informative weight and normalized base-rate vector.\",\n },\n {\n operator: \"projectDirichletOpinion\",\n tag: \"SL_APPROXIMATION\",\n sourceModule: \"operations/bridge/index.ts\",\n rationale:\n \"Projects a Dirichlet opinion back into a multinomial probability vector rather than into Lucern's scalar node confidence.\",\n },\n {\n operator: \"opinionFromBeta\",\n tag: \"SL_APPROXIMATION\",\n sourceModule: \"operations/bridge/index.ts\",\n rationale:\n \"Bridges Beta evidence counts into SL opinions, but exposes a configurable non-informative weight instead of locking the canonical bridge to W = 2.\",\n },\n {\n operator: \"betaFromOpinion\",\n tag: \"SL_APPROXIMATION\",\n sourceModule: \"operations/bridge/index.ts\",\n rationale:\n \"Bridges opinions back to Beta parameters while allowing a configurable non-informative weight and explicit dogmatic infinities.\",\n },\n {\n operator: \"dampedDependencyOpinion\",\n tag: \"SL_APPROXIMATION\",\n sourceModule: \"operations/dynamics/cascade.ts\",\n rationale:\n \"Approximates dependency propagation with a threshold-or-damping scheme instead of a general SL network inference operator. Used as the fallback when edge metadata lacks explicit conditional opinions.\",\n },\n {\n operator: \"dampedDependencyCascade\",\n tag: \"SL_APPROXIMATION\",\n sourceModule: \"operations/dynamics/cascade.ts\",\n rationale:\n \"Wraps the damped dependency approximation and records it as dependency_cascade provenance for graph propagation. Fallback path for depends_on when edge conditionals are absent.\",\n },\n {\n operator: \"clamp01\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/scoring.ts\",\n rationale:\n \"Implementation helper for Lucern APIs; it has no direct Jøsang operator analogue.\",\n },\n {\n operator: \"toStoredOpinionFields\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/scoring.ts\",\n rationale:\n \"Serializes opinions into Lucern storage fields rather than implementing an SL algebra operator.\",\n },\n {\n operator: \"readOpinionFromRecord\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/scoring.ts\",\n rationale:\n \"Deserializes opinion fields from Lucern record shapes and fallback aliases; it is storage glue, not SL.\",\n },\n {\n operator: \"opinionFromScalar\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/scoring.ts\",\n rationale:\n \"Lucern convenience wrapper that multiplexes several scalar-to-opinion construction modes behind one API.\",\n },\n {\n operator: \"temporalDecay\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/temporalDecay.ts\",\n rationale:\n \"Lucern temporal operator that exponentially ages evidential mass back into uncertainty while preserving the prior/base rate.\",\n },\n {\n operator: \"toDogmaticOpinion\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/scoring.ts\",\n rationale:\n \"Deprecated Lucern shim retained for compatibility rather than as a canonical SL operator.\",\n },\n {\n operator: \"hasProjectedOpinionChanged\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/scoring.ts\",\n rationale:\n \"Lucern propagation threshold helper that decides whether a write is materially different enough to fan out.\",\n },\n {\n operator: \"normalizeTupleContradictionPolicy\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contradiction/detectTupleContradiction.ts\",\n rationale:\n \"Normalizes Lucern tuple-contradiction thresholds; tuple contradiction is not a standard SL operator.\",\n },\n {\n operator: \"detectTupleContradiction\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contradiction/detectTupleContradiction.ts\",\n rationale:\n \"Lucern heuristic that flags simultaneous high belief and disbelief mass as a first-class contradiction state.\",\n },\n {\n operator: \"evaluateTupleContradictionTransition\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contradiction/detectTupleContradiction.ts\",\n rationale:\n \"Lucern transition helper that turns tuple-contradiction threshold crossings into workflow signals.\",\n },\n {\n operator: \"confidenceLevel\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Buckets opinions into Lucern UI labels; it is not part of Jøsang's operator set.\",\n },\n {\n operator: \"constraintFusion\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Lucern exclusivity/XOR heuristic that pressures paired opinions; there is no direct textbook SL operator with this behavior.\",\n },\n {\n operator: \"evidenceBalance\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Lucern analytic helper that summarizes resolved evidence tilt after uncertainty is excluded.\",\n },\n {\n operator: \"areTensioned\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Lucern heuristic for surfacing opinion tension based on projected agreement plus residual disbelief mass.\",\n },\n {\n operator: \"informationGain\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Lucern heuristic score over uncertainty and balance; it is neither Shannon entropy nor a named SL operator.\",\n },\n {\n operator: \"isPropagationEdgeType\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/propagation.ts\",\n rationale:\n \"Lucern dispatch-table guard for graph edge semantics, not an SL algebra operator.\",\n },\n {\n operator: \"getPropagationTraversalSpecs\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/propagation.ts\",\n rationale:\n \"Exposes the pure-module edge traversal ordering used by the local propagation helpers; graph-primitives owns the multi-hop runtime.\",\n },\n {\n operator: \"propagateThroughEdge\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/propagation.ts\",\n rationale:\n \"Compiles Lucern edge types into operator application; the dispatch architecture itself has no direct Jøsang analogue.\",\n },\n {\n operator: \"propagateAllEdges\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/propagation.ts\",\n rationale:\n \"Lucern bounded aggregator for ordered 1-hop dispatch results across edge families.\",\n },\n {\n operator: \"bayesianUpdate\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/revision.ts\",\n rationale:\n \"Scalar Bayesian helper retained by Lucern as a fallback revision primitive outside the canonical SL operator family.\",\n },\n {\n operator: \"reviseConfidence\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/revision.ts\",\n rationale:\n \"Lucern wrapper around the scalar Bayesian revision helper rather than a direct SL operator.\",\n },\n {\n operator: \"computeBaseDecay\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/decay.ts\",\n rationale:\n \"Lucern recency heuristic over scored beliefs; decay tiers are a product rule, not part of SL.\",\n },\n {\n operator: \"computeDeadlineUrgency\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/decay.ts\",\n rationale:\n \"Lucern deadline heuristic that modulates rescoring urgency outside the SL literature.\",\n },\n {\n operator: \"computeEffectiveDecay\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/decay.ts\",\n rationale:\n \"Combines Lucern age, lifecycle, and deadline heuristics into an effective decay weight.\",\n },\n {\n operator: \"getRescoringSchedule\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/decay.ts\",\n rationale:\n \"Produces Lucern operational scheduling guidance for rescoring rather than opinion algebra.\",\n },\n {\n operator: \"decay\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/decay.ts\",\n rationale:\n \"Applies Lucern time-decay heuristics to an opinion tuple; it is not a named Jøsang operator.\",\n },\n {\n operator: \"applyNegativeSupport\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/defeat.ts\",\n rationale:\n \"Lucern graph-specific defeater wrapper that chooses between XOR pressure and negation-plus-discount-plus-fusion.\",\n },\n {\n operator: \"applyNegativeEvidence\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/defeat.ts\",\n rationale:\n \"Lucern signed-edge wrapper that interprets negative evidence through a composed anti-opinion path.\",\n },\n {\n operator: \"deriveContractStatus\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Lucern contract-lifecycle helper with no direct relation to the SL operator family.\",\n },\n {\n operator: \"deriveVerificationTrigger\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Maps Lucern contract evaluation results into confidence triggers for workflow use.\",\n },\n {\n operator: \"deriveContractModulationPlan\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Computes Lucern confidence deltas from contract outcomes; contracts are a Lucern control surface, not SL.\",\n },\n {\n operator: \"createInheritedContractRecord\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Builds Lucern contract lineage records rather than confidence algebra.\",\n },\n {\n operator: \"normalizeEvidentialAction\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Normalizes Lucern evidential contract actions for workflow execution.\",\n },\n {\n operator: \"parseComparisonOperator\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Parses Lucern contract evaluator configuration; it is not an SL operator.\",\n },\n {\n operator: \"parseNumericThreshold\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Lucern contract-config helper for numeric thresholds.\",\n },\n {\n operator: \"pickFiniteNumber\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Lucern parser utility for evaluator configuration and snapshots.\",\n },\n {\n operator: \"getEvaluatorInputRecord\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Extracts Lucern evaluator payloads from nested runtime records.\",\n },\n {\n operator: \"parseEvidentialEvaluatorConfig\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Parses Lucern evidential contract configuration into a typed evaluator plan.\",\n },\n {\n operator: \"compareMetricValue\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Executes Lucern contract comparison semantics rather than SL tuple algebra.\",\n },\n {\n operator: \"resolveComparisonResult\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Maps Lucern comparison outcomes into contract confirmation or disconfirmation.\",\n },\n {\n operator: \"buildComparisonRationale\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Renders Lucern contract-evaluation explanations for auditability.\",\n },\n {\n operator: \"buildEvidentialRationale\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Renders Lucern evidential evaluator explanations for auditability.\",\n },\n {\n operator: \"parseMetricCheckerConfig\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Parses the Lucern metric-checker contract evaluator.\",\n },\n {\n operator: \"parseReferenceCheckCounterConfig\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Parses the Lucern reference-check counter evaluator.\",\n },\n {\n operator: \"parseTemporalDeadlineConfig\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Parses Lucern deadline-evaluator configuration for time-bounded claims.\",\n },\n {\n operator: \"parseMarketIndexComparatorConfig\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Parses the Lucern market-index comparator evaluator.\",\n },\n] as const satisfies readonly OperatorTaxonomyEntry[];\n\nexport const OPERATOR_TAXONOMY = Object.freeze(\n Object.fromEntries(\n OPERATOR_TAXONOMY_ENTRIES.map((entry) => [entry.operator, entry])\n )\n) as Readonly<Record<ConfidenceOperatorName, OperatorTaxonomyEntry>>;\n\nexport const OPERATOR_TAXONOMY_BY_TAG = Object.freeze({\n SL_CANONICAL: SL_CANONICAL_OPERATOR_NAMES,\n SL_APPROXIMATION: SL_APPROXIMATION_OPERATOR_NAMES,\n LUCERN_SPECIFIC: LUCERN_SPECIFIC_OPERATOR_NAMES,\n}) as Readonly<Record<OperatorTaxonomyTag, readonly ConfidenceOperatorName[]>>;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/v1/operations/approximation.ts","../../../src/v1/operations/canonical.ts","../../../src/v1/operations/lucern.ts","../../../src/v1/operations/operatorTaxonomy.ts"],"names":[],"mappings":";AAAO,IAAM,+BAAA,GAAkC;AAAA,EAC7C,kBAAA;AAAA,EACA,iBAAA;AAAA,EACA,sBAAA;AAAA,EACA,sBAAA;AAAA,EACA,yBAAA;AAAA,EACA,iBAAA;AAAA,EACA,iBAAA;AAAA,EACA,yBAAA;AAAA,EACA;AACF,C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pE;AAEO,IAAM,wBAAA,GAA2B,OAAO,MAAA,CAAO;AAAA,EACpD,YAAA,EAAc,2BAAA;AAAA,EACd,gBAAA,EAAkB,+BAAA;AAAA,EAClB,eAAA,EAAiB;AACnB,CAAC","file":"operatorTaxonomy.js","sourcesContent":["export const SL_APPROXIMATION_OPERATOR_NAMES = [\n \"cumulativeFusion\",\n \"averagingFusion\",\n \"conditionalAbduction\",\n \"opinionFromDirichlet\",\n \"projectDirichletOpinion\",\n \"opinionFromBeta\",\n \"betaFromOpinion\",\n \"dampedDependencyOpinion\",\n \"dampedDependencyCascade\",\n] as const;\n\nexport {\n cumulativeFusion,\n averagingFusion,\n conditionalAbduction,\n} from \"./subjectiveLogic\";\nexport {\n opinionFromDirichlet,\n projectDirichletOpinion,\n opinionFromBeta,\n betaFromOpinion,\n} from \"./bridge\";\nexport {\n dampedDependencyOpinion,\n dampedDependencyCascade,\n} from \"./dynamics/cascade\";\n","export const SL_CANONICAL_OPERATOR_NAMES = [\n \"mkOpinion\",\n \"opinion\",\n \"vacuous\",\n \"dogmatic\",\n \"project\",\n \"trustDiscount\",\n \"negate\",\n \"conditionalDeduction\",\n \"confidenceFromOpinion\",\n \"confidenceFromSL\",\n \"opinionFromBaseRate\",\n \"opinionFromDogmatic\",\n \"opinionFromProjected\",\n] as const;\n\nexport {\n mkOpinion,\n opinion,\n vacuous,\n dogmatic,\n project,\n trustDiscount,\n negate,\n conditionalDeduction,\n} from \"./subjectiveLogic\";\nexport {\n confidenceFromOpinion,\n confidenceFromSL,\n opinionFromBaseRate,\n opinionFromDogmatic,\n opinionFromProjected,\n} from \"./scoring\";\n","export const LUCERN_SPECIFIC_OPERATOR_NAMES = [\n \"clamp01\",\n \"fromStorage\",\n \"toStorage\",\n \"toStoredOpinionFields\",\n \"readOpinionFromRecord\",\n \"opinionFromScalar\",\n \"temporalDecay\",\n \"toDogmaticOpinion\",\n \"hasProjectedOpinionChanged\",\n \"normalizeTupleContradictionPolicy\",\n \"detectTupleContradiction\",\n \"evaluateTupleContradictionTransition\",\n \"confidenceLevel\",\n \"constraintFusion\",\n \"evidenceBalance\",\n \"areTensioned\",\n \"informationGain\",\n \"isPropagationEdgeType\",\n \"getPropagationTraversalSpecs\",\n \"propagateThroughEdge\",\n \"propagateAllEdges\",\n \"bayesianUpdate\",\n \"reviseConfidence\",\n \"reviseConfidenceOpinion\",\n \"computeBaseDecay\",\n \"computeDeadlineUrgency\",\n \"computeEffectiveDecay\",\n \"getRescoringSchedule\",\n \"decay\",\n \"applyNegativeSupport\",\n \"applyNegativeEvidence\",\n \"deriveContractStatus\",\n \"deriveVerificationTrigger\",\n \"deriveContractModulationPlan\",\n \"createInheritedContractRecord\",\n \"normalizeEvidentialAction\",\n \"parseComparisonOperator\",\n \"parseNumericThreshold\",\n \"pickFiniteNumber\",\n \"getEvaluatorInputRecord\",\n \"parseEvidentialEvaluatorConfig\",\n \"compareMetricValue\",\n \"resolveComparisonResult\",\n \"buildComparisonRationale\",\n \"buildEvidentialRationale\",\n \"parseMetricCheckerConfig\",\n \"parseReferenceCheckCounterConfig\",\n \"parseTemporalDeadlineConfig\",\n \"parseMarketIndexComparatorConfig\",\n] as const;\n\nexport {\n clamp01,\n toStoredOpinionFields,\n readOpinionFromRecord,\n opinionFromScalar,\n toDogmaticOpinion,\n hasProjectedOpinionChanged,\n} from \"./scoring\";\nexport { fromStorage, toStorage } from \"../codec\";\nexport { temporalDecay } from \"./temporalDecay\";\nexport {\n normalizeTupleContradictionPolicy,\n detectTupleContradiction,\n evaluateTupleContradictionTransition,\n} from \"./contradiction\";\nexport {\n confidenceLevel,\n constraintFusion,\n evidenceBalance,\n areTensioned,\n informationGain,\n} from \"./subjectiveLogic\";\nexport {\n isPropagationEdgeType,\n getPropagationTraversalSpecs,\n propagateThroughEdge,\n propagateAllEdges,\n} from \"./dynamics/propagation\";\nexport {\n bayesianUpdate,\n reviseConfidence,\n reviseConfidenceOpinion,\n} from \"./dynamics/revision\";\nexport {\n computeBaseDecay,\n computeDeadlineUrgency,\n computeEffectiveDecay,\n getRescoringSchedule,\n decay,\n} from \"./dynamics/decay\";\nexport { applyNegativeSupport, applyNegativeEvidence } from \"./dynamics/defeat\";\nexport {\n deriveContractStatus,\n deriveVerificationTrigger,\n deriveContractModulationPlan,\n createInheritedContractRecord,\n normalizeEvidentialAction,\n parseComparisonOperator,\n parseNumericThreshold,\n pickFiniteNumber,\n getEvaluatorInputRecord,\n parseEvidentialEvaluatorConfig,\n compareMetricValue,\n resolveComparisonResult,\n buildComparisonRationale,\n buildEvidentialRationale,\n parseMetricCheckerConfig,\n parseReferenceCheckCounterConfig,\n parseTemporalDeadlineConfig,\n parseMarketIndexComparatorConfig,\n} from \"./contracts/epistemicContract\";\n","import { SL_APPROXIMATION_OPERATOR_NAMES } from \"./approximation\";\nimport { SL_CANONICAL_OPERATOR_NAMES } from \"./canonical\";\nimport { LUCERN_SPECIFIC_OPERATOR_NAMES } from \"./lucern\";\n\nexport const OPERATOR_TAXONOMY_TAGS = [\n \"SL_CANONICAL\",\n \"SL_APPROXIMATION\",\n \"LUCERN_SPECIFIC\",\n] as const;\n\nexport type OperatorTaxonomyTag = (typeof OPERATOR_TAXONOMY_TAGS)[number];\nexport type ConfidenceOperatorName =\n | (typeof SL_CANONICAL_OPERATOR_NAMES)[number]\n | (typeof SL_APPROXIMATION_OPERATOR_NAMES)[number]\n | (typeof LUCERN_SPECIFIC_OPERATOR_NAMES)[number];\n\nexport type OperatorTaxonomyEntry = {\n readonly operator: ConfidenceOperatorName;\n readonly tag: OperatorTaxonomyTag;\n readonly sourceModule: string;\n readonly rationale: string;\n};\n\nexport const PUBLIC_OPERATOR_EXPORT_NAMES = [\n ...SL_CANONICAL_OPERATOR_NAMES,\n ...SL_APPROXIMATION_OPERATOR_NAMES,\n ...LUCERN_SPECIFIC_OPERATOR_NAMES,\n] as const;\n\nexport const OPERATOR_TAXONOMY_ENTRIES = [\n {\n operator: \"mkOpinion\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Constructs the canonical binomial SL opinion tuple and normalizes it into valid mass components.\",\n },\n {\n operator: \"opinion\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Constructs the canonical binomial SL opinion tuple and normalizes it into valid mass components.\",\n },\n {\n operator: \"vacuous\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Builds the canonical vacuous opinion with full uncertainty and an explicit base rate.\",\n },\n {\n operator: \"dogmatic\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Builds the canonical dogmatic opinion with zero uncertainty at a projected probability.\",\n },\n {\n operator: \"project\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Implements the canonical SL projected probability formula P = b + a*u.\",\n },\n {\n operator: \"trustDiscount\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Implements standard trust discounting by attenuating belief/disbelief mass and returning the remainder to uncertainty.\",\n },\n {\n operator: \"negate\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Implements canonical opinion negation by swapping belief and disbelief and complementing the base rate.\",\n },\n {\n operator: \"confidenceFromOpinion\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/scoring.ts\",\n rationale:\n \"Projects a stored opinion into its canonical scalar probability without adding Lucern-specific heuristics.\",\n },\n {\n operator: \"confidenceFromSL\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/scoring.ts\",\n rationale:\n \"Thin wrapper over the canonical SL projection formula for callers that provide tuple components directly.\",\n },\n {\n operator: \"opinionFromBaseRate\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/scoring.ts\",\n rationale:\n \"Constructs the canonical vacuous opinion from a prior/base-rate probability.\",\n },\n {\n operator: \"opinionFromDogmatic\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/scoring.ts\",\n rationale:\n \"Constructs the canonical dogmatic opinion from a projected probability and base rate.\",\n },\n {\n operator: \"opinionFromProjected\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/scoring.ts\",\n rationale:\n \"Reconstructs a valid opinion from projected probability plus explicit uncertainty without changing the SL tuple semantics.\",\n },\n {\n operator: \"cumulativeFusion\",\n tag: \"SL_APPROXIMATION\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Implements the cumulative fusion family, but Lucern averages base rates and special-cases dogmatic pairs instead of claiming a verbatim textbook transcription.\",\n },\n {\n operator: \"averagingFusion\",\n tag: \"SL_APPROXIMATION\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Implements the averaging fusion family with Lucern-specific base-rate averaging and dogmatic shortcuts.\",\n },\n {\n operator: \"conditionalDeduction\",\n tag: \"SL_CANONICAL\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Implements textbook Jøsang conditional deduction over (b, d, u, a) tuples with explicit child base-rate derivation and uncertainty correction.\",\n },\n {\n operator: \"conditionalAbduction\",\n tag: \"SL_APPROXIMATION\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Implements inverse conditional reasoning through projected probabilities and a Lucern uncertainty floor rather than a full subjective-network derivation.\",\n },\n {\n operator: \"opinionFromDirichlet\",\n tag: \"SL_APPROXIMATION\",\n sourceModule: \"operations/bridge/index.ts\",\n rationale:\n \"Bridges multinomial Dirichlet-style evidence counts into opinion mass with a configurable non-informative weight and normalized base-rate vector.\",\n },\n {\n operator: \"projectDirichletOpinion\",\n tag: \"SL_APPROXIMATION\",\n sourceModule: \"operations/bridge/index.ts\",\n rationale:\n \"Projects a Dirichlet opinion back into a multinomial probability vector rather than into Lucern's scalar node confidence.\",\n },\n {\n operator: \"opinionFromBeta\",\n tag: \"SL_APPROXIMATION\",\n sourceModule: \"operations/bridge/index.ts\",\n rationale:\n \"Bridges Beta evidence counts into SL opinions, but exposes a configurable non-informative weight instead of locking the canonical bridge to W = 2.\",\n },\n {\n operator: \"betaFromOpinion\",\n tag: \"SL_APPROXIMATION\",\n sourceModule: \"operations/bridge/index.ts\",\n rationale:\n \"Bridges opinions back to Beta parameters while allowing a configurable non-informative weight and explicit dogmatic infinities.\",\n },\n {\n operator: \"dampedDependencyOpinion\",\n tag: \"SL_APPROXIMATION\",\n sourceModule: \"operations/dynamics/cascade.ts\",\n rationale:\n \"Approximates dependency propagation with a threshold-or-damping scheme instead of a general SL network inference operator. Used as the fallback when edge metadata lacks explicit conditional opinions.\",\n },\n {\n operator: \"dampedDependencyCascade\",\n tag: \"SL_APPROXIMATION\",\n sourceModule: \"operations/dynamics/cascade.ts\",\n rationale:\n \"Wraps the damped dependency approximation and records it as dependency_cascade provenance for graph propagation. Fallback path for depends_on when edge conditionals are absent.\",\n },\n {\n operator: \"clamp01\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/scoring.ts\",\n rationale:\n \"Implementation helper for Lucern APIs; it has no direct Jøsang operator analogue.\",\n },\n {\n operator: \"fromStorage\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"codec.ts\",\n rationale:\n \"Reads Lucern storage fields into a normalized opinion and reports repair metadata; it is storage glue, not SL algebra.\",\n },\n {\n operator: \"toStorage\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"codec.ts\",\n rationale:\n \"Serializes a normalized opinion into Lucern storage fields rather than implementing an SL algebra operator.\",\n },\n {\n operator: \"toStoredOpinionFields\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/scoring.ts\",\n rationale:\n \"Serializes opinions into Lucern storage fields rather than implementing an SL algebra operator.\",\n },\n {\n operator: \"readOpinionFromRecord\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/scoring.ts\",\n rationale:\n \"Deserializes opinion fields from Lucern record shapes and fallback aliases; it is storage glue, not SL.\",\n },\n {\n operator: \"opinionFromScalar\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/scoring.ts\",\n rationale:\n \"Lucern convenience wrapper that multiplexes several scalar-to-opinion construction modes behind one API.\",\n },\n {\n operator: \"temporalDecay\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/temporalDecay.ts\",\n rationale:\n \"Lucern temporal operator that exponentially ages evidential mass back into uncertainty while preserving the prior/base rate.\",\n },\n {\n operator: \"toDogmaticOpinion\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/scoring.ts\",\n rationale:\n \"Deprecated Lucern shim retained for compatibility rather than as a canonical SL operator.\",\n },\n {\n operator: \"hasProjectedOpinionChanged\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/scoring.ts\",\n rationale:\n \"Lucern propagation threshold helper that decides whether a write is materially different enough to fan out.\",\n },\n {\n operator: \"normalizeTupleContradictionPolicy\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contradiction/detectTupleContradiction.ts\",\n rationale:\n \"Normalizes Lucern tuple-contradiction thresholds; tuple contradiction is not a standard SL operator.\",\n },\n {\n operator: \"detectTupleContradiction\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contradiction/detectTupleContradiction.ts\",\n rationale:\n \"Lucern heuristic that flags simultaneous high belief and disbelief mass as a first-class contradiction state.\",\n },\n {\n operator: \"evaluateTupleContradictionTransition\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contradiction/detectTupleContradiction.ts\",\n rationale:\n \"Lucern transition helper that turns tuple-contradiction threshold crossings into workflow signals.\",\n },\n {\n operator: \"confidenceLevel\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Buckets opinions into Lucern UI labels; it is not part of Jøsang's operator set.\",\n },\n {\n operator: \"constraintFusion\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Lucern exclusivity/XOR heuristic that pressures paired opinions; there is no direct textbook SL operator with this behavior.\",\n },\n {\n operator: \"evidenceBalance\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Lucern analytic helper that summarizes resolved evidence tilt after uncertainty is excluded.\",\n },\n {\n operator: \"areTensioned\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Lucern heuristic for surfacing opinion tension based on projected agreement plus residual disbelief mass.\",\n },\n {\n operator: \"informationGain\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/subjectiveLogic/index.ts\",\n rationale:\n \"Lucern heuristic score over uncertainty and balance; it is neither Shannon entropy nor a named SL operator.\",\n },\n {\n operator: \"isPropagationEdgeType\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/propagation.ts\",\n rationale:\n \"Lucern dispatch-table guard for graph edge semantics, not an SL algebra operator.\",\n },\n {\n operator: \"getPropagationTraversalSpecs\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/propagation.ts\",\n rationale:\n \"Exposes the pure-module edge traversal ordering used by the local propagation helpers; graph-primitives owns the multi-hop runtime.\",\n },\n {\n operator: \"propagateThroughEdge\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/propagation.ts\",\n rationale:\n \"Compiles Lucern edge types into operator application; the dispatch architecture itself has no direct Jøsang analogue.\",\n },\n {\n operator: \"propagateAllEdges\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/propagation.ts\",\n rationale:\n \"Lucern bounded aggregator for ordered 1-hop dispatch results across edge families.\",\n },\n {\n operator: \"bayesianUpdate\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/revision.ts\",\n rationale:\n \"Scalar Bayesian helper retained by Lucern as a fallback revision primitive outside the canonical SL operator family.\",\n },\n {\n operator: \"reviseConfidence\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/revision.ts\",\n rationale:\n \"Lucern wrapper around the scalar Bayesian revision helper rather than a direct SL operator.\",\n },\n {\n operator: \"reviseConfidenceOpinion\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/revision.ts\",\n rationale:\n \"Lucern revision helper that exposes the Beta-bridge opinion behind scalar confidence revision.\",\n },\n {\n operator: \"computeBaseDecay\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/decay.ts\",\n rationale:\n \"Lucern recency heuristic over scored beliefs; decay tiers are a product rule, not part of SL.\",\n },\n {\n operator: \"computeDeadlineUrgency\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/decay.ts\",\n rationale:\n \"Lucern deadline heuristic that modulates rescoring urgency outside the SL literature.\",\n },\n {\n operator: \"computeEffectiveDecay\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/decay.ts\",\n rationale:\n \"Combines Lucern age, lifecycle, and deadline heuristics into an effective decay weight.\",\n },\n {\n operator: \"getRescoringSchedule\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/decay.ts\",\n rationale:\n \"Produces Lucern operational scheduling guidance for rescoring rather than opinion algebra.\",\n },\n {\n operator: \"decay\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/decay.ts\",\n rationale:\n \"Applies Lucern time-decay heuristics to an opinion tuple; it is not a named Jøsang operator.\",\n },\n {\n operator: \"applyNegativeSupport\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/defeat.ts\",\n rationale:\n \"Lucern graph-specific defeater wrapper that chooses between XOR pressure and negation-plus-discount-plus-fusion.\",\n },\n {\n operator: \"applyNegativeEvidence\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/dynamics/defeat.ts\",\n rationale:\n \"Lucern signed-edge wrapper that interprets negative evidence through a composed anti-opinion path.\",\n },\n {\n operator: \"deriveContractStatus\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Lucern contract-lifecycle helper with no direct relation to the SL operator family.\",\n },\n {\n operator: \"deriveVerificationTrigger\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Maps Lucern contract evaluation results into confidence triggers for workflow use.\",\n },\n {\n operator: \"deriveContractModulationPlan\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Computes Lucern confidence deltas from contract outcomes; contracts are a Lucern control surface, not SL.\",\n },\n {\n operator: \"createInheritedContractRecord\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Builds Lucern contract lineage records rather than confidence algebra.\",\n },\n {\n operator: \"normalizeEvidentialAction\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Normalizes Lucern evidential contract actions for workflow execution.\",\n },\n {\n operator: \"parseComparisonOperator\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Parses Lucern contract evaluator configuration; it is not an SL operator.\",\n },\n {\n operator: \"parseNumericThreshold\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Lucern contract-config helper for numeric thresholds.\",\n },\n {\n operator: \"pickFiniteNumber\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Lucern parser utility for evaluator configuration and snapshots.\",\n },\n {\n operator: \"getEvaluatorInputRecord\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Extracts Lucern evaluator payloads from nested runtime records.\",\n },\n {\n operator: \"parseEvidentialEvaluatorConfig\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Parses Lucern evidential contract configuration into a typed evaluator plan.\",\n },\n {\n operator: \"compareMetricValue\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Executes Lucern contract comparison semantics rather than SL tuple algebra.\",\n },\n {\n operator: \"resolveComparisonResult\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Maps Lucern comparison outcomes into contract confirmation or disconfirmation.\",\n },\n {\n operator: \"buildComparisonRationale\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Renders Lucern contract-evaluation explanations for auditability.\",\n },\n {\n operator: \"buildEvidentialRationale\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Renders Lucern evidential evaluator explanations for auditability.\",\n },\n {\n operator: \"parseMetricCheckerConfig\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Parses the Lucern metric-checker contract evaluator.\",\n },\n {\n operator: \"parseReferenceCheckCounterConfig\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Parses the Lucern reference-check counter evaluator.\",\n },\n {\n operator: \"parseTemporalDeadlineConfig\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Parses Lucern deadline-evaluator configuration for time-bounded claims.\",\n },\n {\n operator: \"parseMarketIndexComparatorConfig\",\n tag: \"LUCERN_SPECIFIC\",\n sourceModule: \"operations/contracts/epistemicContract.ts\",\n rationale:\n \"Parses the Lucern market-index comparator evaluator.\",\n },\n] as const satisfies readonly OperatorTaxonomyEntry[];\n\nexport const OPERATOR_TAXONOMY = Object.freeze(\n Object.fromEntries(\n OPERATOR_TAXONOMY_ENTRIES.map((entry) => [entry.operator, entry])\n )\n) as Readonly<Record<ConfidenceOperatorName, OperatorTaxonomyEntry>>;\n\nexport const OPERATOR_TAXONOMY_BY_TAG = Object.freeze({\n SL_CANONICAL: SL_CANONICAL_OPERATOR_NAMES,\n SL_APPROXIMATION: SL_APPROXIMATION_OPERATOR_NAMES,\n LUCERN_SPECIFIC: LUCERN_SPECIFIC_OPERATOR_NAMES,\n}) as Readonly<Record<OperatorTaxonomyTag, readonly ConfidenceOperatorName[]>>;\n"]}
|
|
@@ -1,28 +1,46 @@
|
|
|
1
|
-
import { Opinion, StoredOpinionFields } from '../types.js';
|
|
1
|
+
import { Opinion, StoredOpinionFields, SLOpinion } from '../types.js';
|
|
2
2
|
|
|
3
3
|
declare function clamp01(value: number): number;
|
|
4
4
|
declare function confidenceFromOpinion(opinion: Opinion): number;
|
|
5
|
-
declare function confidenceFromSL(belief: number, _disbelief: number, uncertainty: number, baseRate
|
|
5
|
+
declare function confidenceFromSL(belief: number, _disbelief: number, uncertainty: number, baseRate: number): number;
|
|
6
6
|
declare function toStoredOpinionFields(opinion: Opinion): StoredOpinionFields;
|
|
7
|
-
declare function readOpinionFromRecord(source: unknown
|
|
7
|
+
declare function readOpinionFromRecord(source: unknown): SLOpinion;
|
|
8
8
|
type OpinionFromScalarMode = "base_rate" | "dogmatic" | "projected_with_u";
|
|
9
|
-
|
|
10
|
-
baseRate?:
|
|
11
|
-
uncertainty?:
|
|
12
|
-
}
|
|
9
|
+
type OpinionFromScalarOptions = {
|
|
10
|
+
baseRate?: never;
|
|
11
|
+
uncertainty?: never;
|
|
12
|
+
} | {
|
|
13
|
+
baseRate: number;
|
|
14
|
+
uncertainty?: never;
|
|
15
|
+
} | {
|
|
16
|
+
baseRate: number;
|
|
17
|
+
uncertainty: number;
|
|
18
|
+
};
|
|
19
|
+
declare function opinionFromScalar(value: number, mode: "base_rate", options?: {
|
|
20
|
+
baseRate?: never;
|
|
21
|
+
uncertainty?: never;
|
|
22
|
+
}): SLOpinion;
|
|
23
|
+
declare function opinionFromScalar(value: number, mode: "dogmatic", options: {
|
|
24
|
+
baseRate: number;
|
|
25
|
+
uncertainty?: never;
|
|
26
|
+
}): SLOpinion;
|
|
27
|
+
declare function opinionFromScalar(value: number, mode: "projected_with_u", options: {
|
|
28
|
+
baseRate: number;
|
|
29
|
+
uncertainty: number;
|
|
30
|
+
}): SLOpinion;
|
|
13
31
|
/**
|
|
14
32
|
* @deprecated Use opinionFromScalar(value, "dogmatic", { baseRate }) instead.
|
|
15
33
|
*/
|
|
16
|
-
declare function toDogmaticOpinion(confidence: number, baseRate
|
|
34
|
+
declare function toDogmaticOpinion(confidence: number, baseRate: number): SLOpinion;
|
|
17
35
|
/** Interpret p as a prior with no observed evidence. */
|
|
18
|
-
declare function opinionFromBaseRate(probability: number):
|
|
36
|
+
declare function opinionFromBaseRate(probability: number): SLOpinion;
|
|
19
37
|
/** Interpret p as a certainty-equivalent projected probability. */
|
|
20
|
-
declare function opinionFromDogmatic(probability: number, baseRate
|
|
38
|
+
declare function opinionFromDogmatic(probability: number, baseRate: number): SLOpinion;
|
|
21
39
|
/**
|
|
22
40
|
* Interpret p as a projected probability with an explicit uncertainty bucket.
|
|
23
41
|
* The resulting opinion always projects back to p.
|
|
24
42
|
*/
|
|
25
|
-
declare function opinionFromProjected(probability: number, uncertainty: number, baseRate
|
|
43
|
+
declare function opinionFromProjected(probability: number, uncertainty: number, baseRate: number): SLOpinion;
|
|
26
44
|
declare function hasProjectedOpinionChanged(current: Opinion, next: Opinion, tolerance?: number): boolean;
|
|
27
45
|
|
|
28
|
-
export { type OpinionFromScalarMode, clamp01, confidenceFromOpinion, confidenceFromSL, hasProjectedOpinionChanged, opinionFromBaseRate, opinionFromDogmatic, opinionFromProjected, opinionFromScalar, readOpinionFromRecord, toDogmaticOpinion, toStoredOpinionFields };
|
|
46
|
+
export { type OpinionFromScalarMode, type OpinionFromScalarOptions, clamp01, confidenceFromOpinion, confidenceFromSL, hasProjectedOpinionChanged, opinionFromBaseRate, opinionFromDogmatic, opinionFromProjected, opinionFromScalar, readOpinionFromRecord, toDogmaticOpinion, toStoredOpinionFields };
|
|
@@ -1,23 +1,48 @@
|
|
|
1
1
|
// src/v1/operations/subjectiveLogic/index.ts
|
|
2
|
-
function
|
|
3
|
-
|
|
2
|
+
function mkOpinion(belief, disbelief, uncertainty, baseRate) {
|
|
3
|
+
const b = Number.isFinite(belief) ? Math.max(0, belief) : 0;
|
|
4
|
+
const d = Number.isFinite(disbelief) ? Math.max(0, disbelief) : 0;
|
|
5
|
+
const u = Number.isFinite(uncertainty) ? Math.max(0, uncertainty) : 0;
|
|
6
|
+
const a = Math.max(0, Math.min(1, baseRate));
|
|
7
|
+
const sum = b + d + u;
|
|
8
|
+
if (sum === 0) {
|
|
9
|
+
return { b: 0, d: 0, u: 1, a };
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
b: b / sum,
|
|
13
|
+
d: d / sum,
|
|
14
|
+
u: u / sum,
|
|
15
|
+
a
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function vacuous(baseRate) {
|
|
19
|
+
return mkOpinion(0, 0, 1, baseRate);
|
|
4
20
|
}
|
|
5
|
-
function dogmatic(probability, baseRate
|
|
21
|
+
function dogmatic(probability, baseRate) {
|
|
6
22
|
const p = Math.max(0, Math.min(1, probability));
|
|
7
|
-
return
|
|
23
|
+
return mkOpinion(p, 1 - p, 0, baseRate);
|
|
8
24
|
}
|
|
9
25
|
|
|
10
26
|
// src/v1/operations/scoring.ts
|
|
11
27
|
function finiteNumber(value) {
|
|
12
28
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
13
29
|
}
|
|
30
|
+
function requiredOpinionNumber(label, ...values) {
|
|
31
|
+
for (const value of values) {
|
|
32
|
+
const numberValue = finiteNumber(value);
|
|
33
|
+
if (numberValue !== void 0) {
|
|
34
|
+
return numberValue;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
throw new Error(`Opinion record is missing required ${label}.`);
|
|
38
|
+
}
|
|
14
39
|
function clamp01(value) {
|
|
15
40
|
return Math.max(0, Math.min(1, value));
|
|
16
41
|
}
|
|
17
42
|
function confidenceFromOpinion(opinion) {
|
|
18
43
|
return clamp01(opinion.b + opinion.a * opinion.u);
|
|
19
44
|
}
|
|
20
|
-
function confidenceFromSL(belief, _disbelief, uncertainty, baseRate
|
|
45
|
+
function confidenceFromSL(belief, _disbelief, uncertainty, baseRate) {
|
|
21
46
|
return confidenceFromOpinion({
|
|
22
47
|
b: belief,
|
|
23
48
|
u: uncertainty,
|
|
@@ -32,34 +57,56 @@ function toStoredOpinionFields(opinion) {
|
|
|
32
57
|
baseRate: opinion.a
|
|
33
58
|
};
|
|
34
59
|
}
|
|
35
|
-
function readOpinionFromRecord(source
|
|
60
|
+
function readOpinionFromRecord(source) {
|
|
36
61
|
const record = source && typeof source === "object" ? source : {};
|
|
37
|
-
return
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
62
|
+
return mkOpinion(
|
|
63
|
+
requiredOpinionNumber(
|
|
64
|
+
"belief",
|
|
65
|
+
record.b,
|
|
66
|
+
record.belief,
|
|
67
|
+
record.slBelief,
|
|
68
|
+
record.opinion_b
|
|
69
|
+
),
|
|
70
|
+
requiredOpinionNumber(
|
|
71
|
+
"disbelief",
|
|
72
|
+
record.d,
|
|
73
|
+
record.disbelief,
|
|
74
|
+
record.slDisbelief,
|
|
75
|
+
record.opinion_d
|
|
76
|
+
),
|
|
77
|
+
requiredOpinionNumber(
|
|
78
|
+
"uncertainty",
|
|
79
|
+
record.u,
|
|
80
|
+
record.uncertainty,
|
|
81
|
+
record.slUncertainty,
|
|
82
|
+
record.opinion_u
|
|
83
|
+
),
|
|
84
|
+
requiredOpinionNumber(
|
|
85
|
+
"baseRate",
|
|
86
|
+
record.a,
|
|
87
|
+
record.baseRate,
|
|
88
|
+
record.slBaseRate,
|
|
89
|
+
record.opinion_a
|
|
90
|
+
)
|
|
91
|
+
);
|
|
43
92
|
}
|
|
44
93
|
function opinionFromScalar(value, mode, options) {
|
|
45
94
|
const clampedValue = clamp01(value);
|
|
46
|
-
const baseRate =
|
|
95
|
+
const baseRate = options?.baseRate === void 0 ? void 0 : clamp01(options.baseRate);
|
|
47
96
|
switch (mode) {
|
|
48
97
|
case "base_rate":
|
|
49
|
-
return
|
|
50
|
-
b: 0,
|
|
51
|
-
d: 0,
|
|
52
|
-
u: 1,
|
|
53
|
-
a: clampedValue
|
|
54
|
-
};
|
|
98
|
+
return mkOpinion(0, 0, 1, clampedValue);
|
|
55
99
|
case "dogmatic":
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
a: baseRate
|
|
61
|
-
};
|
|
100
|
+
if (baseRate === void 0) {
|
|
101
|
+
throw new Error('opinionFromScalar(value, "dogmatic") requires options.baseRate.');
|
|
102
|
+
}
|
|
103
|
+
return mkOpinion(clampedValue, 1 - clampedValue, 0, baseRate);
|
|
62
104
|
case "projected_with_u": {
|
|
105
|
+
if (baseRate === void 0) {
|
|
106
|
+
throw new Error(
|
|
107
|
+
'opinionFromScalar(value, "projected_with_u") requires options.baseRate.'
|
|
108
|
+
);
|
|
109
|
+
}
|
|
63
110
|
const uncertainty = options?.uncertainty;
|
|
64
111
|
if (uncertainty === void 0) {
|
|
65
112
|
throw new Error(
|
|
@@ -68,35 +115,30 @@ function opinionFromScalar(value, mode, options) {
|
|
|
68
115
|
}
|
|
69
116
|
const clampedUncertainty = clamp01(uncertainty);
|
|
70
117
|
const evidenceWeight = 1 - clampedUncertainty;
|
|
71
|
-
return
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
118
|
+
return mkOpinion(
|
|
119
|
+
clampedValue * evidenceWeight,
|
|
120
|
+
(1 - clampedValue) * evidenceWeight,
|
|
121
|
+
clampedUncertainty,
|
|
122
|
+
baseRate
|
|
123
|
+
);
|
|
77
124
|
}
|
|
78
125
|
}
|
|
79
126
|
throw new Error(`Unsupported opinionFromScalar mode: ${mode}`);
|
|
80
127
|
}
|
|
81
|
-
function toDogmaticOpinion(confidence, baseRate
|
|
128
|
+
function toDogmaticOpinion(confidence, baseRate) {
|
|
82
129
|
return opinionFromScalar(confidence, "dogmatic", { baseRate });
|
|
83
130
|
}
|
|
84
131
|
function opinionFromBaseRate(probability) {
|
|
85
132
|
return vacuous(clamp01(probability));
|
|
86
133
|
}
|
|
87
|
-
function opinionFromDogmatic(probability, baseRate
|
|
134
|
+
function opinionFromDogmatic(probability, baseRate) {
|
|
88
135
|
return dogmatic(clamp01(probability), clamp01(baseRate));
|
|
89
136
|
}
|
|
90
|
-
function opinionFromProjected(probability, uncertainty, baseRate
|
|
137
|
+
function opinionFromProjected(probability, uncertainty, baseRate) {
|
|
91
138
|
const p = clamp01(probability);
|
|
92
139
|
const u = clamp01(uncertainty);
|
|
93
140
|
const remainingMass = 1 - u;
|
|
94
|
-
return
|
|
95
|
-
b: p * remainingMass,
|
|
96
|
-
d: (1 - p) * remainingMass,
|
|
97
|
-
u,
|
|
98
|
-
a: clamp01(baseRate)
|
|
99
|
-
};
|
|
141
|
+
return mkOpinion(p * remainingMass, (1 - p) * remainingMass, u, clamp01(baseRate));
|
|
100
142
|
}
|
|
101
143
|
function hasProjectedOpinionChanged(current, next, tolerance = 0.01) {
|
|
102
144
|
return Math.abs(confidenceFromOpinion(next) - confidenceFromOpinion(current)) >= tolerance;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/v1/operations/subjectiveLogic/index.ts","../../../src/v1/operations/scoring.ts"],"names":[],"mappings":";AA0BO,SAAS,OAAA,CAAQ,WAAmB,GAAA,EAAc;AACvD,EA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AAA,CACd,WAAA,EACA,WAAA,EACA,QAAA,GAAmB,GAAA,EACV;AACT,EAAA,MAAM,CAAA,GAAI,QAAQ,WAAW,CAAA;AAC7B,EAAA,MAAM,CAAA,GAAI,QAAQ,WAAW,CAAA;AAC7B,EAAA,MAAM,gBAAgB,CAAA,GAAI,CAAA;AAC1B,EAAA,OAAO;AAAA,IACL,GAAG,CAAA,GAAI,aAAA;AAAA,IACP,CAAA,EAAA,CAAI,IAAI,CAAA,IAAK,aAAA;AAAA,IACb,CAAA;AAAA,IACA,CAAA,EAAG,QAAQ,QAAQ;AAAA,GACrB;AACF;AAEO,SAAS,0BAAA,CACd,OAAA,EACA,IAAA,EACA,SAAA,GAAoB,IAAA,EACX;AACT,EAAA,OAAO,IAAA,CAAK,IAAI,qBAAA,CAAsB,IAAI,IAAI,qBAAA,CAAsB,OAAO,CAAC,CAAA,IAC1E,SAAA;AACJ","file":"scoring.js","sourcesContent":["import type { Opinion } from \"../../types\";\n\nexport function opinion(\n belief: number,\n disbelief: number,\n uncertainty: number,\n baseRate: number = 0.5\n): Opinion {\n const b = Math.max(0, Math.min(1, belief));\n const d = Math.max(0, Math.min(1, disbelief));\n const u = Math.max(0, Math.min(1, uncertainty));\n const a = Math.max(0, Math.min(1, baseRate));\n const sum = b + d + u;\n\n if (sum === 0) {\n return { b: 0, d: 0, u: 1, a };\n }\n\n return {\n b: b / sum,\n d: d / sum,\n u: u / sum,\n a,\n };\n}\n\nexport function vacuous(baseRate: number = 0.5): Opinion {\n return { b: 0, d: 0, u: 1, a: baseRate };\n}\n\nexport function dogmatic(probability: number, baseRate: number = 0.5): Opinion {\n const p = Math.max(0, Math.min(1, probability));\n return { b: p, d: 1 - p, u: 0, a: baseRate };\n}\n\nexport function project(o: Opinion): number {\n return o.b + o.a * o.u;\n}\n\nexport function confidenceLevel(o: Opinion): \"high\" | \"medium\" | \"low\" {\n const projected = project(o);\n if (o.u > 0.5) {\n return \"low\";\n }\n if (projected >= 0.8 && o.u < 0.2) {\n return \"high\";\n }\n if (projected >= 0.6) {\n return \"medium\";\n }\n return \"low\";\n}\n\nexport function cumulativeFusion(left: Opinion, right: Opinion): Opinion {\n if (left.u === 0 && right.u === 0) {\n return opinion(\n (left.b + right.b) / 2,\n (left.d + right.d) / 2,\n 0,\n (left.a + right.a) / 2\n );\n }\n\n const k = left.u + right.u - left.u * right.u;\n if (k === 0) {\n return vacuous((left.a + right.a) / 2);\n }\n\n return opinion(\n (left.b * right.u + right.b * left.u) / k,\n (left.d * right.u + right.d * left.u) / k,\n (left.u * right.u) / k,\n (left.a + right.a) / 2\n );\n}\n\nexport function averagingFusion(left: Opinion, right: Opinion): Opinion {\n if (left.u === 0 && right.u === 0) {\n return opinion(\n (left.b + right.b) / 2,\n (left.d + right.d) / 2,\n 0,\n (left.a + right.a) / 2\n );\n }\n\n const k = left.u + right.u;\n if (k === 0) {\n return vacuous((left.a + right.a) / 2);\n }\n\n return opinion(\n (left.b * right.u + right.b * left.u) / k,\n (left.d * right.u + right.d * left.u) / k,\n (2 * left.u * right.u) / k,\n (left.a + right.a) / 2\n );\n}\n\nexport function trustDiscount(sourceOpinion: Opinion, trust: number): Opinion {\n const weight = Math.max(0, Math.min(1, Math.abs(trust)));\n return opinion(\n weight * sourceOpinion.b,\n weight * sourceOpinion.d,\n 1 - weight * (sourceOpinion.b + sourceOpinion.d),\n sourceOpinion.a\n );\n}\n\nconst EPSILON = 1e-9;\n\nfunction childBaseRateFallback(\n ifTrue: Opinion,\n ifFalse: Opinion,\n fallbackBaseRate: number | undefined\n): number {\n if (fallbackBaseRate !== undefined) {\n return Math.max(0, Math.min(1, fallbackBaseRate));\n }\n\n if (Math.abs(ifTrue.a - ifFalse.a) <= EPSILON) {\n return ifTrue.a;\n }\n\n return (ifTrue.a + ifFalse.a) / 2;\n}\n\nfunction computeConditionalDeductionBaseRate(\n opinionA: Opinion,\n ifTrue: Opinion,\n ifFalse: Opinion,\n fallbackBaseRate: number\n): number {\n const denominator =\n 1 - opinionA.a * ifTrue.u - (1 - opinionA.a) * ifFalse.u;\n\n if (ifTrue.u + ifFalse.u < 2 - EPSILON && Math.abs(denominator) > EPSILON) {\n const baseRate =\n (opinionA.a * ifTrue.b + (1 - opinionA.a) * ifFalse.b) / denominator;\n if (baseRate >= -EPSILON && baseRate <= 1 + EPSILON) {\n return Math.max(0, Math.min(1, baseRate));\n }\n }\n\n return fallbackBaseRate;\n}\n\nfunction safeCorrectionTerm(\n numerator: number,\n denominator: number\n): number | undefined {\n if (Math.abs(denominator) <= EPSILON) {\n return undefined;\n }\n\n const value = numerator / denominator;\n if (!Number.isFinite(value)) {\n return undefined;\n }\n\n return Math.max(0, value);\n}\n\nexport function conditionalDeduction(\n opinionA: Opinion,\n ifTrue: Opinion,\n ifFalse: Opinion,\n fallbackBaseRate?: number\n): Opinion {\n const fallbackChildBaseRate = childBaseRateFallback(\n ifTrue,\n ifFalse,\n fallbackBaseRate\n );\n const childBaseRate = computeConditionalDeductionBaseRate(\n opinionA,\n ifTrue,\n ifFalse,\n fallbackChildBaseRate\n );\n const projectedAntecedent = project(opinionA);\n const projectedAntecedentComplement = 1 - projectedAntecedent;\n const intermediateBelief =\n opinionA.b * ifTrue.b +\n opinionA.d * ifFalse.b +\n opinionA.u * (ifTrue.b * opinionA.a + ifFalse.b * (1 - opinionA.a));\n const intermediateDisbelief =\n opinionA.b * ifTrue.d +\n opinionA.d * ifFalse.d +\n opinionA.u * (ifTrue.d * opinionA.a + ifFalse.d * (1 - opinionA.a));\n const intermediateUncertainty =\n opinionA.b * ifTrue.u +\n opinionA.d * ifFalse.u +\n opinionA.u * (ifTrue.u * opinionA.a + ifFalse.u * (1 - opinionA.a));\n const projectedVacuousDeduction =\n ifTrue.b * opinionA.a +\n ifFalse.b * (1 - opinionA.a) +\n childBaseRate *\n (ifTrue.u * opinionA.a + ifFalse.u * (1 - opinionA.a));\n const projectedConditionalA =\n ifTrue.b + childBaseRate * (1 - ifTrue.b - ifTrue.d);\n let correction = 0;\n\n if (\n (ifTrue.b > ifFalse.b && ifTrue.d > ifFalse.d) ||\n (ifTrue.b <= ifFalse.b && ifTrue.d <= ifFalse.d)\n ) {\n correction = 0;\n } else if (ifTrue.b > ifFalse.b && ifTrue.d <= ifFalse.d) {\n const beliefGap = ifTrue.b - ifFalse.b;\n const disbeliefGap = ifFalse.d - ifTrue.d;\n\n if (\n projectedVacuousDeduction <= projectedConditionalA &&\n projectedAntecedent <= opinionA.a\n ) {\n correction =\n safeCorrectionTerm(\n opinionA.a * opinionA.u * (intermediateBelief - ifTrue.b),\n projectedAntecedent * childBaseRate\n ) ?? 0;\n } else if (\n projectedVacuousDeduction <= projectedConditionalA &&\n projectedAntecedent > opinionA.a\n ) {\n correction =\n safeCorrectionTerm(\n opinionA.a * opinionA.u * (intermediateDisbelief - ifTrue.d) * beliefGap,\n projectedAntecedentComplement * childBaseRate * disbeliefGap\n ) ?? 0;\n } else if (\n projectedVacuousDeduction > projectedConditionalA &&\n projectedAntecedent <= opinionA.a\n ) {\n correction =\n safeCorrectionTerm(\n (1 - opinionA.a) *\n opinionA.u *\n (intermediateBelief - ifTrue.b) *\n disbeliefGap,\n projectedAntecedent * (1 - childBaseRate) * beliefGap\n ) ?? 0;\n } else {\n correction =\n safeCorrectionTerm(\n (1 - opinionA.a) * opinionA.u * (intermediateDisbelief - ifTrue.d),\n projectedAntecedentComplement * (1 - childBaseRate)\n ) ?? 0;\n }\n } else {\n const beliefGap = ifFalse.b - ifTrue.b;\n const disbeliefGap = ifTrue.d - ifFalse.d;\n\n if (\n projectedVacuousDeduction <= projectedConditionalA &&\n projectedAntecedent <= opinionA.a\n ) {\n correction =\n safeCorrectionTerm(\n (1 - opinionA.a) *\n opinionA.u *\n (intermediateDisbelief - ifTrue.d) *\n beliefGap,\n projectedAntecedent * childBaseRate * disbeliefGap\n ) ?? 0;\n } else if (\n projectedVacuousDeduction <= projectedConditionalA &&\n projectedAntecedent > opinionA.a\n ) {\n correction =\n safeCorrectionTerm(\n (1 - opinionA.a) * opinionA.u * (intermediateBelief - ifTrue.b),\n projectedAntecedentComplement * childBaseRate\n ) ?? 0;\n } else if (\n projectedVacuousDeduction > projectedConditionalA &&\n projectedAntecedent <= opinionA.a\n ) {\n correction =\n safeCorrectionTerm(\n opinionA.a * opinionA.u * (intermediateDisbelief - ifTrue.d),\n projectedAntecedent * (1 - childBaseRate)\n ) ?? 0;\n } else {\n correction =\n safeCorrectionTerm(\n opinionA.a *\n opinionA.u *\n (intermediateBelief - ifTrue.b) *\n disbeliefGap,\n projectedAntecedentComplement * (1 - childBaseRate) * beliefGap\n ) ?? 0;\n }\n }\n\n return opinion(\n intermediateBelief - childBaseRate * correction,\n intermediateDisbelief - (1 - childBaseRate) * correction,\n intermediateUncertainty + correction,\n childBaseRate\n );\n}\n\n/**\n * Abductive inference over a conditional.\n * Given an opinion on Y and conditionals P(Y|X), P(Y|~X), infer an opinion on X.\n */\nexport function conditionalAbduction(\n opinionY: Opinion,\n ifTrue: Opinion,\n ifFalse: Opinion,\n baseRateX: number\n): Opinion {\n const priorX = Math.max(0, Math.min(1, baseRateX));\n const probabilityY = project(opinionY);\n const probabilityGivenTrue = project(ifTrue);\n const probabilityGivenFalse = project(ifFalse);\n\n const posteriorIfYDenominator =\n probabilityGivenTrue * priorX +\n probabilityGivenFalse * (1 - priorX);\n const posteriorIfY =\n posteriorIfYDenominator === 0\n ? priorX\n : (probabilityGivenTrue * priorX) / posteriorIfYDenominator;\n\n const posteriorIfNotYDenominator =\n (1 - probabilityGivenTrue) * priorX +\n (1 - probabilityGivenFalse) * (1 - priorX);\n const posteriorIfNotY =\n posteriorIfNotYDenominator === 0\n ? priorX\n : ((1 - probabilityGivenTrue) * priorX) / posteriorIfNotYDenominator;\n\n const projectedX =\n probabilityY * posteriorIfY + (1 - probabilityY) * posteriorIfNotY;\n const uncertainty = Math.max(\n opinionY.u * 0.5,\n probabilityY * ifTrue.u + (1 - probabilityY) * ifFalse.u\n );\n\n return opinion(\n projectedX * (1 - uncertainty),\n (1 - projectedX) * (1 - uncertainty),\n uncertainty,\n priorX\n );\n}\n\nexport function negate(o: Opinion): Opinion {\n return { b: o.d, d: o.b, u: o.u, a: 1 - o.a };\n}\n\nexport function constraintFusion(\n left: Opinion,\n right: Opinion,\n mode: \"pressure\" | \"redistribute\" = \"pressure\"\n): { o1: Opinion; o2: Opinion } {\n if (mode === \"redistribute\") {\n const leftProjected = project(left);\n const rightProjected = project(right);\n const total = leftProjected + rightProjected;\n\n if (total <= 1) {\n return { o1: left, o2: right };\n }\n\n const scale = 1 / total;\n return {\n o1: opinion(\n left.b * scale,\n left.d + left.b * (1 - scale),\n left.u,\n left.a\n ),\n o2: opinion(\n right.b * scale,\n right.d + right.b * (1 - scale),\n right.u,\n right.a\n ),\n };\n }\n\n const pressureLeft = right.b * 0.5;\n const pressureRight = left.b * 0.5;\n\n return {\n o1: opinion(\n left.b - pressureLeft * 0.3,\n left.d + pressureLeft * 0.3,\n left.u,\n left.a\n ),\n o2: opinion(\n right.b - pressureRight * 0.3,\n right.d + pressureRight * 0.3,\n right.u,\n right.a\n ),\n };\n}\n\nexport function evidenceBalance(o: Opinion): number {\n const total = o.b + o.d;\n if (total === 0) {\n return 0;\n }\n return (o.b - o.d) / total;\n}\n\nexport function areTensioned(left: Opinion, right: Opinion): boolean {\n return (\n project(left) > 0.5 &&\n project(right) > 0.5 &&\n (left.d > 0.2 || right.d > 0.2)\n );\n}\n\nexport function informationGain(o: Opinion): number {\n if (o.u === 0) {\n return 0;\n }\n if (o.u === 1) {\n return 1;\n }\n return o.u * (1 - Math.abs(o.b - o.d));\n}\n","import type { Opinion, StoredOpinionFields } from \"../types\";\nimport { dogmatic, vacuous } from \"./subjectiveLogic\";\n\nfunction finiteNumber(value: unknown): number | undefined {\n return typeof value === \"number\" && Number.isFinite(value) ? value : undefined;\n}\n\nexport function clamp01(value: number): number {\n return Math.max(0, Math.min(1, value));\n}\n\nexport function confidenceFromOpinion(opinion: Opinion): number {\n return clamp01(opinion.b + opinion.a * opinion.u);\n}\n\nexport function confidenceFromSL(\n belief: number,\n _disbelief: number,\n uncertainty: number,\n baseRate: number = 0.5\n): number {\n return confidenceFromOpinion({\n b: belief,\n d: _disbelief,\n u: uncertainty,\n a: baseRate,\n });\n}\n\nexport function toStoredOpinionFields(opinion: Opinion): StoredOpinionFields {\n return {\n belief: opinion.b,\n disbelief: opinion.d,\n uncertainty: opinion.u,\n baseRate: opinion.a,\n };\n}\n\nexport function readOpinionFromRecord(\n source: unknown,\n fallback: Partial<Opinion> = {}\n): Opinion {\n const record =\n source && typeof source === \"object\"\n ? (source as Record<string, unknown>)\n : {};\n\n return {\n b:\n finiteNumber(record.b) ??\n finiteNumber(record.belief) ??\n finiteNumber(record.slBelief) ??\n finiteNumber(record.opinion_b) ??\n fallback.b ??\n 0,\n d:\n finiteNumber(record.d) ??\n finiteNumber(record.disbelief) ??\n finiteNumber(record.slDisbelief) ??\n finiteNumber(record.opinion_d) ??\n fallback.d ??\n 0,\n u:\n finiteNumber(record.u) ??\n finiteNumber(record.uncertainty) ??\n finiteNumber(record.slUncertainty) ??\n finiteNumber(record.opinion_u) ??\n fallback.u ??\n 1,\n a:\n finiteNumber(record.a) ??\n finiteNumber(record.baseRate) ??\n finiteNumber(record.slBaseRate) ??\n finiteNumber(record.opinion_a) ??\n fallback.a ??\n 0.5,\n };\n}\n\nexport type OpinionFromScalarMode =\n | \"base_rate\"\n | \"dogmatic\"\n | \"projected_with_u\";\n\nexport function opinionFromScalar(\n value: number,\n mode: OpinionFromScalarMode,\n options?: { baseRate?: number; uncertainty?: number }\n): Opinion {\n const clampedValue = clamp01(value);\n const baseRate = clamp01(options?.baseRate ?? 0.5);\n\n switch (mode) {\n case \"base_rate\":\n return {\n b: 0,\n d: 0,\n u: 1,\n a: clampedValue,\n };\n case \"dogmatic\":\n return {\n b: clampedValue,\n d: 1 - clampedValue,\n u: 0,\n a: baseRate,\n };\n case \"projected_with_u\": {\n const uncertainty = options?.uncertainty;\n if (uncertainty === undefined) {\n throw new Error(\n \"opinionFromScalar(value, \\\"projected_with_u\\\") requires options.uncertainty.\"\n );\n }\n const clampedUncertainty = clamp01(uncertainty);\n const evidenceWeight = 1 - clampedUncertainty;\n return {\n b: clampedValue * evidenceWeight,\n d: (1 - clampedValue) * evidenceWeight,\n u: clampedUncertainty,\n a: baseRate,\n };\n }\n }\n\n throw new Error(`Unsupported opinionFromScalar mode: ${mode}`);\n}\n\n/**\n * @deprecated Use opinionFromScalar(value, \"dogmatic\", { baseRate }) instead.\n */\nexport function toDogmaticOpinion(\n confidence: number,\n baseRate: number = 0.5\n): Opinion {\n return opinionFromScalar(confidence, \"dogmatic\", { baseRate });\n}\n\n/** Interpret p as a prior with no observed evidence. */\nexport function opinionFromBaseRate(probability: number): Opinion {\n return vacuous(clamp01(probability));\n}\n\n/** Interpret p as a certainty-equivalent projected probability. */\nexport function opinionFromDogmatic(\n probability: number,\n baseRate: number = 0.5\n): Opinion {\n return dogmatic(clamp01(probability), clamp01(baseRate));\n}\n\n/**\n * Interpret p as a projected probability with an explicit uncertainty bucket.\n * The resulting opinion always projects back to p.\n */\nexport function opinionFromProjected(\n probability: number,\n uncertainty: number,\n baseRate: number = 0.5\n): Opinion {\n const p = clamp01(probability);\n const u = clamp01(uncertainty);\n const remainingMass = 1 - u;\n return {\n b: p * remainingMass,\n d: (1 - p) * remainingMass,\n u,\n a: clamp01(baseRate),\n };\n}\n\nexport function hasProjectedOpinionChanged(\n current: Opinion,\n next: Opinion,\n tolerance: number = 0.01\n): boolean {\n return Math.abs(confidenceFromOpinion(next) - confidenceFromOpinion(current)) >=\n tolerance;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/v1/operations/subjectiveLogic/index.ts","../../../src/v1/operations/scoring.ts"],"names":[],"mappings":";AAEO,SAAS,SAAA,CACd,MAAA,EACA,SAAA,EACA,WAAA,EACA,QAAA,EACW;AACX,EAAA,MAAM,CAAA,GAAI,OAAO,QAAA,CAAS,MAAM,IAAI,IAAA,CAAK,GA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X;AACT,EAAA,OAAO,IAAA,CAAK,IAAI,qBAAA,CAAsB,IAAI,IAAI,qBAAA,CAAsB,OAAO,CAAC,CAAA,IAC1E,SAAA;AACJ","file":"scoring.js","sourcesContent":["import type { SLOpinion } from \"../../types\";\n\nexport function mkOpinion(\n belief: number,\n disbelief: number,\n uncertainty: number,\n baseRate: number\n): SLOpinion {\n const b = Number.isFinite(belief) ? Math.max(0, belief) : 0;\n const d = Number.isFinite(disbelief) ? Math.max(0, disbelief) : 0;\n const u = Number.isFinite(uncertainty) ? Math.max(0, uncertainty) : 0;\n const a = Math.max(0, Math.min(1, baseRate));\n const sum = b + d + u;\n\n if (sum === 0) {\n return { b: 0, d: 0, u: 1, a } as SLOpinion;\n }\n\n return {\n b: b / sum,\n d: d / sum,\n u: u / sum,\n a,\n } as SLOpinion;\n}\n\nexport const opinion = mkOpinion;\n\nexport function vacuous(baseRate: number): SLOpinion {\n return mkOpinion(0, 0, 1, baseRate);\n}\n\nexport function dogmatic(probability: number, baseRate: number): SLOpinion {\n const p = Math.max(0, Math.min(1, probability));\n return mkOpinion(p, 1 - p, 0, baseRate);\n}\n\nexport function project(o: SLOpinion): number {\n return o.b + o.a * o.u;\n}\n\nexport function confidenceLevel(o: SLOpinion): \"high\" | \"medium\" | \"low\" {\n const projected = project(o);\n if (o.u > 0.5) {\n return \"low\";\n }\n if (projected >= 0.8 && o.u < 0.2) {\n return \"high\";\n }\n if (projected >= 0.6) {\n return \"medium\";\n }\n return \"low\";\n}\n\nexport function cumulativeFusion(left: SLOpinion, right: SLOpinion): SLOpinion {\n if (left.u === 0 && right.u === 0) {\n return opinion(\n (left.b + right.b) / 2,\n (left.d + right.d) / 2,\n 0,\n (left.a + right.a) / 2\n );\n }\n\n const k = left.u + right.u - left.u * right.u;\n if (k === 0) {\n return vacuous((left.a + right.a) / 2);\n }\n\n return opinion(\n (left.b * right.u + right.b * left.u) / k,\n (left.d * right.u + right.d * left.u) / k,\n (left.u * right.u) / k,\n (left.a + right.a) / 2\n );\n}\n\nexport function averagingFusion(left: SLOpinion, right: SLOpinion): SLOpinion {\n if (left.u === 0 && right.u === 0) {\n return opinion(\n (left.b + right.b) / 2,\n (left.d + right.d) / 2,\n 0,\n (left.a + right.a) / 2\n );\n }\n\n const k = left.u + right.u;\n if (k === 0) {\n return vacuous((left.a + right.a) / 2);\n }\n\n return opinion(\n (left.b * right.u + right.b * left.u) / k,\n (left.d * right.u + right.d * left.u) / k,\n (2 * left.u * right.u) / k,\n (left.a + right.a) / 2\n );\n}\n\nexport function trustDiscount(sourceOpinion: SLOpinion, trust: number): SLOpinion {\n const weight = Math.max(0, Math.min(1, Math.abs(trust)));\n return opinion(\n weight * sourceOpinion.b,\n weight * sourceOpinion.d,\n 1 - weight * (sourceOpinion.b + sourceOpinion.d),\n sourceOpinion.a\n );\n}\n\nconst EPSILON = 1e-9;\n\nfunction childBaseRateFallback(\n ifTrue: SLOpinion,\n ifFalse: SLOpinion,\n fallbackBaseRate: number | undefined\n): number {\n if (fallbackBaseRate !== undefined) {\n return Math.max(0, Math.min(1, fallbackBaseRate));\n }\n\n if (Math.abs(ifTrue.a - ifFalse.a) <= EPSILON) {\n return ifTrue.a;\n }\n\n return (ifTrue.a + ifFalse.a) / 2;\n}\n\nfunction computeConditionalDeductionBaseRate(\n opinionA: SLOpinion,\n ifTrue: SLOpinion,\n ifFalse: SLOpinion,\n fallbackBaseRate: number\n): number {\n const denominator =\n 1 - opinionA.a * ifTrue.u - (1 - opinionA.a) * ifFalse.u;\n\n if (ifTrue.u + ifFalse.u < 2 - EPSILON && Math.abs(denominator) > EPSILON) {\n const baseRate =\n (opinionA.a * ifTrue.b + (1 - opinionA.a) * ifFalse.b) / denominator;\n if (baseRate >= -EPSILON && baseRate <= 1 + EPSILON) {\n return Math.max(0, Math.min(1, baseRate));\n }\n }\n\n return fallbackBaseRate;\n}\n\nfunction safeCorrectionTerm(\n numerator: number,\n denominator: number\n): number | undefined {\n if (Math.abs(denominator) <= EPSILON) {\n return undefined;\n }\n\n const value = numerator / denominator;\n if (!Number.isFinite(value)) {\n return undefined;\n }\n\n return Math.max(0, value);\n}\n\nexport function conditionalDeduction(\n opinionA: SLOpinion,\n ifTrue: SLOpinion,\n ifFalse: SLOpinion,\n fallbackBaseRate?: number\n): SLOpinion {\n const fallbackChildBaseRate = childBaseRateFallback(\n ifTrue,\n ifFalse,\n fallbackBaseRate\n );\n const childBaseRate = computeConditionalDeductionBaseRate(\n opinionA,\n ifTrue,\n ifFalse,\n fallbackChildBaseRate\n );\n const projectedAntecedent = project(opinionA);\n const projectedAntecedentComplement = 1 - projectedAntecedent;\n const intermediateBelief =\n opinionA.b * ifTrue.b +\n opinionA.d * ifFalse.b +\n opinionA.u * (ifTrue.b * opinionA.a + ifFalse.b * (1 - opinionA.a));\n const intermediateDisbelief =\n opinionA.b * ifTrue.d +\n opinionA.d * ifFalse.d +\n opinionA.u * (ifTrue.d * opinionA.a + ifFalse.d * (1 - opinionA.a));\n const intermediateUncertainty =\n opinionA.b * ifTrue.u +\n opinionA.d * ifFalse.u +\n opinionA.u * (ifTrue.u * opinionA.a + ifFalse.u * (1 - opinionA.a));\n const projectedVacuousDeduction =\n ifTrue.b * opinionA.a +\n ifFalse.b * (1 - opinionA.a) +\n childBaseRate *\n (ifTrue.u * opinionA.a + ifFalse.u * (1 - opinionA.a));\n const projectedConditionalA =\n ifTrue.b + childBaseRate * (1 - ifTrue.b - ifTrue.d);\n let correction = 0;\n\n if (\n (ifTrue.b > ifFalse.b && ifTrue.d > ifFalse.d) ||\n (ifTrue.b <= ifFalse.b && ifTrue.d <= ifFalse.d)\n ) {\n correction = 0;\n } else if (ifTrue.b > ifFalse.b && ifTrue.d <= ifFalse.d) {\n const beliefGap = ifTrue.b - ifFalse.b;\n const disbeliefGap = ifFalse.d - ifTrue.d;\n\n if (\n projectedVacuousDeduction <= projectedConditionalA &&\n projectedAntecedent <= opinionA.a\n ) {\n correction =\n safeCorrectionTerm(\n opinionA.a * opinionA.u * (intermediateBelief - ifTrue.b),\n projectedAntecedent * childBaseRate\n ) ?? 0;\n } else if (\n projectedVacuousDeduction <= projectedConditionalA &&\n projectedAntecedent > opinionA.a\n ) {\n correction =\n safeCorrectionTerm(\n opinionA.a * opinionA.u * (intermediateDisbelief - ifTrue.d) * beliefGap,\n projectedAntecedentComplement * childBaseRate * disbeliefGap\n ) ?? 0;\n } else if (\n projectedVacuousDeduction > projectedConditionalA &&\n projectedAntecedent <= opinionA.a\n ) {\n correction =\n safeCorrectionTerm(\n (1 - opinionA.a) *\n opinionA.u *\n (intermediateBelief - ifTrue.b) *\n disbeliefGap,\n projectedAntecedent * (1 - childBaseRate) * beliefGap\n ) ?? 0;\n } else {\n correction =\n safeCorrectionTerm(\n (1 - opinionA.a) * opinionA.u * (intermediateDisbelief - ifTrue.d),\n projectedAntecedentComplement * (1 - childBaseRate)\n ) ?? 0;\n }\n } else {\n const beliefGap = ifFalse.b - ifTrue.b;\n const disbeliefGap = ifTrue.d - ifFalse.d;\n\n if (\n projectedVacuousDeduction <= projectedConditionalA &&\n projectedAntecedent <= opinionA.a\n ) {\n correction =\n safeCorrectionTerm(\n (1 - opinionA.a) *\n opinionA.u *\n (intermediateDisbelief - ifTrue.d) *\n beliefGap,\n projectedAntecedent * childBaseRate * disbeliefGap\n ) ?? 0;\n } else if (\n projectedVacuousDeduction <= projectedConditionalA &&\n projectedAntecedent > opinionA.a\n ) {\n correction =\n safeCorrectionTerm(\n (1 - opinionA.a) * opinionA.u * (intermediateBelief - ifTrue.b),\n projectedAntecedentComplement * childBaseRate\n ) ?? 0;\n } else if (\n projectedVacuousDeduction > projectedConditionalA &&\n projectedAntecedent <= opinionA.a\n ) {\n correction =\n safeCorrectionTerm(\n opinionA.a * opinionA.u * (intermediateDisbelief - ifTrue.d),\n projectedAntecedent * (1 - childBaseRate)\n ) ?? 0;\n } else {\n correction =\n safeCorrectionTerm(\n opinionA.a *\n opinionA.u *\n (intermediateBelief - ifTrue.b) *\n disbeliefGap,\n projectedAntecedentComplement * (1 - childBaseRate) * beliefGap\n ) ?? 0;\n }\n }\n\n return opinion(\n intermediateBelief - childBaseRate * correction,\n intermediateDisbelief - (1 - childBaseRate) * correction,\n intermediateUncertainty + correction,\n childBaseRate\n );\n}\n\n/**\n * Abductive inference over a conditional.\n * Given an opinion on Y and conditionals P(Y|X), P(Y|~X), infer an opinion on X.\n */\nexport function conditionalAbduction(\n opinionY: SLOpinion,\n ifTrue: SLOpinion,\n ifFalse: SLOpinion,\n baseRateX: number\n): SLOpinion {\n const priorX = Math.max(0, Math.min(1, baseRateX));\n const probabilityY = project(opinionY);\n const probabilityGivenTrue = project(ifTrue);\n const probabilityGivenFalse = project(ifFalse);\n\n const posteriorIfYDenominator =\n probabilityGivenTrue * priorX +\n probabilityGivenFalse * (1 - priorX);\n const posteriorIfY =\n posteriorIfYDenominator === 0\n ? priorX\n : (probabilityGivenTrue * priorX) / posteriorIfYDenominator;\n\n const posteriorIfNotYDenominator =\n (1 - probabilityGivenTrue) * priorX +\n (1 - probabilityGivenFalse) * (1 - priorX);\n const posteriorIfNotY =\n posteriorIfNotYDenominator === 0\n ? priorX\n : ((1 - probabilityGivenTrue) * priorX) / posteriorIfNotYDenominator;\n\n const projectedX =\n probabilityY * posteriorIfY + (1 - probabilityY) * posteriorIfNotY;\n const uncertainty = Math.max(\n opinionY.u * 0.5,\n probabilityY * ifTrue.u + (1 - probabilityY) * ifFalse.u\n );\n\n return opinion(\n projectedX * (1 - uncertainty),\n (1 - projectedX) * (1 - uncertainty),\n uncertainty,\n priorX\n );\n}\n\nexport function negate(o: SLOpinion): SLOpinion {\n return mkOpinion(o.d, o.b, o.u, 1 - o.a);\n}\n\nexport function constraintFusion(\n left: SLOpinion,\n right: SLOpinion,\n mode: \"pressure\" | \"redistribute\" = \"pressure\"\n): { o1: SLOpinion; o2: SLOpinion } {\n if (mode === \"redistribute\") {\n const leftProjected = project(left);\n const rightProjected = project(right);\n const total = leftProjected + rightProjected;\n\n if (total <= 1) {\n return { o1: left, o2: right };\n }\n\n const scale = 1 / total;\n return {\n o1: opinion(\n left.b * scale,\n left.d + left.b * (1 - scale),\n left.u,\n left.a\n ),\n o2: opinion(\n right.b * scale,\n right.d + right.b * (1 - scale),\n right.u,\n right.a\n ),\n };\n }\n\n const pressureLeft = right.b * 0.5;\n const pressureRight = left.b * 0.5;\n\n return {\n o1: opinion(\n left.b - pressureLeft * 0.3,\n left.d + pressureLeft * 0.3,\n left.u,\n left.a\n ),\n o2: opinion(\n right.b - pressureRight * 0.3,\n right.d + pressureRight * 0.3,\n right.u,\n right.a\n ),\n };\n}\n\nexport function evidenceBalance(o: SLOpinion): number {\n const total = o.b + o.d;\n if (total === 0) {\n return 0;\n }\n return (o.b - o.d) / total;\n}\n\nexport function areTensioned(left: SLOpinion, right: SLOpinion): boolean {\n return (\n project(left) > 0.5 &&\n project(right) > 0.5 &&\n (left.d > 0.2 || right.d > 0.2)\n );\n}\n\nexport function informationGain(o: SLOpinion): number {\n if (o.u === 0) {\n return 0;\n }\n if (o.u === 1) {\n return 1;\n }\n return o.u * (1 - Math.abs(o.b - o.d));\n}\n","import type { Opinion, SLOpinion, StoredOpinionFields } from \"../types\";\nimport { dogmatic, mkOpinion, vacuous } from \"./subjectiveLogic\";\n\nfunction finiteNumber(value: unknown): number | undefined {\n return typeof value === \"number\" && Number.isFinite(value) ? value : undefined;\n}\n\nfunction requiredOpinionNumber(label: string, ...values: unknown[]): number {\n for (const value of values) {\n const numberValue = finiteNumber(value);\n if (numberValue !== undefined) {\n return numberValue;\n }\n }\n throw new Error(`Opinion record is missing required ${label}.`);\n}\n\nexport function clamp01(value: number): number {\n return Math.max(0, Math.min(1, value));\n}\n\nexport function confidenceFromOpinion(opinion: Opinion): number {\n return clamp01(opinion.b + opinion.a * opinion.u);\n}\n\nexport function confidenceFromSL(\n belief: number,\n _disbelief: number,\n uncertainty: number,\n baseRate: number\n): number {\n return confidenceFromOpinion({\n b: belief,\n d: _disbelief,\n u: uncertainty,\n a: baseRate,\n });\n}\n\nexport function toStoredOpinionFields(opinion: Opinion): StoredOpinionFields {\n return {\n belief: opinion.b,\n disbelief: opinion.d,\n uncertainty: opinion.u,\n baseRate: opinion.a,\n };\n}\n\nexport function readOpinionFromRecord(\n source: unknown\n): SLOpinion {\n const record =\n source && typeof source === \"object\"\n ? (source as Record<string, unknown>)\n : {};\n\n return mkOpinion(\n requiredOpinionNumber(\n \"belief\",\n record.b,\n record.belief,\n record.slBelief,\n record.opinion_b\n ),\n requiredOpinionNumber(\n \"disbelief\",\n record.d,\n record.disbelief,\n record.slDisbelief,\n record.opinion_d\n ),\n requiredOpinionNumber(\n \"uncertainty\",\n record.u,\n record.uncertainty,\n record.slUncertainty,\n record.opinion_u\n ),\n requiredOpinionNumber(\n \"baseRate\",\n record.a,\n record.baseRate,\n record.slBaseRate,\n record.opinion_a\n )\n );\n}\n\nexport type OpinionFromScalarMode =\n | \"base_rate\"\n | \"dogmatic\"\n | \"projected_with_u\";\n\nexport type OpinionFromScalarOptions =\n | { baseRate?: never; uncertainty?: never }\n | { baseRate: number; uncertainty?: never }\n | { baseRate: number; uncertainty: number };\n\nexport function opinionFromScalar(\n value: number,\n mode: \"base_rate\",\n options?: { baseRate?: never; uncertainty?: never }\n): SLOpinion;\nexport function opinionFromScalar(\n value: number,\n mode: \"dogmatic\",\n options: { baseRate: number; uncertainty?: never }\n): SLOpinion;\nexport function opinionFromScalar(\n value: number,\n mode: \"projected_with_u\",\n options: { baseRate: number; uncertainty: number }\n): SLOpinion;\nexport function opinionFromScalar(\n value: number,\n mode: OpinionFromScalarMode,\n options?: OpinionFromScalarOptions\n): SLOpinion {\n const clampedValue = clamp01(value);\n const baseRate =\n options?.baseRate === undefined ? undefined : clamp01(options.baseRate);\n\n switch (mode) {\n case \"base_rate\":\n return mkOpinion(0, 0, 1, clampedValue);\n case \"dogmatic\":\n if (baseRate === undefined) {\n throw new Error(\"opinionFromScalar(value, \\\"dogmatic\\\") requires options.baseRate.\");\n }\n return mkOpinion(clampedValue, 1 - clampedValue, 0, baseRate);\n case \"projected_with_u\": {\n if (baseRate === undefined) {\n throw new Error(\n \"opinionFromScalar(value, \\\"projected_with_u\\\") requires options.baseRate.\"\n );\n }\n const uncertainty = options?.uncertainty;\n if (uncertainty === undefined) {\n throw new Error(\n \"opinionFromScalar(value, \\\"projected_with_u\\\") requires options.uncertainty.\"\n );\n }\n const clampedUncertainty = clamp01(uncertainty);\n const evidenceWeight = 1 - clampedUncertainty;\n return mkOpinion(\n clampedValue * evidenceWeight,\n (1 - clampedValue) * evidenceWeight,\n clampedUncertainty,\n baseRate\n );\n }\n }\n\n throw new Error(`Unsupported opinionFromScalar mode: ${mode}`);\n}\n\n/**\n * @deprecated Use opinionFromScalar(value, \"dogmatic\", { baseRate }) instead.\n */\nexport function toDogmaticOpinion(\n confidence: number,\n baseRate: number\n): SLOpinion {\n return opinionFromScalar(confidence, \"dogmatic\", { baseRate });\n}\n\n/** Interpret p as a prior with no observed evidence. */\nexport function opinionFromBaseRate(probability: number): SLOpinion {\n return vacuous(clamp01(probability));\n}\n\n/** Interpret p as a certainty-equivalent projected probability. */\nexport function opinionFromDogmatic(\n probability: number,\n baseRate: number\n): SLOpinion {\n return dogmatic(clamp01(probability), clamp01(baseRate));\n}\n\n/**\n * Interpret p as a projected probability with an explicit uncertainty bucket.\n * The resulting opinion always projects back to p.\n */\nexport function opinionFromProjected(\n probability: number,\n uncertainty: number,\n baseRate: number\n): SLOpinion {\n const p = clamp01(probability);\n const u = clamp01(uncertainty);\n const remainingMass = 1 - u;\n return mkOpinion(p * remainingMass, (1 - p) * remainingMass, u, clamp01(baseRate));\n}\n\nexport function hasProjectedOpinionChanged(\n current: Opinion,\n next: Opinion,\n tolerance: number = 0.01\n): boolean {\n return Math.abs(confidenceFromOpinion(next) - confidenceFromOpinion(current)) >=\n tolerance;\n}\n"]}
|