@tuprolog/arg2p-core 0.6.5 → 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.
@@ -77,6 +77,8 @@
77
77
  var equals = Kotlin.equals;
78
78
  var DomainError = $module$_2p_solve.it.unibo.tuprolog.solve.exception.error.DomainError;
79
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;
80
82
  var Unit = Kotlin.kotlin.Unit;
81
83
  var filter = Kotlin.kotlin.sequences.filter_euau3h$;
82
84
  var prolog = $module$_2p_dsl_core.it.unibo.tuprolog.dsl.prolog;
@@ -114,6 +116,7 @@
114
116
  var IllegalArgumentException_init = Kotlin.kotlin.IllegalArgumentException_init;
115
117
  var copyToArray = Kotlin.kotlin.collections.copyToArray;
116
118
  var hashCode = Kotlin.hashCode;
119
+ var Collection = Kotlin.kotlin.collections.Collection;
117
120
  var AliasedLibrary = $module$_2p_solve.it.unibo.tuprolog.solve.library.AliasedLibrary;
118
121
  var compareBy = Kotlin.kotlin.comparisons.compareBy_bvgy4j$;
119
122
  var sortedWith = Kotlin.kotlin.sequences.sortedWith_vjgqpk$;
@@ -926,36 +929,18 @@
926
929
  PrologWithArgumentationImpl.prototype.write1 = function (term) {
927
930
  return this.$delegate_38xz9p$_0.write1(term);
928
931
  };
929
- PrologWithArgumentationImpl.prototype.neq2 = function ($receiver, right) {
930
- return this.$delegate_38xz9p$_0.neq2($receiver, right);
931
- };
932
- PrologWithArgumentationImpl.prototype.nid2 = function ($receiver, right) {
933
- return this.$delegate_38xz9p$_0.nid2($receiver, right);
934
- };
935
- PrologWithArgumentationImpl.prototype.power = function ($receiver, right) {
936
- return this.$delegate_38xz9p$_0.power($receiver, right);
937
- };
938
- PrologWithArgumentationImpl.prototype.eq2 = function ($receiver, right) {
939
- return this.$delegate_38xz9p$_0.eq2($receiver, right);
940
- };
941
- PrologWithArgumentationImpl.prototype.arithNeq2 = function ($receiver, right) {
942
- return this.$delegate_38xz9p$_0.arithNeq2($receiver, right);
943
- };
944
- PrologWithArgumentationImpl.prototype.id2 = function ($receiver, right) {
945
- return this.$delegate_38xz9p$_0.id2($receiver, right);
946
- };
947
- PrologWithArgumentationImpl.prototype.arithEq2 = function ($receiver, right) {
948
- return this.$delegate_38xz9p$_0.arithEq2($receiver, right);
949
- };
950
- PrologWithArgumentationImpl.prototype.pow = function ($receiver, right) {
951
- return this.$delegate_38xz9p$_0.pow($receiver, right);
952
- };
953
932
  PrologWithArgumentationImpl.prototype.anyAnd = function ($receiver, other) {
954
933
  return this.$delegate_38xz9p$_0.anyAnd($receiver, other);
955
934
  };
956
935
  PrologWithArgumentationImpl.prototype.append = function ($receiver, item, items) {
957
936
  return this.$delegate_38xz9p$_0.append($receiver, item, items);
958
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
+ };
959
944
  PrologWithArgumentationImpl.prototype.concat = function ($receiver, other) {
960
945
  return this.$delegate_38xz9p$_0.concat($receiver, other);
961
946
  };
@@ -971,6 +956,9 @@
971
956
  PrologWithArgumentationImpl.prototype.anyDiv = function ($receiver, other) {
972
957
  return this.$delegate_38xz9p$_0.anyDiv($receiver, other);
973
958
  };
959
+ PrologWithArgumentationImpl.prototype.eq2 = function ($receiver, right) {
960
+ return this.$delegate_38xz9p$_0.eq2($receiver, right);
961
+ };
974
962
  PrologWithArgumentationImpl.prototype.anyEqualsTo = function ($receiver, other) {
975
963
  return this.$delegate_38xz9p$_0.anyEqualsTo($receiver, other);
976
964
  };
@@ -983,6 +971,9 @@
983
971
  PrologWithArgumentationImpl.prototype.anyGreaterThanOrEqualsTo = function ($receiver, other) {
984
972
  return this.$delegate_38xz9p$_0.anyGreaterThanOrEqualsTo($receiver, other);
985
973
  };
974
+ PrologWithArgumentationImpl.prototype.id2 = function ($receiver, right) {
975
+ return this.$delegate_38xz9p$_0.id2($receiver, right);
976
+ };
986
977
  PrologWithArgumentationImpl.prototype.anyIf = function ($receiver, other) {
987
978
  return this.$delegate_38xz9p$_0.anyIf($receiver, other);
988
979
  };
@@ -1013,6 +1004,12 @@
1013
1004
  PrologWithArgumentationImpl.prototype.anyMinus = function ($receiver, other) {
1014
1005
  return this.$delegate_38xz9p$_0.anyMinus($receiver, other);
1015
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
+ };
1016
1013
  PrologWithArgumentationImpl.prototype.anyNonGreaterThan = function ($receiver, other) {
1017
1014
  return this.$delegate_38xz9p$_0.anyNonGreaterThan($receiver, other);
1018
1015
  };
@@ -1724,7 +1721,7 @@
1724
1721
  switch (this.state_0) {
1725
1722
  case 0:
1726
1723
  this.state_0 = 2;
1727
- 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);
1728
1725
  if (this.result_0 === COROUTINE_SUSPENDED)
1729
1726
  return COROUTINE_SUSPENDED;
1730
1727
  continue;
@@ -3777,7 +3774,7 @@
3777
3774
  var tmp$_2 = to(AppendOptimized_getInstance().signature, AppendOptimized_getInstance());
3778
3775
  var tmp$_3 = to(AssertAll_getInstance().signature, AssertAll_getInstance());
3779
3776
  var $this = ArgumentHash_getInstance();
3780
- return tmp$_1.aliased(tmp$, mapOf_0([tmp$_2, tmp$_3, to($this.signature, $this.wrappedImplementation)]), tmp$_0);
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);
3781
3778
  }
3782
3779
  });
3783
3780
  Object.defineProperty(UtilsBase.prototype, 'baseFlags', {
@@ -3984,6 +3981,206 @@
3984
3981
  new ArgumentHash();
3985
3982
  }return ArgumentHash_instance;
3986
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
+ }
3987
4184
  function MetaInterpreterLib() {
3988
4185
  MetaInterpreterLib_instance = this;
3989
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 ')));
@@ -5032,7 +5229,7 @@
5032
5229
  }
5033
5230
  function ArgumentationGraph() {
5034
5231
  ArgumentationGraph_instance = this;
5035
- this.theoryCode = trimIndent('\n buildArgumentationGraph :-\n buildArguments,\n buildAttacks.\n buildArguments :-\n \tbuildArgumentsFromPremises,\n \tbuildArgumentsFromEmptyRules,\n \tfindall([RuleID, RuleBody, RuleHead], (\n \t parser::classic_rule(RuleID, RuleBody, RuleHead),\n \t \\+ emptyRule([RuleID, RuleBody, RuleHead])\n ), Rules),\n \tbuildArgumentsFromRules(b, Rules, Rules, n).\n buildArgumentsFromPremises :-\n findall(\n _,\n (\n parser::classic_rule(PremiseID, Premise),\n checkStrict(PremiseID, DefPrem),\n ground(Premise),\n context_assert(argument([[PremiseID], none, Premise, [], [[], [], DefPrem]])),\n context_assert(conc(Premise) :- argument([[PremiseID], none, Premise, [], [[], [], DefPrem]])),\n context_assert(newConc(a, Premise)),\n utils::hash(argument([[PremiseID], none, Premise, [], [[], [], DefPrem]]), Id),\n context_assert(arg(Id) :- argument([[PremiseID], none, Premise, [], [[], [], DefPrem]]))\n ),\n _\n ).\n buildArgumentsFromEmptyRules :-\n findall(\n _,\n (\n emptyRule([RuleID, RulePrem, RuleHead]),\n checkStrict(RuleID, DefRule),\n ground(RuleHead),\n context_assert(argument([[RuleID], RuleID, RuleHead, RulePrem, [DefRule, DefRule, []]])),\n context_assert(conc(Premise) :- argument([[RuleID], RuleID, RuleHead, RulePrem, [DefRule, DefRule, []]])),\n context_assert(newConc(a, Premise)),\n utils::hash(argument([[RuleID], RuleID, RuleHead, RulePrem, [DefRule, DefRule, []]]), Id),\n context_assert(arg(Id) :- argument([[RuleID], RuleID, RuleHead, RulePrem, [DefRule, DefRule, []]]))\n ),\n _\n ).\n emptyRule([RuleID, Body, RuleHead]) :-\n parser::classic_rule(RuleID, Body, RuleHead),\n \\+ (member(X, Body), X \\= ~(_), X \\= prolog(_)),\n checkPrologClauses(Body).\n checkPrologClauses([]) :- !.\n checkPrologClauses([~(_)|T]) :- checkPrologClauses(T), !.\n checkPrologClauses([prolog(Check)|T]) :-\n (callable(Check) -> call(Check); Check),\n checkPrologClauses(T).\n clean(Tn, Rules) :-\n invert(Tn, Tx),\n context_retract(newConc(Tx, _)),\n buildArgumentsFromRules(Tx, Rules, Rules, n).\n check_new(Tn, H) :-\n copy_term(H, [_, RuleBody, _]),\n member(prolog(_), RuleBody), !.\n check_new(Tn, H) :-\n copy_term(H, [_, RuleBody, _]),\n member(X, RuleBody),\n invert(Tn, Tx),\n context_check(newConc(Tx, [X])).\n invert(a, b).\n invert(b, a).\n buildArgumentsFromRules(_, Rules, [], n).\n buildArgumentsFromRules(Tn, Rules, [], y) :- clean(Tn, Rules).\n buildArgumentsFromRules(Tn, Rules, [H|T], _) :-\n once(check_new(Tn, H)),\n copy_term(H, HH),\n findall(true, buildArgumentsFromRule(Tn, HH), R),\n R \\== [],\n buildArgumentsFromRules(Tn, Rules, T, y), !.\n buildArgumentsFromRules(Tn, Rules, [_|T], X) :-\n buildArgumentsFromRules(Tn, Rules, T, X).\n buildArgumentsFromRule(Tn, [RuleID, RuleBody, RuleHead]) :-\n \truleBodyIsSupported(RuleBody, [], [], SupportRules, ArgSupports),\n \t\\+ member(RuleID, SupportRules),\n \tground(RuleHead),\n \tutils::sort([RuleID|SupportRules], SortedPremises),\n \t\\+ context_check(argument([SortedPremises, RuleID, RuleHead, RuleBody, _])),\n \tbuildArgumentInfo(ArgSupports, RuleID, Info),\n NewArgument = [SortedPremises, RuleID, RuleHead, RuleBody, Info],\n context_assert(conc(RuleHead) :- argument(NewArgument)),\n context_assert(newConc(Tn, RuleHead)),\n \tcontext_assert(argument(NewArgument)),\n \tutils::hash(argument(NewArgument), Id),\n \tcontext_assert(arg(Id) :- argument(NewArgument)),\n \tsupports(NewArgument, ArgSupports).\n supports(Argument, Supports) :-\n findall(_, (\n member(S, Supports),\n context_assert(support(S, Argument))\n ), _).\n checkStrict(Id, [Id]) :- \\+ parser::check_strict(Id).\n checkStrict(Id, []) :- parser::check_strict(Id).\n buildArgumentInfo(Supports, RuleId, [LastDefRules, DefRules, DefPrem]) :-\n defeasibleRules(RuleId, Supports, DefRules),\n ordinaryPremises(Supports, DefPrem),\n lastDefeasibleRules(Supports, RuleId, LastDefRules).\n ordinaryPremises(Supports, DefPrem) :-\n findall(Def, member([_, _, _, _, [_, _, Def]], Supports), Prem),\n utils::appendLists(Prem, TempPrem),\n utils::sortDistinct(TempPrem, DefPrem).\n defeasibleRules(RuleId, Supports, DefRules) :-\n \tfindall(Def, member([_, _, _, _, [_, Def, _]], Supports), UnsortedRules),\n \tcheckStrict(RuleId, DefRule),\n \tutils::appendLists([DefRule|UnsortedRules], TempRules),\n \tutils::sortDistinct(TempRules, DefRules).\n lastDefeasibleRules(_, TopRule, [TopRule]) :-\n TopRule \\== none, \\+ parser::check_strict(TopRule).\n lastDefeasibleRules(Supports, TopRule, LastRules) :-\n \tparser::check_strict(TopRule),\n \tfindall(Def, member([_, _, _, _, [Def, _, _]], Supports), Res),\n \tutils::appendLists(Res, TempLastRules),\n \tutils::sortDistinct(TempLastRules, LastRules).\n ruleBodyIsSupported([], ResultPremises, ResultSupports, ResultPremises, ResultSupports).\n ruleBodyIsSupported([~(_)|Others], Premises, Supports, ResultPremises, ResultSupports) :-\n \truleBodyIsSupported(Others, Premises, Supports, ResultPremises, ResultSupports), !.\n ruleBodyIsSupported([prolog(Check)|Others], Premises, Supports, ResultPremises, ResultSupports) :-\n \t(callable(Check) -> call(Check); Check),\n \truleBodyIsSupported(Others, Premises, Supports, ResultPremises, ResultSupports), !.\n ruleBodyIsSupported([Statement|Others], Premises, Supports, ResultPremises, ResultSupports) :-\n context_check(clause(conc([Statement]), argument([ArgumentID, RuleID, [Statement], Body, Info]))),\n \tappend(ArgumentID, Premises, NewPremises),\n \truleBodyIsSupported(Others, NewPremises, [[ArgumentID, RuleID, [Statement], Body, Info]|Supports], ResultPremises, ResultSupports).\n findPossibleAttackers([_, _, Head, _, _], Conf) :-\n conflict(Conf, Head, Guard).\n findPossibleAttackers([_, _, Head, _, _], Conf) :-\n conflict(Conf, Head).\n findPossibleAttackers([_, _, _, Prem, _], [Conf]) :-\n member(~(Conf), Prem).\n findPossibleAttackers([_, RuleID, _, _, _], [undercut(RuleID)]).\n buildAttacks :-\n \tbuildDirectAttacks,\n \tbuildTransitiveAttacks.\n buildDirectAttacks :-\n findall(_, buildDirectAttack, _).\n buildDirectAttack :-\n context_check(argument(A)),\n findPossibleAttackers(A, BB),\n \tcontext_check(clause(conc(BB), argument(B))),\n \tA \\== B,\n attacks(T, B, A),\n \t\\+ context_check(attack(T, B, A, A)),\n \tcontext_assert(attack(T, B, A, A)),\n \tutils::hash(argument(A), IdA),\n \tutils::hash(argument(B), IdB),\n \tcontext_assert(att(IdB, IdA) :- attack(T, B, A, A)),\n \tfail.\n buildDirectAttack.\n buildTransitiveAttacks :-\n \tcontext_check(attack(T, A, B, D)),\n \tcontext_check(support(B, C)),\n \t\\+ context_check(attack(T, A, C, D)), !,\n \tcontext_assert(attack(T, A, C, D)),\n utils::hash(argument(A), IdA),\n utils::hash(argument(C), IdC),\n context_assert(att(IdA, IdC) :- attack(T, B, C, D)),\n buildTransitiveAttacks.\n buildTransitiveAttacks.\n attacks(rebut, A, B) :- rebuts(A, B), !.\n attacks(contrary_rebut, A, B) :- contraryRebuts(A, B), !.\n attacks(undermine, A, B) :- undermines(A, B), !.\n attacks(contrary_undermine, A, B) :- contraryUndermines(A, B), !.\n attacks(undercut, A, B) :- undercuts(A, B), !.\n expanded_conflict(HeadA, HeadB) :-\n conflict(HeadA, HeadB).\n expanded_conflict(HeadA, HeadB) :-\n conflict(HeadA, HeadB, Guard),\n (callable(Guard) -> call(Guard); Guard).\n rebuts([IDPremisesA, RuleA, RuleHeadA, _, _], [IDPremisesB, RuleB, RuleHeadB, _, Info]) :-\n \tRuleB \\== none,\n Info \\== [[], [], []],\n \texpanded_conflict(RuleHeadA, RuleHeadB).\n contraryRebuts([IDPremisesA, RuleA, [RuleHeadA], _, _], [IDPremisesB, RuleB, RuleHeadB, Body, Info]) :-\n \tRuleA \\== none,\n \tRuleB \\== none,\n \tmember(~(RuleHeadA), Body).\n undermines([IDPremisesA, RuleA, RuleHeadA, _, _], [[IDPremiseB], none, RuleHeadB, _, Info]) :-\n \tInfo \\== [[], [], []],\n \texpanded_conflict(RuleHeadA, RuleHeadB).\n contraryUndermines([IDPremisesA, none, [RuleHeadA], _, _], [IDPremisesB, RuleB, RuleHeadB, Body, Info]) :-\n \tRuleB \\== none,\n \tmember(~(RuleHeadA), Body).\n undercuts([_, _, [undercut(RuleB)], _, _], [_, RuleB, _, _, [[RuleB], _, _]]).\n check(-Atom).\n conflict([Atom], [-Atom]) :- \\+ check(Atom).\n conflict([-Atom], [Atom]).\n conflict([o(Atom)], [o(-Atom)]) :- \\+ check(Atom).\n conflict([o(-Atom)], [o(Atom)]).\n conflict([p(Atom)], [o(-Atom)]) :- \\+ check(Atom).\n conflict([o(-Atom)], [p(Atom)]).\n conflict([p(-Atom)], [o(Atom)]).\n conflict([o(Atom)], [p(-Atom)]) :- \\+ check(Atom).\n conflict([sup(X, Y)], [sup(Y, X)]).\n ');
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 ');
5036
5233
  }
5037
5234
  ArgumentationGraph.$metadata$ = {
5038
5235
  kind: Kind_OBJECT,
@@ -5545,6 +5742,12 @@
5545
5742
  Object.defineProperty(package$utils, 'ArgumentHash', {
5546
5743
  get: ArgumentHash_getInstance
5547
5744
  });
5745
+ Object.defineProperty(package$utils, 'Contains', {
5746
+ get: Contains_getInstance
5747
+ });
5748
+ Object.defineProperty(package$utils, 'ContainsAny', {
5749
+ get: ContainsAny_getInstance
5750
+ });
5548
5751
  var package$meta = package$core.meta || (package$core.meta = {});
5549
5752
  Object.defineProperty(package$meta, 'MetaInterpreterLib', {
5550
5753
  get: MetaInterpreterLib_getInstance
@@ -5808,21 +6011,17 @@
5808
6011
  PrologWithArgumentation.prototype.unifyWithOccurCheck = PrologScopeWithTheories.prototype.unifyWithOccurCheck;
5809
6012
  PrologWithArgumentation.prototype.var1 = PrologScopeWithTheories.prototype.var1;
5810
6013
  PrologWithArgumentation.prototype.write1 = PrologScopeWithTheories.prototype.write1;
5811
- PrologWithArgumentation.prototype.neq2 = PrologScopeWithTheories.prototype.neq2;
5812
- PrologWithArgumentation.prototype.nid2 = PrologScopeWithTheories.prototype.nid2;
5813
- PrologWithArgumentation.prototype.power = PrologScopeWithTheories.prototype.power;
5814
- PrologWithArgumentation.prototype.eq2 = PrologScopeWithTheories.prototype.eq2;
5815
- PrologWithArgumentation.prototype.arithNeq2 = PrologScopeWithTheories.prototype.arithNeq2;
5816
- PrologWithArgumentation.prototype.id2 = PrologScopeWithTheories.prototype.id2;
5817
- PrologWithArgumentation.prototype.arithEq2 = PrologScopeWithTheories.prototype.arithEq2;
5818
- PrologWithArgumentation.prototype.pow = PrologScopeWithTheories.prototype.pow;
5819
6014
  PrologWithArgumentation.prototype.anyAnd = PrologScopeWithTheories.prototype.anyAnd;
6015
+ PrologWithArgumentation.prototype.arithEq2 = PrologScopeWithTheories.prototype.arithEq2;
6016
+ PrologWithArgumentation.prototype.arithNeq2 = PrologScopeWithTheories.prototype.arithNeq2;
5820
6017
  PrologWithArgumentation.prototype.substitutionContainsKey = PrologScopeWithTheories.prototype.substitutionContainsKey;
5821
6018
  PrologWithArgumentation.prototype.substitutionContainsValue = PrologScopeWithTheories.prototype.substitutionContainsValue;
5822
6019
  PrologWithArgumentation.prototype.anyDiv = PrologScopeWithTheories.prototype.anyDiv;
6020
+ PrologWithArgumentation.prototype.eq2 = PrologScopeWithTheories.prototype.eq2;
5823
6021
  PrologWithArgumentation.prototype.anyEqualsTo = PrologScopeWithTheories.prototype.anyEqualsTo;
5824
6022
  PrologWithArgumentation.prototype.anyGreaterThan = PrologScopeWithTheories.prototype.anyGreaterThan;
5825
6023
  PrologWithArgumentation.prototype.anyGreaterThanOrEqualsTo = PrologScopeWithTheories.prototype.anyGreaterThanOrEqualsTo;
6024
+ PrologWithArgumentation.prototype.id2 = PrologScopeWithTheories.prototype.id2;
5826
6025
  PrologWithArgumentation.prototype.anyIf = PrologScopeWithTheories.prototype.anyIf;
5827
6026
  PrologWithArgumentation.prototype.anyIfVararg = PrologScopeWithTheories.prototype.anyIfVararg;
5828
6027
  PrologWithArgumentation.prototype.anyImpliedBy = PrologScopeWithTheories.prototype.anyImpliedBy;
@@ -5835,6 +6034,8 @@
5835
6034
  PrologWithArgumentation.prototype.anyMatches = PrologScopeWithTheories.prototype.anyMatches;
5836
6035
  PrologWithArgumentation.prototype.anyMguWith = PrologScopeWithTheories.prototype.anyMguWith;
5837
6036
  PrologWithArgumentation.prototype.anyMinus = PrologScopeWithTheories.prototype.anyMinus;
6037
+ PrologWithArgumentation.prototype.neq2 = PrologScopeWithTheories.prototype.neq2;
6038
+ PrologWithArgumentation.prototype.nid2 = PrologScopeWithTheories.prototype.nid2;
5838
6039
  PrologWithArgumentation.prototype.anyNonGreaterThan = PrologScopeWithTheories.prototype.anyNonGreaterThan;
5839
6040
  PrologWithArgumentation.prototype.anyNonLowerThan = PrologScopeWithTheories.prototype.anyNonLowerThan;
5840
6041
  PrologWithArgumentation.prototype.anyNotEqualsTo = PrologScopeWithTheories.prototype.anyNotEqualsTo;