@tuprolog/2p-full 0.30.5 → 0.31.1-dev02
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-bdd.js +609 -0
- package/2p-bdd.js.map +1 -0
- package/2p-core.js +12057 -0
- package/2p-core.js.map +1 -0
- package/2p-datalog.js +8 -0
- package/2p-datalog.js.map +1 -0
- package/2p-dsl-core.js +8 -0
- package/2p-dsl-core.js.map +1 -0
- package/2p-dsl-solve.js +8 -0
- package/2p-dsl-solve.js.map +1 -0
- package/2p-dsl-theory.js +8 -0
- package/2p-dsl-theory.js.map +1 -0
- package/2p-dsl-unify.js +8 -0
- package/2p-dsl-unify.js.map +1 -0
- package/2p-full.d.ts +270 -0
- package/2p-full.js +21 -0
- package/2p-full.js.map +1 -0
- package/2p-io-lib.js +3600 -0
- package/2p-io-lib.js.map +1 -0
- package/2p-oop-lib.js +3660 -0
- package/2p-oop-lib.js.map +1 -0
- package/2p-parser-core.js +1450 -0
- package/2p-parser-core.js.map +1 -0
- package/2p-parser-js.js +29 -0
- package/2p-parser-js.js.map +1 -0
- package/2p-parser-theory.js +114 -0
- package/2p-parser-theory.js.map +1 -0
- package/2p-repl.js +519 -0
- package/2p-repl.js.map +1 -0
- package/2p-serialize-core.js +8 -0
- package/2p-serialize-core.js.map +1 -0
- package/2p-serialize-theory.js +8 -0
- package/2p-serialize-theory.js.map +1 -0
- package/2p-solve-classic.js +3329 -0
- package/2p-solve-classic.js.map +1 -0
- package/2p-solve-concurrent.js +8 -0
- package/2p-solve-concurrent.js.map +1 -0
- package/2p-solve-plp.js +44 -0
- package/2p-solve-plp.js.map +1 -0
- package/2p-solve-problog.js +4547 -0
- package/2p-solve-problog.js.map +1 -0
- package/2p-solve-streams.js +3028 -0
- package/2p-solve-streams.js.map +1 -0
- package/2p-solve.js +16824 -0
- package/2p-solve.js.map +1 -0
- package/2p-theory.js +4902 -0
- package/2p-theory.js.map +1 -0
- package/2p-unify.js +957 -0
- package/2p-unify.js.map +1 -0
- package/2p-utils.js +1423 -0
- package/2p-utils.js.map +1 -0
- package/88b0986a7186d029-atomicfu-js-ir.js +8 -0
- package/88b0986a7186d029-atomicfu-js-ir.js.map +1 -0
- package/clikt-clikt-js-ir.js +7240 -0
- package/clikt-clikt-js-ir.js.map +1 -0
- package/kotlin-kotlin-stdlib-js-ir.js +11847 -0
- package/kotlin-kotlin-stdlib-js-ir.js.map +1 -0
- package/kotlin-kotlinx-atomicfu-runtime-js-ir.js +8 -0
- package/kotlin-kotlinx-atomicfu-runtime-js-ir.js.map +1 -0
- package/kotlinx.coroutines-kotlinx-coroutines-core-js-ir.js +8 -0
- package/kotlinx.coroutines-kotlinx-coroutines-core-js-ir.js.map +1 -0
- package/kt-math.js +11348 -0
- package/kt-math.js.map +1 -0
- package/package.json +4 -36
- package/CONTRIBUTORS +0 -10
- package/LICENSE +0 -202
- package/kotlin/2p-full/it/unibo/tuprolog/tuprolog.kjsm +0 -0
- package/kotlin/2p-full.js +0 -15
- package/kotlin/2p-full.js.map +0 -1
- package/kotlin/2p-full.meta.js +0 -1
|
@@ -0,0 +1,4547 @@
|
|
|
1
|
+
(function (_, kotlin_kotlin, kotlin_it_unibo_tuprolog_core, kotlin_it_unibo_tuprolog_solve, kotlin_it_unibo_tuprolog_solve_plp, kotlin_it_unibo_tuprolog_solve_classic, kotlin_it_unibo_tuprolog_bdd, kotlin_it_unibo_tuprolog_theory, kotlin_it_unibo_tuprolog_utils, kotlin_it_unibo_tuprolog_unify) {
|
|
2
|
+
'use strict';
|
|
3
|
+
//region block: imports
|
|
4
|
+
var imul = Math.imul;
|
|
5
|
+
var first = kotlin_kotlin.$_$.y3;
|
|
6
|
+
var Companion_getInstance = kotlin_it_unibo_tuprolog_core.$_$.v;
|
|
7
|
+
var copy$default = kotlin_it_unibo_tuprolog_solve.$_$.u;
|
|
8
|
+
var loadStaticClauses = kotlin_it_unibo_tuprolog_solve.$_$.n4;
|
|
9
|
+
var loadStaticClausesIterable = kotlin_it_unibo_tuprolog_solve.$_$.o4;
|
|
10
|
+
var loadStaticClausesSequence = kotlin_it_unibo_tuprolog_solve.$_$.p4;
|
|
11
|
+
var loadDynamicClauses = kotlin_it_unibo_tuprolog_solve.$_$.m4;
|
|
12
|
+
var loadDynamicClausesIterable = kotlin_it_unibo_tuprolog_solve.$_$.k4;
|
|
13
|
+
var loadDynamicClausesSequence = kotlin_it_unibo_tuprolog_solve.$_$.l4;
|
|
14
|
+
var MutableSolver = kotlin_it_unibo_tuprolog_solve.$_$.q4;
|
|
15
|
+
var classMeta = kotlin_kotlin.$_$.m6;
|
|
16
|
+
var setMetadataFor = kotlin_kotlin.$_$.j7;
|
|
17
|
+
var Specifier_XFY_getInstance = kotlin_it_unibo_tuprolog_core.$_$.c;
|
|
18
|
+
var Operator = kotlin_it_unibo_tuprolog_core.$_$.n1;
|
|
19
|
+
var OperatorSet_init_$Create$ = kotlin_it_unibo_tuprolog_core.$_$.n;
|
|
20
|
+
var Companion_getInstance_0 = kotlin_it_unibo_tuprolog_core.$_$.q;
|
|
21
|
+
var Companion_getInstance_1 = kotlin_it_unibo_tuprolog_core.$_$.i1;
|
|
22
|
+
var Companion_getInstance_2 = kotlin_it_unibo_tuprolog_core.$_$.h1;
|
|
23
|
+
var Companion_getInstance_3 = kotlin_it_unibo_tuprolog_core.$_$.d1;
|
|
24
|
+
var Unit_getInstance = kotlin_kotlin.$_$.r2;
|
|
25
|
+
var map = kotlin_kotlin.$_$.c9;
|
|
26
|
+
var Companion_getInstance_4 = kotlin_it_unibo_tuprolog_solve.$_$.m2;
|
|
27
|
+
var Halt = kotlin_it_unibo_tuprolog_solve.$_$.r4;
|
|
28
|
+
var isInterface = kotlin_kotlin.$_$.y6;
|
|
29
|
+
var Yes = kotlin_it_unibo_tuprolog_solve.$_$.t4;
|
|
30
|
+
var DoubleCompanionObject_getInstance = kotlin_kotlin.$_$.j2;
|
|
31
|
+
var setProbability = kotlin_it_unibo_tuprolog_solve_plp.$_$.d;
|
|
32
|
+
var Numeric = kotlin_it_unibo_tuprolog_core.$_$.w1;
|
|
33
|
+
var setBinaryDecisionDiagram = kotlin_it_unibo_tuprolog_solve_plp.$_$.b;
|
|
34
|
+
var get_isProbabilistic = kotlin_it_unibo_tuprolog_solve_plp.$_$.a;
|
|
35
|
+
var Companion_getInstance_5 = kotlin_it_unibo_tuprolog_solve.$_$.o2;
|
|
36
|
+
var toList = kotlin_kotlin.$_$.p9;
|
|
37
|
+
var first_0 = kotlin_kotlin.$_$.t8;
|
|
38
|
+
var Solver = kotlin_it_unibo_tuprolog_solve.$_$.q5;
|
|
39
|
+
var TrackVariables_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.c2;
|
|
40
|
+
var invoke = kotlin_it_unibo_tuprolog_solve.$_$.w2;
|
|
41
|
+
var THROW_CCE = kotlin_kotlin.$_$.sb;
|
|
42
|
+
var Map = kotlin_kotlin.$_$.w2;
|
|
43
|
+
var get_defaultFlags = kotlin_it_unibo_tuprolog_solve.$_$.f5;
|
|
44
|
+
var ClassicSolverFactory_getInstance = kotlin_it_unibo_tuprolog_solve_classic.$_$.c;
|
|
45
|
+
var solverOf$default = kotlin_it_unibo_tuprolog_solve.$_$.z;
|
|
46
|
+
var solverOf$default_0 = kotlin_it_unibo_tuprolog_solve.$_$.y;
|
|
47
|
+
var mutableSolverOf$default = kotlin_it_unibo_tuprolog_solve.$_$.v;
|
|
48
|
+
var mutableSolverOf$default_0 = kotlin_it_unibo_tuprolog_solve.$_$.w;
|
|
49
|
+
var newBuilder = kotlin_it_unibo_tuprolog_solve.$_$.n5;
|
|
50
|
+
var get_defaultRuntime = kotlin_it_unibo_tuprolog_solve.$_$.i5;
|
|
51
|
+
var get_defaultUnificator = kotlin_it_unibo_tuprolog_solve.$_$.k5;
|
|
52
|
+
var get_defaultStaticKb = kotlin_it_unibo_tuprolog_solve.$_$.j5;
|
|
53
|
+
var get_defaultDynamicKb = kotlin_it_unibo_tuprolog_solve.$_$.d5;
|
|
54
|
+
var get_defaultInputChannel = kotlin_it_unibo_tuprolog_solve.$_$.g5;
|
|
55
|
+
var get_defaultOutputChannel = kotlin_it_unibo_tuprolog_solve.$_$.h5;
|
|
56
|
+
var get_defaultErrorChannel = kotlin_it_unibo_tuprolog_solve.$_$.e5;
|
|
57
|
+
var get_defaultWarningsChannel = kotlin_it_unibo_tuprolog_solve.$_$.l5;
|
|
58
|
+
var solverWithDefaultBuiltins = kotlin_it_unibo_tuprolog_solve.$_$.o5;
|
|
59
|
+
var solverWithDefaultBuiltins$default = kotlin_it_unibo_tuprolog_solve.$_$.a1;
|
|
60
|
+
var mutableSolverWithDefaultBuiltins = kotlin_it_unibo_tuprolog_solve.$_$.m5;
|
|
61
|
+
var mutableSolverWithDefaultBuiltins$default = kotlin_it_unibo_tuprolog_solve.$_$.x;
|
|
62
|
+
var SolverFactory = kotlin_it_unibo_tuprolog_solve.$_$.p5;
|
|
63
|
+
var objectMeta = kotlin_kotlin.$_$.i7;
|
|
64
|
+
var ExtensionLibrary = kotlin_it_unibo_tuprolog_solve.$_$.z2;
|
|
65
|
+
var DefaultBuiltins_getInstance = kotlin_it_unibo_tuprolog_solve_classic.$_$.b;
|
|
66
|
+
var containsSignature = kotlin_it_unibo_tuprolog_solve.$_$.b3;
|
|
67
|
+
var containsOperator = kotlin_it_unibo_tuprolog_solve.$_$.a3;
|
|
68
|
+
var hasPrimitive = kotlin_it_unibo_tuprolog_solve.$_$.d3;
|
|
69
|
+
var hasFunction = kotlin_it_unibo_tuprolog_solve.$_$.c3;
|
|
70
|
+
var get_ruleSignatures = kotlin_it_unibo_tuprolog_solve.$_$.f3;
|
|
71
|
+
var hasProtected = kotlin_it_unibo_tuprolog_solve.$_$.e3;
|
|
72
|
+
var EnsureExecutable_getInstance = kotlin_it_unibo_tuprolog_solve.$_$.i2;
|
|
73
|
+
var listOf = kotlin_kotlin.$_$.h4;
|
|
74
|
+
var Call_getInstance = kotlin_it_unibo_tuprolog_solve_classic.$_$.a;
|
|
75
|
+
var Companion_getInstance_6 = kotlin_it_unibo_tuprolog_solve.$_$.e2;
|
|
76
|
+
var listOf_0 = kotlin_kotlin.$_$.i4;
|
|
77
|
+
var captureStack = kotlin_kotlin.$_$.h6;
|
|
78
|
+
var TuPrologException = kotlin_it_unibo_tuprolog_core.$_$.l1;
|
|
79
|
+
var TuPrologException_init_$Init$ = kotlin_it_unibo_tuprolog_core.$_$.j;
|
|
80
|
+
var emptyList = kotlin_kotlin.$_$.s3;
|
|
81
|
+
var asIterable = kotlin_kotlin.$_$.b3;
|
|
82
|
+
var asIterable_0 = kotlin_kotlin.$_$.h8;
|
|
83
|
+
var ArrayList_init_$Create$ = kotlin_kotlin.$_$.b1;
|
|
84
|
+
var Companion_getInstance_7 = kotlin_it_unibo_tuprolog_core.$_$.c1;
|
|
85
|
+
var bddTerminalOf = kotlin_it_unibo_tuprolog_bdd.$_$.d;
|
|
86
|
+
var bddOf = kotlin_it_unibo_tuprolog_bdd.$_$.c;
|
|
87
|
+
var interfaceMeta = kotlin_kotlin.$_$.u6;
|
|
88
|
+
var Companion_getInstance_8 = kotlin_it_unibo_tuprolog_core.$_$.s;
|
|
89
|
+
var Term = kotlin_it_unibo_tuprolog_core.$_$.y2;
|
|
90
|
+
var Companion_getInstance_9 = kotlin_it_unibo_tuprolog_core.$_$.e1;
|
|
91
|
+
var Atom = kotlin_it_unibo_tuprolog_core.$_$.o1;
|
|
92
|
+
var Collection = kotlin_kotlin.$_$.t2;
|
|
93
|
+
var getNumberHashCode = kotlin_kotlin.$_$.q6;
|
|
94
|
+
var hashCode = kotlin_kotlin.$_$.t6;
|
|
95
|
+
var Companion_getInstance_10 = kotlin_it_unibo_tuprolog_core.$_$.z;
|
|
96
|
+
var lazy = kotlin_kotlin.$_$.xb;
|
|
97
|
+
var collectionSizeOrDefault = kotlin_kotlin.$_$.j3;
|
|
98
|
+
var toSet = kotlin_kotlin.$_$.w5;
|
|
99
|
+
var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.c1;
|
|
100
|
+
var compareTo = kotlin_it_unibo_tuprolog_core.$_$.b2;
|
|
101
|
+
var equals = kotlin_kotlin.$_$.o6;
|
|
102
|
+
var compareTo_0 = kotlin_kotlin.$_$.n6;
|
|
103
|
+
var round = kotlin_kotlin.$_$.s7;
|
|
104
|
+
var KProperty1 = kotlin_kotlin.$_$.d8;
|
|
105
|
+
var getPropertyCallableRef = kotlin_kotlin.$_$.r6;
|
|
106
|
+
var MutableTheory = kotlin_it_unibo_tuprolog_theory.$_$.c;
|
|
107
|
+
var Theory = kotlin_it_unibo_tuprolog_theory.$_$.f;
|
|
108
|
+
var Struct = kotlin_it_unibo_tuprolog_core.$_$.z1;
|
|
109
|
+
var Companion_getInstance_11 = kotlin_it_unibo_tuprolog_solve.$_$.k2;
|
|
110
|
+
var TuPrologException_init_$Create$ = kotlin_it_unibo_tuprolog_core.$_$.l;
|
|
111
|
+
var Rule = kotlin_it_unibo_tuprolog_core.$_$.y1;
|
|
112
|
+
var Companion_getInstance_12 = kotlin_it_unibo_tuprolog_core.$_$.b1;
|
|
113
|
+
var toList_0 = kotlin_kotlin.$_$.n5;
|
|
114
|
+
var UnsupportedOperationException_init_$Create$ = kotlin_kotlin.$_$.c2;
|
|
115
|
+
var notThenExpansion = kotlin_it_unibo_tuprolog_bdd.$_$.g;
|
|
116
|
+
var expansion = kotlin_it_unibo_tuprolog_bdd.$_$.e;
|
|
117
|
+
var anyWhere = kotlin_it_unibo_tuprolog_bdd.$_$.b;
|
|
118
|
+
var andThenExpansion = kotlin_it_unibo_tuprolog_bdd.$_$.a;
|
|
119
|
+
var orThenExpansion = kotlin_it_unibo_tuprolog_bdd.$_$.h;
|
|
120
|
+
var map_0 = kotlin_it_unibo_tuprolog_bdd.$_$.f;
|
|
121
|
+
var Long = kotlin_kotlin.$_$.mb;
|
|
122
|
+
var NoSuchElementException_init_$Create$ = kotlin_kotlin.$_$.w1;
|
|
123
|
+
var Companion_getInstance_13 = kotlin_it_unibo_tuprolog_core.$_$.w;
|
|
124
|
+
var plus = kotlin_kotlin.$_$.b5;
|
|
125
|
+
var setTag = kotlin_it_unibo_tuprolog_utils.$_$.j1;
|
|
126
|
+
var Regex_init_$Create$ = kotlin_kotlin.$_$.h1;
|
|
127
|
+
var toDoubleOrNull = kotlin_kotlin.$_$.sa;
|
|
128
|
+
var toSet_0 = kotlin_kotlin.$_$.r9;
|
|
129
|
+
var plus_0 = kotlin_kotlin.$_$.y4;
|
|
130
|
+
var checkIndexOverflow = kotlin_kotlin.$_$.i3;
|
|
131
|
+
var Pair = kotlin_kotlin.$_$.qb;
|
|
132
|
+
var Fact = kotlin_it_unibo_tuprolog_core.$_$.s1;
|
|
133
|
+
var emptySet = kotlin_kotlin.$_$.u3;
|
|
134
|
+
var subtract = kotlin_kotlin.$_$.j5;
|
|
135
|
+
var setOf = kotlin_kotlin.$_$.e5;
|
|
136
|
+
var Directive = kotlin_it_unibo_tuprolog_core.$_$.r1;
|
|
137
|
+
var Indicator = kotlin_it_unibo_tuprolog_core.$_$.t1;
|
|
138
|
+
var Companion_getInstance_14 = kotlin_it_unibo_tuprolog_core.$_$.u;
|
|
139
|
+
var Truth = kotlin_it_unibo_tuprolog_core.$_$.z2;
|
|
140
|
+
var Companion_getInstance_15 = kotlin_it_unibo_tuprolog_core.$_$.g1;
|
|
141
|
+
var Companion_getInstance_16 = kotlin_it_unibo_tuprolog_unify.$_$.a;
|
|
142
|
+
var Companion_getInstance_17 = kotlin_it_unibo_tuprolog_theory.$_$.a;
|
|
143
|
+
var addAll = kotlin_kotlin.$_$.y2;
|
|
144
|
+
var Companion_getInstance_18 = kotlin_it_unibo_tuprolog_theory.$_$.b;
|
|
145
|
+
var Failure = kotlin_it_unibo_tuprolog_theory.$_$.d;
|
|
146
|
+
var Success = kotlin_it_unibo_tuprolog_theory.$_$.e;
|
|
147
|
+
var NonBacktrackable = kotlin_it_unibo_tuprolog_solve.$_$.p3;
|
|
148
|
+
var Companion_getInstance_19 = kotlin_it_unibo_tuprolog_solve.$_$.g2;
|
|
149
|
+
var Var = kotlin_it_unibo_tuprolog_core.$_$.b3;
|
|
150
|
+
var ResolutionException_init_$Create$ = kotlin_it_unibo_tuprolog_solve.$_$.c1;
|
|
151
|
+
var CoroutineImpl = kotlin_kotlin.$_$.c6;
|
|
152
|
+
var SequenceScope = kotlin_kotlin.$_$.e8;
|
|
153
|
+
var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.b6;
|
|
154
|
+
var extractSignature = kotlin_it_unibo_tuprolog_solve.$_$.s5;
|
|
155
|
+
var ensureNotNull = kotlin_kotlin.$_$.vb;
|
|
156
|
+
var Clause = kotlin_it_unibo_tuprolog_core.$_$.p1;
|
|
157
|
+
var copyToArray = kotlin_kotlin.$_$.p3;
|
|
158
|
+
var WithoutSideEffects = kotlin_it_unibo_tuprolog_solve.$_$.r3;
|
|
159
|
+
var sequence = kotlin_kotlin.$_$.j9;
|
|
160
|
+
var NonBacktrackable_0 = kotlin_it_unibo_tuprolog_solve.$_$.h3;
|
|
161
|
+
var setProbabilistic = kotlin_it_unibo_tuprolog_solve_plp.$_$.c;
|
|
162
|
+
var firstOrNull = kotlin_kotlin.$_$.s8;
|
|
163
|
+
var WithoutSideEffects_0 = kotlin_it_unibo_tuprolog_solve.$_$.n3;
|
|
164
|
+
var NonBacktrackable_1 = kotlin_it_unibo_tuprolog_solve.$_$.u3;
|
|
165
|
+
var SetFlags_init_$Create$ = kotlin_it_unibo_tuprolog_solve.$_$.j1;
|
|
166
|
+
var WithoutSideEffects_1 = kotlin_it_unibo_tuprolog_solve.$_$.i3;
|
|
167
|
+
var asSequence = kotlin_kotlin.$_$.g3;
|
|
168
|
+
var filter = kotlin_kotlin.$_$.r8;
|
|
169
|
+
var Sequence = kotlin_kotlin.$_$.f8;
|
|
170
|
+
var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.f1;
|
|
171
|
+
var sequenceOf = kotlin_kotlin.$_$.i9;
|
|
172
|
+
var RuleWrapper = kotlin_it_unibo_tuprolog_solve.$_$.x3;
|
|
173
|
+
var RuleWrapper_init_$Init$ = kotlin_it_unibo_tuprolog_solve.$_$.g1;
|
|
174
|
+
//endregion
|
|
175
|
+
//region block: pre-declaration
|
|
176
|
+
setMetadataFor(ProblogSolver, 'ProblogSolver', classMeta, undefined, [Solver], undefined, undefined, []);
|
|
177
|
+
setMetadataFor(MutableProblogSolver, 'MutableProblogSolver', classMeta, ProblogSolver, [ProblogSolver, MutableSolver], undefined, undefined, []);
|
|
178
|
+
setMetadataFor(ProblogSolverFactory, 'ProblogSolverFactory', objectMeta, undefined, [SolverFactory], undefined, undefined, []);
|
|
179
|
+
setMetadataFor(DefaultBuiltins, 'DefaultBuiltins', objectMeta, ExtensionLibrary, undefined, undefined, undefined, []);
|
|
180
|
+
setMetadataFor(MinimalBuiltins, 'MinimalBuiltins', objectMeta, ExtensionLibrary, undefined, undefined, undefined, []);
|
|
181
|
+
setMetadataFor(ProblogLib, 'ProblogLib', objectMeta, ExtensionLibrary, undefined, undefined, undefined, []);
|
|
182
|
+
setMetadataFor(ClauseMappingException, 'ClauseMappingException', classMeta, TuPrologException, undefined, undefined, undefined, []);
|
|
183
|
+
setMetadataFor(Companion, 'Companion', objectMeta, undefined, undefined, undefined, undefined, []);
|
|
184
|
+
setMetadataFor(Companion_0, 'Companion', objectMeta, undefined, undefined, undefined, undefined, []);
|
|
185
|
+
function get_probabilityOrNull() {
|
|
186
|
+
var tmp;
|
|
187
|
+
try {
|
|
188
|
+
tmp = this.x3d();
|
|
189
|
+
} catch ($p) {
|
|
190
|
+
var tmp_0;
|
|
191
|
+
if ($p instanceof Error) {
|
|
192
|
+
tmp_0 = null;
|
|
193
|
+
} else {
|
|
194
|
+
throw $p;
|
|
195
|
+
}
|
|
196
|
+
tmp = tmp_0;
|
|
197
|
+
}
|
|
198
|
+
return tmp;
|
|
199
|
+
}
|
|
200
|
+
setMetadataFor(ProbExplanation, 'ProbExplanation', interfaceMeta, undefined, undefined, undefined, undefined, []);
|
|
201
|
+
setMetadataFor(ProbExplanationTerm, 'ProbExplanationTerm', classMeta, undefined, [Atom], undefined, undefined, []);
|
|
202
|
+
setMetadataFor(ProbTerm, 'ProbTerm', classMeta, undefined, [Term], undefined, undefined, []);
|
|
203
|
+
setMetadataFor(Companion_1, 'Companion', objectMeta, undefined, undefined, undefined, undefined, []);
|
|
204
|
+
setMetadataFor(ProblogTheory, 'ProblogTheory', interfaceMeta, undefined, [Theory], undefined, undefined, []);
|
|
205
|
+
setMetadataFor(AnnotatedDisjunctionClauseMapper, 'AnnotatedDisjunctionClauseMapper', objectMeta, undefined, undefined, undefined, undefined, []);
|
|
206
|
+
setMetadataFor(ComputedValue, 'ComputedValue', classMeta, undefined, undefined, undefined, undefined, []);
|
|
207
|
+
setMetadataFor(Companion_2, 'Companion', objectMeta, undefined, undefined, undefined, undefined, []);
|
|
208
|
+
setMetadataFor(BinaryDecisionDiagramExplanation, 'BinaryDecisionDiagramExplanation', classMeta, undefined, [ProbExplanation], undefined, undefined, []);
|
|
209
|
+
setMetadataFor(ClauseMappingUtils, 'ClauseMappingUtils', objectMeta, undefined, undefined, undefined, undefined, []);
|
|
210
|
+
setMetadataFor(DirectiveClauseMapper, 'DirectiveClauseMapper', objectMeta, undefined, undefined, undefined, undefined, []);
|
|
211
|
+
setMetadataFor(EvidenceClauseMapper, 'EvidenceClauseMapper', objectMeta, undefined, undefined, undefined, undefined, []);
|
|
212
|
+
setMetadataFor(MappedMutableProblogTheory, 'MappedMutableProblogTheory', classMeta, undefined, [MutableTheory, ProblogTheory], undefined, undefined, []);
|
|
213
|
+
setMetadataFor(MappedProblogTheory, 'MappedProblogTheory', classMeta, undefined, [Theory, ProblogTheory], undefined, undefined, []);
|
|
214
|
+
setMetadataFor(NothingClauseMapper, 'NothingClauseMapper', objectMeta, undefined, undefined, undefined, undefined, []);
|
|
215
|
+
setMetadataFor(ProbabilisticClauseMapper, 'ProbabilisticClauseMapper', objectMeta, undefined, undefined, undefined, undefined, []);
|
|
216
|
+
setMetadataFor(PrologClauseMapper, 'PrologClauseMapper', objectMeta, undefined, undefined, undefined, undefined, []);
|
|
217
|
+
setMetadataFor(ProbExplAnd, 'ProbExplAnd', objectMeta, NonBacktrackable, undefined, undefined, undefined, []);
|
|
218
|
+
setMetadataFor(ProbHelper$computeAllSubstitutions$slambda, 'ProbHelper$computeAllSubstitutions$slambda', classMeta, CoroutineImpl, undefined, undefined, undefined, [1]);
|
|
219
|
+
setMetadataFor(ProbHelper, 'ProbHelper', objectMeta, WithoutSideEffects, undefined, undefined, undefined, []);
|
|
220
|
+
setMetadataFor(ProbNegationAsFailure, 'ProbNegationAsFailure', objectMeta, NonBacktrackable_0, undefined, undefined, undefined, []);
|
|
221
|
+
setMetadataFor(ProbQuery$computeAllSubstitutions$slambda, 'ProbQuery$computeAllSubstitutions$slambda', classMeta, CoroutineImpl, undefined, undefined, undefined, [1]);
|
|
222
|
+
setMetadataFor(ProbQuery, 'ProbQuery', objectMeta, WithoutSideEffects_0, undefined, undefined, undefined, []);
|
|
223
|
+
setMetadataFor(ProbSetConfig, 'ProbSetConfig', objectMeta, NonBacktrackable_1, undefined, undefined, undefined, []);
|
|
224
|
+
setMetadataFor(ProbSolve$computeAllSubstitutions$slambda, 'ProbSolve$computeAllSubstitutions$slambda', classMeta, CoroutineImpl, undefined, undefined, undefined, [1]);
|
|
225
|
+
setMetadataFor(ProbSolve, 'ProbSolve', objectMeta, WithoutSideEffects_1, undefined, undefined, undefined, []);
|
|
226
|
+
setMetadataFor(ProbSolveEvidence, 'ProbSolveEvidence', objectMeta, NonBacktrackable_1, undefined, undefined, undefined, []);
|
|
227
|
+
setMetadataFor(ProbSolveWithEvidence$computeAllSubstitutions$slambda, 'ProbSolveWithEvidence$computeAllSubstitutions$slambda', classMeta, CoroutineImpl, undefined, undefined, undefined, [1]);
|
|
228
|
+
setMetadataFor(ProbSolveWithEvidence, 'ProbSolveWithEvidence', objectMeta, WithoutSideEffects, undefined, undefined, undefined, []);
|
|
229
|
+
setMetadataFor(Prob, 'Prob', objectMeta, RuleWrapper, undefined, undefined, undefined, []);
|
|
230
|
+
//endregion
|
|
231
|
+
function MutableProblogSolver(solver) {
|
|
232
|
+
ProblogSolver.call(this, solver);
|
|
233
|
+
this.s3b_1 = solver;
|
|
234
|
+
}
|
|
235
|
+
MutableProblogSolver.prototype.f37 = function (library) {
|
|
236
|
+
this.s3b_1.loadLibrary(library);
|
|
237
|
+
};
|
|
238
|
+
MutableProblogSolver.prototype.loadLibrary = function (library) {
|
|
239
|
+
return this.f37(library);
|
|
240
|
+
};
|
|
241
|
+
MutableProblogSolver.prototype.g37 = function (library) {
|
|
242
|
+
this.s3b_1.unloadLibrary(library);
|
|
243
|
+
};
|
|
244
|
+
MutableProblogSolver.prototype.unloadLibrary = function (library) {
|
|
245
|
+
return this.g37(library);
|
|
246
|
+
};
|
|
247
|
+
MutableProblogSolver.prototype.h37 = function (libraries) {
|
|
248
|
+
this.s3b_1.setLibraries(libraries);
|
|
249
|
+
};
|
|
250
|
+
MutableProblogSolver.prototype.setLibraries = function (libraries) {
|
|
251
|
+
return this.h37(libraries);
|
|
252
|
+
};
|
|
253
|
+
MutableProblogSolver.prototype.i37 = function (theory) {
|
|
254
|
+
this.s3b_1.loadStaticKb(Companion_getInstance_22().ofIterable(this.s3b_1.k1l(), theory));
|
|
255
|
+
};
|
|
256
|
+
MutableProblogSolver.prototype.loadStaticKb = function (theory) {
|
|
257
|
+
return this.i37(theory);
|
|
258
|
+
};
|
|
259
|
+
MutableProblogSolver.prototype.j37 = function (theory) {
|
|
260
|
+
this.s3b_1.appendStaticKb(Companion_getInstance_22().ofIterable(this.s3b_1.k1l(), theory));
|
|
261
|
+
};
|
|
262
|
+
MutableProblogSolver.prototype.appendStaticKb = function (theory) {
|
|
263
|
+
return this.j37(theory);
|
|
264
|
+
};
|
|
265
|
+
MutableProblogSolver.prototype.k37 = function () {
|
|
266
|
+
this.s3b_1.resetStaticKb();
|
|
267
|
+
};
|
|
268
|
+
MutableProblogSolver.prototype.resetStaticKb = function () {
|
|
269
|
+
return this.k37();
|
|
270
|
+
};
|
|
271
|
+
MutableProblogSolver.prototype.l37 = function (theory) {
|
|
272
|
+
this.s3b_1.loadDynamicKb(Companion_getInstance_22().ofIterable(this.s3b_1.k1l(), theory));
|
|
273
|
+
};
|
|
274
|
+
MutableProblogSolver.prototype.loadDynamicKb = function (theory) {
|
|
275
|
+
return this.l37(theory);
|
|
276
|
+
};
|
|
277
|
+
MutableProblogSolver.prototype.m37 = function (theory) {
|
|
278
|
+
this.s3b_1.appendDynamicKb(Companion_getInstance_22().ofIterable(this.s3b_1.k1l(), theory));
|
|
279
|
+
};
|
|
280
|
+
MutableProblogSolver.prototype.appendDynamicKb = function (theory) {
|
|
281
|
+
return this.m37(theory);
|
|
282
|
+
};
|
|
283
|
+
MutableProblogSolver.prototype.n37 = function () {
|
|
284
|
+
this.s3b_1.resetDynamicKb();
|
|
285
|
+
};
|
|
286
|
+
MutableProblogSolver.prototype.resetDynamicKb = function () {
|
|
287
|
+
return this.n37();
|
|
288
|
+
};
|
|
289
|
+
MutableProblogSolver.prototype.w1m = function (clause) {
|
|
290
|
+
this.s3b_1.assertA(first(Companion_getInstance_22().of(this.s3b_1.k1l(), [clause]).t1l()));
|
|
291
|
+
};
|
|
292
|
+
MutableProblogSolver.prototype.assertA = function (clause) {
|
|
293
|
+
return this.w1m(clause);
|
|
294
|
+
};
|
|
295
|
+
MutableProblogSolver.prototype.o37 = function (fact) {
|
|
296
|
+
this.s3b_1.assertA(first(Companion_getInstance_22().of(this.s3b_1.k1l(), [Companion_getInstance().of(fact)]).t1l()));
|
|
297
|
+
};
|
|
298
|
+
MutableProblogSolver.prototype.assertAFact = function (fact) {
|
|
299
|
+
return this.o37(fact);
|
|
300
|
+
};
|
|
301
|
+
MutableProblogSolver.prototype.w1l = function (clause) {
|
|
302
|
+
this.s3b_1.assertZ(first(Companion_getInstance_22().of(this.s3b_1.k1l(), [clause]).t1l()));
|
|
303
|
+
};
|
|
304
|
+
MutableProblogSolver.prototype.assertZ = function (clause) {
|
|
305
|
+
return this.w1l(clause);
|
|
306
|
+
};
|
|
307
|
+
MutableProblogSolver.prototype.p37 = function (fact) {
|
|
308
|
+
this.s3b_1.assertA(first(Companion_getInstance_22().of(this.s3b_1.k1l(), [Companion_getInstance().of(fact)]).t1l()));
|
|
309
|
+
};
|
|
310
|
+
MutableProblogSolver.prototype.assertZFact = function (fact) {
|
|
311
|
+
return this.p37(fact);
|
|
312
|
+
};
|
|
313
|
+
MutableProblogSolver.prototype.e1t = function (clause) {
|
|
314
|
+
return this.s3b_1.retract(first(Companion_getInstance_22().of(this.s3b_1.k1l(), [clause]).t1l()));
|
|
315
|
+
};
|
|
316
|
+
MutableProblogSolver.prototype.retract = function (clause) {
|
|
317
|
+
return this.e1t(clause);
|
|
318
|
+
};
|
|
319
|
+
MutableProblogSolver.prototype.f1t = function (fact) {
|
|
320
|
+
return this.s3b_1.retract(first(Companion_getInstance_22().of(this.s3b_1.k1l(), [Companion_getInstance().of(fact)]).t1l()));
|
|
321
|
+
};
|
|
322
|
+
MutableProblogSolver.prototype.retractByHead = function (fact) {
|
|
323
|
+
return this.f1t(fact);
|
|
324
|
+
};
|
|
325
|
+
MutableProblogSolver.prototype.c1m = function (clause) {
|
|
326
|
+
return this.s3b_1.retractAll(first(Companion_getInstance_22().of(this.s3b_1.k1l(), [clause]).t1l()));
|
|
327
|
+
};
|
|
328
|
+
MutableProblogSolver.prototype.retractAll = function (clause) {
|
|
329
|
+
return this.c1m(clause);
|
|
330
|
+
};
|
|
331
|
+
MutableProblogSolver.prototype.q37 = function (fact) {
|
|
332
|
+
return this.s3b_1.retractAll(first(Companion_getInstance_22().of(this.s3b_1.k1l(), [Companion_getInstance().of(fact)]).t1l()));
|
|
333
|
+
};
|
|
334
|
+
MutableProblogSolver.prototype.retractAllBeHead = function (fact) {
|
|
335
|
+
return this.q37(fact);
|
|
336
|
+
};
|
|
337
|
+
MutableProblogSolver.prototype.r37 = function (name, value) {
|
|
338
|
+
this.s3b_1.setFlag(name, value);
|
|
339
|
+
};
|
|
340
|
+
MutableProblogSolver.prototype.setFlag = function (name, value) {
|
|
341
|
+
return this.r37(name, value);
|
|
342
|
+
};
|
|
343
|
+
MutableProblogSolver.prototype.s37 = function (flag) {
|
|
344
|
+
this.s3b_1.setFlagPair(flag);
|
|
345
|
+
};
|
|
346
|
+
MutableProblogSolver.prototype.setFlagPair = function (flag) {
|
|
347
|
+
return this.s37(flag);
|
|
348
|
+
};
|
|
349
|
+
MutableProblogSolver.prototype.t37 = function (flag) {
|
|
350
|
+
this.s3b_1.setFlagNotable(flag);
|
|
351
|
+
};
|
|
352
|
+
MutableProblogSolver.prototype.setFlagNotable = function (flag) {
|
|
353
|
+
return this.t37(flag);
|
|
354
|
+
};
|
|
355
|
+
MutableProblogSolver.prototype.u37 = function (stdIn) {
|
|
356
|
+
this.s3b_1.setStandardInput(stdIn);
|
|
357
|
+
};
|
|
358
|
+
MutableProblogSolver.prototype.setStandardInput = function (stdIn) {
|
|
359
|
+
return this.u37(stdIn);
|
|
360
|
+
};
|
|
361
|
+
MutableProblogSolver.prototype.v37 = function (stdErr) {
|
|
362
|
+
this.s3b_1.setStandardError(stdErr);
|
|
363
|
+
};
|
|
364
|
+
MutableProblogSolver.prototype.setStandardError = function (stdErr) {
|
|
365
|
+
return this.v37(stdErr);
|
|
366
|
+
};
|
|
367
|
+
MutableProblogSolver.prototype.w37 = function (stdOut) {
|
|
368
|
+
this.s3b_1.setStandardOutput(stdOut);
|
|
369
|
+
};
|
|
370
|
+
MutableProblogSolver.prototype.setStandardOutput = function (stdOut) {
|
|
371
|
+
return this.w37(stdOut);
|
|
372
|
+
};
|
|
373
|
+
MutableProblogSolver.prototype.x37 = function (warnings) {
|
|
374
|
+
this.s3b_1.setWarnings(warnings);
|
|
375
|
+
};
|
|
376
|
+
MutableProblogSolver.prototype.setWarnings = function (warnings) {
|
|
377
|
+
return this.x37(warnings);
|
|
378
|
+
};
|
|
379
|
+
MutableProblogSolver.prototype.p1v = function (unificator, libraries, flags, staticKb, dynamicKb, stdIn, stdOut, stdErr, warnings) {
|
|
380
|
+
return new MutableProblogSolver(this.s3b_1.p1v(unificator, libraries, flags, staticKb, dynamicKb, stdIn, stdOut, stdErr, warnings));
|
|
381
|
+
};
|
|
382
|
+
MutableProblogSolver.prototype.z1s = function () {
|
|
383
|
+
return new MutableProblogSolver(this.s3b_1.z1s());
|
|
384
|
+
};
|
|
385
|
+
MutableProblogSolver.prototype.clone = function () {
|
|
386
|
+
return this.z1s();
|
|
387
|
+
};
|
|
388
|
+
function get_ANNOTATION_OPERATOR() {
|
|
389
|
+
init_properties_Operators_kt_f59079();
|
|
390
|
+
return ANNOTATION_OPERATOR;
|
|
391
|
+
}
|
|
392
|
+
var ANNOTATION_OPERATOR;
|
|
393
|
+
function get_PROBLOG_SPECIFIC_OPERATORS() {
|
|
394
|
+
init_properties_Operators_kt_f59079();
|
|
395
|
+
return PROBLOG_SPECIFIC_OPERATORS;
|
|
396
|
+
}
|
|
397
|
+
var PROBLOG_SPECIFIC_OPERATORS;
|
|
398
|
+
var PROBLOG_OPERATORS;
|
|
399
|
+
function get_ANNOTATION_FUNCTOR() {
|
|
400
|
+
return ANNOTATION_FUNCTOR;
|
|
401
|
+
}
|
|
402
|
+
var ANNOTATION_FUNCTOR;
|
|
403
|
+
var properties_initialized_Operators_kt_vybuzl;
|
|
404
|
+
function init_properties_Operators_kt_f59079() {
|
|
405
|
+
if (properties_initialized_Operators_kt_vybuzl) {
|
|
406
|
+
} else {
|
|
407
|
+
properties_initialized_Operators_kt_vybuzl = true;
|
|
408
|
+
ANNOTATION_OPERATOR = new Operator('::', Specifier_XFY_getInstance(), 900);
|
|
409
|
+
PROBLOG_SPECIFIC_OPERATORS = OperatorSet_init_$Create$([get_ANNOTATION_OPERATOR()]);
|
|
410
|
+
PROBLOG_OPERATORS = Companion_getInstance_0().DEFAULT.plusOperatorSet(get_PROBLOG_SPECIFIC_OPERATORS());
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
function solveNonProbabilistically($this, goal, options) {
|
|
414
|
+
var anonVar = Companion_getInstance_1().anonymous();
|
|
415
|
+
var tmp = Companion_getInstance_2();
|
|
416
|
+
var tmp_0 = Companion_getInstance_3();
|
|
417
|
+
var tmp$ret$0;
|
|
418
|
+
// Inline function 'it.unibo.tuprolog.solve.AbstractWrapper.functor' call
|
|
419
|
+
var tmp0__get_functor__thl4dk = ProbSetConfig_getInstance();
|
|
420
|
+
tmp$ret$0 = tmp0__get_functor__thl4dk.signature.name;
|
|
421
|
+
var tmp_1 = tmp_0.of(tmp$ret$0, [ProbSetConfig_getInstance().g3c(options)]);
|
|
422
|
+
var tmp_2 = Companion_getInstance_3();
|
|
423
|
+
var tmp$ret$1;
|
|
424
|
+
// Inline function 'it.unibo.tuprolog.solve.AbstractWrapper.functor' call
|
|
425
|
+
var tmp1__get_functor__4k11yf = Prob_getInstance();
|
|
426
|
+
tmp$ret$1 = tmp1__get_functor__4k11yf.signature.name;
|
|
427
|
+
var tmp_3 = $this.t3b_1.solveWithOptions(tmp.of(tmp_1, tmp_2.of(tmp$ret$1, [anonVar, goal])), options);
|
|
428
|
+
return map(tmp_3, ProblogSolver$solveNonProbabilistically$lambda(goal, anonVar));
|
|
429
|
+
}
|
|
430
|
+
function solveProbabilistically($this, goal, options) {
|
|
431
|
+
var probabilityVar = Companion_getInstance_1().of('Prob');
|
|
432
|
+
var bddVar = Companion_getInstance_1().of('BDD');
|
|
433
|
+
var tmp = Companion_getInstance_3();
|
|
434
|
+
var tmp$ret$0;
|
|
435
|
+
// Inline function 'it.unibo.tuprolog.solve.AbstractWrapper.functor' call
|
|
436
|
+
var tmp0__get_functor__thl4dk = ProbQuery_getInstance();
|
|
437
|
+
tmp$ret$0 = tmp0__get_functor__thl4dk.signature.name;
|
|
438
|
+
var tmp_0 = $this.t3b_1.solveWithOptions(tmp.of(tmp$ret$0, [probabilityVar, goal, ProbSetConfig_getInstance().g3c(options), bddVar]), options);
|
|
439
|
+
return map(tmp_0, ProblogSolver$solveProbabilistically$lambda(probabilityVar, bddVar, goal, options));
|
|
440
|
+
}
|
|
441
|
+
function ProblogSolver$solveNonProbabilistically$lambda$lambda($anonVar) {
|
|
442
|
+
return function (key, _anonymous_parameter_1__qggqgd) {
|
|
443
|
+
return !key.equals($anonVar);
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
function ProblogSolver$solveNonProbabilistically$lambda($goal, $anonVar) {
|
|
447
|
+
return function (it) {
|
|
448
|
+
var tmp0_subject = it;
|
|
449
|
+
var tmp;
|
|
450
|
+
if (isInterface(tmp0_subject, Yes)) {
|
|
451
|
+
var tmp_0 = Companion_getInstance_4();
|
|
452
|
+
var tmp_1 = it.r1u();
|
|
453
|
+
tmp = tmp_0.m1w($goal, tmp_1.l12(ProblogSolver$solveNonProbabilistically$lambda$lambda($anonVar)));
|
|
454
|
+
} else {
|
|
455
|
+
if (isInterface(tmp0_subject, Halt)) {
|
|
456
|
+
tmp = Companion_getInstance_4().halt($goal, it.c1w());
|
|
457
|
+
} else {
|
|
458
|
+
tmp = Companion_getInstance_4().no($goal);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
return tmp;
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
function ProblogSolver$solveProbabilistically$lambda$lambda($probabilityVar, $bddVar) {
|
|
465
|
+
return function (key, _anonymous_parameter_1__qggqgd) {
|
|
466
|
+
return !key.equals($probabilityVar) ? !key.equals($bddVar) : false;
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
function ProblogSolver$solveProbabilistically$lambda($probabilityVar, $bddVar, $goal, $options) {
|
|
470
|
+
return function (it) {
|
|
471
|
+
var probabilityTerm = it.r1u().a3($probabilityVar);
|
|
472
|
+
var bddTerm = it.r1u().a3($bddVar);
|
|
473
|
+
var tmp0_subject = it;
|
|
474
|
+
var tmp;
|
|
475
|
+
if (isInterface(tmp0_subject, Yes)) {
|
|
476
|
+
var tmp_0 = Companion_getInstance_4();
|
|
477
|
+
var tmp_1 = it.r1u();
|
|
478
|
+
tmp = tmp_0.m1w($goal, tmp_1.l12(ProblogSolver$solveProbabilistically$lambda$lambda($probabilityVar, $bddVar)));
|
|
479
|
+
} else {
|
|
480
|
+
if (isInterface(tmp0_subject, Halt)) {
|
|
481
|
+
tmp = Companion_getInstance_4().halt($goal, it.c1w());
|
|
482
|
+
} else {
|
|
483
|
+
tmp = Companion_getInstance_4().no($goal);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
var newSolution = tmp;
|
|
487
|
+
var tmp_2;
|
|
488
|
+
if (!get_isProbabilistic($options)) {
|
|
489
|
+
tmp_2 = newSolution;
|
|
490
|
+
} else {
|
|
491
|
+
var tmp1_subject = probabilityTerm;
|
|
492
|
+
var tmp_3;
|
|
493
|
+
if (!(tmp1_subject == null) ? isInterface(tmp1_subject, Numeric) : false) {
|
|
494
|
+
tmp_3 = setProbability(newSolution, probabilityTerm.x10().toDouble());
|
|
495
|
+
} else {
|
|
496
|
+
var tmp_4 = newSolution;
|
|
497
|
+
DoubleCompanionObject_getInstance();
|
|
498
|
+
tmp_3 = setProbability(tmp_4, NaN);
|
|
499
|
+
}
|
|
500
|
+
newSolution = tmp_3;
|
|
501
|
+
var tmp_5;
|
|
502
|
+
if (!(bddTerm == null)) {
|
|
503
|
+
tmp_5 = bddTerm instanceof ProbExplanationTerm;
|
|
504
|
+
} else {
|
|
505
|
+
tmp_5 = false;
|
|
506
|
+
}
|
|
507
|
+
if (tmp_5) {
|
|
508
|
+
var explanation = bddTerm.h3c_1;
|
|
509
|
+
if (explanation instanceof BinaryDecisionDiagramExplanation) {
|
|
510
|
+
newSolution = setBinaryDecisionDiagram(newSolution, explanation.j3c_1);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
tmp_2 = newSolution;
|
|
514
|
+
}
|
|
515
|
+
return tmp_2;
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
function ProblogSolver(solver) {
|
|
519
|
+
this.t3b_1 = solver;
|
|
520
|
+
}
|
|
521
|
+
ProblogSolver.prototype.z1u = function () {
|
|
522
|
+
return this.t3b_1.z1u();
|
|
523
|
+
};
|
|
524
|
+
ProblogSolver.prototype.x1u = function () {
|
|
525
|
+
return this.t3b_1.x1u();
|
|
526
|
+
};
|
|
527
|
+
ProblogSolver.prototype.a1v = function () {
|
|
528
|
+
return this.t3b_1.a1v();
|
|
529
|
+
};
|
|
530
|
+
ProblogSolver.prototype.w1u = function () {
|
|
531
|
+
return this.t3b_1.w1u();
|
|
532
|
+
};
|
|
533
|
+
ProblogSolver.prototype.h1v = function () {
|
|
534
|
+
return this.t3b_1.h1v();
|
|
535
|
+
};
|
|
536
|
+
ProblogSolver.prototype.b1v = function () {
|
|
537
|
+
return this.t3b_1.b1v();
|
|
538
|
+
};
|
|
539
|
+
ProblogSolver.prototype.m1v = function () {
|
|
540
|
+
return this.t3b_1.m1v();
|
|
541
|
+
};
|
|
542
|
+
ProblogSolver.prototype.i1v = function () {
|
|
543
|
+
return this.t3b_1.i1v();
|
|
544
|
+
};
|
|
545
|
+
ProblogSolver.prototype.k1v = function () {
|
|
546
|
+
return this.t3b_1.k1v();
|
|
547
|
+
};
|
|
548
|
+
ProblogSolver.prototype.y1u = function () {
|
|
549
|
+
return this.t3b_1.y1u();
|
|
550
|
+
};
|
|
551
|
+
ProblogSolver.prototype.k1l = function () {
|
|
552
|
+
return this.t3b_1.k1l();
|
|
553
|
+
};
|
|
554
|
+
ProblogSolver.prototype.o1v = function () {
|
|
555
|
+
return this.t3b_1.o1v();
|
|
556
|
+
};
|
|
557
|
+
ProblogSolver.prototype.u2b = function (goal, options) {
|
|
558
|
+
var tmp;
|
|
559
|
+
if (!get_isProbabilistic(options)) {
|
|
560
|
+
tmp = solveNonProbabilistically(this, goal, options);
|
|
561
|
+
} else {
|
|
562
|
+
tmp = solveProbabilistically(this, goal, options);
|
|
563
|
+
}
|
|
564
|
+
return tmp;
|
|
565
|
+
};
|
|
566
|
+
ProblogSolver.prototype.solveWithOptions = function (goal, options) {
|
|
567
|
+
return this.u2b(goal, options);
|
|
568
|
+
};
|
|
569
|
+
ProblogSolver.prototype.u3b = function (goal, timeout) {
|
|
570
|
+
return this.u2b(goal, Companion_getInstance_5().allLazilyWithTimeout(timeout));
|
|
571
|
+
};
|
|
572
|
+
ProblogSolver.prototype.solveWithTimeout = function (goal, timeout) {
|
|
573
|
+
return this.u3b(goal, timeout);
|
|
574
|
+
};
|
|
575
|
+
ProblogSolver.prototype.v3b = function (goal) {
|
|
576
|
+
return this.u2b(goal, Companion_getInstance_5().DEFAULT);
|
|
577
|
+
};
|
|
578
|
+
ProblogSolver.prototype.solve = function (goal) {
|
|
579
|
+
return this.v3b(goal);
|
|
580
|
+
};
|
|
581
|
+
ProblogSolver.prototype.w3b = function (goal, timeout) {
|
|
582
|
+
return toList(this.u3b(goal, timeout));
|
|
583
|
+
};
|
|
584
|
+
ProblogSolver.prototype.solveListWithTimeout = function (goal, timeout) {
|
|
585
|
+
return this.w3b(goal, timeout);
|
|
586
|
+
};
|
|
587
|
+
ProblogSolver.prototype.x3b = function (goal) {
|
|
588
|
+
return toList(this.v3b(goal));
|
|
589
|
+
};
|
|
590
|
+
ProblogSolver.prototype.solveList = function (goal) {
|
|
591
|
+
return this.x3b(goal);
|
|
592
|
+
};
|
|
593
|
+
ProblogSolver.prototype.y3b = function (goal, options) {
|
|
594
|
+
return toList(this.u2b(goal, options));
|
|
595
|
+
};
|
|
596
|
+
ProblogSolver.prototype.solveListWithOptions = function (goal, options) {
|
|
597
|
+
return this.y3b(goal, options);
|
|
598
|
+
};
|
|
599
|
+
ProblogSolver.prototype.z3b = function (goal, timeout) {
|
|
600
|
+
return first_0(this.u2b(goal, Companion_getInstance_5().someLazilyWithTimeout(1, timeout)));
|
|
601
|
+
};
|
|
602
|
+
ProblogSolver.prototype.solveOnceWithTimeout = function (goal, timeout) {
|
|
603
|
+
return this.z3b(goal, timeout);
|
|
604
|
+
};
|
|
605
|
+
ProblogSolver.prototype.a3c = function (goal) {
|
|
606
|
+
return first_0(this.u2b(goal, Companion_getInstance_5().someLazily(1)));
|
|
607
|
+
};
|
|
608
|
+
ProblogSolver.prototype.solveOnce = function (goal) {
|
|
609
|
+
return this.a3c(goal);
|
|
610
|
+
};
|
|
611
|
+
ProblogSolver.prototype.b3c = function (goal, options) {
|
|
612
|
+
return first_0(this.u2b(goal, options.setLimit(1)));
|
|
613
|
+
};
|
|
614
|
+
ProblogSolver.prototype.solveOnceWithOptions = function (goal, options) {
|
|
615
|
+
return this.b3c(goal, options);
|
|
616
|
+
};
|
|
617
|
+
ProblogSolver.prototype.p1v = function (unificator, libraries, flags, staticKb, dynamicKb, stdIn, stdOut, stdErr, warnings) {
|
|
618
|
+
return new ProblogSolver(this.t3b_1.p1v(unificator, libraries, flags, Companion_getInstance_22().ofIterable(unificator, staticKb), Companion_getInstance_22().ofIterable(unificator, dynamicKb), stdIn, stdOut, stdErr, warnings));
|
|
619
|
+
};
|
|
620
|
+
ProblogSolver.prototype.z1s = function () {
|
|
621
|
+
return new ProblogSolver(this.t3b_1.clone());
|
|
622
|
+
};
|
|
623
|
+
ProblogSolver.prototype.clone = function () {
|
|
624
|
+
return this.z1s();
|
|
625
|
+
};
|
|
626
|
+
function ensureVariablesTracking($this, flags) {
|
|
627
|
+
var tmp = TrackVariables_getInstance();
|
|
628
|
+
return flags.plusPair(invoke(tmp, ProblogSolverFactory$ensureVariablesTracking$lambda));
|
|
629
|
+
}
|
|
630
|
+
function fixLibraries($this, libraries) {
|
|
631
|
+
var tmp;
|
|
632
|
+
var tmp$ret$1;
|
|
633
|
+
// Inline function 'kotlin.collections.contains' call
|
|
634
|
+
var tmp0_contains = ProblogLib_getInstance().i2e();
|
|
635
|
+
var tmp$ret$0;
|
|
636
|
+
// Inline function 'kotlin.collections.containsKey' call
|
|
637
|
+
tmp$ret$0 = (isInterface(libraries, Map) ? libraries : THROW_CCE()).u2(tmp0_contains);
|
|
638
|
+
tmp$ret$1 = tmp$ret$0;
|
|
639
|
+
if (!tmp$ret$1) {
|
|
640
|
+
tmp = libraries.plusLibrary(MinimalBuiltins_getInstance());
|
|
641
|
+
} else {
|
|
642
|
+
tmp = libraries;
|
|
643
|
+
}
|
|
644
|
+
return tmp;
|
|
645
|
+
}
|
|
646
|
+
function ProblogSolverFactory$ensureVariablesTracking$lambda($this$invoke) {
|
|
647
|
+
return $this$invoke.m29_1;
|
|
648
|
+
}
|
|
649
|
+
function ProblogSolverFactory() {
|
|
650
|
+
ProblogSolverFactory_instance = this;
|
|
651
|
+
}
|
|
652
|
+
ProblogSolverFactory.prototype.d1y = function () {
|
|
653
|
+
return DefaultBuiltins_getInstance_0();
|
|
654
|
+
};
|
|
655
|
+
ProblogSolverFactory.prototype.f1y = function () {
|
|
656
|
+
return ensureVariablesTracking(this, get_defaultFlags.call(this));
|
|
657
|
+
};
|
|
658
|
+
ProblogSolverFactory.prototype.t1y = function (unificator, libraries, flags, staticKb, dynamicKb, inputs, outputs) {
|
|
659
|
+
return new ProblogSolver(ClassicSolverFactory_getInstance().t1y(unificator, fixLibraries(this, libraries), ensureVariablesTracking(this, flags), Companion_getInstance_22().ofIterable(unificator, staticKb), Companion_getInstance_22().ofIterable(unificator, dynamicKb), inputs, outputs));
|
|
660
|
+
};
|
|
661
|
+
ProblogSolverFactory.prototype.v1y = function (unificator, libraries, flags, staticKb, dynamicKb, stdIn, stdOut, stdErr, warnings) {
|
|
662
|
+
return new ProblogSolver(ClassicSolverFactory_getInstance().v1y(unificator, fixLibraries(this, libraries), ensureVariablesTracking(this, flags), Companion_getInstance_22().ofIterable(unificator, staticKb), Companion_getInstance_22().ofIterable(unificator, dynamicKb), stdIn, stdOut, stdErr, warnings));
|
|
663
|
+
};
|
|
664
|
+
ProblogSolverFactory.prototype.z1y = function (unificator, libraries, flags, staticKb, dynamicKb, stdIn, stdOut, stdErr, warnings) {
|
|
665
|
+
return new MutableProblogSolver(ClassicSolverFactory_getInstance().z1y(unificator, fixLibraries(this, libraries), ensureVariablesTracking(this, flags), Companion_getInstance_22().ofIterable(unificator, staticKb), Companion_getInstance_22().ofIterable(unificator, dynamicKb), stdIn, stdOut, stdErr, warnings));
|
|
666
|
+
};
|
|
667
|
+
ProblogSolverFactory.prototype.d1z = function (unificator, libraries, flags, staticKb, dynamicKb, inputs, outputs) {
|
|
668
|
+
return new MutableProblogSolver(ClassicSolverFactory_getInstance().d1z(unificator, fixLibraries(this, libraries), ensureVariablesTracking(this, flags), Companion_getInstance_22().ofIterable(unificator, staticKb), Companion_getInstance_22().ofIterable(unificator, dynamicKb), inputs, outputs));
|
|
669
|
+
};
|
|
670
|
+
var ProblogSolverFactory_instance;
|
|
671
|
+
function ProblogSolverFactory_getInstance() {
|
|
672
|
+
if (ProblogSolverFactory_instance == null)
|
|
673
|
+
new ProblogSolverFactory();
|
|
674
|
+
return ProblogSolverFactory_instance;
|
|
675
|
+
}
|
|
676
|
+
function DefaultBuiltins() {
|
|
677
|
+
DefaultBuiltins_instance = this;
|
|
678
|
+
ExtensionLibrary.call(this, DefaultBuiltins_getInstance());
|
|
679
|
+
}
|
|
680
|
+
DefaultBuiltins.prototype.i2e = function () {
|
|
681
|
+
return ProblogLib_getInstance().i2e();
|
|
682
|
+
};
|
|
683
|
+
DefaultBuiltins.prototype.t2e = function () {
|
|
684
|
+
return ProblogLib_getInstance().t2e();
|
|
685
|
+
};
|
|
686
|
+
DefaultBuiltins.prototype.y2e = function () {
|
|
687
|
+
return ProblogLib_getInstance().y2e();
|
|
688
|
+
};
|
|
689
|
+
DefaultBuiltins.prototype.x2e = function () {
|
|
690
|
+
return ProblogLib_getInstance().x2e();
|
|
691
|
+
};
|
|
692
|
+
var DefaultBuiltins_instance;
|
|
693
|
+
function DefaultBuiltins_getInstance_0() {
|
|
694
|
+
if (DefaultBuiltins_instance == null)
|
|
695
|
+
new DefaultBuiltins();
|
|
696
|
+
return DefaultBuiltins_instance;
|
|
697
|
+
}
|
|
698
|
+
function MinimalBuiltins() {
|
|
699
|
+
MinimalBuiltins_instance = this;
|
|
700
|
+
ExtensionLibrary.call(this, ProblogLib_getInstance());
|
|
701
|
+
}
|
|
702
|
+
MinimalBuiltins.prototype.y2e = function () {
|
|
703
|
+
return listOf(EnsureExecutable_getInstance());
|
|
704
|
+
};
|
|
705
|
+
MinimalBuiltins.prototype.x2e = function () {
|
|
706
|
+
return listOf(Call_getInstance());
|
|
707
|
+
};
|
|
708
|
+
var MinimalBuiltins_instance;
|
|
709
|
+
function MinimalBuiltins_getInstance() {
|
|
710
|
+
if (MinimalBuiltins_instance == null)
|
|
711
|
+
new MinimalBuiltins();
|
|
712
|
+
return MinimalBuiltins_instance;
|
|
713
|
+
}
|
|
714
|
+
function ProblogLib() {
|
|
715
|
+
ProblogLib_instance = this;
|
|
716
|
+
var tmp = Companion_getInstance_6();
|
|
717
|
+
ExtensionLibrary.call(this, tmp.e2e('problog.lang', null, null, null, null, 30, null));
|
|
718
|
+
this.a3d_1 = 'EXPL';
|
|
719
|
+
this.b3d_1 = 'evidence';
|
|
720
|
+
this.c3d_1 = 'prob';
|
|
721
|
+
}
|
|
722
|
+
ProblogLib.prototype.t2e = function () {
|
|
723
|
+
return get_PROBLOG_SPECIFIC_OPERATORS();
|
|
724
|
+
};
|
|
725
|
+
ProblogLib.prototype.x2e = function () {
|
|
726
|
+
return listOf(Prob_getInstance());
|
|
727
|
+
};
|
|
728
|
+
ProblogLib.prototype.y2e = function () {
|
|
729
|
+
return listOf_0([ProbHelper_getInstance(), ProbSolve_getInstance(), ProbExplAnd_getInstance(), ProbQuery_getInstance(), ProbSolveEvidence_getInstance(), ProbSolveWithEvidence_getInstance(), ProbNegationAsFailure_getInstance(), ProbSetConfig_getInstance()]);
|
|
730
|
+
};
|
|
731
|
+
var ProblogLib_instance;
|
|
732
|
+
function ProblogLib_getInstance() {
|
|
733
|
+
if (ProblogLib_instance == null)
|
|
734
|
+
new ProblogLib();
|
|
735
|
+
return ProblogLib_instance;
|
|
736
|
+
}
|
|
737
|
+
function ClauseMappingException_init_$Init$(message, cause, $mask0, $marker, $this) {
|
|
738
|
+
if (!(($mask0 & 2) === 0))
|
|
739
|
+
cause = null;
|
|
740
|
+
ClauseMappingException.call($this, message, cause);
|
|
741
|
+
return $this;
|
|
742
|
+
}
|
|
743
|
+
function ClauseMappingException_init_$Create$(message, cause, $mask0, $marker) {
|
|
744
|
+
var tmp = ClauseMappingException_init_$Init$(message, cause, $mask0, $marker, Object.create(ClauseMappingException.prototype));
|
|
745
|
+
captureStack(tmp, ClauseMappingException_init_$Create$);
|
|
746
|
+
return tmp;
|
|
747
|
+
}
|
|
748
|
+
function ClauseMappingException(message, cause) {
|
|
749
|
+
TuPrologException_init_$Init$(cause, this);
|
|
750
|
+
this.j3d_1 = message;
|
|
751
|
+
captureStack(this, ClauseMappingException);
|
|
752
|
+
}
|
|
753
|
+
ClauseMappingException.prototype.k1 = function () {
|
|
754
|
+
return this.j3d_1;
|
|
755
|
+
};
|
|
756
|
+
Object.defineProperty(ClauseMappingException.prototype, 'message', {
|
|
757
|
+
configurable: true,
|
|
758
|
+
get: function () {
|
|
759
|
+
return this.k1();
|
|
760
|
+
}
|
|
761
|
+
});
|
|
762
|
+
function Companion() {
|
|
763
|
+
Companion_instance = this;
|
|
764
|
+
}
|
|
765
|
+
Companion.prototype.empty = function (unificator) {
|
|
766
|
+
return this.ofIterable(unificator, emptyList());
|
|
767
|
+
};
|
|
768
|
+
Companion.prototype.of = function (unificator, clauses) {
|
|
769
|
+
return this.ofIterable(unificator, asIterable(clauses));
|
|
770
|
+
};
|
|
771
|
+
Companion.prototype.ofSequence = function (unificator, clauses) {
|
|
772
|
+
return this.ofIterable(unificator, asIterable_0(clauses));
|
|
773
|
+
};
|
|
774
|
+
Companion.prototype.ofScopes = function (unificator, clauses) {
|
|
775
|
+
var tmp$ret$2;
|
|
776
|
+
// Inline function 'kotlin.collections.map' call
|
|
777
|
+
var tmp$ret$1;
|
|
778
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
779
|
+
var tmp0_mapTo = ArrayList_init_$Create$(clauses.length);
|
|
780
|
+
var indexedObject = clauses;
|
|
781
|
+
var inductionVariable = 0;
|
|
782
|
+
var last = indexedObject.length;
|
|
783
|
+
while (inductionVariable < last) {
|
|
784
|
+
var item = indexedObject[inductionVariable];
|
|
785
|
+
inductionVariable = inductionVariable + 1 | 0;
|
|
786
|
+
var tmp$ret$0;
|
|
787
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.knowledge.Companion.of.<anonymous>' call
|
|
788
|
+
tmp$ret$0 = item(Companion_getInstance_7().empty());
|
|
789
|
+
tmp0_mapTo.g(tmp$ret$0);
|
|
790
|
+
}
|
|
791
|
+
tmp$ret$1 = tmp0_mapTo;
|
|
792
|
+
tmp$ret$2 = tmp$ret$1;
|
|
793
|
+
return this.ofIterable(unificator, tmp$ret$2);
|
|
794
|
+
};
|
|
795
|
+
Companion.prototype.ofIterable = function (unificator, clauses) {
|
|
796
|
+
return MappedMutableProblogTheory_init_$Create$(clauses, unificator, null, 4, null);
|
|
797
|
+
};
|
|
798
|
+
var Companion_instance;
|
|
799
|
+
function Companion_getInstance_20() {
|
|
800
|
+
if (Companion_instance == null)
|
|
801
|
+
new Companion();
|
|
802
|
+
return Companion_instance;
|
|
803
|
+
}
|
|
804
|
+
function Companion_0() {
|
|
805
|
+
Companion_instance_0 = this;
|
|
806
|
+
this.k3d_1 = new BinaryDecisionDiagramExplanation(bddTerminalOf(false), Companion_getInstance_23().n3d_1);
|
|
807
|
+
this.l3d_1 = new BinaryDecisionDiagramExplanation(bddTerminalOf(true), Companion_getInstance_23().o3d_1);
|
|
808
|
+
}
|
|
809
|
+
Companion_0.prototype.p3d = function (term) {
|
|
810
|
+
return new BinaryDecisionDiagramExplanation(bddOf(term), new ComputedValue(term.r3d_1));
|
|
811
|
+
};
|
|
812
|
+
var Companion_instance_0;
|
|
813
|
+
function Companion_getInstance_21() {
|
|
814
|
+
if (Companion_instance_0 == null)
|
|
815
|
+
new Companion_0();
|
|
816
|
+
return Companion_instance_0;
|
|
817
|
+
}
|
|
818
|
+
function ProbExplanation() {
|
|
819
|
+
}
|
|
820
|
+
function ProbExplanationTerm$freshCopy$lambda(it) {
|
|
821
|
+
return it.iw();
|
|
822
|
+
}
|
|
823
|
+
function ProbExplanationTerm$freshCopy$lambda_0($scope) {
|
|
824
|
+
return function (it) {
|
|
825
|
+
return it.jw($scope);
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
function ProbExplanationTerm$apply$lambda($substitution) {
|
|
829
|
+
return function (it) {
|
|
830
|
+
return it.s16($substitution);
|
|
831
|
+
};
|
|
832
|
+
}
|
|
833
|
+
function ProbExplanationTerm(explanation) {
|
|
834
|
+
this.h3c_1 = explanation;
|
|
835
|
+
this.i3c_1 = Companion_getInstance_8().of('<expl:' + explanation + '>');
|
|
836
|
+
}
|
|
837
|
+
ProbExplanationTerm.prototype.gw = function () {
|
|
838
|
+
return this.i3c_1.gw();
|
|
839
|
+
};
|
|
840
|
+
ProbExplanationTerm.prototype.yw = function () {
|
|
841
|
+
return this.i3c_1.yw();
|
|
842
|
+
};
|
|
843
|
+
ProbExplanationTerm.prototype.zv = function () {
|
|
844
|
+
return this.i3c_1.zv();
|
|
845
|
+
};
|
|
846
|
+
ProbExplanationTerm.prototype.fw = function () {
|
|
847
|
+
return this.i3c_1.fw();
|
|
848
|
+
};
|
|
849
|
+
ProbExplanationTerm.prototype.xw = function () {
|
|
850
|
+
return this.i3c_1.xw();
|
|
851
|
+
};
|
|
852
|
+
ProbExplanationTerm.prototype.aw = function () {
|
|
853
|
+
return this.i3c_1.aw();
|
|
854
|
+
};
|
|
855
|
+
ProbExplanationTerm.prototype.tw = function () {
|
|
856
|
+
return this.i3c_1.tw();
|
|
857
|
+
};
|
|
858
|
+
ProbExplanationTerm.prototype.mw = function () {
|
|
859
|
+
return this.i3c_1.mw();
|
|
860
|
+
};
|
|
861
|
+
ProbExplanationTerm.prototype.sw = function () {
|
|
862
|
+
return this.i3c_1.sw();
|
|
863
|
+
};
|
|
864
|
+
ProbExplanationTerm.prototype.ow = function () {
|
|
865
|
+
return this.i3c_1.ow();
|
|
866
|
+
};
|
|
867
|
+
ProbExplanationTerm.prototype.bw = function () {
|
|
868
|
+
return this.i3c_1.bw();
|
|
869
|
+
};
|
|
870
|
+
ProbExplanationTerm.prototype.cw = function () {
|
|
871
|
+
return this.i3c_1.cw();
|
|
872
|
+
};
|
|
873
|
+
ProbExplanationTerm.prototype.pw = function () {
|
|
874
|
+
return this.i3c_1.pw();
|
|
875
|
+
};
|
|
876
|
+
ProbExplanationTerm.prototype.ew = function () {
|
|
877
|
+
return this.i3c_1.ew();
|
|
878
|
+
};
|
|
879
|
+
ProbExplanationTerm.prototype.ww = function () {
|
|
880
|
+
return this.i3c_1.ww();
|
|
881
|
+
};
|
|
882
|
+
ProbExplanationTerm.prototype.uw = function () {
|
|
883
|
+
return this.i3c_1.uw();
|
|
884
|
+
};
|
|
885
|
+
ProbExplanationTerm.prototype.gx = function () {
|
|
886
|
+
return this.i3c_1.gx();
|
|
887
|
+
};
|
|
888
|
+
ProbExplanationTerm.prototype.rw = function () {
|
|
889
|
+
return this.i3c_1.rw();
|
|
890
|
+
};
|
|
891
|
+
ProbExplanationTerm.prototype.fx = function () {
|
|
892
|
+
return this.i3c_1.fx();
|
|
893
|
+
};
|
|
894
|
+
ProbExplanationTerm.prototype.hx = function () {
|
|
895
|
+
return this.i3c_1.hx();
|
|
896
|
+
};
|
|
897
|
+
ProbExplanationTerm.prototype.dx = function () {
|
|
898
|
+
return this.i3c_1.dx();
|
|
899
|
+
};
|
|
900
|
+
ProbExplanationTerm.prototype.nw = function () {
|
|
901
|
+
return this.i3c_1.nw();
|
|
902
|
+
};
|
|
903
|
+
ProbExplanationTerm.prototype.lw = function () {
|
|
904
|
+
return this.i3c_1.lw();
|
|
905
|
+
};
|
|
906
|
+
ProbExplanationTerm.prototype.dw = function () {
|
|
907
|
+
return this.i3c_1.dw();
|
|
908
|
+
};
|
|
909
|
+
ProbExplanationTerm.prototype.cx = function () {
|
|
910
|
+
return this.i3c_1.cx();
|
|
911
|
+
};
|
|
912
|
+
ProbExplanationTerm.prototype.qw = function () {
|
|
913
|
+
return this.i3c_1.qw();
|
|
914
|
+
};
|
|
915
|
+
ProbExplanationTerm.prototype.bx = function () {
|
|
916
|
+
return this.i3c_1.bx();
|
|
917
|
+
};
|
|
918
|
+
ProbExplanationTerm.prototype.kt = function () {
|
|
919
|
+
return this.i3c_1.kt();
|
|
920
|
+
};
|
|
921
|
+
ProbExplanationTerm.prototype.b1 = function () {
|
|
922
|
+
return this.i3c_1.b1();
|
|
923
|
+
};
|
|
924
|
+
ProbExplanationTerm.prototype.hw = function () {
|
|
925
|
+
return this.i3c_1.hw();
|
|
926
|
+
};
|
|
927
|
+
ProbExplanationTerm.prototype.accept = function (visitor) {
|
|
928
|
+
return this.i3c_1.accept(visitor);
|
|
929
|
+
};
|
|
930
|
+
ProbExplanationTerm.prototype.addFirst = function (argument) {
|
|
931
|
+
return this.i3c_1.addFirst(argument);
|
|
932
|
+
};
|
|
933
|
+
ProbExplanationTerm.prototype.addLast = function (argument) {
|
|
934
|
+
return this.i3c_1.addLast(argument);
|
|
935
|
+
};
|
|
936
|
+
ProbExplanationTerm.prototype.append = function (argument) {
|
|
937
|
+
return this.i3c_1.append(argument);
|
|
938
|
+
};
|
|
939
|
+
ProbExplanationTerm.prototype.kw = function () {
|
|
940
|
+
return this.i3c_1.kw();
|
|
941
|
+
};
|
|
942
|
+
ProbExplanationTerm.prototype.asAtom = function () {
|
|
943
|
+
return this.kw();
|
|
944
|
+
};
|
|
945
|
+
ProbExplanationTerm.prototype.asBlock = function () {
|
|
946
|
+
return this.i3c_1.asBlock();
|
|
947
|
+
};
|
|
948
|
+
ProbExplanationTerm.prototype.asClause = function () {
|
|
949
|
+
return this.i3c_1.asClause();
|
|
950
|
+
};
|
|
951
|
+
ProbExplanationTerm.prototype.asCons = function () {
|
|
952
|
+
return this.i3c_1.asCons();
|
|
953
|
+
};
|
|
954
|
+
ProbExplanationTerm.prototype.asDirective = function () {
|
|
955
|
+
return this.i3c_1.asDirective();
|
|
956
|
+
};
|
|
957
|
+
ProbExplanationTerm.prototype.asEmptyBlock = function () {
|
|
958
|
+
return this.i3c_1.asEmptyBlock();
|
|
959
|
+
};
|
|
960
|
+
ProbExplanationTerm.prototype.asEmptyList = function () {
|
|
961
|
+
return this.i3c_1.asEmptyList();
|
|
962
|
+
};
|
|
963
|
+
ProbExplanationTerm.prototype.asFact = function () {
|
|
964
|
+
return this.i3c_1.asFact();
|
|
965
|
+
};
|
|
966
|
+
ProbExplanationTerm.prototype.asIndicator = function () {
|
|
967
|
+
return this.i3c_1.asIndicator();
|
|
968
|
+
};
|
|
969
|
+
ProbExplanationTerm.prototype.asInteger = function () {
|
|
970
|
+
return this.i3c_1.asInteger();
|
|
971
|
+
};
|
|
972
|
+
ProbExplanationTerm.prototype.asList = function () {
|
|
973
|
+
return this.i3c_1.asList();
|
|
974
|
+
};
|
|
975
|
+
ProbExplanationTerm.prototype.asNumeric = function () {
|
|
976
|
+
return this.i3c_1.asNumeric();
|
|
977
|
+
};
|
|
978
|
+
ProbExplanationTerm.prototype.asReal = function () {
|
|
979
|
+
return this.i3c_1.asReal();
|
|
980
|
+
};
|
|
981
|
+
ProbExplanationTerm.prototype.asRecursive = function () {
|
|
982
|
+
return this.i3c_1.asRecursive();
|
|
983
|
+
};
|
|
984
|
+
ProbExplanationTerm.prototype.asRule = function () {
|
|
985
|
+
return this.i3c_1.asRule();
|
|
986
|
+
};
|
|
987
|
+
ProbExplanationTerm.prototype.vw = function () {
|
|
988
|
+
return this.i3c_1.vw();
|
|
989
|
+
};
|
|
990
|
+
ProbExplanationTerm.prototype.asStruct = function () {
|
|
991
|
+
return this.vw();
|
|
992
|
+
};
|
|
993
|
+
ProbExplanationTerm.prototype.asTerm = function () {
|
|
994
|
+
return this.i3c_1.asTerm();
|
|
995
|
+
};
|
|
996
|
+
ProbExplanationTerm.prototype.asTruth = function () {
|
|
997
|
+
return this.i3c_1.asTruth();
|
|
998
|
+
};
|
|
999
|
+
ProbExplanationTerm.prototype.asTuple = function () {
|
|
1000
|
+
return this.i3c_1.asTuple();
|
|
1001
|
+
};
|
|
1002
|
+
ProbExplanationTerm.prototype.asVar = function () {
|
|
1003
|
+
return this.i3c_1.asVar();
|
|
1004
|
+
};
|
|
1005
|
+
ProbExplanationTerm.prototype.zw = function () {
|
|
1006
|
+
return this.i3c_1.zw();
|
|
1007
|
+
};
|
|
1008
|
+
ProbExplanationTerm.prototype.qq = function () {
|
|
1009
|
+
return this.zw();
|
|
1010
|
+
};
|
|
1011
|
+
ProbExplanationTerm.prototype.castToAtom = function () {
|
|
1012
|
+
return this.i3c_1.castToAtom();
|
|
1013
|
+
};
|
|
1014
|
+
ProbExplanationTerm.prototype.castToBlock = function () {
|
|
1015
|
+
return this.i3c_1.castToBlock();
|
|
1016
|
+
};
|
|
1017
|
+
ProbExplanationTerm.prototype.castToClause = function () {
|
|
1018
|
+
return this.i3c_1.castToClause();
|
|
1019
|
+
};
|
|
1020
|
+
ProbExplanationTerm.prototype.castToCons = function () {
|
|
1021
|
+
return this.i3c_1.castToCons();
|
|
1022
|
+
};
|
|
1023
|
+
ProbExplanationTerm.prototype.castToConstant = function () {
|
|
1024
|
+
return this.i3c_1.castToConstant();
|
|
1025
|
+
};
|
|
1026
|
+
ProbExplanationTerm.prototype.castToDirective = function () {
|
|
1027
|
+
return this.i3c_1.castToDirective();
|
|
1028
|
+
};
|
|
1029
|
+
ProbExplanationTerm.prototype.castToEmptyBlock = function () {
|
|
1030
|
+
return this.i3c_1.castToEmptyBlock();
|
|
1031
|
+
};
|
|
1032
|
+
ProbExplanationTerm.prototype.castToEmptyList = function () {
|
|
1033
|
+
return this.i3c_1.castToEmptyList();
|
|
1034
|
+
};
|
|
1035
|
+
ProbExplanationTerm.prototype.castToFact = function () {
|
|
1036
|
+
return this.i3c_1.castToFact();
|
|
1037
|
+
};
|
|
1038
|
+
ProbExplanationTerm.prototype.castToIndicator = function () {
|
|
1039
|
+
return this.i3c_1.castToIndicator();
|
|
1040
|
+
};
|
|
1041
|
+
ProbExplanationTerm.prototype.castToInteger = function () {
|
|
1042
|
+
return this.i3c_1.castToInteger();
|
|
1043
|
+
};
|
|
1044
|
+
ProbExplanationTerm.prototype.castToList = function () {
|
|
1045
|
+
return this.i3c_1.castToList();
|
|
1046
|
+
};
|
|
1047
|
+
ProbExplanationTerm.prototype.castToNumeric = function () {
|
|
1048
|
+
return this.i3c_1.castToNumeric();
|
|
1049
|
+
};
|
|
1050
|
+
ProbExplanationTerm.prototype.castToReal = function () {
|
|
1051
|
+
return this.i3c_1.castToReal();
|
|
1052
|
+
};
|
|
1053
|
+
ProbExplanationTerm.prototype.castToRecursive = function () {
|
|
1054
|
+
return this.i3c_1.castToRecursive();
|
|
1055
|
+
};
|
|
1056
|
+
ProbExplanationTerm.prototype.castToRule = function () {
|
|
1057
|
+
return this.i3c_1.castToRule();
|
|
1058
|
+
};
|
|
1059
|
+
ProbExplanationTerm.prototype.castToStruct = function () {
|
|
1060
|
+
return this.i3c_1.castToStruct();
|
|
1061
|
+
};
|
|
1062
|
+
ProbExplanationTerm.prototype.castToTerm = function () {
|
|
1063
|
+
return this.i3c_1.castToTerm();
|
|
1064
|
+
};
|
|
1065
|
+
ProbExplanationTerm.prototype.castToTruth = function () {
|
|
1066
|
+
return this.i3c_1.castToTruth();
|
|
1067
|
+
};
|
|
1068
|
+
ProbExplanationTerm.prototype.castToTuple = function () {
|
|
1069
|
+
return this.i3c_1.castToTuple();
|
|
1070
|
+
};
|
|
1071
|
+
ProbExplanationTerm.prototype.castToVar = function () {
|
|
1072
|
+
return this.i3c_1.castToVar();
|
|
1073
|
+
};
|
|
1074
|
+
ProbExplanationTerm.prototype.ax = function (other) {
|
|
1075
|
+
return this.i3c_1.ax(other);
|
|
1076
|
+
};
|
|
1077
|
+
ProbExplanationTerm.prototype.aa = function (other) {
|
|
1078
|
+
return this.ax((!(other == null) ? isInterface(other, Term) : false) ? other : THROW_CCE());
|
|
1079
|
+
};
|
|
1080
|
+
ProbExplanationTerm.prototype.containsTag = function (name) {
|
|
1081
|
+
return this.i3c_1.containsTag(name);
|
|
1082
|
+
};
|
|
1083
|
+
ProbExplanationTerm.prototype.equalsUsingVarCompleteNames = function (other, useVarCompleteName) {
|
|
1084
|
+
return this.i3c_1.equalsUsingVarCompleteNames(other, useVarCompleteName);
|
|
1085
|
+
};
|
|
1086
|
+
ProbExplanationTerm.prototype.equals = function (other) {
|
|
1087
|
+
return this.i3c_1.equals(other);
|
|
1088
|
+
};
|
|
1089
|
+
ProbExplanationTerm.prototype.get = function (index) {
|
|
1090
|
+
return this.i3c_1.get(index);
|
|
1091
|
+
};
|
|
1092
|
+
ProbExplanationTerm.prototype.getArgAt = function (index) {
|
|
1093
|
+
return this.i3c_1.getArgAt(index);
|
|
1094
|
+
};
|
|
1095
|
+
ProbExplanationTerm.prototype.getTag = function (name) {
|
|
1096
|
+
return this.i3c_1.getTag(name);
|
|
1097
|
+
};
|
|
1098
|
+
ProbExplanationTerm.prototype.hashCode = function () {
|
|
1099
|
+
return this.i3c_1.hashCode();
|
|
1100
|
+
};
|
|
1101
|
+
ProbExplanationTerm.prototype.insertAt = function (index, argument) {
|
|
1102
|
+
return this.i3c_1.insertAt(index, argument);
|
|
1103
|
+
};
|
|
1104
|
+
ProbExplanationTerm.prototype.resetTags = function (tags) {
|
|
1105
|
+
return this.i3c_1.resetTags(tags);
|
|
1106
|
+
};
|
|
1107
|
+
ProbExplanationTerm.prototype.setArgs = function (args) {
|
|
1108
|
+
return this.i3c_1.setArgs(args);
|
|
1109
|
+
};
|
|
1110
|
+
ProbExplanationTerm.prototype.setArgsIterable = function (args) {
|
|
1111
|
+
return this.i3c_1.setArgsIterable(args);
|
|
1112
|
+
};
|
|
1113
|
+
ProbExplanationTerm.prototype.setArgsSequence = function (args) {
|
|
1114
|
+
return this.i3c_1.setArgsSequence(args);
|
|
1115
|
+
};
|
|
1116
|
+
ProbExplanationTerm.prototype.setFunctor = function (functor) {
|
|
1117
|
+
return this.i3c_1.setFunctor(functor);
|
|
1118
|
+
};
|
|
1119
|
+
ProbExplanationTerm.prototype.structurallyEquals = function (other) {
|
|
1120
|
+
return this.i3c_1.structurallyEquals(other);
|
|
1121
|
+
};
|
|
1122
|
+
ProbExplanationTerm.prototype.toString = function () {
|
|
1123
|
+
return this.i3c_1.toString();
|
|
1124
|
+
};
|
|
1125
|
+
ProbExplanationTerm.prototype.ex = function () {
|
|
1126
|
+
return false;
|
|
1127
|
+
};
|
|
1128
|
+
ProbExplanationTerm.prototype.ix = function () {
|
|
1129
|
+
return this;
|
|
1130
|
+
};
|
|
1131
|
+
ProbExplanationTerm.prototype.asConstant = function () {
|
|
1132
|
+
return this.ix();
|
|
1133
|
+
};
|
|
1134
|
+
ProbExplanationTerm.prototype.iw = function () {
|
|
1135
|
+
return new ProbExplanationTerm(this.h3c_1.applyTransformation(ProbExplanationTerm$freshCopy$lambda));
|
|
1136
|
+
};
|
|
1137
|
+
ProbExplanationTerm.prototype.freshCopy = function () {
|
|
1138
|
+
return this.iw();
|
|
1139
|
+
};
|
|
1140
|
+
ProbExplanationTerm.prototype.jw = function (scope) {
|
|
1141
|
+
return new ProbExplanationTerm(this.h3c_1.applyTransformation(ProbExplanationTerm$freshCopy$lambda_0(scope)));
|
|
1142
|
+
};
|
|
1143
|
+
ProbExplanationTerm.prototype.freshCopyFromScope = function (scope) {
|
|
1144
|
+
return this.jw(scope);
|
|
1145
|
+
};
|
|
1146
|
+
ProbExplanationTerm.prototype.b2p = function (substitution, substitutions) {
|
|
1147
|
+
return this.c2p(substitution, substitutions.slice());
|
|
1148
|
+
};
|
|
1149
|
+
ProbExplanationTerm.prototype.getSubstituted = function (substitution, substitutions) {
|
|
1150
|
+
return this.b2p(substitution, substitutions);
|
|
1151
|
+
};
|
|
1152
|
+
ProbExplanationTerm.prototype.c2p = function (substitution, substitutions) {
|
|
1153
|
+
return this.s16(Companion_getInstance_9().ofSubstitution(substitution, substitutions.slice()));
|
|
1154
|
+
};
|
|
1155
|
+
ProbExplanationTerm.prototype.apply = function (substitution, substitutions) {
|
|
1156
|
+
return this.c2p(substitution, substitutions);
|
|
1157
|
+
};
|
|
1158
|
+
ProbExplanationTerm.prototype.s16 = function (substitution) {
|
|
1159
|
+
var tmp;
|
|
1160
|
+
if (substitution.d() ? true : this.jx()) {
|
|
1161
|
+
tmp = this;
|
|
1162
|
+
} else {
|
|
1163
|
+
tmp = new ProbExplanationTerm(this.h3c_1.applyTransformation(ProbExplanationTerm$apply$lambda(substitution)));
|
|
1164
|
+
}
|
|
1165
|
+
return tmp;
|
|
1166
|
+
};
|
|
1167
|
+
ProbExplanationTerm.prototype.applySubstitution = function (substitution) {
|
|
1168
|
+
return this.s16(substitution);
|
|
1169
|
+
};
|
|
1170
|
+
ProbExplanationTerm.prototype.jx = function () {
|
|
1171
|
+
return !this.h3c_1.z3d();
|
|
1172
|
+
};
|
|
1173
|
+
function _get_cachedHashCode__d7x0zy($this) {
|
|
1174
|
+
var tmp$ret$0;
|
|
1175
|
+
// Inline function 'kotlin.getValue' call
|
|
1176
|
+
var tmp0_getValue = cachedHashCode$factory();
|
|
1177
|
+
tmp$ret$0 = $this.w3d_1.b1();
|
|
1178
|
+
return tmp$ret$0;
|
|
1179
|
+
}
|
|
1180
|
+
function ProbTerm$isGround$delegate$lambda(this$0) {
|
|
1181
|
+
return function () {
|
|
1182
|
+
var tmp;
|
|
1183
|
+
if (this$0.s3d_1.jx()) {
|
|
1184
|
+
var tmp$ret$0;
|
|
1185
|
+
$l$block_0: {
|
|
1186
|
+
// Inline function 'kotlin.collections.any' call
|
|
1187
|
+
var tmp0_any = this$0.t3d_1;
|
|
1188
|
+
var tmp_0;
|
|
1189
|
+
if (isInterface(tmp0_any, Collection)) {
|
|
1190
|
+
tmp_0 = tmp0_any.d();
|
|
1191
|
+
} else {
|
|
1192
|
+
tmp_0 = false;
|
|
1193
|
+
}
|
|
1194
|
+
if (tmp_0) {
|
|
1195
|
+
tmp$ret$0 = false;
|
|
1196
|
+
break $l$block_0;
|
|
1197
|
+
}
|
|
1198
|
+
var tmp0_iterator = tmp0_any.j();
|
|
1199
|
+
while (tmp0_iterator.m()) {
|
|
1200
|
+
var element = tmp0_iterator.p();
|
|
1201
|
+
var tmp$ret$1;
|
|
1202
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.knowledge.ProbTerm.isGround$delegate.<anonymous>.<anonymous>' call
|
|
1203
|
+
tmp$ret$1 = element.bx();
|
|
1204
|
+
if (tmp$ret$1) {
|
|
1205
|
+
tmp$ret$0 = true;
|
|
1206
|
+
break $l$block_0;
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
tmp$ret$0 = false;
|
|
1210
|
+
}
|
|
1211
|
+
tmp = !tmp$ret$0;
|
|
1212
|
+
} else {
|
|
1213
|
+
tmp = false;
|
|
1214
|
+
}
|
|
1215
|
+
return tmp;
|
|
1216
|
+
};
|
|
1217
|
+
}
|
|
1218
|
+
function ProbTerm$cachedHashCode$delegate$lambda(this$0) {
|
|
1219
|
+
return function () {
|
|
1220
|
+
var result = this$0.q3d_1.hashCode();
|
|
1221
|
+
result = imul(31, result) + getNumberHashCode(this$0.r3d_1) | 0;
|
|
1222
|
+
result = imul(31, result) + this$0.s3d_1.hashCode() | 0;
|
|
1223
|
+
result = imul(31, result) + hashCode(this$0.t3d_1) | 0;
|
|
1224
|
+
return result;
|
|
1225
|
+
};
|
|
1226
|
+
}
|
|
1227
|
+
function ProbTerm(id, probability, term, extraVariables) {
|
|
1228
|
+
this.q3d_1 = id;
|
|
1229
|
+
this.r3d_1 = probability;
|
|
1230
|
+
this.s3d_1 = term;
|
|
1231
|
+
this.t3d_1 = extraVariables;
|
|
1232
|
+
this.u3d_1 = Companion_getInstance_3().of(get_ANNOTATION_FUNCTOR(), [Companion_getInstance_10().ofDouble(probability), term]);
|
|
1233
|
+
var tmp = this;
|
|
1234
|
+
tmp.v3d_1 = lazy(ProbTerm$isGround$delegate$lambda(this));
|
|
1235
|
+
var tmp_0 = this;
|
|
1236
|
+
tmp_0.w3d_1 = lazy(ProbTerm$cachedHashCode$delegate$lambda(this));
|
|
1237
|
+
}
|
|
1238
|
+
ProbTerm.prototype.aw = function () {
|
|
1239
|
+
return this.u3d_1.aw();
|
|
1240
|
+
};
|
|
1241
|
+
ProbTerm.prototype.mw = function () {
|
|
1242
|
+
return this.u3d_1.mw();
|
|
1243
|
+
};
|
|
1244
|
+
ProbTerm.prototype.sw = function () {
|
|
1245
|
+
return this.u3d_1.sw();
|
|
1246
|
+
};
|
|
1247
|
+
ProbTerm.prototype.ex = function () {
|
|
1248
|
+
return this.u3d_1.ex();
|
|
1249
|
+
};
|
|
1250
|
+
ProbTerm.prototype.bw = function () {
|
|
1251
|
+
return this.u3d_1.bw();
|
|
1252
|
+
};
|
|
1253
|
+
ProbTerm.prototype.cw = function () {
|
|
1254
|
+
return this.u3d_1.cw();
|
|
1255
|
+
};
|
|
1256
|
+
ProbTerm.prototype.uw = function () {
|
|
1257
|
+
return this.u3d_1.uw();
|
|
1258
|
+
};
|
|
1259
|
+
ProbTerm.prototype.gx = function () {
|
|
1260
|
+
return this.u3d_1.gx();
|
|
1261
|
+
};
|
|
1262
|
+
ProbTerm.prototype.rw = function () {
|
|
1263
|
+
return this.u3d_1.rw();
|
|
1264
|
+
};
|
|
1265
|
+
ProbTerm.prototype.fx = function () {
|
|
1266
|
+
return this.u3d_1.fx();
|
|
1267
|
+
};
|
|
1268
|
+
ProbTerm.prototype.hx = function () {
|
|
1269
|
+
return this.u3d_1.hx();
|
|
1270
|
+
};
|
|
1271
|
+
ProbTerm.prototype.lw = function () {
|
|
1272
|
+
return this.u3d_1.lw();
|
|
1273
|
+
};
|
|
1274
|
+
ProbTerm.prototype.dw = function () {
|
|
1275
|
+
return this.u3d_1.dw();
|
|
1276
|
+
};
|
|
1277
|
+
ProbTerm.prototype.qw = function () {
|
|
1278
|
+
return this.u3d_1.qw();
|
|
1279
|
+
};
|
|
1280
|
+
ProbTerm.prototype.bx = function () {
|
|
1281
|
+
return this.u3d_1.bx();
|
|
1282
|
+
};
|
|
1283
|
+
ProbTerm.prototype.kt = function () {
|
|
1284
|
+
return this.u3d_1.kt();
|
|
1285
|
+
};
|
|
1286
|
+
ProbTerm.prototype.hw = function () {
|
|
1287
|
+
return this.u3d_1.hw();
|
|
1288
|
+
};
|
|
1289
|
+
ProbTerm.prototype.accept = function (visitor) {
|
|
1290
|
+
return this.u3d_1.accept(visitor);
|
|
1291
|
+
};
|
|
1292
|
+
ProbTerm.prototype.asAtom = function () {
|
|
1293
|
+
return this.u3d_1.asAtom();
|
|
1294
|
+
};
|
|
1295
|
+
ProbTerm.prototype.asBlock = function () {
|
|
1296
|
+
return this.u3d_1.asBlock();
|
|
1297
|
+
};
|
|
1298
|
+
ProbTerm.prototype.asClause = function () {
|
|
1299
|
+
return this.u3d_1.asClause();
|
|
1300
|
+
};
|
|
1301
|
+
ProbTerm.prototype.asCons = function () {
|
|
1302
|
+
return this.u3d_1.asCons();
|
|
1303
|
+
};
|
|
1304
|
+
ProbTerm.prototype.asConstant = function () {
|
|
1305
|
+
return this.u3d_1.asConstant();
|
|
1306
|
+
};
|
|
1307
|
+
ProbTerm.prototype.asDirective = function () {
|
|
1308
|
+
return this.u3d_1.asDirective();
|
|
1309
|
+
};
|
|
1310
|
+
ProbTerm.prototype.asEmptyBlock = function () {
|
|
1311
|
+
return this.u3d_1.asEmptyBlock();
|
|
1312
|
+
};
|
|
1313
|
+
ProbTerm.prototype.asEmptyList = function () {
|
|
1314
|
+
return this.u3d_1.asEmptyList();
|
|
1315
|
+
};
|
|
1316
|
+
ProbTerm.prototype.asFact = function () {
|
|
1317
|
+
return this.u3d_1.asFact();
|
|
1318
|
+
};
|
|
1319
|
+
ProbTerm.prototype.asIndicator = function () {
|
|
1320
|
+
return this.u3d_1.asIndicator();
|
|
1321
|
+
};
|
|
1322
|
+
ProbTerm.prototype.asInteger = function () {
|
|
1323
|
+
return this.u3d_1.asInteger();
|
|
1324
|
+
};
|
|
1325
|
+
ProbTerm.prototype.asList = function () {
|
|
1326
|
+
return this.u3d_1.asList();
|
|
1327
|
+
};
|
|
1328
|
+
ProbTerm.prototype.asNumeric = function () {
|
|
1329
|
+
return this.u3d_1.asNumeric();
|
|
1330
|
+
};
|
|
1331
|
+
ProbTerm.prototype.asReal = function () {
|
|
1332
|
+
return this.u3d_1.asReal();
|
|
1333
|
+
};
|
|
1334
|
+
ProbTerm.prototype.asRecursive = function () {
|
|
1335
|
+
return this.u3d_1.asRecursive();
|
|
1336
|
+
};
|
|
1337
|
+
ProbTerm.prototype.asRule = function () {
|
|
1338
|
+
return this.u3d_1.asRule();
|
|
1339
|
+
};
|
|
1340
|
+
ProbTerm.prototype.asStruct = function () {
|
|
1341
|
+
return this.u3d_1.vw();
|
|
1342
|
+
};
|
|
1343
|
+
ProbTerm.prototype.asTerm = function () {
|
|
1344
|
+
return this.u3d_1.asTerm();
|
|
1345
|
+
};
|
|
1346
|
+
ProbTerm.prototype.asTruth = function () {
|
|
1347
|
+
return this.u3d_1.asTruth();
|
|
1348
|
+
};
|
|
1349
|
+
ProbTerm.prototype.asTuple = function () {
|
|
1350
|
+
return this.u3d_1.asTuple();
|
|
1351
|
+
};
|
|
1352
|
+
ProbTerm.prototype.asVar = function () {
|
|
1353
|
+
return this.u3d_1.asVar();
|
|
1354
|
+
};
|
|
1355
|
+
ProbTerm.prototype.zw = function () {
|
|
1356
|
+
return this.u3d_1.zw();
|
|
1357
|
+
};
|
|
1358
|
+
ProbTerm.prototype.qq = function () {
|
|
1359
|
+
return this.zw();
|
|
1360
|
+
};
|
|
1361
|
+
ProbTerm.prototype.castToAtom = function () {
|
|
1362
|
+
return this.u3d_1.castToAtom();
|
|
1363
|
+
};
|
|
1364
|
+
ProbTerm.prototype.castToBlock = function () {
|
|
1365
|
+
return this.u3d_1.castToBlock();
|
|
1366
|
+
};
|
|
1367
|
+
ProbTerm.prototype.castToClause = function () {
|
|
1368
|
+
return this.u3d_1.castToClause();
|
|
1369
|
+
};
|
|
1370
|
+
ProbTerm.prototype.castToCons = function () {
|
|
1371
|
+
return this.u3d_1.castToCons();
|
|
1372
|
+
};
|
|
1373
|
+
ProbTerm.prototype.castToConstant = function () {
|
|
1374
|
+
return this.u3d_1.castToConstant();
|
|
1375
|
+
};
|
|
1376
|
+
ProbTerm.prototype.castToDirective = function () {
|
|
1377
|
+
return this.u3d_1.castToDirective();
|
|
1378
|
+
};
|
|
1379
|
+
ProbTerm.prototype.castToEmptyBlock = function () {
|
|
1380
|
+
return this.u3d_1.castToEmptyBlock();
|
|
1381
|
+
};
|
|
1382
|
+
ProbTerm.prototype.castToEmptyList = function () {
|
|
1383
|
+
return this.u3d_1.castToEmptyList();
|
|
1384
|
+
};
|
|
1385
|
+
ProbTerm.prototype.castToFact = function () {
|
|
1386
|
+
return this.u3d_1.castToFact();
|
|
1387
|
+
};
|
|
1388
|
+
ProbTerm.prototype.castToIndicator = function () {
|
|
1389
|
+
return this.u3d_1.castToIndicator();
|
|
1390
|
+
};
|
|
1391
|
+
ProbTerm.prototype.castToInteger = function () {
|
|
1392
|
+
return this.u3d_1.castToInteger();
|
|
1393
|
+
};
|
|
1394
|
+
ProbTerm.prototype.castToList = function () {
|
|
1395
|
+
return this.u3d_1.castToList();
|
|
1396
|
+
};
|
|
1397
|
+
ProbTerm.prototype.castToNumeric = function () {
|
|
1398
|
+
return this.u3d_1.castToNumeric();
|
|
1399
|
+
};
|
|
1400
|
+
ProbTerm.prototype.castToReal = function () {
|
|
1401
|
+
return this.u3d_1.castToReal();
|
|
1402
|
+
};
|
|
1403
|
+
ProbTerm.prototype.castToRecursive = function () {
|
|
1404
|
+
return this.u3d_1.castToRecursive();
|
|
1405
|
+
};
|
|
1406
|
+
ProbTerm.prototype.castToRule = function () {
|
|
1407
|
+
return this.u3d_1.castToRule();
|
|
1408
|
+
};
|
|
1409
|
+
ProbTerm.prototype.castToStruct = function () {
|
|
1410
|
+
return this.u3d_1.castToStruct();
|
|
1411
|
+
};
|
|
1412
|
+
ProbTerm.prototype.castToTerm = function () {
|
|
1413
|
+
return this.u3d_1.castToTerm();
|
|
1414
|
+
};
|
|
1415
|
+
ProbTerm.prototype.castToTruth = function () {
|
|
1416
|
+
return this.u3d_1.castToTruth();
|
|
1417
|
+
};
|
|
1418
|
+
ProbTerm.prototype.castToTuple = function () {
|
|
1419
|
+
return this.u3d_1.castToTuple();
|
|
1420
|
+
};
|
|
1421
|
+
ProbTerm.prototype.castToVar = function () {
|
|
1422
|
+
return this.u3d_1.castToVar();
|
|
1423
|
+
};
|
|
1424
|
+
ProbTerm.prototype.containsTag = function (name) {
|
|
1425
|
+
return this.u3d_1.containsTag(name);
|
|
1426
|
+
};
|
|
1427
|
+
ProbTerm.prototype.equalsUsingVarCompleteNames = function (other, useVarCompleteName) {
|
|
1428
|
+
return this.u3d_1.equalsUsingVarCompleteNames(other, useVarCompleteName);
|
|
1429
|
+
};
|
|
1430
|
+
ProbTerm.prototype.getTag = function (name) {
|
|
1431
|
+
return this.u3d_1.getTag(name);
|
|
1432
|
+
};
|
|
1433
|
+
ProbTerm.prototype.resetTags = function (tags) {
|
|
1434
|
+
return this.u3d_1.resetTags(tags);
|
|
1435
|
+
};
|
|
1436
|
+
ProbTerm.prototype.structurallyEquals = function (other) {
|
|
1437
|
+
return this.u3d_1.structurallyEquals(other);
|
|
1438
|
+
};
|
|
1439
|
+
ProbTerm.prototype.iw = function () {
|
|
1440
|
+
var termCopy = this.s3d_1.freshCopy();
|
|
1441
|
+
var tmp$ret$2;
|
|
1442
|
+
// Inline function 'kotlin.collections.map' call
|
|
1443
|
+
var tmp0_map = this.t3d_1;
|
|
1444
|
+
var tmp$ret$1;
|
|
1445
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
1446
|
+
var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp0_map, 10));
|
|
1447
|
+
var tmp0_iterator = tmp0_map.j();
|
|
1448
|
+
while (tmp0_iterator.m()) {
|
|
1449
|
+
var item = tmp0_iterator.p();
|
|
1450
|
+
var tmp$ret$0;
|
|
1451
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.knowledge.ProbTerm.freshCopy.<anonymous>' call
|
|
1452
|
+
tmp$ret$0 = item.freshCopy();
|
|
1453
|
+
tmp0_mapTo.g(tmp$ret$0);
|
|
1454
|
+
}
|
|
1455
|
+
tmp$ret$1 = tmp0_mapTo;
|
|
1456
|
+
tmp$ret$2 = tmp$ret$1;
|
|
1457
|
+
return new ProbTerm(this.q3d_1, this.r3d_1, termCopy, toSet(tmp$ret$2));
|
|
1458
|
+
};
|
|
1459
|
+
ProbTerm.prototype.freshCopy = function () {
|
|
1460
|
+
return this.iw();
|
|
1461
|
+
};
|
|
1462
|
+
ProbTerm.prototype.jw = function (scope) {
|
|
1463
|
+
var termCopy = this.s3d_1.freshCopyFromScope(scope);
|
|
1464
|
+
var tmp$ret$2;
|
|
1465
|
+
// Inline function 'kotlin.collections.map' call
|
|
1466
|
+
var tmp0_map = this.t3d_1;
|
|
1467
|
+
var tmp$ret$1;
|
|
1468
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
1469
|
+
var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp0_map, 10));
|
|
1470
|
+
var tmp0_iterator = tmp0_map.j();
|
|
1471
|
+
while (tmp0_iterator.m()) {
|
|
1472
|
+
var item = tmp0_iterator.p();
|
|
1473
|
+
var tmp$ret$0;
|
|
1474
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.knowledge.ProbTerm.freshCopy.<anonymous>' call
|
|
1475
|
+
tmp$ret$0 = item.freshCopyFromScope(scope);
|
|
1476
|
+
tmp0_mapTo.g(tmp$ret$0);
|
|
1477
|
+
}
|
|
1478
|
+
tmp$ret$1 = tmp0_mapTo;
|
|
1479
|
+
tmp$ret$2 = tmp$ret$1;
|
|
1480
|
+
return new ProbTerm(this.q3d_1, this.r3d_1, termCopy, toSet(tmp$ret$2));
|
|
1481
|
+
};
|
|
1482
|
+
ProbTerm.prototype.freshCopyFromScope = function (scope) {
|
|
1483
|
+
return this.jw(scope);
|
|
1484
|
+
};
|
|
1485
|
+
ProbTerm.prototype.b2p = function (substitution, substitutions) {
|
|
1486
|
+
return this.c2p(substitution, substitutions.slice());
|
|
1487
|
+
};
|
|
1488
|
+
ProbTerm.prototype.getSubstituted = function (substitution, substitutions) {
|
|
1489
|
+
return this.b2p(substitution, substitutions);
|
|
1490
|
+
};
|
|
1491
|
+
ProbTerm.prototype.c2p = function (substitution, substitutions) {
|
|
1492
|
+
return this.s16(Companion_getInstance_9().ofSubstitution(substitution, substitutions.slice()));
|
|
1493
|
+
};
|
|
1494
|
+
ProbTerm.prototype.apply = function (substitution, substitutions) {
|
|
1495
|
+
return this.c2p(substitution, substitutions);
|
|
1496
|
+
};
|
|
1497
|
+
ProbTerm.prototype.s16 = function (substitution) {
|
|
1498
|
+
var tmp;
|
|
1499
|
+
if (substitution.d() ? true : this.jx()) {
|
|
1500
|
+
tmp = this;
|
|
1501
|
+
} else {
|
|
1502
|
+
var tmp_0;
|
|
1503
|
+
var tmp$ret$0;
|
|
1504
|
+
$l$block_0: {
|
|
1505
|
+
// Inline function 'kotlin.collections.any' call
|
|
1506
|
+
var tmp0_any = this.t3d_1;
|
|
1507
|
+
var tmp_1;
|
|
1508
|
+
if (isInterface(tmp0_any, Collection)) {
|
|
1509
|
+
tmp_1 = tmp0_any.d();
|
|
1510
|
+
} else {
|
|
1511
|
+
tmp_1 = false;
|
|
1512
|
+
}
|
|
1513
|
+
if (tmp_1) {
|
|
1514
|
+
tmp$ret$0 = false;
|
|
1515
|
+
break $l$block_0;
|
|
1516
|
+
}
|
|
1517
|
+
var tmp0_iterator = tmp0_any.j();
|
|
1518
|
+
while (tmp0_iterator.m()) {
|
|
1519
|
+
var element = tmp0_iterator.p();
|
|
1520
|
+
var tmp$ret$1;
|
|
1521
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.knowledge.ProbTerm.apply.<anonymous>' call
|
|
1522
|
+
tmp$ret$1 = element.bx();
|
|
1523
|
+
if (tmp$ret$1) {
|
|
1524
|
+
tmp$ret$0 = true;
|
|
1525
|
+
break $l$block_0;
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
tmp$ret$0 = false;
|
|
1529
|
+
}
|
|
1530
|
+
if (!tmp$ret$0) {
|
|
1531
|
+
tmp_0 = this.t3d_1;
|
|
1532
|
+
} else {
|
|
1533
|
+
var tmp$ret$5;
|
|
1534
|
+
// Inline function 'kotlin.collections.mapNotNull' call
|
|
1535
|
+
var tmp1_mapNotNull = this.t3d_1;
|
|
1536
|
+
var tmp$ret$4;
|
|
1537
|
+
// Inline function 'kotlin.collections.mapNotNullTo' call
|
|
1538
|
+
var tmp0_mapNotNullTo = ArrayList_init_$Create$_0();
|
|
1539
|
+
// Inline function 'kotlin.collections.forEach' call
|
|
1540
|
+
var tmp0_iterator_0 = tmp1_mapNotNull.j();
|
|
1541
|
+
while (tmp0_iterator_0.m()) {
|
|
1542
|
+
var element_0 = tmp0_iterator_0.p();
|
|
1543
|
+
// Inline function 'kotlin.collections.mapNotNullTo.<anonymous>' call
|
|
1544
|
+
var tmp$ret$2;
|
|
1545
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.knowledge.ProbTerm.apply.<anonymous>' call
|
|
1546
|
+
tmp$ret$2 = substitution.applyTo(element_0);
|
|
1547
|
+
var tmp0_safe_receiver = tmp$ret$2;
|
|
1548
|
+
if (tmp0_safe_receiver == null)
|
|
1549
|
+
null;
|
|
1550
|
+
else {
|
|
1551
|
+
var tmp$ret$3;
|
|
1552
|
+
// Inline function 'kotlin.let' call
|
|
1553
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
1554
|
+
tmp0_mapNotNullTo.g(tmp0_safe_receiver);
|
|
1555
|
+
tmp$ret$3 = Unit_getInstance();
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
tmp$ret$4 = tmp0_mapNotNullTo;
|
|
1559
|
+
tmp$ret$5 = tmp$ret$4;
|
|
1560
|
+
tmp_0 = toSet(tmp$ret$5);
|
|
1561
|
+
}
|
|
1562
|
+
var newExtraVars = tmp_0;
|
|
1563
|
+
tmp = new ProbTerm(this.q3d_1, this.r3d_1, this.s3d_1.applySubstitution(substitution), newExtraVars);
|
|
1564
|
+
}
|
|
1565
|
+
return tmp;
|
|
1566
|
+
};
|
|
1567
|
+
ProbTerm.prototype.applySubstitution = function (substitution) {
|
|
1568
|
+
return this.s16(substitution);
|
|
1569
|
+
};
|
|
1570
|
+
ProbTerm.prototype.jx = function () {
|
|
1571
|
+
var tmp$ret$0;
|
|
1572
|
+
// Inline function 'kotlin.getValue' call
|
|
1573
|
+
var tmp0_getValue = isGround$factory();
|
|
1574
|
+
tmp$ret$0 = this.v3d_1.b1();
|
|
1575
|
+
return tmp$ret$0;
|
|
1576
|
+
};
|
|
1577
|
+
ProbTerm.prototype.ax = function (other) {
|
|
1578
|
+
if (!(other instanceof ProbTerm)) {
|
|
1579
|
+
return compareTo.call(this, other);
|
|
1580
|
+
}
|
|
1581
|
+
var res = this.q3d_1.jd(other.q3d_1);
|
|
1582
|
+
if (!(res === 0))
|
|
1583
|
+
return res;
|
|
1584
|
+
res = this.s3d_1.ax(other.s3d_1);
|
|
1585
|
+
if (!(res === 0))
|
|
1586
|
+
return res;
|
|
1587
|
+
res = equals(this.t3d_1, other.t3d_1) ? 0 : -1;
|
|
1588
|
+
if (!(res === 0))
|
|
1589
|
+
return res;
|
|
1590
|
+
res = compareTo_0(this.r3d_1, other.r3d_1);
|
|
1591
|
+
return res;
|
|
1592
|
+
};
|
|
1593
|
+
ProbTerm.prototype.aa = function (other) {
|
|
1594
|
+
return this.ax((!(other == null) ? isInterface(other, Term) : false) ? other : THROW_CCE());
|
|
1595
|
+
};
|
|
1596
|
+
ProbTerm.prototype.equals = function (other) {
|
|
1597
|
+
var tmp;
|
|
1598
|
+
if (other instanceof ProbTerm) {
|
|
1599
|
+
tmp = this.ax(other) === 0;
|
|
1600
|
+
} else {
|
|
1601
|
+
tmp = false;
|
|
1602
|
+
}
|
|
1603
|
+
return tmp;
|
|
1604
|
+
};
|
|
1605
|
+
ProbTerm.prototype.hashCode = function () {
|
|
1606
|
+
return _get_cachedHashCode__d7x0zy(this);
|
|
1607
|
+
};
|
|
1608
|
+
ProbTerm.prototype.toString = function () {
|
|
1609
|
+
return '' + round(this.r3d_1 * 100) / 100.0 + '::' + this.s3d_1;
|
|
1610
|
+
};
|
|
1611
|
+
function isGround$factory() {
|
|
1612
|
+
return getPropertyCallableRef('isGround', 1, KProperty1, function (receiver) {
|
|
1613
|
+
return receiver.jx();
|
|
1614
|
+
}, null);
|
|
1615
|
+
}
|
|
1616
|
+
function cachedHashCode$factory() {
|
|
1617
|
+
return getPropertyCallableRef('cachedHashCode', 1, KProperty1, function (receiver) {
|
|
1618
|
+
return _get_cachedHashCode__d7x0zy(receiver);
|
|
1619
|
+
}, null);
|
|
1620
|
+
}
|
|
1621
|
+
function Companion_1() {
|
|
1622
|
+
Companion_instance_1 = this;
|
|
1623
|
+
}
|
|
1624
|
+
Companion_1.prototype.empty = function (unificator) {
|
|
1625
|
+
return this.ofIterable(unificator, emptyList());
|
|
1626
|
+
};
|
|
1627
|
+
Companion_1.prototype.of = function (unificator, clause) {
|
|
1628
|
+
return this.ofIterable(unificator, asIterable(clause));
|
|
1629
|
+
};
|
|
1630
|
+
Companion_1.prototype.ofSequence = function (unificator, clauses) {
|
|
1631
|
+
return this.ofIterable(unificator, asIterable_0(clauses));
|
|
1632
|
+
};
|
|
1633
|
+
Companion_1.prototype.ofScopes = function (unificator, clauses) {
|
|
1634
|
+
var tmp$ret$2;
|
|
1635
|
+
// Inline function 'kotlin.collections.map' call
|
|
1636
|
+
var tmp$ret$1;
|
|
1637
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
1638
|
+
var tmp0_mapTo = ArrayList_init_$Create$(clauses.length);
|
|
1639
|
+
var indexedObject = clauses;
|
|
1640
|
+
var inductionVariable = 0;
|
|
1641
|
+
var last = indexedObject.length;
|
|
1642
|
+
while (inductionVariable < last) {
|
|
1643
|
+
var item = indexedObject[inductionVariable];
|
|
1644
|
+
inductionVariable = inductionVariable + 1 | 0;
|
|
1645
|
+
var tmp$ret$0;
|
|
1646
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.knowledge.Companion.of.<anonymous>' call
|
|
1647
|
+
tmp$ret$0 = item(Companion_getInstance_7().empty());
|
|
1648
|
+
tmp0_mapTo.g(tmp$ret$0);
|
|
1649
|
+
}
|
|
1650
|
+
tmp$ret$1 = tmp0_mapTo;
|
|
1651
|
+
tmp$ret$2 = tmp$ret$1;
|
|
1652
|
+
return this.ofIterable(unificator, tmp$ret$2);
|
|
1653
|
+
};
|
|
1654
|
+
Companion_1.prototype.ofIterable = function (unificator, clauses) {
|
|
1655
|
+
var tmp;
|
|
1656
|
+
if (isInterface(clauses, MutableTheory)) {
|
|
1657
|
+
tmp = Companion_getInstance_20().ofIterable(unificator, clauses);
|
|
1658
|
+
} else {
|
|
1659
|
+
tmp = MappedProblogTheory_init_$Create$(clauses, unificator, null, 4, null);
|
|
1660
|
+
}
|
|
1661
|
+
return tmp;
|
|
1662
|
+
};
|
|
1663
|
+
var Companion_instance_1;
|
|
1664
|
+
function Companion_getInstance_22() {
|
|
1665
|
+
if (Companion_instance_1 == null)
|
|
1666
|
+
new Companion_1();
|
|
1667
|
+
return Companion_instance_1;
|
|
1668
|
+
}
|
|
1669
|
+
function ProblogTheory() {
|
|
1670
|
+
}
|
|
1671
|
+
function collectAllHeads($this, head, accumulator) {
|
|
1672
|
+
var tmp;
|
|
1673
|
+
if (isInterface(head, Struct)) {
|
|
1674
|
+
tmp = head.zv() === 2;
|
|
1675
|
+
} else {
|
|
1676
|
+
tmp = false;
|
|
1677
|
+
}
|
|
1678
|
+
if (tmp) {
|
|
1679
|
+
var tmp_0;
|
|
1680
|
+
var tmp_1 = head.fw();
|
|
1681
|
+
Companion_getInstance_11();
|
|
1682
|
+
if (!(tmp_1 === ';')) {
|
|
1683
|
+
tmp_0 = !(head.fw() === get_ANNOTATION_FUNCTOR());
|
|
1684
|
+
} else {
|
|
1685
|
+
tmp_0 = false;
|
|
1686
|
+
}
|
|
1687
|
+
if (tmp_0) {
|
|
1688
|
+
throw TuPrologException_init_$Create$('Badly formatted disjoint annotation: ' + head);
|
|
1689
|
+
}
|
|
1690
|
+
var tmp_2 = head.fw();
|
|
1691
|
+
Companion_getInstance_11();
|
|
1692
|
+
if (tmp_2 === ';') {
|
|
1693
|
+
collectAllHeads($this, head.get(1), accumulator);
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
var curHeadProb = 1.0;
|
|
1697
|
+
var curHead = head;
|
|
1698
|
+
if (isInterface(head, Struct)) {
|
|
1699
|
+
var tmp_3;
|
|
1700
|
+
var tmp_4 = head.fw();
|
|
1701
|
+
Companion_getInstance_11();
|
|
1702
|
+
if (tmp_4 === ';') {
|
|
1703
|
+
tmp_3 = head.get(0);
|
|
1704
|
+
} else {
|
|
1705
|
+
tmp_3 = head;
|
|
1706
|
+
}
|
|
1707
|
+
curHead = tmp_3;
|
|
1708
|
+
var tmp_5;
|
|
1709
|
+
if (isInterface(curHead, Struct)) {
|
|
1710
|
+
tmp_5 = curHead.fw() === get_ANNOTATION_FUNCTOR();
|
|
1711
|
+
} else {
|
|
1712
|
+
tmp_5 = false;
|
|
1713
|
+
}
|
|
1714
|
+
if (tmp_5) {
|
|
1715
|
+
var curHeadProbTerm = curHead.get(0);
|
|
1716
|
+
var tmp0_subject = curHeadProbTerm;
|
|
1717
|
+
var tmp_6;
|
|
1718
|
+
if (isInterface(tmp0_subject, Numeric)) {
|
|
1719
|
+
tmp_6 = curHeadProbTerm.x10().toDouble();
|
|
1720
|
+
} else {
|
|
1721
|
+
tmp_6 = solveArithmeticExpression(curHeadProbTerm);
|
|
1722
|
+
}
|
|
1723
|
+
curHeadProb = tmp_6;
|
|
1724
|
+
curHead = curHead.get(1);
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1727
|
+
accumulator.g(Companion_getInstance_3().of(get_ANNOTATION_FUNCTOR(), [Companion_getInstance_10().ofDouble(curHeadProb), curHead]));
|
|
1728
|
+
}
|
|
1729
|
+
function AnnotatedDisjunctionClauseMapper() {
|
|
1730
|
+
AnnotatedDisjunctionClauseMapper_instance = this;
|
|
1731
|
+
}
|
|
1732
|
+
AnnotatedDisjunctionClauseMapper.prototype.a3e = function (clause) {
|
|
1733
|
+
var tmp;
|
|
1734
|
+
if (isInterface(clause, Rule)) {
|
|
1735
|
+
var tmp_0 = clause.ly().fw();
|
|
1736
|
+
Companion_getInstance_11();
|
|
1737
|
+
tmp = tmp_0 === ';';
|
|
1738
|
+
} else {
|
|
1739
|
+
tmp = false;
|
|
1740
|
+
}
|
|
1741
|
+
return tmp;
|
|
1742
|
+
};
|
|
1743
|
+
AnnotatedDisjunctionClauseMapper.prototype.b3e = function (clause) {
|
|
1744
|
+
if (!isInterface(clause, Rule)) {
|
|
1745
|
+
var tmp = 'Clause is not an instance of Rule: ' + clause;
|
|
1746
|
+
throw ClauseMappingException_init_$Create$(tmp, null, 2, null);
|
|
1747
|
+
}
|
|
1748
|
+
var body = clause.my();
|
|
1749
|
+
var tmp$ret$0;
|
|
1750
|
+
// Inline function 'kotlin.collections.mutableListOf' call
|
|
1751
|
+
tmp$ret$0 = ArrayList_init_$Create$_0();
|
|
1752
|
+
var disjointHeads = tmp$ret$0;
|
|
1753
|
+
collectAllHeads(this, clause.ly(), disjointHeads);
|
|
1754
|
+
var probSum = 0.0;
|
|
1755
|
+
var tmp$ret$3;
|
|
1756
|
+
// Inline function 'kotlin.collections.map' call
|
|
1757
|
+
var tmp$ret$2;
|
|
1758
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
1759
|
+
var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(disjointHeads, 10));
|
|
1760
|
+
var tmp0_iterator = disjointHeads.j();
|
|
1761
|
+
while (tmp0_iterator.m()) {
|
|
1762
|
+
var item = tmp0_iterator.p();
|
|
1763
|
+
var tmp$ret$1;
|
|
1764
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.knowledge.impl.AnnotatedDisjunctionClauseMapper.apply.<anonymous>' call
|
|
1765
|
+
var tmp_0 = item.get(0);
|
|
1766
|
+
var curProb = (isInterface(tmp_0, Numeric) ? tmp_0 : THROW_CCE()).x10().toDouble();
|
|
1767
|
+
var tmp_1;
|
|
1768
|
+
var tmp_2 = item.get(1);
|
|
1769
|
+
if (isInterface(tmp_2, Struct)) {
|
|
1770
|
+
var tmp_3 = item.get(1);
|
|
1771
|
+
tmp_1 = isInterface(tmp_3, Struct) ? tmp_3 : THROW_CCE();
|
|
1772
|
+
} else {
|
|
1773
|
+
tmp_1 = Companion_getInstance_3().of(item.get(1).toString(), []);
|
|
1774
|
+
}
|
|
1775
|
+
var curRuleHead = tmp_1;
|
|
1776
|
+
probSum = probSum + curProb;
|
|
1777
|
+
tmp$ret$1 = ProbabilisticClauseMapper_getInstance().c3e(Companion_getInstance_12().of(Companion_getInstance_3().of(get_ANNOTATION_FUNCTOR(), [Companion_getInstance_10().ofDouble(curProb / (1.0 - (probSum - curProb))), curRuleHead]), [body]));
|
|
1778
|
+
tmp0_mapTo.g(tmp$ret$1);
|
|
1779
|
+
}
|
|
1780
|
+
tmp$ret$2 = tmp0_mapTo;
|
|
1781
|
+
tmp$ret$3 = tmp$ret$2;
|
|
1782
|
+
var mappedRules = toList_0(tmp$ret$3);
|
|
1783
|
+
var explanation = Companion_getInstance_21().l3d_1;
|
|
1784
|
+
var tmp$ret$6;
|
|
1785
|
+
// Inline function 'kotlin.collections.map' call
|
|
1786
|
+
var tmp$ret$5;
|
|
1787
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
1788
|
+
var tmp0_mapTo_0 = ArrayList_init_$Create$(collectionSizeOrDefault(mappedRules, 10));
|
|
1789
|
+
var tmp0_iterator_0 = mappedRules.j();
|
|
1790
|
+
while (tmp0_iterator_0.m()) {
|
|
1791
|
+
var item_0 = tmp0_iterator_0.p();
|
|
1792
|
+
var tmp$ret$4;
|
|
1793
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.knowledge.impl.AnnotatedDisjunctionClauseMapper.apply.<anonymous>' call
|
|
1794
|
+
var thisExplanation = Companion_getInstance_21().p3d(item_0.h4_1);
|
|
1795
|
+
var resultExplanation = thisExplanation.and(explanation);
|
|
1796
|
+
explanation = explanation.and(thisExplanation.not());
|
|
1797
|
+
tmp$ret$4 = ProbabilisticClauseMapper_getInstance().d3e(item_0.g4_1, resultExplanation);
|
|
1798
|
+
tmp0_mapTo_0.g(tmp$ret$4);
|
|
1799
|
+
}
|
|
1800
|
+
tmp$ret$5 = tmp0_mapTo_0;
|
|
1801
|
+
tmp$ret$6 = tmp$ret$5;
|
|
1802
|
+
return tmp$ret$6;
|
|
1803
|
+
};
|
|
1804
|
+
var AnnotatedDisjunctionClauseMapper_instance;
|
|
1805
|
+
function AnnotatedDisjunctionClauseMapper_getInstance() {
|
|
1806
|
+
if (AnnotatedDisjunctionClauseMapper_instance == null)
|
|
1807
|
+
new AnnotatedDisjunctionClauseMapper();
|
|
1808
|
+
return AnnotatedDisjunctionClauseMapper_instance;
|
|
1809
|
+
}
|
|
1810
|
+
function BinaryDecisionDiagramExplanation_init_$Init$(diagram, computedValue, $mask0, $marker, $this) {
|
|
1811
|
+
if (!(($mask0 & 2) === 0))
|
|
1812
|
+
computedValue = Companion_getInstance_23().m3d_1;
|
|
1813
|
+
BinaryDecisionDiagramExplanation.call($this, diagram, computedValue);
|
|
1814
|
+
return $this;
|
|
1815
|
+
}
|
|
1816
|
+
function BinaryDecisionDiagramExplanation_init_$Create$(diagram, computedValue, $mask0, $marker) {
|
|
1817
|
+
return BinaryDecisionDiagramExplanation_init_$Init$(diagram, computedValue, $mask0, $marker, Object.create(BinaryDecisionDiagramExplanation.prototype));
|
|
1818
|
+
}
|
|
1819
|
+
function ComputedValue(probability) {
|
|
1820
|
+
this.e3e_1 = probability;
|
|
1821
|
+
}
|
|
1822
|
+
ComputedValue.prototype.toString = function () {
|
|
1823
|
+
return 'ComputedValue(probability=' + this.e3e_1 + ')';
|
|
1824
|
+
};
|
|
1825
|
+
ComputedValue.prototype.hashCode = function () {
|
|
1826
|
+
return this.e3e_1 == null ? 0 : getNumberHashCode(this.e3e_1);
|
|
1827
|
+
};
|
|
1828
|
+
ComputedValue.prototype.equals = function (other) {
|
|
1829
|
+
if (this === other)
|
|
1830
|
+
return true;
|
|
1831
|
+
if (!(other instanceof ComputedValue))
|
|
1832
|
+
return false;
|
|
1833
|
+
var tmp0_other_with_cast = other instanceof ComputedValue ? other : THROW_CCE();
|
|
1834
|
+
if (!equals(this.e3e_1, tmp0_other_with_cast.e3e_1))
|
|
1835
|
+
return false;
|
|
1836
|
+
return true;
|
|
1837
|
+
};
|
|
1838
|
+
function Companion_2() {
|
|
1839
|
+
Companion_instance_2 = this;
|
|
1840
|
+
this.m3d_1 = new ComputedValue(null);
|
|
1841
|
+
this.n3d_1 = new ComputedValue(0.0);
|
|
1842
|
+
this.o3d_1 = new ComputedValue(1.0);
|
|
1843
|
+
}
|
|
1844
|
+
var Companion_instance_2;
|
|
1845
|
+
function Companion_getInstance_23() {
|
|
1846
|
+
if (Companion_instance_2 == null)
|
|
1847
|
+
new Companion_2();
|
|
1848
|
+
return Companion_instance_2;
|
|
1849
|
+
}
|
|
1850
|
+
function getAsInternal($this, that) {
|
|
1851
|
+
if (!(that instanceof BinaryDecisionDiagramExplanation)) {
|
|
1852
|
+
throw UnsupportedOperationException_init_$Create$('that does not support Binary Decision Diagrams');
|
|
1853
|
+
}
|
|
1854
|
+
return that;
|
|
1855
|
+
}
|
|
1856
|
+
function computeExpansion($this, value, low, high) {
|
|
1857
|
+
var tmp;
|
|
1858
|
+
if (!(low.e3e_1 == null) ? !(high.e3e_1 == null) : false) {
|
|
1859
|
+
tmp = value.r3d_1 * high.e3e_1 + (1.0 - value.r3d_1) * low.e3e_1;
|
|
1860
|
+
} else {
|
|
1861
|
+
tmp = null;
|
|
1862
|
+
}
|
|
1863
|
+
return new ComputedValue(tmp);
|
|
1864
|
+
}
|
|
1865
|
+
function _get_cachedNot__l38068($this) {
|
|
1866
|
+
var tmp$ret$0;
|
|
1867
|
+
// Inline function 'kotlin.getValue' call
|
|
1868
|
+
var tmp0_getValue = cachedNot$factory();
|
|
1869
|
+
tmp$ret$0 = $this.l3c_1.b1();
|
|
1870
|
+
return tmp$ret$0;
|
|
1871
|
+
}
|
|
1872
|
+
function BinaryDecisionDiagramExplanation$cachedNot$delegate$lambda$lambda(this$0) {
|
|
1873
|
+
return function (node, low, high) {
|
|
1874
|
+
return computeExpansion(this$0, node, low, high);
|
|
1875
|
+
};
|
|
1876
|
+
}
|
|
1877
|
+
function BinaryDecisionDiagramExplanation$cachedNot$delegate$lambda(this$0) {
|
|
1878
|
+
return function () {
|
|
1879
|
+
var tmp = Companion_getInstance_23().n3d_1;
|
|
1880
|
+
var tmp_0 = Companion_getInstance_23().o3d_1;
|
|
1881
|
+
var result = notThenExpansion(this$0.j3c_1, tmp, tmp_0, BinaryDecisionDiagramExplanation$cachedNot$delegate$lambda$lambda(this$0));
|
|
1882
|
+
return new BinaryDecisionDiagramExplanation(result.g4_1, result.h4_1);
|
|
1883
|
+
};
|
|
1884
|
+
}
|
|
1885
|
+
function BinaryDecisionDiagramExplanation$and$lambda(this$0) {
|
|
1886
|
+
return function (node, low, high) {
|
|
1887
|
+
return computeExpansion(this$0, node, low, high);
|
|
1888
|
+
};
|
|
1889
|
+
}
|
|
1890
|
+
function BinaryDecisionDiagramExplanation$or$lambda(this$0) {
|
|
1891
|
+
return function (node, low, high) {
|
|
1892
|
+
return computeExpansion(this$0, node, low, high);
|
|
1893
|
+
};
|
|
1894
|
+
}
|
|
1895
|
+
function BinaryDecisionDiagramExplanation$probability$delegate$lambda$lambda(node, low, high) {
|
|
1896
|
+
return node.r3d_1 * high + (1.0 - node.r3d_1) * low;
|
|
1897
|
+
}
|
|
1898
|
+
function BinaryDecisionDiagramExplanation$probability$delegate$lambda(this$0) {
|
|
1899
|
+
return function () {
|
|
1900
|
+
var tmp0_elvis_lhs = this$0.k3c_1.e3e_1;
|
|
1901
|
+
var tmp;
|
|
1902
|
+
if (tmp0_elvis_lhs == null) {
|
|
1903
|
+
tmp = expansion(this$0.j3c_1, 0.0, 1.0, BinaryDecisionDiagramExplanation$probability$delegate$lambda$lambda);
|
|
1904
|
+
} else {
|
|
1905
|
+
tmp = tmp0_elvis_lhs;
|
|
1906
|
+
}
|
|
1907
|
+
return tmp;
|
|
1908
|
+
};
|
|
1909
|
+
}
|
|
1910
|
+
function BinaryDecisionDiagramExplanation$containsAnyNotGroundTerm$delegate$lambda$lambda(it) {
|
|
1911
|
+
return !it.jx();
|
|
1912
|
+
}
|
|
1913
|
+
function BinaryDecisionDiagramExplanation$containsAnyNotGroundTerm$delegate$lambda(this$0) {
|
|
1914
|
+
return function () {
|
|
1915
|
+
return anyWhere(this$0.j3c_1, BinaryDecisionDiagramExplanation$containsAnyNotGroundTerm$delegate$lambda$lambda);
|
|
1916
|
+
};
|
|
1917
|
+
}
|
|
1918
|
+
function BinaryDecisionDiagramExplanation$apply$lambda($transformation) {
|
|
1919
|
+
return function (it) {
|
|
1920
|
+
return $transformation(it);
|
|
1921
|
+
};
|
|
1922
|
+
}
|
|
1923
|
+
function BinaryDecisionDiagramExplanation(diagram, computedValue) {
|
|
1924
|
+
Companion_getInstance_23();
|
|
1925
|
+
this.j3c_1 = diagram;
|
|
1926
|
+
this.k3c_1 = computedValue;
|
|
1927
|
+
var tmp = this;
|
|
1928
|
+
tmp.l3c_1 = lazy(BinaryDecisionDiagramExplanation$cachedNot$delegate$lambda(this));
|
|
1929
|
+
var tmp_0 = this;
|
|
1930
|
+
tmp_0.m3c_1 = lazy(BinaryDecisionDiagramExplanation$probability$delegate$lambda(this));
|
|
1931
|
+
var tmp_1 = this;
|
|
1932
|
+
tmp_1.n3c_1 = lazy(BinaryDecisionDiagramExplanation$containsAnyNotGroundTerm$delegate$lambda(this));
|
|
1933
|
+
}
|
|
1934
|
+
BinaryDecisionDiagramExplanation.prototype.f3e = function () {
|
|
1935
|
+
return _get_cachedNot__l38068(this);
|
|
1936
|
+
};
|
|
1937
|
+
BinaryDecisionDiagramExplanation.prototype.not = function () {
|
|
1938
|
+
return this.f3e();
|
|
1939
|
+
};
|
|
1940
|
+
BinaryDecisionDiagramExplanation.prototype.g3e = function (that) {
|
|
1941
|
+
var tmp = getAsInternal(this, that).j3c_1;
|
|
1942
|
+
var tmp_0 = Companion_getInstance_23().n3d_1;
|
|
1943
|
+
var tmp_1 = Companion_getInstance_23().o3d_1;
|
|
1944
|
+
var result = andThenExpansion(this.j3c_1, tmp, tmp_0, tmp_1, BinaryDecisionDiagramExplanation$and$lambda(this));
|
|
1945
|
+
return new BinaryDecisionDiagramExplanation(result.g4_1, result.h4_1);
|
|
1946
|
+
};
|
|
1947
|
+
BinaryDecisionDiagramExplanation.prototype.and = function (that) {
|
|
1948
|
+
return this.g3e(that);
|
|
1949
|
+
};
|
|
1950
|
+
BinaryDecisionDiagramExplanation.prototype.h3e = function (that) {
|
|
1951
|
+
var tmp = getAsInternal(this, that).j3c_1;
|
|
1952
|
+
var tmp_0 = Companion_getInstance_23().n3d_1;
|
|
1953
|
+
var tmp_1 = Companion_getInstance_23().o3d_1;
|
|
1954
|
+
var result = orThenExpansion(this.j3c_1, tmp, tmp_0, tmp_1, BinaryDecisionDiagramExplanation$or$lambda(this));
|
|
1955
|
+
return new BinaryDecisionDiagramExplanation(result.g4_1, result.h4_1);
|
|
1956
|
+
};
|
|
1957
|
+
BinaryDecisionDiagramExplanation.prototype.or = function (that) {
|
|
1958
|
+
return this.h3e(that);
|
|
1959
|
+
};
|
|
1960
|
+
BinaryDecisionDiagramExplanation.prototype.x3d = function () {
|
|
1961
|
+
var tmp$ret$0;
|
|
1962
|
+
// Inline function 'kotlin.getValue' call
|
|
1963
|
+
var tmp0_getValue = probability$factory();
|
|
1964
|
+
tmp$ret$0 = this.m3c_1.b1();
|
|
1965
|
+
return tmp$ret$0;
|
|
1966
|
+
};
|
|
1967
|
+
BinaryDecisionDiagramExplanation.prototype.z3d = function () {
|
|
1968
|
+
var tmp$ret$0;
|
|
1969
|
+
// Inline function 'kotlin.getValue' call
|
|
1970
|
+
var tmp0_getValue = containsAnyNotGroundTerm$factory();
|
|
1971
|
+
tmp$ret$0 = this.n3c_1.b1();
|
|
1972
|
+
return tmp$ret$0;
|
|
1973
|
+
};
|
|
1974
|
+
BinaryDecisionDiagramExplanation.prototype.toString = function () {
|
|
1975
|
+
return 'bdd:' + hashCode(this.j3c_1);
|
|
1976
|
+
};
|
|
1977
|
+
BinaryDecisionDiagramExplanation.prototype.i3e = function (transformation) {
|
|
1978
|
+
var tmp = map_0(this.j3c_1, BinaryDecisionDiagramExplanation$apply$lambda(transformation));
|
|
1979
|
+
return BinaryDecisionDiagramExplanation_init_$Create$(tmp, null, 2, null);
|
|
1980
|
+
};
|
|
1981
|
+
BinaryDecisionDiagramExplanation.prototype.applyTransformation = function (transformation) {
|
|
1982
|
+
return this.i3e(transformation);
|
|
1983
|
+
};
|
|
1984
|
+
function cachedNot$factory() {
|
|
1985
|
+
return getPropertyCallableRef('cachedNot', 1, KProperty1, function (receiver) {
|
|
1986
|
+
return _get_cachedNot__l38068(receiver);
|
|
1987
|
+
}, null);
|
|
1988
|
+
}
|
|
1989
|
+
function probability$factory() {
|
|
1990
|
+
return getPropertyCallableRef('probability', 1, KProperty1, function (receiver) {
|
|
1991
|
+
return receiver.x3d();
|
|
1992
|
+
}, null);
|
|
1993
|
+
}
|
|
1994
|
+
function containsAnyNotGroundTerm$factory() {
|
|
1995
|
+
return getPropertyCallableRef('containsAnyNotGroundTerm', 1, KProperty1, function (receiver) {
|
|
1996
|
+
return receiver.z3d();
|
|
1997
|
+
}, null);
|
|
1998
|
+
}
|
|
1999
|
+
function get_nonWrappableFunctors() {
|
|
2000
|
+
init_properties_ClauseMappingUtils_kt_i29ma0();
|
|
2001
|
+
return nonWrappableFunctors;
|
|
2002
|
+
}
|
|
2003
|
+
var nonWrappableFunctors;
|
|
2004
|
+
function ClauseMappingUtils() {
|
|
2005
|
+
ClauseMappingUtils_instance = this;
|
|
2006
|
+
this.j3e_1 = new Long(1, 0);
|
|
2007
|
+
this.k3e_1 = listOf_0([DirectiveClauseMapper_getInstance(), AnnotatedDisjunctionClauseMapper_getInstance(), ProbabilisticClauseMapper_getInstance(), EvidenceClauseMapper_getInstance(), PrologClauseMapper_getInstance(), NothingClauseMapper_getInstance()]);
|
|
2008
|
+
}
|
|
2009
|
+
ClauseMappingUtils.prototype.l3e = function () {
|
|
2010
|
+
var tmp0_this = this;
|
|
2011
|
+
var tmp1 = tmp0_this.j3e_1;
|
|
2012
|
+
tmp0_this.j3e_1 = tmp1.gh();
|
|
2013
|
+
return tmp1;
|
|
2014
|
+
};
|
|
2015
|
+
ClauseMappingUtils.prototype.m3e = function (clause) {
|
|
2016
|
+
var tmp;
|
|
2017
|
+
if (get_isMappedAsProblog(clause)) {
|
|
2018
|
+
tmp = listOf(clause);
|
|
2019
|
+
} else {
|
|
2020
|
+
var tmp$ret$4;
|
|
2021
|
+
// Inline function 'kotlin.collections.map' call
|
|
2022
|
+
var tmp$ret$1;
|
|
2023
|
+
$l$block: {
|
|
2024
|
+
// Inline function 'kotlin.collections.first' call
|
|
2025
|
+
var tmp0_first = this.k3e_1;
|
|
2026
|
+
var tmp0_iterator = tmp0_first.j();
|
|
2027
|
+
while (tmp0_iterator.m()) {
|
|
2028
|
+
var element = tmp0_iterator.p();
|
|
2029
|
+
var tmp$ret$0;
|
|
2030
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.knowledge.impl.ClauseMappingUtils.map.<anonymous>' call
|
|
2031
|
+
tmp$ret$0 = element.a3e(clause);
|
|
2032
|
+
if (tmp$ret$0) {
|
|
2033
|
+
tmp$ret$1 = element;
|
|
2034
|
+
break $l$block;
|
|
2035
|
+
}
|
|
2036
|
+
}
|
|
2037
|
+
throw NoSuchElementException_init_$Create$('Collection contains no element matching the predicate.');
|
|
2038
|
+
}
|
|
2039
|
+
var tmp1_map = tmp$ret$1.b3e(clause);
|
|
2040
|
+
var tmp$ret$3;
|
|
2041
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
2042
|
+
var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp1_map, 10));
|
|
2043
|
+
var tmp0_iterator_0 = tmp1_map.j();
|
|
2044
|
+
while (tmp0_iterator_0.m()) {
|
|
2045
|
+
var item = tmp0_iterator_0.p();
|
|
2046
|
+
var tmp$ret$2;
|
|
2047
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.knowledge.impl.ClauseMappingUtils.map.<anonymous>' call
|
|
2048
|
+
tmp$ret$2 = setMappedAsProblog(item, true);
|
|
2049
|
+
tmp0_mapTo.g(tmp$ret$2);
|
|
2050
|
+
}
|
|
2051
|
+
tmp$ret$3 = tmp0_mapTo;
|
|
2052
|
+
tmp$ret$4 = tmp$ret$3;
|
|
2053
|
+
tmp = tmp$ret$4;
|
|
2054
|
+
}
|
|
2055
|
+
return tmp;
|
|
2056
|
+
};
|
|
2057
|
+
ClauseMappingUtils.prototype.n3e = function (indicator) {
|
|
2058
|
+
var arityTerm = indicator.o10();
|
|
2059
|
+
var tmp = Companion_getInstance_13();
|
|
2060
|
+
var tmp_0 = indicator.n10();
|
|
2061
|
+
var tmp0_subject = arityTerm;
|
|
2062
|
+
var tmp_1;
|
|
2063
|
+
if (isInterface(tmp0_subject, Numeric)) {
|
|
2064
|
+
tmp_1 = Companion_getInstance_10().ofInteger(arityTerm.p10().toInt() + 1 | 0);
|
|
2065
|
+
} else {
|
|
2066
|
+
tmp_1 = arityTerm;
|
|
2067
|
+
}
|
|
2068
|
+
return tmp.of(tmp_0, tmp_1);
|
|
2069
|
+
};
|
|
2070
|
+
var ClauseMappingUtils_instance;
|
|
2071
|
+
function ClauseMappingUtils_getInstance() {
|
|
2072
|
+
if (ClauseMappingUtils_instance == null)
|
|
2073
|
+
new ClauseMappingUtils();
|
|
2074
|
+
return ClauseMappingUtils_instance;
|
|
2075
|
+
}
|
|
2076
|
+
function toTerm(_this__u8e3s4) {
|
|
2077
|
+
init_properties_ClauseMappingUtils_kt_i29ma0();
|
|
2078
|
+
return new ProbExplanationTerm(_this__u8e3s4);
|
|
2079
|
+
}
|
|
2080
|
+
function safeToStruct(_this__u8e3s4) {
|
|
2081
|
+
init_properties_ClauseMappingUtils_kt_i29ma0();
|
|
2082
|
+
var tmp;
|
|
2083
|
+
if (isInterface(_this__u8e3s4, Struct)) {
|
|
2084
|
+
tmp = _this__u8e3s4;
|
|
2085
|
+
} else {
|
|
2086
|
+
tmp = Companion_getInstance_3().of(_this__u8e3s4.toString(), []);
|
|
2087
|
+
}
|
|
2088
|
+
return tmp;
|
|
2089
|
+
}
|
|
2090
|
+
function withBodyExplanation(_this__u8e3s4, explanation) {
|
|
2091
|
+
init_properties_ClauseMappingUtils_kt_i29ma0();
|
|
2092
|
+
var tmp$ret$0;
|
|
2093
|
+
// Inline function 'it.unibo.tuprolog.solve.AbstractWrapper.functor' call
|
|
2094
|
+
var tmp0__get_functor__thl4dk = Prob_getInstance();
|
|
2095
|
+
tmp$ret$0 = tmp0__get_functor__thl4dk.signature.name;
|
|
2096
|
+
var tmp = tmp$ret$0;
|
|
2097
|
+
return wrapInPredicateRecursive$default(_this__u8e3s4, tmp, explanation, 0, 4, null);
|
|
2098
|
+
}
|
|
2099
|
+
function withExplanation(_this__u8e3s4, explanation) {
|
|
2100
|
+
init_properties_ClauseMappingUtils_kt_i29ma0();
|
|
2101
|
+
var tmp;
|
|
2102
|
+
if (!get_isWrappableWithExplanation(_this__u8e3s4)) {
|
|
2103
|
+
tmp = withExplanationNonWrappable(_this__u8e3s4, explanation);
|
|
2104
|
+
} else {
|
|
2105
|
+
var tmp0_subject = _this__u8e3s4;
|
|
2106
|
+
var tmp_0;
|
|
2107
|
+
if (isInterface(tmp0_subject, Struct)) {
|
|
2108
|
+
tmp_0 = Companion_getInstance_3().ofList(_this__u8e3s4.fw(), plus(_this__u8e3s4.gw(), explanation));
|
|
2109
|
+
} else {
|
|
2110
|
+
tmp_0 = Companion_getInstance_3().of(_this__u8e3s4.toString(), [explanation]);
|
|
2111
|
+
}
|
|
2112
|
+
tmp = tmp_0;
|
|
2113
|
+
}
|
|
2114
|
+
return tmp;
|
|
2115
|
+
}
|
|
2116
|
+
function get_isMappedAsProblog(_this__u8e3s4) {
|
|
2117
|
+
init_properties_ClauseMappingUtils_kt_i29ma0();
|
|
2118
|
+
var tmp0_elvis_lhs = _this__u8e3s4.getTag('it.unibo.tuprolog.problog.mapped');
|
|
2119
|
+
return tmp0_elvis_lhs == null ? false : tmp0_elvis_lhs;
|
|
2120
|
+
}
|
|
2121
|
+
function setMappedAsProblog(_this__u8e3s4, value) {
|
|
2122
|
+
init_properties_ClauseMappingUtils_kt_i29ma0();
|
|
2123
|
+
return setTag(_this__u8e3s4, 'it.unibo.tuprolog.problog.mapped', value);
|
|
2124
|
+
}
|
|
2125
|
+
function wrapInPredicateRecursive(_this__u8e3s4, functor, explanation, depth) {
|
|
2126
|
+
init_properties_ClauseMappingUtils_kt_i29ma0();
|
|
2127
|
+
var tmp0_subject = _this__u8e3s4;
|
|
2128
|
+
var tmp;
|
|
2129
|
+
if (isInterface(tmp0_subject, Struct)) {
|
|
2130
|
+
var tmp1_subject = _this__u8e3s4.fw();
|
|
2131
|
+
var tmp_0;
|
|
2132
|
+
switch (tmp1_subject) {
|
|
2133
|
+
case ',':
|
|
2134
|
+
var tmp_1 = Companion_getInstance_1();
|
|
2135
|
+
ProblogLib_getInstance();
|
|
2136
|
+
var leftVar = tmp_1.of('EXPL' + '_A_' + depth);
|
|
2137
|
+
var tmp_2 = Companion_getInstance_1();
|
|
2138
|
+
ProblogLib_getInstance();
|
|
2139
|
+
var rightVar = tmp_2.of('EXPL' + '_B_' + depth);
|
|
2140
|
+
var tmp_3 = Companion_getInstance_2();
|
|
2141
|
+
var tmp_4 = wrapInPredicateRecursive(_this__u8e3s4.get(0), functor, leftVar, depth + 1 | 0);
|
|
2142
|
+
var tmp_5 = wrapInPredicateRecursive(_this__u8e3s4.get(1), functor, rightVar, depth + 1 | 0);
|
|
2143
|
+
var tmp_6 = Companion_getInstance_3();
|
|
2144
|
+
var tmp$ret$0;
|
|
2145
|
+
// Inline function 'it.unibo.tuprolog.solve.AbstractWrapper.functor' call
|
|
2146
|
+
var tmp0__get_functor__thl4dk = ProbExplAnd_getInstance();
|
|
2147
|
+
tmp$ret$0 = tmp0__get_functor__thl4dk.signature.name;
|
|
2148
|
+
|
|
2149
|
+
tmp_0 = tmp_3.ofMany(tmp_4, tmp_5, [tmp_6.of(tmp$ret$0, [explanation, leftVar, rightVar])]);
|
|
2150
|
+
break;
|
|
2151
|
+
case ';':
|
|
2152
|
+
tmp_0 = Companion_getInstance_3().of(';', [wrapInPredicateRecursive(_this__u8e3s4.get(0), functor, explanation, depth + 1 | 0), wrapInPredicateRecursive(_this__u8e3s4.get(1), functor, explanation, depth + 1 | 0)]);
|
|
2153
|
+
break;
|
|
2154
|
+
case '->':
|
|
2155
|
+
tmp_0 = Companion_getInstance_3().of('->', [wrapInPredicateRecursive(_this__u8e3s4.get(0), functor, Companion_getInstance_1().anonymous(), depth + 1 | 0), wrapInPredicateRecursive(_this__u8e3s4.get(1), functor, explanation, depth + 1 | 0)]);
|
|
2156
|
+
break;
|
|
2157
|
+
default:
|
|
2158
|
+
tmp_0 = wrapInPredicate(_this__u8e3s4, functor, explanation);
|
|
2159
|
+
break;
|
|
2160
|
+
}
|
|
2161
|
+
tmp = tmp_0;
|
|
2162
|
+
} else {
|
|
2163
|
+
tmp = wrapInPredicate(_this__u8e3s4, functor, explanation);
|
|
2164
|
+
}
|
|
2165
|
+
return tmp;
|
|
2166
|
+
}
|
|
2167
|
+
function wrapInPredicateRecursive$default(_this__u8e3s4, functor, explanation, depth, $mask0, $handler) {
|
|
2168
|
+
if (!(($mask0 & 4) === 0))
|
|
2169
|
+
depth = 1;
|
|
2170
|
+
return wrapInPredicateRecursive(_this__u8e3s4, functor, explanation, depth);
|
|
2171
|
+
}
|
|
2172
|
+
function get_isWrappableWithExplanation(_this__u8e3s4) {
|
|
2173
|
+
init_properties_ClauseMappingUtils_kt_i29ma0();
|
|
2174
|
+
return !get_nonWrappableFunctors().v(safeToStruct(_this__u8e3s4).fw());
|
|
2175
|
+
}
|
|
2176
|
+
function withExplanationNonWrappable(_this__u8e3s4, explanation) {
|
|
2177
|
+
init_properties_ClauseMappingUtils_kt_i29ma0();
|
|
2178
|
+
return Companion_getInstance_2().of(_this__u8e3s4, Companion_getInstance_3().of('=', [explanation, toTerm(Companion_getInstance_21().l3d_1)]));
|
|
2179
|
+
}
|
|
2180
|
+
function wrapInPredicate(_this__u8e3s4, functor, explanation) {
|
|
2181
|
+
init_properties_ClauseMappingUtils_kt_i29ma0();
|
|
2182
|
+
var tmp;
|
|
2183
|
+
if (!get_isWrappableWithExplanation(_this__u8e3s4)) {
|
|
2184
|
+
tmp = withExplanationNonWrappable(_this__u8e3s4, explanation);
|
|
2185
|
+
} else {
|
|
2186
|
+
tmp = Companion_getInstance_3().of(functor, [explanation, _this__u8e3s4]);
|
|
2187
|
+
}
|
|
2188
|
+
return tmp;
|
|
2189
|
+
}
|
|
2190
|
+
function solveArithmeticExpression(_this__u8e3s4) {
|
|
2191
|
+
init_properties_ClauseMappingUtils_kt_i29ma0();
|
|
2192
|
+
var tmp$ret$1;
|
|
2193
|
+
// Inline function 'kotlin.text.replace' call
|
|
2194
|
+
var tmp0_replace = _this__u8e3s4.toString();
|
|
2195
|
+
var tmp$ret$0;
|
|
2196
|
+
// Inline function 'kotlin.text.toRegex' call
|
|
2197
|
+
tmp$ret$0 = Regex_init_$Create$('\\s');
|
|
2198
|
+
var tmp1_replace = tmp$ret$0;
|
|
2199
|
+
tmp$ret$1 = tmp1_replace.kf(tmp0_replace, '');
|
|
2200
|
+
var termStr = tmp$ret$1;
|
|
2201
|
+
var tmp = Regex_init_$Create$('([0-9.]+)(/)([0-9.]+).*');
|
|
2202
|
+
var tmp0_elvis_lhs = tmp.gf(termStr, 0, 2, null);
|
|
2203
|
+
var tmp_0;
|
|
2204
|
+
if (tmp0_elvis_lhs == null) {
|
|
2205
|
+
throw TuPrologException_init_$Create$('Unsupported probability notation in annotated disjunction: ' + termStr);
|
|
2206
|
+
} else {
|
|
2207
|
+
tmp_0 = tmp0_elvis_lhs;
|
|
2208
|
+
}
|
|
2209
|
+
var regexMatch = tmp_0;
|
|
2210
|
+
var tmp1_container = regexMatch.n9();
|
|
2211
|
+
var tmp$ret$2;
|
|
2212
|
+
// Inline function 'kotlin.text.Destructured.component1' call
|
|
2213
|
+
tmp$ret$2 = tmp1_container.j9_1.m9().n(1);
|
|
2214
|
+
var dividendStr = tmp$ret$2;
|
|
2215
|
+
var tmp$ret$3;
|
|
2216
|
+
// Inline function 'kotlin.text.Destructured.component3' call
|
|
2217
|
+
tmp$ret$3 = tmp1_container.j9_1.m9().n(3);
|
|
2218
|
+
var divisorStr = tmp$ret$3;
|
|
2219
|
+
var dividend = toDoubleOrNull(dividendStr);
|
|
2220
|
+
var divisor = toDoubleOrNull(divisorStr);
|
|
2221
|
+
if (dividend == null ? true : divisor == null) {
|
|
2222
|
+
throw TuPrologException_init_$Create$('Unable to parse arithmetic division expression: ' + termStr);
|
|
2223
|
+
}
|
|
2224
|
+
return dividend / divisor;
|
|
2225
|
+
}
|
|
2226
|
+
function withoutAnonymousVars(_this__u8e3s4) {
|
|
2227
|
+
init_properties_ClauseMappingUtils_kt_i29ma0();
|
|
2228
|
+
var tmp = Companion_getInstance_9();
|
|
2229
|
+
var tmp$ret$5;
|
|
2230
|
+
// Inline function 'kotlin.collections.mapIndexed' call
|
|
2231
|
+
var tmp$ret$2;
|
|
2232
|
+
// Inline function 'kotlin.collections.filter' call
|
|
2233
|
+
var tmp0_filter = plus_0(toSet_0(_this__u8e3s4.ly().hw()), toSet_0(_this__u8e3s4.my().hw()));
|
|
2234
|
+
var tmp$ret$1;
|
|
2235
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
2236
|
+
var tmp0_filterTo = ArrayList_init_$Create$_0();
|
|
2237
|
+
var tmp0_iterator = tmp0_filter.j();
|
|
2238
|
+
while (tmp0_iterator.m()) {
|
|
2239
|
+
var element = tmp0_iterator.p();
|
|
2240
|
+
var tmp$ret$0;
|
|
2241
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.knowledge.impl.withoutAnonymousVars.<anonymous>' call
|
|
2242
|
+
tmp$ret$0 = element.x14();
|
|
2243
|
+
if (tmp$ret$0) {
|
|
2244
|
+
tmp0_filterTo.g(element);
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2247
|
+
tmp$ret$1 = tmp0_filterTo;
|
|
2248
|
+
tmp$ret$2 = tmp$ret$1;
|
|
2249
|
+
var tmp1_mapIndexed = tmp$ret$2;
|
|
2250
|
+
var tmp$ret$4;
|
|
2251
|
+
// Inline function 'kotlin.collections.mapIndexedTo' call
|
|
2252
|
+
var tmp0_mapIndexedTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp1_mapIndexed, 10));
|
|
2253
|
+
var index = 0;
|
|
2254
|
+
var tmp0_iterator_0 = tmp1_mapIndexed.j();
|
|
2255
|
+
while (tmp0_iterator_0.m()) {
|
|
2256
|
+
var item = tmp0_iterator_0.p();
|
|
2257
|
+
var tmp$ret$3;
|
|
2258
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.knowledge.impl.withoutAnonymousVars.<anonymous>' call
|
|
2259
|
+
var tmp1 = index;
|
|
2260
|
+
index = tmp1 + 1 | 0;
|
|
2261
|
+
var tmp2__anonymous__z9zvc9 = checkIndexOverflow(tmp1);
|
|
2262
|
+
tmp$ret$3 = new Pair(item, Companion_getInstance_1().of('ANON_' + tmp2__anonymous__z9zvc9));
|
|
2263
|
+
tmp0_mapIndexedTo.g(tmp$ret$3);
|
|
2264
|
+
}
|
|
2265
|
+
tmp$ret$4 = tmp0_mapIndexedTo;
|
|
2266
|
+
tmp$ret$5 = tmp$ret$4;
|
|
2267
|
+
var anonVarSubstitution = tmp.ofIterable(tmp$ret$5);
|
|
2268
|
+
var tmp0_subject = _this__u8e3s4;
|
|
2269
|
+
var tmp_0;
|
|
2270
|
+
if (isInterface(tmp0_subject, Fact)) {
|
|
2271
|
+
tmp_0 = Companion_getInstance().of(safeToStruct(_this__u8e3s4.ly().applySubstitution(anonVarSubstitution)));
|
|
2272
|
+
} else {
|
|
2273
|
+
tmp_0 = Companion_getInstance_12().of(safeToStruct(_this__u8e3s4.ly().applySubstitution(anonVarSubstitution)), [safeToStruct(_this__u8e3s4.my().applySubstitution(anonVarSubstitution))]);
|
|
2274
|
+
}
|
|
2275
|
+
return tmp_0;
|
|
2276
|
+
}
|
|
2277
|
+
function get_extraVariables(_this__u8e3s4) {
|
|
2278
|
+
init_properties_ClauseMappingUtils_kt_i29ma0();
|
|
2279
|
+
var tmp;
|
|
2280
|
+
if (!_this__u8e3s4.jx()) {
|
|
2281
|
+
var headVars = toSet_0(_this__u8e3s4.ly().hw());
|
|
2282
|
+
var bodyVars = toSet_0(_this__u8e3s4.my().hw());
|
|
2283
|
+
tmp = subtract(bodyVars, headVars);
|
|
2284
|
+
} else {
|
|
2285
|
+
tmp = emptySet();
|
|
2286
|
+
}
|
|
2287
|
+
return tmp;
|
|
2288
|
+
}
|
|
2289
|
+
var properties_initialized_ClauseMappingUtils_kt_tzf6ek;
|
|
2290
|
+
function init_properties_ClauseMappingUtils_kt_i29ma0() {
|
|
2291
|
+
if (properties_initialized_ClauseMappingUtils_kt_tzf6ek) {
|
|
2292
|
+
} else {
|
|
2293
|
+
properties_initialized_ClauseMappingUtils_kt_tzf6ek = true;
|
|
2294
|
+
nonWrappableFunctors = setOf(['!', 'true', 'false']);
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
function DirectiveClauseMapper() {
|
|
2298
|
+
DirectiveClauseMapper_instance = this;
|
|
2299
|
+
}
|
|
2300
|
+
DirectiveClauseMapper.prototype.a3e = function (clause) {
|
|
2301
|
+
return clause.ow();
|
|
2302
|
+
};
|
|
2303
|
+
DirectiveClauseMapper.prototype.b3e = function (clause) {
|
|
2304
|
+
var body = clause.my();
|
|
2305
|
+
if (!isInterface(clause, Directive)) {
|
|
2306
|
+
var tmp = 'Clause is not an instance of Directive: ' + clause;
|
|
2307
|
+
throw ClauseMappingException_init_$Create$(tmp, null, 2, null);
|
|
2308
|
+
}
|
|
2309
|
+
var tmp_0;
|
|
2310
|
+
if (isInterface(body, Struct)) {
|
|
2311
|
+
tmp_0 = body.fw() === 'static' ? true : body.fw() === 'dynamic';
|
|
2312
|
+
} else {
|
|
2313
|
+
tmp_0 = false;
|
|
2314
|
+
}
|
|
2315
|
+
if (tmp_0) {
|
|
2316
|
+
var indicatorTerm = body.get(0);
|
|
2317
|
+
if (!isInterface(indicatorTerm, Indicator)) {
|
|
2318
|
+
var tmp_1 = 'Malformed directive: ' + clause;
|
|
2319
|
+
throw ClauseMappingException_init_$Create$(tmp_1, null, 2, null);
|
|
2320
|
+
}
|
|
2321
|
+
var name = indicatorTerm.n10();
|
|
2322
|
+
var arity = indicatorTerm.o10();
|
|
2323
|
+
if (!isInterface(arity, Numeric)) {
|
|
2324
|
+
var tmp_2 = 'Malformed directive: ' + clause;
|
|
2325
|
+
throw ClauseMappingException_init_$Create$(tmp_2, null, 2, null);
|
|
2326
|
+
}
|
|
2327
|
+
return listOf(Companion_getInstance_14().of(Companion_getInstance_3().of(body.fw(), [Companion_getInstance_13().of(name, Companion_getInstance_10().ofInteger(arity.x10().toInt() + 1 | 0))]), []));
|
|
2328
|
+
}
|
|
2329
|
+
var tmp_3;
|
|
2330
|
+
if (isInterface(body, Struct)) {
|
|
2331
|
+
tmp_3 = body.fw() === 'initialization' ? true : body.fw() === 'solve';
|
|
2332
|
+
} else {
|
|
2333
|
+
tmp_3 = false;
|
|
2334
|
+
}
|
|
2335
|
+
if (tmp_3) {
|
|
2336
|
+
return listOf(Companion_getInstance_14().of(Companion_getInstance_3().of(body.fw(), [withBodyExplanation(body.get(0), Companion_getInstance_1().anonymous())]), []));
|
|
2337
|
+
}
|
|
2338
|
+
return listOf(clause);
|
|
2339
|
+
};
|
|
2340
|
+
var DirectiveClauseMapper_instance;
|
|
2341
|
+
function DirectiveClauseMapper_getInstance() {
|
|
2342
|
+
if (DirectiveClauseMapper_instance == null)
|
|
2343
|
+
new DirectiveClauseMapper();
|
|
2344
|
+
return DirectiveClauseMapper_instance;
|
|
2345
|
+
}
|
|
2346
|
+
function EvidenceClauseMapper() {
|
|
2347
|
+
EvidenceClauseMapper_instance = this;
|
|
2348
|
+
}
|
|
2349
|
+
EvidenceClauseMapper.prototype.a3e = function (clause) {
|
|
2350
|
+
var tmp;
|
|
2351
|
+
if (isInterface(clause, Rule)) {
|
|
2352
|
+
var tmp_0 = clause.ly().fw();
|
|
2353
|
+
ProblogLib_getInstance();
|
|
2354
|
+
tmp = tmp_0 === 'evidence';
|
|
2355
|
+
} else {
|
|
2356
|
+
tmp = false;
|
|
2357
|
+
}
|
|
2358
|
+
return tmp;
|
|
2359
|
+
};
|
|
2360
|
+
EvidenceClauseMapper.prototype.b3e = function (clause) {
|
|
2361
|
+
if (!isInterface(clause, Rule)) {
|
|
2362
|
+
var tmp = 'Clause is not an instance of Rule: ' + clause;
|
|
2363
|
+
throw ClauseMappingException_init_$Create$(tmp, null, 2, null);
|
|
2364
|
+
}
|
|
2365
|
+
if (clause.ly().zv() > 2) {
|
|
2366
|
+
throw TuPrologException_init_$Create$('Invalid evidence predicate: ' + clause.ly());
|
|
2367
|
+
} else {
|
|
2368
|
+
var tmp_0;
|
|
2369
|
+
if (clause.ly().zv() === 2) {
|
|
2370
|
+
var tmp_1 = clause.ly().get(1);
|
|
2371
|
+
tmp_0 = !isInterface(tmp_1, Truth);
|
|
2372
|
+
} else {
|
|
2373
|
+
tmp_0 = false;
|
|
2374
|
+
}
|
|
2375
|
+
if (tmp_0) {
|
|
2376
|
+
throw TuPrologException_init_$Create$('Invalid evidence predicate: ' + clause.ly());
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
var headTerm = clause.ly();
|
|
2380
|
+
if (headTerm.zv() === 1) {
|
|
2381
|
+
headTerm = Companion_getInstance_3().of(headTerm.fw(), [headTerm.get(0), Companion_getInstance_15().wv_1]);
|
|
2382
|
+
}
|
|
2383
|
+
var tmp_2;
|
|
2384
|
+
if (isInterface(clause, Fact)) {
|
|
2385
|
+
tmp_2 = Companion_getInstance().of(headTerm);
|
|
2386
|
+
} else {
|
|
2387
|
+
tmp_2 = Companion_getInstance_12().of(headTerm, [withBodyExplanation(clause.my(), Companion_getInstance_1().anonymous())]);
|
|
2388
|
+
}
|
|
2389
|
+
return listOf(tmp_2);
|
|
2390
|
+
};
|
|
2391
|
+
var EvidenceClauseMapper_instance;
|
|
2392
|
+
function EvidenceClauseMapper_getInstance() {
|
|
2393
|
+
if (EvidenceClauseMapper_instance == null)
|
|
2394
|
+
new EvidenceClauseMapper();
|
|
2395
|
+
return EvidenceClauseMapper_instance;
|
|
2396
|
+
}
|
|
2397
|
+
function MappedMutableProblogTheory_init_$Init$(clauses, unificator, theory, $mask0, $marker, $this) {
|
|
2398
|
+
if (!(($mask0 & 2) === 0))
|
|
2399
|
+
unificator = Companion_getInstance_16().h1l();
|
|
2400
|
+
if (!(($mask0 & 4) === 0)) {
|
|
2401
|
+
var tmp = Companion_getInstance_17();
|
|
2402
|
+
var tmp0_safe_receiver = clauses;
|
|
2403
|
+
var tmp_0;
|
|
2404
|
+
if (tmp0_safe_receiver == null) {
|
|
2405
|
+
tmp_0 = null;
|
|
2406
|
+
} else {
|
|
2407
|
+
var tmp$ret$2;
|
|
2408
|
+
var tmp$ret$2_0;
|
|
2409
|
+
// Inline function 'kotlin.collections.flatMap' call
|
|
2410
|
+
var tmp$ret$1;
|
|
2411
|
+
var tmp$ret$1_0;
|
|
2412
|
+
// Inline function 'kotlin.collections.flatMapTo' call
|
|
2413
|
+
var tmp0_flatMapTo = ArrayList_init_$Create$_0();
|
|
2414
|
+
var tmp0_iterator = tmp0_safe_receiver.j();
|
|
2415
|
+
while (tmp0_iterator.m()) {
|
|
2416
|
+
var element = tmp0_iterator.p();
|
|
2417
|
+
var tmp$ret$0;
|
|
2418
|
+
var tmp$ret$0_0;
|
|
2419
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.knowledge.impl.MappedMutableProblogTheory.<init>.<anonymous>' call
|
|
2420
|
+
tmp$ret$0 = ClauseMappingUtils_getInstance().m3e(element);
|
|
2421
|
+
tmp$ret$0_0 = Unit_getInstance();
|
|
2422
|
+
var list = tmp$ret$0;
|
|
2423
|
+
addAll(tmp0_flatMapTo, list);
|
|
2424
|
+
}
|
|
2425
|
+
tmp$ret$1 = tmp0_flatMapTo;
|
|
2426
|
+
tmp$ret$1_0 = Unit_getInstance();
|
|
2427
|
+
tmp$ret$2 = tmp$ret$1;
|
|
2428
|
+
tmp$ret$2_0 = Unit_getInstance();
|
|
2429
|
+
tmp_0 = tmp$ret$2;
|
|
2430
|
+
}
|
|
2431
|
+
var tmp1_elvis_lhs = tmp_0;
|
|
2432
|
+
theory = tmp.indexedOfIterable(unificator, tmp1_elvis_lhs == null ? emptyList() : tmp1_elvis_lhs);
|
|
2433
|
+
}
|
|
2434
|
+
MappedMutableProblogTheory.call($this, clauses, unificator, theory);
|
|
2435
|
+
return $this;
|
|
2436
|
+
}
|
|
2437
|
+
function MappedMutableProblogTheory_init_$Create$(clauses, unificator, theory, $mask0, $marker) {
|
|
2438
|
+
return MappedMutableProblogTheory_init_$Init$(clauses, unificator, theory, $mask0, $marker, Object.create(MappedMutableProblogTheory.prototype));
|
|
2439
|
+
}
|
|
2440
|
+
function MappedMutableProblogTheory(clauses, unificator, theory) {
|
|
2441
|
+
this.o3e_1 = theory;
|
|
2442
|
+
}
|
|
2443
|
+
MappedMutableProblogTheory.prototype.t1l = function () {
|
|
2444
|
+
return this.o3e_1.t1l();
|
|
2445
|
+
};
|
|
2446
|
+
MappedMutableProblogTheory.prototype.m1l = function () {
|
|
2447
|
+
return this.o3e_1.m1l();
|
|
2448
|
+
};
|
|
2449
|
+
MappedMutableProblogTheory.prototype.o1l = function () {
|
|
2450
|
+
return this.o3e_1.o1l();
|
|
2451
|
+
};
|
|
2452
|
+
MappedMutableProblogTheory.prototype.k1s = function () {
|
|
2453
|
+
return this.o3e_1.k1s();
|
|
2454
|
+
};
|
|
2455
|
+
MappedMutableProblogTheory.prototype.o = function () {
|
|
2456
|
+
return this.o3e_1.o();
|
|
2457
|
+
};
|
|
2458
|
+
MappedMutableProblogTheory.prototype.kt = function () {
|
|
2459
|
+
return this.o3e_1.kt();
|
|
2460
|
+
};
|
|
2461
|
+
MappedMutableProblogTheory.prototype.k1l = function () {
|
|
2462
|
+
return this.o3e_1.k1l();
|
|
2463
|
+
};
|
|
2464
|
+
MappedMutableProblogTheory.prototype.z1s = function () {
|
|
2465
|
+
return this.o3e_1.z1s();
|
|
2466
|
+
};
|
|
2467
|
+
MappedMutableProblogTheory.prototype.clone = function () {
|
|
2468
|
+
return this.z1s();
|
|
2469
|
+
};
|
|
2470
|
+
MappedMutableProblogTheory.prototype.contains = function (clause) {
|
|
2471
|
+
return this.o3e_1.contains(clause);
|
|
2472
|
+
};
|
|
2473
|
+
MappedMutableProblogTheory.prototype.containsIndicator = function (indicator) {
|
|
2474
|
+
return this.o3e_1.containsIndicator(indicator);
|
|
2475
|
+
};
|
|
2476
|
+
MappedMutableProblogTheory.prototype.containsHead = function (head) {
|
|
2477
|
+
return this.o3e_1.containsHead(head);
|
|
2478
|
+
};
|
|
2479
|
+
MappedMutableProblogTheory.prototype.containsTag = function (name) {
|
|
2480
|
+
return this.o3e_1.containsTag(name);
|
|
2481
|
+
};
|
|
2482
|
+
MappedMutableProblogTheory.prototype.equalsUsingVarCompleteNames = function (other, useVarCompleteName) {
|
|
2483
|
+
return this.o3e_1.equalsUsingVarCompleteNames(other, useVarCompleteName);
|
|
2484
|
+
};
|
|
2485
|
+
MappedMutableProblogTheory.prototype.get = function (clause) {
|
|
2486
|
+
return this.o3e_1.get(clause);
|
|
2487
|
+
};
|
|
2488
|
+
MappedMutableProblogTheory.prototype.getByIndicator = function (indicator) {
|
|
2489
|
+
return this.o3e_1.getByIndicator(indicator);
|
|
2490
|
+
};
|
|
2491
|
+
MappedMutableProblogTheory.prototype.getByHead = function (head) {
|
|
2492
|
+
return this.o3e_1.getByHead(head);
|
|
2493
|
+
};
|
|
2494
|
+
MappedMutableProblogTheory.prototype.getTag = function (name) {
|
|
2495
|
+
return this.o3e_1.getTag(name);
|
|
2496
|
+
};
|
|
2497
|
+
MappedMutableProblogTheory.prototype.j = function () {
|
|
2498
|
+
return this.o3e_1.j();
|
|
2499
|
+
};
|
|
2500
|
+
MappedMutableProblogTheory.prototype.o12 = function (tags) {
|
|
2501
|
+
return this.o3e_1.o12(tags);
|
|
2502
|
+
};
|
|
2503
|
+
MappedMutableProblogTheory.prototype.resetTags = function (tags) {
|
|
2504
|
+
return this.o12(tags);
|
|
2505
|
+
};
|
|
2506
|
+
MappedMutableProblogTheory.prototype.l1s = function (unificator) {
|
|
2507
|
+
return this.o3e_1.l1s(unificator);
|
|
2508
|
+
};
|
|
2509
|
+
MappedMutableProblogTheory.prototype.setUnificator = function (unificator) {
|
|
2510
|
+
return this.l1s(unificator);
|
|
2511
|
+
};
|
|
2512
|
+
MappedMutableProblogTheory.prototype.toStringAsProlog = function (asPrologText) {
|
|
2513
|
+
return this.o3e_1.toStringAsProlog(asPrologText);
|
|
2514
|
+
};
|
|
2515
|
+
MappedMutableProblogTheory.prototype.a1t = function () {
|
|
2516
|
+
return false;
|
|
2517
|
+
};
|
|
2518
|
+
MappedMutableProblogTheory.prototype.b1t = function () {
|
|
2519
|
+
return Companion_getInstance_20().ofIterable(this.k1l(), this);
|
|
2520
|
+
};
|
|
2521
|
+
MappedMutableProblogTheory.prototype.toMutableTheory = function () {
|
|
2522
|
+
return this.b1t();
|
|
2523
|
+
};
|
|
2524
|
+
MappedMutableProblogTheory.prototype.a1s = function () {
|
|
2525
|
+
return this;
|
|
2526
|
+
};
|
|
2527
|
+
MappedMutableProblogTheory.prototype.toImmutableTheory = function () {
|
|
2528
|
+
return this.a1s();
|
|
2529
|
+
};
|
|
2530
|
+
MappedMutableProblogTheory.prototype.p3e = function (theory) {
|
|
2531
|
+
return new MappedMutableProblogTheory(null, this.k1l(), this.o3e_1.n1s(theory));
|
|
2532
|
+
};
|
|
2533
|
+
MappedMutableProblogTheory.prototype.n1s = function (theory) {
|
|
2534
|
+
var tmp0_subject = theory;
|
|
2535
|
+
var tmp;
|
|
2536
|
+
if (isInterface(tmp0_subject, ProblogTheory)) {
|
|
2537
|
+
tmp = this.p3e(theory);
|
|
2538
|
+
} else {
|
|
2539
|
+
var tmp_0 = this.k1l();
|
|
2540
|
+
tmp = this.p3e(MappedMutableProblogTheory_init_$Create$(theory, tmp_0, null, 4, null));
|
|
2541
|
+
}
|
|
2542
|
+
return tmp;
|
|
2543
|
+
};
|
|
2544
|
+
MappedMutableProblogTheory.prototype.plusTheory = function (theory) {
|
|
2545
|
+
return this.n1s(theory);
|
|
2546
|
+
};
|
|
2547
|
+
MappedMutableProblogTheory.prototype.b1s = function (clause) {
|
|
2548
|
+
var mapped = ClauseMappingUtils_getInstance().m3e(clause);
|
|
2549
|
+
return new MappedMutableProblogTheory(null, this.k1l(), this.o3e_1.n1s(Companion_getInstance_18().indexedOfIterable(this.k1l(), mapped)));
|
|
2550
|
+
};
|
|
2551
|
+
MappedMutableProblogTheory.prototype.plus = function (clause) {
|
|
2552
|
+
return this.b1s(clause);
|
|
2553
|
+
};
|
|
2554
|
+
MappedMutableProblogTheory.prototype.r1s = function (clauses) {
|
|
2555
|
+
var tmp$ret$2;
|
|
2556
|
+
// Inline function 'kotlin.collections.flatMap' call
|
|
2557
|
+
var tmp$ret$1;
|
|
2558
|
+
// Inline function 'kotlin.collections.flatMapTo' call
|
|
2559
|
+
var tmp0_flatMapTo = ArrayList_init_$Create$_0();
|
|
2560
|
+
var tmp0_iterator = clauses.j();
|
|
2561
|
+
while (tmp0_iterator.m()) {
|
|
2562
|
+
var element = tmp0_iterator.p();
|
|
2563
|
+
var tmp$ret$0;
|
|
2564
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.knowledge.impl.MappedMutableProblogTheory.assertA.<anonymous>' call
|
|
2565
|
+
tmp$ret$0 = ClauseMappingUtils_getInstance().m3e(element);
|
|
2566
|
+
var list = tmp$ret$0;
|
|
2567
|
+
addAll(tmp0_flatMapTo, list);
|
|
2568
|
+
}
|
|
2569
|
+
tmp$ret$1 = tmp0_flatMapTo;
|
|
2570
|
+
tmp$ret$2 = tmp$ret$1;
|
|
2571
|
+
var mapped = tmp$ret$2;
|
|
2572
|
+
return new MappedMutableProblogTheory(null, this.k1l(), this.o3e_1.r1s(mapped));
|
|
2573
|
+
};
|
|
2574
|
+
MappedMutableProblogTheory.prototype.assertAIterable = function (clauses) {
|
|
2575
|
+
return this.r1s(clauses);
|
|
2576
|
+
};
|
|
2577
|
+
MappedMutableProblogTheory.prototype.u1s = function (clauses) {
|
|
2578
|
+
var tmp$ret$2;
|
|
2579
|
+
// Inline function 'kotlin.collections.flatMap' call
|
|
2580
|
+
var tmp$ret$1;
|
|
2581
|
+
// Inline function 'kotlin.collections.flatMapTo' call
|
|
2582
|
+
var tmp0_flatMapTo = ArrayList_init_$Create$_0();
|
|
2583
|
+
var tmp0_iterator = clauses.j();
|
|
2584
|
+
while (tmp0_iterator.m()) {
|
|
2585
|
+
var element = tmp0_iterator.p();
|
|
2586
|
+
var tmp$ret$0;
|
|
2587
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.knowledge.impl.MappedMutableProblogTheory.assertZ.<anonymous>' call
|
|
2588
|
+
tmp$ret$0 = ClauseMappingUtils_getInstance().m3e(element);
|
|
2589
|
+
var list = tmp$ret$0;
|
|
2590
|
+
addAll(tmp0_flatMapTo, list);
|
|
2591
|
+
}
|
|
2592
|
+
tmp$ret$1 = tmp0_flatMapTo;
|
|
2593
|
+
tmp$ret$2 = tmp$ret$1;
|
|
2594
|
+
var mapped = tmp$ret$2;
|
|
2595
|
+
return new MappedMutableProblogTheory(null, this.k1l(), this.o3e_1.u1s(mapped));
|
|
2596
|
+
};
|
|
2597
|
+
MappedMutableProblogTheory.prototype.assertZIterable = function (clauses) {
|
|
2598
|
+
return this.u1s(clauses);
|
|
2599
|
+
};
|
|
2600
|
+
MappedMutableProblogTheory.prototype.y1s = function (clauses) {
|
|
2601
|
+
var tmp$ret$2;
|
|
2602
|
+
// Inline function 'kotlin.collections.flatMap' call
|
|
2603
|
+
var tmp$ret$1;
|
|
2604
|
+
// Inline function 'kotlin.collections.flatMapTo' call
|
|
2605
|
+
var tmp0_flatMapTo = ArrayList_init_$Create$_0();
|
|
2606
|
+
var tmp0_iterator = clauses.j();
|
|
2607
|
+
while (tmp0_iterator.m()) {
|
|
2608
|
+
var element = tmp0_iterator.p();
|
|
2609
|
+
var tmp$ret$0;
|
|
2610
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.knowledge.impl.MappedMutableProblogTheory.retract.<anonymous>' call
|
|
2611
|
+
tmp$ret$0 = ClauseMappingUtils_getInstance().m3e(element);
|
|
2612
|
+
var list = tmp$ret$0;
|
|
2613
|
+
addAll(tmp0_flatMapTo, list);
|
|
2614
|
+
}
|
|
2615
|
+
tmp$ret$1 = tmp0_flatMapTo;
|
|
2616
|
+
tmp$ret$2 = tmp$ret$1;
|
|
2617
|
+
var mapped = tmp$ret$2;
|
|
2618
|
+
var result = this.o3e_1.y1s(mapped);
|
|
2619
|
+
var tmp;
|
|
2620
|
+
if (result instanceof Success) {
|
|
2621
|
+
tmp = new Success(new MappedMutableProblogTheory(null, this.k1l(), result.h1s()), result.i1t_1);
|
|
2622
|
+
} else {
|
|
2623
|
+
tmp = new Failure(new MappedMutableProblogTheory(null, this.k1l(), result.h1s()));
|
|
2624
|
+
}
|
|
2625
|
+
return tmp;
|
|
2626
|
+
};
|
|
2627
|
+
MappedMutableProblogTheory.prototype.retractIterable = function (clauses) {
|
|
2628
|
+
return this.y1s(clauses);
|
|
2629
|
+
};
|
|
2630
|
+
MappedMutableProblogTheory.prototype.c1m = function (clause) {
|
|
2631
|
+
var mappedClauses = ClauseMappingUtils_getInstance().m3e(clause);
|
|
2632
|
+
var result = null;
|
|
2633
|
+
var tmp0_iterator = mappedClauses.j();
|
|
2634
|
+
while (tmp0_iterator.m()) {
|
|
2635
|
+
var c = tmp0_iterator.p();
|
|
2636
|
+
var tmp;
|
|
2637
|
+
if (result == null) {
|
|
2638
|
+
tmp = true;
|
|
2639
|
+
} else {
|
|
2640
|
+
tmp = !(result instanceof Failure);
|
|
2641
|
+
}
|
|
2642
|
+
if (tmp) {
|
|
2643
|
+
result = this.o3e_1.c1m(c);
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2646
|
+
var tmp1_subject = result;
|
|
2647
|
+
var tmp_0;
|
|
2648
|
+
if (tmp1_subject instanceof Success) {
|
|
2649
|
+
tmp_0 = new Success(new MappedMutableProblogTheory(null, this.k1l(), result.h1s()), result.i1t_1);
|
|
2650
|
+
} else {
|
|
2651
|
+
if (tmp1_subject instanceof Failure) {
|
|
2652
|
+
tmp_0 = new Failure(new MappedMutableProblogTheory(null, this.k1l(), result.h1s()));
|
|
2653
|
+
} else {
|
|
2654
|
+
tmp_0 = new Failure(this);
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
return tmp_0;
|
|
2658
|
+
};
|
|
2659
|
+
MappedMutableProblogTheory.prototype.retractAll = function (clause) {
|
|
2660
|
+
return this.c1m(clause);
|
|
2661
|
+
};
|
|
2662
|
+
MappedMutableProblogTheory.prototype.g1s = function (indicator) {
|
|
2663
|
+
return new MappedMutableProblogTheory(null, this.k1l(), this.o3e_1.g1s(ClauseMappingUtils_getInstance().n3e(indicator)));
|
|
2664
|
+
};
|
|
2665
|
+
MappedMutableProblogTheory.prototype.abolish = function (indicator) {
|
|
2666
|
+
return this.g1s(indicator);
|
|
2667
|
+
};
|
|
2668
|
+
MappedMutableProblogTheory.prototype.c1t = function (struct) {
|
|
2669
|
+
return this.p1s(Companion_getInstance().of(struct));
|
|
2670
|
+
};
|
|
2671
|
+
MappedMutableProblogTheory.prototype.assertAFact = function (struct) {
|
|
2672
|
+
return this.c1t(struct);
|
|
2673
|
+
};
|
|
2674
|
+
MappedMutableProblogTheory.prototype.d1t = function (struct) {
|
|
2675
|
+
return this.t1s(Companion_getInstance().of(struct));
|
|
2676
|
+
};
|
|
2677
|
+
MappedMutableProblogTheory.prototype.assertZFact = function (struct) {
|
|
2678
|
+
return this.d1t(struct);
|
|
2679
|
+
};
|
|
2680
|
+
MappedMutableProblogTheory.prototype.p1s = function (clause) {
|
|
2681
|
+
return this.r1s(listOf(clause));
|
|
2682
|
+
};
|
|
2683
|
+
MappedMutableProblogTheory.prototype.assertA = function (clause) {
|
|
2684
|
+
return this.p1s(clause);
|
|
2685
|
+
};
|
|
2686
|
+
MappedMutableProblogTheory.prototype.s1s = function (clauses) {
|
|
2687
|
+
return this.r1s(asIterable_0(clauses));
|
|
2688
|
+
};
|
|
2689
|
+
MappedMutableProblogTheory.prototype.assertASequence = function (clauses) {
|
|
2690
|
+
return this.s1s(clauses);
|
|
2691
|
+
};
|
|
2692
|
+
MappedMutableProblogTheory.prototype.t1s = function (clause) {
|
|
2693
|
+
return this.u1s(listOf(clause));
|
|
2694
|
+
};
|
|
2695
|
+
MappedMutableProblogTheory.prototype.assertZ = function (clause) {
|
|
2696
|
+
return this.t1s(clause);
|
|
2697
|
+
};
|
|
2698
|
+
MappedMutableProblogTheory.prototype.v1s = function (clauses) {
|
|
2699
|
+
return this.u1s(asIterable_0(clauses));
|
|
2700
|
+
};
|
|
2701
|
+
MappedMutableProblogTheory.prototype.assertZSequence = function (clauses) {
|
|
2702
|
+
return this.v1s(clauses);
|
|
2703
|
+
};
|
|
2704
|
+
MappedMutableProblogTheory.prototype.f1t = function (head) {
|
|
2705
|
+
return this.e1t(Companion_getInstance_12().of(head, [Companion_getInstance_1().anonymous()]));
|
|
2706
|
+
};
|
|
2707
|
+
MappedMutableProblogTheory.prototype.retractByHead = function (head) {
|
|
2708
|
+
return this.f1t(head);
|
|
2709
|
+
};
|
|
2710
|
+
MappedMutableProblogTheory.prototype.e1t = function (clause) {
|
|
2711
|
+
return this.y1s(listOf(clause));
|
|
2712
|
+
};
|
|
2713
|
+
MappedMutableProblogTheory.prototype.retract = function (clause) {
|
|
2714
|
+
return this.e1t(clause);
|
|
2715
|
+
};
|
|
2716
|
+
MappedMutableProblogTheory.prototype.x1s = function (clauses) {
|
|
2717
|
+
return this.y1s(asIterable_0(clauses));
|
|
2718
|
+
};
|
|
2719
|
+
MappedMutableProblogTheory.prototype.retractSequence = function (clauses) {
|
|
2720
|
+
return this.x1s(clauses);
|
|
2721
|
+
};
|
|
2722
|
+
MappedMutableProblogTheory.prototype.g1t = function (head) {
|
|
2723
|
+
return this.c1m(Companion_getInstance_12().of(head, [Companion_getInstance_1().anonymous()]));
|
|
2724
|
+
};
|
|
2725
|
+
MappedMutableProblogTheory.prototype.retractAllByHead = function (head) {
|
|
2726
|
+
return this.g1t(head);
|
|
2727
|
+
};
|
|
2728
|
+
function MappedProblogTheory_init_$Init$(clauses, unificator, theory, $mask0, $marker, $this) {
|
|
2729
|
+
if (!(($mask0 & 2) === 0))
|
|
2730
|
+
unificator = Companion_getInstance_16().h1l();
|
|
2731
|
+
if (!(($mask0 & 4) === 0)) {
|
|
2732
|
+
var tmp = Companion_getInstance_18();
|
|
2733
|
+
var tmp0_safe_receiver = clauses;
|
|
2734
|
+
var tmp_0;
|
|
2735
|
+
if (tmp0_safe_receiver == null) {
|
|
2736
|
+
tmp_0 = null;
|
|
2737
|
+
} else {
|
|
2738
|
+
var tmp$ret$2;
|
|
2739
|
+
var tmp$ret$2_0;
|
|
2740
|
+
// Inline function 'kotlin.collections.flatMap' call
|
|
2741
|
+
var tmp$ret$1;
|
|
2742
|
+
var tmp$ret$1_0;
|
|
2743
|
+
// Inline function 'kotlin.collections.flatMapTo' call
|
|
2744
|
+
var tmp0_flatMapTo = ArrayList_init_$Create$_0();
|
|
2745
|
+
var tmp0_iterator = tmp0_safe_receiver.j();
|
|
2746
|
+
while (tmp0_iterator.m()) {
|
|
2747
|
+
var element = tmp0_iterator.p();
|
|
2748
|
+
var tmp$ret$0;
|
|
2749
|
+
var tmp$ret$0_0;
|
|
2750
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.knowledge.impl.MappedProblogTheory.<init>.<anonymous>' call
|
|
2751
|
+
tmp$ret$0 = ClauseMappingUtils_getInstance().m3e(element);
|
|
2752
|
+
tmp$ret$0_0 = Unit_getInstance();
|
|
2753
|
+
var list = tmp$ret$0;
|
|
2754
|
+
addAll(tmp0_flatMapTo, list);
|
|
2755
|
+
}
|
|
2756
|
+
tmp$ret$1 = tmp0_flatMapTo;
|
|
2757
|
+
tmp$ret$1_0 = Unit_getInstance();
|
|
2758
|
+
tmp$ret$2 = tmp$ret$1;
|
|
2759
|
+
tmp$ret$2_0 = Unit_getInstance();
|
|
2760
|
+
tmp_0 = tmp$ret$2;
|
|
2761
|
+
}
|
|
2762
|
+
var tmp1_elvis_lhs = tmp_0;
|
|
2763
|
+
theory = tmp.indexedOfIterable(unificator, tmp1_elvis_lhs == null ? emptyList() : tmp1_elvis_lhs);
|
|
2764
|
+
}
|
|
2765
|
+
MappedProblogTheory.call($this, clauses, unificator, theory);
|
|
2766
|
+
return $this;
|
|
2767
|
+
}
|
|
2768
|
+
function MappedProblogTheory_init_$Create$(clauses, unificator, theory, $mask0, $marker) {
|
|
2769
|
+
return MappedProblogTheory_init_$Init$(clauses, unificator, theory, $mask0, $marker, Object.create(MappedProblogTheory.prototype));
|
|
2770
|
+
}
|
|
2771
|
+
function MappedProblogTheory(clauses, unificator, theory) {
|
|
2772
|
+
this.q3e_1 = theory;
|
|
2773
|
+
}
|
|
2774
|
+
MappedProblogTheory.prototype.t1l = function () {
|
|
2775
|
+
return this.q3e_1.t1l();
|
|
2776
|
+
};
|
|
2777
|
+
MappedProblogTheory.prototype.m1l = function () {
|
|
2778
|
+
return this.q3e_1.m1l();
|
|
2779
|
+
};
|
|
2780
|
+
MappedProblogTheory.prototype.o1l = function () {
|
|
2781
|
+
return this.q3e_1.o1l();
|
|
2782
|
+
};
|
|
2783
|
+
MappedProblogTheory.prototype.k1s = function () {
|
|
2784
|
+
return this.q3e_1.k1s();
|
|
2785
|
+
};
|
|
2786
|
+
MappedProblogTheory.prototype.o = function () {
|
|
2787
|
+
return this.q3e_1.o();
|
|
2788
|
+
};
|
|
2789
|
+
MappedProblogTheory.prototype.kt = function () {
|
|
2790
|
+
return this.q3e_1.kt();
|
|
2791
|
+
};
|
|
2792
|
+
MappedProblogTheory.prototype.k1l = function () {
|
|
2793
|
+
return this.q3e_1.k1l();
|
|
2794
|
+
};
|
|
2795
|
+
MappedProblogTheory.prototype.clone = function () {
|
|
2796
|
+
return this.q3e_1.clone();
|
|
2797
|
+
};
|
|
2798
|
+
MappedProblogTheory.prototype.contains = function (clause) {
|
|
2799
|
+
return this.q3e_1.contains(clause);
|
|
2800
|
+
};
|
|
2801
|
+
MappedProblogTheory.prototype.containsIndicator = function (indicator) {
|
|
2802
|
+
return this.q3e_1.containsIndicator(indicator);
|
|
2803
|
+
};
|
|
2804
|
+
MappedProblogTheory.prototype.containsHead = function (head) {
|
|
2805
|
+
return this.q3e_1.containsHead(head);
|
|
2806
|
+
};
|
|
2807
|
+
MappedProblogTheory.prototype.containsTag = function (name) {
|
|
2808
|
+
return this.q3e_1.containsTag(name);
|
|
2809
|
+
};
|
|
2810
|
+
MappedProblogTheory.prototype.equalsUsingVarCompleteNames = function (other, useVarCompleteName) {
|
|
2811
|
+
return this.q3e_1.equalsUsingVarCompleteNames(other, useVarCompleteName);
|
|
2812
|
+
};
|
|
2813
|
+
MappedProblogTheory.prototype.get = function (clause) {
|
|
2814
|
+
return this.q3e_1.get(clause);
|
|
2815
|
+
};
|
|
2816
|
+
MappedProblogTheory.prototype.getByIndicator = function (indicator) {
|
|
2817
|
+
return this.q3e_1.getByIndicator(indicator);
|
|
2818
|
+
};
|
|
2819
|
+
MappedProblogTheory.prototype.getByHead = function (head) {
|
|
2820
|
+
return this.q3e_1.getByHead(head);
|
|
2821
|
+
};
|
|
2822
|
+
MappedProblogTheory.prototype.getTag = function (name) {
|
|
2823
|
+
return this.q3e_1.getTag(name);
|
|
2824
|
+
};
|
|
2825
|
+
MappedProblogTheory.prototype.j = function () {
|
|
2826
|
+
return this.q3e_1.j();
|
|
2827
|
+
};
|
|
2828
|
+
MappedProblogTheory.prototype.resetTags = function (tags) {
|
|
2829
|
+
return this.q3e_1.resetTags(tags);
|
|
2830
|
+
};
|
|
2831
|
+
MappedProblogTheory.prototype.setUnificator = function (unificator) {
|
|
2832
|
+
return this.q3e_1.setUnificator(unificator);
|
|
2833
|
+
};
|
|
2834
|
+
MappedProblogTheory.prototype.toStringAsProlog = function (asPrologText) {
|
|
2835
|
+
return this.q3e_1.toStringAsProlog(asPrologText);
|
|
2836
|
+
};
|
|
2837
|
+
MappedProblogTheory.prototype.a1t = function () {
|
|
2838
|
+
return false;
|
|
2839
|
+
};
|
|
2840
|
+
MappedProblogTheory.prototype.b1t = function () {
|
|
2841
|
+
return Companion_getInstance_20().ofIterable(this.k1l(), this);
|
|
2842
|
+
};
|
|
2843
|
+
MappedProblogTheory.prototype.toMutableTheory = function () {
|
|
2844
|
+
return this.b1t();
|
|
2845
|
+
};
|
|
2846
|
+
MappedProblogTheory.prototype.a1s = function () {
|
|
2847
|
+
return this;
|
|
2848
|
+
};
|
|
2849
|
+
MappedProblogTheory.prototype.toImmutableTheory = function () {
|
|
2850
|
+
return this.a1s();
|
|
2851
|
+
};
|
|
2852
|
+
MappedProblogTheory.prototype.p3e = function (theory) {
|
|
2853
|
+
return new MappedProblogTheory(null, this.k1l(), this.q3e_1.plusTheory(theory));
|
|
2854
|
+
};
|
|
2855
|
+
MappedProblogTheory.prototype.n1s = function (theory) {
|
|
2856
|
+
var tmp0_subject = theory;
|
|
2857
|
+
var tmp;
|
|
2858
|
+
if (isInterface(tmp0_subject, ProblogTheory)) {
|
|
2859
|
+
tmp = this.p3e(theory);
|
|
2860
|
+
} else {
|
|
2861
|
+
var tmp_0 = this.k1l();
|
|
2862
|
+
tmp = this.p3e(MappedProblogTheory_init_$Create$(theory, tmp_0, null, 4, null));
|
|
2863
|
+
}
|
|
2864
|
+
return tmp;
|
|
2865
|
+
};
|
|
2866
|
+
MappedProblogTheory.prototype.plusTheory = function (theory) {
|
|
2867
|
+
return this.n1s(theory);
|
|
2868
|
+
};
|
|
2869
|
+
MappedProblogTheory.prototype.b1s = function (clause) {
|
|
2870
|
+
var mapped = ClauseMappingUtils_getInstance().m3e(clause);
|
|
2871
|
+
return new MappedProblogTheory(null, this.k1l(), this.q3e_1.plusTheory(Companion_getInstance_18().indexedOfIterable(this.k1l(), mapped)));
|
|
2872
|
+
};
|
|
2873
|
+
MappedProblogTheory.prototype.plus = function (clause) {
|
|
2874
|
+
return this.b1s(clause);
|
|
2875
|
+
};
|
|
2876
|
+
MappedProblogTheory.prototype.r1s = function (clauses) {
|
|
2877
|
+
var tmp$ret$2;
|
|
2878
|
+
// Inline function 'kotlin.collections.flatMap' call
|
|
2879
|
+
var tmp$ret$1;
|
|
2880
|
+
// Inline function 'kotlin.collections.flatMapTo' call
|
|
2881
|
+
var tmp0_flatMapTo = ArrayList_init_$Create$_0();
|
|
2882
|
+
var tmp0_iterator = clauses.j();
|
|
2883
|
+
while (tmp0_iterator.m()) {
|
|
2884
|
+
var element = tmp0_iterator.p();
|
|
2885
|
+
var tmp$ret$0;
|
|
2886
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.knowledge.impl.MappedProblogTheory.assertA.<anonymous>' call
|
|
2887
|
+
tmp$ret$0 = ClauseMappingUtils_getInstance().m3e(element);
|
|
2888
|
+
var list = tmp$ret$0;
|
|
2889
|
+
addAll(tmp0_flatMapTo, list);
|
|
2890
|
+
}
|
|
2891
|
+
tmp$ret$1 = tmp0_flatMapTo;
|
|
2892
|
+
tmp$ret$2 = tmp$ret$1;
|
|
2893
|
+
var mapped = tmp$ret$2;
|
|
2894
|
+
return new MappedProblogTheory(null, this.k1l(), this.q3e_1.assertAIterable(mapped));
|
|
2895
|
+
};
|
|
2896
|
+
MappedProblogTheory.prototype.assertAIterable = function (clauses) {
|
|
2897
|
+
return this.r1s(clauses);
|
|
2898
|
+
};
|
|
2899
|
+
MappedProblogTheory.prototype.u1s = function (clauses) {
|
|
2900
|
+
var tmp$ret$2;
|
|
2901
|
+
// Inline function 'kotlin.collections.flatMap' call
|
|
2902
|
+
var tmp$ret$1;
|
|
2903
|
+
// Inline function 'kotlin.collections.flatMapTo' call
|
|
2904
|
+
var tmp0_flatMapTo = ArrayList_init_$Create$_0();
|
|
2905
|
+
var tmp0_iterator = clauses.j();
|
|
2906
|
+
while (tmp0_iterator.m()) {
|
|
2907
|
+
var element = tmp0_iterator.p();
|
|
2908
|
+
var tmp$ret$0;
|
|
2909
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.knowledge.impl.MappedProblogTheory.assertZ.<anonymous>' call
|
|
2910
|
+
tmp$ret$0 = ClauseMappingUtils_getInstance().m3e(element);
|
|
2911
|
+
var list = tmp$ret$0;
|
|
2912
|
+
addAll(tmp0_flatMapTo, list);
|
|
2913
|
+
}
|
|
2914
|
+
tmp$ret$1 = tmp0_flatMapTo;
|
|
2915
|
+
tmp$ret$2 = tmp$ret$1;
|
|
2916
|
+
var mapped = tmp$ret$2;
|
|
2917
|
+
return new MappedProblogTheory(null, this.k1l(), this.q3e_1.assertZIterable(mapped));
|
|
2918
|
+
};
|
|
2919
|
+
MappedProblogTheory.prototype.assertZIterable = function (clauses) {
|
|
2920
|
+
return this.u1s(clauses);
|
|
2921
|
+
};
|
|
2922
|
+
MappedProblogTheory.prototype.y1s = function (clauses) {
|
|
2923
|
+
var tmp$ret$2;
|
|
2924
|
+
// Inline function 'kotlin.collections.flatMap' call
|
|
2925
|
+
var tmp$ret$1;
|
|
2926
|
+
// Inline function 'kotlin.collections.flatMapTo' call
|
|
2927
|
+
var tmp0_flatMapTo = ArrayList_init_$Create$_0();
|
|
2928
|
+
var tmp0_iterator = clauses.j();
|
|
2929
|
+
while (tmp0_iterator.m()) {
|
|
2930
|
+
var element = tmp0_iterator.p();
|
|
2931
|
+
var tmp$ret$0;
|
|
2932
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.knowledge.impl.MappedProblogTheory.retract.<anonymous>' call
|
|
2933
|
+
tmp$ret$0 = ClauseMappingUtils_getInstance().m3e(element);
|
|
2934
|
+
var list = tmp$ret$0;
|
|
2935
|
+
addAll(tmp0_flatMapTo, list);
|
|
2936
|
+
}
|
|
2937
|
+
tmp$ret$1 = tmp0_flatMapTo;
|
|
2938
|
+
tmp$ret$2 = tmp$ret$1;
|
|
2939
|
+
var mapped = tmp$ret$2;
|
|
2940
|
+
var result = this.q3e_1.retractIterable(mapped);
|
|
2941
|
+
var tmp;
|
|
2942
|
+
if (result instanceof Success) {
|
|
2943
|
+
tmp = new Success(new MappedProblogTheory(null, this.k1l(), result.h1s()), result.i1t_1);
|
|
2944
|
+
} else {
|
|
2945
|
+
tmp = new Failure(new MappedProblogTheory(null, this.k1l(), result.h1s()));
|
|
2946
|
+
}
|
|
2947
|
+
return tmp;
|
|
2948
|
+
};
|
|
2949
|
+
MappedProblogTheory.prototype.retractIterable = function (clauses) {
|
|
2950
|
+
return this.y1s(clauses);
|
|
2951
|
+
};
|
|
2952
|
+
MappedProblogTheory.prototype.c1m = function (clause) {
|
|
2953
|
+
var mappedClauses = ClauseMappingUtils_getInstance().m3e(clause);
|
|
2954
|
+
var result = null;
|
|
2955
|
+
var tmp0_iterator = mappedClauses.j();
|
|
2956
|
+
while (tmp0_iterator.m()) {
|
|
2957
|
+
var c = tmp0_iterator.p();
|
|
2958
|
+
var tmp;
|
|
2959
|
+
if (result == null) {
|
|
2960
|
+
tmp = true;
|
|
2961
|
+
} else {
|
|
2962
|
+
tmp = !(result instanceof Failure);
|
|
2963
|
+
}
|
|
2964
|
+
if (tmp) {
|
|
2965
|
+
result = this.q3e_1.retractAll(c);
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2968
|
+
var tmp1_subject = result;
|
|
2969
|
+
var tmp_0;
|
|
2970
|
+
if (tmp1_subject instanceof Success) {
|
|
2971
|
+
tmp_0 = new Success(new MappedProblogTheory(null, this.k1l(), result.h1s()), result.i1t_1);
|
|
2972
|
+
} else {
|
|
2973
|
+
tmp_0 = new Failure(this);
|
|
2974
|
+
}
|
|
2975
|
+
return tmp_0;
|
|
2976
|
+
};
|
|
2977
|
+
MappedProblogTheory.prototype.retractAll = function (clause) {
|
|
2978
|
+
return this.c1m(clause);
|
|
2979
|
+
};
|
|
2980
|
+
MappedProblogTheory.prototype.g1s = function (indicator) {
|
|
2981
|
+
return new MappedProblogTheory(null, this.k1l(), this.q3e_1.abolish(ClauseMappingUtils_getInstance().n3e(indicator)));
|
|
2982
|
+
};
|
|
2983
|
+
MappedProblogTheory.prototype.abolish = function (indicator) {
|
|
2984
|
+
return this.g1s(indicator);
|
|
2985
|
+
};
|
|
2986
|
+
MappedProblogTheory.prototype.c1t = function (struct) {
|
|
2987
|
+
return this.p1s(Companion_getInstance().of(struct));
|
|
2988
|
+
};
|
|
2989
|
+
MappedProblogTheory.prototype.assertAFact = function (struct) {
|
|
2990
|
+
return this.c1t(struct);
|
|
2991
|
+
};
|
|
2992
|
+
MappedProblogTheory.prototype.d1t = function (struct) {
|
|
2993
|
+
return this.t1s(Companion_getInstance().of(struct));
|
|
2994
|
+
};
|
|
2995
|
+
MappedProblogTheory.prototype.assertZFact = function (struct) {
|
|
2996
|
+
return this.d1t(struct);
|
|
2997
|
+
};
|
|
2998
|
+
MappedProblogTheory.prototype.p1s = function (clause) {
|
|
2999
|
+
return this.r1s(listOf(clause));
|
|
3000
|
+
};
|
|
3001
|
+
MappedProblogTheory.prototype.assertA = function (clause) {
|
|
3002
|
+
return this.p1s(clause);
|
|
3003
|
+
};
|
|
3004
|
+
MappedProblogTheory.prototype.s1s = function (clauses) {
|
|
3005
|
+
return this.r1s(asIterable_0(clauses));
|
|
3006
|
+
};
|
|
3007
|
+
MappedProblogTheory.prototype.assertASequence = function (clauses) {
|
|
3008
|
+
return this.s1s(clauses);
|
|
3009
|
+
};
|
|
3010
|
+
MappedProblogTheory.prototype.t1s = function (clause) {
|
|
3011
|
+
return this.u1s(listOf(clause));
|
|
3012
|
+
};
|
|
3013
|
+
MappedProblogTheory.prototype.assertZ = function (clause) {
|
|
3014
|
+
return this.t1s(clause);
|
|
3015
|
+
};
|
|
3016
|
+
MappedProblogTheory.prototype.v1s = function (clauses) {
|
|
3017
|
+
return this.u1s(asIterable_0(clauses));
|
|
3018
|
+
};
|
|
3019
|
+
MappedProblogTheory.prototype.assertZSequence = function (clauses) {
|
|
3020
|
+
return this.v1s(clauses);
|
|
3021
|
+
};
|
|
3022
|
+
MappedProblogTheory.prototype.f1t = function (head) {
|
|
3023
|
+
return this.e1t(Companion_getInstance_12().of(head, [Companion_getInstance_1().anonymous()]));
|
|
3024
|
+
};
|
|
3025
|
+
MappedProblogTheory.prototype.retractByHead = function (head) {
|
|
3026
|
+
return this.f1t(head);
|
|
3027
|
+
};
|
|
3028
|
+
MappedProblogTheory.prototype.e1t = function (clause) {
|
|
3029
|
+
return this.y1s(listOf(clause));
|
|
3030
|
+
};
|
|
3031
|
+
MappedProblogTheory.prototype.retract = function (clause) {
|
|
3032
|
+
return this.e1t(clause);
|
|
3033
|
+
};
|
|
3034
|
+
MappedProblogTheory.prototype.x1s = function (clauses) {
|
|
3035
|
+
return this.y1s(asIterable_0(clauses));
|
|
3036
|
+
};
|
|
3037
|
+
MappedProblogTheory.prototype.retractSequence = function (clauses) {
|
|
3038
|
+
return this.x1s(clauses);
|
|
3039
|
+
};
|
|
3040
|
+
MappedProblogTheory.prototype.g1t = function (head) {
|
|
3041
|
+
return this.c1m(Companion_getInstance_12().of(head, [Companion_getInstance_1().anonymous()]));
|
|
3042
|
+
};
|
|
3043
|
+
MappedProblogTheory.prototype.retractAllByHead = function (head) {
|
|
3044
|
+
return this.g1t(head);
|
|
3045
|
+
};
|
|
3046
|
+
function NothingClauseMapper() {
|
|
3047
|
+
NothingClauseMapper_instance = this;
|
|
3048
|
+
}
|
|
3049
|
+
NothingClauseMapper.prototype.a3e = function (clause) {
|
|
3050
|
+
return true;
|
|
3051
|
+
};
|
|
3052
|
+
NothingClauseMapper.prototype.b3e = function (clause) {
|
|
3053
|
+
return listOf(clause);
|
|
3054
|
+
};
|
|
3055
|
+
var NothingClauseMapper_instance;
|
|
3056
|
+
function NothingClauseMapper_getInstance() {
|
|
3057
|
+
if (NothingClauseMapper_instance == null)
|
|
3058
|
+
new NothingClauseMapper();
|
|
3059
|
+
return NothingClauseMapper_instance;
|
|
3060
|
+
}
|
|
3061
|
+
function ProbabilisticClauseMapper() {
|
|
3062
|
+
ProbabilisticClauseMapper_instance = this;
|
|
3063
|
+
}
|
|
3064
|
+
ProbabilisticClauseMapper.prototype.a3e = function (clause) {
|
|
3065
|
+
var tmp;
|
|
3066
|
+
if (isInterface(clause, Rule)) {
|
|
3067
|
+
tmp = clause.ly().fw() === get_ANNOTATION_FUNCTOR();
|
|
3068
|
+
} else {
|
|
3069
|
+
tmp = false;
|
|
3070
|
+
}
|
|
3071
|
+
return tmp;
|
|
3072
|
+
};
|
|
3073
|
+
ProbabilisticClauseMapper.prototype.b3e = function (clause) {
|
|
3074
|
+
if (!isInterface(clause, Rule)) {
|
|
3075
|
+
var tmp = 'Clause is not an instance of Rule: ' + clause;
|
|
3076
|
+
throw ClauseMappingException_init_$Create$(tmp, null, 2, null);
|
|
3077
|
+
}
|
|
3078
|
+
var mapped = this.c3e(clause);
|
|
3079
|
+
return listOf(this.d3e(mapped.g4_1, Companion_getInstance_21().p3d(mapped.h4_1)));
|
|
3080
|
+
};
|
|
3081
|
+
ProbabilisticClauseMapper.prototype.c3e = function (rule) {
|
|
3082
|
+
if (!(rule.ly().zv() === 2)) {
|
|
3083
|
+
throw TuPrologException_init_$Create$('Invalid probabilistic rule: ' + rule.ly());
|
|
3084
|
+
}
|
|
3085
|
+
var probTerm = rule.ly().get(0);
|
|
3086
|
+
var tmp;
|
|
3087
|
+
if (isInterface(probTerm, Numeric)) {
|
|
3088
|
+
tmp = probTerm.x10().toDouble();
|
|
3089
|
+
} else {
|
|
3090
|
+
tmp = solveArithmeticExpression(probTerm);
|
|
3091
|
+
}
|
|
3092
|
+
var probability = tmp;
|
|
3093
|
+
var headTerm = safeToStruct(rule.ly().get(1));
|
|
3094
|
+
var tmp_0 = headTerm.fw();
|
|
3095
|
+
ProblogLib_getInstance();
|
|
3096
|
+
if (tmp_0 === 'evidence') {
|
|
3097
|
+
throw TuPrologException_init_$Create$("Probability notation can't be expressed on evidence: " + rule.ly());
|
|
3098
|
+
}
|
|
3099
|
+
var bodyTerm = rule.my();
|
|
3100
|
+
var tmp_1 = rule.my();
|
|
3101
|
+
if (isInterface(tmp_1, Truth)) {
|
|
3102
|
+
if (!rule.my().dw() ? probability < 1.0 : false) {
|
|
3103
|
+
probability = 1.0 - probability;
|
|
3104
|
+
bodyTerm = Companion_getInstance_15().of(true);
|
|
3105
|
+
}
|
|
3106
|
+
}
|
|
3107
|
+
var anonVariablesFix = withoutAnonymousVars(Companion_getInstance_12().of(headTerm, [bodyTerm]));
|
|
3108
|
+
headTerm = anonVariablesFix.ly();
|
|
3109
|
+
bodyTerm = anonVariablesFix.my();
|
|
3110
|
+
var extraVariables = get_extraVariables(Companion_getInstance_12().of(headTerm, [bodyTerm]));
|
|
3111
|
+
var probTerm_0 = new ProbTerm(ClauseMappingUtils_getInstance().l3e(), probability, headTerm, extraVariables);
|
|
3112
|
+
return new Pair(Companion_getInstance_12().of(headTerm, [bodyTerm]), probTerm_0);
|
|
3113
|
+
};
|
|
3114
|
+
ProbabilisticClauseMapper.prototype.d3e = function (rule, explanation) {
|
|
3115
|
+
var tmp = rule.my();
|
|
3116
|
+
if (isInterface(tmp, Truth)) {
|
|
3117
|
+
return Companion_getInstance_12().of(withExplanation(rule.ly(), toTerm(explanation)), [rule.my()]);
|
|
3118
|
+
}
|
|
3119
|
+
var tmp_0 = Companion_getInstance_1();
|
|
3120
|
+
ProblogLib_getInstance();
|
|
3121
|
+
var explanationVar = tmp_0.of('EXPL' + '_Res');
|
|
3122
|
+
var tmp_1 = Companion_getInstance_1();
|
|
3123
|
+
ProblogLib_getInstance();
|
|
3124
|
+
var explanationBodyVar = tmp_1.of('EXPL' + '_Body');
|
|
3125
|
+
var newBody = withBodyExplanation(rule.my(), explanationBodyVar);
|
|
3126
|
+
var tmp_2 = Companion_getInstance_12();
|
|
3127
|
+
var tmp_3 = withExplanation(rule.ly(), explanationVar);
|
|
3128
|
+
var tmp_4 = Companion_getInstance_3();
|
|
3129
|
+
var tmp_5 = Companion_getInstance_3();
|
|
3130
|
+
var tmp$ret$0;
|
|
3131
|
+
// Inline function 'it.unibo.tuprolog.solve.AbstractWrapper.functor' call
|
|
3132
|
+
var tmp0__get_functor__thl4dk = ProbExplAnd_getInstance();
|
|
3133
|
+
tmp$ret$0 = tmp0__get_functor__thl4dk.signature.name;
|
|
3134
|
+
return tmp_2.of(tmp_3, [tmp_4.of(',', [newBody, tmp_5.of(tmp$ret$0, [explanationVar, explanationBodyVar, toTerm(explanation)])])]);
|
|
3135
|
+
};
|
|
3136
|
+
var ProbabilisticClauseMapper_instance;
|
|
3137
|
+
function ProbabilisticClauseMapper_getInstance() {
|
|
3138
|
+
if (ProbabilisticClauseMapper_instance == null)
|
|
3139
|
+
new ProbabilisticClauseMapper();
|
|
3140
|
+
return ProbabilisticClauseMapper_instance;
|
|
3141
|
+
}
|
|
3142
|
+
function PrologClauseMapper() {
|
|
3143
|
+
PrologClauseMapper_instance = this;
|
|
3144
|
+
}
|
|
3145
|
+
PrologClauseMapper.prototype.a3e = function (clause) {
|
|
3146
|
+
return isInterface(clause, Rule);
|
|
3147
|
+
};
|
|
3148
|
+
PrologClauseMapper.prototype.b3e = function (clause) {
|
|
3149
|
+
if (!isInterface(clause, Rule)) {
|
|
3150
|
+
var tmp = 'Clause is not an instance of Rule: ' + clause;
|
|
3151
|
+
throw ClauseMappingException_init_$Create$(tmp, null, 2, null);
|
|
3152
|
+
}
|
|
3153
|
+
var tmp_0 = clause.my();
|
|
3154
|
+
if (isInterface(tmp_0, Truth)) {
|
|
3155
|
+
return listOf(Companion_getInstance_12().of(withExplanation(clause.ly(), toTerm(Companion_getInstance_21().l3d_1)), [clause.my()]));
|
|
3156
|
+
}
|
|
3157
|
+
var tmp_1 = Companion_getInstance_1();
|
|
3158
|
+
ProblogLib_getInstance();
|
|
3159
|
+
var explanationVar = tmp_1.of('EXPL' + '_Res');
|
|
3160
|
+
return listOf(Companion_getInstance_12().of(withExplanation(clause.ly(), explanationVar), [withBodyExplanation(clause.my(), explanationVar)]));
|
|
3161
|
+
};
|
|
3162
|
+
var PrologClauseMapper_instance;
|
|
3163
|
+
function PrologClauseMapper_getInstance() {
|
|
3164
|
+
if (PrologClauseMapper_instance == null)
|
|
3165
|
+
new PrologClauseMapper();
|
|
3166
|
+
return PrologClauseMapper_instance;
|
|
3167
|
+
}
|
|
3168
|
+
function ProbExplAnd() {
|
|
3169
|
+
ProbExplAnd_instance = this;
|
|
3170
|
+
ProblogLib_getInstance();
|
|
3171
|
+
NonBacktrackable.call(this, 'prob' + '_expl_and');
|
|
3172
|
+
}
|
|
3173
|
+
ProbExplAnd.prototype.z2r = function (_this__u8e3s4, first, second, third) {
|
|
3174
|
+
Companion_getInstance_19().h2h(_this__u8e3s4, 1);
|
|
3175
|
+
Companion_getInstance_19().n2h(_this__u8e3s4, 1);
|
|
3176
|
+
if (ProbSetConfig_getInstance().s3e(_this__u8e3s4.context)) {
|
|
3177
|
+
var tmp = Companion_getInstance_19().b2h(_this__u8e3s4, first, toTerm(Companion_getInstance_21().l3d_1));
|
|
3178
|
+
return _this__u8e3s4.g2g(tmp, null, [], 6, null);
|
|
3179
|
+
}
|
|
3180
|
+
var tmp_0;
|
|
3181
|
+
var tmp_1;
|
|
3182
|
+
var tmp_2;
|
|
3183
|
+
if (isInterface(first, Var)) {
|
|
3184
|
+
tmp_2 = second instanceof ProbExplanationTerm;
|
|
3185
|
+
} else {
|
|
3186
|
+
tmp_2 = false;
|
|
3187
|
+
}
|
|
3188
|
+
if (tmp_2) {
|
|
3189
|
+
tmp_1 = third instanceof ProbExplanationTerm;
|
|
3190
|
+
} else {
|
|
3191
|
+
tmp_1 = false;
|
|
3192
|
+
}
|
|
3193
|
+
if (tmp_1) {
|
|
3194
|
+
var explanation = (second.h3c_1.x3d() === 0.0 ? true : third.h3c_1.x3d() === 0.0) ? Companion_getInstance_21().k3d_1 : (second.h3c_1.x3d() === 1.0 ? third.h3c_1.x3d() === 1.0 : false) ? Companion_getInstance_21().l3d_1 : second.h3c_1.x3d() === 1.0 ? third.h3c_1 : third.h3c_1.x3d() === 1.0 ? second.h3c_1 : second.h3c_1.and(third.h3c_1);
|
|
3195
|
+
var tmp_3;
|
|
3196
|
+
if (explanation.x3d() === 0.0) {
|
|
3197
|
+
tmp_3 = _this__u8e3s4.y2i(false, null, [], 6, null);
|
|
3198
|
+
} else {
|
|
3199
|
+
var tmp_4 = Companion_getInstance_19().b2h(_this__u8e3s4, first, new ProbExplanationTerm(explanation));
|
|
3200
|
+
tmp_3 = _this__u8e3s4.g2g(tmp_4, null, [], 6, null);
|
|
3201
|
+
}
|
|
3202
|
+
tmp_0 = tmp_3;
|
|
3203
|
+
} else {
|
|
3204
|
+
var tmp$ret$0;
|
|
3205
|
+
// Inline function 'it.unibo.tuprolog.solve.AbstractWrapper.functor' call
|
|
3206
|
+
tmp$ret$0 = this.signature.name;
|
|
3207
|
+
var tmp_5 = "Can't compute " + tmp$ret$0;
|
|
3208
|
+
var tmp_6 = ResolutionException_init_$Create$(tmp_5, null, _this__u8e3s4.context, [], 10, null);
|
|
3209
|
+
tmp_0 = _this__u8e3s4.c2j(tmp_6, null, [], 6, null);
|
|
3210
|
+
}
|
|
3211
|
+
return tmp_0;
|
|
3212
|
+
};
|
|
3213
|
+
ProbExplAnd.prototype.r2j = function (_this__u8e3s4, first, second, third) {
|
|
3214
|
+
return this.z2r(_this__u8e3s4, first, second, third);
|
|
3215
|
+
};
|
|
3216
|
+
var ProbExplAnd_instance;
|
|
3217
|
+
function ProbExplAnd_getInstance() {
|
|
3218
|
+
if (ProbExplAnd_instance == null)
|
|
3219
|
+
new ProbExplAnd();
|
|
3220
|
+
return ProbExplAnd_instance;
|
|
3221
|
+
}
|
|
3222
|
+
function ProbHelper$computeAllSubstitutions$slambda($goal, $this_computeAllSubstitutions, $third, $first, $second, $goalSignature, resultContinuation) {
|
|
3223
|
+
this.b3f_1 = $goal;
|
|
3224
|
+
this.c3f_1 = $this_computeAllSubstitutions;
|
|
3225
|
+
this.d3f_1 = $third;
|
|
3226
|
+
this.e3f_1 = $first;
|
|
3227
|
+
this.f3f_1 = $second;
|
|
3228
|
+
this.g3f_1 = $goalSignature;
|
|
3229
|
+
CoroutineImpl.call(this, resultContinuation);
|
|
3230
|
+
}
|
|
3231
|
+
ProbHelper$computeAllSubstitutions$slambda.prototype.t2t = function ($this$sequence, $cont) {
|
|
3232
|
+
var tmp = this.u2t($this$sequence, $cont);
|
|
3233
|
+
tmp.ei_1 = Unit_getInstance();
|
|
3234
|
+
tmp.fi_1 = null;
|
|
3235
|
+
return tmp.ki();
|
|
3236
|
+
};
|
|
3237
|
+
ProbHelper$computeAllSubstitutions$slambda.prototype.wi = function (p1, $cont) {
|
|
3238
|
+
return this.t2t(p1 instanceof SequenceScope ? p1 : THROW_CCE(), $cont);
|
|
3239
|
+
};
|
|
3240
|
+
ProbHelper$computeAllSubstitutions$slambda.prototype.ki = function () {
|
|
3241
|
+
var suspendResult = this.ei_1;
|
|
3242
|
+
$sm: do
|
|
3243
|
+
try {
|
|
3244
|
+
var tmp = this.ci_1;
|
|
3245
|
+
switch (tmp) {
|
|
3246
|
+
case 0:
|
|
3247
|
+
this.di_1 = 18;
|
|
3248
|
+
this.i3f_1 = this.b3f_1.fw();
|
|
3249
|
+
if (this.i3f_1 === '\\+' ? true : this.i3f_1 === 'not') {
|
|
3250
|
+
this.ci_1 = 16;
|
|
3251
|
+
var tmp_0;
|
|
3252
|
+
if (ProbSetConfig_getInstance().s3e(this.c3f_1.context)) {
|
|
3253
|
+
var tmp_1 = Companion_getInstance_19();
|
|
3254
|
+
var tmp_2 = Companion_getInstance_3();
|
|
3255
|
+
var tmp_3 = this.b3f_1.fw();
|
|
3256
|
+
var tmp_4 = Companion_getInstance_3();
|
|
3257
|
+
var tmp0__get_functor__thl4dk = Prob_getInstance();
|
|
3258
|
+
tmp_0 = tmp_1.b2h(this.c3f_1, this.d3f_1, tmp_2.of(tmp_3, [tmp_4.of(tmp0__get_functor__thl4dk.signature.name, [Companion_getInstance_1().anonymous(), this.b3f_1.get(0)])])).plus(Companion_getInstance_19().b2h(this.c3f_1, this.e3f_1, toTerm(Companion_getInstance_21().l3d_1)));
|
|
3259
|
+
} else {
|
|
3260
|
+
var tmp_5 = Companion_getInstance_19();
|
|
3261
|
+
var tmp_6 = Companion_getInstance_3();
|
|
3262
|
+
var tmp1__get_functor__4k11yf = ProbNegationAsFailure_getInstance();
|
|
3263
|
+
tmp_0 = tmp_5.b2h(this.c3f_1, this.d3f_1, tmp_6.of(tmp1__get_functor__4k11yf.signature.name, [this.e3f_1, this.b3f_1.get(0)]));
|
|
3264
|
+
}
|
|
3265
|
+
suspendResult = this.h3f_1.z4(tmp_0, this);
|
|
3266
|
+
if (suspendResult === get_COROUTINE_SUSPENDED()) {
|
|
3267
|
+
return suspendResult;
|
|
3268
|
+
}
|
|
3269
|
+
continue $sm;
|
|
3270
|
+
} else {
|
|
3271
|
+
if ((this.i3f_1 === ',' ? true : this.i3f_1 === ';') ? true : this.i3f_1 === '->') {
|
|
3272
|
+
this.ci_1 = 15;
|
|
3273
|
+
var tmp_7;
|
|
3274
|
+
if (ProbSetConfig_getInstance().s3e(this.c3f_1.context)) {
|
|
3275
|
+
tmp_7 = Companion_getInstance_19().b2h(this.c3f_1, this.d3f_1, withBodyExplanation(this.b3f_1, Companion_getInstance_1().anonymous())).plus(Companion_getInstance_19().b2h(this.c3f_1, this.e3f_1, toTerm(Companion_getInstance_21().l3d_1)));
|
|
3276
|
+
} else {
|
|
3277
|
+
tmp_7 = Companion_getInstance_19().b2h(this.c3f_1, this.d3f_1, withBodyExplanation(this.b3f_1, this.e3f_1));
|
|
3278
|
+
}
|
|
3279
|
+
suspendResult = this.h3f_1.z4(tmp_7, this);
|
|
3280
|
+
if (suspendResult === get_COROUTINE_SUSPENDED()) {
|
|
3281
|
+
return suspendResult;
|
|
3282
|
+
}
|
|
3283
|
+
continue $sm;
|
|
3284
|
+
} else {
|
|
3285
|
+
if (this.i3f_1 === 'call') {
|
|
3286
|
+
this.j3f_1 = this.b3f_1.get(0);
|
|
3287
|
+
this.ci_1 = 14;
|
|
3288
|
+
suspendResult = this.h3f_1.z4(Companion_getInstance_19().b2h(this.c3f_1, this.d3f_1, Companion_getInstance_2().of(Companion_getInstance_3().of('ensure_executable', [this.j3f_1]), Companion_getInstance_3().of(this.b3f_1.fw(), [withBodyExplanation(this.j3f_1, this.e3f_1)]))), this);
|
|
3289
|
+
if (suspendResult === get_COROUTINE_SUSPENDED()) {
|
|
3290
|
+
return suspendResult;
|
|
3291
|
+
}
|
|
3292
|
+
continue $sm;
|
|
3293
|
+
} else {
|
|
3294
|
+
if (this.i3f_1 === 'catch') {
|
|
3295
|
+
this.ci_1 = 13;
|
|
3296
|
+
suspendResult = this.h3f_1.z4(Companion_getInstance_19().b2h(this.c3f_1, this.d3f_1, Companion_getInstance_3().of(this.b3f_1.fw(), [withBodyExplanation(this.b3f_1.get(0), this.e3f_1), this.b3f_1.get(1), withBodyExplanation(this.b3f_1.get(2), this.e3f_1)])), this);
|
|
3297
|
+
if (suspendResult === get_COROUTINE_SUSPENDED()) {
|
|
3298
|
+
return suspendResult;
|
|
3299
|
+
}
|
|
3300
|
+
continue $sm;
|
|
3301
|
+
} else {
|
|
3302
|
+
if (this.i3f_1 === 'findall') {
|
|
3303
|
+
var tmp_8 = this;
|
|
3304
|
+
var tmp2_toTypedArray = this.b3f_1.gw();
|
|
3305
|
+
tmp_8.k3f_1 = copyToArray(tmp2_toTypedArray);
|
|
3306
|
+
this.k3f_1[1] = withBodyExplanation(this.k3f_1[1], Companion_getInstance_1().anonymous());
|
|
3307
|
+
this.ci_1 = 12;
|
|
3308
|
+
suspendResult = this.h3f_1.z4(Companion_getInstance_19().b2h(this.c3f_1, this.d3f_1, Companion_getInstance_3().of(this.b3f_1.fw(), this.k3f_1.slice())).plus(Companion_getInstance_19().b2h(this.c3f_1, this.e3f_1, toTerm(Companion_getInstance_21().l3d_1))), this);
|
|
3309
|
+
if (suspendResult === get_COROUTINE_SUSPENDED()) {
|
|
3310
|
+
return suspendResult;
|
|
3311
|
+
}
|
|
3312
|
+
continue $sm;
|
|
3313
|
+
} else {
|
|
3314
|
+
if ((this.i3f_1 === 'assert' ? true : this.i3f_1 === 'asserta') ? true : this.i3f_1 === 'assertz') {
|
|
3315
|
+
this.l3f_1 = this.b3f_1.get(0);
|
|
3316
|
+
var tmp_9 = this;
|
|
3317
|
+
var tmp1_subject = this.l3f_1;
|
|
3318
|
+
var tmp_10;
|
|
3319
|
+
if (isInterface(tmp1_subject, Clause)) {
|
|
3320
|
+
tmp_10 = extractSignature(ensureNotNull(this.l3f_1.ly()));
|
|
3321
|
+
} else {
|
|
3322
|
+
tmp_10 = extractSignature(safeToStruct(this.l3f_1));
|
|
3323
|
+
}
|
|
3324
|
+
tmp_9.m3f_1 = tmp_10;
|
|
3325
|
+
var tmp_11;
|
|
3326
|
+
if (this.c3f_1.context.w1u().containsSignature(this.m3f_1)) {
|
|
3327
|
+
tmp_11 = true;
|
|
3328
|
+
} else {
|
|
3329
|
+
var tmp_12;
|
|
3330
|
+
var tmp_13 = this.l3f_1;
|
|
3331
|
+
if (isInterface(tmp_13, Clause)) {
|
|
3332
|
+
tmp_12 = !this.l3f_1.vy();
|
|
3333
|
+
} else {
|
|
3334
|
+
tmp_12 = false;
|
|
3335
|
+
}
|
|
3336
|
+
tmp_11 = tmp_12;
|
|
3337
|
+
}
|
|
3338
|
+
if (tmp_11) {
|
|
3339
|
+
this.ci_1 = 10;
|
|
3340
|
+
suspendResult = this.h3f_1.z4(Companion_getInstance_19().b2h(this.c3f_1, this.d3f_1, this.b3f_1).plus(Companion_getInstance_19().b2h(this.c3f_1, this.e3f_1, toTerm(Companion_getInstance_21().l3d_1))), this);
|
|
3341
|
+
if (suspendResult === get_COROUTINE_SUSPENDED()) {
|
|
3342
|
+
return suspendResult;
|
|
3343
|
+
}
|
|
3344
|
+
continue $sm;
|
|
3345
|
+
} else {
|
|
3346
|
+
var tmp_14 = this;
|
|
3347
|
+
var tmp2_subject = this.l3f_1;
|
|
3348
|
+
var tmp_15;
|
|
3349
|
+
if (isInterface(tmp2_subject, Clause)) {
|
|
3350
|
+
tmp_15 = ClauseMappingUtils_getInstance().m3e(this.l3f_1);
|
|
3351
|
+
} else {
|
|
3352
|
+
if (isInterface(tmp2_subject, Struct)) {
|
|
3353
|
+
var tmp3_map = ClauseMappingUtils_getInstance().m3e(Companion_getInstance().of(this.l3f_1));
|
|
3354
|
+
var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp3_map, 10));
|
|
3355
|
+
var tmp0_iterator = tmp3_map.j();
|
|
3356
|
+
while (tmp0_iterator.m()) {
|
|
3357
|
+
var item = tmp0_iterator.p();
|
|
3358
|
+
tmp0_mapTo.g(ensureNotNull(item.ly()));
|
|
3359
|
+
}
|
|
3360
|
+
tmp_15 = tmp0_mapTo;
|
|
3361
|
+
} else {
|
|
3362
|
+
tmp_15 = listOf(this.l3f_1);
|
|
3363
|
+
}
|
|
3364
|
+
}
|
|
3365
|
+
tmp_14.n3f_1 = tmp_15;
|
|
3366
|
+
this.ci_1 = 9;
|
|
3367
|
+
var tmp0_mapTo_0 = ArrayList_init_$Create$(collectionSizeOrDefault(this.n3f_1, 10));
|
|
3368
|
+
var tmp0_iterator_0 = this.n3f_1.j();
|
|
3369
|
+
while (tmp0_iterator_0.m()) {
|
|
3370
|
+
var item_0 = tmp0_iterator_0.p();
|
|
3371
|
+
tmp0_mapTo_0.g(Companion_getInstance_19().b2h(this.c3f_1, this.d3f_1, Companion_getInstance_3().of(this.b3f_1.fw(), [item_0])).plus(Companion_getInstance_19().b2h(this.c3f_1, this.e3f_1, toTerm(Companion_getInstance_21().l3d_1))));
|
|
3372
|
+
}
|
|
3373
|
+
suspendResult = this.h3f_1.b5(tmp0_mapTo_0, this);
|
|
3374
|
+
if (suspendResult === get_COROUTINE_SUSPENDED()) {
|
|
3375
|
+
return suspendResult;
|
|
3376
|
+
}
|
|
3377
|
+
continue $sm;
|
|
3378
|
+
}
|
|
3379
|
+
} else {
|
|
3380
|
+
if (this.i3f_1 === 'retract' ? true : this.i3f_1 === 'retractall') {
|
|
3381
|
+
this.o3f_1 = this.b3f_1.get(0);
|
|
3382
|
+
this.ci_1 = 8;
|
|
3383
|
+
var tmp_16 = Companion_getInstance_19();
|
|
3384
|
+
var tmp_17 = Companion_getInstance_3();
|
|
3385
|
+
var tmp_18 = this.b3f_1.fw();
|
|
3386
|
+
var tmp_19;
|
|
3387
|
+
var tmp_20;
|
|
3388
|
+
var tmp_21;
|
|
3389
|
+
if (this.o3f_1.mw()) {
|
|
3390
|
+
tmp_21 = true;
|
|
3391
|
+
} else {
|
|
3392
|
+
var tmp_22;
|
|
3393
|
+
var tmp_23 = this.o3f_1;
|
|
3394
|
+
if (isInterface(tmp_23, Struct)) {
|
|
3395
|
+
tmp_22 = this.o3f_1.fw() === ':-';
|
|
3396
|
+
} else {
|
|
3397
|
+
tmp_22 = false;
|
|
3398
|
+
}
|
|
3399
|
+
tmp_21 = tmp_22;
|
|
3400
|
+
}
|
|
3401
|
+
if (tmp_21) {
|
|
3402
|
+
tmp_20 = true;
|
|
3403
|
+
} else {
|
|
3404
|
+
tmp_20 = this.c3f_1.context.w1u().containsSignature(extractSignature(safeToStruct(this.o3f_1)));
|
|
3405
|
+
}
|
|
3406
|
+
if (tmp_20) {
|
|
3407
|
+
tmp_19 = this.o3f_1;
|
|
3408
|
+
} else {
|
|
3409
|
+
tmp_19 = withExplanation(this.o3f_1, this.e3f_1);
|
|
3410
|
+
}
|
|
3411
|
+
suspendResult = this.h3f_1.z4(tmp_16.b2h(this.c3f_1, this.d3f_1, tmp_17.of(tmp_18, [tmp_19])), this);
|
|
3412
|
+
if (suspendResult === get_COROUTINE_SUSPENDED()) {
|
|
3413
|
+
return suspendResult;
|
|
3414
|
+
}
|
|
3415
|
+
continue $sm;
|
|
3416
|
+
} else {
|
|
3417
|
+
if (this.i3f_1 === 'clause') {
|
|
3418
|
+
this.p3f_1 = this.b3f_1.get(0);
|
|
3419
|
+
var tmp_24;
|
|
3420
|
+
var tmp_25 = this.p3f_1;
|
|
3421
|
+
if (!isInterface(tmp_25, Struct)) {
|
|
3422
|
+
tmp_24 = true;
|
|
3423
|
+
} else {
|
|
3424
|
+
tmp_24 = this.c3f_1.context.w1u().hasProtected(extractSignature(this.p3f_1));
|
|
3425
|
+
}
|
|
3426
|
+
if (tmp_24) {
|
|
3427
|
+
this.ci_1 = 6;
|
|
3428
|
+
suspendResult = this.h3f_1.z4(Companion_getInstance_19().b2h(this.c3f_1, this.d3f_1, this.b3f_1).plus(Companion_getInstance_19().b2h(this.c3f_1, this.e3f_1, toTerm(Companion_getInstance_21().l3d_1))), this);
|
|
3429
|
+
if (suspendResult === get_COROUTINE_SUSPENDED()) {
|
|
3430
|
+
return suspendResult;
|
|
3431
|
+
}
|
|
3432
|
+
continue $sm;
|
|
3433
|
+
} else {
|
|
3434
|
+
this.ci_1 = 5;
|
|
3435
|
+
suspendResult = this.h3f_1.z4(Companion_getInstance_19().b2h(this.c3f_1, this.d3f_1, Companion_getInstance_3().of(this.b3f_1.fw(), [withExplanation(this.b3f_1.get(0), this.e3f_1), this.b3f_1.get(1)])), this);
|
|
3436
|
+
if (suspendResult === get_COROUTINE_SUSPENDED()) {
|
|
3437
|
+
return suspendResult;
|
|
3438
|
+
}
|
|
3439
|
+
continue $sm;
|
|
3440
|
+
}
|
|
3441
|
+
} else {
|
|
3442
|
+
var tmp_26 = this;
|
|
3443
|
+
var tmp_27;
|
|
3444
|
+
var tmp_28 = this.f3f_1;
|
|
3445
|
+
if (isInterface(tmp_28, Truth)) {
|
|
3446
|
+
tmp_27 = true;
|
|
3447
|
+
} else {
|
|
3448
|
+
tmp_27 = this.c3f_1.context.w1u().containsSignature(this.g3f_1);
|
|
3449
|
+
}
|
|
3450
|
+
tmp_26.q3f_1 = tmp_27;
|
|
3451
|
+
if ((this.q3f_1 ? true : this.c3f_1.context.y1u().containsIndicator(this.g3f_1.toIndicator())) ? true : this.c3f_1.context.z1u().containsIndicator(this.g3f_1.toIndicator())) {
|
|
3452
|
+
this.ci_1 = 1;
|
|
3453
|
+
suspendResult = this.h3f_1.z4(Companion_getInstance_19().b2h(this.c3f_1, this.d3f_1, this.b3f_1).plus(Companion_getInstance_19().b2h(this.c3f_1, this.e3f_1, toTerm(Companion_getInstance_21().l3d_1))), this);
|
|
3454
|
+
if (suspendResult === get_COROUTINE_SUSPENDED()) {
|
|
3455
|
+
return suspendResult;
|
|
3456
|
+
}
|
|
3457
|
+
continue $sm;
|
|
3458
|
+
} else {
|
|
3459
|
+
this.ci_1 = 2;
|
|
3460
|
+
continue $sm;
|
|
3461
|
+
}
|
|
3462
|
+
}
|
|
3463
|
+
}
|
|
3464
|
+
}
|
|
3465
|
+
}
|
|
3466
|
+
}
|
|
3467
|
+
}
|
|
3468
|
+
}
|
|
3469
|
+
}
|
|
3470
|
+
|
|
3471
|
+
break;
|
|
3472
|
+
case 1:
|
|
3473
|
+
this.ci_1 = 2;
|
|
3474
|
+
continue $sm;
|
|
3475
|
+
case 2:
|
|
3476
|
+
if (!this.q3f_1) {
|
|
3477
|
+
this.ci_1 = 3;
|
|
3478
|
+
suspendResult = this.h3f_1.z4(Companion_getInstance_19().b2h(this.c3f_1, this.d3f_1, withExplanation(this.b3f_1, this.e3f_1)), this);
|
|
3479
|
+
if (suspendResult === get_COROUTINE_SUSPENDED()) {
|
|
3480
|
+
return suspendResult;
|
|
3481
|
+
}
|
|
3482
|
+
continue $sm;
|
|
3483
|
+
} else {
|
|
3484
|
+
this.ci_1 = 4;
|
|
3485
|
+
continue $sm;
|
|
3486
|
+
}
|
|
3487
|
+
|
|
3488
|
+
break;
|
|
3489
|
+
case 3:
|
|
3490
|
+
this.ci_1 = 4;
|
|
3491
|
+
continue $sm;
|
|
3492
|
+
case 4:
|
|
3493
|
+
this.ci_1 = 17;
|
|
3494
|
+
continue $sm;
|
|
3495
|
+
case 5:
|
|
3496
|
+
this.ci_1 = 7;
|
|
3497
|
+
continue $sm;
|
|
3498
|
+
case 6:
|
|
3499
|
+
this.ci_1 = 7;
|
|
3500
|
+
continue $sm;
|
|
3501
|
+
case 7:
|
|
3502
|
+
this.ci_1 = 17;
|
|
3503
|
+
continue $sm;
|
|
3504
|
+
case 8:
|
|
3505
|
+
this.ci_1 = 17;
|
|
3506
|
+
continue $sm;
|
|
3507
|
+
case 9:
|
|
3508
|
+
this.ci_1 = 11;
|
|
3509
|
+
continue $sm;
|
|
3510
|
+
case 10:
|
|
3511
|
+
this.ci_1 = 11;
|
|
3512
|
+
continue $sm;
|
|
3513
|
+
case 11:
|
|
3514
|
+
this.ci_1 = 17;
|
|
3515
|
+
continue $sm;
|
|
3516
|
+
case 12:
|
|
3517
|
+
this.ci_1 = 17;
|
|
3518
|
+
continue $sm;
|
|
3519
|
+
case 13:
|
|
3520
|
+
this.ci_1 = 17;
|
|
3521
|
+
continue $sm;
|
|
3522
|
+
case 14:
|
|
3523
|
+
this.ci_1 = 17;
|
|
3524
|
+
continue $sm;
|
|
3525
|
+
case 15:
|
|
3526
|
+
this.ci_1 = 17;
|
|
3527
|
+
continue $sm;
|
|
3528
|
+
case 16:
|
|
3529
|
+
this.ci_1 = 17;
|
|
3530
|
+
continue $sm;
|
|
3531
|
+
case 17:
|
|
3532
|
+
return Unit_getInstance();
|
|
3533
|
+
case 18:
|
|
3534
|
+
throw this.fi_1;
|
|
3535
|
+
}
|
|
3536
|
+
} catch ($p) {
|
|
3537
|
+
if (this.di_1 === 18) {
|
|
3538
|
+
throw $p;
|
|
3539
|
+
} else {
|
|
3540
|
+
this.ci_1 = this.di_1;
|
|
3541
|
+
this.fi_1 = $p;
|
|
3542
|
+
}
|
|
3543
|
+
}
|
|
3544
|
+
while (true);
|
|
3545
|
+
};
|
|
3546
|
+
ProbHelper$computeAllSubstitutions$slambda.prototype.u2t = function ($this$sequence, completion) {
|
|
3547
|
+
var i = new ProbHelper$computeAllSubstitutions$slambda(this.b3f_1, this.c3f_1, this.d3f_1, this.e3f_1, this.f3f_1, this.g3f_1, completion);
|
|
3548
|
+
i.h3f_1 = $this$sequence;
|
|
3549
|
+
return i;
|
|
3550
|
+
};
|
|
3551
|
+
function ProbHelper$computeAllSubstitutions$slambda_0($goal, $this_computeAllSubstitutions, $third, $first, $second, $goalSignature, resultContinuation) {
|
|
3552
|
+
var i = new ProbHelper$computeAllSubstitutions$slambda($goal, $this_computeAllSubstitutions, $third, $first, $second, $goalSignature, resultContinuation);
|
|
3553
|
+
var l = function ($this$sequence, $cont) {
|
|
3554
|
+
return i.t2t($this$sequence, $cont);
|
|
3555
|
+
};
|
|
3556
|
+
l.$arity = 1;
|
|
3557
|
+
return l;
|
|
3558
|
+
}
|
|
3559
|
+
function ProbHelper() {
|
|
3560
|
+
ProbHelper_instance = this;
|
|
3561
|
+
ProblogLib_getInstance();
|
|
3562
|
+
WithoutSideEffects.call(this, 'prob' + '_helper');
|
|
3563
|
+
}
|
|
3564
|
+
ProbHelper.prototype.r2p = function (_this__u8e3s4, first, second, third) {
|
|
3565
|
+
Companion_getInstance_19().h2h(_this__u8e3s4, 1);
|
|
3566
|
+
Companion_getInstance_19().n2h(_this__u8e3s4, 1);
|
|
3567
|
+
var goal = safeToStruct(second);
|
|
3568
|
+
var goalSignature = extractSignature(goal);
|
|
3569
|
+
return sequence(ProbHelper$computeAllSubstitutions$slambda_0(goal, _this__u8e3s4, third, first, second, goalSignature, null));
|
|
3570
|
+
};
|
|
3571
|
+
ProbHelper.prototype.n2j = function (_this__u8e3s4, first, second, third) {
|
|
3572
|
+
return this.r2p(_this__u8e3s4, first, second, third);
|
|
3573
|
+
};
|
|
3574
|
+
var ProbHelper_instance;
|
|
3575
|
+
function ProbHelper_getInstance() {
|
|
3576
|
+
if (ProbHelper_instance == null)
|
|
3577
|
+
new ProbHelper();
|
|
3578
|
+
return ProbHelper_instance;
|
|
3579
|
+
}
|
|
3580
|
+
function ProbNegationAsFailure() {
|
|
3581
|
+
ProbNegationAsFailure_instance = this;
|
|
3582
|
+
ProblogLib_getInstance();
|
|
3583
|
+
NonBacktrackable_0.call(this, 'prob' + '_negation_as_failure');
|
|
3584
|
+
}
|
|
3585
|
+
ProbNegationAsFailure.prototype.x2p = function (_this__u8e3s4, first, second) {
|
|
3586
|
+
Companion_getInstance_19().h2h(_this__u8e3s4, 1);
|
|
3587
|
+
Companion_getInstance_19().n2h(_this__u8e3s4, 1);
|
|
3588
|
+
var tmp;
|
|
3589
|
+
if (!second.jx()) {
|
|
3590
|
+
var tmp_0 = 'Probabilistic negation does not support non-ground goals: ' + second;
|
|
3591
|
+
var tmp_1 = ResolutionException_init_$Create$(tmp_0, null, _this__u8e3s4.context, [], 10, null);
|
|
3592
|
+
tmp = _this__u8e3s4.c2j(tmp_1, null, [], 6, null);
|
|
3593
|
+
} else {
|
|
3594
|
+
var explanationTermVar = Companion_getInstance_1().of('Explanation');
|
|
3595
|
+
var tmp_2 = _this__u8e3s4.subSolver();
|
|
3596
|
+
var tmp_3 = Companion_getInstance_3();
|
|
3597
|
+
var tmp$ret$0;
|
|
3598
|
+
// Inline function 'it.unibo.tuprolog.solve.AbstractWrapper.functor' call
|
|
3599
|
+
var tmp0__get_functor__thl4dk = ProbSolve_getInstance();
|
|
3600
|
+
tmp$ret$0 = tmp0__get_functor__thl4dk.signature.name;
|
|
3601
|
+
var solution = firstOrNull(tmp_2.solveWithOptions(tmp_3.of(tmp$ret$0, [explanationTermVar, second]), setProbabilistic(Companion_getInstance_5().DEFAULT, false)));
|
|
3602
|
+
var tmp_4;
|
|
3603
|
+
if (solution == null) {
|
|
3604
|
+
tmp_4 = _this__u8e3s4.l2g(null, [], 3, null);
|
|
3605
|
+
} else {
|
|
3606
|
+
var explanationTerm = solution.r1u().a3(explanationTermVar);
|
|
3607
|
+
var tmp_5;
|
|
3608
|
+
var tmp_6;
|
|
3609
|
+
if (explanationTerm == null) {
|
|
3610
|
+
tmp_6 = true;
|
|
3611
|
+
} else {
|
|
3612
|
+
tmp_6 = !(explanationTerm instanceof ProbExplanationTerm);
|
|
3613
|
+
}
|
|
3614
|
+
if (tmp_6) {
|
|
3615
|
+
var tmp_7 = 'No valid explanation has been solved for goal: ' + second;
|
|
3616
|
+
var tmp_8 = ResolutionException_init_$Create$(tmp_7, null, _this__u8e3s4.context, [], 10, null);
|
|
3617
|
+
tmp_5 = _this__u8e3s4.c2j(tmp_8, null, [], 6, null);
|
|
3618
|
+
} else {
|
|
3619
|
+
var tmp_9 = Companion_getInstance_9().ofSubstitution(Companion_getInstance_19().b2h(_this__u8e3s4, first, new ProbExplanationTerm(explanationTerm.h3c_1.not())), []);
|
|
3620
|
+
tmp_5 = _this__u8e3s4.g2g(tmp_9, null, [], 6, null);
|
|
3621
|
+
}
|
|
3622
|
+
tmp_4 = tmp_5;
|
|
3623
|
+
}
|
|
3624
|
+
tmp = tmp_4;
|
|
3625
|
+
}
|
|
3626
|
+
return tmp;
|
|
3627
|
+
};
|
|
3628
|
+
ProbNegationAsFailure.prototype.a2g = function (_this__u8e3s4, first, second) {
|
|
3629
|
+
return this.x2p(_this__u8e3s4, first, second);
|
|
3630
|
+
};
|
|
3631
|
+
var ProbNegationAsFailure_instance;
|
|
3632
|
+
function ProbNegationAsFailure_getInstance() {
|
|
3633
|
+
if (ProbNegationAsFailure_instance == null)
|
|
3634
|
+
new ProbNegationAsFailure();
|
|
3635
|
+
return ProbNegationAsFailure_instance;
|
|
3636
|
+
}
|
|
3637
|
+
function ProbQuery$computeAllSubstitutions$slambda$lambda($evidenceExplanation, $queryWithEvidenceExplanation) {
|
|
3638
|
+
return function (v, _anonymous_parameter_1__qggqgd) {
|
|
3639
|
+
return !v.equals($evidenceExplanation) ? !v.equals($queryWithEvidenceExplanation) : false;
|
|
3640
|
+
};
|
|
3641
|
+
}
|
|
3642
|
+
function ProbQuery$computeAllSubstitutions$slambda($solutions, $queryWithEvidenceExplanation, $evidenceExplanation, $this_computeAllSubstitutions, $first, $fourth, resultContinuation) {
|
|
3643
|
+
this.b3g_1 = $solutions;
|
|
3644
|
+
this.c3g_1 = $queryWithEvidenceExplanation;
|
|
3645
|
+
this.d3g_1 = $evidenceExplanation;
|
|
3646
|
+
this.e3g_1 = $this_computeAllSubstitutions;
|
|
3647
|
+
this.f3g_1 = $first;
|
|
3648
|
+
this.g3g_1 = $fourth;
|
|
3649
|
+
CoroutineImpl.call(this, resultContinuation);
|
|
3650
|
+
}
|
|
3651
|
+
ProbQuery$computeAllSubstitutions$slambda.prototype.t2t = function ($this$sequence, $cont) {
|
|
3652
|
+
var tmp = this.u2t($this$sequence, $cont);
|
|
3653
|
+
tmp.ei_1 = Unit_getInstance();
|
|
3654
|
+
tmp.fi_1 = null;
|
|
3655
|
+
return tmp.ki();
|
|
3656
|
+
};
|
|
3657
|
+
ProbQuery$computeAllSubstitutions$slambda.prototype.wi = function (p1, $cont) {
|
|
3658
|
+
return this.t2t(p1 instanceof SequenceScope ? p1 : THROW_CCE(), $cont);
|
|
3659
|
+
};
|
|
3660
|
+
ProbQuery$computeAllSubstitutions$slambda.prototype.ki = function () {
|
|
3661
|
+
var suspendResult = this.ei_1;
|
|
3662
|
+
$sm: do
|
|
3663
|
+
try {
|
|
3664
|
+
var tmp = this.ci_1;
|
|
3665
|
+
switch (tmp) {
|
|
3666
|
+
case 0:
|
|
3667
|
+
this.di_1 = 8;
|
|
3668
|
+
this.i3g_1 = this.b3g_1.j();
|
|
3669
|
+
this.ci_1 = 1;
|
|
3670
|
+
continue $sm;
|
|
3671
|
+
case 1:
|
|
3672
|
+
if (!this.i3g_1.m()) {
|
|
3673
|
+
this.ci_1 = 7;
|
|
3674
|
+
continue $sm;
|
|
3675
|
+
}
|
|
3676
|
+
|
|
3677
|
+
this.j3g_1 = this.i3g_1.p();
|
|
3678
|
+
if (this.j3g_1.f1w())
|
|
3679
|
+
throw ensureNotNull(this.j3g_1.c1w());
|
|
3680
|
+
this.k3g_1 = this.j3g_1.r1u().a3(this.c3g_1);
|
|
3681
|
+
this.l3g_1 = this.j3g_1.r1u().a3(this.d3g_1);
|
|
3682
|
+
var tmp_0;
|
|
3683
|
+
var tmp_1;
|
|
3684
|
+
var tmp_2;
|
|
3685
|
+
if (this.k3g_1 == null) {
|
|
3686
|
+
tmp_2 = true;
|
|
3687
|
+
} else {
|
|
3688
|
+
var tmp_3 = this.k3g_1;
|
|
3689
|
+
tmp_2 = !(tmp_3 instanceof ProbExplanationTerm);
|
|
3690
|
+
}
|
|
3691
|
+
|
|
3692
|
+
if (tmp_2) {
|
|
3693
|
+
tmp_1 = true;
|
|
3694
|
+
} else {
|
|
3695
|
+
tmp_1 = this.l3g_1 == null;
|
|
3696
|
+
}
|
|
3697
|
+
|
|
3698
|
+
if (tmp_1) {
|
|
3699
|
+
tmp_0 = true;
|
|
3700
|
+
} else {
|
|
3701
|
+
var tmp_4 = this.l3g_1;
|
|
3702
|
+
tmp_0 = !(tmp_4 instanceof ProbExplanationTerm);
|
|
3703
|
+
}
|
|
3704
|
+
|
|
3705
|
+
if (tmp_0) {
|
|
3706
|
+
this.ci_1 = 5;
|
|
3707
|
+
suspendResult = this.h3g_1.z4(Companion_getInstance_9().failed(), this);
|
|
3708
|
+
if (suspendResult === get_COROUTINE_SUSPENDED()) {
|
|
3709
|
+
return suspendResult;
|
|
3710
|
+
}
|
|
3711
|
+
continue $sm;
|
|
3712
|
+
} else {
|
|
3713
|
+
this.m3g_1 = this.k3g_1.h3c_1.y3d();
|
|
3714
|
+
this.n3g_1 = this.l3g_1.h3c_1.y3d();
|
|
3715
|
+
if (this.m3g_1 == null ? true : this.n3g_1 == null) {
|
|
3716
|
+
this.ci_1 = 3;
|
|
3717
|
+
suspendResult = this.h3g_1.z4(Companion_getInstance_9().failed(), this);
|
|
3718
|
+
if (suspendResult === get_COROUTINE_SUSPENDED()) {
|
|
3719
|
+
return suspendResult;
|
|
3720
|
+
}
|
|
3721
|
+
continue $sm;
|
|
3722
|
+
} else {
|
|
3723
|
+
var tmp_5 = this;
|
|
3724
|
+
var tmp_6 = this.j3g_1.r1u();
|
|
3725
|
+
tmp_5.o3g_1 = tmp_6.filter(ProbQuery$computeAllSubstitutions$slambda$lambda(this.d3g_1, this.c3g_1));
|
|
3726
|
+
this.p3g_1 = Companion_getInstance_10().ofDouble(this.m3g_1 / this.n3g_1);
|
|
3727
|
+
this.ci_1 = 2;
|
|
3728
|
+
suspendResult = this.h3g_1.z4(Companion_getInstance_9().ofSubstitution(this.o3g_1, [Companion_getInstance_19().b2h(this.e3g_1, this.f3g_1, this.p3g_1), Companion_getInstance_19().b2h(this.e3g_1, this.g3g_1, this.k3g_1)]), this);
|
|
3729
|
+
if (suspendResult === get_COROUTINE_SUSPENDED()) {
|
|
3730
|
+
return suspendResult;
|
|
3731
|
+
}
|
|
3732
|
+
continue $sm;
|
|
3733
|
+
}
|
|
3734
|
+
}
|
|
3735
|
+
|
|
3736
|
+
break;
|
|
3737
|
+
case 2:
|
|
3738
|
+
this.ci_1 = 4;
|
|
3739
|
+
continue $sm;
|
|
3740
|
+
case 3:
|
|
3741
|
+
this.ci_1 = 4;
|
|
3742
|
+
continue $sm;
|
|
3743
|
+
case 4:
|
|
3744
|
+
this.ci_1 = 6;
|
|
3745
|
+
continue $sm;
|
|
3746
|
+
case 5:
|
|
3747
|
+
this.ci_1 = 6;
|
|
3748
|
+
continue $sm;
|
|
3749
|
+
case 6:
|
|
3750
|
+
this.ci_1 = 1;
|
|
3751
|
+
continue $sm;
|
|
3752
|
+
case 7:
|
|
3753
|
+
return Unit_getInstance();
|
|
3754
|
+
case 8:
|
|
3755
|
+
throw this.fi_1;
|
|
3756
|
+
}
|
|
3757
|
+
} catch ($p) {
|
|
3758
|
+
if (this.di_1 === 8) {
|
|
3759
|
+
throw $p;
|
|
3760
|
+
} else {
|
|
3761
|
+
this.ci_1 = this.di_1;
|
|
3762
|
+
this.fi_1 = $p;
|
|
3763
|
+
}
|
|
3764
|
+
}
|
|
3765
|
+
while (true);
|
|
3766
|
+
};
|
|
3767
|
+
ProbQuery$computeAllSubstitutions$slambda.prototype.u2t = function ($this$sequence, completion) {
|
|
3768
|
+
var i = new ProbQuery$computeAllSubstitutions$slambda(this.b3g_1, this.c3g_1, this.d3g_1, this.e3g_1, this.f3g_1, this.g3g_1, completion);
|
|
3769
|
+
i.h3g_1 = $this$sequence;
|
|
3770
|
+
return i;
|
|
3771
|
+
};
|
|
3772
|
+
function ProbQuery$computeAllSubstitutions$slambda_0($solutions, $queryWithEvidenceExplanation, $evidenceExplanation, $this_computeAllSubstitutions, $first, $fourth, resultContinuation) {
|
|
3773
|
+
var i = new ProbQuery$computeAllSubstitutions$slambda($solutions, $queryWithEvidenceExplanation, $evidenceExplanation, $this_computeAllSubstitutions, $first, $fourth, resultContinuation);
|
|
3774
|
+
var l = function ($this$sequence, $cont) {
|
|
3775
|
+
return i.t2t($this$sequence, $cont);
|
|
3776
|
+
};
|
|
3777
|
+
l.$arity = 1;
|
|
3778
|
+
return l;
|
|
3779
|
+
}
|
|
3780
|
+
function ProbQuery() {
|
|
3781
|
+
ProbQuery_instance = this;
|
|
3782
|
+
ProblogLib_getInstance();
|
|
3783
|
+
WithoutSideEffects_0.call(this, 'prob' + '_query');
|
|
3784
|
+
}
|
|
3785
|
+
ProbQuery.prototype.r3g = function (_this__u8e3s4, first, second, third, fourth) {
|
|
3786
|
+
Companion_getInstance_19().h2h(_this__u8e3s4, 1);
|
|
3787
|
+
Companion_getInstance_19().n2h(_this__u8e3s4, 1);
|
|
3788
|
+
Companion_getInstance_19().l2h(_this__u8e3s4, 1);
|
|
3789
|
+
Companion_getInstance_19().h2h(_this__u8e3s4, 2);
|
|
3790
|
+
var queryWithEvidenceExplanation = Companion_getInstance_1().of('QueryWithEvidenceExplanation');
|
|
3791
|
+
var evidenceExplanation = Companion_getInstance_1().of('EvidenceExplanation');
|
|
3792
|
+
var tmp = _this__u8e3s4.subSolver();
|
|
3793
|
+
var tmp_0 = Companion_getInstance_2();
|
|
3794
|
+
var tmp_1 = Companion_getInstance_3();
|
|
3795
|
+
var tmp$ret$0;
|
|
3796
|
+
// Inline function 'it.unibo.tuprolog.solve.AbstractWrapper.functor' call
|
|
3797
|
+
var tmp0__get_functor__thl4dk = ProbSetConfig_getInstance();
|
|
3798
|
+
tmp$ret$0 = tmp0__get_functor__thl4dk.signature.name;
|
|
3799
|
+
var tmp_2 = tmp_1.of(tmp$ret$0, [third]);
|
|
3800
|
+
var tmp_3 = Companion_getInstance_3();
|
|
3801
|
+
var tmp$ret$1;
|
|
3802
|
+
// Inline function 'it.unibo.tuprolog.solve.AbstractWrapper.functor' call
|
|
3803
|
+
var tmp1__get_functor__4k11yf = ProbSolveWithEvidence_getInstance();
|
|
3804
|
+
tmp$ret$1 = tmp1__get_functor__4k11yf.signature.name;
|
|
3805
|
+
var solutions = tmp.solveWithOptions(tmp_0.of(tmp_2, tmp_3.of(tmp$ret$1, [queryWithEvidenceExplanation, evidenceExplanation, second])), ProbSetConfig_getInstance().s3g(third));
|
|
3806
|
+
return sequence(ProbQuery$computeAllSubstitutions$slambda_0(solutions, queryWithEvidenceExplanation, evidenceExplanation, _this__u8e3s4, first, fourth, null));
|
|
3807
|
+
};
|
|
3808
|
+
ProbQuery.prototype.d2i = function (_this__u8e3s4, first, second, third, fourth) {
|
|
3809
|
+
return this.r3g(_this__u8e3s4, first, second, third, fourth);
|
|
3810
|
+
};
|
|
3811
|
+
var ProbQuery_instance;
|
|
3812
|
+
function ProbQuery_getInstance() {
|
|
3813
|
+
if (ProbQuery_instance == null)
|
|
3814
|
+
new ProbQuery();
|
|
3815
|
+
return ProbQuery_instance;
|
|
3816
|
+
}
|
|
3817
|
+
function ProbSetConfig() {
|
|
3818
|
+
ProbSetConfig_instance = this;
|
|
3819
|
+
ProblogLib_getInstance();
|
|
3820
|
+
NonBacktrackable_1.call(this, 'prob' + '_set_config');
|
|
3821
|
+
var tmp = this;
|
|
3822
|
+
var tmp$ret$0;
|
|
3823
|
+
// Inline function 'it.unibo.tuprolog.solve.AbstractWrapper.functor' call
|
|
3824
|
+
tmp$ret$0 = this.signature.name;
|
|
3825
|
+
tmp.d3c_1 = tmp$ret$0 + '_flag';
|
|
3826
|
+
var tmp_0 = this;
|
|
3827
|
+
var tmp$ret$1;
|
|
3828
|
+
// Inline function 'it.unibo.tuprolog.solve.AbstractWrapper.functor' call
|
|
3829
|
+
tmp$ret$1 = this.signature.name;
|
|
3830
|
+
tmp_0.e3c_1 = tmp$ret$1 + '_term';
|
|
3831
|
+
var tmp_1 = this;
|
|
3832
|
+
var tmp$ret$2;
|
|
3833
|
+
// Inline function 'it.unibo.tuprolog.solve.AbstractWrapper.functor' call
|
|
3834
|
+
tmp$ret$2 = this.signature.name;
|
|
3835
|
+
tmp_1.f3c_1 = 'it.unibo.tuprolog.solve.probability' + tmp$ret$2 + '_tag';
|
|
3836
|
+
}
|
|
3837
|
+
ProbSetConfig.prototype.g2p = function (_this__u8e3s4, first) {
|
|
3838
|
+
Companion_getInstance_19().h2h(_this__u8e3s4, 0);
|
|
3839
|
+
Companion_getInstance_19().q2h(_this__u8e3s4, 0);
|
|
3840
|
+
var tmp$ret$2;
|
|
3841
|
+
// Inline function 'kotlin.arrayOf' call
|
|
3842
|
+
var tmp0_arrayOf = [SetFlags_init_$Create$([new Pair(this.d3c_1, first)])];
|
|
3843
|
+
var tmp$ret$1;
|
|
3844
|
+
// Inline function 'kotlin.js.unsafeCast' call
|
|
3845
|
+
var tmp$ret$0;
|
|
3846
|
+
// Inline function 'kotlin.js.asDynamic' call
|
|
3847
|
+
tmp$ret$0 = tmp0_arrayOf;
|
|
3848
|
+
tmp$ret$1 = tmp$ret$0;
|
|
3849
|
+
tmp$ret$2 = tmp$ret$1;
|
|
3850
|
+
return _this__u8e3s4.m2g(null, null, tmp$ret$2.slice(), 3, null);
|
|
3851
|
+
};
|
|
3852
|
+
ProbSetConfig.prototype.a2k = function (_this__u8e3s4, first) {
|
|
3853
|
+
return this.g2p(_this__u8e3s4, first);
|
|
3854
|
+
};
|
|
3855
|
+
ProbSetConfig.prototype.s3g = function (_this__u8e3s4) {
|
|
3856
|
+
var tmp0_elvis_lhs = _this__u8e3s4.getTag(this.f3c_1);
|
|
3857
|
+
return tmp0_elvis_lhs == null ? Companion_getInstance_5().DEFAULT : tmp0_elvis_lhs;
|
|
3858
|
+
};
|
|
3859
|
+
ProbSetConfig.prototype.g3c = function (_this__u8e3s4) {
|
|
3860
|
+
return setTag(Companion_getInstance_8().of(this.e3c_1), this.f3c_1, _this__u8e3s4);
|
|
3861
|
+
};
|
|
3862
|
+
ProbSetConfig.prototype.t3g = function (_this__u8e3s4) {
|
|
3863
|
+
var tmp0_safe_receiver = _this__u8e3s4.x1u().o9(this.d3c_1);
|
|
3864
|
+
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.s3g(tmp0_safe_receiver);
|
|
3865
|
+
return tmp1_elvis_lhs == null ? Companion_getInstance_5().DEFAULT : tmp1_elvis_lhs;
|
|
3866
|
+
};
|
|
3867
|
+
ProbSetConfig.prototype.s3e = function (_this__u8e3s4) {
|
|
3868
|
+
return !get_isProbabilistic(this.t3g(_this__u8e3s4));
|
|
3869
|
+
};
|
|
3870
|
+
var ProbSetConfig_instance;
|
|
3871
|
+
function ProbSetConfig_getInstance() {
|
|
3872
|
+
if (ProbSetConfig_instance == null)
|
|
3873
|
+
new ProbSetConfig();
|
|
3874
|
+
return ProbSetConfig_instance;
|
|
3875
|
+
}
|
|
3876
|
+
function ProbSolve$computeAllSubstitutions$lambda(it) {
|
|
3877
|
+
if (it.f1w())
|
|
3878
|
+
throw ensureNotNull(it.c1w());
|
|
3879
|
+
return it.r1u();
|
|
3880
|
+
}
|
|
3881
|
+
function ProbSolve$computeAllSubstitutions$lambda_0(it) {
|
|
3882
|
+
return !(it == null) ? isInterface(it, Halt) : false;
|
|
3883
|
+
}
|
|
3884
|
+
function ProbSolve$computeAllSubstitutions$lambda_1($explanationVar) {
|
|
3885
|
+
return function (v, _anonymous_parameter_1__qggqgd) {
|
|
3886
|
+
return !v.equals($explanationVar);
|
|
3887
|
+
};
|
|
3888
|
+
}
|
|
3889
|
+
function ProbSolve$computeAllSubstitutions$slambda($solutionGroups, $explanationVar, $this_computeAllSubstitutions, $first, resultContinuation) {
|
|
3890
|
+
this.c3h_1 = $solutionGroups;
|
|
3891
|
+
this.d3h_1 = $explanationVar;
|
|
3892
|
+
this.e3h_1 = $this_computeAllSubstitutions;
|
|
3893
|
+
this.f3h_1 = $first;
|
|
3894
|
+
CoroutineImpl.call(this, resultContinuation);
|
|
3895
|
+
}
|
|
3896
|
+
ProbSolve$computeAllSubstitutions$slambda.prototype.t2t = function ($this$sequence, $cont) {
|
|
3897
|
+
var tmp = this.u2t($this$sequence, $cont);
|
|
3898
|
+
tmp.ei_1 = Unit_getInstance();
|
|
3899
|
+
tmp.fi_1 = null;
|
|
3900
|
+
return tmp.ki();
|
|
3901
|
+
};
|
|
3902
|
+
ProbSolve$computeAllSubstitutions$slambda.prototype.wi = function (p1, $cont) {
|
|
3903
|
+
return this.t2t(p1 instanceof SequenceScope ? p1 : THROW_CCE(), $cont);
|
|
3904
|
+
};
|
|
3905
|
+
ProbSolve$computeAllSubstitutions$slambda.prototype.ki = function () {
|
|
3906
|
+
var suspendResult = this.ei_1;
|
|
3907
|
+
$sm: do
|
|
3908
|
+
try {
|
|
3909
|
+
var tmp = this.ci_1;
|
|
3910
|
+
switch (tmp) {
|
|
3911
|
+
case 0:
|
|
3912
|
+
this.di_1 = 4;
|
|
3913
|
+
var tmp_0 = this;
|
|
3914
|
+
tmp_0.h3h_1 = this.c3h_1.z().j();
|
|
3915
|
+
this.ci_1 = 1;
|
|
3916
|
+
continue $sm;
|
|
3917
|
+
case 1:
|
|
3918
|
+
if (!this.h3h_1.m()) {
|
|
3919
|
+
this.ci_1 = 3;
|
|
3920
|
+
continue $sm;
|
|
3921
|
+
}
|
|
3922
|
+
|
|
3923
|
+
this.i3h_1 = this.h3h_1.p();
|
|
3924
|
+
var tmp_1 = this;
|
|
3925
|
+
var tmp0_map = this.i3h_1.b1();
|
|
3926
|
+
var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp0_map, 10));
|
|
3927
|
+
var tmp0_iterator = tmp0_map.j();
|
|
3928
|
+
while (tmp0_iterator.m()) {
|
|
3929
|
+
var item = tmp0_iterator.p();
|
|
3930
|
+
tmp0_mapTo.g(item.r1u().a3(this.d3h_1));
|
|
3931
|
+
}
|
|
3932
|
+
|
|
3933
|
+
var tmp1_filterIsInstance = tmp0_mapTo;
|
|
3934
|
+
var tmp0_filterIsInstanceTo = ArrayList_init_$Create$_0();
|
|
3935
|
+
var tmp0_iterator_0 = tmp1_filterIsInstance.j();
|
|
3936
|
+
while (tmp0_iterator_0.m()) {
|
|
3937
|
+
var element = tmp0_iterator_0.p();
|
|
3938
|
+
if (element instanceof ProbExplanationTerm) {
|
|
3939
|
+
tmp0_filterIsInstanceTo.g(element);
|
|
3940
|
+
}
|
|
3941
|
+
}
|
|
3942
|
+
|
|
3943
|
+
var tmp2_map = tmp0_filterIsInstanceTo;
|
|
3944
|
+
var tmp0_mapTo_0 = ArrayList_init_$Create$(collectionSizeOrDefault(tmp2_map, 10));
|
|
3945
|
+
var tmp0_iterator_1 = tmp2_map.j();
|
|
3946
|
+
while (tmp0_iterator_1.m()) {
|
|
3947
|
+
var item_0 = tmp0_iterator_1.p();
|
|
3948
|
+
tmp0_mapTo_0.g(item_0.h3c_1);
|
|
3949
|
+
}
|
|
3950
|
+
|
|
3951
|
+
var tmp3_reduce = tmp0_mapTo_0;
|
|
3952
|
+
var iterator = tmp3_reduce.j();
|
|
3953
|
+
if (!iterator.m())
|
|
3954
|
+
throw UnsupportedOperationException_init_$Create$("Empty collection can't be reduced.");
|
|
3955
|
+
var accumulator = iterator.p();
|
|
3956
|
+
while (iterator.m()) {
|
|
3957
|
+
var tmp4__anonymous__pkmkx7 = accumulator;
|
|
3958
|
+
var tmp5__anonymous__kpxxpo = iterator.p();
|
|
3959
|
+
accumulator = tmp5__anonymous__kpxxpo.x3d() === 1.0 ? tmp4__anonymous__pkmkx7 : tmp4__anonymous__pkmkx7.x3d() === 1.0 ? tmp5__anonymous__kpxxpo : tmp4__anonymous__pkmkx7.or(tmp5__anonymous__kpxxpo);
|
|
3960
|
+
}
|
|
3961
|
+
|
|
3962
|
+
tmp_1.j3h_1 = accumulator;
|
|
3963
|
+
this.k3h_1 = Companion_getInstance_9().ofSubstitution(this.i3h_1.a1(), [Companion_getInstance_19().b2h(this.e3h_1, this.f3h_1, new ProbExplanationTerm(this.j3h_1))]);
|
|
3964
|
+
this.ci_1 = 2;
|
|
3965
|
+
suspendResult = this.g3h_1.z4(this.k3h_1, this);
|
|
3966
|
+
if (suspendResult === get_COROUTINE_SUSPENDED()) {
|
|
3967
|
+
return suspendResult;
|
|
3968
|
+
}
|
|
3969
|
+
|
|
3970
|
+
continue $sm;
|
|
3971
|
+
case 2:
|
|
3972
|
+
this.ci_1 = 1;
|
|
3973
|
+
continue $sm;
|
|
3974
|
+
case 3:
|
|
3975
|
+
return Unit_getInstance();
|
|
3976
|
+
case 4:
|
|
3977
|
+
throw this.fi_1;
|
|
3978
|
+
}
|
|
3979
|
+
} catch ($p) {
|
|
3980
|
+
if (this.di_1 === 4) {
|
|
3981
|
+
throw $p;
|
|
3982
|
+
} else {
|
|
3983
|
+
this.ci_1 = this.di_1;
|
|
3984
|
+
this.fi_1 = $p;
|
|
3985
|
+
}
|
|
3986
|
+
}
|
|
3987
|
+
while (true);
|
|
3988
|
+
};
|
|
3989
|
+
ProbSolve$computeAllSubstitutions$slambda.prototype.u2t = function ($this$sequence, completion) {
|
|
3990
|
+
var i = new ProbSolve$computeAllSubstitutions$slambda(this.c3h_1, this.d3h_1, this.e3h_1, this.f3h_1, completion);
|
|
3991
|
+
i.g3h_1 = $this$sequence;
|
|
3992
|
+
return i;
|
|
3993
|
+
};
|
|
3994
|
+
function ProbSolve$computeAllSubstitutions$slambda_0($solutionGroups, $explanationVar, $this_computeAllSubstitutions, $first, resultContinuation) {
|
|
3995
|
+
var i = new ProbSolve$computeAllSubstitutions$slambda($solutionGroups, $explanationVar, $this_computeAllSubstitutions, $first, resultContinuation);
|
|
3996
|
+
var l = function ($this$sequence, $cont) {
|
|
3997
|
+
return i.t2t($this$sequence, $cont);
|
|
3998
|
+
};
|
|
3999
|
+
l.$arity = 1;
|
|
4000
|
+
return l;
|
|
4001
|
+
}
|
|
4002
|
+
function ProbSolve() {
|
|
4003
|
+
ProbSolve_instance = this;
|
|
4004
|
+
ProblogLib_getInstance();
|
|
4005
|
+
WithoutSideEffects_1.call(this, 'prob' + '_solve');
|
|
4006
|
+
}
|
|
4007
|
+
ProbSolve.prototype.w2q = function (_this__u8e3s4, first, second) {
|
|
4008
|
+
Companion_getInstance_19().h2h(_this__u8e3s4, 1);
|
|
4009
|
+
Companion_getInstance_19().n2h(_this__u8e3s4, 1);
|
|
4010
|
+
if (ProbSetConfig_getInstance().s3e(_this__u8e3s4.context)) {
|
|
4011
|
+
var tmp = _this__u8e3s4.subSolver();
|
|
4012
|
+
var tmp_0 = Companion_getInstance_3();
|
|
4013
|
+
var tmp$ret$0;
|
|
4014
|
+
// Inline function 'it.unibo.tuprolog.solve.AbstractWrapper.functor' call
|
|
4015
|
+
var tmp0__get_functor__thl4dk = Prob_getInstance();
|
|
4016
|
+
tmp$ret$0 = tmp0__get_functor__thl4dk.signature.name;
|
|
4017
|
+
var tmp_1 = tmp.solveWithOptions(tmp_0.of(tmp$ret$0, [first, second]), ProbSetConfig_getInstance().t3g(_this__u8e3s4.context));
|
|
4018
|
+
return map(tmp_1, ProbSolve$computeAllSubstitutions$lambda);
|
|
4019
|
+
}
|
|
4020
|
+
var tmp_2 = Companion_getInstance_1();
|
|
4021
|
+
ProblogLib_getInstance();
|
|
4022
|
+
var explanationVar = tmp_2.of('EXPL');
|
|
4023
|
+
var tmp_3 = _this__u8e3s4.subSolver();
|
|
4024
|
+
var tmp_4 = Companion_getInstance_3();
|
|
4025
|
+
var tmp$ret$1;
|
|
4026
|
+
// Inline function 'it.unibo.tuprolog.solve.AbstractWrapper.functor' call
|
|
4027
|
+
var tmp1__get_functor__4k11yf = Prob_getInstance();
|
|
4028
|
+
tmp$ret$1 = tmp1__get_functor__4k11yf.signature.name;
|
|
4029
|
+
var solutions = toList(tmp_3.solveWithOptions(tmp_4.of(tmp$ret$1, [explanationVar, second]), ProbSetConfig_getInstance().t3g(_this__u8e3s4.context)));
|
|
4030
|
+
var tmp$ret$2;
|
|
4031
|
+
// Inline function 'kotlin.sequences.filterIsInstance' call
|
|
4032
|
+
var tmp2_filterIsInstance = asSequence(solutions);
|
|
4033
|
+
var tmp_5 = filter(tmp2_filterIsInstance, ProbSolve$computeAllSubstitutions$lambda_0);
|
|
4034
|
+
tmp$ret$2 = isInterface(tmp_5, Sequence) ? tmp_5 : THROW_CCE();
|
|
4035
|
+
var error = firstOrNull(tmp$ret$2);
|
|
4036
|
+
if (!(error == null))
|
|
4037
|
+
throw error.c1w();
|
|
4038
|
+
var tmp_6;
|
|
4039
|
+
var tmp$ret$3;
|
|
4040
|
+
$l$block_0: {
|
|
4041
|
+
// Inline function 'kotlin.collections.any' call
|
|
4042
|
+
var tmp_7;
|
|
4043
|
+
if (isInterface(solutions, Collection)) {
|
|
4044
|
+
tmp_7 = solutions.d();
|
|
4045
|
+
} else {
|
|
4046
|
+
tmp_7 = false;
|
|
4047
|
+
}
|
|
4048
|
+
if (tmp_7) {
|
|
4049
|
+
tmp$ret$3 = false;
|
|
4050
|
+
break $l$block_0;
|
|
4051
|
+
}
|
|
4052
|
+
var tmp0_iterator = solutions.j();
|
|
4053
|
+
while (tmp0_iterator.m()) {
|
|
4054
|
+
var element = tmp0_iterator.p();
|
|
4055
|
+
var tmp$ret$4;
|
|
4056
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.primitive.ProbSolve.computeAllSubstitutions.<anonymous>' call
|
|
4057
|
+
tmp$ret$4 = isInterface(element, Yes);
|
|
4058
|
+
if (tmp$ret$4) {
|
|
4059
|
+
tmp$ret$3 = true;
|
|
4060
|
+
break $l$block_0;
|
|
4061
|
+
}
|
|
4062
|
+
}
|
|
4063
|
+
tmp$ret$3 = false;
|
|
4064
|
+
}
|
|
4065
|
+
if (!tmp$ret$3) {
|
|
4066
|
+
tmp_6 = sequenceOf([Companion_getInstance_9().ofSubstitution(Companion_getInstance_19().b2h(_this__u8e3s4, first, new ProbExplanationTerm(Companion_getInstance_21().k3d_1)), [])]);
|
|
4067
|
+
} else {
|
|
4068
|
+
var tmp$ret$11;
|
|
4069
|
+
// Inline function 'kotlin.collections.groupBy' call
|
|
4070
|
+
var tmp$ret$6;
|
|
4071
|
+
// Inline function 'kotlin.collections.filterIsInstance' call
|
|
4072
|
+
var tmp$ret$5;
|
|
4073
|
+
// Inline function 'kotlin.collections.filterIsInstanceTo' call
|
|
4074
|
+
var tmp0_filterIsInstanceTo = ArrayList_init_$Create$_0();
|
|
4075
|
+
var tmp0_iterator_0 = solutions.j();
|
|
4076
|
+
while (tmp0_iterator_0.m()) {
|
|
4077
|
+
var element_0 = tmp0_iterator_0.p();
|
|
4078
|
+
if (!(element_0 == null) ? isInterface(element_0, Yes) : false) {
|
|
4079
|
+
tmp0_filterIsInstanceTo.g(element_0);
|
|
4080
|
+
}
|
|
4081
|
+
}
|
|
4082
|
+
tmp$ret$5 = tmp0_filterIsInstanceTo;
|
|
4083
|
+
tmp$ret$6 = tmp$ret$5;
|
|
4084
|
+
var tmp3_groupBy = tmp$ret$6;
|
|
4085
|
+
var tmp$ret$10;
|
|
4086
|
+
// Inline function 'kotlin.collections.groupByTo' call
|
|
4087
|
+
var tmp0_groupByTo = LinkedHashMap_init_$Create$();
|
|
4088
|
+
var tmp0_iterator_1 = tmp3_groupBy.j();
|
|
4089
|
+
while (tmp0_iterator_1.m()) {
|
|
4090
|
+
var element_1 = tmp0_iterator_1.p();
|
|
4091
|
+
var tmp$ret$7;
|
|
4092
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.primitive.ProbSolve.computeAllSubstitutions.<anonymous>' call
|
|
4093
|
+
var tmp_8 = element_1.r1u();
|
|
4094
|
+
tmp$ret$7 = tmp_8.l12(ProbSolve$computeAllSubstitutions$lambda_1(explanationVar));
|
|
4095
|
+
var key = tmp$ret$7;
|
|
4096
|
+
var tmp$ret$9;
|
|
4097
|
+
// Inline function 'kotlin.collections.getOrPut' call
|
|
4098
|
+
var value = tmp0_groupByTo.a3(key);
|
|
4099
|
+
var tmp_9;
|
|
4100
|
+
if (value == null) {
|
|
4101
|
+
var tmp$ret$8;
|
|
4102
|
+
// Inline function 'kotlin.collections.groupByTo.<anonymous>' call
|
|
4103
|
+
tmp$ret$8 = ArrayList_init_$Create$_0();
|
|
4104
|
+
var answer = tmp$ret$8;
|
|
4105
|
+
tmp0_groupByTo.w3(key, answer);
|
|
4106
|
+
tmp_9 = answer;
|
|
4107
|
+
} else {
|
|
4108
|
+
tmp_9 = value;
|
|
4109
|
+
}
|
|
4110
|
+
tmp$ret$9 = tmp_9;
|
|
4111
|
+
var list = tmp$ret$9;
|
|
4112
|
+
list.g(element_1);
|
|
4113
|
+
}
|
|
4114
|
+
tmp$ret$10 = tmp0_groupByTo;
|
|
4115
|
+
tmp$ret$11 = tmp$ret$10;
|
|
4116
|
+
var solutionGroups = tmp$ret$11;
|
|
4117
|
+
tmp_6 = sequence(ProbSolve$computeAllSubstitutions$slambda_0(solutionGroups, explanationVar, _this__u8e3s4, first, null));
|
|
4118
|
+
}
|
|
4119
|
+
return tmp_6;
|
|
4120
|
+
};
|
|
4121
|
+
ProbSolve.prototype.i2g = function (_this__u8e3s4, first, second) {
|
|
4122
|
+
return this.w2q(_this__u8e3s4, first, second);
|
|
4123
|
+
};
|
|
4124
|
+
var ProbSolve_instance;
|
|
4125
|
+
function ProbSolve_getInstance() {
|
|
4126
|
+
if (ProbSolve_instance == null)
|
|
4127
|
+
new ProbSolve();
|
|
4128
|
+
return ProbSolve_instance;
|
|
4129
|
+
}
|
|
4130
|
+
function ProbSolveEvidence$computeOne$lambda(it) {
|
|
4131
|
+
return !(it == null) ? isInterface(it, Yes) : false;
|
|
4132
|
+
}
|
|
4133
|
+
function ProbSolveEvidence$computeOne$lambda_0($explanationVar) {
|
|
4134
|
+
return function (s) {
|
|
4135
|
+
return s.r1u().a3($explanationVar);
|
|
4136
|
+
};
|
|
4137
|
+
}
|
|
4138
|
+
function ProbSolveEvidence$computeOne$lambda_1(it) {
|
|
4139
|
+
return it instanceof ProbExplanationTerm;
|
|
4140
|
+
}
|
|
4141
|
+
function ProbSolveEvidence$computeOne$lambda_2(t) {
|
|
4142
|
+
return t.h3c_1;
|
|
4143
|
+
}
|
|
4144
|
+
function ProbSolveEvidence() {
|
|
4145
|
+
ProbSolveEvidence_instance = this;
|
|
4146
|
+
ProblogLib_getInstance();
|
|
4147
|
+
NonBacktrackable_1.call(this, 'prob' + '_solve_evidence');
|
|
4148
|
+
}
|
|
4149
|
+
ProbSolveEvidence.prototype.g2p = function (_this__u8e3s4, first) {
|
|
4150
|
+
var tmp = Companion_getInstance_13();
|
|
4151
|
+
ProblogLib_getInstance();
|
|
4152
|
+
var evidenceIndicator = tmp.ofString('evidence', 2);
|
|
4153
|
+
if (!_this__u8e3s4.context.y1u().containsIndicator(evidenceIndicator) ? !_this__u8e3s4.context.z1u().containsIndicator(evidenceIndicator) : false) {
|
|
4154
|
+
var tmp_0 = Companion_getInstance_19().b2h(_this__u8e3s4, first, new ProbExplanationTerm(Companion_getInstance_21().l3d_1));
|
|
4155
|
+
return _this__u8e3s4.g2g(tmp_0, null, [], 6, null);
|
|
4156
|
+
}
|
|
4157
|
+
var evidenceTermVar = Companion_getInstance_1().of('TermVar');
|
|
4158
|
+
var evidenceTruthVar = Companion_getInstance_1().of('TruthVar');
|
|
4159
|
+
var tmp_1 = Companion_getInstance_3();
|
|
4160
|
+
ProblogLib_getInstance();
|
|
4161
|
+
var subQuery = tmp_1.of('evidence', [evidenceTermVar, evidenceTruthVar]);
|
|
4162
|
+
var tmp_2 = ProbSetConfig_getInstance().t3g(_this__u8e3s4.context);
|
|
4163
|
+
Companion_getInstance_5();
|
|
4164
|
+
var subOptions = tmp_2.setLimit(-1).setLazy(false);
|
|
4165
|
+
var tmp$ret$10;
|
|
4166
|
+
// Inline function 'kotlin.collections.filter' call
|
|
4167
|
+
var tmp$ret$7;
|
|
4168
|
+
// Inline function 'kotlin.collections.map' call
|
|
4169
|
+
var tmp$ret$0;
|
|
4170
|
+
// Inline function 'kotlin.sequences.filterIsInstance' call
|
|
4171
|
+
var tmp0_filterIsInstance = _this__u8e3s4.subSolver().solveWithOptions(subQuery, subOptions);
|
|
4172
|
+
var tmp_3 = filter(tmp0_filterIsInstance, ProbSolveEvidence$computeOne$lambda);
|
|
4173
|
+
tmp$ret$0 = isInterface(tmp_3, Sequence) ? tmp_3 : THROW_CCE();
|
|
4174
|
+
var tmp1_map = toList(tmp$ret$0);
|
|
4175
|
+
var tmp$ret$6;
|
|
4176
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
4177
|
+
var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp1_map, 10));
|
|
4178
|
+
var tmp0_iterator = tmp1_map.j();
|
|
4179
|
+
while (tmp0_iterator.m()) {
|
|
4180
|
+
var item = tmp0_iterator.p();
|
|
4181
|
+
var tmp$ret$5;
|
|
4182
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.primitive.ProbSolveEvidence.computeOne.<anonymous>' call
|
|
4183
|
+
var truth = item.r1u().a3(evidenceTruthVar);
|
|
4184
|
+
var term = item.r1u().a3(evidenceTermVar);
|
|
4185
|
+
var tmp_4;
|
|
4186
|
+
var tmp_5;
|
|
4187
|
+
if ((term == null ? true : term.bx()) ? true : truth == null) {
|
|
4188
|
+
tmp_5 = true;
|
|
4189
|
+
} else {
|
|
4190
|
+
tmp_5 = !(!(truth == null) ? isInterface(truth, Truth) : false);
|
|
4191
|
+
}
|
|
4192
|
+
if (tmp_5) {
|
|
4193
|
+
tmp_4 = Companion_getInstance_21().k3d_1;
|
|
4194
|
+
} else {
|
|
4195
|
+
var tmp_6 = Companion_getInstance_1();
|
|
4196
|
+
ProblogLib_getInstance();
|
|
4197
|
+
var explanationVar = tmp_6.of('EXPL');
|
|
4198
|
+
var tmp$ret$4;
|
|
4199
|
+
// Inline function 'kotlin.sequences.reduce' call
|
|
4200
|
+
var tmp$ret$2;
|
|
4201
|
+
// Inline function 'kotlin.sequences.filterIsInstance' call
|
|
4202
|
+
var tmp_7 = Companion_getInstance_3();
|
|
4203
|
+
var tmp$ret$1;
|
|
4204
|
+
// Inline function 'it.unibo.tuprolog.solve.AbstractWrapper.functor' call
|
|
4205
|
+
var tmp0__get_functor__thl4dk = ProbSolve_getInstance();
|
|
4206
|
+
tmp$ret$1 = tmp0__get_functor__thl4dk.signature.name;
|
|
4207
|
+
var tmp_8 = tmp_7.of(tmp$ret$1, [explanationVar, term]);
|
|
4208
|
+
var tmp_9 = _this__u8e3s4.e2j(tmp_8, new Long(0, 0), 2, null);
|
|
4209
|
+
var tmp1_filterIsInstance = map(tmp_9, ProbSolveEvidence$computeOne$lambda_0(explanationVar));
|
|
4210
|
+
var tmp_10 = filter(tmp1_filterIsInstance, ProbSolveEvidence$computeOne$lambda_1);
|
|
4211
|
+
tmp$ret$2 = isInterface(tmp_10, Sequence) ? tmp_10 : THROW_CCE();
|
|
4212
|
+
var tmp_11 = tmp$ret$2;
|
|
4213
|
+
var tmp2_reduce = map(tmp_11, ProbSolveEvidence$computeOne$lambda_2);
|
|
4214
|
+
var iterator = tmp2_reduce.j();
|
|
4215
|
+
if (!iterator.m())
|
|
4216
|
+
throw UnsupportedOperationException_init_$Create$("Empty sequence can't be reduced.");
|
|
4217
|
+
var accumulator = iterator.p();
|
|
4218
|
+
while (iterator.m()) {
|
|
4219
|
+
var tmp$ret$3;
|
|
4220
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.primitive.ProbSolveEvidence.computeOne.<anonymous>.<anonymous>' call
|
|
4221
|
+
var tmp3__anonymous__ufb84q = accumulator;
|
|
4222
|
+
var tmp4__anonymous__pkmkx7 = iterator.p();
|
|
4223
|
+
tmp$ret$3 = tmp4__anonymous__pkmkx7.x3d() === 1.0 ? tmp3__anonymous__ufb84q : tmp3__anonymous__ufb84q.x3d() === 1.0 ? tmp4__anonymous__pkmkx7 : tmp4__anonymous__pkmkx7.or(tmp3__anonymous__ufb84q);
|
|
4224
|
+
accumulator = tmp$ret$3;
|
|
4225
|
+
}
|
|
4226
|
+
tmp$ret$4 = accumulator;
|
|
4227
|
+
var totalExplanation = tmp$ret$4;
|
|
4228
|
+
tmp_4 = truth.dw() ? totalExplanation : totalExplanation.not();
|
|
4229
|
+
}
|
|
4230
|
+
tmp$ret$5 = tmp_4;
|
|
4231
|
+
tmp0_mapTo.g(tmp$ret$5);
|
|
4232
|
+
}
|
|
4233
|
+
tmp$ret$6 = tmp0_mapTo;
|
|
4234
|
+
tmp$ret$7 = tmp$ret$6;
|
|
4235
|
+
var tmp2_filter = tmp$ret$7;
|
|
4236
|
+
var tmp$ret$9;
|
|
4237
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
4238
|
+
var tmp0_filterTo = ArrayList_init_$Create$_0();
|
|
4239
|
+
var tmp0_iterator_0 = tmp2_filter.j();
|
|
4240
|
+
while (tmp0_iterator_0.m()) {
|
|
4241
|
+
var element = tmp0_iterator_0.p();
|
|
4242
|
+
var tmp$ret$8;
|
|
4243
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.primitive.ProbSolveEvidence.computeOne.<anonymous>' call
|
|
4244
|
+
tmp$ret$8 = !equals(element, Companion_getInstance_21().k3d_1);
|
|
4245
|
+
if (tmp$ret$8) {
|
|
4246
|
+
tmp0_filterTo.g(element);
|
|
4247
|
+
}
|
|
4248
|
+
}
|
|
4249
|
+
tmp$ret$9 = tmp0_filterTo;
|
|
4250
|
+
tmp$ret$10 = tmp$ret$9;
|
|
4251
|
+
var result = tmp$ret$10;
|
|
4252
|
+
var tmp_12;
|
|
4253
|
+
if (result.d()) {
|
|
4254
|
+
tmp_12 = Companion_getInstance_21().l3d_1;
|
|
4255
|
+
} else {
|
|
4256
|
+
var tmp$ret$12;
|
|
4257
|
+
// Inline function 'kotlin.collections.reduce' call
|
|
4258
|
+
var iterator_0 = result.j();
|
|
4259
|
+
if (!iterator_0.m())
|
|
4260
|
+
throw UnsupportedOperationException_init_$Create$("Empty collection can't be reduced.");
|
|
4261
|
+
var accumulator_0 = iterator_0.p();
|
|
4262
|
+
while (iterator_0.m()) {
|
|
4263
|
+
var tmp$ret$11;
|
|
4264
|
+
// Inline function 'it.unibo.tuprolog.solve.problog.lib.primitive.ProbSolveEvidence.computeOne.<anonymous>' call
|
|
4265
|
+
var tmp3__anonymous__ufb84q_0 = accumulator_0;
|
|
4266
|
+
var tmp4__anonymous__pkmkx7_0 = iterator_0.p();
|
|
4267
|
+
tmp$ret$11 = tmp4__anonymous__pkmkx7_0.and(tmp3__anonymous__ufb84q_0);
|
|
4268
|
+
accumulator_0 = tmp$ret$11;
|
|
4269
|
+
}
|
|
4270
|
+
tmp$ret$12 = accumulator_0;
|
|
4271
|
+
tmp_12 = tmp$ret$12;
|
|
4272
|
+
}
|
|
4273
|
+
var resultExplanation = tmp_12;
|
|
4274
|
+
var tmp_13 = Companion_getInstance_19().b2h(_this__u8e3s4, first, new ProbExplanationTerm(resultExplanation));
|
|
4275
|
+
return _this__u8e3s4.g2g(tmp_13, null, [], 6, null);
|
|
4276
|
+
};
|
|
4277
|
+
ProbSolveEvidence.prototype.a2k = function (_this__u8e3s4, first) {
|
|
4278
|
+
return this.g2p(_this__u8e3s4, first);
|
|
4279
|
+
};
|
|
4280
|
+
var ProbSolveEvidence_instance;
|
|
4281
|
+
function ProbSolveEvidence_getInstance() {
|
|
4282
|
+
if (ProbSolveEvidence_instance == null)
|
|
4283
|
+
new ProbSolveEvidence();
|
|
4284
|
+
return ProbSolveEvidence_instance;
|
|
4285
|
+
}
|
|
4286
|
+
function ProbSolveWithEvidence$computeAllSubstitutions$slambda$lambda($goalExplanationVar) {
|
|
4287
|
+
return function (v, _anonymous_parameter_1__qggqgd) {
|
|
4288
|
+
return !v.equals($goalExplanationVar);
|
|
4289
|
+
};
|
|
4290
|
+
}
|
|
4291
|
+
function ProbSolveWithEvidence$computeAllSubstitutions$slambda($solutions, $goalExplanationVar, $evidenceExplanationTerm, $this_computeAllSubstitutions, $first, $second, resultContinuation) {
|
|
4292
|
+
this.v3h_1 = $solutions;
|
|
4293
|
+
this.w3h_1 = $goalExplanationVar;
|
|
4294
|
+
this.x3h_1 = $evidenceExplanationTerm;
|
|
4295
|
+
this.y3h_1 = $this_computeAllSubstitutions;
|
|
4296
|
+
this.z3h_1 = $first;
|
|
4297
|
+
this.a3i_1 = $second;
|
|
4298
|
+
CoroutineImpl.call(this, resultContinuation);
|
|
4299
|
+
}
|
|
4300
|
+
ProbSolveWithEvidence$computeAllSubstitutions$slambda.prototype.t2t = function ($this$sequence, $cont) {
|
|
4301
|
+
var tmp = this.u2t($this$sequence, $cont);
|
|
4302
|
+
tmp.ei_1 = Unit_getInstance();
|
|
4303
|
+
tmp.fi_1 = null;
|
|
4304
|
+
return tmp.ki();
|
|
4305
|
+
};
|
|
4306
|
+
ProbSolveWithEvidence$computeAllSubstitutions$slambda.prototype.wi = function (p1, $cont) {
|
|
4307
|
+
return this.t2t(p1 instanceof SequenceScope ? p1 : THROW_CCE(), $cont);
|
|
4308
|
+
};
|
|
4309
|
+
ProbSolveWithEvidence$computeAllSubstitutions$slambda.prototype.ki = function () {
|
|
4310
|
+
var suspendResult = this.ei_1;
|
|
4311
|
+
$sm: do
|
|
4312
|
+
try {
|
|
4313
|
+
var tmp = this.ci_1;
|
|
4314
|
+
switch (tmp) {
|
|
4315
|
+
case 0:
|
|
4316
|
+
this.di_1 = 6;
|
|
4317
|
+
this.c3i_1 = this.v3h_1.j();
|
|
4318
|
+
this.ci_1 = 1;
|
|
4319
|
+
continue $sm;
|
|
4320
|
+
case 1:
|
|
4321
|
+
if (!this.c3i_1.m()) {
|
|
4322
|
+
this.ci_1 = 5;
|
|
4323
|
+
continue $sm;
|
|
4324
|
+
}
|
|
4325
|
+
|
|
4326
|
+
this.d3i_1 = this.c3i_1.p();
|
|
4327
|
+
if (this.d3i_1.f1w())
|
|
4328
|
+
throw ensureNotNull(this.d3i_1.c1w());
|
|
4329
|
+
this.e3i_1 = this.d3i_1.r1u().a3(this.w3h_1);
|
|
4330
|
+
var tmp_0;
|
|
4331
|
+
var tmp_1;
|
|
4332
|
+
var tmp_2;
|
|
4333
|
+
if (this.x3h_1 == null) {
|
|
4334
|
+
tmp_2 = true;
|
|
4335
|
+
} else {
|
|
4336
|
+
var tmp_3 = this.x3h_1;
|
|
4337
|
+
tmp_2 = !(tmp_3 instanceof ProbExplanationTerm);
|
|
4338
|
+
}
|
|
4339
|
+
|
|
4340
|
+
if (tmp_2) {
|
|
4341
|
+
tmp_1 = true;
|
|
4342
|
+
} else {
|
|
4343
|
+
tmp_1 = this.e3i_1 == null;
|
|
4344
|
+
}
|
|
4345
|
+
|
|
4346
|
+
if (tmp_1) {
|
|
4347
|
+
tmp_0 = true;
|
|
4348
|
+
} else {
|
|
4349
|
+
var tmp_4 = this.e3i_1;
|
|
4350
|
+
tmp_0 = !(tmp_4 instanceof ProbExplanationTerm);
|
|
4351
|
+
}
|
|
4352
|
+
|
|
4353
|
+
if (tmp_0) {
|
|
4354
|
+
this.ci_1 = 3;
|
|
4355
|
+
suspendResult = this.b3i_1.z4(Companion_getInstance_9().failed(), this);
|
|
4356
|
+
if (suspendResult === get_COROUTINE_SUSPENDED()) {
|
|
4357
|
+
return suspendResult;
|
|
4358
|
+
}
|
|
4359
|
+
continue $sm;
|
|
4360
|
+
} else {
|
|
4361
|
+
this.f3i_1 = new ProbExplanationTerm(this.e3i_1.h3c_1.and(this.x3h_1.h3c_1));
|
|
4362
|
+
this.ci_1 = 2;
|
|
4363
|
+
var tmp_5 = Companion_getInstance_9();
|
|
4364
|
+
var tmp_6 = Companion_getInstance_19().b2h(this.y3h_1, this.z3h_1, this.f3i_1);
|
|
4365
|
+
var tmp_7 = Companion_getInstance_19().b2h(this.y3h_1, this.a3i_1, this.x3h_1);
|
|
4366
|
+
var tmp_8 = this.d3i_1.r1u();
|
|
4367
|
+
suspendResult = this.b3i_1.z4(tmp_5.ofSubstitution(tmp_6, [tmp_7, tmp_8.filter(ProbSolveWithEvidence$computeAllSubstitutions$slambda$lambda(this.w3h_1))]), this);
|
|
4368
|
+
if (suspendResult === get_COROUTINE_SUSPENDED()) {
|
|
4369
|
+
return suspendResult;
|
|
4370
|
+
}
|
|
4371
|
+
continue $sm;
|
|
4372
|
+
}
|
|
4373
|
+
|
|
4374
|
+
break;
|
|
4375
|
+
case 2:
|
|
4376
|
+
this.ci_1 = 4;
|
|
4377
|
+
continue $sm;
|
|
4378
|
+
case 3:
|
|
4379
|
+
this.ci_1 = 4;
|
|
4380
|
+
continue $sm;
|
|
4381
|
+
case 4:
|
|
4382
|
+
this.ci_1 = 1;
|
|
4383
|
+
continue $sm;
|
|
4384
|
+
case 5:
|
|
4385
|
+
return Unit_getInstance();
|
|
4386
|
+
case 6:
|
|
4387
|
+
throw this.fi_1;
|
|
4388
|
+
}
|
|
4389
|
+
} catch ($p) {
|
|
4390
|
+
if (this.di_1 === 6) {
|
|
4391
|
+
throw $p;
|
|
4392
|
+
} else {
|
|
4393
|
+
this.ci_1 = this.di_1;
|
|
4394
|
+
this.fi_1 = $p;
|
|
4395
|
+
}
|
|
4396
|
+
}
|
|
4397
|
+
while (true);
|
|
4398
|
+
};
|
|
4399
|
+
ProbSolveWithEvidence$computeAllSubstitutions$slambda.prototype.u2t = function ($this$sequence, completion) {
|
|
4400
|
+
var i = new ProbSolveWithEvidence$computeAllSubstitutions$slambda(this.v3h_1, this.w3h_1, this.x3h_1, this.y3h_1, this.z3h_1, this.a3i_1, completion);
|
|
4401
|
+
i.b3i_1 = $this$sequence;
|
|
4402
|
+
return i;
|
|
4403
|
+
};
|
|
4404
|
+
function ProbSolveWithEvidence$computeAllSubstitutions$slambda_0($solutions, $goalExplanationVar, $evidenceExplanationTerm, $this_computeAllSubstitutions, $first, $second, resultContinuation) {
|
|
4405
|
+
var i = new ProbSolveWithEvidence$computeAllSubstitutions$slambda($solutions, $goalExplanationVar, $evidenceExplanationTerm, $this_computeAllSubstitutions, $first, $second, resultContinuation);
|
|
4406
|
+
var l = function ($this$sequence, $cont) {
|
|
4407
|
+
return i.t2t($this$sequence, $cont);
|
|
4408
|
+
};
|
|
4409
|
+
l.$arity = 1;
|
|
4410
|
+
return l;
|
|
4411
|
+
}
|
|
4412
|
+
function ProbSolveWithEvidence() {
|
|
4413
|
+
ProbSolveWithEvidence_instance = this;
|
|
4414
|
+
ProblogLib_getInstance();
|
|
4415
|
+
WithoutSideEffects.call(this, 'prob' + '_solve_with_evidence');
|
|
4416
|
+
}
|
|
4417
|
+
ProbSolveWithEvidence.prototype.r2p = function (_this__u8e3s4, first, second, third) {
|
|
4418
|
+
Companion_getInstance_19().h2h(_this__u8e3s4, 2);
|
|
4419
|
+
Companion_getInstance_19().n2h(_this__u8e3s4, 2);
|
|
4420
|
+
var evidenceExplanationVar = Companion_getInstance_1().of('EvidenceExplanation');
|
|
4421
|
+
var tmp;
|
|
4422
|
+
if (ProbSetConfig_getInstance().s3e(_this__u8e3s4.context)) {
|
|
4423
|
+
tmp = toTerm(Companion_getInstance_21().l3d_1);
|
|
4424
|
+
} else {
|
|
4425
|
+
var tmp_0 = Companion_getInstance_3();
|
|
4426
|
+
var tmp$ret$0;
|
|
4427
|
+
// Inline function 'it.unibo.tuprolog.solve.AbstractWrapper.functor' call
|
|
4428
|
+
var tmp0__get_functor__thl4dk = ProbSolveEvidence_getInstance();
|
|
4429
|
+
tmp$ret$0 = tmp0__get_functor__thl4dk.signature.name;
|
|
4430
|
+
var subQuery = tmp_0.of(tmp$ret$0, [evidenceExplanationVar]);
|
|
4431
|
+
var solution = _this__u8e3s4.subSolver().solveOnceWithOptions(subQuery, ProbSetConfig_getInstance().t3g(_this__u8e3s4.context));
|
|
4432
|
+
tmp = solution.r1u().a3(evidenceExplanationVar);
|
|
4433
|
+
}
|
|
4434
|
+
var evidenceExplanationTerm = tmp;
|
|
4435
|
+
var goalExplanationVar = Companion_getInstance_1().of('GoalExplanation');
|
|
4436
|
+
var tmp_1 = _this__u8e3s4.subSolver();
|
|
4437
|
+
var tmp_2 = Companion_getInstance_3();
|
|
4438
|
+
var tmp$ret$1;
|
|
4439
|
+
// Inline function 'it.unibo.tuprolog.solve.AbstractWrapper.functor' call
|
|
4440
|
+
var tmp1__get_functor__4k11yf = ProbSolve_getInstance();
|
|
4441
|
+
tmp$ret$1 = tmp1__get_functor__4k11yf.signature.name;
|
|
4442
|
+
var solutions = tmp_1.solveWithOptions(tmp_2.of(tmp$ret$1, [goalExplanationVar, third]), ProbSetConfig_getInstance().t3g(_this__u8e3s4.context));
|
|
4443
|
+
return sequence(ProbSolveWithEvidence$computeAllSubstitutions$slambda_0(solutions, goalExplanationVar, evidenceExplanationTerm, _this__u8e3s4, first, second, null));
|
|
4444
|
+
};
|
|
4445
|
+
ProbSolveWithEvidence.prototype.n2j = function (_this__u8e3s4, first, second, third) {
|
|
4446
|
+
return this.r2p(_this__u8e3s4, first, second, third);
|
|
4447
|
+
};
|
|
4448
|
+
var ProbSolveWithEvidence_instance;
|
|
4449
|
+
function ProbSolveWithEvidence_getInstance() {
|
|
4450
|
+
if (ProbSolveWithEvidence_instance == null)
|
|
4451
|
+
new ProbSolveWithEvidence();
|
|
4452
|
+
return ProbSolveWithEvidence_instance;
|
|
4453
|
+
}
|
|
4454
|
+
function Prob() {
|
|
4455
|
+
Prob_instance = this;
|
|
4456
|
+
ProblogLib_getInstance();
|
|
4457
|
+
RuleWrapper_init_$Init$('prob', 2, false, 4, null, this);
|
|
4458
|
+
}
|
|
4459
|
+
Prob.prototype.g2k = function (_this__u8e3s4) {
|
|
4460
|
+
return _this__u8e3s4.ktListOf([_this__u8e3s4.varOf('EXPL'), _this__u8e3s4.varOf('GOAL')]);
|
|
4461
|
+
};
|
|
4462
|
+
Prob.prototype.h2k = function (_this__u8e3s4) {
|
|
4463
|
+
var expl = _this__u8e3s4.varOf('EXPL');
|
|
4464
|
+
var goal = _this__u8e3s4.varOf('GOAL');
|
|
4465
|
+
var newGoal = _this__u8e3s4.varOf('NEW_GOAL');
|
|
4466
|
+
var tmp = _this__u8e3s4.atomOf('!');
|
|
4467
|
+
var tmp_0 = _this__u8e3s4.structOf('ensure_executable', [goal]);
|
|
4468
|
+
var tmp$ret$0;
|
|
4469
|
+
// Inline function 'it.unibo.tuprolog.solve.AbstractWrapper.functor' call
|
|
4470
|
+
var tmp0__get_functor__thl4dk = ProbHelper_getInstance();
|
|
4471
|
+
tmp$ret$0 = tmp0__get_functor__thl4dk.signature.name;
|
|
4472
|
+
return _this__u8e3s4.tupleOf([tmp, tmp_0, _this__u8e3s4.structOf(tmp$ret$0, [expl, goal, newGoal]), newGoal]);
|
|
4473
|
+
};
|
|
4474
|
+
var Prob_instance;
|
|
4475
|
+
function Prob_getInstance() {
|
|
4476
|
+
if (Prob_instance == null)
|
|
4477
|
+
new Prob();
|
|
4478
|
+
return Prob_instance;
|
|
4479
|
+
}
|
|
4480
|
+
//region block: post-declaration
|
|
4481
|
+
ProblogSolver.prototype.x1x = copy$default;
|
|
4482
|
+
MutableProblogSolver.prototype.x1x = copy$default;
|
|
4483
|
+
MutableProblogSolver.prototype.loadStaticClauses = loadStaticClauses;
|
|
4484
|
+
MutableProblogSolver.prototype.loadStaticClausesIterable = loadStaticClausesIterable;
|
|
4485
|
+
MutableProblogSolver.prototype.loadStaticClausesSequence = loadStaticClausesSequence;
|
|
4486
|
+
MutableProblogSolver.prototype.loadDynamicClauses = loadDynamicClauses;
|
|
4487
|
+
MutableProblogSolver.prototype.loadDynamicClausesIterable = loadDynamicClausesIterable;
|
|
4488
|
+
MutableProblogSolver.prototype.loadDynamicClausesSequence = loadDynamicClausesSequence;
|
|
4489
|
+
ProblogSolverFactory.prototype.u1y = solverOf$default;
|
|
4490
|
+
ProblogSolverFactory.prototype.w1y = solverOf$default_0;
|
|
4491
|
+
ProblogSolverFactory.prototype.a1z = mutableSolverOf$default;
|
|
4492
|
+
ProblogSolverFactory.prototype.e1z = mutableSolverOf$default_0;
|
|
4493
|
+
ProblogSolverFactory.prototype.newBuilder = newBuilder;
|
|
4494
|
+
ProblogSolverFactory.prototype.c1y = get_defaultRuntime;
|
|
4495
|
+
ProblogSolverFactory.prototype.e1y = get_defaultUnificator;
|
|
4496
|
+
ProblogSolverFactory.prototype.i1y = get_defaultStaticKb;
|
|
4497
|
+
ProblogSolverFactory.prototype.j1y = get_defaultDynamicKb;
|
|
4498
|
+
ProblogSolverFactory.prototype.k1y = get_defaultInputChannel;
|
|
4499
|
+
ProblogSolverFactory.prototype.l1y = get_defaultOutputChannel;
|
|
4500
|
+
ProblogSolverFactory.prototype.m1y = get_defaultErrorChannel;
|
|
4501
|
+
ProblogSolverFactory.prototype.n1y = get_defaultWarningsChannel;
|
|
4502
|
+
ProblogSolverFactory.prototype.x1y = solverWithDefaultBuiltins;
|
|
4503
|
+
ProblogSolverFactory.prototype.y1y = solverWithDefaultBuiltins$default;
|
|
4504
|
+
ProblogSolverFactory.prototype.b1z = mutableSolverWithDefaultBuiltins;
|
|
4505
|
+
ProblogSolverFactory.prototype.c1z = mutableSolverWithDefaultBuiltins$default;
|
|
4506
|
+
DefaultBuiltins.prototype.containsSignature = containsSignature;
|
|
4507
|
+
DefaultBuiltins.prototype.containsOperator = containsOperator;
|
|
4508
|
+
DefaultBuiltins.prototype.hasPrimitive = hasPrimitive;
|
|
4509
|
+
DefaultBuiltins.prototype.hasFunction = hasFunction;
|
|
4510
|
+
DefaultBuiltins.prototype.j2e = get_ruleSignatures;
|
|
4511
|
+
DefaultBuiltins.prototype.hasProtected = hasProtected;
|
|
4512
|
+
MinimalBuiltins.prototype.containsSignature = containsSignature;
|
|
4513
|
+
MinimalBuiltins.prototype.containsOperator = containsOperator;
|
|
4514
|
+
MinimalBuiltins.prototype.hasPrimitive = hasPrimitive;
|
|
4515
|
+
MinimalBuiltins.prototype.hasFunction = hasFunction;
|
|
4516
|
+
MinimalBuiltins.prototype.j2e = get_ruleSignatures;
|
|
4517
|
+
MinimalBuiltins.prototype.hasProtected = hasProtected;
|
|
4518
|
+
ProblogLib.prototype.containsSignature = containsSignature;
|
|
4519
|
+
ProblogLib.prototype.containsOperator = containsOperator;
|
|
4520
|
+
ProblogLib.prototype.hasPrimitive = hasPrimitive;
|
|
4521
|
+
ProblogLib.prototype.hasFunction = hasFunction;
|
|
4522
|
+
ProblogLib.prototype.j2e = get_ruleSignatures;
|
|
4523
|
+
ProblogLib.prototype.hasProtected = hasProtected;
|
|
4524
|
+
BinaryDecisionDiagramExplanation.prototype.y3d = get_probabilityOrNull;
|
|
4525
|
+
//endregion
|
|
4526
|
+
//region block: init
|
|
4527
|
+
ANNOTATION_FUNCTOR = '::';
|
|
4528
|
+
//endregion
|
|
4529
|
+
//region block: exports
|
|
4530
|
+
function $jsExportAll$(_) {
|
|
4531
|
+
var $it = _.it || (_.it = {});
|
|
4532
|
+
var $it$unibo = $it.unibo || ($it.unibo = {});
|
|
4533
|
+
var $it$unibo$tuprolog = $it$unibo.tuprolog || ($it$unibo.tuprolog = {});
|
|
4534
|
+
var $it$unibo$tuprolog$solve = $it$unibo$tuprolog.solve || ($it$unibo$tuprolog.solve = {});
|
|
4535
|
+
var $it$unibo$tuprolog$solve$problog = $it$unibo$tuprolog$solve.problog || ($it$unibo$tuprolog$solve.problog = {});
|
|
4536
|
+
Object.defineProperty($it$unibo$tuprolog$solve$problog, 'ProblogSolverFactory', {
|
|
4537
|
+
configurable: true,
|
|
4538
|
+
get: ProblogSolverFactory_getInstance
|
|
4539
|
+
});
|
|
4540
|
+
}
|
|
4541
|
+
$jsExportAll$(_);
|
|
4542
|
+
_.$jsExportAll$ = $jsExportAll$;
|
|
4543
|
+
//endregion
|
|
4544
|
+
return _;
|
|
4545
|
+
}(module.exports, require('./kotlin-kotlin-stdlib-js-ir.js'), require('./2p-core.js'), require('./2p-solve.js'), require('./2p-solve-plp.js'), require('./2p-solve-classic.js'), require('./2p-bdd.js'), require('./2p-theory.js'), require('./2p-utils.js'), require('./2p-unify.js')));
|
|
4546
|
+
|
|
4547
|
+
//# sourceMappingURL=2p-solve-problog.js.map
|