@tuprolog/arg2p-core 0.6.3 → 0.6.6

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.
@@ -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;
@@ -74,9 +77,10 @@
74
77
  var equals = Kotlin.equals;
75
78
  var DomainError = $module$_2p_solve.it.unibo.tuprolog.solve.exception.error.DomainError;
76
79
  var DomainError$Expected = $module$_2p_solve.it.unibo.tuprolog.solve.exception.error.DomainError.Expected;
80
+ var SolveOptions = $module$_2p_solve.it.unibo.tuprolog.solve.SolveOptions;
81
+ var Long$Companion$MAX_VALUE = Kotlin.Long.MAX_VALUE;
77
82
  var Unit = Kotlin.kotlin.Unit;
78
83
  var filter = Kotlin.kotlin.sequences.filter_euau3h$;
79
- var first = Kotlin.kotlin.sequences.first_veqyi0$;
80
84
  var prolog = $module$_2p_dsl_core.it.unibo.tuprolog.dsl.prolog;
81
85
  var Specifier = $module$_2p_core.it.unibo.tuprolog.core.operators.Specifier;
82
86
  var Operator = $module$_2p_core.it.unibo.tuprolog.core.operators.Operator;
@@ -109,7 +113,10 @@
109
113
  var toTerm = $module$_2p_core.it.unibo.tuprolog.core.listToTerm;
110
114
  var UnaryPredicate$WithoutSideEffects = $module$_2p_solve.it.unibo.tuprolog.solve.primitive.UnaryPredicate.WithoutSideEffects;
111
115
  var BinaryRelation$WithoutSideEffects = $module$_2p_solve.it.unibo.tuprolog.solve.primitive.BinaryRelation.WithoutSideEffects;
116
+ var IllegalArgumentException_init = Kotlin.kotlin.IllegalArgumentException_init;
112
117
  var copyToArray = Kotlin.kotlin.collections.copyToArray;
118
+ var hashCode = Kotlin.hashCode;
119
+ var Collection = Kotlin.kotlin.collections.Collection;
113
120
  var AliasedLibrary = $module$_2p_solve.it.unibo.tuprolog.solve.library.AliasedLibrary;
114
121
  var compareBy = Kotlin.kotlin.comparisons.compareBy_bvgy4j$;
115
122
  var sortedWith = Kotlin.kotlin.sequences.sortedWith_vjgqpk$;
@@ -152,6 +159,8 @@
152
159
  CompleteLabellerBase.prototype.constructor = CompleteLabellerBase;
153
160
  GroundedLabellerBase.prototype = Object.create(LazyRawPrologContent.prototype);
154
161
  GroundedLabellerBase.prototype.constructor = GroundedLabellerBase;
162
+ GroundedLabellerOptimizedBase.prototype = Object.create(LazyRawPrologContent.prototype);
163
+ GroundedLabellerOptimizedBase.prototype.constructor = GroundedLabellerOptimizedBase;
155
164
  Labelling.prototype = Object.create(RuleWrapper.prototype);
156
165
  Labelling.prototype.constructor = Labelling;
157
166
  StatementLabellerBase.prototype = Object.create(LazyRawPrologContent.prototype);
@@ -170,6 +179,8 @@
170
179
  Bps.prototype.constructor = Bps;
171
180
  ExtractStrictIds.prototype = Object.create(BinaryRelation$WithoutSideEffects.prototype);
172
181
  ExtractStrictIds.prototype.constructor = ExtractStrictIds;
182
+ RuleToClause.prototype = Object.create(BinaryRelation$WithoutSideEffects.prototype);
183
+ RuleToClause.prototype.constructor = RuleToClause;
173
184
  StructuredModeBase.prototype = Object.create(LazyRawPrologContent.prototype);
174
185
  StructuredModeBase.prototype.constructor = StructuredModeBase;
175
186
  DebugBase.prototype = Object.create(LazyRawPrologContent.prototype);
@@ -178,6 +189,8 @@
178
189
  SuperiorityRelationBase.prototype.constructor = SuperiorityRelationBase;
179
190
  UtilsBase.prototype = Object.create(LazyRawPrologContent.prototype);
180
191
  UtilsBase.prototype.constructor = UtilsBase;
192
+ ArgumentHash.prototype = Object.create(BinaryRelation$WithoutSideEffects.prototype);
193
+ ArgumentHash.prototype.constructor = ArgumentHash;
181
194
  EngineInterface.prototype = Object.create(EngineInterfaceBase.prototype);
182
195
  EngineInterface.prototype.constructor = EngineInterface;
183
196
  AbstractMode.prototype = Object.create(AbstractModeBase.prototype);
@@ -204,6 +217,8 @@
204
217
  CompleteLabeller.prototype.constructor = CompleteLabeller;
205
218
  GroundedLabeller.prototype = Object.create(GroundedLabellerBase.prototype);
206
219
  GroundedLabeller.prototype.constructor = GroundedLabeller;
220
+ GroundedLabellerOptimized.prototype = Object.create(GroundedLabellerOptimizedBase.prototype);
221
+ GroundedLabellerOptimized.prototype.constructor = GroundedLabellerOptimized;
207
222
  StatementLabeller.prototype = Object.create(StatementLabellerBase.prototype);
208
223
  StatementLabeller.prototype.constructor = StatementLabeller;
209
224
  RuleParser.prototype = Object.create(RuleParserBase.prototype);
@@ -288,7 +303,7 @@
288
303
  staticLibs = emptyList();
289
304
  if (dynamicLibs === void 0)
290
305
  dynamicLibs = emptyList();
291
- 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));
306
+ 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));
292
307
  };
293
308
  Arg2pSolver$Companion.$metadata$ = {
294
309
  kind: Kind_OBJECT,
@@ -914,36 +929,18 @@
914
929
  PrologWithArgumentationImpl.prototype.write1 = function (term) {
915
930
  return this.$delegate_38xz9p$_0.write1(term);
916
931
  };
917
- PrologWithArgumentationImpl.prototype.neq2 = function ($receiver, right) {
918
- return this.$delegate_38xz9p$_0.neq2($receiver, right);
919
- };
920
- PrologWithArgumentationImpl.prototype.nid2 = function ($receiver, right) {
921
- return this.$delegate_38xz9p$_0.nid2($receiver, right);
922
- };
923
- PrologWithArgumentationImpl.prototype.power = function ($receiver, right) {
924
- return this.$delegate_38xz9p$_0.power($receiver, right);
925
- };
926
- PrologWithArgumentationImpl.prototype.eq2 = function ($receiver, right) {
927
- return this.$delegate_38xz9p$_0.eq2($receiver, right);
928
- };
929
- PrologWithArgumentationImpl.prototype.arithNeq2 = function ($receiver, right) {
930
- return this.$delegate_38xz9p$_0.arithNeq2($receiver, right);
931
- };
932
- PrologWithArgumentationImpl.prototype.id2 = function ($receiver, right) {
933
- return this.$delegate_38xz9p$_0.id2($receiver, right);
934
- };
935
- PrologWithArgumentationImpl.prototype.arithEq2 = function ($receiver, right) {
936
- return this.$delegate_38xz9p$_0.arithEq2($receiver, right);
937
- };
938
- PrologWithArgumentationImpl.prototype.pow = function ($receiver, right) {
939
- return this.$delegate_38xz9p$_0.pow($receiver, right);
940
- };
941
932
  PrologWithArgumentationImpl.prototype.anyAnd = function ($receiver, other) {
942
933
  return this.$delegate_38xz9p$_0.anyAnd($receiver, other);
943
934
  };
944
935
  PrologWithArgumentationImpl.prototype.append = function ($receiver, item, items) {
945
936
  return this.$delegate_38xz9p$_0.append($receiver, item, items);
946
937
  };
938
+ PrologWithArgumentationImpl.prototype.arithEq2 = function ($receiver, right) {
939
+ return this.$delegate_38xz9p$_0.arithEq2($receiver, right);
940
+ };
941
+ PrologWithArgumentationImpl.prototype.arithNeq2 = function ($receiver, right) {
942
+ return this.$delegate_38xz9p$_0.arithNeq2($receiver, right);
943
+ };
947
944
  PrologWithArgumentationImpl.prototype.concat = function ($receiver, other) {
948
945
  return this.$delegate_38xz9p$_0.concat($receiver, other);
949
946
  };
@@ -959,6 +956,9 @@
959
956
  PrologWithArgumentationImpl.prototype.anyDiv = function ($receiver, other) {
960
957
  return this.$delegate_38xz9p$_0.anyDiv($receiver, other);
961
958
  };
959
+ PrologWithArgumentationImpl.prototype.eq2 = function ($receiver, right) {
960
+ return this.$delegate_38xz9p$_0.eq2($receiver, right);
961
+ };
962
962
  PrologWithArgumentationImpl.prototype.anyEqualsTo = function ($receiver, other) {
963
963
  return this.$delegate_38xz9p$_0.anyEqualsTo($receiver, other);
964
964
  };
@@ -971,6 +971,9 @@
971
971
  PrologWithArgumentationImpl.prototype.anyGreaterThanOrEqualsTo = function ($receiver, other) {
972
972
  return this.$delegate_38xz9p$_0.anyGreaterThanOrEqualsTo($receiver, other);
973
973
  };
974
+ PrologWithArgumentationImpl.prototype.id2 = function ($receiver, right) {
975
+ return this.$delegate_38xz9p$_0.id2($receiver, right);
976
+ };
974
977
  PrologWithArgumentationImpl.prototype.anyIf = function ($receiver, other) {
975
978
  return this.$delegate_38xz9p$_0.anyIf($receiver, other);
976
979
  };
@@ -1001,6 +1004,12 @@
1001
1004
  PrologWithArgumentationImpl.prototype.anyMinus = function ($receiver, other) {
1002
1005
  return this.$delegate_38xz9p$_0.anyMinus($receiver, other);
1003
1006
  };
1007
+ PrologWithArgumentationImpl.prototype.neq2 = function ($receiver, right) {
1008
+ return this.$delegate_38xz9p$_0.neq2($receiver, right);
1009
+ };
1010
+ PrologWithArgumentationImpl.prototype.nid2 = function ($receiver, right) {
1011
+ return this.$delegate_38xz9p$_0.nid2($receiver, right);
1012
+ };
1004
1013
  PrologWithArgumentationImpl.prototype.anyNonGreaterThan = function ($receiver, other) {
1005
1014
  return this.$delegate_38xz9p$_0.anyNonGreaterThan($receiver, other);
1006
1015
  };
@@ -1334,7 +1343,7 @@
1334
1343
  function Context() {
1335
1344
  this.nextSolver_0 = 1;
1336
1345
  this.selectedSolver_0 = 0;
1337
- var $receiver = classic(MutableSolver.Companion, void 0, void 0, Theory.Companion.empty(), MutableTheory.Companion.empty());
1346
+ var $receiver = classicWithDefaultBuiltins(MutableSolver.Companion, void 0, void 0, Theory.Companion.empty(), MutableTheory.Companion.empty());
1338
1347
  $receiver.setFlag(flags.Unknown.name, flags.Unknown.FAIL);
1339
1348
  this.dynamicSolver_0 = mutableMapOf([to(0, $receiver)]);
1340
1349
  this.alias_476cz2$_0 = 'prolog.argumentation.context';
@@ -1354,7 +1363,7 @@
1354
1363
  this.$outer.nextSolver_0 = 1;
1355
1364
  this.$outer.dynamicSolver_0.clear();
1356
1365
  var tmp$ = this.$outer.dynamicSolver_0;
1357
- var $receiver = classic(MutableSolver.Companion, void 0, void 0, Theory.Companion.empty(), MutableTheory.Companion.empty());
1366
+ var $receiver = classicWithDefaultBuiltins(MutableSolver.Companion, void 0, void 0, Theory.Companion.empty(), MutableTheory.Companion.empty());
1358
1367
  $receiver.setFlag(flags.Unknown.name, flags.Unknown.FAIL);
1359
1368
  tmp$.put_xwzc9p$(0, $receiver);
1360
1369
  return sequenceOf([request.replyWithCondition(true, void 0, [])]);
@@ -1420,7 +1429,7 @@
1420
1429
  var result = request.arguments.get_za3lpa$(1);
1421
1430
  var tmp$_1 = this.$outer.dynamicSolver_0;
1422
1431
  var tmp$_2 = this.$outer.nextSolver_0;
1423
- var $receiver = classic(MutableSolver.Companion, void 0, void 0, Theory.Companion.empty(), MutableTheory.Companion.ofIterable(ensureNotNull(this.$outer.dynamicSolver_0.get_11rb$(target)).dynamicKb));
1432
+ var $receiver = classicWithDefaultBuiltins(MutableSolver.Companion, void 0, void 0, Theory.Companion.empty(), MutableTheory.Companion.ofIterable(ensureNotNull(this.$outer.dynamicSolver_0.get_11rb$(target)).dynamicKb));
1424
1433
  $receiver.setFlag(flags.Unknown.name, flags.Unknown.FAIL);
1425
1434
  tmp$_1.put_xwzc9p$(tmp$_2, $receiver);
1426
1435
  tmp$_0 = this.$outer;
@@ -1446,9 +1455,14 @@
1446
1455
  return this.signature_t5avxd$_0;
1447
1456
  }
1448
1457
  });
1458
+ function Context$DynamicCacheAssert$solve$lambda(this$Context, closure$term) {
1459
+ return function ($receiver) {
1460
+ return ensureNotNull(this$Context.dynamicSolver_0.get_11rb$(this$Context.selectedSolver_0)).solve($receiver.stringInvoke('asserta', closure$term, []));
1461
+ };
1462
+ }
1449
1463
  Context$DynamicCacheAssert.prototype.solve = function (request) {
1450
1464
  var term = request.arguments.get_za3lpa$(0);
1451
- ensureNotNull(this.$outer.dynamicSolver_0.get_11rb$(this.$outer.selectedSolver_0)).assertAFact(term.castToStruct());
1465
+ first(arg2pScope(Context$DynamicCacheAssert$solve$lambda(this.$outer, term)));
1452
1466
  return sequenceOf([request.replyWithCondition(true, void 0, [])]);
1453
1467
  };
1454
1468
  Context$DynamicCacheAssert.$metadata$ = {
@@ -1466,9 +1480,14 @@
1466
1480
  return this.signature_5o25xi$_0;
1467
1481
  }
1468
1482
  });
1483
+ function Context$DynamicCacheRetract$solve$lambda(this$Context, closure$term) {
1484
+ return function ($receiver) {
1485
+ return ensureNotNull(this$Context.dynamicSolver_0.get_11rb$(this$Context.selectedSolver_0)).solve($receiver.stringInvoke('retractall', closure$term, []));
1486
+ };
1487
+ }
1469
1488
  Context$DynamicCacheRetract.prototype.solve = function (request) {
1470
1489
  var term = request.arguments.get_za3lpa$(0);
1471
- ensureNotNull(this.$outer.dynamicSolver_0.get_11rb$(this.$outer.selectedSolver_0)).retractAllBeHead(term.castToStruct());
1490
+ first(arg2pScope(Context$DynamicCacheRetract$solve$lambda(this.$outer, term)));
1472
1491
  return sequenceOf([request.replyWithCondition(true, void 0, [])]);
1473
1492
  };
1474
1493
  Context$DynamicCacheRetract.$metadata$ = {
@@ -1702,7 +1721,7 @@
1702
1721
  switch (this.state_0) {
1703
1722
  case 0:
1704
1723
  this.state_0 = 2;
1705
- this.result_0 = this.local$$receiver.yieldAll_swo9gw$(map(this.local$closure$solver.solve(this.local$closure$goal), DynamicLoader$AbstractWithLib$solve$lambda$lambda(this.local$closure$request)), this);
1724
+ this.result_0 = this.local$$receiver.yieldAll_swo9gw$(map(this.local$closure$solver.solveWithOptions(this.local$closure$goal, SolveOptions.Companion.someEagerlyWithTimeout(1000, Long$Companion$MAX_VALUE)), DynamicLoader$AbstractWithLib$solve$lambda$lambda(this.local$closure$request)), this);
1706
1725
  if (this.result_0 === COROUTINE_SUSPENDED)
1707
1726
  return COROUTINE_SUSPENDED;
1708
1727
  continue;
@@ -2424,7 +2443,7 @@
2424
2443
  return 'grounded';
2425
2444
  };
2426
2445
  ArgumentLabellingMode.prototype.values = function () {
2427
- return listOf(['grounded', 'complete', 'bp_grounded', 'bp_grounded_partial', 'bp_grounded_complete']);
2446
+ return listOf(['grounded', 'grounded_hash', 'complete', 'bp_grounded', 'bp_grounded_partial', 'bp_grounded_complete']);
2428
2447
  };
2429
2448
  ArgumentLabellingMode.$metadata$ = {
2430
2449
  kind: Kind_OBJECT,
@@ -2954,6 +2973,43 @@
2954
2973
  simpleName: 'GroundedLabellerBase',
2955
2974
  interfaces: [Loadable, LazyRawPrologContent, ArgLibrary]
2956
2975
  };
2976
+ function GroundedLabellerOptimizedBase() {
2977
+ LazyRawPrologContent.call(this);
2978
+ this.alias_9fhn2g$_0 = 'prolog.argumentation.graph.labelling.grounded.optimized';
2979
+ this.theoryOperators_8xcsny$_0 = DynamicLoader$Companion_getInstance().operators().plusOperatorSet(OperatorSet.Companion.DEFAULT);
2980
+ }
2981
+ Object.defineProperty(GroundedLabellerOptimizedBase.prototype, 'alias', {
2982
+ configurable: true,
2983
+ get: function () {
2984
+ return this.alias_9fhn2g$_0;
2985
+ }
2986
+ });
2987
+ Object.defineProperty(GroundedLabellerOptimizedBase.prototype, 'baseContent', {
2988
+ configurable: true,
2989
+ get: function () {
2990
+ return Library.Companion.aliased(this.alias, void 0, this.prologTheory);
2991
+ }
2992
+ });
2993
+ Object.defineProperty(GroundedLabellerOptimizedBase.prototype, 'baseFlags', {
2994
+ configurable: true,
2995
+ get: function () {
2996
+ return emptyList();
2997
+ }
2998
+ });
2999
+ GroundedLabellerOptimizedBase.prototype.identifier = function () {
3000
+ return 'grounded_hash';
3001
+ };
3002
+ Object.defineProperty(GroundedLabellerOptimizedBase.prototype, 'theoryOperators', {
3003
+ configurable: true,
3004
+ get: function () {
3005
+ return this.theoryOperators_8xcsny$_0;
3006
+ }
3007
+ });
3008
+ GroundedLabellerOptimizedBase.$metadata$ = {
3009
+ kind: Kind_CLASS,
3010
+ simpleName: 'GroundedLabellerOptimizedBase',
3011
+ interfaces: [Loadable, LazyRawPrologContent, ArgLibrary]
3012
+ };
2957
3013
  function PassThroughStatementLabeller() {
2958
3014
  PassThroughStatementLabeller_instance = this;
2959
3015
  this.alias_as0zmd$_0 = 'prolog.argumentation.graph.labelling.statement.pt';
@@ -3082,7 +3138,9 @@
3082
3138
  return $receiver.descriptionPair;
3083
3139
  }.bind(null, DefeasibleRules_getInstance())).get(), getPropertyCallableRef('descriptionPair', 0, function ($receiver) {
3084
3140
  return $receiver.descriptionPair;
3085
- }.bind(null, ExtractStrictIds_getInstance())).get()]), this.prologTheory, RuleParserBase$Companion_getInstance().operators());
3141
+ }.bind(null, ExtractStrictIds_getInstance())).get(), getPropertyCallableRef('descriptionPair', 0, function ($receiver) {
3142
+ return $receiver.descriptionPair;
3143
+ }.bind(null, RuleToClause_getInstance())).get()]), this.prologTheory, RuleParserBase$Companion_getInstance().operators());
3086
3144
  }
3087
3145
  });
3088
3146
  Object.defineProperty(RuleParserBase.prototype, 'baseFlags', {
@@ -3401,7 +3459,7 @@
3401
3459
  tmp$_1 = destination.iterator();
3402
3460
  while (tmp$_1.hasNext()) {
3403
3461
  var item = tmp$_1.next();
3404
- destination_0.add_11rb$(prologScope.listOfAny(['bps', ensureNotNull(item.head)]));
3462
+ destination_0.add_11rb$(Struct.Companion.of('abstractBp', [prologScope.listOfIterable(ensureNotNull(item.head).argsList)]));
3405
3463
  }
3406
3464
  return toTerm(destination_0);
3407
3465
  }
@@ -3448,6 +3506,50 @@
3448
3506
  new ExtractStrictIds();
3449
3507
  }return ExtractStrictIds_instance;
3450
3508
  }
3509
+ function RuleToClause() {
3510
+ RuleToClause_instance = this;
3511
+ BinaryRelation$WithoutSideEffects.call(this, 'rule_to_clause');
3512
+ }
3513
+ RuleToClause.prototype.computeAllSubstitutions_2j1e5m$ = function ($receiver, first, second) {
3514
+ var tmp$ = Substitution.Companion;
3515
+ var tmp$_0 = ensureNotNull(second.asVar());
3516
+ var tmp$_1 = List.Companion;
3517
+ var $receiver_0 = ensureNotNull(first.asList()).toList();
3518
+ var destination = ArrayList_init(collectionSizeOrDefault($receiver_0, 10));
3519
+ var tmp$_2;
3520
+ tmp$_2 = $receiver_0.iterator();
3521
+ loop_label: while (tmp$_2.hasNext()) {
3522
+ var item = tmp$_2.next();
3523
+ var tmp$_3 = destination.add_11rb$;
3524
+ var it = ensureNotNull(item.asList()).toList();
3525
+ var block$result;
3526
+ block$break: do {
3527
+ switch (it.size) {
3528
+ case 2:
3529
+ block$result = Clause.Companion.of(Struct.Companion.of('rl', [it.get_za3lpa$(1)]), [item]);
3530
+ break block$break;
3531
+ case 3:
3532
+ block$result = Clause.Companion.of(Struct.Companion.of('rl', [it.get_za3lpa$(2)]), [item]);
3533
+ break block$break;
3534
+ default:throw IllegalArgumentException_init();
3535
+ }
3536
+ }
3537
+ while (false);
3538
+ tmp$_3.call(destination, block$result);
3539
+ }
3540
+ return sequenceOf([tmp$.of(tmp$_0, tmp$_1.ofList(destination))]);
3541
+ };
3542
+ RuleToClause.$metadata$ = {
3543
+ kind: Kind_OBJECT,
3544
+ simpleName: 'RuleToClause',
3545
+ interfaces: [BinaryRelation$WithoutSideEffects]
3546
+ };
3547
+ var RuleToClause_instance = null;
3548
+ function RuleToClause_getInstance() {
3549
+ if (RuleToClause_instance === null) {
3550
+ new RuleToClause();
3551
+ }return RuleToClause_instance;
3552
+ }
3451
3553
  function StructuredModeBase() {
3452
3554
  LazyRawPrologContent.call(this);
3453
3555
  this.alias_k0m5up$_0 = 'prolog.argumentation.structured';
@@ -3669,7 +3771,10 @@
3669
3771
  tmp$_1 = Library.Companion;
3670
3772
  tmp$ = this.alias;
3671
3773
  tmp$_0 = this.prologTheory;
3672
- return tmp$_1.aliased(tmp$, mapOf_0([to(AppendOptimized_getInstance().signature, AppendOptimized_getInstance()), to(AssertAll_getInstance().signature, AssertAll_getInstance())]), tmp$_0);
3774
+ var tmp$_2 = to(AppendOptimized_getInstance().signature, AppendOptimized_getInstance());
3775
+ var tmp$_3 = to(AssertAll_getInstance().signature, AssertAll_getInstance());
3776
+ var $this = ArgumentHash_getInstance();
3777
+ return tmp$_1.aliased(tmp$, mapOf_0([tmp$_2, tmp$_3, to($this.signature, $this.wrappedImplementation), to(Contains_getInstance().signature, Contains_getInstance()), to(ContainsAny_getInstance().signature, ContainsAny_getInstance())]), tmp$_0);
3673
3778
  }
3674
3779
  });
3675
3780
  Object.defineProperty(UtilsBase.prototype, 'baseFlags', {
@@ -3779,7 +3884,7 @@
3779
3884
  }
3780
3885
  function AssertAll$solve$lambda(closure$list, closure$request) {
3781
3886
  return function ($receiver) {
3782
- var $receiver_0 = closure$list.toSequence();
3887
+ var $receiver_0 = closure$list.toList();
3783
3888
  var tmp$;
3784
3889
  tmp$ = $receiver_0.iterator();
3785
3890
  while (tmp$.hasNext()) {
@@ -3858,6 +3963,224 @@
3858
3963
  new AssertAll();
3859
3964
  }return AssertAll_instance;
3860
3965
  }
3966
+ function ArgumentHash() {
3967
+ ArgumentHash_instance = this;
3968
+ BinaryRelation$WithoutSideEffects.call(this, 'hash');
3969
+ }
3970
+ ArgumentHash.prototype.computeAllSubstitutions_2j1e5m$ = function ($receiver, first, second) {
3971
+ return sequenceOf([Substitution.Companion.of(ensureNotNull(second.asVar()), Numeric.Companion.ofInteger(hashCode(first.toString())))]);
3972
+ };
3973
+ ArgumentHash.$metadata$ = {
3974
+ kind: Kind_OBJECT,
3975
+ simpleName: 'ArgumentHash',
3976
+ interfaces: [BinaryRelation$WithoutSideEffects]
3977
+ };
3978
+ var ArgumentHash_instance = null;
3979
+ function ArgumentHash_getInstance() {
3980
+ if (ArgumentHash_instance === null) {
3981
+ new ArgumentHash();
3982
+ }return ArgumentHash_instance;
3983
+ }
3984
+ function Contains() {
3985
+ Contains_instance = this;
3986
+ this.signature = new Signature('contains', 2);
3987
+ }
3988
+ function Coroutine$Contains$solve$lambda(closure$request_0, closure$list_0, closure$elem_0, $receiver_0, controller, continuation_0) {
3989
+ CoroutineImpl.call(this, continuation_0);
3990
+ this.$controller = controller;
3991
+ this.exceptionState_0 = 1;
3992
+ this.local$closure$request = closure$request_0;
3993
+ this.local$closure$list = closure$list_0;
3994
+ this.local$closure$elem = closure$elem_0;
3995
+ this.local$$receiver = $receiver_0;
3996
+ }
3997
+ Coroutine$Contains$solve$lambda.$metadata$ = {
3998
+ kind: Kotlin.Kind.CLASS,
3999
+ simpleName: null,
4000
+ interfaces: [CoroutineImpl]
4001
+ };
4002
+ Coroutine$Contains$solve$lambda.prototype = Object.create(CoroutineImpl.prototype);
4003
+ Coroutine$Contains$solve$lambda.prototype.constructor = Coroutine$Contains$solve$lambda;
4004
+ Coroutine$Contains$solve$lambda.prototype.doResume = function () {
4005
+ do
4006
+ try {
4007
+ switch (this.state_0) {
4008
+ case 0:
4009
+ var tmp$ = this.local$closure$request;
4010
+ var $receiver = this.local$closure$list.toList();
4011
+ var any$result;
4012
+ any$break: do {
4013
+ var tmp$_0;
4014
+ if (Kotlin.isType($receiver, Collection) && $receiver.isEmpty()) {
4015
+ any$result = false;
4016
+ break any$break;
4017
+ }tmp$_0 = $receiver.iterator();
4018
+ while (tmp$_0.hasNext()) {
4019
+ var element = tmp$_0.next();
4020
+ var closure$elem = this.local$closure$elem;
4021
+ if (Unificator.Companion.default.match(element, closure$elem)) {
4022
+ any$result = true;
4023
+ break any$break;
4024
+ }}
4025
+ any$result = false;
4026
+ }
4027
+ while (false);
4028
+ this.state_0 = 2;
4029
+ this.result_0 = this.local$$receiver.yield_11rb$(tmp$.replyWithCondition(any$result, void 0, []), this);
4030
+ if (this.result_0 === COROUTINE_SUSPENDED)
4031
+ return COROUTINE_SUSPENDED;
4032
+ continue;
4033
+ case 1:
4034
+ throw this.exception_0;
4035
+ case 2:
4036
+ return this.result_0;
4037
+ default:this.state_0 = 1;
4038
+ throw new Error('State Machine Unreachable execution');
4039
+ }
4040
+ } catch (e) {
4041
+ if (this.state_0 === 1) {
4042
+ this.exceptionState_0 = this.state_0;
4043
+ throw e;
4044
+ } else {
4045
+ this.state_0 = this.exceptionState_0;
4046
+ this.exception_0 = e;
4047
+ }
4048
+ }
4049
+ while (true);
4050
+ };
4051
+ function Contains$solve$lambda(closure$request_0, closure$list_0, closure$elem_0) {
4052
+ return function ($receiver_0, continuation_0, suspended) {
4053
+ var instance = new Coroutine$Contains$solve$lambda(closure$request_0, closure$list_0, closure$elem_0, $receiver_0, this, continuation_0);
4054
+ if (suspended)
4055
+ return instance;
4056
+ else
4057
+ return instance.doResume(null);
4058
+ };
4059
+ }
4060
+ Contains.prototype.solve = function (request) {
4061
+ var elem = request.arguments.get_za3lpa$(0);
4062
+ var list = request.arguments.get_za3lpa$(1);
4063
+ if (!Kotlin.isType(list, List)) {
4064
+ throw TypeError.Companion.forGoal(request.context, request.signature, TypeError$Expected.LIST, list);
4065
+ }return sequence(Contains$solve$lambda(request, list, elem));
4066
+ };
4067
+ Contains.$metadata$ = {
4068
+ kind: Kind_OBJECT,
4069
+ simpleName: 'Contains',
4070
+ interfaces: [Primitive]
4071
+ };
4072
+ var Contains_instance = null;
4073
+ function Contains_getInstance() {
4074
+ if (Contains_instance === null) {
4075
+ new Contains();
4076
+ }return Contains_instance;
4077
+ }
4078
+ function ContainsAny() {
4079
+ ContainsAny_instance = this;
4080
+ this.signature = new Signature('contains_any', 2);
4081
+ }
4082
+ function Coroutine$ContainsAny$solve$lambda(closure$request_0, closure$list_0, closure$elemList_0, $receiver_0, controller, continuation_0) {
4083
+ CoroutineImpl.call(this, continuation_0);
4084
+ this.$controller = controller;
4085
+ this.exceptionState_0 = 1;
4086
+ this.local$closure$request = closure$request_0;
4087
+ this.local$closure$list = closure$list_0;
4088
+ this.local$closure$elemList = closure$elemList_0;
4089
+ this.local$$receiver = $receiver_0;
4090
+ }
4091
+ Coroutine$ContainsAny$solve$lambda.$metadata$ = {
4092
+ kind: Kotlin.Kind.CLASS,
4093
+ simpleName: null,
4094
+ interfaces: [CoroutineImpl]
4095
+ };
4096
+ Coroutine$ContainsAny$solve$lambda.prototype = Object.create(CoroutineImpl.prototype);
4097
+ Coroutine$ContainsAny$solve$lambda.prototype.constructor = Coroutine$ContainsAny$solve$lambda;
4098
+ Coroutine$ContainsAny$solve$lambda.prototype.doResume = function () {
4099
+ do
4100
+ try {
4101
+ switch (this.state_0) {
4102
+ case 0:
4103
+ var tmp$ = this.local$closure$request;
4104
+ var $receiver = this.local$closure$list.toSequence();
4105
+ var any$result;
4106
+ any$break: do {
4107
+ var tmp$_0;
4108
+ tmp$_0 = $receiver.iterator();
4109
+ loop_label: while (tmp$_0.hasNext()) {
4110
+ var element = tmp$_0.next();
4111
+ var $receiver_0 = this.local$closure$elemList.toSequence();
4112
+ var any$result_0;
4113
+ any$break_0: do {
4114
+ var tmp$_1;
4115
+ tmp$_1 = $receiver_0.iterator();
4116
+ while (tmp$_1.hasNext()) {
4117
+ var element_0 = tmp$_1.next();
4118
+ if (Unificator.Companion.default.match(element, element_0)) {
4119
+ any$result_0 = true;
4120
+ break any$break_0;
4121
+ }}
4122
+ any$result_0 = false;
4123
+ }
4124
+ while (false);
4125
+ if (any$result_0) {
4126
+ any$result = true;
4127
+ break any$break;
4128
+ }}
4129
+ any$result = false;
4130
+ }
4131
+ while (false);
4132
+ this.state_0 = 2;
4133
+ this.result_0 = this.local$$receiver.yield_11rb$(tmp$.replyWithCondition(any$result, void 0, []), this);
4134
+ if (this.result_0 === COROUTINE_SUSPENDED)
4135
+ return COROUTINE_SUSPENDED;
4136
+ continue;
4137
+ case 1:
4138
+ throw this.exception_0;
4139
+ case 2:
4140
+ return this.result_0;
4141
+ default:this.state_0 = 1;
4142
+ throw new Error('State Machine Unreachable execution');
4143
+ }
4144
+ } catch (e) {
4145
+ if (this.state_0 === 1) {
4146
+ this.exceptionState_0 = this.state_0;
4147
+ throw e;
4148
+ } else {
4149
+ this.state_0 = this.exceptionState_0;
4150
+ this.exception_0 = e;
4151
+ }
4152
+ }
4153
+ while (true);
4154
+ };
4155
+ function ContainsAny$solve$lambda(closure$request_0, closure$list_0, closure$elemList_0) {
4156
+ return function ($receiver_0, continuation_0, suspended) {
4157
+ var instance = new Coroutine$ContainsAny$solve$lambda(closure$request_0, closure$list_0, closure$elemList_0, $receiver_0, this, continuation_0);
4158
+ if (suspended)
4159
+ return instance;
4160
+ else
4161
+ return instance.doResume(null);
4162
+ };
4163
+ }
4164
+ ContainsAny.prototype.solve = function (request) {
4165
+ var elemList = request.arguments.get_za3lpa$(0);
4166
+ var list = request.arguments.get_za3lpa$(1);
4167
+ if (!Kotlin.isType(list, List)) {
4168
+ throw TypeError.Companion.forGoal(request.context, request.signature, TypeError$Expected.LIST, list);
4169
+ }if (!Kotlin.isType(elemList, List)) {
4170
+ throw TypeError.Companion.forGoal(request.context, request.signature, TypeError$Expected.LIST, list);
4171
+ }return sequence(ContainsAny$solve$lambda(request, list, elemList));
4172
+ };
4173
+ ContainsAny.$metadata$ = {
4174
+ kind: Kind_OBJECT,
4175
+ simpleName: 'ContainsAny',
4176
+ interfaces: [Primitive]
4177
+ };
4178
+ var ContainsAny_instance = null;
4179
+ function ContainsAny_getInstance() {
4180
+ if (ContainsAny_instance === null) {
4181
+ new ContainsAny();
4182
+ }return ContainsAny_instance;
4183
+ }
3861
4184
  function MetaInterpreterLib() {
3862
4185
  MetaInterpreterLib_instance = this;
3863
4186
  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 ')));
@@ -4127,7 +4450,7 @@
4127
4450
  }
4128
4451
  });
4129
4452
  Argument.prototype.termRepresentation = function () {
4130
- return parse_1(Struct.Companion, '[' + this.rules + ', ' + this.topRule + ', ' + this.conclusion + ', ' + this.groundings + ', [' + this.lastDefeasibleRules + ', ' + this.defeasibleRules + ', ' + this.defeasiblePremises + ']]');
4453
+ return parse_1(Struct.Companion, '[' + this.rules + ', ' + this.topRule + ', [' + this.conclusion + '], ' + this.groundings + ', [' + this.lastDefeasibleRules + ', ' + this.defeasibleRules + ', ' + this.defeasiblePremises + ']]');
4131
4454
  };
4132
4455
  Argument.prototype.toString = function () {
4133
4456
  return 'argument(' + this.termRepresentation() + ')';
@@ -4163,7 +4486,7 @@
4163
4486
  return argument.get_za3lpa$(1).toString();
4164
4487
  }
4165
4488
  function Argument$Companion$of$argConclusion(argument) {
4166
- return argument.get_za3lpa$(2).toString();
4489
+ return ensureNotNull(argument.get_za3lpa$(2).asList()).get(0).toString();
4167
4490
  }
4168
4491
  function Argument$Companion$of$argGroundings(closure$toStringList) {
4169
4492
  return function (argument) {
@@ -4424,7 +4747,7 @@
4424
4747
  }
4425
4748
  });
4426
4749
  Premise.prototype.toString = function () {
4427
- return 'premise([' + this.identifier + ', ' + this.conclusion + '])';
4750
+ return 'rl(' + this.conclusion + ') :- ([' + this.identifier + ', ' + this.conclusion + '])';
4428
4751
  };
4429
4752
  Premise.$metadata$ = {
4430
4753
  kind: Kind_CLASS,
@@ -4472,7 +4795,7 @@
4472
4795
  }
4473
4796
  });
4474
4797
  Rule.prototype.toString = function () {
4475
- return 'rule([' + this.identifier + ', ' + this.premises + ', ' + this.conclusion + '])';
4798
+ return 'rl(' + this.conclusion + ') :- [' + this.identifier + ', ' + this.premises + ', ' + this.conclusion + ']';
4476
4799
  };
4477
4800
  Rule.$metadata$ = {
4478
4801
  kind: Kind_CLASS,
@@ -4811,6 +5134,27 @@
4811
5134
  new GroundedLabeller();
4812
5135
  }return GroundedLabeller_instance;
4813
5136
  }
5137
+ function GroundedLabellerOptimized() {
5138
+ GroundedLabellerOptimized_instance = this;
5139
+ GroundedLabellerOptimizedBase.call(this);
5140
+ }
5141
+ Object.defineProperty(GroundedLabellerOptimized.prototype, 'prologRawTheory', {
5142
+ configurable: true,
5143
+ get: function () {
5144
+ return GroundedOptimized_getInstance().theoryCode;
5145
+ }
5146
+ });
5147
+ GroundedLabellerOptimized.$metadata$ = {
5148
+ kind: Kind_OBJECT,
5149
+ simpleName: 'GroundedLabellerOptimized',
5150
+ interfaces: [GroundedLabellerOptimizedBase]
5151
+ };
5152
+ var GroundedLabellerOptimized_instance = null;
5153
+ function GroundedLabellerOptimized_getInstance() {
5154
+ if (GroundedLabellerOptimized_instance === null) {
5155
+ new GroundedLabellerOptimized();
5156
+ }return GroundedLabellerOptimized_instance;
5157
+ }
4814
5158
  function StatementLabeller() {
4815
5159
  StatementLabeller_instance = this;
4816
5160
  StatementLabellerBase.call(this);
@@ -4870,7 +5214,7 @@
4870
5214
  }
4871
5215
  function ArgumentationEngineInterface() {
4872
5216
  ArgumentationEngineInterface_instance = this;
4873
- 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 debug::printTheory(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 ');
5217
+ 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 ');
4874
5218
  }
4875
5219
  ArgumentationEngineInterface.$metadata$ = {
4876
5220
  kind: Kind_OBJECT,
@@ -4885,7 +5229,7 @@
4885
5229
  }
4886
5230
  function ArgumentationGraph() {
4887
5231
  ArgumentationGraph_instance = this;
4888
- this.theoryCode = trimIndent('\n buildArgumentationGraph :-\n buildArguments,\n buildAttacks.\n buildArguments :-\n \tbuildArgumentsFromPremises,\n \tbuildArgumentsFromEmptyRules,\n \tfindall([RuleID, RuleBody, RuleHead], (\n \t context_check(rule([RuleID, RuleBody, RuleHead])),\n \t \\+ emptyRule([RuleID, RuleBody, RuleHead])\n ), Rules),\n \tbuildArgumentsFromRules(Rules, Rules, n).\n buildArgumentsFromPremises :-\n findall(\n _,\n (\n context_check(premise([PremiseID, Premise])),\n checkStrict(PremiseID, DefPrem),\n ground(Premise),\n context_assert(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 ),\n _\n ).\n emptyRule([RuleID, [], RuleHead]) :-\n context_check(rule([RuleID, [], RuleHead])).\n emptyRule([RuleID, [[unless, X]], RuleHead]) :-\n context_check(rule([RuleID, [[unless, X]], RuleHead])).\n emptyRule([RuleID, [[prolog(Check)]], RuleHead]) :-\n context_check(rule([RuleID, [[prolog(Check)]], RuleHead])),\n (callable(Check) -> call(Check); Check).\n buildArgumentsFromRules(Rules, [], n).\n buildArgumentsFromRules(Rules, [], y) :- buildArgumentsFromRules(Rules, Rules, n).\n buildArgumentsFromRules(Rules, [H|T], _) :-\n copy_term(H, HH),\n buildArgumentsFromRule(HH),\n buildArgumentsFromRules(Rules, T, y), !.\n buildArgumentsFromRules(Rules, [_|T], X) :-\n buildArgumentsFromRules(Rules, T, X).\n buildArgumentsFromRule([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 \tcontext_assert(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]) :- \\+ context_check(strict(Id)).\n checkStrict(Id, []) :- context_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, \\+ context_check(strict(TopRule)).\n lastDefeasibleRules(Supports, TopRule, LastRules) :-\n \tcontext_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([ [unless, _] | 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(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(Head, Conf).\n findPossibleAttackers([_, _, _, Prem, _], [_, _, Conf, _, _]) :-\n member([unless, Conf], Prem).\n findPossibleAttackers([_, RuleID, _, _, _], [_, _, [undercut(RuleID)], _, _]).\n buildAttacks :-\n findall(X, context_check(argument(X)), Args),\n \tbuildDirectAttacks(Args),\n \tbuildTransitiveAttacks.\n buildDirectAttacks([]).\n buildDirectAttacks([H|T]) :-\n findall(_, buildDirectAttack(H), _),\n buildDirectAttacks(T).\n buildDirectAttack(A) :-\n \tcontext_check(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 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 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 rebuts([IDPremisesA, RuleA, RuleHeadA, _, _], [IDPremisesB, RuleB, RuleHeadB, _, Info]) :-\n \tRuleB \\== none,\n Info \\== [[], [], []],\n \tconflict(RuleHeadA, RuleHeadB).\n contraryRebuts([IDPremisesA, RuleA, RuleHeadA, _, _], [IDPremisesB, RuleB, RuleHeadB, Body, Info]) :-\n \tRuleA \\== none,\n \tRuleB \\== none,\n \tmember([unless, RuleHeadA], Body).\n undermines([IDPremisesA, RuleA, RuleHeadA, _, _], [[IDPremiseB], none, RuleHeadB, _, Info]) :-\n \tInfo \\== [[], [], []],\n \tconflict(RuleHeadA, RuleHeadB).\n contraryUndermines([IDPremisesA, none, RuleHeadA, _, _], [IDPremisesB, RuleB, RuleHeadB, Body, Info]) :-\n \tRuleB \\== none,\n \tmember([unless, RuleHeadA], Body).\n undercuts([_, _, [undercut(RuleB)], _, _], [_, RuleB, _, _, [[RuleB], _, _]]).\n conflict( [Atom], [neg, Atom]).\n conflict( [neg, Atom], [Atom]).\n conflict( [obl, [Atom]], [obl, [neg, Atom]]).\n conflict( [obl, [neg, Atom]], [obl, [Atom]]).\n conflict( [obl, Lit], [neg, obl, Lit]).\n conflict( [neg, obl, Lit], [obl, Lit]).\n conflict( [perm, [Atom]], [obl, [neg, Atom]]).\n conflict( [obl, [neg, Atom]], [perm, [Atom]]).\n conflict( [perm, [neg, Atom]], [obl, [Atom]]).\n conflict( [obl, [Atom]], [perm, [neg, Atom]]).\n conflict([bp, Atom], [neg, bp, Atom]).\n conflict([neg, bp, Atom], [bp, Atom]).\n conflict([sup(X, Y)], [sup(Y, X)]).\n ');
5232
+ 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 findall(X, context_check(newConc(a, [X])), N),\n \tbuildArgumentsFromRules(N, 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(RuleHead) :- argument([[RuleID], RuleID, RuleHead, RulePrem, [DefRule, DefRule, []]])),\n context_assert(newConc(a, RuleHead)),\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 findall(X, context_check(newConc(Tn, [X])), N),\n buildArgumentsFromRules(N, Tx, Rules, Rules, n).\n invert(a, b).\n invert(b, a).\n buildArgumentsFromRules(_, _, Rules, [], n) :- !.\n buildArgumentsFromRules(_, Tn, Rules, [], y) :- !, clean(Tn, Rules).\n buildArgumentsFromRules(N, Tn, Rules, [[Id, Body, Conc]|T], _) :-\n utils::contains_any(Body, N),\n findall(true, buildArgumentsFromRule(Tn, [Id, Body, Conc]), R),\n R \\== [],\n buildArgumentsFromRules(N, Tn, Rules, T, y), !.\n buildArgumentsFromRules(N, Tn, Rules, [_|T], X) :-\n buildArgumentsFromRules(N, Tn, Rules, T, X).\n buildArgumentsFromRule(Tn, [RuleID, RuleBody, RuleHead]) :-\n \truleBodyIsSupported(RuleID, RuleHead, RuleBody, RuleBody, [[], [], [], []], Argument),\n context_assert(newConc(Tn, RuleHead)).\n checkStrict(Id, []) :- parser::check_strict(Id), !.\n checkStrict(Id, [Id]).\n defRules(Id, Def, Def) :- parser::check_strict(Id), !.\n defRules(Id, Def, [Id|Def]).\n lastDefRules(Id, LDef, LDef) :- parser::check_strict(Id), !.\n lastDefRules(Id, LDef, [Id]) :- Id \\== none, \\+ parser::check_strict(Id).\n argumentInfo(RuleId, LDef, Def, Prem, [FLDef, FDef, FPrem]) :-\n utils::sortDistinct(Prem, FPrem),\n defRules(RuleId, Def, NDef),\n utils::sortDistinct(NDef, FDef),\n lastDefRules(RuleId, LDef, NLDef),\n utils::sortDistinct(NLDef, FLDef).\n ruleBodyIsSupported(RuleID, RuleHead, RuleBody, [], [TAll, TLDef, TDef, TPrem], Argument) :-\n ground(RuleHead),\n \\+ context_check(clause(conc(RuleHead), argument([_, RuleID, RuleHead, RuleBody, _]))),\n utils::appendLists(TAll, All),\n \\+ utils::contains(RuleID, All),\n utils::appendLists(TLDef, LDef),\n utils::appendLists(TDef, Def),\n utils::appendLists(TPrem, Prem),\n argumentInfo(RuleID, LDef, Def, Prem, Info),\n utils::sort([RuleID|All], Rules),\n Argument = [Rules, RuleID, RuleHead, RuleBody, Info],\n context_assert(conc(RuleHead) :- argument(Argument)),\n context_assert(argument(Argument)),\n utils::hash(argument(Argument), Id),\n context_assert(arg(Id) :- argument(Argument)).\n ruleBodyIsSupported(RuleID, RuleHead, RuleBody, [~(_)|Others], Info, Argument) :-\n \truleBodyIsSupported(RuleID, RuleHead, RuleBody, Others, Info, Argument).\n ruleBodyIsSupported(RuleID, RuleHead, RuleBody, [prolog(Check)|Others], Info, Argument) :-\n \t(callable(Check) -> call(Check); Check),\n \truleBodyIsSupported(RuleID, RuleHead, RuleBody, Others, Info, Argument).\n ruleBodyIsSupported(RuleId, RuleHead, RuleBody, [Statement|Others], [All, LDef, Def, Prem], Argument) :-\n context_check(clause(conc([Statement]), argument([ArgumentID, RuleID, [Statement], Body, [NLDef, NDef, NPrem]]))),\n \truleBodyIsSupported(RuleId, RuleHead, RuleBody, Others, [[ArgumentID|All], [NLDef|LDef], [NDef|Def], [NPrem|Prem]], Argument),\n \tcontext_assert(support([ArgumentID, RuleID, [Statement], Body, [NLDef, NDef, NPrem]], Argument)).\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 \tutils::contains(~(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 \tutils::contains(~(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 ');
4889
5233
  }
4890
5234
  ArgumentationGraph.$metadata$ = {
4891
5235
  kind: Kind_OBJECT,
@@ -4930,7 +5274,7 @@
4930
5274
  }
4931
5275
  function BpGrounded() {
4932
5276
  BpGrounded_instance = this;
4933
- 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([_, _, Conclusion, _, _])),\n fillTemplate(T, R).\n ');
5277
+ 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 ');
4934
5278
  }
4935
5279
  BpGrounded.$metadata$ = {
4936
5280
  kind: Kind_OBJECT,
@@ -5035,7 +5379,7 @@
5035
5379
  }
5036
5380
  function Grounded() {
5037
5381
  Grounded_instance = this;
5038
- 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 ');
5382
+ 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 ');
5039
5383
  }
5040
5384
  Grounded.$metadata$ = {
5041
5385
  kind: Kind_OBJECT,
@@ -5048,9 +5392,24 @@
5048
5392
  new Grounded();
5049
5393
  }return Grounded_instance;
5050
5394
  }
5395
+ function GroundedOptimized() {
5396
+ GroundedOptimized_instance = this;
5397
+ 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 ');
5398
+ }
5399
+ GroundedOptimized.$metadata$ = {
5400
+ kind: Kind_OBJECT,
5401
+ simpleName: 'GroundedOptimized',
5402
+ interfaces: []
5403
+ };
5404
+ var GroundedOptimized_instance = null;
5405
+ function GroundedOptimized_getInstance() {
5406
+ if (GroundedOptimized_instance === null) {
5407
+ new GroundedOptimized();
5408
+ }return GroundedOptimized_instance;
5409
+ }
5051
5410
  function Preferences() {
5052
5411
  Preferences_instance = this;
5053
- 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 ');
5412
+ 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 ');
5054
5413
  }
5055
5414
  Preferences.$metadata$ = {
5056
5415
  kind: Kind_OBJECT,
@@ -5065,7 +5424,7 @@
5065
5424
  }
5066
5425
  function QueryMode_0() {
5067
5426
  QueryMode_instance_0 = this;
5068
- 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 parser::check_modifiers_in_list(effects, [Goal], [X]),\n findall(_, query(X, _), _),\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 parser::check_modifiers_in_list(effects, [Goal], [X]),\n findall(Goal, context_check(statIn(X)), In),\n findall(Goal, context_check(statOut(X)), Out),\n findall(Goal, context_check(statUnd(X)), 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 \\+ context_check(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 buildArgument([undercut(Rule)], Argument).\n attackerOnTerm(Term, [TargetRules, TopRule, Conclusion, Groundings, ArgInfo], Attacker, direct) :-\n Term \\= [unless, _],\n \\+ strict([TargetRules, TopRule, Conclusion, Groundings, ArgInfo]),\n (graphExtension(rebutRestriction) ->\n (\n buildSubArgument(Term, TargetRules, SubArgument),\n rebutRestriction(SubArgument)\n );\n true\n ),\n standard_af::conflict(Term, X),\n buildArgument(X, Attacker),\n (graphExtension(standardPref) ->\n (ground(SubArgument) ->\n true;\n buildSubArgument(Term, TargetRules, SubArgument)\n ),\n \\+ superiorArgument(SubArgument, Attacker);\n true\n ).\n attackerOnTerm([unless, X], _, Attacker, contrary) :-\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 buildSubArgument(Term, Rules, [SubRules, SubTopRule, SubConclusion, SubGrounds, Info]) :-\n buildArgument(Term, [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(Conclusion, _, [Conclusion], Rules) :-\n context_check(premise([Id, Conclusion])),\n premiseRules(Id, Rules).\n build(Conclusion, Ids, [Conclusion|Conclusions], Rules) :-\n context_check(rule([Id, Premises, Conclusion])),\n \\+ member(Id, Ids),\n buildPremises(Premises, [Id|Ids], Conclusions, ResRules),\n ruleRules(Id, ResRules, Rules).\n build([prolog(Check)], _, [], []) :- (callable(Check) -> call(Check); Check).\n build([unless, Atom], _, [[unless, Atom]], []).\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]]) :- \\+ context_check(strict(Id)).\n premiseRules(Id, [[Id], none, [], [], []]) :- context_check(strict(Id)).\n ruleRules(Id, [AllRules, _, DefRules, DefPremises], \n [[Id|AllRules], Id, [Id], [Id|DefRules], DefPremises]) :- \\+ context_check(strict(Id)).\n ruleRules(Id, [AllRules, LastDefRules, DefRules, DefPremises], \n [[Id|AllRules], Id, LastDefRules, DefRules, DefPremises]) :- context_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 ');
5427
+ 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 ');
5069
5428
  }
5070
5429
  QueryMode_0.$metadata$ = {
5071
5430
  kind: Kind_OBJECT,
@@ -5080,7 +5439,7 @@
5080
5439
  }
5081
5440
  function RuleTranslator() {
5082
5441
  RuleTranslator_instance = this;
5083
- 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), Sup),\n utils::appendLists([Rules, AxiomsIds, RulesIds, Sup], 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 /*\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 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 ");
5442
+ 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 ");
5084
5443
  }
5085
5444
  RuleTranslator.$metadata$ = {
5086
5445
  kind: Kind_OBJECT,
@@ -5315,6 +5674,7 @@
5315
5674
  package$labelling.BpPartialLabellerBase = BpPartialLabellerBase;
5316
5675
  package$labelling.CompleteLabellerBase = CompleteLabellerBase;
5317
5676
  package$labelling.GroundedLabellerBase = GroundedLabellerBase;
5677
+ package$labelling.GroundedLabellerOptimizedBase = GroundedLabellerOptimizedBase;
5318
5678
  Object.defineProperty(package$labelling, 'PassThroughStatementLabeller', {
5319
5679
  get: PassThroughStatementLabeller_getInstance
5320
5680
  });
@@ -5351,6 +5711,9 @@
5351
5711
  Object.defineProperty(package$language, 'ExtractStrictIds', {
5352
5712
  get: ExtractStrictIds_getInstance
5353
5713
  });
5714
+ Object.defineProperty(package$language, 'RuleToClause', {
5715
+ get: RuleToClause_getInstance
5716
+ });
5354
5717
  var package$structured = package$libs.structured || (package$libs.structured = {});
5355
5718
  package$structured.StructuredModeBase = StructuredModeBase;
5356
5719
  Object.defineProperty(package$structured, 'QueryMode', {
@@ -5368,6 +5731,7 @@
5368
5731
  Object.defineProperty(package$utils, 'OrderingComparator', {
5369
5732
  get: OrderingComparator_getInstance
5370
5733
  });
5734
+ $$importsForInline$$['@tuprolog/2p-solve'] = $module$_2p_solve;
5371
5735
  package$utils.UtilsBase = UtilsBase;
5372
5736
  Object.defineProperty(package$utils, 'AppendOptimized', {
5373
5737
  get: AppendOptimized_getInstance
@@ -5375,6 +5739,15 @@
5375
5739
  Object.defineProperty(package$utils, 'AssertAll', {
5376
5740
  get: AssertAll_getInstance
5377
5741
  });
5742
+ Object.defineProperty(package$utils, 'ArgumentHash', {
5743
+ get: ArgumentHash_getInstance
5744
+ });
5745
+ Object.defineProperty(package$utils, 'Contains', {
5746
+ get: Contains_getInstance
5747
+ });
5748
+ Object.defineProperty(package$utils, 'ContainsAny', {
5749
+ get: ContainsAny_getInstance
5750
+ });
5378
5751
  var package$meta = package$core.meta || (package$core.meta = {});
5379
5752
  Object.defineProperty(package$meta, 'MetaInterpreterLib', {
5380
5753
  get: MetaInterpreterLib_getInstance
@@ -5439,6 +5812,9 @@
5439
5812
  Object.defineProperty(package$labelling, 'GroundedLabeller', {
5440
5813
  get: GroundedLabeller_getInstance
5441
5814
  });
5815
+ Object.defineProperty(package$labelling, 'GroundedLabellerOptimized', {
5816
+ get: GroundedLabellerOptimized_getInstance
5817
+ });
5442
5818
  Object.defineProperty(package$labelling, 'StatementLabeller', {
5443
5819
  get: StatementLabeller_getInstance
5444
5820
  });
@@ -5485,6 +5861,9 @@
5485
5861
  Object.defineProperty(package$sources, 'Grounded', {
5486
5862
  get: Grounded_getInstance
5487
5863
  });
5864
+ Object.defineProperty(package$sources, 'GroundedOptimized', {
5865
+ get: GroundedOptimized_getInstance
5866
+ });
5488
5867
  Object.defineProperty(package$sources, 'Preferences', {
5489
5868
  get: Preferences_getInstance
5490
5869
  });
@@ -5632,21 +6011,17 @@
5632
6011
  PrologWithArgumentation.prototype.unifyWithOccurCheck = PrologScopeWithTheories.prototype.unifyWithOccurCheck;
5633
6012
  PrologWithArgumentation.prototype.var1 = PrologScopeWithTheories.prototype.var1;
5634
6013
  PrologWithArgumentation.prototype.write1 = PrologScopeWithTheories.prototype.write1;
5635
- PrologWithArgumentation.prototype.neq2 = PrologScopeWithTheories.prototype.neq2;
5636
- PrologWithArgumentation.prototype.nid2 = PrologScopeWithTheories.prototype.nid2;
5637
- PrologWithArgumentation.prototype.power = PrologScopeWithTheories.prototype.power;
5638
- PrologWithArgumentation.prototype.eq2 = PrologScopeWithTheories.prototype.eq2;
5639
- PrologWithArgumentation.prototype.arithNeq2 = PrologScopeWithTheories.prototype.arithNeq2;
5640
- PrologWithArgumentation.prototype.id2 = PrologScopeWithTheories.prototype.id2;
5641
- PrologWithArgumentation.prototype.arithEq2 = PrologScopeWithTheories.prototype.arithEq2;
5642
- PrologWithArgumentation.prototype.pow = PrologScopeWithTheories.prototype.pow;
5643
6014
  PrologWithArgumentation.prototype.anyAnd = PrologScopeWithTheories.prototype.anyAnd;
6015
+ PrologWithArgumentation.prototype.arithEq2 = PrologScopeWithTheories.prototype.arithEq2;
6016
+ PrologWithArgumentation.prototype.arithNeq2 = PrologScopeWithTheories.prototype.arithNeq2;
5644
6017
  PrologWithArgumentation.prototype.substitutionContainsKey = PrologScopeWithTheories.prototype.substitutionContainsKey;
5645
6018
  PrologWithArgumentation.prototype.substitutionContainsValue = PrologScopeWithTheories.prototype.substitutionContainsValue;
5646
6019
  PrologWithArgumentation.prototype.anyDiv = PrologScopeWithTheories.prototype.anyDiv;
6020
+ PrologWithArgumentation.prototype.eq2 = PrologScopeWithTheories.prototype.eq2;
5647
6021
  PrologWithArgumentation.prototype.anyEqualsTo = PrologScopeWithTheories.prototype.anyEqualsTo;
5648
6022
  PrologWithArgumentation.prototype.anyGreaterThan = PrologScopeWithTheories.prototype.anyGreaterThan;
5649
6023
  PrologWithArgumentation.prototype.anyGreaterThanOrEqualsTo = PrologScopeWithTheories.prototype.anyGreaterThanOrEqualsTo;
6024
+ PrologWithArgumentation.prototype.id2 = PrologScopeWithTheories.prototype.id2;
5650
6025
  PrologWithArgumentation.prototype.anyIf = PrologScopeWithTheories.prototype.anyIf;
5651
6026
  PrologWithArgumentation.prototype.anyIfVararg = PrologScopeWithTheories.prototype.anyIfVararg;
5652
6027
  PrologWithArgumentation.prototype.anyImpliedBy = PrologScopeWithTheories.prototype.anyImpliedBy;
@@ -5659,6 +6034,8 @@
5659
6034
  PrologWithArgumentation.prototype.anyMatches = PrologScopeWithTheories.prototype.anyMatches;
5660
6035
  PrologWithArgumentation.prototype.anyMguWith = PrologScopeWithTheories.prototype.anyMguWith;
5661
6036
  PrologWithArgumentation.prototype.anyMinus = PrologScopeWithTheories.prototype.anyMinus;
6037
+ PrologWithArgumentation.prototype.neq2 = PrologScopeWithTheories.prototype.neq2;
6038
+ PrologWithArgumentation.prototype.nid2 = PrologScopeWithTheories.prototype.nid2;
5662
6039
  PrologWithArgumentation.prototype.anyNonGreaterThan = PrologScopeWithTheories.prototype.anyNonGreaterThan;
5663
6040
  PrologWithArgumentation.prototype.anyNonLowerThan = PrologScopeWithTheories.prototype.anyNonLowerThan;
5664
6041
  PrologWithArgumentation.prototype.anyNotEqualsTo = PrologScopeWithTheories.prototype.anyNotEqualsTo;
@@ -5693,9 +6070,9 @@
5693
6070
  PrologWithArgumentationImpl.prototype.anyMguWith = PrologWithArgumentation.prototype.anyMguWith;
5694
6071
  PrologWithArgumentationImpl.prototype.anyUnifyWith = PrologWithArgumentation.prototype.anyUnifyWith;
5695
6072
  PrologWithArgumentationImpl.prototype.list = PrologWithArgumentation.prototype.list;
5696
- PrologWithArgumentationImpl.prototype.listFromSequence = PrologWithArgumentation.prototype.listFromSequence;
5697
6073
  PrologWithArgumentationImpl.prototype.listFrom = PrologWithArgumentation.prototype.listFrom;
5698
6074
  PrologWithArgumentationImpl.prototype.listFromIterable = PrologWithArgumentation.prototype.listFromIterable;
6075
+ PrologWithArgumentationImpl.prototype.listFromSequence = PrologWithArgumentation.prototype.listFromSequence;
5699
6076
  PrologWithArgumentationImpl.prototype.matchAny = PrologWithArgumentation.prototype.matchAny;
5700
6077
  PrologWithArgumentationImpl.prototype.mguWithOccurCheck = PrologWithArgumentation.prototype.mguWithOccurCheck;
5701
6078
  PrologWithArgumentationImpl.prototype.mguAny = PrologWithArgumentation.prototype.mguAny;
@@ -5755,6 +6132,8 @@
5755
6132
  CompleteLabellerBase.prototype.content = ArgLibrary.prototype.content;
5756
6133
  GroundedLabellerBase.prototype.flags = ArgLibrary.prototype.flags;
5757
6134
  GroundedLabellerBase.prototype.content = ArgLibrary.prototype.content;
6135
+ GroundedLabellerOptimizedBase.prototype.flags = ArgLibrary.prototype.flags;
6136
+ GroundedLabellerOptimizedBase.prototype.content = ArgLibrary.prototype.content;
5758
6137
  PassThroughStatementLabeller.prototype.flags = ArgLibrary.prototype.flags;
5759
6138
  PassThroughStatementLabeller.prototype.content = ArgLibrary.prototype.content;
5760
6139
  StatementLabellerBase.prototype.flags = ArgLibrary.prototype.flags;