@tuprolog/arg2p-core 0.6.2 → 0.6.5
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/kotlin/arg2p-core/it/unibo/tuprolog/argumentation/core/libs/graph/labelling/labelling.kjsm +0 -0
- package/kotlin/arg2p-core/it/unibo/tuprolog/argumentation/core/libs/language/language.kjsm +0 -0
- package/kotlin/arg2p-core/it/unibo/tuprolog/argumentation/core/libs/sources/sources.kjsm +0 -0
- package/kotlin/arg2p-core/it/unibo/tuprolog/argumentation/core/libs/utils/utils.kjsm +0 -0
- package/kotlin/arg2p-core.js +415 -24
- package/kotlin/arg2p-core.js.map +1 -1
- package/kotlin/arg2p-core.meta.js +1 -1
- package/package.json +1 -1
- package/package.json.hash +1 -1
- package/pre-package.json +1 -1
package/kotlin/arg2p-core.js
CHANGED
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
}(this, function (_, Kotlin, $module$_2p_solve, $module$_2p_dsl_theory, $module$_2p_dsl_core, $module$_2p_unify, $module$_2p_core, $module$_2p_theory, $module$_2p_parser_theory, $module$_2p_solve_classic, $module$_2p_parser_core) {
|
|
30
30
|
'use strict';
|
|
31
|
+
var $$importsForInline$$ = _.$$importsForInline$$ || (_.$$importsForInline$$ = {});
|
|
31
32
|
var Libraries = $module$_2p_solve.it.unibo.tuprolog.solve.library.Libraries;
|
|
32
33
|
var listOf = Kotlin.kotlin.collections.listOf_i5x0yv$;
|
|
33
34
|
var plus = Kotlin.kotlin.collections.plus_mydzjv$;
|
|
@@ -61,9 +62,11 @@
|
|
|
61
62
|
var mapCapacity = Kotlin.kotlin.collections.mapCapacity_za3lpa$;
|
|
62
63
|
var coerceAtLeast = Kotlin.kotlin.ranges.coerceAtLeast_dqglrj$;
|
|
63
64
|
var LinkedHashMap_init = Kotlin.kotlin.collections.LinkedHashMap_init_bwtc7$;
|
|
65
|
+
var classicWithDefaultBuiltins = $module$_2p_solve_classic.it.unibo.tuprolog.solve.classic.classicMutableSolverWithDefaultBuiltins;
|
|
64
66
|
var Substitution = $module$_2p_core.it.unibo.tuprolog.core.Substitution;
|
|
65
67
|
var Numeric = $module$_2p_core.it.unibo.tuprolog.core.Numeric;
|
|
66
68
|
var ensureNotNull = Kotlin.ensureNotNull;
|
|
69
|
+
var first = Kotlin.kotlin.sequences.first_veqyi0$;
|
|
67
70
|
var to = Kotlin.kotlin.to_ujzrz7$;
|
|
68
71
|
var mutableMapOf = Kotlin.kotlin.collections.mutableMapOf_qfcya0$;
|
|
69
72
|
var Atom = $module$_2p_core.it.unibo.tuprolog.core.Atom;
|
|
@@ -76,7 +79,6 @@
|
|
|
76
79
|
var DomainError$Expected = $module$_2p_solve.it.unibo.tuprolog.solve.exception.error.DomainError.Expected;
|
|
77
80
|
var Unit = Kotlin.kotlin.Unit;
|
|
78
81
|
var filter = Kotlin.kotlin.sequences.filter_euau3h$;
|
|
79
|
-
var first = Kotlin.kotlin.sequences.first_veqyi0$;
|
|
80
82
|
var prolog = $module$_2p_dsl_core.it.unibo.tuprolog.dsl.prolog;
|
|
81
83
|
var Specifier = $module$_2p_core.it.unibo.tuprolog.core.operators.Specifier;
|
|
82
84
|
var Operator = $module$_2p_core.it.unibo.tuprolog.core.operators.Operator;
|
|
@@ -108,7 +110,10 @@
|
|
|
108
110
|
var Random = Kotlin.kotlin.random.Random;
|
|
109
111
|
var toTerm = $module$_2p_core.it.unibo.tuprolog.core.listToTerm;
|
|
110
112
|
var UnaryPredicate$WithoutSideEffects = $module$_2p_solve.it.unibo.tuprolog.solve.primitive.UnaryPredicate.WithoutSideEffects;
|
|
113
|
+
var BinaryRelation$WithoutSideEffects = $module$_2p_solve.it.unibo.tuprolog.solve.primitive.BinaryRelation.WithoutSideEffects;
|
|
114
|
+
var IllegalArgumentException_init = Kotlin.kotlin.IllegalArgumentException_init;
|
|
111
115
|
var copyToArray = Kotlin.kotlin.collections.copyToArray;
|
|
116
|
+
var hashCode = Kotlin.hashCode;
|
|
112
117
|
var AliasedLibrary = $module$_2p_solve.it.unibo.tuprolog.solve.library.AliasedLibrary;
|
|
113
118
|
var compareBy = Kotlin.kotlin.comparisons.compareBy_bvgy4j$;
|
|
114
119
|
var sortedWith = Kotlin.kotlin.sequences.sortedWith_vjgqpk$;
|
|
@@ -151,6 +156,8 @@
|
|
|
151
156
|
CompleteLabellerBase.prototype.constructor = CompleteLabellerBase;
|
|
152
157
|
GroundedLabellerBase.prototype = Object.create(LazyRawPrologContent.prototype);
|
|
153
158
|
GroundedLabellerBase.prototype.constructor = GroundedLabellerBase;
|
|
159
|
+
GroundedLabellerOptimizedBase.prototype = Object.create(LazyRawPrologContent.prototype);
|
|
160
|
+
GroundedLabellerOptimizedBase.prototype.constructor = GroundedLabellerOptimizedBase;
|
|
154
161
|
Labelling.prototype = Object.create(RuleWrapper.prototype);
|
|
155
162
|
Labelling.prototype.constructor = Labelling;
|
|
156
163
|
StatementLabellerBase.prototype = Object.create(LazyRawPrologContent.prototype);
|
|
@@ -167,6 +174,10 @@
|
|
|
167
174
|
DefeasibleRules.prototype.constructor = DefeasibleRules;
|
|
168
175
|
Bps.prototype = Object.create(UnaryPredicate$WithoutSideEffects.prototype);
|
|
169
176
|
Bps.prototype.constructor = Bps;
|
|
177
|
+
ExtractStrictIds.prototype = Object.create(BinaryRelation$WithoutSideEffects.prototype);
|
|
178
|
+
ExtractStrictIds.prototype.constructor = ExtractStrictIds;
|
|
179
|
+
RuleToClause.prototype = Object.create(BinaryRelation$WithoutSideEffects.prototype);
|
|
180
|
+
RuleToClause.prototype.constructor = RuleToClause;
|
|
170
181
|
StructuredModeBase.prototype = Object.create(LazyRawPrologContent.prototype);
|
|
171
182
|
StructuredModeBase.prototype.constructor = StructuredModeBase;
|
|
172
183
|
DebugBase.prototype = Object.create(LazyRawPrologContent.prototype);
|
|
@@ -175,6 +186,8 @@
|
|
|
175
186
|
SuperiorityRelationBase.prototype.constructor = SuperiorityRelationBase;
|
|
176
187
|
UtilsBase.prototype = Object.create(LazyRawPrologContent.prototype);
|
|
177
188
|
UtilsBase.prototype.constructor = UtilsBase;
|
|
189
|
+
ArgumentHash.prototype = Object.create(BinaryRelation$WithoutSideEffects.prototype);
|
|
190
|
+
ArgumentHash.prototype.constructor = ArgumentHash;
|
|
178
191
|
EngineInterface.prototype = Object.create(EngineInterfaceBase.prototype);
|
|
179
192
|
EngineInterface.prototype.constructor = EngineInterface;
|
|
180
193
|
AbstractMode.prototype = Object.create(AbstractModeBase.prototype);
|
|
@@ -201,6 +214,8 @@
|
|
|
201
214
|
CompleteLabeller.prototype.constructor = CompleteLabeller;
|
|
202
215
|
GroundedLabeller.prototype = Object.create(GroundedLabellerBase.prototype);
|
|
203
216
|
GroundedLabeller.prototype.constructor = GroundedLabeller;
|
|
217
|
+
GroundedLabellerOptimized.prototype = Object.create(GroundedLabellerOptimizedBase.prototype);
|
|
218
|
+
GroundedLabellerOptimized.prototype.constructor = GroundedLabellerOptimized;
|
|
204
219
|
StatementLabeller.prototype = Object.create(StatementLabellerBase.prototype);
|
|
205
220
|
StatementLabeller.prototype.constructor = StatementLabeller;
|
|
206
221
|
RuleParser.prototype = Object.create(RuleParserBase.prototype);
|
|
@@ -285,7 +300,7 @@
|
|
|
285
300
|
staticLibs = emptyList();
|
|
286
301
|
if (dynamicLibs === void 0)
|
|
287
302
|
dynamicLibs = emptyList();
|
|
288
|
-
return this.of_gdqvf0$(plus(listOf([EngineInterface_getInstance(), new Cache()]), staticLibs), plus(listOf([Utils_getInstance_0(), Debug_getInstance_0(), RuleParser_getInstance(), MetaInterpreter_getInstance(), ModuleCalls_getInstance(), ArgumentationGraphBuilder_getInstance(), AttackRestrictionHandler_getInstance(), BpMetaGraphHandler_getInstance(), DefeasiblePreferencesHandler_getInstance(), GenericDefeasiblePreferencesHandler_getInstance(), StrictPreferencesHandler_getInstance(), BpLabeller_getInstance(), CompleteLabeller_getInstance(), GroundedLabeller_getInstance(), StatementLabeller_getInstance(), AbstractMode_getInstance(), StructuredMode_getInstance(), SuperiorityRelation_getInstance_0(), BpPartialLabeller_getInstance(), BpCompleteLabeller_getInstance(), PassThroughStatementLabeller_getInstance(), BinaryStatementLabeller_getInstance()]), dynamicLibs));
|
|
303
|
+
return this.of_gdqvf0$(plus(listOf([EngineInterface_getInstance(), new Cache()]), staticLibs), plus(listOf([Utils_getInstance_0(), Debug_getInstance_0(), RuleParser_getInstance(), MetaInterpreter_getInstance(), ModuleCalls_getInstance(), ArgumentationGraphBuilder_getInstance(), AttackRestrictionHandler_getInstance(), BpMetaGraphHandler_getInstance(), DefeasiblePreferencesHandler_getInstance(), GenericDefeasiblePreferencesHandler_getInstance(), StrictPreferencesHandler_getInstance(), BpLabeller_getInstance(), CompleteLabeller_getInstance(), GroundedLabeller_getInstance(), StatementLabeller_getInstance(), AbstractMode_getInstance(), StructuredMode_getInstance(), SuperiorityRelation_getInstance_0(), BpPartialLabeller_getInstance(), BpCompleteLabeller_getInstance(), PassThroughStatementLabeller_getInstance(), BinaryStatementLabeller_getInstance(), GroundedLabellerOptimized_getInstance()]), dynamicLibs));
|
|
289
304
|
};
|
|
290
305
|
Arg2pSolver$Companion.$metadata$ = {
|
|
291
306
|
kind: Kind_OBJECT,
|
|
@@ -1331,7 +1346,7 @@
|
|
|
1331
1346
|
function Context() {
|
|
1332
1347
|
this.nextSolver_0 = 1;
|
|
1333
1348
|
this.selectedSolver_0 = 0;
|
|
1334
|
-
var $receiver =
|
|
1349
|
+
var $receiver = classicWithDefaultBuiltins(MutableSolver.Companion, void 0, void 0, Theory.Companion.empty(), MutableTheory.Companion.empty());
|
|
1335
1350
|
$receiver.setFlag(flags.Unknown.name, flags.Unknown.FAIL);
|
|
1336
1351
|
this.dynamicSolver_0 = mutableMapOf([to(0, $receiver)]);
|
|
1337
1352
|
this.alias_476cz2$_0 = 'prolog.argumentation.context';
|
|
@@ -1351,7 +1366,7 @@
|
|
|
1351
1366
|
this.$outer.nextSolver_0 = 1;
|
|
1352
1367
|
this.$outer.dynamicSolver_0.clear();
|
|
1353
1368
|
var tmp$ = this.$outer.dynamicSolver_0;
|
|
1354
|
-
var $receiver =
|
|
1369
|
+
var $receiver = classicWithDefaultBuiltins(MutableSolver.Companion, void 0, void 0, Theory.Companion.empty(), MutableTheory.Companion.empty());
|
|
1355
1370
|
$receiver.setFlag(flags.Unknown.name, flags.Unknown.FAIL);
|
|
1356
1371
|
tmp$.put_xwzc9p$(0, $receiver);
|
|
1357
1372
|
return sequenceOf([request.replyWithCondition(true, void 0, [])]);
|
|
@@ -1417,7 +1432,7 @@
|
|
|
1417
1432
|
var result = request.arguments.get_za3lpa$(1);
|
|
1418
1433
|
var tmp$_1 = this.$outer.dynamicSolver_0;
|
|
1419
1434
|
var tmp$_2 = this.$outer.nextSolver_0;
|
|
1420
|
-
var $receiver =
|
|
1435
|
+
var $receiver = classicWithDefaultBuiltins(MutableSolver.Companion, void 0, void 0, Theory.Companion.empty(), MutableTheory.Companion.ofIterable(ensureNotNull(this.$outer.dynamicSolver_0.get_11rb$(target)).dynamicKb));
|
|
1421
1436
|
$receiver.setFlag(flags.Unknown.name, flags.Unknown.FAIL);
|
|
1422
1437
|
tmp$_1.put_xwzc9p$(tmp$_2, $receiver);
|
|
1423
1438
|
tmp$_0 = this.$outer;
|
|
@@ -1443,9 +1458,14 @@
|
|
|
1443
1458
|
return this.signature_t5avxd$_0;
|
|
1444
1459
|
}
|
|
1445
1460
|
});
|
|
1461
|
+
function Context$DynamicCacheAssert$solve$lambda(this$Context, closure$term) {
|
|
1462
|
+
return function ($receiver) {
|
|
1463
|
+
return ensureNotNull(this$Context.dynamicSolver_0.get_11rb$(this$Context.selectedSolver_0)).solve($receiver.stringInvoke('asserta', closure$term, []));
|
|
1464
|
+
};
|
|
1465
|
+
}
|
|
1446
1466
|
Context$DynamicCacheAssert.prototype.solve = function (request) {
|
|
1447
1467
|
var term = request.arguments.get_za3lpa$(0);
|
|
1448
|
-
|
|
1468
|
+
first(arg2pScope(Context$DynamicCacheAssert$solve$lambda(this.$outer, term)));
|
|
1449
1469
|
return sequenceOf([request.replyWithCondition(true, void 0, [])]);
|
|
1450
1470
|
};
|
|
1451
1471
|
Context$DynamicCacheAssert.$metadata$ = {
|
|
@@ -1463,9 +1483,14 @@
|
|
|
1463
1483
|
return this.signature_5o25xi$_0;
|
|
1464
1484
|
}
|
|
1465
1485
|
});
|
|
1486
|
+
function Context$DynamicCacheRetract$solve$lambda(this$Context, closure$term) {
|
|
1487
|
+
return function ($receiver) {
|
|
1488
|
+
return ensureNotNull(this$Context.dynamicSolver_0.get_11rb$(this$Context.selectedSolver_0)).solve($receiver.stringInvoke('retractall', closure$term, []));
|
|
1489
|
+
};
|
|
1490
|
+
}
|
|
1466
1491
|
Context$DynamicCacheRetract.prototype.solve = function (request) {
|
|
1467
1492
|
var term = request.arguments.get_za3lpa$(0);
|
|
1468
|
-
|
|
1493
|
+
first(arg2pScope(Context$DynamicCacheRetract$solve$lambda(this.$outer, term)));
|
|
1469
1494
|
return sequenceOf([request.replyWithCondition(true, void 0, [])]);
|
|
1470
1495
|
};
|
|
1471
1496
|
Context$DynamicCacheRetract.$metadata$ = {
|
|
@@ -2421,7 +2446,7 @@
|
|
|
2421
2446
|
return 'grounded';
|
|
2422
2447
|
};
|
|
2423
2448
|
ArgumentLabellingMode.prototype.values = function () {
|
|
2424
|
-
return listOf(['grounded', 'complete', 'bp_grounded', 'bp_grounded_partial', 'bp_grounded_complete']);
|
|
2449
|
+
return listOf(['grounded', 'grounded_hash', 'complete', 'bp_grounded', 'bp_grounded_partial', 'bp_grounded_complete']);
|
|
2425
2450
|
};
|
|
2426
2451
|
ArgumentLabellingMode.$metadata$ = {
|
|
2427
2452
|
kind: Kind_OBJECT,
|
|
@@ -2951,6 +2976,43 @@
|
|
|
2951
2976
|
simpleName: 'GroundedLabellerBase',
|
|
2952
2977
|
interfaces: [Loadable, LazyRawPrologContent, ArgLibrary]
|
|
2953
2978
|
};
|
|
2979
|
+
function GroundedLabellerOptimizedBase() {
|
|
2980
|
+
LazyRawPrologContent.call(this);
|
|
2981
|
+
this.alias_9fhn2g$_0 = 'prolog.argumentation.graph.labelling.grounded.optimized';
|
|
2982
|
+
this.theoryOperators_8xcsny$_0 = DynamicLoader$Companion_getInstance().operators().plusOperatorSet(OperatorSet.Companion.DEFAULT);
|
|
2983
|
+
}
|
|
2984
|
+
Object.defineProperty(GroundedLabellerOptimizedBase.prototype, 'alias', {
|
|
2985
|
+
configurable: true,
|
|
2986
|
+
get: function () {
|
|
2987
|
+
return this.alias_9fhn2g$_0;
|
|
2988
|
+
}
|
|
2989
|
+
});
|
|
2990
|
+
Object.defineProperty(GroundedLabellerOptimizedBase.prototype, 'baseContent', {
|
|
2991
|
+
configurable: true,
|
|
2992
|
+
get: function () {
|
|
2993
|
+
return Library.Companion.aliased(this.alias, void 0, this.prologTheory);
|
|
2994
|
+
}
|
|
2995
|
+
});
|
|
2996
|
+
Object.defineProperty(GroundedLabellerOptimizedBase.prototype, 'baseFlags', {
|
|
2997
|
+
configurable: true,
|
|
2998
|
+
get: function () {
|
|
2999
|
+
return emptyList();
|
|
3000
|
+
}
|
|
3001
|
+
});
|
|
3002
|
+
GroundedLabellerOptimizedBase.prototype.identifier = function () {
|
|
3003
|
+
return 'grounded_hash';
|
|
3004
|
+
};
|
|
3005
|
+
Object.defineProperty(GroundedLabellerOptimizedBase.prototype, 'theoryOperators', {
|
|
3006
|
+
configurable: true,
|
|
3007
|
+
get: function () {
|
|
3008
|
+
return this.theoryOperators_8xcsny$_0;
|
|
3009
|
+
}
|
|
3010
|
+
});
|
|
3011
|
+
GroundedLabellerOptimizedBase.$metadata$ = {
|
|
3012
|
+
kind: Kind_CLASS,
|
|
3013
|
+
simpleName: 'GroundedLabellerOptimizedBase',
|
|
3014
|
+
interfaces: [Loadable, LazyRawPrologContent, ArgLibrary]
|
|
3015
|
+
};
|
|
2954
3016
|
function PassThroughStatementLabeller() {
|
|
2955
3017
|
PassThroughStatementLabeller_instance = this;
|
|
2956
3018
|
this.alias_as0zmd$_0 = 'prolog.argumentation.graph.labelling.statement.pt';
|
|
@@ -3077,7 +3139,11 @@
|
|
|
3077
3139
|
return $receiver.descriptionPair;
|
|
3078
3140
|
}.bind(null, Premises_getInstance())).get(), getPropertyCallableRef('descriptionPair', 0, function ($receiver) {
|
|
3079
3141
|
return $receiver.descriptionPair;
|
|
3080
|
-
}.bind(null, DefeasibleRules_getInstance())).get()
|
|
3142
|
+
}.bind(null, DefeasibleRules_getInstance())).get(), getPropertyCallableRef('descriptionPair', 0, function ($receiver) {
|
|
3143
|
+
return $receiver.descriptionPair;
|
|
3144
|
+
}.bind(null, ExtractStrictIds_getInstance())).get(), getPropertyCallableRef('descriptionPair', 0, function ($receiver) {
|
|
3145
|
+
return $receiver.descriptionPair;
|
|
3146
|
+
}.bind(null, RuleToClause_getInstance())).get()]), this.prologTheory, RuleParserBase$Companion_getInstance().operators());
|
|
3081
3147
|
}
|
|
3082
3148
|
});
|
|
3083
3149
|
Object.defineProperty(RuleParserBase.prototype, 'baseFlags', {
|
|
@@ -3396,7 +3462,7 @@
|
|
|
3396
3462
|
tmp$_1 = destination.iterator();
|
|
3397
3463
|
while (tmp$_1.hasNext()) {
|
|
3398
3464
|
var item = tmp$_1.next();
|
|
3399
|
-
destination_0.add_11rb$(
|
|
3465
|
+
destination_0.add_11rb$(Struct.Companion.of('abstractBp', [prologScope.listOfIterable(ensureNotNull(item.head).argsList)]));
|
|
3400
3466
|
}
|
|
3401
3467
|
return toTerm(destination_0);
|
|
3402
3468
|
}
|
|
@@ -3414,6 +3480,79 @@
|
|
|
3414
3480
|
new Bps();
|
|
3415
3481
|
}return Bps_instance;
|
|
3416
3482
|
}
|
|
3483
|
+
function ExtractStrictIds() {
|
|
3484
|
+
ExtractStrictIds_instance = this;
|
|
3485
|
+
BinaryRelation$WithoutSideEffects.call(this, 'extract_id');
|
|
3486
|
+
}
|
|
3487
|
+
ExtractStrictIds.prototype.computeAllSubstitutions_2j1e5m$ = function ($receiver, first, second) {
|
|
3488
|
+
var tmp$ = Substitution.Companion;
|
|
3489
|
+
var tmp$_0 = ensureNotNull(second.asVar());
|
|
3490
|
+
var tmp$_1 = List.Companion;
|
|
3491
|
+
var $receiver_0 = ensureNotNull(first.asList()).toList();
|
|
3492
|
+
var destination = ArrayList_init(collectionSizeOrDefault($receiver_0, 10));
|
|
3493
|
+
var tmp$_2;
|
|
3494
|
+
tmp$_2 = $receiver_0.iterator();
|
|
3495
|
+
while (tmp$_2.hasNext()) {
|
|
3496
|
+
var item = tmp$_2.next();
|
|
3497
|
+
destination.add_11rb$(Struct.Companion.of('strict', [ensureNotNull(item.asCons()).head]));
|
|
3498
|
+
}
|
|
3499
|
+
return sequenceOf([tmp$.of(tmp$_0, tmp$_1.ofList(destination))]);
|
|
3500
|
+
};
|
|
3501
|
+
ExtractStrictIds.$metadata$ = {
|
|
3502
|
+
kind: Kind_OBJECT,
|
|
3503
|
+
simpleName: 'ExtractStrictIds',
|
|
3504
|
+
interfaces: [BinaryRelation$WithoutSideEffects]
|
|
3505
|
+
};
|
|
3506
|
+
var ExtractStrictIds_instance = null;
|
|
3507
|
+
function ExtractStrictIds_getInstance() {
|
|
3508
|
+
if (ExtractStrictIds_instance === null) {
|
|
3509
|
+
new ExtractStrictIds();
|
|
3510
|
+
}return ExtractStrictIds_instance;
|
|
3511
|
+
}
|
|
3512
|
+
function RuleToClause() {
|
|
3513
|
+
RuleToClause_instance = this;
|
|
3514
|
+
BinaryRelation$WithoutSideEffects.call(this, 'rule_to_clause');
|
|
3515
|
+
}
|
|
3516
|
+
RuleToClause.prototype.computeAllSubstitutions_2j1e5m$ = function ($receiver, first, second) {
|
|
3517
|
+
var tmp$ = Substitution.Companion;
|
|
3518
|
+
var tmp$_0 = ensureNotNull(second.asVar());
|
|
3519
|
+
var tmp$_1 = List.Companion;
|
|
3520
|
+
var $receiver_0 = ensureNotNull(first.asList()).toList();
|
|
3521
|
+
var destination = ArrayList_init(collectionSizeOrDefault($receiver_0, 10));
|
|
3522
|
+
var tmp$_2;
|
|
3523
|
+
tmp$_2 = $receiver_0.iterator();
|
|
3524
|
+
loop_label: while (tmp$_2.hasNext()) {
|
|
3525
|
+
var item = tmp$_2.next();
|
|
3526
|
+
var tmp$_3 = destination.add_11rb$;
|
|
3527
|
+
var it = ensureNotNull(item.asList()).toList();
|
|
3528
|
+
var block$result;
|
|
3529
|
+
block$break: do {
|
|
3530
|
+
switch (it.size) {
|
|
3531
|
+
case 2:
|
|
3532
|
+
block$result = Clause.Companion.of(Struct.Companion.of('rl', [it.get_za3lpa$(1)]), [item]);
|
|
3533
|
+
break block$break;
|
|
3534
|
+
case 3:
|
|
3535
|
+
block$result = Clause.Companion.of(Struct.Companion.of('rl', [it.get_za3lpa$(2)]), [item]);
|
|
3536
|
+
break block$break;
|
|
3537
|
+
default:throw IllegalArgumentException_init();
|
|
3538
|
+
}
|
|
3539
|
+
}
|
|
3540
|
+
while (false);
|
|
3541
|
+
tmp$_3.call(destination, block$result);
|
|
3542
|
+
}
|
|
3543
|
+
return sequenceOf([tmp$.of(tmp$_0, tmp$_1.ofList(destination))]);
|
|
3544
|
+
};
|
|
3545
|
+
RuleToClause.$metadata$ = {
|
|
3546
|
+
kind: Kind_OBJECT,
|
|
3547
|
+
simpleName: 'RuleToClause',
|
|
3548
|
+
interfaces: [BinaryRelation$WithoutSideEffects]
|
|
3549
|
+
};
|
|
3550
|
+
var RuleToClause_instance = null;
|
|
3551
|
+
function RuleToClause_getInstance() {
|
|
3552
|
+
if (RuleToClause_instance === null) {
|
|
3553
|
+
new RuleToClause();
|
|
3554
|
+
}return RuleToClause_instance;
|
|
3555
|
+
}
|
|
3417
3556
|
function StructuredModeBase() {
|
|
3418
3557
|
LazyRawPrologContent.call(this);
|
|
3419
3558
|
this.alias_k0m5up$_0 = 'prolog.argumentation.structured';
|
|
@@ -3631,7 +3770,14 @@
|
|
|
3631
3770
|
Object.defineProperty(UtilsBase.prototype, 'baseContent', {
|
|
3632
3771
|
configurable: true,
|
|
3633
3772
|
get: function () {
|
|
3634
|
-
|
|
3773
|
+
var tmp$, tmp$_0, tmp$_1;
|
|
3774
|
+
tmp$_1 = Library.Companion;
|
|
3775
|
+
tmp$ = this.alias;
|
|
3776
|
+
tmp$_0 = this.prologTheory;
|
|
3777
|
+
var tmp$_2 = to(AppendOptimized_getInstance().signature, AppendOptimized_getInstance());
|
|
3778
|
+
var tmp$_3 = to(AssertAll_getInstance().signature, AssertAll_getInstance());
|
|
3779
|
+
var $this = ArgumentHash_getInstance();
|
|
3780
|
+
return tmp$_1.aliased(tmp$, mapOf_0([tmp$_2, tmp$_3, to($this.signature, $this.wrappedImplementation)]), tmp$_0);
|
|
3635
3781
|
}
|
|
3636
3782
|
});
|
|
3637
3783
|
Object.defineProperty(UtilsBase.prototype, 'baseFlags', {
|
|
@@ -3654,6 +3800,190 @@
|
|
|
3654
3800
|
simpleName: 'UtilsBase',
|
|
3655
3801
|
interfaces: [Loadable, LazyRawPrologContent, ArgLibrary]
|
|
3656
3802
|
};
|
|
3803
|
+
function AppendOptimized() {
|
|
3804
|
+
AppendOptimized_instance = this;
|
|
3805
|
+
this.signature = new Signature('append_fast', 3);
|
|
3806
|
+
}
|
|
3807
|
+
function Coroutine$AppendOptimized$solve$lambda(closure$request_0, closure$res_0, closure$list1_0, closure$list2_0, $receiver_0, controller, continuation_0) {
|
|
3808
|
+
CoroutineImpl.call(this, continuation_0);
|
|
3809
|
+
this.$controller = controller;
|
|
3810
|
+
this.exceptionState_0 = 1;
|
|
3811
|
+
this.local$closure$request = closure$request_0;
|
|
3812
|
+
this.local$closure$res = closure$res_0;
|
|
3813
|
+
this.local$closure$list1 = closure$list1_0;
|
|
3814
|
+
this.local$closure$list2 = closure$list2_0;
|
|
3815
|
+
this.local$$receiver = $receiver_0;
|
|
3816
|
+
}
|
|
3817
|
+
Coroutine$AppendOptimized$solve$lambda.$metadata$ = {
|
|
3818
|
+
kind: Kotlin.Kind.CLASS,
|
|
3819
|
+
simpleName: null,
|
|
3820
|
+
interfaces: [CoroutineImpl]
|
|
3821
|
+
};
|
|
3822
|
+
Coroutine$AppendOptimized$solve$lambda.prototype = Object.create(CoroutineImpl.prototype);
|
|
3823
|
+
Coroutine$AppendOptimized$solve$lambda.prototype.constructor = Coroutine$AppendOptimized$solve$lambda;
|
|
3824
|
+
Coroutine$AppendOptimized$solve$lambda.prototype.doResume = function () {
|
|
3825
|
+
do
|
|
3826
|
+
try {
|
|
3827
|
+
switch (this.state_0) {
|
|
3828
|
+
case 0:
|
|
3829
|
+
this.state_0 = 2;
|
|
3830
|
+
this.result_0 = this.local$$receiver.yield_11rb$(this.local$closure$request.replyWith(Substitution.Companion.of(this.local$closure$res, List.Companion.ofList(plus(this.local$closure$list1.toList(), this.local$closure$list2.toList()))), void 0, []), this);
|
|
3831
|
+
if (this.result_0 === COROUTINE_SUSPENDED)
|
|
3832
|
+
return COROUTINE_SUSPENDED;
|
|
3833
|
+
continue;
|
|
3834
|
+
case 1:
|
|
3835
|
+
throw this.exception_0;
|
|
3836
|
+
case 2:
|
|
3837
|
+
return this.result_0;
|
|
3838
|
+
default:this.state_0 = 1;
|
|
3839
|
+
throw new Error('State Machine Unreachable execution');
|
|
3840
|
+
}
|
|
3841
|
+
} catch (e) {
|
|
3842
|
+
if (this.state_0 === 1) {
|
|
3843
|
+
this.exceptionState_0 = this.state_0;
|
|
3844
|
+
throw e;
|
|
3845
|
+
} else {
|
|
3846
|
+
this.state_0 = this.exceptionState_0;
|
|
3847
|
+
this.exception_0 = e;
|
|
3848
|
+
}
|
|
3849
|
+
}
|
|
3850
|
+
while (true);
|
|
3851
|
+
};
|
|
3852
|
+
function AppendOptimized$solve$lambda(closure$request_0, closure$res_0, closure$list1_0, closure$list2_0) {
|
|
3853
|
+
return function ($receiver_0, continuation_0, suspended) {
|
|
3854
|
+
var instance = new Coroutine$AppendOptimized$solve$lambda(closure$request_0, closure$res_0, closure$list1_0, closure$list2_0, $receiver_0, this, continuation_0);
|
|
3855
|
+
if (suspended)
|
|
3856
|
+
return instance;
|
|
3857
|
+
else
|
|
3858
|
+
return instance.doResume(null);
|
|
3859
|
+
};
|
|
3860
|
+
}
|
|
3861
|
+
AppendOptimized.prototype.solve = function (request) {
|
|
3862
|
+
var list1 = request.arguments.get_za3lpa$(0);
|
|
3863
|
+
var list2 = request.arguments.get_za3lpa$(1);
|
|
3864
|
+
var res = request.arguments.get_za3lpa$(2);
|
|
3865
|
+
if (!Kotlin.isType(list1, List)) {
|
|
3866
|
+
throw TypeError.Companion.forGoal(request.context, request.signature, TypeError$Expected.LIST, list1);
|
|
3867
|
+
}if (!Kotlin.isType(list2, List)) {
|
|
3868
|
+
throw TypeError.Companion.forGoal(request.context, request.signature, TypeError$Expected.LIST, list2);
|
|
3869
|
+
}if (!Kotlin.isType(res, Var)) {
|
|
3870
|
+
throw TypeError.Companion.forGoal(request.context, request.signature, TypeError$Expected.VARIABLE, res);
|
|
3871
|
+
}return sequence(AppendOptimized$solve$lambda(request, res, list1, list2));
|
|
3872
|
+
};
|
|
3873
|
+
AppendOptimized.$metadata$ = {
|
|
3874
|
+
kind: Kind_OBJECT,
|
|
3875
|
+
simpleName: 'AppendOptimized',
|
|
3876
|
+
interfaces: [Primitive]
|
|
3877
|
+
};
|
|
3878
|
+
var AppendOptimized_instance = null;
|
|
3879
|
+
function AppendOptimized_getInstance() {
|
|
3880
|
+
if (AppendOptimized_instance === null) {
|
|
3881
|
+
new AppendOptimized();
|
|
3882
|
+
}return AppendOptimized_instance;
|
|
3883
|
+
}
|
|
3884
|
+
function AssertAll() {
|
|
3885
|
+
AssertAll_instance = this;
|
|
3886
|
+
this.signature = new Signature('assert_all', 1);
|
|
3887
|
+
}
|
|
3888
|
+
function AssertAll$solve$lambda(closure$list, closure$request) {
|
|
3889
|
+
return function ($receiver) {
|
|
3890
|
+
var $receiver_0 = closure$list.toList();
|
|
3891
|
+
var tmp$;
|
|
3892
|
+
tmp$ = $receiver_0.iterator();
|
|
3893
|
+
while (tmp$.hasNext()) {
|
|
3894
|
+
var element = tmp$.next();
|
|
3895
|
+
first(closure$request.solve($receiver.stringInvoke('context_assert', element, [])));
|
|
3896
|
+
}
|
|
3897
|
+
return Unit;
|
|
3898
|
+
};
|
|
3899
|
+
}
|
|
3900
|
+
function Coroutine$AssertAll$solve$lambda(closure$request_0, $receiver_0, controller, continuation_0) {
|
|
3901
|
+
CoroutineImpl.call(this, continuation_0);
|
|
3902
|
+
this.$controller = controller;
|
|
3903
|
+
this.exceptionState_0 = 1;
|
|
3904
|
+
this.local$closure$request = closure$request_0;
|
|
3905
|
+
this.local$$receiver = $receiver_0;
|
|
3906
|
+
}
|
|
3907
|
+
Coroutine$AssertAll$solve$lambda.$metadata$ = {
|
|
3908
|
+
kind: Kotlin.Kind.CLASS,
|
|
3909
|
+
simpleName: null,
|
|
3910
|
+
interfaces: [CoroutineImpl]
|
|
3911
|
+
};
|
|
3912
|
+
Coroutine$AssertAll$solve$lambda.prototype = Object.create(CoroutineImpl.prototype);
|
|
3913
|
+
Coroutine$AssertAll$solve$lambda.prototype.constructor = Coroutine$AssertAll$solve$lambda;
|
|
3914
|
+
Coroutine$AssertAll$solve$lambda.prototype.doResume = function () {
|
|
3915
|
+
do
|
|
3916
|
+
try {
|
|
3917
|
+
switch (this.state_0) {
|
|
3918
|
+
case 0:
|
|
3919
|
+
this.state_0 = 2;
|
|
3920
|
+
this.result_0 = this.local$$receiver.yield_11rb$(this.local$closure$request.replyWithCondition(true, void 0, []), this);
|
|
3921
|
+
if (this.result_0 === COROUTINE_SUSPENDED)
|
|
3922
|
+
return COROUTINE_SUSPENDED;
|
|
3923
|
+
continue;
|
|
3924
|
+
case 1:
|
|
3925
|
+
throw this.exception_0;
|
|
3926
|
+
case 2:
|
|
3927
|
+
return this.result_0;
|
|
3928
|
+
default:this.state_0 = 1;
|
|
3929
|
+
throw new Error('State Machine Unreachable execution');
|
|
3930
|
+
}
|
|
3931
|
+
} catch (e) {
|
|
3932
|
+
if (this.state_0 === 1) {
|
|
3933
|
+
this.exceptionState_0 = this.state_0;
|
|
3934
|
+
throw e;
|
|
3935
|
+
} else {
|
|
3936
|
+
this.state_0 = this.exceptionState_0;
|
|
3937
|
+
this.exception_0 = e;
|
|
3938
|
+
}
|
|
3939
|
+
}
|
|
3940
|
+
while (true);
|
|
3941
|
+
};
|
|
3942
|
+
function AssertAll$solve$lambda_0(closure$request_0) {
|
|
3943
|
+
return function ($receiver_0, continuation_0, suspended) {
|
|
3944
|
+
var instance = new Coroutine$AssertAll$solve$lambda(closure$request_0, $receiver_0, this, continuation_0);
|
|
3945
|
+
if (suspended)
|
|
3946
|
+
return instance;
|
|
3947
|
+
else
|
|
3948
|
+
return instance.doResume(null);
|
|
3949
|
+
};
|
|
3950
|
+
}
|
|
3951
|
+
AssertAll.prototype.solve = function (request) {
|
|
3952
|
+
var list = request.arguments.get_za3lpa$(0);
|
|
3953
|
+
if (!Kotlin.isType(list, List)) {
|
|
3954
|
+
throw TypeError.Companion.forGoal(request.context, request.signature, TypeError$Expected.LIST, list);
|
|
3955
|
+
}arg2pScope(AssertAll$solve$lambda(list, request));
|
|
3956
|
+
return sequence(AssertAll$solve$lambda_0(request));
|
|
3957
|
+
};
|
|
3958
|
+
AssertAll.$metadata$ = {
|
|
3959
|
+
kind: Kind_OBJECT,
|
|
3960
|
+
simpleName: 'AssertAll',
|
|
3961
|
+
interfaces: [Primitive]
|
|
3962
|
+
};
|
|
3963
|
+
var AssertAll_instance = null;
|
|
3964
|
+
function AssertAll_getInstance() {
|
|
3965
|
+
if (AssertAll_instance === null) {
|
|
3966
|
+
new AssertAll();
|
|
3967
|
+
}return AssertAll_instance;
|
|
3968
|
+
}
|
|
3969
|
+
function ArgumentHash() {
|
|
3970
|
+
ArgumentHash_instance = this;
|
|
3971
|
+
BinaryRelation$WithoutSideEffects.call(this, 'hash');
|
|
3972
|
+
}
|
|
3973
|
+
ArgumentHash.prototype.computeAllSubstitutions_2j1e5m$ = function ($receiver, first, second) {
|
|
3974
|
+
return sequenceOf([Substitution.Companion.of(ensureNotNull(second.asVar()), Numeric.Companion.ofInteger(hashCode(first.toString())))]);
|
|
3975
|
+
};
|
|
3976
|
+
ArgumentHash.$metadata$ = {
|
|
3977
|
+
kind: Kind_OBJECT,
|
|
3978
|
+
simpleName: 'ArgumentHash',
|
|
3979
|
+
interfaces: [BinaryRelation$WithoutSideEffects]
|
|
3980
|
+
};
|
|
3981
|
+
var ArgumentHash_instance = null;
|
|
3982
|
+
function ArgumentHash_getInstance() {
|
|
3983
|
+
if (ArgumentHash_instance === null) {
|
|
3984
|
+
new ArgumentHash();
|
|
3985
|
+
}return ArgumentHash_instance;
|
|
3986
|
+
}
|
|
3657
3987
|
function MetaInterpreterLib() {
|
|
3658
3988
|
MetaInterpreterLib_instance = this;
|
|
3659
3989
|
this.$delegate_3wovwi$_0 = Library.Companion.aliased('prolog.argumentation.meta', void 0, parse_2(Theory.Companion, trimIndent('\n % with_facts_and_length/3\n with_facts_and_length(X, Y, L) :-\n solve(X, R),\n recover_facts(R, Y),\n length(Y, L).\n\n % lenght/2\n\n length([], 0).\n length([_|T], X) :- length(T, Y), X is Y + 1.\n\n % recover_facts/2\n\n recover_facts([], []) :- !.\n recover_facts([H|T], C) :-\n is_list(H), !,\n recover_facts(T, TC),\n recover_facts(H, HC),\n append(TC, HC, C).\n recover_facts([H|T], C) :-\n \\+ is_list(H),\n recover_facts(T, TC),\n evaluate(H, HC),\n append(TC, HC, C).\n\n evaluate(user_fact(X), [X]) :- !.\n evaluate(_, []) :- !.\n\n % solve/2\n\n solve((A,B), Result) :- !,\n solve(A, ARes),\n solve(B, BRes),\n append(ARes, BRes, Result).\n\n solve((A;B), Result) :- !,\n solve(A, Result);\n solve(B, Result).\n\n solve(member(A, B), [system_predicate]) :- !,\n call(member(A, B)).\n\n solve(\\+(A), [not(A)]) :- !,\n call(\\+(A)).\n\n solve((A)\\=(B), [doNotUnify(A, B)]) :- !,\n call((A)\\=(B)).\n\n solve(A, [system_predicate]) :-\n catch(clause(A, _), B, true),\n \\+ var(B), !,\n call(A).\n\n solve(A, [A]) :-\n \\+ clause(A, B), !,\n call(A).\n\n solve(A, [A|[Res]]) :-\n clause(A, B),\n solve(B, Res).\n\n % is_list/1\n\n is_list(X) :- var(X), !, fail.\n is_list([]).\n is_list([_|T]) :- is_list(T).\n \n % fetch_argument_facts/2\n \n fetch_argument_facts(Conclusion, Facts) :-\n argument([R, TR, [Conclusion]]),\n findall(user_fact(Fact), \n support([_, _, [user_fact(Fact)]], [R, TR, [Conclusion]]),\n Facts).\n ')));
|
|
@@ -3923,7 +4253,7 @@
|
|
|
3923
4253
|
}
|
|
3924
4254
|
});
|
|
3925
4255
|
Argument.prototype.termRepresentation = function () {
|
|
3926
|
-
return parse_1(Struct.Companion, '[' + this.rules + ', ' + this.topRule + ', ' + this.conclusion + ', ' + this.groundings + ', [' + this.lastDefeasibleRules + ', ' + this.defeasibleRules + ', ' + this.defeasiblePremises + ']]');
|
|
4256
|
+
return parse_1(Struct.Companion, '[' + this.rules + ', ' + this.topRule + ', [' + this.conclusion + '], ' + this.groundings + ', [' + this.lastDefeasibleRules + ', ' + this.defeasibleRules + ', ' + this.defeasiblePremises + ']]');
|
|
3927
4257
|
};
|
|
3928
4258
|
Argument.prototype.toString = function () {
|
|
3929
4259
|
return 'argument(' + this.termRepresentation() + ')';
|
|
@@ -3959,7 +4289,7 @@
|
|
|
3959
4289
|
return argument.get_za3lpa$(1).toString();
|
|
3960
4290
|
}
|
|
3961
4291
|
function Argument$Companion$of$argConclusion(argument) {
|
|
3962
|
-
return argument.get_za3lpa$(2).toString();
|
|
4292
|
+
return ensureNotNull(argument.get_za3lpa$(2).asList()).get(0).toString();
|
|
3963
4293
|
}
|
|
3964
4294
|
function Argument$Companion$of$argGroundings(closure$toStringList) {
|
|
3965
4295
|
return function (argument) {
|
|
@@ -4220,7 +4550,7 @@
|
|
|
4220
4550
|
}
|
|
4221
4551
|
});
|
|
4222
4552
|
Premise.prototype.toString = function () {
|
|
4223
|
-
return '
|
|
4553
|
+
return 'rl(' + this.conclusion + ') :- ([' + this.identifier + ', ' + this.conclusion + '])';
|
|
4224
4554
|
};
|
|
4225
4555
|
Premise.$metadata$ = {
|
|
4226
4556
|
kind: Kind_CLASS,
|
|
@@ -4268,7 +4598,7 @@
|
|
|
4268
4598
|
}
|
|
4269
4599
|
});
|
|
4270
4600
|
Rule.prototype.toString = function () {
|
|
4271
|
-
return '
|
|
4601
|
+
return 'rl(' + this.conclusion + ') :- [' + this.identifier + ', ' + this.premises + ', ' + this.conclusion + ']';
|
|
4272
4602
|
};
|
|
4273
4603
|
Rule.$metadata$ = {
|
|
4274
4604
|
kind: Kind_CLASS,
|
|
@@ -4607,6 +4937,27 @@
|
|
|
4607
4937
|
new GroundedLabeller();
|
|
4608
4938
|
}return GroundedLabeller_instance;
|
|
4609
4939
|
}
|
|
4940
|
+
function GroundedLabellerOptimized() {
|
|
4941
|
+
GroundedLabellerOptimized_instance = this;
|
|
4942
|
+
GroundedLabellerOptimizedBase.call(this);
|
|
4943
|
+
}
|
|
4944
|
+
Object.defineProperty(GroundedLabellerOptimized.prototype, 'prologRawTheory', {
|
|
4945
|
+
configurable: true,
|
|
4946
|
+
get: function () {
|
|
4947
|
+
return GroundedOptimized_getInstance().theoryCode;
|
|
4948
|
+
}
|
|
4949
|
+
});
|
|
4950
|
+
GroundedLabellerOptimized.$metadata$ = {
|
|
4951
|
+
kind: Kind_OBJECT,
|
|
4952
|
+
simpleName: 'GroundedLabellerOptimized',
|
|
4953
|
+
interfaces: [GroundedLabellerOptimizedBase]
|
|
4954
|
+
};
|
|
4955
|
+
var GroundedLabellerOptimized_instance = null;
|
|
4956
|
+
function GroundedLabellerOptimized_getInstance() {
|
|
4957
|
+
if (GroundedLabellerOptimized_instance === null) {
|
|
4958
|
+
new GroundedLabellerOptimized();
|
|
4959
|
+
}return GroundedLabellerOptimized_instance;
|
|
4960
|
+
}
|
|
4610
4961
|
function StatementLabeller() {
|
|
4611
4962
|
StatementLabeller_instance = this;
|
|
4612
4963
|
StatementLabellerBase.call(this);
|
|
@@ -4666,7 +5017,7 @@
|
|
|
4666
5017
|
}
|
|
4667
5018
|
function ArgumentationEngineInterface() {
|
|
4668
5019
|
ArgumentationEngineInterface_instance = this;
|
|
4669
|
-
this.theoryCode = trimIndent('\n argTuProlog.\n buildLabelSets([StatIn, StatOut, StatUnd], [ArgsIn, ArgsOut, ArgsUnd]) :-\n context_reset,\n parser:::convertAllRules(_),\n abstract::computeGlobalAcceptance(_, [ArgsIn, ArgsOut, ArgsUnd], [StatIn, StatOut, StatUnd]).\n buildLabelSets(StatIn, StatOut, StatUnd) :-\n buildLabelSets([StatIn, StatOut, StatUnd], _).\n buildLabelSets :-\n context_reset,\n parser:::convertAllRules(ArgRules),\n
|
|
5020
|
+
this.theoryCode = trimIndent('\n argTuProlog.\n buildLabelSets([StatIn, StatOut, StatUnd], [ArgsIn, ArgsOut, ArgsUnd]) :-\n context_reset,\n parser:::convertAllRules(_),\n abstract::computeGlobalAcceptance(_, [ArgsIn, ArgsOut, ArgsUnd], [StatIn, StatOut, StatUnd]).\n buildLabelSets(StatIn, StatOut, StatUnd) :-\n buildLabelSets([StatIn, StatOut, StatUnd], _).\n buildLabelSets :-\n context_reset,\n parser:::convertAllRules(ArgRules),\n abstract::computeGlobalAcceptance([Arguments, Attacks, Supports], [ArgsIn, ArgsOut, ArgsUnd], [StatIn, StatOut, StatUnd]),\n debug::printArgumentationGraph(Arguments, Attacks, Supports),\n debug::printArgumentLabelling([ArgsIn, ArgsOut, ArgsUnd]),\n debug::printStatementLabelling([StatIn, StatOut, StatUnd]).\n answerQuery(Goal, Yes, No, Und) :-\n context_reset,\n parser:::convertAllRules(_),\n structured:::computeStatementAcceptance(Goal, Yes, No, Und).\n answerQuery(Goal, Res) :-\n context_reset,\n parser:::convertAllRules(_),\n structured:::query(Goal, Res).\n buildLabelSetsSilent :-\n context_reset,\n parser:::convertAllRules(ArgRules),\n abstract::computeGlobalAcceptance.\n ');
|
|
4670
5021
|
}
|
|
4671
5022
|
ArgumentationEngineInterface.$metadata$ = {
|
|
4672
5023
|
kind: Kind_OBJECT,
|
|
@@ -4681,7 +5032,7 @@
|
|
|
4681
5032
|
}
|
|
4682
5033
|
function ArgumentationGraph() {
|
|
4683
5034
|
ArgumentationGraph_instance = this;
|
|
4684
|
-
this.theoryCode = trimIndent('\n buildArgumentationGraph :-\n buildArguments,\n buildAttacks.\n buildArguments :-\n \tbuildArgumentsFromPremises,\n \tbuildArgumentsFromEmptyRules,\n \tfindall([RuleID, RuleBody, RuleHead], (\n \t
|
|
5035
|
+
this.theoryCode = trimIndent('\n buildArgumentationGraph :-\n buildArguments,\n buildAttacks.\n buildArguments :-\n \tbuildArgumentsFromPremises,\n \tbuildArgumentsFromEmptyRules,\n \tfindall([RuleID, RuleBody, RuleHead], (\n \t parser::classic_rule(RuleID, RuleBody, RuleHead),\n \t \\+ emptyRule([RuleID, RuleBody, RuleHead])\n ), Rules),\n \tbuildArgumentsFromRules(b, Rules, Rules, n).\n buildArgumentsFromPremises :-\n findall(\n _,\n (\n parser::classic_rule(PremiseID, Premise),\n checkStrict(PremiseID, DefPrem),\n ground(Premise),\n context_assert(argument([[PremiseID], none, Premise, [], [[], [], DefPrem]])),\n context_assert(conc(Premise) :- argument([[PremiseID], none, Premise, [], [[], [], DefPrem]])),\n context_assert(newConc(a, Premise)),\n utils::hash(argument([[PremiseID], none, Premise, [], [[], [], DefPrem]]), Id),\n context_assert(arg(Id) :- argument([[PremiseID], none, Premise, [], [[], [], DefPrem]]))\n ),\n _\n ).\n buildArgumentsFromEmptyRules :-\n findall(\n _,\n (\n emptyRule([RuleID, RulePrem, RuleHead]),\n checkStrict(RuleID, DefRule),\n ground(RuleHead),\n context_assert(argument([[RuleID], RuleID, RuleHead, RulePrem, [DefRule, DefRule, []]])),\n context_assert(conc(Premise) :- argument([[RuleID], RuleID, RuleHead, RulePrem, [DefRule, DefRule, []]])),\n context_assert(newConc(a, Premise)),\n utils::hash(argument([[RuleID], RuleID, RuleHead, RulePrem, [DefRule, DefRule, []]]), Id),\n context_assert(arg(Id) :- argument([[RuleID], RuleID, RuleHead, RulePrem, [DefRule, DefRule, []]]))\n ),\n _\n ).\n emptyRule([RuleID, Body, RuleHead]) :-\n parser::classic_rule(RuleID, Body, RuleHead),\n \\+ (member(X, Body), X \\= ~(_), X \\= prolog(_)),\n checkPrologClauses(Body).\n checkPrologClauses([]) :- !.\n checkPrologClauses([~(_)|T]) :- checkPrologClauses(T), !.\n checkPrologClauses([prolog(Check)|T]) :-\n (callable(Check) -> call(Check); Check),\n checkPrologClauses(T).\n clean(Tn, Rules) :-\n invert(Tn, Tx),\n context_retract(newConc(Tx, _)),\n buildArgumentsFromRules(Tx, Rules, Rules, n).\n check_new(Tn, H) :-\n copy_term(H, [_, RuleBody, _]),\n member(prolog(_), RuleBody), !.\n check_new(Tn, H) :-\n copy_term(H, [_, RuleBody, _]),\n member(X, RuleBody),\n invert(Tn, Tx),\n context_check(newConc(Tx, [X])).\n invert(a, b).\n invert(b, a).\n buildArgumentsFromRules(_, Rules, [], n).\n buildArgumentsFromRules(Tn, Rules, [], y) :- clean(Tn, Rules).\n buildArgumentsFromRules(Tn, Rules, [H|T], _) :-\n once(check_new(Tn, H)),\n copy_term(H, HH),\n findall(true, buildArgumentsFromRule(Tn, HH), R),\n R \\== [],\n buildArgumentsFromRules(Tn, Rules, T, y), !.\n buildArgumentsFromRules(Tn, Rules, [_|T], X) :-\n buildArgumentsFromRules(Tn, Rules, T, X).\n buildArgumentsFromRule(Tn, [RuleID, RuleBody, RuleHead]) :-\n \truleBodyIsSupported(RuleBody, [], [], SupportRules, ArgSupports),\n \t\\+ member(RuleID, SupportRules),\n \tground(RuleHead),\n \tutils::sort([RuleID|SupportRules], SortedPremises),\n \t\\+ context_check(argument([SortedPremises, RuleID, RuleHead, RuleBody, _])),\n \tbuildArgumentInfo(ArgSupports, RuleID, Info),\n NewArgument = [SortedPremises, RuleID, RuleHead, RuleBody, Info],\n context_assert(conc(RuleHead) :- argument(NewArgument)),\n context_assert(newConc(Tn, RuleHead)),\n \tcontext_assert(argument(NewArgument)),\n \tutils::hash(argument(NewArgument), Id),\n \tcontext_assert(arg(Id) :- argument(NewArgument)),\n \tsupports(NewArgument, ArgSupports).\n supports(Argument, Supports) :-\n findall(_, (\n member(S, Supports),\n context_assert(support(S, Argument))\n ), _).\n checkStrict(Id, [Id]) :- \\+ parser::check_strict(Id).\n checkStrict(Id, []) :- parser::check_strict(Id).\n buildArgumentInfo(Supports, RuleId, [LastDefRules, DefRules, DefPrem]) :-\n defeasibleRules(RuleId, Supports, DefRules),\n ordinaryPremises(Supports, DefPrem),\n lastDefeasibleRules(Supports, RuleId, LastDefRules).\n ordinaryPremises(Supports, DefPrem) :-\n findall(Def, member([_, _, _, _, [_, _, Def]], Supports), Prem),\n utils::appendLists(Prem, TempPrem),\n utils::sortDistinct(TempPrem, DefPrem).\n defeasibleRules(RuleId, Supports, DefRules) :-\n \tfindall(Def, member([_, _, _, _, [_, Def, _]], Supports), UnsortedRules),\n \tcheckStrict(RuleId, DefRule),\n \tutils::appendLists([DefRule|UnsortedRules], TempRules),\n \tutils::sortDistinct(TempRules, DefRules).\n lastDefeasibleRules(_, TopRule, [TopRule]) :-\n TopRule \\== none, \\+ parser::check_strict(TopRule).\n lastDefeasibleRules(Supports, TopRule, LastRules) :-\n \tparser::check_strict(TopRule),\n \tfindall(Def, member([_, _, _, _, [Def, _, _]], Supports), Res),\n \tutils::appendLists(Res, TempLastRules),\n \tutils::sortDistinct(TempLastRules, LastRules).\n ruleBodyIsSupported([], ResultPremises, ResultSupports, ResultPremises, ResultSupports).\n ruleBodyIsSupported([~(_)|Others], Premises, Supports, ResultPremises, ResultSupports) :-\n \truleBodyIsSupported(Others, Premises, Supports, ResultPremises, ResultSupports), !.\n ruleBodyIsSupported([prolog(Check)|Others], Premises, Supports, ResultPremises, ResultSupports) :-\n \t(callable(Check) -> call(Check); Check),\n \truleBodyIsSupported(Others, Premises, Supports, ResultPremises, ResultSupports), !.\n ruleBodyIsSupported([Statement|Others], Premises, Supports, ResultPremises, ResultSupports) :-\n context_check(clause(conc([Statement]), argument([ArgumentID, RuleID, [Statement], Body, Info]))),\n \tappend(ArgumentID, Premises, NewPremises),\n \truleBodyIsSupported(Others, NewPremises, [[ArgumentID, RuleID, [Statement], Body, Info]|Supports], ResultPremises, ResultSupports).\n findPossibleAttackers([_, _, Head, _, _], Conf) :-\n conflict(Conf, Head, Guard).\n findPossibleAttackers([_, _, Head, _, _], Conf) :-\n conflict(Conf, Head).\n findPossibleAttackers([_, _, _, Prem, _], [Conf]) :-\n member(~(Conf), Prem).\n findPossibleAttackers([_, RuleID, _, _, _], [undercut(RuleID)]).\n buildAttacks :-\n \tbuildDirectAttacks,\n \tbuildTransitiveAttacks.\n buildDirectAttacks :-\n findall(_, buildDirectAttack, _).\n buildDirectAttack :-\n context_check(argument(A)),\n findPossibleAttackers(A, BB),\n \tcontext_check(clause(conc(BB), argument(B))),\n \tA \\== B,\n attacks(T, B, A),\n \t\\+ context_check(attack(T, B, A, A)),\n \tcontext_assert(attack(T, B, A, A)),\n \tutils::hash(argument(A), IdA),\n \tutils::hash(argument(B), IdB),\n \tcontext_assert(att(IdB, IdA) :- attack(T, B, A, A)),\n \tfail.\n buildDirectAttack.\n buildTransitiveAttacks :-\n \tcontext_check(attack(T, A, B, D)),\n \tcontext_check(support(B, C)),\n \t\\+ context_check(attack(T, A, C, D)), !,\n \tcontext_assert(attack(T, A, C, D)),\n utils::hash(argument(A), IdA),\n utils::hash(argument(C), IdC),\n context_assert(att(IdA, IdC) :- attack(T, B, C, D)),\n buildTransitiveAttacks.\n buildTransitiveAttacks.\n attacks(rebut, A, B) :- rebuts(A, B), !.\n attacks(contrary_rebut, A, B) :- contraryRebuts(A, B), !.\n attacks(undermine, A, B) :- undermines(A, B), !.\n attacks(contrary_undermine, A, B) :- contraryUndermines(A, B), !.\n attacks(undercut, A, B) :- undercuts(A, B), !.\n expanded_conflict(HeadA, HeadB) :-\n conflict(HeadA, HeadB).\n expanded_conflict(HeadA, HeadB) :-\n conflict(HeadA, HeadB, Guard),\n (callable(Guard) -> call(Guard); Guard).\n rebuts([IDPremisesA, RuleA, RuleHeadA, _, _], [IDPremisesB, RuleB, RuleHeadB, _, Info]) :-\n \tRuleB \\== none,\n Info \\== [[], [], []],\n \texpanded_conflict(RuleHeadA, RuleHeadB).\n contraryRebuts([IDPremisesA, RuleA, [RuleHeadA], _, _], [IDPremisesB, RuleB, RuleHeadB, Body, Info]) :-\n \tRuleA \\== none,\n \tRuleB \\== none,\n \tmember(~(RuleHeadA), Body).\n undermines([IDPremisesA, RuleA, RuleHeadA, _, _], [[IDPremiseB], none, RuleHeadB, _, Info]) :-\n \tInfo \\== [[], [], []],\n \texpanded_conflict(RuleHeadA, RuleHeadB).\n contraryUndermines([IDPremisesA, none, [RuleHeadA], _, _], [IDPremisesB, RuleB, RuleHeadB, Body, Info]) :-\n \tRuleB \\== none,\n \tmember(~(RuleHeadA), Body).\n undercuts([_, _, [undercut(RuleB)], _, _], [_, RuleB, _, _, [[RuleB], _, _]]).\n check(-Atom).\n conflict([Atom], [-Atom]) :- \\+ check(Atom).\n conflict([-Atom], [Atom]).\n conflict([o(Atom)], [o(-Atom)]) :- \\+ check(Atom).\n conflict([o(-Atom)], [o(Atom)]).\n conflict([p(Atom)], [o(-Atom)]) :- \\+ check(Atom).\n conflict([o(-Atom)], [p(Atom)]).\n conflict([p(-Atom)], [o(Atom)]).\n conflict([o(Atom)], [p(-Atom)]) :- \\+ check(Atom).\n conflict([sup(X, Y)], [sup(Y, X)]).\n ');
|
|
4685
5036
|
}
|
|
4686
5037
|
ArgumentationGraph.$metadata$ = {
|
|
4687
5038
|
kind: Kind_OBJECT,
|
|
@@ -4726,7 +5077,7 @@
|
|
|
4726
5077
|
}
|
|
4727
5078
|
function BpGrounded() {
|
|
4728
5079
|
BpGrounded_instance = this;
|
|
4729
|
-
this.theoryCode = trimIndent('\n argumentLabelling :-\n reifyBurdenOfProofs,\n filterBpDefeats,\n findall(X, context_check(argument(X)), Arguments),\n bpLabelling(Arguments).\n bpLabelling(Arguments) :-\n member(A, Arguments),\n grounded::allAttacksOUT(A), !,\n context_assert(in(A)),\n utils::subtract(Arguments, [A], NewArguments),\n bpLabelling(NewArguments).\n bpLabelling(Arguments) :-\n member(A, Arguments),\n \\+ isArgumentInBurdenOfProof(A),\n grounded::oneAttackIN(A), !,\n context_assert(out(A)),\n utils::subtract(Arguments, [A], NewArguments),\n bpLabelling(NewArguments).\n bpLabelling(Arguments) :-\n context_active(Branch),\n mostGroundedBpUnd(Arguments, A),\n context_branch(Branch, _),\n context_assert(out(A)),\n utils::subtract(Arguments, [A], NewArguments),\n bpLabelling(NewArguments).\n bpLabelling(Args) :-\n notLabelled(Args),\n findall(_, (member(A, Args), context_assert(und(A))), _).\n notLabelled(Args) :-\n \\+ (\n member(A, Args),\n (\n context_check(in(A));\n context_check(out(A));\n context_check(und(A))\n )\n ).\n isInBurdenOfProof(Conclusion) :-\n context_check(reifiedBp(Literals)),\n member(Conclusion, Literals), !.\n isArgumentInBurdenOfProof([_, _, Conclusion, _, _]) :-\n isInBurdenOfProof(Conclusion).\n filterBpDefeats :-\n findall(_, (\n context_check(attack(T, A, B, C)),\n filterBpDefeat(T, A, B, C)\n ), _).\n filterBpDefeat(T, B, A, C) :-\n (T = rebut; T = undermine),\n isArgumentInBurdenOfProof(B),\n \\+ superiority::superiorArgument(B, C),\n context_retract(attack(T, B, A, C)).\n mostGroundedBpUnd(Arguments, Arg) :-\n member(Arg, Arguments),\n isArgumentInBurdenOfProof(Arg),\n \\+ (\n member(A, Arguments), Arg \\= A,\n isArgumentInBurdenOfProof(A),\n argumentChain(A, Arg)\n ).\n argumentChain(A, A) :- !.\n argumentChain(A, B) :-\n A \\== B,\n context_check(attack(_, A, C, _)),\n argumentChain(C, B).\n reifyBurdenOfProofs :-\n findall(_, (\n context_check(abstractBp(AbstractBp)),\n fillTemplate(AbstractBp, R),\n \\+ context_check(reifiedBp(R)),\n context_assert(reifiedBp(R))\n ), _).\n /*\n Fill the template (first parameter) using arguments conclusions\n */\n fillTemplate([], []).\n fillTemplate([H|T], [H|R]) :-\n context_check(argument([_, _,
|
|
5080
|
+
this.theoryCode = trimIndent('\n argumentLabelling :-\n reifyBurdenOfProofs,\n filterBpDefeats,\n findall(X, context_check(argument(X)), Arguments),\n bpLabelling(Arguments).\n bpLabelling(Arguments) :-\n member(A, Arguments),\n grounded::allAttacksOUT(A), !,\n context_assert(in(A)),\n utils::subtract(Arguments, [A], NewArguments),\n bpLabelling(NewArguments).\n bpLabelling(Arguments) :-\n member(A, Arguments),\n \\+ isArgumentInBurdenOfProof(A),\n grounded::oneAttackIN(A), !,\n context_assert(out(A)),\n utils::subtract(Arguments, [A], NewArguments),\n bpLabelling(NewArguments).\n bpLabelling(Arguments) :-\n context_active(Branch),\n mostGroundedBpUnd(Arguments, A),\n context_branch(Branch, _),\n context_assert(out(A)),\n utils::subtract(Arguments, [A], NewArguments),\n bpLabelling(NewArguments).\n bpLabelling(Args) :-\n notLabelled(Args),\n findall(_, (member(A, Args), context_assert(und(A))), _).\n notLabelled(Args) :-\n \\+ (\n member(A, Args),\n (\n context_check(in(A));\n context_check(out(A));\n context_check(und(A))\n )\n ).\n isInBurdenOfProof(Conclusion) :-\n context_check(reifiedBp(Literals)),\n member(Conclusion, Literals), !.\n isArgumentInBurdenOfProof([_, _, Conclusion, _, _]) :-\n isInBurdenOfProof(Conclusion).\n filterBpDefeats :-\n findall(_, (\n context_check(attack(T, A, B, C)),\n filterBpDefeat(T, A, B, C)\n ), _).\n filterBpDefeat(T, B, A, C) :-\n (T = rebut; T = undermine),\n isArgumentInBurdenOfProof(B),\n \\+ superiority::superiorArgument(B, C),\n context_retract(attack(T, B, A, C)).\n mostGroundedBpUnd(Arguments, Arg) :-\n member(Arg, Arguments),\n isArgumentInBurdenOfProof(Arg),\n \\+ (\n member(A, Arguments), Arg \\= A,\n isArgumentInBurdenOfProof(A),\n argumentChain(A, Arg)\n ).\n argumentChain(A, A) :- !.\n argumentChain(A, B) :-\n A \\== B,\n context_check(attack(_, A, C, _)),\n argumentChain(C, B).\n reifyBurdenOfProofs :-\n findall(_, (\n context_check(abstractBp(AbstractBp)),\n fillTemplate(AbstractBp, R),\n \\+ context_check(reifiedBp(R)),\n context_assert(reifiedBp(R))\n ), _).\n /*\n Fill the template (first parameter) using arguments conclusions\n */\n fillTemplate([], []).\n fillTemplate([H|T], [[H]|R]) :-\n context_check(argument([_ , _, [P], _, _])),\n fillTemplate(T, R).\n ');
|
|
4730
5081
|
}
|
|
4731
5082
|
BpGrounded.$metadata$ = {
|
|
4732
5083
|
kind: Kind_OBJECT,
|
|
@@ -4831,7 +5182,7 @@
|
|
|
4831
5182
|
}
|
|
4832
5183
|
function Grounded() {
|
|
4833
5184
|
Grounded_instance = this;
|
|
4834
|
-
this.theoryCode = trimIndent('\n argumentLabelling :-\n findall(X, context_check(argument(X)), Arguments),\n groundedLabelling(Arguments).\n groundedLabelling(UND) :-\n member(A, UND)
|
|
5185
|
+
this.theoryCode = trimIndent('\n argumentLabelling :-\n findall(X, context_check(argument(X)), Arguments),\n groundedLabelling(Arguments).\n groundedLabelling(UND) :-\n member(A, UND),\n allAttacksOUT(A), !,\n utils::subtract(UND, [A], NewUND),\n context_assert(in(A)),\n groundedLabelling(NewUND).\n groundedLabelling(UND) :-\n member(A, UND),\n oneAttackIN(A), !,\n utils::subtract(UND, [A], NewUND),\n context_assert(out(A)),\n groundedLabelling(NewUND).\n groundedLabelling(Args) :- findall(_, (member(A, Args), context_assert(und(A))), _).\n allAttacksOUT(A) :-\n \\+ ( context_check(attack(_, B, A, _)), \\+ (context_check(out(B)))).\n oneAttackIN(A) :-\n context_check(attack(_, B, A, _)),\n context_check(in(B)), !.\n oneAttackIN(A) :-\n context_check(attack(_, A, B, _)),\n context_check(in(B)), !.\n ');
|
|
4835
5186
|
}
|
|
4836
5187
|
Grounded.$metadata$ = {
|
|
4837
5188
|
kind: Kind_OBJECT,
|
|
@@ -4844,9 +5195,24 @@
|
|
|
4844
5195
|
new Grounded();
|
|
4845
5196
|
}return Grounded_instance;
|
|
4846
5197
|
}
|
|
5198
|
+
function GroundedOptimized() {
|
|
5199
|
+
GroundedOptimized_instance = this;
|
|
5200
|
+
this.theoryCode = trimIndent('\n argumentLabelling :-\n groundedLabelling.\n groundedLabelling :-\n findall(t, evaluateIn, I),\n findall(t, evaluateOut, O),\n finalize(I, O).\n evaluateIn :-\n argument_to_evaluate(A, IdA),\n allAttacksOUT(IdA),\n context_assert(in(A)),\n context_assert(inId(IdA)).\n evaluateOut :-\n argument_to_evaluate(A, IdA),\n oneAttackIN(IdA),\n context_assert(out(A)),\n context_assert(outId(IdA)).\n finalize(I, O) :- I \\= [], !, groundedLabelling.\n finalize(I, O) :- O \\= [], !, groundedLabelling.\n finalize([], []) :-\n argument_to_evaluate(A, _),\n context_assert(und(A)),\n fail.\n finalize(_, _).\n argument_to_evaluate(X, IdX) :-\n context_check(clause(arg(IdX), argument(X))),\n \\+ context_check(outId(IdX)),\n \\+ context_check(inId(IdX)).\n allAttacksOUT(A) :-\n \\+ ( context_check(clause(att(B, A), _)), \\+ (context_check(outId(B)))).\n oneAttackIN(A) :-\n context_check(clause(att(B, A), _)),\n context_check(inId(B)), !.\n oneAttackIN(A) :-\n context_check(clause(att(A, B), _)),\n context_check(inId(B)), !.\n ');
|
|
5201
|
+
}
|
|
5202
|
+
GroundedOptimized.$metadata$ = {
|
|
5203
|
+
kind: Kind_OBJECT,
|
|
5204
|
+
simpleName: 'GroundedOptimized',
|
|
5205
|
+
interfaces: []
|
|
5206
|
+
};
|
|
5207
|
+
var GroundedOptimized_instance = null;
|
|
5208
|
+
function GroundedOptimized_getInstance() {
|
|
5209
|
+
if (GroundedOptimized_instance === null) {
|
|
5210
|
+
new GroundedOptimized();
|
|
5211
|
+
}return GroundedOptimized_instance;
|
|
5212
|
+
}
|
|
4847
5213
|
function Preferences() {
|
|
4848
5214
|
Preferences_instance = this;
|
|
4849
|
-
this.theoryCode = trimIndent('\n modifyArgumentationGraph :-\n findall(_, (\n context_check(attack(T, A, B, C)),\n checkStandardPreference(T, A, B, C)\n ), _).\n checkStandardPreference(T, A, B, C) :-\n \\+ standardPreferences(T, A, B, C),\n context_retract(attack(T, A, B, C)).\n standardPreferences(rebut, A, _, C) :- \\+ superiority::superiorArgument(C, A).\n standardPreferences(undermine, A, _, C) :- \\+ superiority::superiorArgument(C, A).\n standardPreferences(contrary_rebut, _, _, _).\n standardPreferences(contrary_undermine, _, _, _).\n standardPreferences(undercut, _, _, _).\n ');
|
|
5215
|
+
this.theoryCode = trimIndent('\n modifyArgumentationGraph :-\n findall(_, (\n context_check(attack(T, A, B, C)),\n checkStandardPreference(T, A, B, C)\n ), _).\n checkStandardPreference(T, A, B, C) :-\n \\+ standardPreferences(T, A, B, C),\n context_retract(attack(T, A, B, C)),\n hashed_attack(attack(T, A, B, C), Y),\n context_retract(Y).\n standardPreferences(rebut, A, _, C) :- \\+ superiority::superiorArgument(C, A).\n standardPreferences(undermine, A, _, C) :- \\+ superiority::superiorArgument(C, A).\n standardPreferences(contrary_rebut, _, _, _).\n standardPreferences(contrary_undermine, _, _, _).\n standardPreferences(undercut, _, _, _).\n hashed_attack(attack(T, A, B, C), att(IdA, IdB) :- attack(T, A, B, C)) :-\n utils::hash(argument(A), IdA),\n utils::hash(argument(B), IdB).\n ');
|
|
4850
5216
|
}
|
|
4851
5217
|
Preferences.$metadata$ = {
|
|
4852
5218
|
kind: Kind_OBJECT,
|
|
@@ -4861,7 +5227,7 @@
|
|
|
4861
5227
|
}
|
|
4862
5228
|
function QueryMode_0() {
|
|
4863
5229
|
QueryMode_instance_0 = this;
|
|
4864
|
-
this.theoryCode = trimIndent('\n computeStatementAcceptance(Goal, YesResult, NoResult, UndResult) :-\n \\+ queryMode,\n abstract:::computeGlobalAcceptance,\n mineResults(Goal, YesResult, NoResult, UndResult).\n computeStatementAcceptance(Goal, YesResult, NoResult, UndResult) :-\n queryMode,\n argumentLabellingMode(grounded),\n
|
|
5230
|
+
this.theoryCode = trimIndent('\n computeStatementAcceptance(Goal, YesResult, NoResult, UndResult) :-\n \\+ queryMode,\n abstract:::computeGlobalAcceptance,\n mineResults(Goal, YesResult, NoResult, UndResult).\n computeStatementAcceptance(Goal, YesResult, NoResult, UndResult) :-\n queryMode,\n argumentLabellingMode(grounded),\n findall(_, query(Goal, _), _),\n (ambiguityBlocking ->\n statement_binary:::statementLabelling;\n statementLabellingMode(Y),\n Y:::statementLabelling\n ),\n mineResults(Goal, YesResult, NoResult, UndResult).\n mineResults(Goal, YesResult, NoResult, UndResult) :-\n findall(Goal, context_check(statIn([Goal])), In),\n findall(Goal, context_check(statOut([Goal])), Out),\n findall(Goal, context_check(statUnd([Goal])), Und),\n utils::sort(In, YesResult),\n utils::sort(Out, NoResult),\n utils::sort(Und, UndResult).\n query(Query, Res) :-\n buildArgument(Query, Argument),\n once(defend(Argument, [], Res)).\n query(Query, und) :- \\+ buildArgument(Query, _).\n defend(Argument, _, no) :- context_check(out(Argument)).\n defend(Argument, _, und) :- context_check(und(Argument)).\n defend(Argument, _, yes) :- context_check(in(Argument)).\n defend(Argument, QueryChain, no) :-\n findAttacker(Argument, QueryChain, Attacker, yes),\n once(defend(Attacker, [Argument|QueryChain], X)),\n X == yes,\n bufferResult(Argument, no), !.\n defend(Argument, QueryChain, Res) :-\n findAttacker(Argument, QueryChain, Attacker, yes),\n once(defend(Attacker, [Argument|QueryChain], X)),\n X == und,\n ambiguityCheck(Argument, Attacker, Res),\n bufferResult(Argument, Res), !.\n complementary([_, _, ConclusionA, _, _], [_, _, ConclusionB, _, _]) :-\n standard_af::conflict(ConclusionA, ConclusionB).\n ambiguityCheck(A, B, no) :- ambiguityBlocking,\n \\+ complementary(A, B),\n context_check(attack(direct, B, A, _)), !.\n ambiguityCheck(_, _, und).\n defend(Argument, QueryChain, und) :-\n findAttacker(Argument, QueryChain, Attacker, no),\n bufferResult(Argument, und), !.\n defend(Argument, QueryChain, yes) :- bufferResult(Argument, yes).\n bufferResult(Argument, no) :- \\+ context_check(out(Argument)), context_assert(out(Argument)), !.\n bufferResult(Argument, yes) :- \\+ context_check(in(Argument)), context_assert(in(Argument)), !.\n bufferResult(Argument, und) :- \\+ context_check(und(Argument)), context_assert(und(Argument)), !.\n bufferResult(_, _).\n findAttacker(Target, QueryChain, Attacker, IsValid) :-\n attacker(Target, Attacker, Type),\n bufferAttacker(Attacker, Target, Type),\n detectCycle(Attacker, QueryChain, IsValid).\n bufferAttacker(Attacker, Target, Type) :-\n \\+ context_check(attack(Type, Attacker, Target, none)),\n context_assert(attack(Type, Attacker, Target, none)), !.\n bufferAttacker(_, _, _).\n detectCycle(Attacker, QueryChain, yes) :- \\+ member(Attacker, QueryChain).\n detectCycle(Attacker, QueryChain, no) :- member(Attacker, QueryChain).\n attacker([Rules, TopRule, Conclusion, Groundings, ArgInfo], Argument, Type) :-\n member(X, Rules),\n \\+ parser::strict(X),\n attackerOnRule(X, [Rules, TopRule, Conclusion, Groundings, ArgInfo], Argument, Type).\n attacker([Rules, TopRule, Conclusion, Groundings, ArgInfo], Argument, Type) :-\n member(X, Groundings),\n attackerOnTerm(X, [Rules, TopRule, Conclusion, Groundings, ArgInfo], Argument, Type).\n attackerOnRule(Rule, _, Argument, undercut) :-\n parser::undercut(Undercut, Rule),\n buildArgument(Undercut, Argument).\n attackerOnTerm(Term, [TargetRules, TopRule, Conclusion, Groundings, ArgInfo], Attacker, direct) :-\n \\+ parser::contrary(Term, _),\n \\+ strict([TargetRules, TopRule, Conclusion, Groundings, ArgInfo]),\n (graphExtension(rebutRestriction) ->\n (\n getSubArgument(Term, TargetRules, SubArgument),\n rebutRestriction(SubArgument)\n );\n true\n ),\n standard_af::conflict(Term, [X]),\n buildArgument(X, Attacker),\n (graphExtension(standardPref) ->\n (\n once(getSubArgument(Term, TargetRules, SubArgument)),\n \\+ superiorArgument(SubArgument, Attacker)\n );\n true\n ).\n attackerOnTerm(Unless, _, Attacker, contrary) :-\n parser::contrary(Unless, X),\n buildArgument(X, Attacker).\n strict([_, _, _, _, [_, [], []]]).\n rebutRestriction([TargetRules, none, Conclusion, Groundings, ArgInfo]) :-\n graphExtension(rebutRestriction).\n rebutRestriction([TargetRules, TopRule, Conclusion, Groundings, ArgInfo]) :-\n graphExtension(rebutRestriction),\n TopRule \\= none,\n rebutRestriction::restrict([TargetRules, TopRule, Conclusion, Groundings, ArgInfo]).\n rebutRestriction(_) :- \\+ graphExtension(rebutRestriction).\n superiorArgument(SubArgument, Attacker) :-\n superiority::superiorArgument(SubArgument, Attacker).\n getSubArgument(Term, Rules, [SubRules, SubTopRule, SubConclusion, SubGrounds, Info]) :-\n context_check(clause(support(Term), argument([SubRules, SubTopRule, SubConclusion, SubGrounds, Info]))),\n contained(SubRules, Rules).\n contained([], _).\n contained([H|T], Target) :- member(H, Target), contained(T, Target).\n buildArgument(Query, Argument) :-\n \\+ context_check(explored(Query)),\n findall(_, (\n buildSingleArgument([Query], Argument),\n context_assert(argument(Argument))\n ), _),\n context_assert(explored(Query)),\n fail.\n buildArgument(Query, [R, T, [Query], B, I]) :- context_check(argument([R, T, [Query], B, I])).\n buildSingleArgument(Query, Argument) :-\n build(Query, [], Groundings, [AllRules, TopRule, LastDefRules, DefRules, DefPremises]),\n utils::deduplicate(DefRules, CDefRules),\n utils::deduplicate(DefPremises, CDefPremises),\n utils::deduplicate(Groundings, CGroundings),\n Argument = [AllRules, TopRule, Query, CGroundings, [LastDefRules, CDefRules, CDefPremises]].\n build(Check, _, [], []) :- parser::prolog(Check, Term), (callable(Term) -> call(Term); Term), !.\n build(Unless, _, [Unless], []) :- parser::contrary(Unless, _), !.\n build(Conclusion, _, [Conclusion], [AllRules, TopRule, LastDefRules, DefRules, DefPremises]) :-\n parser::premise(Id, Conclusion),\n premiseRules(Id, [AllRules, TopRule, LastDefRules, DefRules, DefPremises]),\n context_assert(support(Conclusion) :- argument([AllRules, TopRule, Conclusion, [Conclusion], [LastDefRules, DefRules, DefPremises]])).\n build(Conclusion, Ids, [Conclusion|Conclusions], [AllRules, TopRule, LastDefRules, DefRules, DefPremises]) :-\n parser::rule(Id, Premises, Conclusion),\n \\+ member(Id, Ids),\n buildPremises(Premises, [Id|Ids], Conclusions, ResRules),\n ruleRules(Id, ResRules, [AllRules, TopRule, LastDefRules, DefRules, DefPremises]),\n context_assert(support(Conclusion) :- argument([AllRules, TopRule, Conclusion, [Conclusion|Conclusions], [LastDefRules, DefRules, DefPremises]])).\n buildPremises([], _, [], [[], [], [], []]).\n buildPremises([H|T], Ids, Conclusions, Rules) :-\n build([H], Ids, HConclusions, HRules),\n buildPremises(T, Ids, TConclusions, TRules),\n utils::appendLists([HConclusions, TConclusions], Conclusions),\n mergeRules(HRules, TRules, Rules).\n premiseRules(Id, [[Id], none, [], [], [Id]]) :- \\+ parser::check_strict(Id), !.\n premiseRules(Id, [[Id], none, [], [], []]) :- parser::check_strict(Id).\n ruleRules(Id, [AllRules, _, DefRules, DefPremises],\n [[Id|AllRules], Id, [Id], [Id|DefRules], DefPremises]) :- \\+ parser::check_strict(Id), !.\n ruleRules(Id, [AllRules, LastDefRules, DefRules, DefPremises],\n [[Id|AllRules], Id, LastDefRules, DefRules, DefPremises]) :- parser::check_strict(Id).\n mergeRules([], [AllRules, LastDefRules, DefRules, DefPremises], [AllRules, LastDefRules, DefRules, DefPremises]) :- !.\n mergeRules([HAR, _, HLDR, HDR, HDP], [TAR, TLDR, TDR, TDP], [AR, LDR, DR, DP]) :-\n utils::appendLists([HAR, TAR], AR),\n utils::appendLists([HLDR, TLDR], LDR),\n utils::appendLists([HDR, TDR], DR),\n utils::appendLists([HDP, TDP], DP).\n ');
|
|
4865
5231
|
}
|
|
4866
5232
|
QueryMode_0.$metadata$ = {
|
|
4867
5233
|
kind: Kind_OBJECT,
|
|
@@ -4876,7 +5242,7 @@
|
|
|
4876
5242
|
}
|
|
4877
5243
|
function RuleTranslator() {
|
|
4878
5244
|
RuleTranslator_instance = this;
|
|
4879
|
-
this.theoryCode = trimIndent("\n /*\n * Main directive. Find all the rules in the theory in the format (Name : Preconditions => Conclusion)\n * or (Name : Effects) and then if:\n * - It is a standard rule, translate it in the standard format (rule([Name, Preconditions, Conclusions]));\n * - It is a bp rule, translate it to (abstractBp([Effects]))\n * During the process, clean them from the unallowed symbols (-, o, p).\n */\n convertAllRules(ArgRules) :-\n defeasibleRules(DefeasibleRules),\n strictRules(StrictRules, RulesIds),\n ordinaryPremises(Premises),\n axiomPremises(Axioms, AxiomsIds),\n specialRules(SpecialRules),\n utils::appendLists([DefeasibleRules, StrictRules, Premises, Axioms, SpecialRules], L),\n convertAllRules(L, Rules),\n findall(sup(X, Y), sup(X, Y), Sups),\n utils::appendLists([Rules, AxiomsIds, RulesIds, Sups], ArgRules),\n findall(_, (member(X, ArgRules), context_assert(X)), _), !.\n defeasibleRules(DefeasibleRules) :-\n findall([RuleName, Preconditions, Effect], (RuleName : Preconditions => Effect), DefeasibleRulesOld),\n prologDefeasibleRules(DefeasibleRulesNew),\n append(DefeasibleRulesOld, DefeasibleRulesNew, DefeasibleRules).\n strictRules(CtrRules, Ids) :-\n findall([RuleName, Preconditions, Effect], (RuleName : Preconditions -> Effect), StrictRulesOld),\n prologStrictRules(StrictRulesNew),\n append(StrictRulesOld, StrictRulesNew, StrictRules),\n transpose(StrictRules, StrictRules, CtrRules),\n findall(strict(RN), member([RN, _, _], CtrRules), Ids).\n ordinaryPremises(Premises) :-\n findall([RuleName, Effect], ((RuleName :=> Effect), atom(RuleName)), PremisesOld),\n prologPremises(PremisesNew),\n append(PremisesOld, PremisesNew, Premises).\n axiomPremises(Axioms, Ids) :-\n findall([RuleName, Effect], ((RuleName :-> Effect), atom(RuleName)), AxiomsOld),\n prologAxioms(AxiomsNew),\n append(AxiomsOld, AxiomsNew, Axioms),\n findall(strict(RN), member([RN, _], Axioms), Ids).\n specialRules(SpecialRules) :-\n bpsNew(SpecialRules).\n transpose(_, CtrRules, CtrRules) :- \\+ autoTransposition, !.\n transpose([], CtrRules, CtrRules).\n transpose([H|T], TempCtrRules, CtrRules) :-\n transpose(T, TempCtrRules, CR),\n findall(TrH, transposition(H, TrH), Tran),\n mergeCtrRules(CR, Tran, CtrRules).\n mergeCtrRules(All, ToMerge, X) :-\n append(All, ToMerge, XT),\n deduplicate(XT, X).\n deduplicate([], []).\n deduplicate([[RN,A,B]|T], X) :- deduplicate(T, TT), (member([RN,_,_], TT) -> X = TT; X = [[RN,A,B]|TT]). \n transposition([Id, Prec, Effect], [Id, Prec, Effect]).\n transposition([Id, Prec, Effect], [NewId, NewPrec ,XNegated]) :-\n compound(Prec),\n tuple_to_list(Prec, LPrec),!,\n transposition_sequential(LPrec, LPrec, Effect, Id, [], NewPrec, XNegated, NewId).\n transposition([Id, Prec, Effect], [NewId, EffectNegated ,XNegated]) :-\n \\+ compound(Prec),\n Prec \\== [],\n prologEscape(Prec),\n negate(Prec, XNegated),\n negate(Effect, EffectNegated),\n atom_concat(Id, '_i', NewId).\n transposition_sequential(LPrec, [H|T], Effect, Id, Skipped, NewPrec, XNegated, NewId) :-\n transposition_sequential(LPrec, T, Effect, Id, [H|Skipped], NewPrec, XNegated, NewId).\n transposition_sequential(LPrec, [X|T], Effect, Id, Skipped, NewPrec, XNegated, NewId) :-\n prologEscape(X),\n append(Skipped, T, CleanedPrec),\n negate(X, XNegated),\n negate(Effect, EffectNegated),\n list_to_tuple([EffectNegated|CleanedPrec], NewPrec),\n newIdentifier(Skipped, Id, NewId).\n newIdentifier(List, OldId, NewId) :-\n modifier(List, Mod),\n atom_concat(OldId, Mod, NewId).\n modifier([], '_i').\n modifier([_|Tail], Index):-\n modifier(Tail, Index1),\n atom_concat(Index1, 'i', Index).\n negate(X, Arg) :-\n functor(X, '-', _) -> (\n arg(1, X, Arg));\n functor(X, 'p', _) -> (\n arg(1, X, PX),\n (functor(PX, '-', _) -> (\n arg(1, PX, PNX),\n Arg = o(PNX)\n );\n Arg = o(-(PX))));\n Arg = -(X).\n prologEscape(X) :- \\+ functor(X, 'prolog', _), \\+ functor(X, '~', _).\n /*\n * Standard rules (RuleName : Preconditions => Effects)\n * Special rules (RuleName : Effects)\n */\n convertAllRules([], []).\n convertAllRules([[H,P,E]|T], [R|Rules]) :- convertRule(H, P, E, R), convertAllRules(T, Rules).\n convertAllRules([[H,E]|T], [R|Rules]) :- convertRule(H, E, R), convertAllRules(T, Rules).\n /*\n * Convert the given rule to the standard format\n * Example:\n * r2: followedGuidelines(X), doctor(X) => -liable(X)\n * rule([r2,[[followedGuidelines(X_e4149)],[doctor(X_e4149)]],[neg,liable(X_e4149)]]).\n */\n convertRule(RuleName, Preconditions, Effects, rule(List)) :-\n tuple_to_list(Preconditions, Lprecond),\n tuple_to_list(Effects, Leffects),\n check_modifiers_in_list(preconditions, Lprecond, LprecondChecked),\n check_modifiers_in_list(effects, Leffects, LeffectsChecked),\n flatten_first_level(LeffectsChecked, LeffectsCheckedFlattened),\n List = [RuleName, LprecondChecked, LeffectsCheckedFlattened], !.\n /*\n * Convert the given special rule\n * Example:\n * bp(-liable(X)).\n * abastractBp([[neg, liable(X_e4149)]]).\n */\n convertRule(bps, Effects, abstractBp(Checked)) :-\n functor(Effects, 'bp', _),\n Effects =.. L,\n removehead(L, LC),\n check_modifiers_in_list(effects, LC, Checked), !.\n convertRule(Name, Effects, premise([Name, LeffectsCheckedFlattened])) :-\n tuple_to_list(Effects, Leffects),\n check_modifiers_in_list(effects, Leffects, LeffectsChecked),\n flatten_first_level(LeffectsChecked, LeffectsCheckedFlattened).\n /*\n * Find negations(-), obligations(o), permissions(p) on a list of preconditions/effects and\n * raplace them with the assigned literal (neg, obl, perm)\n */\n check_modifiers_in_list(MODE, [], []) :- !.\n check_modifiers_in_list(MODE, [H|T], L) :- H == [], L = [], !.\n check_modifiers_in_list(MODE, [H|T], L) :- H \\== [],\n check_modifiers_once(H, LH),\n check_modifiers_in_list(MODE, T, LT),\n append([LH], LT, L).\n check_modifiers_once(H, List) :- once(check_modifiers(H, List)).\n check_modifiers([], []).\n check_modifiers(H, List) :-\n functor(H, '-', _) -> (\n arg(1, H, Arg),\n check_modifiers_once(Arg, Lobl),\n append([neg], Lobl, Lf),\n List = Lf);\n functor(H, 'o', _) -> (\n arg(1, H, Arg),\n check_modifiers_once(Arg, Lobl),\n List = [obl|[Lobl]]);\n functor(H, 'p', _) -> (\n arg(1, H, Arg),\n check_modifiers_once(Arg, Lper),\n List = [perm|[Lper]]);\n functor(H, '~', _) -> (\n arg(1, H, Arg),\n check_modifiers_once(Arg, Lper),\n List = [unless|[Lper]]);\n functor(H, 'bp', _) -> (\n H =.. [_|Arg],\n check_modifiers_in_list(effects, Arg, Lper),\n List = [bp|[Lper]]);\n List = [H].\n /*\n * Convert the given tuple to list\n */\n tuple_to_list(A,[A]) :- nonvar(A), A \\= (_ , _), !.\n tuple_to_list((A,B),L) :-\n tuple_to_list(A, La),\n tuple_to_list(B, Lb),\n append(La, Lb,L).\n list_to_tuple([H], (H)) :- !.\n list_to_tuple([H|T], (H,TT)) :- list_to_tuple(T,TT).\n /*\n * Replace all the occurences of a given element with the given argument\n */\n replace(_, _, [],[]) :- !.\n replace(O, R, [O|T], [R|T2]) :- replace(O, R, T, T2), !.\n replace(O, R, [H|T], [H|T2]) :- H \\= O, replace(O, R, T, T2).\n flatten_first_level([X], X) :- !.\n flatten_first_level.\n removehead([_|Tail], Tail).\n in(A, A) :- nonvar(A), A \\= (_ , _), !.\n in(A, (A, _)) :- !.\n in(A, (_ , Cs)) :- in(A, Cs).\n check_admissibility(preconditions, H, LH) :-\n \\+ defeasible_admissible(LH),\n throw(['Premise ', H, ' is not a well formed member of the argumentation language.']).\n check_admissibility(effects, H, LH) :-\n \\+ admissible(LH),\n throw(['Conclusion ', H, ' is not a well formed member of the argumentation language.']).\n check_admissibility(_, _, _).\n defeasible_admissible([unless, Term]) :- admissible(Term).\n defeasible_admissible(Term) :- admissible(Term).\n admissible([neg, bp, Term]) :- admissible_terms_complete(Term).\n admissible([bp, Term]) :- admissible_terms_complete(Term).\n admissible([neg, Term]) :- admissible_term(Term).\n admissible([obl, [Term]]) :- admissible_term(Term).\n admissible([obl, [neg, Term]]) :- admissible_term(Term).\n admissible([neg, obl, [Term]]) :- admissible_term(Term).\n admissible([neg, obl, [neg, Term]]) :- admissible_term(Term).\n admissible([perm, [Term]]) :- admissible_term(Term).\n admissible([perm, [neg, Term]]) :- admissible_term(Term).\n admissible([Term]) :- admissible_term(Term).\n admissible_term(Term) :-\n atomic(Term),\n Term \\== neg,\n Term \\== obl,\n Term \\== perm,\n Term \\== unless,\n Term \\== bp.\n admissible_term(Term) :- var(Term).\n admissible_term(Term) :-\n compound(Term),\n \\+ functor(Term, 'o', _),\n \\+ functor(Term, 'p', _),\n \\+ functor(Term, '-', _),\n \\+ functor(Term, '~', _),\n \\+ functor(Term, 'bp', _),\n Term =.. [_|Args],\n admissible_terms(Args).\n admissible_terms([]).\n admissible_terms([H|T]) :-\n admissible_term(H),\n admissible_terms(T).\n admissible_terms_complete([]).\n admissible_terms_complete([H|T]) :-\n admissible(H),\n admissible_terms_complete(T).\n ");
|
|
5245
|
+
this.theoryCode = trimIndent("\n /*\n * Main directive. Find all the rules in the theory in the format (Name : Preconditions => Conclusion)\n * or (Name : Effects) and then if:\n * - It is a standard rule, translate it in the standard format (rule([Name, Preconditions, Conclusions]));\n * - It is a bp rule, translate it to (abstractBp([Effects]))\n * During the process, clean them from the unallowed symbols (-, o, p).\n */\n convertAllRules(ArgRules) :-\n defeasibleRules(DefeasibleRules),\n strictRules(StrictRules, RulesIds),\n ordinaryPremises(Premises),\n axiomPremises(Axioms, AxiomsIds),\n specialRules(SpecialRules),\n utils::appendLists([DefeasibleRules, StrictRules, Premises, Axioms], Rules),\n rule_to_clause(Rules, Clauses),\n findall(sup(X, Y), sup(X, Y), Sup),\n utils::appendLists([Clauses, AxiomsIds, RulesIds, Sup, SpecialRules], ArgRules),\n utils::assert_all(ArgRules), !.\n defeasibleRules(DefeasibleRules) :-\n findall([RuleName, Preconditions, Effect], (RuleName : Preconditions => Effect), DefeasibleRulesOld),\n prologDefeasibleRules(DefeasibleRulesNew),\n utils::append_fast(DefeasibleRulesOld, DefeasibleRulesNew, DefeasibleRules).\n strictRules(CtrRules, Ids) :-\n findall([RuleName, Preconditions, Effect], (RuleName : Preconditions -> Effect), StrictRulesOld),\n prologStrictRules(StrictRulesNew),\n utils::append_fast(StrictRulesOld, StrictRulesNew, StrictRules),\n transpose(StrictRules, StrictRules, CtrRules),\n extract_id(CtrRules, Ids).\n ordinaryPremises(Premises) :-\n findall([RuleName, Effect], ((RuleName :=> Effect), atom(RuleName)), PremisesOld),\n prologPremises(PremisesNew),\n utils::append_fast(PremisesOld, PremisesNew, Premises).\n axiomPremises(Axioms, Ids) :-\n findall([RuleName, Effect], ((RuleName :-> Effect), atom(RuleName)), AxiomsOld),\n prologAxioms(AxiomsNew),\n utils::append_fast(AxiomsOld, AxiomsNew, Axioms),\n extract_id(Axioms, Ids).\n specialRules(SpecialRules) :-\n bpsNew(SpecialRules).\n transpose(_, CtrRules, CtrRules) :- \\+ autoTransposition, !.\n transpose([], CtrRules, CtrRules).\n transpose([H|T], TempCtrRules, CtrRules) :-\n transpose(T, TempCtrRules, CR),\n findall(TrH, transposition(H, TrH), Tran),\n mergeCtrRules(CR, Tran, CtrRules).\n mergeCtrRules(All, ToMerge, X) :-\n utils::append_fast(All, ToMerge, XT),\n deduplicate(XT, X).\n deduplicate([], []).\n deduplicate([[RN,A,B]|T], X) :- deduplicate(T, TT), (member([RN,_,_], TT) -> X = TT; X = [[RN,A,B]|TT]). \n transposition([Id, Prec, Effect], [Id, Prec, Effect]).\n transposition([Id, Prec, Effect], [NewId, NewPrec ,XNegated]) :-\n compound(Prec),\n tuple_to_list(Prec, LPrec),!,\n transposition_sequential(LPrec, LPrec, Effect, Id, [], NewPrec, XNegated, NewId).\n transposition([Id, Prec, Effect], [NewId, EffectNegated ,XNegated]) :-\n \\+ compound(Prec),\n Prec \\== [],\n prologEscape(Prec),\n negate(Prec, XNegated),\n negate(Effect, EffectNegated),\n atom_concat(Id, '_i', NewId).\n transposition_sequential(LPrec, [H|T], Effect, Id, Skipped, NewPrec, XNegated, NewId) :-\n transposition_sequential(LPrec, T, Effect, Id, [H|Skipped], NewPrec, XNegated, NewId).\n transposition_sequential(LPrec, [X|T], Effect, Id, Skipped, NewPrec, XNegated, NewId) :-\n prologEscape(X),\n utils::append_fast(Skipped, T, CleanedPrec),\n negate(X, XNegated),\n negate(Effect, EffectNegated),\n list_to_tuple([EffectNegated|CleanedPrec], NewPrec),\n newIdentifier(Skipped, Id, NewId).\n newIdentifier(List, OldId, NewId) :-\n modifier(List, Mod),\n atom_concat(OldId, Mod, NewId).\n modifier([], '_i').\n modifier([_|Tail], Index):-\n modifier(Tail, Index1),\n atom_concat(Index1, 'i', Index).\n negate(X, Arg) :-\n functor(X, '-', _) -> (\n arg(1, X, Arg));\n functor(X, 'p', _) -> (\n arg(1, X, PX),\n (functor(PX, '-', _) -> (\n arg(1, PX, PNX),\n Arg = o(PNX)\n );\n Arg = o(-(PX))));\n Arg = -(X).\n prologEscape(X) :- \\+ functor(X, 'prolog', _), \\+ functor(X, '~', _).\n /*\n * Standard rules (RuleName : Preconditions => Effects)\n * Special rules (RuleName : Effects)\n */\n convertAllRules([], []).\n convertAllRules([[H,P,E]|T], [R|Rules]) :- convertRule(H, P, E, R), convertAllRules(T, Rules).\n convertAllRules([[H,E]|T], [R|Rules]) :- convertRule(H, E, R), convertAllRules(T, Rules).\n /*\n * Convert the given rule to the standard format\n * Example:\n * r2: followedGuidelines(X), doctor(X) => -liable(X)\n * rule([r2,[[followedGuidelines(X_e4149)],[doctor(X_e4149)]],[neg,liable(X_e4149)]]).\n */\n convertRule(RuleName, Preconditions, Effects, rule(List)) :-\n tuple_to_list(Preconditions, Lprecond),\n tuple_to_list(Effects, Leffects),\n check_modifiers_in_list(preconditions, Lprecond, LprecondChecked),\n check_modifiers_in_list(effects, Leffects, LeffectsChecked),\n flatten_first_level(LeffectsChecked, LeffectsCheckedFlattened),\n List = [RuleName, LprecondChecked, LeffectsCheckedFlattened], !.\n /*\n * Convert the given special rule\n * Example:\n * bp(-liable(X)).\n * abastractBp([[neg, liable(X_e4149)]]).\n */\n convertRule(bps, Effects, abstractBp(Checked)) :-\n functor(Effects, 'bp', _),\n Effects =.. L,\n removehead(L, LC),\n check_modifiers_in_list(effects, LC, Checked), !.\n convertRule(Name, Effects, premise([Name, LeffectsCheckedFlattened])) :-\n tuple_to_list(Effects, Leffects),\n check_modifiers_in_list(effects, Leffects, LeffectsChecked),\n flatten_first_level(LeffectsChecked, LeffectsCheckedFlattened).\n /*\n * Find negations(-), obligations(o), permissions(p) on a list of preconditions/effects and\n * raplace them with the assigned literal (neg, obl, perm)\n */\n check_modifiers_in_list(MODE, [], []) :- !.\n check_modifiers_in_list(MODE, [H|T], L) :- H == [], L = [], !.\n check_modifiers_in_list(MODE, [H|T], R) :- H \\== [],\n check_modifiers_once(H, LH),\n check_modifiers_in_list(MODE, T, LT),\n utils::append_fast([LH], LT, L),\n R = L.\n check_modifiers_once(H, List) :- once(check_modifiers(H, List)).\n check_modifiers([], []).\n check_modifiers(H, List) :-\n functor(H, '-', _) -> (\n arg(1, H, Arg),\n check_modifiers_once(Arg, Lobl),\n utils::append_fast([neg], Lobl, Lf),\n List = Lf);\n functor(H, 'o', _) -> (\n arg(1, H, Arg),\n check_modifiers_once(Arg, Lobl),\n List = [obl|[Lobl]]);\n functor(H, 'p', _) -> (\n arg(1, H, Arg),\n check_modifiers_once(Arg, Lper),\n List = [perm|[Lper]]);\n functor(H, '~', _) -> (\n arg(1, H, Arg),\n check_modifiers_once(Arg, Lper),\n List = [unless|[Lper]]);\n functor(H, 'bp', _) -> (\n H =.. [_|Arg],\n check_modifiers_in_list(effects, Arg, Lper),\n List = [bp|[Lper]]);\n List = [H].\n list_to_tuple([H], (H)) :- !.\n list_to_tuple([H|T], (H,TT)) :- list_to_tuple(T,TT).\n /*\n * Replace all the occurences of a given element with the given argument\n */\n replace(_, _, [],[]) :- !.\n replace(O, R, [O|T], [R|T2]) :- replace(O, R, T, T2), !.\n replace(O, R, [H|T], [H|T2]) :- H \\= O, replace(O, R, T, T2).\n flatten_first_level([X], X) :- !.\n flatten_first_level.\n removehead([_|Tail], Tail).\n in(A, A) :- nonvar(A), A \\= (_ , _), !.\n in(A, (A, _)) :- !.\n in(A, (_ , Cs)) :- in(A, Cs).\n check_admissibility(preconditions, H, LH) :-\n \\+ defeasible_admissible(LH),\n throw(['Premise ', H, ' is not a well formed member of the argumentation language.']).\n check_admissibility(effects, H, LH) :-\n \\+ admissible(LH),\n throw(['Conclusion ', H, ' is not a well formed member of the argumentation language.']).\n check_admissibility(_, _, _).\n defeasible_admissible([unless, Term]) :- admissible(Term).\n defeasible_admissible(Term) :- admissible(Term).\n admissible([neg, bp, Term]) :- admissible_terms_complete(Term).\n admissible([bp, Term]) :- admissible_terms_complete(Term).\n admissible([neg, Term]) :- admissible_term(Term).\n admissible([obl, [Term]]) :- admissible_term(Term).\n admissible([obl, [neg, Term]]) :- admissible_term(Term).\n admissible([neg, obl, [Term]]) :- admissible_term(Term).\n admissible([neg, obl, [neg, Term]]) :- admissible_term(Term).\n admissible([perm, [Term]]) :- admissible_term(Term).\n admissible([perm, [neg, Term]]) :- admissible_term(Term).\n admissible([Term]) :- admissible_term(Term).\n admissible_term(Term) :-\n atomic(Term),\n Term \\== neg,\n Term \\== obl,\n Term \\== perm,\n Term \\== unless,\n Term \\== bp.\n admissible_term(Term) :- var(Term).\n admissible_term(Term) :-\n compound(Term),\n \\+ functor(Term, 'o', _),\n \\+ functor(Term, 'p', _),\n \\+ functor(Term, '-', _),\n \\+ functor(Term, '~', _),\n \\+ functor(Term, 'bp', _),\n Term =.. [_|Args],\n admissible_terms(Args).\n admissible_terms([]).\n admissible_terms([H|T]) :-\n admissible_term(H),\n admissible_terms(T).\n admissible_terms_complete([]).\n admissible_terms_complete([H|T]) :-\n admissible(H),\n admissible_terms_complete(T).\n rule(Id, PP, [Conclusion]) :- context_check(clause(rl(Conclusion), [Id, Premises, Conclusion])), tuple_to_list(Premises, P), ff(P, PP).\n premise(Id, [Conclusion]) :- context_check(clause(rl(Conclusion), [Id, Conclusion])).\n check_strict(Id) :- context_check(strict(Id)).\n prolog([prolog(Term)], Term).\n contrary([~(Term)], Term).\n undercut(undercut(Rule), Rule).\n superiority(sup(Id1, Id2), Id1, Id2).\n /*\n * Convert the given tuple to list\n */\n tuple_to_list(A,[A]) :- nonvar(A), A \\= (_ , _), !.\n tuple_to_list((A,B),L) :-\n tuple_to_list(A, La),\n tuple_to_list(B, Lb),\n utils::append_fast(La, Lb,L).\n ff([[]], []) :- !.\n ff([[X]], [X]) :- !.\n ff(X, X).\n classic_rule(X, Y, Z) :- rule(X, Y, Z).\n classic_rule(X, Y) :- premise(X, Y).\n ");
|
|
4880
5246
|
}
|
|
4881
5247
|
RuleTranslator.$metadata$ = {
|
|
4882
5248
|
kind: Kind_OBJECT,
|
|
@@ -4921,7 +5287,7 @@
|
|
|
4921
5287
|
}
|
|
4922
5288
|
function Utils() {
|
|
4923
5289
|
Utils_instance = this;
|
|
4924
|
-
this.theoryCode = trimIndent('\n writeList([]) :- nl.\n writeList([X|Others]) :-\n \twrite(X),\n \twriteList(Others).\n writeListNl([]).\n writeListNl([X|Others]) :-\n \twrite(X),nl,\n \twriteListNl(Others).\n sortDistinct(List, Sorted) :-\n deduplicate(List, Deduplicated),\n sort(Deduplicated, Sorted).\n deduplicate([], []).\n deduplicate(List, Output) :-\n List \\== [],\n setof(X, member(X, List), Output).\n sort(List,Sorted) :- q_sort(List, [], Sorted).\n q_sort([], Acc, Acc).\n q_sort([H|T], Acc, Sorted) :-\n \tpivoting(H, T, L1, L2),\n \tq_sort(L1, Acc, Sorted1),\n \tq_sort(L2, [H|Sorted1], Sorted).\n pivoting(H,[],[],[]).\n pivoting(H, [X|T], [X|L], G) :-\n H @>= X,\n pivoting(H, T, L, G).\n pivoting(H, [X|T], L, [X|G]) :-\n X @> H,\n pivoting(H, T, L, G).\n subtract([], _, []).\n subtract([Head|Tail], L2, L3) :-\n member(Head, L2), !,\n subtract(Tail, L2, L3).\n subtract([Head|Tail1], L2, [Head|Tail3]) :-\n subtract(Tail1, L2, Tail3).\n isEmptyList([]).\n appendLists([], []).\n appendLists([H|T], R) :-\n appendLists(T, AT),\n
|
|
5290
|
+
this.theoryCode = trimIndent('\n writeList([]) :- nl.\n writeList([X|Others]) :-\n \twrite(X),\n \twriteList(Others).\n writeListNl([]).\n writeListNl([X|Others]) :-\n \twrite(X),nl,\n \twriteListNl(Others).\n sortDistinct(List, Sorted) :-\n deduplicate(List, Deduplicated),\n sort(Deduplicated, Sorted).\n deduplicate([], []).\n deduplicate(List, Output) :-\n List \\== [],\n setof(X, member(X, List), Output).\n sort(List,Sorted) :- q_sort(List, [], Sorted).\n q_sort([], Acc, Acc).\n q_sort([H|T], Acc, Sorted) :-\n \tpivoting(H, T, L1, L2),\n \tq_sort(L1, Acc, Sorted1),\n \tq_sort(L2, [H|Sorted1], Sorted).\n pivoting(H,[],[],[]).\n pivoting(H, [X|T], [X|L], G) :-\n H @>= X,\n pivoting(H, T, L, G).\n pivoting(H, [X|T], L, [X|G]) :-\n X @> H,\n pivoting(H, T, L, G).\n subtract([], _, []).\n subtract([Head|Tail], L2, L3) :-\n member(Head, L2), !,\n subtract(Tail, L2, L3).\n subtract([Head|Tail1], L2, [Head|Tail3]) :-\n subtract(Tail1, L2, Tail3).\n isEmptyList([]).\n appendLists([], []).\n appendLists([H|T], R) :-\n appendLists(T, AT),\n append_fast(H, AT, R).\n search(F, L, S) :-\n between(1, L, N),\n functor(S, F, N),\n call(S).\n between(N, M, K) :- N < M, K = N.\n between(N, M, K) :- N == M, !, K = N.\n between(N, M, K) :- N < M, N1 is N+1, between(N1, M, K).\n recoverGraph(Args, Attacks, Supports) :-\n findall(X, context_check(argument(X)), TempArgs),\n findall((T, A, B, C), context_check(attack(T, A, B, C)), TempAttacks),\n findall((A, B), context_check(support(A, B)), TempSupports),\n utils::sort(TempArgs, Args),\n utils::sort(TempAttacks, Attacks),\n utils::sort(TempSupports, Supports).\n recoverArgumentLabelling(ArgsIn, ArgsOut, ArgsUnd) :-\n findall(X, context_check(in(X)), TempArgsIn),\n findall(X, context_check(out(X)), TempArgsOut),\n findall(X, context_check(und(X)), TempArgsUnd),\n utils::sort(TempArgsIn, ArgsIn),\n utils::sort(TempArgsOut, ArgsOut),\n utils::sort(TempArgsUnd, ArgsUnd).\n recoverStatementLabelling(In, Out, Und) :-\n findall(X, context_check(statIn(X)), TempIn),\n findall(X, context_check(statOut(X)), TempOut),\n findall(X, context_check(statUnd(X)), TempUnd),\n utils::sort(TempIn, In),\n utils::sort(TempOut, Out),\n utils::sort(TempUnd, Und).\n ');
|
|
4925
5291
|
}
|
|
4926
5292
|
Utils.$metadata$ = {
|
|
4927
5293
|
kind: Kind_OBJECT,
|
|
@@ -5111,6 +5477,7 @@
|
|
|
5111
5477
|
package$labelling.BpPartialLabellerBase = BpPartialLabellerBase;
|
|
5112
5478
|
package$labelling.CompleteLabellerBase = CompleteLabellerBase;
|
|
5113
5479
|
package$labelling.GroundedLabellerBase = GroundedLabellerBase;
|
|
5480
|
+
package$labelling.GroundedLabellerOptimizedBase = GroundedLabellerOptimizedBase;
|
|
5114
5481
|
Object.defineProperty(package$labelling, 'PassThroughStatementLabeller', {
|
|
5115
5482
|
get: PassThroughStatementLabeller_getInstance
|
|
5116
5483
|
});
|
|
@@ -5144,6 +5511,12 @@
|
|
|
5144
5511
|
Object.defineProperty(package$language, 'Bps', {
|
|
5145
5512
|
get: Bps_getInstance
|
|
5146
5513
|
});
|
|
5514
|
+
Object.defineProperty(package$language, 'ExtractStrictIds', {
|
|
5515
|
+
get: ExtractStrictIds_getInstance
|
|
5516
|
+
});
|
|
5517
|
+
Object.defineProperty(package$language, 'RuleToClause', {
|
|
5518
|
+
get: RuleToClause_getInstance
|
|
5519
|
+
});
|
|
5147
5520
|
var package$structured = package$libs.structured || (package$libs.structured = {});
|
|
5148
5521
|
package$structured.StructuredModeBase = StructuredModeBase;
|
|
5149
5522
|
Object.defineProperty(package$structured, 'QueryMode', {
|
|
@@ -5161,7 +5534,17 @@
|
|
|
5161
5534
|
Object.defineProperty(package$utils, 'OrderingComparator', {
|
|
5162
5535
|
get: OrderingComparator_getInstance
|
|
5163
5536
|
});
|
|
5537
|
+
$$importsForInline$$['@tuprolog/2p-solve'] = $module$_2p_solve;
|
|
5164
5538
|
package$utils.UtilsBase = UtilsBase;
|
|
5539
|
+
Object.defineProperty(package$utils, 'AppendOptimized', {
|
|
5540
|
+
get: AppendOptimized_getInstance
|
|
5541
|
+
});
|
|
5542
|
+
Object.defineProperty(package$utils, 'AssertAll', {
|
|
5543
|
+
get: AssertAll_getInstance
|
|
5544
|
+
});
|
|
5545
|
+
Object.defineProperty(package$utils, 'ArgumentHash', {
|
|
5546
|
+
get: ArgumentHash_getInstance
|
|
5547
|
+
});
|
|
5165
5548
|
var package$meta = package$core.meta || (package$core.meta = {});
|
|
5166
5549
|
Object.defineProperty(package$meta, 'MetaInterpreterLib', {
|
|
5167
5550
|
get: MetaInterpreterLib_getInstance
|
|
@@ -5226,6 +5609,9 @@
|
|
|
5226
5609
|
Object.defineProperty(package$labelling, 'GroundedLabeller', {
|
|
5227
5610
|
get: GroundedLabeller_getInstance
|
|
5228
5611
|
});
|
|
5612
|
+
Object.defineProperty(package$labelling, 'GroundedLabellerOptimized', {
|
|
5613
|
+
get: GroundedLabellerOptimized_getInstance
|
|
5614
|
+
});
|
|
5229
5615
|
Object.defineProperty(package$labelling, 'StatementLabeller', {
|
|
5230
5616
|
get: StatementLabeller_getInstance
|
|
5231
5617
|
});
|
|
@@ -5272,6 +5658,9 @@
|
|
|
5272
5658
|
Object.defineProperty(package$sources, 'Grounded', {
|
|
5273
5659
|
get: Grounded_getInstance
|
|
5274
5660
|
});
|
|
5661
|
+
Object.defineProperty(package$sources, 'GroundedOptimized', {
|
|
5662
|
+
get: GroundedOptimized_getInstance
|
|
5663
|
+
});
|
|
5275
5664
|
Object.defineProperty(package$sources, 'Preferences', {
|
|
5276
5665
|
get: Preferences_getInstance
|
|
5277
5666
|
});
|
|
@@ -5480,8 +5869,8 @@
|
|
|
5480
5869
|
PrologWithArgumentationImpl.prototype.anyMguWith = PrologWithArgumentation.prototype.anyMguWith;
|
|
5481
5870
|
PrologWithArgumentationImpl.prototype.anyUnifyWith = PrologWithArgumentation.prototype.anyUnifyWith;
|
|
5482
5871
|
PrologWithArgumentationImpl.prototype.list = PrologWithArgumentation.prototype.list;
|
|
5483
|
-
PrologWithArgumentationImpl.prototype.listFromIterable = PrologWithArgumentation.prototype.listFromIterable;
|
|
5484
5872
|
PrologWithArgumentationImpl.prototype.listFrom = PrologWithArgumentation.prototype.listFrom;
|
|
5873
|
+
PrologWithArgumentationImpl.prototype.listFromIterable = PrologWithArgumentation.prototype.listFromIterable;
|
|
5485
5874
|
PrologWithArgumentationImpl.prototype.listFromSequence = PrologWithArgumentation.prototype.listFromSequence;
|
|
5486
5875
|
PrologWithArgumentationImpl.prototype.matchAny = PrologWithArgumentation.prototype.matchAny;
|
|
5487
5876
|
PrologWithArgumentationImpl.prototype.mguWithOccurCheck = PrologWithArgumentation.prototype.mguWithOccurCheck;
|
|
@@ -5542,6 +5931,8 @@
|
|
|
5542
5931
|
CompleteLabellerBase.prototype.content = ArgLibrary.prototype.content;
|
|
5543
5932
|
GroundedLabellerBase.prototype.flags = ArgLibrary.prototype.flags;
|
|
5544
5933
|
GroundedLabellerBase.prototype.content = ArgLibrary.prototype.content;
|
|
5934
|
+
GroundedLabellerOptimizedBase.prototype.flags = ArgLibrary.prototype.flags;
|
|
5935
|
+
GroundedLabellerOptimizedBase.prototype.content = ArgLibrary.prototype.content;
|
|
5545
5936
|
PassThroughStatementLabeller.prototype.flags = ArgLibrary.prototype.flags;
|
|
5546
5937
|
PassThroughStatementLabeller.prototype.content = ArgLibrary.prototype.content;
|
|
5547
5938
|
StatementLabellerBase.prototype.flags = ArgLibrary.prototype.flags;
|