@tuprolog/arg2p-causality-solver 0.17.4 → 0.18.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/2p-core.js +3496 -3242
- package/2p-core.js.map +1 -1
- package/2p-dsl-core.js +1511 -5
- package/2p-dsl-core.js.map +1 -1
- package/2p-dsl-solve.js +945 -5
- package/2p-dsl-solve.js.map +1 -1
- package/2p-dsl-theory.js +791 -5
- package/2p-dsl-theory.js.map +1 -1
- package/2p-dsl-unify.js +68 -5
- package/2p-dsl-unify.js.map +1 -1
- package/2p-io-lib.js +3700 -5
- package/2p-io-lib.js.map +1 -1
- package/2p-parser-core.js +624 -5
- package/2p-parser-core.js.map +1 -1
- package/2p-parser-impl.js +5647 -5
- package/2p-parser-impl.js.map +1 -1
- package/2p-parser-theory.js +295 -5
- package/2p-parser-theory.js.map +1 -1
- package/2p-solve.js +4824 -4275
- package/2p-solve.js.map +1 -1
- package/2p-theory.js +1511 -1496
- package/2p-theory.js.map +1 -1
- package/2p-unify.js +363 -360
- package/2p-unify.js.map +1 -1
- package/2p-utils.js +554 -468
- package/2p-utils.js.map +1 -1
- package/README.md +26 -19
- package/arg2p-causality-solver.js +881 -8
- package/arg2p-causality-solver.js.map +1 -1
- package/arg2p-core.js +14892 -5
- package/arg2p-core.js.map +1 -1
- package/kotlin-kotlin-stdlib.js +4775 -2444
- package/kotlin-kotlin-stdlib.js.map +1 -1
- package/kt-math.js +1542 -1539
- package/kt-math.js.map +1 -1
- package/okio-parent-okio-nodefilesystem.js +201 -5
- package/okio-parent-okio-nodefilesystem.js.map +1 -1
- package/okio-parent-okio.js +3863 -5
- package/okio-parent-okio.js.map +1 -1
- package/package.json +1 -1
- package/2p-solve-prolog.js +0 -2854
- package/2p-solve-prolog.js.map +0 -1
|
@@ -1,28 +1,901 @@
|
|
|
1
1
|
(function (factory) {
|
|
2
2
|
if (typeof define === 'function' && define.amd)
|
|
3
|
-
define(['exports', './kotlin-kotlin-stdlib.js', './
|
|
3
|
+
define(['exports', './kotlin-kotlin-stdlib.js', './arg2p-core.js', './2p-core.js', './2p-solve.js', './2p-unify.js', './2p-parser-core.js', './2p-theory.js', './kt-math.js'], factory);
|
|
4
4
|
else if (typeof exports === 'object')
|
|
5
|
-
factory(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./
|
|
5
|
+
factory(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./arg2p-core.js'), require('./2p-core.js'), require('./2p-solve.js'), require('./2p-unify.js'), require('./2p-parser-core.js'), require('./2p-theory.js'), require('./kt-math.js'));
|
|
6
6
|
else {
|
|
7
7
|
if (typeof globalThis['kotlin-kotlin-stdlib'] === 'undefined') {
|
|
8
8
|
throw new Error("Error loading module 'it.unibo.tuprolog.argumentation:causality-solver'. Its dependency 'kotlin-kotlin-stdlib' was not found. Please, check whether 'kotlin-kotlin-stdlib' is loaded prior to 'it.unibo.tuprolog.argumentation:causality-solver'.");
|
|
9
9
|
}
|
|
10
|
+
if (typeof globalThis['arg2p-core'] === 'undefined') {
|
|
11
|
+
throw new Error("Error loading module 'it.unibo.tuprolog.argumentation:causality-solver'. Its dependency 'arg2p-core' was not found. Please, check whether 'arg2p-core' is loaded prior to 'it.unibo.tuprolog.argumentation:causality-solver'.");
|
|
12
|
+
}
|
|
13
|
+
if (typeof globalThis['2p-core'] === 'undefined') {
|
|
14
|
+
throw new Error("Error loading module 'it.unibo.tuprolog.argumentation:causality-solver'. Its dependency '2p-core' was not found. Please, check whether '2p-core' is loaded prior to 'it.unibo.tuprolog.argumentation:causality-solver'.");
|
|
15
|
+
}
|
|
16
|
+
if (typeof globalThis['2p-solve'] === 'undefined') {
|
|
17
|
+
throw new Error("Error loading module 'it.unibo.tuprolog.argumentation:causality-solver'. Its dependency '2p-solve' was not found. Please, check whether '2p-solve' is loaded prior to 'it.unibo.tuprolog.argumentation:causality-solver'.");
|
|
18
|
+
}
|
|
19
|
+
if (typeof globalThis['2p-unify'] === 'undefined') {
|
|
20
|
+
throw new Error("Error loading module 'it.unibo.tuprolog.argumentation:causality-solver'. Its dependency '2p-unify' was not found. Please, check whether '2p-unify' is loaded prior to 'it.unibo.tuprolog.argumentation:causality-solver'.");
|
|
21
|
+
}
|
|
22
|
+
if (typeof globalThis['2p-parser-core'] === 'undefined') {
|
|
23
|
+
throw new Error("Error loading module 'it.unibo.tuprolog.argumentation:causality-solver'. Its dependency '2p-parser-core' was not found. Please, check whether '2p-parser-core' is loaded prior to 'it.unibo.tuprolog.argumentation:causality-solver'.");
|
|
24
|
+
}
|
|
25
|
+
if (typeof globalThis['2p-theory'] === 'undefined') {
|
|
26
|
+
throw new Error("Error loading module 'it.unibo.tuprolog.argumentation:causality-solver'. Its dependency '2p-theory' was not found. Please, check whether '2p-theory' is loaded prior to 'it.unibo.tuprolog.argumentation:causality-solver'.");
|
|
27
|
+
}
|
|
10
28
|
if (typeof globalThis['kt-math'] === 'undefined') {
|
|
11
29
|
throw new Error("Error loading module 'it.unibo.tuprolog.argumentation:causality-solver'. Its dependency 'kt-math' was not found. Please, check whether 'kt-math' is loaded prior to 'it.unibo.tuprolog.argumentation:causality-solver'.");
|
|
12
30
|
}
|
|
13
|
-
|
|
14
|
-
throw new Error("Error loading module 'it.unibo.tuprolog.argumentation:causality-solver'. Its dependency '2p-solve-prolog' was not found. Please, check whether '2p-solve-prolog' is loaded prior to 'it.unibo.tuprolog.argumentation:causality-solver'.");
|
|
15
|
-
}
|
|
16
|
-
globalThis['it.unibo.tuprolog.argumentation:causality-solver'] = factory(typeof globalThis['it.unibo.tuprolog.argumentation:causality-solver'] === 'undefined' ? {} : globalThis['it.unibo.tuprolog.argumentation:causality-solver'], globalThis['kotlin-kotlin-stdlib'], globalThis['kt-math'], globalThis['2p-solve-prolog']);
|
|
31
|
+
globalThis['it.unibo.tuprolog.argumentation:causality-solver'] = factory(typeof globalThis['it.unibo.tuprolog.argumentation:causality-solver'] === 'undefined' ? {} : globalThis['it.unibo.tuprolog.argumentation:causality-solver'], globalThis['kotlin-kotlin-stdlib'], globalThis['arg2p-core'], globalThis['2p-core'], globalThis['2p-solve'], globalThis['2p-unify'], globalThis['2p-parser-core'], globalThis['2p-theory'], globalThis['kt-math']);
|
|
17
32
|
}
|
|
18
|
-
}(function (_, kotlin_kotlin,
|
|
33
|
+
}(function (_, kotlin_kotlin, kotlin_it_unibo_tuprolog_argumentation_core, kotlin_it_unibo_tuprolog_core, kotlin_it_unibo_tuprolog_solve, kotlin_it_unibo_tuprolog_unify, kotlin_it_unibo_tuprolog_parser_core, kotlin_it_unibo_tuprolog_theory, kotlin_io_github_gciatto_kt_math) {
|
|
19
34
|
'use strict';
|
|
35
|
+
//region block: imports
|
|
36
|
+
var protoOf = kotlin_kotlin.$_$.e8;
|
|
37
|
+
var initMetadataForObject = kotlin_kotlin.$_$.v7;
|
|
38
|
+
var defineProp = kotlin_kotlin.$_$.j7;
|
|
39
|
+
var VOID = kotlin_kotlin.$_$.b;
|
|
40
|
+
var PrologModule = kotlin_it_unibo_tuprolog_argumentation_core.$_$.i;
|
|
41
|
+
var listOf = kotlin_kotlin.$_$.f4;
|
|
42
|
+
var collectionSizeOrDefault = kotlin_kotlin.$_$.x2;
|
|
43
|
+
var mapCapacity = kotlin_kotlin.$_$.g4;
|
|
44
|
+
var coerceAtLeast = kotlin_kotlin.$_$.r8;
|
|
45
|
+
var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.z;
|
|
46
|
+
var Unit_instance = kotlin_kotlin.$_$.r;
|
|
47
|
+
var ParserModule_getInstance = kotlin_it_unibo_tuprolog_argumentation_core.$_$.b;
|
|
48
|
+
var initMetadataForClass = kotlin_kotlin.$_$.r7;
|
|
49
|
+
var Companion_instance = kotlin_it_unibo_tuprolog_core.$_$.p;
|
|
50
|
+
var ensureNotNull = kotlin_kotlin.$_$.uc;
|
|
51
|
+
var filter = kotlin_kotlin.$_$.k9;
|
|
52
|
+
var map = kotlin_kotlin.$_$.x9;
|
|
53
|
+
var firstOrNull = kotlin_kotlin.$_$.l9;
|
|
54
|
+
var Signature = kotlin_it_unibo_tuprolog_solve.$_$.y3;
|
|
55
|
+
var arg2pScope = kotlin_it_unibo_tuprolog_argumentation_core.$_$.g;
|
|
56
|
+
var sequenceOf = kotlin_kotlin.$_$.ea;
|
|
57
|
+
var get_help = kotlin_it_unibo_tuprolog_solve.$_$.p3;
|
|
58
|
+
var Helpable = kotlin_it_unibo_tuprolog_solve.$_$.q3;
|
|
59
|
+
var Companion_instance_0 = kotlin_it_unibo_tuprolog_solve.$_$.e1;
|
|
60
|
+
var Expected_VARIABLE_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.r;
|
|
61
|
+
var Var = kotlin_it_unibo_tuprolog_core.$_$.d3;
|
|
62
|
+
var isInterface = kotlin_kotlin.$_$.y7;
|
|
63
|
+
var Companion_getInstance = kotlin_it_unibo_tuprolog_core.$_$.v;
|
|
64
|
+
var joinToString = kotlin_kotlin.$_$.w3;
|
|
65
|
+
var to = kotlin_kotlin.$_$.dd;
|
|
66
|
+
var Companion_getInstance_0 = kotlin_it_unibo_tuprolog_core.$_$.u;
|
|
67
|
+
var first = kotlin_kotlin.$_$.m9;
|
|
68
|
+
var Halt = kotlin_it_unibo_tuprolog_solve.$_$.z3;
|
|
69
|
+
var mineActiveGraph = kotlin_it_unibo_tuprolog_argumentation_core.$_$.h;
|
|
70
|
+
var Companion_getInstance_1 = kotlin_it_unibo_tuprolog_unify.$_$.a;
|
|
71
|
+
var Companion_instance_1 = kotlin_it_unibo_tuprolog_core.$_$.w;
|
|
72
|
+
var parseTermWithOperators = kotlin_it_unibo_tuprolog_parser_core.$_$.c;
|
|
73
|
+
var ArrayList_init_$Create$ = kotlin_kotlin.$_$.u;
|
|
74
|
+
var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.t;
|
|
75
|
+
var NoSuchElementException_init_$Create$ = kotlin_kotlin.$_$.v1;
|
|
76
|
+
var plus = kotlin_kotlin.$_$.a5;
|
|
77
|
+
var addAll = kotlin_kotlin.$_$.j2;
|
|
78
|
+
var plus_0 = kotlin_kotlin.$_$.z4;
|
|
79
|
+
var emptyList = kotlin_kotlin.$_$.l3;
|
|
80
|
+
var asSequence = kotlin_kotlin.$_$.t2;
|
|
81
|
+
var flatMap = kotlin_kotlin.$_$.o9;
|
|
82
|
+
var Companion_instance_2 = kotlin_it_unibo_tuprolog_argumentation_core.$_$.c;
|
|
83
|
+
var ArgumentLabellingMode_instance = kotlin_it_unibo_tuprolog_argumentation_core.$_$.a;
|
|
84
|
+
var setOf = kotlin_kotlin.$_$.e5;
|
|
85
|
+
var Companion_instance_3 = kotlin_it_unibo_tuprolog_theory.$_$.b;
|
|
86
|
+
var Companion_getInstance_2 = kotlin_it_unibo_tuprolog_core.$_$.l;
|
|
87
|
+
var Companion_getInstance_3 = kotlin_it_unibo_tuprolog_core.$_$.k;
|
|
88
|
+
var toList = kotlin_kotlin.$_$.la;
|
|
89
|
+
var Collection = kotlin_kotlin.$_$.c2;
|
|
90
|
+
var distinct = kotlin_kotlin.$_$.j3;
|
|
91
|
+
var RuleAnnotations_getInstance = kotlin_it_unibo_tuprolog_argumentation_core.$_$.d;
|
|
92
|
+
var Arg2pSolverFactory_instance = kotlin_it_unibo_tuprolog_argumentation_core.$_$.f;
|
|
93
|
+
var FlagsBuilder = kotlin_it_unibo_tuprolog_argumentation_core.$_$.j;
|
|
94
|
+
var Companion_instance_4 = kotlin_it_unibo_tuprolog_argumentation_core.$_$.e;
|
|
95
|
+
var LinkedHashMap_init_$Create$_0 = kotlin_kotlin.$_$.a1;
|
|
96
|
+
//endregion
|
|
20
97
|
//region block: pre-declaration
|
|
98
|
+
initMetadataForObject(JsCausality, 'JsCausality');
|
|
99
|
+
initMetadataForClass(CausalityModule, 'CausalityModule', CausalityModule, PrologModule);
|
|
100
|
+
initMetadataForClass(ButFor, 'ButFor', VOID, VOID, [Helpable]);
|
|
101
|
+
initMetadataForClass(Ness, 'Ness', VOID, VOID, [Helpable]);
|
|
102
|
+
initMetadataForClass(NessIntervention, 'NessIntervention', VOID, VOID, [Helpable]);
|
|
103
|
+
initMetadataForClass(NessOriginal, 'NessOriginal', VOID, VOID, [Helpable]);
|
|
104
|
+
initMetadataForClass(NessOriginalIntervention, 'NessOriginalIntervention', VOID, VOID, [Helpable]);
|
|
105
|
+
initMetadataForClass(CausalityAnalysis, 'CausalityAnalysis', CausalityAnalysis);
|
|
106
|
+
//endregion
|
|
107
|
+
function JsCausality() {
|
|
108
|
+
}
|
|
109
|
+
protoOf(JsCausality).module = function () {
|
|
110
|
+
return new CausalityModule();
|
|
111
|
+
};
|
|
112
|
+
var JsCausality_instance;
|
|
113
|
+
function JsCausality_getInstance() {
|
|
114
|
+
return JsCausality_instance;
|
|
115
|
+
}
|
|
116
|
+
function CausalityModule() {
|
|
117
|
+
PrologModule.call(this, 'prolog.argumentation.causality.solver', 'causality');
|
|
118
|
+
this.a57_1 = new CausalityAnalysis();
|
|
119
|
+
this.b57_1 = '%! subsets(?List, ?Subset)\n% Subset is each subset of List, its elements in their order.\nsubsets([], []).\nsubsets([H|T], [H|NT]) :- subsets(T, NT).\nsubsets([_|T], NT) :- subsets(T, NT).\n\n%! properSubsets(+List, -Subset)\n% Subset is each subset of List other than the empty one and List itself.\nproperSubsets(L, S) :-\n subsets(L, S),\n S \\= [],\n S \\= L.\n\n%! generateInterventions(+Rules, +Cause, -Intervention)\n% Intervention is each change of the theory removing Cause: its complement, the undercut of Cause (a rule,\n% unless it is negated), or the complement with a set of the premises of the rules not among Rules (the top\n% rules of the graph of the effect).\ngenerateInterventions(_, S, [CS]) :-\n compl(S, CS).\ngenerateInterventions(_, S, [undercut(S)]) :-\n S \\= -_.\ngenerateInterventions(R, S, SUP) :-\n parser:::convertAllRules(_),\n compl(S, CS),\n unusedPremises(R, UP), !,\n subsets(UP, SUP),\n member(CS, SUP),\n SUP \\= [].\n\n%! compl(?Statement, ?Complement)\n% Complement is the complement of Statement (-X for X, X for -X).\ncompl(-X, X) :- !.\ncompl(X, -X).\n\n%! unusedPremises(+Rules, -Premises)\n% Premises are those of the rules of the theory not among Rules.\nunusedPremises(R, UP) :-\n findall(P, (parser::rule(Id, P, _), \\+ member(Id, R), ground(Id)), RR),\n utils::appendLists(RR, UP).';
|
|
120
|
+
}
|
|
121
|
+
protoOf(CausalityModule).u2i = function () {
|
|
122
|
+
// Inline function 'kotlin.collections.associateBy' call
|
|
123
|
+
var this_0 = listOf([new Ness(this.a57_1), new NessIntervention(this.a57_1), new NessOriginal(this.a57_1), new NessOriginalIntervention(this.a57_1), new ButFor(this.a57_1)]);
|
|
124
|
+
var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(this_0, 10)), 16);
|
|
125
|
+
// Inline function 'kotlin.collections.associateByTo' call
|
|
126
|
+
var destination = LinkedHashMap_init_$Create$(capacity);
|
|
127
|
+
var _iterator__ex2g4s = this_0.n();
|
|
128
|
+
while (_iterator__ex2g4s.q()) {
|
|
129
|
+
var element = _iterator__ex2g4s.r();
|
|
130
|
+
var tmp$ret$2 = element.t1x();
|
|
131
|
+
destination.t4(tmp$ret$2, element);
|
|
132
|
+
}
|
|
133
|
+
return destination;
|
|
134
|
+
};
|
|
135
|
+
protoOf(CausalityModule).w44 = function () {
|
|
136
|
+
return protoOf(PrologModule).w44.call(this).plusOperatorSet(ParserModule_getInstance().i44());
|
|
137
|
+
};
|
|
138
|
+
protoOf(CausalityModule).d4k = function () {
|
|
139
|
+
return this.b57_1;
|
|
140
|
+
};
|
|
141
|
+
function ButFor$solve$lambda$lambda(it) {
|
|
142
|
+
return it.n1z();
|
|
143
|
+
}
|
|
144
|
+
function ButFor$solve$lambda$lambda_0(this$0, $request, $this_arg2pScope, $effect) {
|
|
145
|
+
return function (it) {
|
|
146
|
+
return this$0.c57_1.h57($request, Companion_instance.of([ensureNotNull(it.d1y().k2($this_arg2pScope.x1j()))]), $effect);
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function ButFor$solve$lambda($request, $cause, this$0, $effect) {
|
|
150
|
+
return function ($this$arg2pScope) {
|
|
151
|
+
var tmp = $request.solve($this$arg2pScope.stringInvoke('compl', $cause, [$this$arg2pScope.x1j()]));
|
|
152
|
+
var tmp_0 = filter(tmp, ButFor$solve$lambda$lambda);
|
|
153
|
+
var tmp0_elvis_lhs = firstOrNull(map(tmp_0, ButFor$solve$lambda$lambda_0(this$0, $request, $this$arg2pScope, $effect)));
|
|
154
|
+
return tmp0_elvis_lhs == null ? false : tmp0_elvis_lhs;
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
function ButFor(analysis) {
|
|
158
|
+
this.c57_1 = analysis;
|
|
159
|
+
this.d57_1 = new Signature('but_for', 2);
|
|
160
|
+
}
|
|
161
|
+
protoOf(ButFor).t1x = function () {
|
|
162
|
+
return this.d57_1;
|
|
163
|
+
};
|
|
164
|
+
protoOf(ButFor).o2m = function (request) {
|
|
165
|
+
var _destruct__k2r9zo = request.arguments;
|
|
166
|
+
// Inline function 'kotlin.collections.component1' call
|
|
167
|
+
var cause = _destruct__k2r9zo.t(0);
|
|
168
|
+
// Inline function 'kotlin.collections.component2' call
|
|
169
|
+
var effect = _destruct__k2r9zo.t(1);
|
|
170
|
+
var tmp;
|
|
171
|
+
if (this.c57_1.i57(request, cause)) {
|
|
172
|
+
tmp = arg2pScope(ButFor$solve$lambda(request, cause, this, effect));
|
|
173
|
+
} else {
|
|
174
|
+
tmp = false;
|
|
175
|
+
}
|
|
176
|
+
var holds = tmp;
|
|
177
|
+
return sequenceOf(request.replyWithCondition(holds, VOID, []));
|
|
178
|
+
};
|
|
179
|
+
protoOf(ButFor).solve = function (request) {
|
|
180
|
+
return this.o2m(request);
|
|
181
|
+
};
|
|
182
|
+
function Ness(analysis) {
|
|
183
|
+
this.j57_1 = analysis;
|
|
184
|
+
this.k57_1 = new Signature('ness', 3);
|
|
185
|
+
}
|
|
186
|
+
protoOf(Ness).t1x = function () {
|
|
187
|
+
return this.k57_1;
|
|
188
|
+
};
|
|
189
|
+
protoOf(Ness).o2m = function (request) {
|
|
190
|
+
var _destruct__k2r9zo = request.arguments;
|
|
191
|
+
// Inline function 'kotlin.collections.component1' call
|
|
192
|
+
var intervention = _destruct__k2r9zo.t(0);
|
|
193
|
+
// Inline function 'kotlin.collections.component2' call
|
|
194
|
+
var cause = _destruct__k2r9zo.t(1);
|
|
195
|
+
// Inline function 'kotlin.collections.component3' call
|
|
196
|
+
var effect = _destruct__k2r9zo.t(2);
|
|
197
|
+
if (!isInterface(intervention, Var)) {
|
|
198
|
+
throw Companion_instance_0.forGoal(request.context, request.signature, Expected_VARIABLE_getInstance(), intervention);
|
|
199
|
+
}
|
|
200
|
+
var tmp;
|
|
201
|
+
if (this.j57_1.i57(request, cause)) {
|
|
202
|
+
var tmp0 = this.j57_1.l57(request, cause, effect);
|
|
203
|
+
var tmp$ret$3;
|
|
204
|
+
$l$block: {
|
|
205
|
+
// Inline function 'kotlin.sequences.firstOrNull' call
|
|
206
|
+
var _iterator__ex2g4s = tmp0.n();
|
|
207
|
+
while (_iterator__ex2g4s.q()) {
|
|
208
|
+
var element = _iterator__ex2g4s.r();
|
|
209
|
+
if (this.j57_1.m57(request, element, effect)) {
|
|
210
|
+
tmp$ret$3 = element;
|
|
211
|
+
break $l$block;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
tmp$ret$3 = null;
|
|
215
|
+
}
|
|
216
|
+
tmp = tmp$ret$3;
|
|
217
|
+
} else {
|
|
218
|
+
tmp = null;
|
|
219
|
+
}
|
|
220
|
+
var found = tmp;
|
|
221
|
+
var tmp_0;
|
|
222
|
+
if (found == null) {
|
|
223
|
+
tmp_0 = null;
|
|
224
|
+
} else {
|
|
225
|
+
// Inline function 'kotlin.let' call
|
|
226
|
+
tmp_0 = Companion_getInstance().of(intervention, found);
|
|
227
|
+
}
|
|
228
|
+
var tmp1_elvis_lhs = tmp_0;
|
|
229
|
+
return sequenceOf(request.replyWith(tmp1_elvis_lhs == null ? Companion_getInstance().failed() : tmp1_elvis_lhs, VOID, []));
|
|
230
|
+
};
|
|
231
|
+
protoOf(Ness).solve = function (request) {
|
|
232
|
+
return this.o2m(request);
|
|
233
|
+
};
|
|
234
|
+
function NessIntervention(analysis) {
|
|
235
|
+
this.n57_1 = analysis;
|
|
236
|
+
this.o57_1 = new Signature('ness_intervention', 2);
|
|
237
|
+
}
|
|
238
|
+
protoOf(NessIntervention).t1x = function () {
|
|
239
|
+
return this.o57_1;
|
|
240
|
+
};
|
|
241
|
+
protoOf(NessIntervention).o2m = function (request) {
|
|
242
|
+
var _destruct__k2r9zo = request.arguments;
|
|
243
|
+
// Inline function 'kotlin.collections.component1' call
|
|
244
|
+
var intervention = _destruct__k2r9zo.t(0);
|
|
245
|
+
// Inline function 'kotlin.collections.component2' call
|
|
246
|
+
var effect = _destruct__k2r9zo.t(1);
|
|
247
|
+
return sequenceOf(request.replyWithCondition(this.n57_1.m57(request, intervention.castToList(), effect), VOID, []));
|
|
248
|
+
};
|
|
249
|
+
protoOf(NessIntervention).solve = function (request) {
|
|
250
|
+
return this.o2m(request);
|
|
251
|
+
};
|
|
252
|
+
function NessOriginal(analysis) {
|
|
253
|
+
this.p57_1 = analysis;
|
|
254
|
+
this.q57_1 = new Signature('ness_original', 3);
|
|
255
|
+
}
|
|
256
|
+
protoOf(NessOriginal).t1x = function () {
|
|
257
|
+
return this.q57_1;
|
|
258
|
+
};
|
|
259
|
+
protoOf(NessOriginal).o2m = function (request) {
|
|
260
|
+
var _destruct__k2r9zo = request.arguments;
|
|
261
|
+
// Inline function 'kotlin.collections.component1' call
|
|
262
|
+
var intervention = _destruct__k2r9zo.t(0);
|
|
263
|
+
// Inline function 'kotlin.collections.component2' call
|
|
264
|
+
var cause = _destruct__k2r9zo.t(1);
|
|
265
|
+
// Inline function 'kotlin.collections.component3' call
|
|
266
|
+
var effect = _destruct__k2r9zo.t(2);
|
|
267
|
+
if (!isInterface(intervention, Var)) {
|
|
268
|
+
throw Companion_instance_0.forGoal(request.context, request.signature, Expected_VARIABLE_getInstance(), intervention);
|
|
269
|
+
}
|
|
270
|
+
var tmp0 = this.p57_1.l57(request, cause, effect);
|
|
271
|
+
var tmp$ret$3;
|
|
272
|
+
$l$block: {
|
|
273
|
+
// Inline function 'kotlin.sequences.firstOrNull' call
|
|
274
|
+
var _iterator__ex2g4s = tmp0.n();
|
|
275
|
+
while (_iterator__ex2g4s.q()) {
|
|
276
|
+
var element = _iterator__ex2g4s.r();
|
|
277
|
+
if (this.p57_1.r57(request, element, effect)) {
|
|
278
|
+
tmp$ret$3 = element;
|
|
279
|
+
break $l$block;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
tmp$ret$3 = null;
|
|
283
|
+
}
|
|
284
|
+
var found = tmp$ret$3;
|
|
285
|
+
var tmp;
|
|
286
|
+
if (found == null) {
|
|
287
|
+
tmp = null;
|
|
288
|
+
} else {
|
|
289
|
+
// Inline function 'kotlin.let' call
|
|
290
|
+
tmp = Companion_getInstance().of(intervention, found);
|
|
291
|
+
}
|
|
292
|
+
var tmp1_elvis_lhs = tmp;
|
|
293
|
+
return sequenceOf(request.replyWith(tmp1_elvis_lhs == null ? Companion_getInstance().failed() : tmp1_elvis_lhs, VOID, []));
|
|
294
|
+
};
|
|
295
|
+
protoOf(NessOriginal).solve = function (request) {
|
|
296
|
+
return this.o2m(request);
|
|
297
|
+
};
|
|
298
|
+
function NessOriginalIntervention(analysis) {
|
|
299
|
+
this.s57_1 = analysis;
|
|
300
|
+
this.t57_1 = new Signature('ness_original_intervention', 2);
|
|
301
|
+
}
|
|
302
|
+
protoOf(NessOriginalIntervention).t1x = function () {
|
|
303
|
+
return this.t57_1;
|
|
304
|
+
};
|
|
305
|
+
protoOf(NessOriginalIntervention).o2m = function (request) {
|
|
306
|
+
var _destruct__k2r9zo = request.arguments;
|
|
307
|
+
// Inline function 'kotlin.collections.component1' call
|
|
308
|
+
var intervention = _destruct__k2r9zo.t(0);
|
|
309
|
+
// Inline function 'kotlin.collections.component2' call
|
|
310
|
+
var effect = _destruct__k2r9zo.t(1);
|
|
311
|
+
return sequenceOf(request.replyWithCondition(this.s57_1.r57(request, intervention.castToList(), effect), VOID, []));
|
|
312
|
+
};
|
|
313
|
+
protoOf(NessOriginalIntervention).solve = function (request) {
|
|
314
|
+
return this.o2m(request);
|
|
315
|
+
};
|
|
316
|
+
function graphOf($this, theory, query) {
|
|
317
|
+
var tmp = theory.toStringAsProlog(true);
|
|
318
|
+
var text = tmp + joinToString(theory, ',', VOID, VOID, VOID, VOID, CausalityAnalysis$graphOf$lambda);
|
|
319
|
+
var key = to(text, query.toString());
|
|
320
|
+
var tmp0_safe_receiver = $this.g57_1.k2(key);
|
|
321
|
+
if (tmp0_safe_receiver == null)
|
|
322
|
+
null;
|
|
323
|
+
else {
|
|
324
|
+
// Inline function 'kotlin.let' call
|
|
325
|
+
return tmp0_safe_receiver;
|
|
326
|
+
}
|
|
327
|
+
if ($this.g57_1.s() >= 256) {
|
|
328
|
+
$this.g57_1.n3();
|
|
329
|
+
}
|
|
330
|
+
$this.e57_1.resetStaticKb();
|
|
331
|
+
$this.e57_1.loadStaticKb(theory);
|
|
332
|
+
var solution = first($this.e57_1.solve(Companion_getInstance_0().of('answerQuery', [query])));
|
|
333
|
+
if (isInterface(solution, Halt))
|
|
334
|
+
throw solution.z1z();
|
|
335
|
+
// Inline function 'kotlin.also' call
|
|
336
|
+
var this_0 = mineActiveGraph($this.e57_1);
|
|
337
|
+
// Inline function 'kotlin.collections.set' call
|
|
338
|
+
$this.g57_1.t4(key, this_0);
|
|
339
|
+
return this_0;
|
|
340
|
+
}
|
|
341
|
+
function concludes($this, argument, statement) {
|
|
342
|
+
return Companion_getInstance_1().b1o().match(parseTermWithOperators(Companion_instance_1, argument.r4h_1, $this.f57_1), statement);
|
|
343
|
+
}
|
|
344
|
+
function attackers($this, argument, graph) {
|
|
345
|
+
// Inline function 'kotlin.collections.filter' call
|
|
346
|
+
var tmp0 = graph.m4h_1;
|
|
347
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
348
|
+
var destination = ArrayList_init_$Create$();
|
|
349
|
+
var _iterator__ex2g4s = tmp0.n();
|
|
350
|
+
while (_iterator__ex2g4s.q()) {
|
|
351
|
+
var element = _iterator__ex2g4s.r();
|
|
352
|
+
if (element.d4i_1.x4h_1 === argument.x4h_1) {
|
|
353
|
+
destination.l(element);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
// Inline function 'kotlin.collections.map' call
|
|
357
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
358
|
+
var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(destination, 10));
|
|
359
|
+
var _iterator__ex2g4s_0 = destination.n();
|
|
360
|
+
while (_iterator__ex2g4s_0.q()) {
|
|
361
|
+
var item = _iterator__ex2g4s_0.r();
|
|
362
|
+
var tmp0_0 = graph.o4h_1;
|
|
363
|
+
var tmp$ret$6;
|
|
364
|
+
$l$block: {
|
|
365
|
+
// Inline function 'kotlin.collections.first' call
|
|
366
|
+
var _iterator__ex2g4s_1 = tmp0_0.n();
|
|
367
|
+
while (_iterator__ex2g4s_1.q()) {
|
|
368
|
+
var element_0 = _iterator__ex2g4s_1.r();
|
|
369
|
+
if (item.c4i_1.x4h_1 === element_0.z4h_1.x4h_1) {
|
|
370
|
+
tmp$ret$6 = element_0;
|
|
371
|
+
break $l$block;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
throw NoSuchElementException_init_$Create$('Collection contains no element matching the predicate.');
|
|
375
|
+
}
|
|
376
|
+
var tmp$ret$5 = tmp$ret$6;
|
|
377
|
+
destination_0.l(tmp$ret$5);
|
|
378
|
+
}
|
|
379
|
+
return destination_0;
|
|
380
|
+
}
|
|
381
|
+
function supporters($this, argument, graph, chain) {
|
|
382
|
+
var tmp;
|
|
383
|
+
if (chain.z(argument.x4h_1)) {
|
|
384
|
+
tmp = emptyList();
|
|
385
|
+
} else {
|
|
386
|
+
// Inline function 'kotlin.collections.filter' call
|
|
387
|
+
var tmp0 = graph.o4h_1;
|
|
388
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
389
|
+
var destination = ArrayList_init_$Create$();
|
|
390
|
+
var _iterator__ex2g4s = tmp0.n();
|
|
391
|
+
while (_iterator__ex2g4s.q()) {
|
|
392
|
+
var element = _iterator__ex2g4s.r();
|
|
393
|
+
if (argument.x4h_1 === element.z4h_1.x4h_1 && element.a4i_1 === 'in') {
|
|
394
|
+
destination.l(element);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
var tmp_0 = destination;
|
|
398
|
+
// Inline function 'kotlin.collections.flatMap' call
|
|
399
|
+
var tmp0_0 = attackers($this, argument, graph);
|
|
400
|
+
// Inline function 'kotlin.collections.flatMapTo' call
|
|
401
|
+
var destination_0 = ArrayList_init_$Create$();
|
|
402
|
+
var _iterator__ex2g4s_0 = tmp0_0.n();
|
|
403
|
+
while (_iterator__ex2g4s_0.q()) {
|
|
404
|
+
var element_0 = _iterator__ex2g4s_0.r();
|
|
405
|
+
// Inline function 'kotlin.collections.filter' call
|
|
406
|
+
var tmp0_1 = attackers($this, element_0.z4h_1, graph);
|
|
407
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
408
|
+
var destination_1 = ArrayList_init_$Create$();
|
|
409
|
+
var _iterator__ex2g4s_1 = tmp0_1.n();
|
|
410
|
+
while (_iterator__ex2g4s_1.q()) {
|
|
411
|
+
var element_1 = _iterator__ex2g4s_1.r();
|
|
412
|
+
if (!(element_1.z4h_1.x4h_1 === argument.x4h_1)) {
|
|
413
|
+
destination_1.l(element_1);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
// Inline function 'kotlin.collections.flatMap' call
|
|
417
|
+
// Inline function 'kotlin.collections.flatMapTo' call
|
|
418
|
+
var destination_2 = ArrayList_init_$Create$();
|
|
419
|
+
var _iterator__ex2g4s_2 = destination_1.n();
|
|
420
|
+
while (_iterator__ex2g4s_2.q()) {
|
|
421
|
+
var element_2 = _iterator__ex2g4s_2.r();
|
|
422
|
+
var list = supporters($this, element_2.z4h_1, graph, plus(chain, argument.x4h_1));
|
|
423
|
+
addAll(destination_2, list);
|
|
424
|
+
}
|
|
425
|
+
var list_0 = destination_2;
|
|
426
|
+
addAll(destination_0, list_0);
|
|
427
|
+
}
|
|
428
|
+
tmp = plus_0(tmp_0, destination_0);
|
|
429
|
+
}
|
|
430
|
+
return tmp;
|
|
431
|
+
}
|
|
432
|
+
function supports($this, graph, effect) {
|
|
433
|
+
var tmp = asSequence(graph.o4h_1);
|
|
434
|
+
var tmp_0 = filter(tmp, CausalityAnalysis$supports$lambda($this, effect));
|
|
435
|
+
var tmp_1 = flatMap(tmp_0, CausalityAnalysis$supports$lambda_0($this, graph));
|
|
436
|
+
return map(tmp_1, CausalityAnalysis$supports$lambda_1);
|
|
437
|
+
}
|
|
438
|
+
function theory($this, request) {
|
|
439
|
+
var theory = request.context.j1y();
|
|
440
|
+
var tmp0_elvis_lhs = Companion_instance_2.u4x(request.context);
|
|
441
|
+
var tmp;
|
|
442
|
+
if (tmp0_elvis_lhs == null) {
|
|
443
|
+
return theory;
|
|
444
|
+
} else {
|
|
445
|
+
tmp = tmp0_elvis_lhs;
|
|
446
|
+
}
|
|
447
|
+
var settings = tmp;
|
|
448
|
+
var except = setOf(ArgumentLabellingMode_instance.d4h());
|
|
449
|
+
var tmp_0 = Companion_instance_3;
|
|
450
|
+
var tmp_1 = theory.i1o();
|
|
451
|
+
// Inline function 'kotlin.collections.filterNot' call
|
|
452
|
+
var tmp0 = theory.s1o();
|
|
453
|
+
// Inline function 'kotlin.collections.filterNotTo' call
|
|
454
|
+
var destination = ArrayList_init_$Create$();
|
|
455
|
+
var _iterator__ex2g4s = tmp0.n();
|
|
456
|
+
while (_iterator__ex2g4s.q()) {
|
|
457
|
+
var element = _iterator__ex2g4s.r();
|
|
458
|
+
if (!settings.u56(element)) {
|
|
459
|
+
destination.l(element);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return tmp_0.ofIterable(tmp_1, plus_0(destination, settings.t56(request.context, except)));
|
|
463
|
+
}
|
|
464
|
+
function intervened($this, request, intervention) {
|
|
465
|
+
var tmp = theory($this, request);
|
|
466
|
+
var tmp_0 = Companion_instance_3;
|
|
467
|
+
// Inline function 'kotlin.collections.map' call
|
|
468
|
+
var this_0 = intervention.toList();
|
|
469
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
470
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
471
|
+
var _iterator__ex2g4s = this_0.n();
|
|
472
|
+
while (_iterator__ex2g4s.q()) {
|
|
473
|
+
var item = _iterator__ex2g4s.r();
|
|
474
|
+
var tmp$ret$2 = Companion_getInstance_2().of(Companion_getInstance_0().of(':->', [Companion_getInstance_3().of('fk' + (item.hashCode() & 2147483647)), item]), []);
|
|
475
|
+
destination.l(tmp$ret$2);
|
|
476
|
+
}
|
|
477
|
+
return tmp.plusTheory(tmp_0.ofIterableWithDefaultUnificator(destination));
|
|
478
|
+
}
|
|
479
|
+
function baseSupports($this, request, effect) {
|
|
480
|
+
var tmp = supports($this, graphOf($this, theory($this, request), effect), effect);
|
|
481
|
+
return toList(map(tmp, CausalityAnalysis$baseSupports$lambda));
|
|
482
|
+
}
|
|
483
|
+
function interventionAttackers($this, request, intervention, supports, effect) {
|
|
484
|
+
// Inline function 'kotlin.let' call
|
|
485
|
+
var graph = graphOf($this, intervened($this, request, intervention), effect);
|
|
486
|
+
// Inline function 'kotlin.collections.filter' call
|
|
487
|
+
var tmp0 = graph.o4h_1;
|
|
488
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
489
|
+
var destination = ArrayList_init_$Create$();
|
|
490
|
+
var _iterator__ex2g4s = tmp0.n();
|
|
491
|
+
while (_iterator__ex2g4s.q()) {
|
|
492
|
+
var element = _iterator__ex2g4s.r();
|
|
493
|
+
if (element.a4i_1 === 'out' || element.a4i_1 === 'und') {
|
|
494
|
+
destination.l(element);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
// Inline function 'kotlin.collections.filter' call
|
|
498
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
499
|
+
var destination_0 = ArrayList_init_$Create$();
|
|
500
|
+
var _iterator__ex2g4s_0 = destination.n();
|
|
501
|
+
while (_iterator__ex2g4s_0.q()) {
|
|
502
|
+
var element_0 = _iterator__ex2g4s_0.r();
|
|
503
|
+
var tmp$ret$8;
|
|
504
|
+
$l$block_0: {
|
|
505
|
+
// Inline function 'kotlin.collections.any' call
|
|
506
|
+
var tmp;
|
|
507
|
+
if (isInterface(supports, Collection)) {
|
|
508
|
+
tmp = supports.i();
|
|
509
|
+
} else {
|
|
510
|
+
tmp = false;
|
|
511
|
+
}
|
|
512
|
+
if (tmp) {
|
|
513
|
+
tmp$ret$8 = false;
|
|
514
|
+
break $l$block_0;
|
|
515
|
+
}
|
|
516
|
+
var _iterator__ex2g4s_1 = supports.n();
|
|
517
|
+
while (_iterator__ex2g4s_1.q()) {
|
|
518
|
+
var element_1 = _iterator__ex2g4s_1.r();
|
|
519
|
+
if (Companion_getInstance_1().b1o().match(element_0.z4h_1.h4j(), element_1)) {
|
|
520
|
+
tmp$ret$8 = true;
|
|
521
|
+
break $l$block_0;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
tmp$ret$8 = false;
|
|
525
|
+
}
|
|
526
|
+
if (tmp$ret$8) {
|
|
527
|
+
destination_0.l(element_0);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
// Inline function 'kotlin.collections.flatMap' call
|
|
531
|
+
// Inline function 'kotlin.collections.flatMapTo' call
|
|
532
|
+
var destination_1 = ArrayList_init_$Create$();
|
|
533
|
+
var _iterator__ex2g4s_2 = destination_0.n();
|
|
534
|
+
while (_iterator__ex2g4s_2.q()) {
|
|
535
|
+
var element_2 = _iterator__ex2g4s_2.r();
|
|
536
|
+
// Inline function 'kotlin.collections.filter' call
|
|
537
|
+
var tmp0_0 = attackers($this, element_2.z4h_1, graph);
|
|
538
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
539
|
+
var destination_2 = ArrayList_init_$Create$();
|
|
540
|
+
var _iterator__ex2g4s_3 = tmp0_0.n();
|
|
541
|
+
while (_iterator__ex2g4s_3.q()) {
|
|
542
|
+
var element_3 = _iterator__ex2g4s_3.r();
|
|
543
|
+
if (element_3.a4i_1 === 'in') {
|
|
544
|
+
destination_2.l(element_3);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
var list = destination_2;
|
|
548
|
+
addAll(destination_1, list);
|
|
549
|
+
}
|
|
550
|
+
// Inline function 'kotlin.collections.map' call
|
|
551
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
552
|
+
var destination_3 = ArrayList_init_$Create$_0(collectionSizeOrDefault(destination_1, 10));
|
|
553
|
+
var _iterator__ex2g4s_4 = destination_1.n();
|
|
554
|
+
while (_iterator__ex2g4s_4.q()) {
|
|
555
|
+
var item = _iterator__ex2g4s_4.r();
|
|
556
|
+
var tmp$ret$18 = item.z4h_1;
|
|
557
|
+
destination_3.l(tmp$ret$18);
|
|
558
|
+
}
|
|
559
|
+
return distinct(destination_3);
|
|
560
|
+
}
|
|
561
|
+
function properSubsets($this, request, intervention) {
|
|
562
|
+
return arg2pScope(CausalityAnalysis$properSubsets$lambda(request, intervention));
|
|
563
|
+
}
|
|
564
|
+
function CausalityAnalysis$graphOf$lambda(it) {
|
|
565
|
+
// Inline function 'kotlin.text.orEmpty' call
|
|
566
|
+
var tmp0_elvis_lhs = RuleAnnotations_getInstance().k4z(it);
|
|
567
|
+
return tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
|
|
568
|
+
}
|
|
569
|
+
function CausalityAnalysis$supports$lambda(this$0, $effect) {
|
|
570
|
+
return function (it) {
|
|
571
|
+
return concludes(this$0, it.z4h_1, $effect);
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
function CausalityAnalysis$supports$lambda_0(this$0, $graph) {
|
|
575
|
+
return function (it) {
|
|
576
|
+
return supporters(this$0, it.z4h_1, $graph, emptyList());
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
function CausalityAnalysis$supports$lambda_1(it) {
|
|
580
|
+
return it.z4h_1;
|
|
581
|
+
}
|
|
582
|
+
function CausalityAnalysis$baseSupports$lambda(it) {
|
|
583
|
+
return it.h4j();
|
|
584
|
+
}
|
|
585
|
+
function CausalityAnalysis$properSubsets$lambda$lambda(it) {
|
|
586
|
+
return it.n1z();
|
|
587
|
+
}
|
|
588
|
+
function CausalityAnalysis$properSubsets$lambda$lambda_0($this_arg2pScope) {
|
|
589
|
+
return function (it) {
|
|
590
|
+
return ensureNotNull(it.d1y().k2($this_arg2pScope.x1j())).castToList();
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
function CausalityAnalysis$properSubsets$lambda($request, $intervention) {
|
|
594
|
+
return function ($this$arg2pScope) {
|
|
595
|
+
var tmp = $request.solve($this$arg2pScope.stringInvoke('properSubsets', $intervention, [$this$arg2pScope.x1j()]));
|
|
596
|
+
var tmp_0 = filter(tmp, CausalityAnalysis$properSubsets$lambda$lambda);
|
|
597
|
+
return toList(map(tmp_0, CausalityAnalysis$properSubsets$lambda$lambda_0($this$arg2pScope)));
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
function CausalityAnalysis$interventions$lambda$lambda(it) {
|
|
601
|
+
return it.n1z();
|
|
602
|
+
}
|
|
603
|
+
function CausalityAnalysis$interventions$lambda$lambda_0($this_arg2pScope) {
|
|
604
|
+
return function (it) {
|
|
605
|
+
return ensureNotNull(it.d1y().k2($this_arg2pScope.x1j())).castToList();
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
function CausalityAnalysis$interventions$lambda($request, $rules, $cause) {
|
|
609
|
+
return function ($this$arg2pScope) {
|
|
610
|
+
var tmp = $request.solve($this$arg2pScope.stringInvoke('generateInterventions', $rules, [$cause, $this$arg2pScope.x1j()]));
|
|
611
|
+
var tmp_0 = filter(tmp, CausalityAnalysis$interventions$lambda$lambda);
|
|
612
|
+
return map(tmp_0, CausalityAnalysis$interventions$lambda$lambda_0($this$arg2pScope));
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
function CausalityAnalysis() {
|
|
616
|
+
var tmp = this;
|
|
617
|
+
var tmp_0 = Arg2pSolverFactory_instance;
|
|
618
|
+
var tmp0_graphExtensions = emptyList();
|
|
619
|
+
tmp.e57_1 = tmp_0.z44(VOID, (new FlagsBuilder(VOID, VOID, VOID, VOID, VOID, 'grounded', VOID, VOID, VOID, VOID, tmp0_graphExtensions)).n45());
|
|
620
|
+
this.f57_1 = Companion_instance_4.u44().i44();
|
|
621
|
+
var tmp_1 = this;
|
|
622
|
+
// Inline function 'kotlin.collections.mutableMapOf' call
|
|
623
|
+
tmp_1.g57_1 = LinkedHashMap_init_$Create$_0();
|
|
624
|
+
}
|
|
625
|
+
protoOf(CausalityAnalysis).i57 = function (request, statement) {
|
|
626
|
+
var tmp0 = graphOf(this, theory(this, request), statement).o4h_1;
|
|
627
|
+
var tmp$ret$0;
|
|
628
|
+
$l$block_0: {
|
|
629
|
+
// Inline function 'kotlin.collections.any' call
|
|
630
|
+
var tmp;
|
|
631
|
+
if (isInterface(tmp0, Collection)) {
|
|
632
|
+
tmp = tmp0.i();
|
|
633
|
+
} else {
|
|
634
|
+
tmp = false;
|
|
635
|
+
}
|
|
636
|
+
if (tmp) {
|
|
637
|
+
tmp$ret$0 = false;
|
|
638
|
+
break $l$block_0;
|
|
639
|
+
}
|
|
640
|
+
var _iterator__ex2g4s = tmp0.n();
|
|
641
|
+
while (_iterator__ex2g4s.q()) {
|
|
642
|
+
var element = _iterator__ex2g4s.r();
|
|
643
|
+
if (element.a4i_1 === 'in' && concludes(this, element.z4h_1, statement)) {
|
|
644
|
+
tmp$ret$0 = true;
|
|
645
|
+
break $l$block_0;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
tmp$ret$0 = false;
|
|
649
|
+
}
|
|
650
|
+
return tmp$ret$0;
|
|
651
|
+
};
|
|
652
|
+
protoOf(CausalityAnalysis).l57 = function (request, cause, effect) {
|
|
653
|
+
var tmp = Companion_instance;
|
|
654
|
+
// Inline function 'kotlin.collections.map' call
|
|
655
|
+
var this_0 = graphOf(this, theory(this, request), effect).l4h_1;
|
|
656
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
657
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
658
|
+
var _iterator__ex2g4s = this_0.n();
|
|
659
|
+
while (_iterator__ex2g4s.q()) {
|
|
660
|
+
var item = _iterator__ex2g4s.r();
|
|
661
|
+
var tmp$ret$2 = item.q4h_1;
|
|
662
|
+
destination.l(tmp$ret$2);
|
|
663
|
+
}
|
|
664
|
+
// Inline function 'kotlin.collections.filter' call
|
|
665
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
666
|
+
var destination_0 = ArrayList_init_$Create$();
|
|
667
|
+
var _iterator__ex2g4s_0 = destination.n();
|
|
668
|
+
while (_iterator__ex2g4s_0.q()) {
|
|
669
|
+
var element = _iterator__ex2g4s_0.r();
|
|
670
|
+
if (!(element === 'none')) {
|
|
671
|
+
destination_0.l(element);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
// Inline function 'kotlin.collections.map' call
|
|
675
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
676
|
+
var destination_1 = ArrayList_init_$Create$_0(collectionSizeOrDefault(destination_0, 10));
|
|
677
|
+
var _iterator__ex2g4s_1 = destination_0.n();
|
|
678
|
+
while (_iterator__ex2g4s_1.q()) {
|
|
679
|
+
var item_0 = _iterator__ex2g4s_1.r();
|
|
680
|
+
var tmp$ret$8 = parseTermWithOperators(Companion_instance_1, item_0, this.f57_1);
|
|
681
|
+
destination_1.l(tmp$ret$8);
|
|
682
|
+
}
|
|
683
|
+
var rules = tmp.ofList(destination_1);
|
|
684
|
+
return arg2pScope(CausalityAnalysis$interventions$lambda(request, rules, cause));
|
|
685
|
+
};
|
|
686
|
+
protoOf(CausalityAnalysis).r57 = function (request, intervention, effect) {
|
|
687
|
+
var supports = baseSupports(this, request, effect);
|
|
688
|
+
if (supports.i())
|
|
689
|
+
return false;
|
|
690
|
+
var attackers = interventionAttackers(this, request, intervention, supports, effect);
|
|
691
|
+
var tmp;
|
|
692
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
693
|
+
if (!attackers.i()) {
|
|
694
|
+
var tmp_0;
|
|
695
|
+
if (intervention.d10() <= 1) {
|
|
696
|
+
tmp_0 = true;
|
|
697
|
+
} else {
|
|
698
|
+
var tmp0 = properSubsets(this, request, intervention);
|
|
699
|
+
var tmp$ret$1;
|
|
700
|
+
$l$block_0: {
|
|
701
|
+
// Inline function 'kotlin.collections.none' call
|
|
702
|
+
var tmp_1;
|
|
703
|
+
if (isInterface(tmp0, Collection)) {
|
|
704
|
+
tmp_1 = tmp0.i();
|
|
705
|
+
} else {
|
|
706
|
+
tmp_1 = false;
|
|
707
|
+
}
|
|
708
|
+
if (tmp_1) {
|
|
709
|
+
tmp$ret$1 = true;
|
|
710
|
+
break $l$block_0;
|
|
711
|
+
}
|
|
712
|
+
var _iterator__ex2g4s = tmp0.n();
|
|
713
|
+
while (_iterator__ex2g4s.q()) {
|
|
714
|
+
var element = _iterator__ex2g4s.r();
|
|
715
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
716
|
+
if (!interventionAttackers(this, request, element, supports, effect).i()) {
|
|
717
|
+
tmp$ret$1 = false;
|
|
718
|
+
break $l$block_0;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
tmp$ret$1 = true;
|
|
722
|
+
}
|
|
723
|
+
tmp_0 = tmp$ret$1;
|
|
724
|
+
}
|
|
725
|
+
tmp = tmp_0;
|
|
726
|
+
} else {
|
|
727
|
+
tmp = false;
|
|
728
|
+
}
|
|
729
|
+
return tmp;
|
|
730
|
+
};
|
|
731
|
+
protoOf(CausalityAnalysis).m57 = function (request, intervention, effect) {
|
|
732
|
+
var supports = baseSupports(this, request, effect);
|
|
733
|
+
if (supports.i())
|
|
734
|
+
return false;
|
|
735
|
+
// Inline function 'kotlin.collections.map' call
|
|
736
|
+
var this_0 = interventionAttackers(this, request, intervention, supports, effect);
|
|
737
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
738
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
739
|
+
var _iterator__ex2g4s = this_0.n();
|
|
740
|
+
while (_iterator__ex2g4s.q()) {
|
|
741
|
+
var item = _iterator__ex2g4s.r();
|
|
742
|
+
var tmp$ret$2 = item.h4j();
|
|
743
|
+
destination.l(tmp$ret$2);
|
|
744
|
+
}
|
|
745
|
+
var attackers = destination;
|
|
746
|
+
var tmp;
|
|
747
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
748
|
+
if (!attackers.i()) {
|
|
749
|
+
var tmp_0;
|
|
750
|
+
if (intervention.d10() <= 1) {
|
|
751
|
+
tmp_0 = true;
|
|
752
|
+
} else {
|
|
753
|
+
var tmp0 = properSubsets(this, request, intervention);
|
|
754
|
+
var tmp$ret$4;
|
|
755
|
+
$l$block_4: {
|
|
756
|
+
// Inline function 'kotlin.collections.none' call
|
|
757
|
+
var tmp_1;
|
|
758
|
+
if (isInterface(tmp0, Collection)) {
|
|
759
|
+
tmp_1 = tmp0.i();
|
|
760
|
+
} else {
|
|
761
|
+
tmp_1 = false;
|
|
762
|
+
}
|
|
763
|
+
if (tmp_1) {
|
|
764
|
+
tmp$ret$4 = true;
|
|
765
|
+
break $l$block_4;
|
|
766
|
+
}
|
|
767
|
+
var _iterator__ex2g4s_0 = tmp0.n();
|
|
768
|
+
while (_iterator__ex2g4s_0.q()) {
|
|
769
|
+
var element = _iterator__ex2g4s_0.r();
|
|
770
|
+
// Inline function 'kotlin.collections.map' call
|
|
771
|
+
var this_1 = interventionAttackers(this, request, element, supports, effect);
|
|
772
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
773
|
+
var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_1, 10));
|
|
774
|
+
var _iterator__ex2g4s_1 = this_1.n();
|
|
775
|
+
while (_iterator__ex2g4s_1.q()) {
|
|
776
|
+
var item_0 = _iterator__ex2g4s_1.r();
|
|
777
|
+
var tmp$ret$8 = item_0.h4j();
|
|
778
|
+
destination_0.l(tmp$ret$8);
|
|
779
|
+
}
|
|
780
|
+
var others = destination_0;
|
|
781
|
+
var tmp$ret$9;
|
|
782
|
+
$l$block_3: {
|
|
783
|
+
// Inline function 'kotlin.collections.all' call
|
|
784
|
+
var tmp_2;
|
|
785
|
+
if (isInterface(attackers, Collection)) {
|
|
786
|
+
tmp_2 = attackers.i();
|
|
787
|
+
} else {
|
|
788
|
+
tmp_2 = false;
|
|
789
|
+
}
|
|
790
|
+
if (tmp_2) {
|
|
791
|
+
tmp$ret$9 = true;
|
|
792
|
+
break $l$block_3;
|
|
793
|
+
}
|
|
794
|
+
var _iterator__ex2g4s_2 = attackers.n();
|
|
795
|
+
while (_iterator__ex2g4s_2.q()) {
|
|
796
|
+
var element_0 = _iterator__ex2g4s_2.r();
|
|
797
|
+
var tmp$ret$11;
|
|
798
|
+
$l$block_2: {
|
|
799
|
+
// Inline function 'kotlin.collections.any' call
|
|
800
|
+
var tmp_3;
|
|
801
|
+
if (isInterface(others, Collection)) {
|
|
802
|
+
tmp_3 = others.i();
|
|
803
|
+
} else {
|
|
804
|
+
tmp_3 = false;
|
|
805
|
+
}
|
|
806
|
+
if (tmp_3) {
|
|
807
|
+
tmp$ret$11 = false;
|
|
808
|
+
break $l$block_2;
|
|
809
|
+
}
|
|
810
|
+
var _iterator__ex2g4s_3 = others.n();
|
|
811
|
+
while (_iterator__ex2g4s_3.q()) {
|
|
812
|
+
var element_1 = _iterator__ex2g4s_3.r();
|
|
813
|
+
if (Companion_getInstance_1().b1o().match(element_0, element_1)) {
|
|
814
|
+
tmp$ret$11 = true;
|
|
815
|
+
break $l$block_2;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
tmp$ret$11 = false;
|
|
819
|
+
}
|
|
820
|
+
if (!tmp$ret$11) {
|
|
821
|
+
tmp$ret$9 = false;
|
|
822
|
+
break $l$block_3;
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
tmp$ret$9 = true;
|
|
826
|
+
}
|
|
827
|
+
if (tmp$ret$9) {
|
|
828
|
+
tmp$ret$4 = false;
|
|
829
|
+
break $l$block_4;
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
tmp$ret$4 = true;
|
|
833
|
+
}
|
|
834
|
+
tmp_0 = tmp$ret$4;
|
|
835
|
+
}
|
|
836
|
+
tmp = tmp_0;
|
|
837
|
+
} else {
|
|
838
|
+
tmp = false;
|
|
839
|
+
}
|
|
840
|
+
return tmp;
|
|
841
|
+
};
|
|
842
|
+
protoOf(CausalityAnalysis).h57 = function (request, intervention, effect) {
|
|
843
|
+
var tmp;
|
|
844
|
+
if (this.i57(request, effect)) {
|
|
845
|
+
var tmp0 = graphOf(this, intervened(this, request, intervention), effect).o4h_1;
|
|
846
|
+
var tmp$ret$0;
|
|
847
|
+
$l$block_0: {
|
|
848
|
+
// Inline function 'kotlin.collections.none' call
|
|
849
|
+
var tmp_0;
|
|
850
|
+
if (isInterface(tmp0, Collection)) {
|
|
851
|
+
tmp_0 = tmp0.i();
|
|
852
|
+
} else {
|
|
853
|
+
tmp_0 = false;
|
|
854
|
+
}
|
|
855
|
+
if (tmp_0) {
|
|
856
|
+
tmp$ret$0 = true;
|
|
857
|
+
break $l$block_0;
|
|
858
|
+
}
|
|
859
|
+
var _iterator__ex2g4s = tmp0.n();
|
|
860
|
+
while (_iterator__ex2g4s.q()) {
|
|
861
|
+
var element = _iterator__ex2g4s.r();
|
|
862
|
+
if (element.a4i_1 === 'in' && concludes(this, element.z4h_1, effect)) {
|
|
863
|
+
tmp$ret$0 = false;
|
|
864
|
+
break $l$block_0;
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
tmp$ret$0 = true;
|
|
868
|
+
}
|
|
869
|
+
tmp = tmp$ret$0;
|
|
870
|
+
} else {
|
|
871
|
+
tmp = false;
|
|
872
|
+
}
|
|
873
|
+
return tmp;
|
|
874
|
+
};
|
|
875
|
+
//region block: post-declaration
|
|
876
|
+
protoOf(ButFor).w1x = get_help;
|
|
877
|
+
protoOf(Ness).w1x = get_help;
|
|
878
|
+
protoOf(NessIntervention).w1x = get_help;
|
|
879
|
+
protoOf(NessOriginal).w1x = get_help;
|
|
880
|
+
protoOf(NessOriginalIntervention).w1x = get_help;
|
|
881
|
+
//endregion
|
|
882
|
+
//region block: init
|
|
883
|
+
JsCausality_instance = new JsCausality();
|
|
21
884
|
//endregion
|
|
22
885
|
//region block: exports
|
|
886
|
+
function $jsExportAll$(_) {
|
|
887
|
+
var it = _.it || (_.it = {});
|
|
888
|
+
var unibo = it.unibo || (it.unibo = {});
|
|
889
|
+
var tuprolog = unibo.tuprolog || (unibo.tuprolog = {});
|
|
890
|
+
var argumentation = tuprolog.argumentation || (tuprolog.argumentation = {});
|
|
891
|
+
var causality = argumentation.causality || (argumentation.causality = {});
|
|
892
|
+
var js = causality.js || (causality.js = {});
|
|
893
|
+
defineProp(js, 'JsCausality', JsCausality_getInstance, VOID, true);
|
|
894
|
+
}
|
|
895
|
+
$jsExportAll$(_);
|
|
23
896
|
kotlin_kotlin.$jsExportAll$(_);
|
|
24
897
|
kotlin_io_github_gciatto_kt_math.$jsExportAll$(_);
|
|
25
|
-
|
|
898
|
+
kotlin_it_unibo_tuprolog_argumentation_core.$jsExportAll$(_);
|
|
26
899
|
//endregion
|
|
27
900
|
return _;
|
|
28
901
|
}));
|