termination is a crucial aspect of program verification .it is of particular importance for logic programs , since there are no _ a priori _ syntactic restrictions to queries and , as a matter of fact , most predicates programmers tend to write do not terminate for their most general queries . in the last fifteen years , termination has been the subject of several research works in the field of logic programming ( see , for instance , ) . in contrast to what happens for other programming paradigms , there are two notions of termination for logic programs : _ existential _ and _ universal _ termination . to illustrate them , assume we are using a standard prolog engine .existential termination of a query means that either the computation finitely fails or it produces _ one _ solution in finite time .this does not exclude the possibility that the engine , when asked for further solutions , will loop . on the other hand, universal termination means that the computation yields all solutions and eventually fails in finite time ( if we repeatedly ask for further solutions ) .although the concept of existential termination plays an important role in connection with _normal _ logic programs , it has severe drawbacks that make it not appropriate in other contexts : existential termination is not _instantiation - closed _( i.e. , a goal may existentially terminate , yet some of its instances may not terminate ) , hence it is not _ and - compositional _( i.e. , two goals may existentially terminate while their conjunction does not ) ; finally , existential termination depends on the textual order of clauses in the program .universal termination is a stronger and much more robust concept : it implies existential termination and it is both and - compositional and instantiation - closed .existential termination has been the subject of only a few works whereas most research focused on universal termination .there are two main directions ( see for a survey ) : characterizing termination and finding weaker but decidable sufficient conditions that lead to actual algorithms , e.g. , . even though our research belongs to both streams , in this paper we focus on an intuitive presentation of the implementation of our approach .a companion paper presents a complete formalization of our work in the theoretical setting of acceptability for constraint logic programs , where we refine a necessary and sufficient condition for termination to the sufficient condition implemented in cti .our main contribution compared to other automated termination analyzers is that our tool _ infers _ sufficient universal termination conditions from the text of any prolog program , adopting a bottom - up approach to termination .an important feature of this approach first presented in is that there is no need to define in advance a class of queries of interest .( if required , these classes can be provided after the analysis has finished in order to specialize the obtained results . ) our system , called _ cti _ from _ onstraint - based ermination nference _ , is written in sicstus prolog . a preliminary account of the work described in this paper appeared in , where we showed that numeric computations took most of the execution times .now cti relies on the specialized parma polyhedra library , a modern c library for the manipulation of convex polyhedra that significantly speeds up the analysis .moreover , cti has been extended so that it can analyze any iso - prolog program .the only correctness requirement we currently impose on programs is that they must not create infinite rational terms .hence we assume execution with occurs - check or , equivalently , nsto programs ( i.e. , programs that are _ not subject to occur - check _ and thus are safely executed with any standard conforming system ) .we point out that simple , sufficient syntactic methods for ensuring occurs - check freedom are presented in while describe abstract - interpretation based solutions .recently , _ finite - tree analysis _ has been proposed to confine infinite rational terms in programs that are not occurs - check free .both the approach described in and the cti system can be extended , with the help of finite - tree analysis , to deal also with such programs .  throughout the paperwe assume a basic knowledge of logic programming ( see , e.g. , ) , constraint logic programming ( see , e.g. , ) , abstract interpretation ( see , e.g. , ) , and propositional -calculus ( see , e.g. , ) . in section [ sec: cti - overview ] we present cti informally with an example analysis . how to use ctiis described in section [ sec : using - cti ] .an experimental evaluation of the system is the subject of section [ sec : experimental - evaluation ] .related work is discussed in section [ sec : related - work ] while section [ sec : conclusion ] concludes .our aim is to compute classes of queries for which universal left termination is guaranteed .we call such classes _ termination conditions_. more precisely , let be a prolog program and a predicate symbol of .a termination condition for is a set of goals of the form where is a clp( ) constraint such that , for any goal , each derivation of and using the left - to - right selection rule is finite .our analyzer uses three main constraint structures : herbrand terms for the initial program ( seen as a clp( ) program ) , non - negative integers , and booleans ( is abstracted into both a clp( ) and a clp( ) program ) .we illustrate our method to infer termination conditions by means of an example .the method consists of six distinct steps , which will be illustrated on the following definition for the predicates ` app/3 ` , ` nrev/2 ` and ` app3/4 ` .l|l|l  ` app ( [ ] , x , x ) . `+ ` app([e|x ] , y , [ e|z ] ) : - ` + ` app(x , y , z ) . `  &  ` nrev ( [ ] , [ ] ) . `+ ` nrev([e|x ] , y ) : - ` + ` nrev(x , z ) , ` + ` app(z , [ e ] , y ) . `  &  ` app3(x , y , z , u ) : - ` + ` app(x , y , v ) , ` + ` app(v , z , u ) . `  [ [ step1-from - prolog - to - clpmathcaln . ] ] step 1 : from prolog to clp( ) .+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +  from the prolog program , a clp( ) program is obtained by applying a symbolic norm . in our example, we use the _ term - size _ norm , which is the one cti applies by default .all iso - predefined predicates have been manually pre - analyzed for this norm .notice that , as explained in , termination inference for pure prolog programs can be based on any linear norm .the symbolic term - size norm is inductively defined as follows : for example , .all non - monotonic elements of the program are approximated by monotone constructs .for instance , prolog s unsound negation ` \+ g ` is approximated by ` ( ( g , false ) ; true ) ` .more generally , extra - logical predicates are mapped to their first - order counterparts so that the termination property is preserved . for our running example, we obtain the following clp( ) clauses :  l|l|l   + +   &   + + +   &   + +   [ [ step2-computing - a - numeric - model . ] ] step 2 : computing a numeric model .+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +  a model of the clp( ) program is now computed . for each predicate , the model describes , with a finite conjunction of linear equalities and inequalities denoted by , the linear inter - argument relations that hold for every solution of . in our example we obtain the following model : the actual computation is performed on the set of nonnegative , infinite precision rational numbers , using a fixpoint calculator based on ppl , the parma polyhedra library , and the standard widening . in our examplethe least model is found . in general , however , only a less precise model can be determined .  [ [ step3-computing - a - numeric - level - mapping . ] ] step 3 : computing a numeric level mapping .+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +  the information provided by the numerical model is crucial to compute a _level mapping _let be an -ary predicate symbol in the clp( ) program .the level mapping associates to a function that is guaranteed to decrease when going from the head of the clause to each recursive call(s ) , if any , for each clause defining . for example , a level mapping such that intuitively means : for each ground instance of each recursive clause defining , the first argument decreases when going from the head of the clause to the recursive call ( since for each ) . since no clause defining is recursive , the level mapping can be defined so that .the level mapping computed for our example is defined by : this is obtained by means of an improvement of the technique by k. sohn and a. van gelder for the automatic generation of linear level mappings .their algorithm , which is based on linear programming , is complete in the sense that it will always provide a linear level mapping if one exists . our extension , which is described in ,consists in first computing a constraint over the coefficients of a generic linear level mapping ( step 3a ) .then we generate a concrete level mapping ( step 3b ) .notice that for a multi - directional predicate ( such as ` app/3 ` ) we may get multiple linear level mappings .these are combined , with the operator , into one non - linear level mapping .in contrast with the well - known standard framework of acceptability , the decrease of the level mapping has to be shown only for predicates belonging to the same strongly connected component ( scc ) of the call graph . step 5 below will ensure that the other calls to predicates from lower scc s do left terminate .the advantage of this approach is twofold : first , the computation of a level mapping , being scc - based , is modular .secondly , the expressive power of _ linear _ level mappings with respect to termination is much higher than in the acceptability case .[ [ step4-from - clpmathcaln - to - clpmathcalb . ] ] step 4 : from clp( ) to clp( ) .+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +  from the clp( ) program a clp( ) program , , is obtained by mapping each natural number to ( true ) , each variable symbol to itself , and addition to logical conjunction .l|l|l   + +   &   + + +   &   + +   the purpose of is the one of capturing boundedness dependencies within or , equivalently , rigidity dependencies within the original program .is _ rigid _ with respect to a symbolic norm if and only if its measure is invariant by instantiation , i.e. , for any substitution . ] a model for is then computed and a boolean level mapping is obtained from the numerical level mapping computed in step 3 . in order to do that , the translation scheme outlined above is augmented with the association of the logical disjunction to : this means that is a bounded quantity if or or both are bounded . hereis what we obtain for the example program : for instance , as we use the term - size norm , this model tells us that for any computed answer to a call , is ground if and only if is ground .  [ [ step5-computing - boolean - termination - conditions . ] ] step 5 : computing boolean termination conditions .+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +  the information obtained from for each program point is combined with the level mapping by means of the following boolean -calculus formul , whose solution gives the desired boolean termination conditions .  here is the intuition behind such boolean -calculus formul . consider the ` nrev/2 ` predicate .its unit clause is taken into account in the computation of the numeric and the boolean model .for computing the boolean termination condition , we consider the clause ,    \mathrm{nrev}_{\ensuremath{\mathcal{b}}}(x ' , z ) ,    \mathrm{app}_{\ensuremath{\mathcal{b}}}(z , 1\land e , y).\ ] ] we are looking for a boolean relation satisfying the following conditions :  * for each in , the level mapping has to be bounded , which leads to condition ( 1 ) above ; * the recursive call to ` nrev/2 ` has to terminate , hence condition ( 2 ) ; * for any state resulting from the evaluation of the first call , the subsequent call to ` app/3 ` has to terminate , giving condition ( 3 ) ; * finally , we are interested in the weakest solution for , hence the boolean termination condition is defined as a greatest fixpoint :   solving the equations for our example gives :   the greatest fixpoint is evaluated with the boolean -solver described in , which computes on the domain of positive boolean formul  and is based on the boolean solver of sicstus prolog .[ [ step-6-back - to - prolog . ] ] step 6 : back to prolog .+ + + + + + + + + + + + + + + + + + + + + + +  in the final step of the analysis , the boolean termination conditions are lifted to termination conditions with the following interpretation , where the s are clp( ) constraints :  * each goal `` ? - `  , ` app(x , y , z ) . ` ' left - terminates if ` x ` or ` z ` are ground in ; * each goal `` ? - `  , ` nrev(x , y ) . ` ' left - terminates if ` x ` is ground in ; * each goal `` ? - `  , ` app3(x , y , z , u ) . ` ' left - terminates if ` x ` and ` y ` are ground in or ` x ` and ` u ` are ground in .once compiled and installed , cti is invoked with the command `` cti source ` ' , where the program in `` source ` ' is assumed to be an iso - prolog program .the user may then control the behavior of cti with some options .we describe the main ones .  `` -p file ` ' : :  by default , undefined predicates are assumed to fail .the user may  enrich or redefine the set of built - ins recognized by the system , by  specifying `` -p file ` ' on the command line .this has the effect of  importing the predicates whose numerical model , boolean model , and  termination condition are given in `` file ` ' . as predicates imported  that way can not be redefined in the analyzed program , this scheme  provides a way to overcome potential weaknesses of the analysis .`` -t timeout_in_ms ` ' : :  the analysis steps 2 , 3a , 3b , 4 , and 5 described in  section [ sec : cti - overview ] all include potentially expensive  computations . because of this , for each such step , the computation  concerning each scc is subject to a timeout ,whose default value is 2  seconds .the `` -t ` ' option allows the user to modify this value .`` -n n ` ' : :  for the computation of the numeric model ( step 2 ) , a widening is used  after iterations of the approximate fixpoint  iteration .the default value for is 1 .the user may also modify a program to give specific information for selected program points .we illustrate this facility by means of examples ; the precise syntax is given in the cti s documentation .one may specify that particular program variables will only be bound to non - negative integers and that the analyzer should take into account some constraints involving them .for instance , cti does not detect that the following program terminates :  .... p1(n ) : - n > 0 , m is n-1 , p1(m ) .p1(n ) : - n >1 , a is n>>1 , z is n - a , p1(a ) , p1(z ) . ....  where the predefined arithmetic functor `` >> /2 ` ' is the bitwise arithmetic right shift . on the other hand ,cti is able to show that ` p2(n ) ` terminates :  .... p2(n ) : - cti:{n > 0 , m = n-1 } , p2(m ) .p2(n ) : - cti:{n > 1 , 2*a = <n , n = < 2*a+1 , z = n - a } , p2(a ) , p2(z ) . ....finally , at any program point , the user can add linear inter - argument relations or groundness relations that the analyzer will take for granted .the system can thus prove the termination of the goal `` ? - top . ` ' where the predicate ` top/0 ` is defined by the program given in section [ sec : cti - overview ] augmented with the following clause , where the term - size of ` l1 ` is declared to be less than 10 and ` l2 ` is declared to be ground :  .... top : - cti:{n(l1 ) < 10},app(l1,zs , l2),cti:{b(l2)},app(xs , ys , l2 ) . ....  while such programs are no longer iso - prolog programs , the annotations can be automatically removed so as to obtain the original programs back .the assertion language currently used in cti is only experimental , and future versions of the system may be based on the language defined in .unless otherwise specified , the experiments we present here were all conducted with the option ( see section [ sec : using - cti ] ) ` -p predef_for_compatibility.pl ` , which ensures that non - iso built - ins used in the benchmarks ( several of which are written in a non - iso dialect of prolog ) are predefined .this experimental evaluation was done on a gnu / linux system with an intel i686 cpu clocked at 2.4 ghz , 512 mb of ram , running the linux kernel version 2.4 , sicstus prolog 3.10.0 ( 28.3 mlips ) , ppl version 0.5 , and cti version 1.0 .[ [ standard - programs - from - the - termination - literature . ] ] standard programs from the termination literature .+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +  table [ table_results_dds ] presents timings and results of cti on some standard lp termination benchmarks .the columns are labeled as follows :  program : : :  the name of the analyzed program ( the asterisk near a name means that  we had to use one of the options that allow to tune the behavior of  cti ) ; top - level predicate : : :  the predicate of interest ; checked : : :  the class of queries _ checked _ by the analyzers of ( * ? ? ?* ; * ? ? ?* ;  * ? ? ?* ) ; result : : :  the best result among those reported in ( where ,  of course , ` _ _ yes , the program terminates _ _ ' is better than ` _ _ no ,  do nt know _ _ ' ) ; inferred : : :  the termination condition _ inferred _ by cti ( 1 means that any call to  the predicate terminates , 0 means that cti could not find a  terminating mode for that predicate ) ; time : : :  the running time , in seconds , for cti to infer the termination  conditions .for all the examples presented in table [ table_results_dds ] , our analyzer is able to infer a class of terminating queries at least as large than the one checked by the analyzers of ( although we manually tuned cti three times ) .we point out that termilog and terminweb are sometimes able to prove termination whereas cti is not and _vice versa_.   program & top - level predicate & checked & result & inferred & + permute & & & yes& & 0.03 + duplicate & & & yes& & 0.02 + sum & & &yes& & 0.03 + merge & & &yes&&0.03 + dis - con & & & yes& & 0.03 + reverse & & &yes& & 0.02 + append & & &yes& & 0.02 + list & & & yes& & 0.01 + fold & & &yes& & 0.02 + lte & & & yes& & 0.02 + map & & & yes& & 0.02 + member & & & yes& & 0.01 + mergesort & & & no & & 0.06 + mergesort^*^ & & & no & & 0.07 + mergesort_ap & & & yes& & 0.11 + mergesort_ap^*^ & & & yes& & 0.11 + naive_rev & & & yes& & 0.03 + ordered & & & yes& & 0.01 + overlap & & &yes& & 0.01 + permutation & & & yes& & 0.03 + quicksort & & & yes& & 0.06 + select & & & yes& & 0.01 + subset & & &yes& & 0.02 + sum & & & yes& & 0.02 + pl2.3.1 & & & no & & 0.01 + pl3.5.6 & & & no & & 0.01 + pl3.5.6a & & & yes& & 0.01 + pl4.0.1 & append3(x , y , z , v)& & yes& & 0.02 + pl4.5.2 & & & no & & 0.03 + pl4.5.3a & & & no & & 0.01 + pl5.2.2 & & & no & & 0.11 + pl7.2.9 & & & yes& & 0.02 + pl7.6.2a & & & no & & 0.02 + pl7.6.2b & & &no & & 0.03 + pl7.6.2c & & &yes& & 0.04 + pl8.3.1 & & & no & & 0.04 + pl8.3.1a & & & yes& & 0.04 + pl8.4.1 & & & yes& & 0.02 + pl8.4.2 & & & yes& & 0.07 +  [ [ standard - programs - from - the - abstract - interpretation - literature . ] ] standard programs from the abstract interpretation literature .+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +  table [ table_results_middle ] presents timings of cti using some standard benchmarks from the lp program analysis community .we have chosen eleven middle - sized , well - known logic programs .all the programs are taken from except credit and plan .the first column of table [ table_results_middle ] gives the name of the analyzed program and the second one gives the number of its clauses ( before any program transformation takes place ) .the following six columns indicate the running times ( minimum execution times over ten runs ) , in seconds , for computing :   : : :  a numeric model ( step 2 ) ; : : :  the constraint over the coefficients of a generic linear level mapping  ( step 3a ) ; : : :  the concrete level mapping ( step 3b ) ; : : :  a boolean model ( step 4 ) ; : : :  the boolean termination conditions ( step 5 ) .the next column reports the total runtime in seconds while the last column , labeled ` q% ' , expresses the quality of the analysis , computed as the ratio of the number of user - defined predicates that have a non - empty termination condition over the total number of user - defined predicates ( the result of an analysis presents all the user - defined predicates together with their corresponding termination conditions ) .we note that cti can prove that bid , credit , and plan are _ left - terminating _ : every ground atom left - terminates . for any such program , has only one fixpoint ( * ? ? ?* theorem 8.13 ) , which may help proving its partial correctness .moreover , as the ground semantics of such a program is decidable , prolog is its own decision procedure , which does help testing and validating the program .  on the other hand ,when the quality of the analysis is less than 100% , it means that there exists at least one scc where the inferred termination condition is 0 .let us call such scc s _ failed sccs_. they are clearly identified , which may help the programmer . hereare some reasons why cti may fail : potential non - termination , poor numeric model , non - existence of a linear level mapping for a predicate with respect to the model , inadequate norm .also , the analysis of the scc s which depend on a failed scc is likely to fail , but this does not prevent cti from analyzing other parts of the call graph .program & clauses & & & & & & & q% + ann & 177 & 0.17 & 0.48 & 0.08 & 0.17 & 0.06 & 1.00 & 49% + bid & 50 & 0.03 & 0.04 & 0.02 & 0.02 & 0.02 & 0.14 & 100% + boyer & 136 & 0.07 & 0.06 & 0.02 & 0.08 & 0.02 & 0.30 & 85% + browse & 30 & 0.05 & 0.12 & 0.03 & 0.04 & 0.01 & 0.26 & 60% + credit & 57 & 0.02 & 0.03 & 0.02 & 0.02 & 0.01 & 0.11 & 100% + peephole & 134 & 0.18 & 0.56 & 0.03 & 0.20 & 0.06 & 1.08 & 94% + plan & 29 & 0.02 & 0.03 & 0.01 & 0.02 & 0.02 & 0.11 & 100% + qplan & 148 & 0.20 & 0.52 & 0.12 & 0.18 & 0.07 & 1.13 & 68% + rdtok & 55 & 0.13 & 0.39 & 0.03 & 0.07 & 0.02 & 0.65 & 44% + read & 88 & 0.26 & 1.00 & 0.04 & 0.31 & 0.08 & 1.72 & 52% + warplan & 101 & 0.10 & 0.25 & 0.01 & 0.08 & 0.02 & 0.49 & 33% + & & & & & & + & +  [ [ some - larger - programs . ] ] some larger programs .+ + + + + + + + + + + + + + + + + + + + +  finally , we have tested cti on the following programs :  * chat is a parser written by f.c.n . pereira and d.h.d .warren ; * lptp is an interactive theorem prover for prolog written by r. strk ; * pl2wam is the compiler from prolog to wam of gnu - prolog 1.1.2 developed by d. diaz ; * slice is a multi - language interpreter developed by r. bagnara and a. riaudo ; * symbolic1 seems to be a simulator for a prolog machine .we do not know the origin of this file .the results of the analysis are given in table [ reslarger ] .as explained in the previous section , we set up a timeout of 2 seconds per scc for computing a clp( ) model , the constraints defining level mappings , a clp( ) model , and the termination condition .so we have a limit of 10 seconds of cpu time per scc .the last but one column in table [ reslarger ] summarizes the number of timeouts for steps 2/3a/3b/4/5 , respectively .   program & clauses & & & & & & & timeouts & q% + chat & 515 & 3.89 & 2.78 & 2.84 & 2.85 & 0.35 & 12.80 & 1/1/1/0/0 & 71% + lptp & 1298 & 3.99 & 14.10 & 1.84 & 2.88 & 1.65 & 25.10 & 0/1/0/0/0 & 67% + pl2wam & 1190 & 2.12 & 2.37 & 0.99 & 2.00 & 1.29 & 9.22 & 0/0/0/0/0 & 64% + slice & 952 & 2.20 & 10.46 & 0.13 & 2.08 & 0.93 & 16.20 & 0/3/0/0/0 & 55% + symbolic1 & 923 & 1.49 & 0.67 & 0.04 & 0.61 & 0.29 & 3.47 & 0/0/0/0/0 & 58% +the compiler of the mercury programming language includes a termination checker , described in .the speed of the analyzer is quite impressive .we see two reasons for this .first , the termination checker is written in mercury itself .second , and most importantly , the analyzer takes high profit of the mode informations that are part of the text of the program being checked . on the other hand , while the running times of cti are bigger , termination inference is a more general problem than termination checking : in the worst case , an exponential number of termination checks are needed to simulate termination inference .talp is an automatic tool that transforms a well - moded logic program ( see , e.g. , ) into a term rewriting system such that termination of the latter implies termination of the former .the generated term rewriting system is then proved terminating by the cime tool ( http://cime.lri.fr/ ) .the system seems quite powerful for this class of logic programs . made recently a link between backward analysis and termination analysis , which leads to termination inference .although they used a completely different scheme for computing level mappings , the results of the analysis on the programs described in tables [ table_results_dds ] and [ table_results_middle ] were rather similar , both in time and quality , to previous versions of cti that rely on the rational linear solver of sicstus prolog .thanks to the ppl , cti is now significantly faster ( speed - ups from a factor of two to more than an order of magnitude have been observed ) .the latest version of terminweb emphasizes termination analysis of typed logic programs .termination of logic programming where numerical computations are taken into account are studied in .the authors present some advanced techniques for explicitly dealing with integers and floating point numbers computations .the _ size - change termination principle _ has been proposed in for deciding termination of first - order functional programs .the resulting analysis is close to the termilog approach and the authors establish its intrinsic complexity .finally , we point out that the system ciao - prolog adopts another approach for termination , based on complexity analysis .we have presented cti , the first bottom - up left - termination inference tool for iso - prolog , and its experimental evaluation over standard termination benchmarks as well as middle - sized and larger logic programs . running cti on large programsshows that the approach scales up satisfactorily .we believe that , thanks to the parma polyhedra library , cti is today the fastest and most robust termination inference tool for logic programs .when a scc is too large , computations relying on projection may become too expensive .so we have added for each computation which may be too costly a timeout and if necessary we are able to return a value which does not destroy the correctness of the analysis , although the quality of the inference is obviously weaker .it allows cti to keep on analyzing the program . as a side effect ,the running time of cti is _ linear _ with respect to the number of scc s in the call graph .finally , one can observe that the termination conditions computed in section [ sec : cti - overview ] are actually _ optimal _ with respect to the language used for describing classes of queries .can one prove such properties automatically ? presents a first step in this direction .* acknowledgments .* we would like to thank ulrich neumerkel for numerous discussions we had on termination inference and for the help he provided while debugging cti .thanks also to the readers of a previous version of this paper for their comments .  ** cti is distributed under the gnu general public license .the analyzer , together with the programs analyzed for benchmarking , are available from cti s web site : http://www.cs.unipr.it/cti .termination of logic programs using semantic unification . in _logic program synthesis and transformation : proceedings of the 5th international workshop _, m. proietti , ed .lecture notes in computer science , vol .springer - verlag , berlin , utrecht , the netherlands , 219233 .   , ricci , e. , zaffanella , e. , and hill , p. m. 2002 .possibly not closed convex polyhedra and the parma polyhedra library . in _static analysis : proceedings of the 9th international symposium _ ,m. v. hermenegildo and g. puebla , eds .lecture notes in computer science , vol . 2477 .springer - verlag , berlin , madrid , spain , 213229 .   ,cabeza , d. , carro , m. , hermenegildo , m. , lpez - garca , p. , and puebla , g. 1997 .the ciao prolog system .reference manual .clip3/97.1 , school of computer science , technical university of madrid ( upm ) .available from http://www.clip.dia.fi.upm.es/.  , de la banda , m. g. , and hermenegildo , m. v. 1994 .effectiveness of global analysis in strict independence - based automatic program parallelization . in _ logic programming : proceedings of the 1994 international symposium _, m. bruynooghe , ed .mit press series in logic programming .the mit press , ithaca , ny , usa , 253268 .       \1978 . automatic discovery of linear restraints among variables of a program . in _conference record of the fifth annual acm symposium on principles of programming languages_. acm press , tucson , arizona , 8496 .  , kelly , a. d. , and sndergaard , h. 1996 .a comparison of three occur - check analysers . in _static analysis : proceedings of the 3rd international symposium _, r. cousot and d. a. schmidt , eds .lecture notes in computer science , vol .springer - verlag , berlin , aachen , germany , 159173 ., lpez - garca , p. , hermenegildo , m. v. , and lin , n .- w .1994 . estimating the computational cost of logic programs . in _ static analysis : proceedings of the 1st international symposium _ , b. le charlier , ed .lecture notes in computer science , vol .springer - verlag , berlin , namur , belgium , 255265 .     ,ferrand , g. , and tguia : , m. 1991 .programs ( not subject to occur - check ) . in _ logic programming : proceedings of the 1991 international symposium _ , v. a. saraswat and k. ueda , eds .mit press series in logic programming . the mit press , san diego , usa , 533547 .   ,grumberg , o. , katz , s. , and pnueli , a. 1985 .proving termination of prolog programs . in_ proceedings of third workshop on logics of programs _ , r. parikh , ed .lecture notes in computer science , vol .springer - verlag , berlin , brooklyn , new york , 89105 .     ,puebla , g. , and bueno , f. 2000 .an assertion language for constraint logic programs . in _ analysis and visualization tools for constraint programming _ , p. deransart , m. v. hermenegildo , and j. mauszyski , eds .lecture notes in computer science , vol .springer - verlag , berlin , 2361 ., jones , n. d. , and ben - amram , a. m. 2001 .the size - change principle for program termination . in _ proceedings of the 28th acm sigplan - sigact symposium on principles of programming languages ( popl-01 ) _ , c. norris and j. j. b. fenwick , eds .acm sigplan notices , vol .association for computing machinery , london , uk , 8192 .contributions to a theory of txistential termination for definite logic programs . in _ proceedings of the `` 1995 joint conference on declarative programming ( gulp - prode95 ) ''_ , m. alpuente and m. i. sessa , eds .marina di vietri , italy , 631642 .automatic termination analysis of logic programs . in _ logic programming : proceedings of the fourteenth international conference on logic programming _ ,l. naish , ed .mit press series in logic programming .the mit press , leuven , belgium , 6377 .   \1996 .proving existential termination of normal logic programs . in _ proceedings of the fifth international conference on algebraic methodology and software technology ( amast96 )_ , m. wirsing and m. nivat , eds .lecture notes in computer science , vol . 1101 .springer - verlag , berlin , munich , germany , 375390 .\1996 . inferring left - terminating classes of queries for constraint logic programs by means of approximations . in _ logic programming : proceedings of the joint international conference and symposium on logic programming _ , m. j. maher , ed .mit press series in logic programming . the mit press , bonn , germany , 721 .termination detection in logic programs using argument sizes . in _ proceedings of the tenth acm sigact - sigmod - sigart symposium on principles of database systems_. association for computing machinery , denver , colorado , 216226 . extended abstract .an application of abstract interpretation of logic programs : occur check reduction . in_ proceedings of the 1986 european symposium on programming _ , b. robinet and r. wilhelm , eds .lecture notes in computer science , vol .springer - verlag , berlin , saarbrcken , federal republic of germany , 327338 .  ,somogyi , z. , and sndergaard , h. 1997 .termination analysis for mercury . in _static analysis : proceedings of the 4th international symposium _ , p. van hentenryck , ed .lecture notes in computer science , vol .springer - verlag , berlin , paris , france , 157171 .

Abstract: we present cti , the first system for universal left - termination inference of logic programs . termination inference generalizes termination analysis and checking . traditionally , a termination analyzer tries to prove that a given class of queries terminates . this class must be provided to the system , for instance by means of user annotations . moreover , the analysis must be redone every time the class of queries of interest is updated . termination inference , in contrast , requires neither user annotations nor recomputation . in this approach , terminating classes for all predicates are inferred at once . we describe the architecture of cti and report an extensive experimental evaluation of the system covering many classical examples from the logic programming termination literature and several prolog programs of respectable size and complexity .   termination inference ; termination analysis ; logic programming ; abstract interpretation .


the stock price of a given company is a mutual inference of various information , such as company revenue , competition performance , currency policy , business barometers , political situation , and so on . in other words , when the price is estimated , there are numerous complicated factors that must be considered . in the stock market , all companies are interconnected and consequently their stock prices are correlated .this correlation , known as the potential of deep inner impact , forms the stock market network .network theory has been extended into a wide range of subjects .barabsi and albert ( ba ) introduced the scale - free network which is constructed by the growth rule and the preferential attachment rule .we consider the preferential attachment rule as the connectivity of an influential company in stock market - a more influential company has more connections with other companies .the interaction strengths between nodes are important in many network systems .non - binary scale - free network which takes a continuous weight between 0 and 1 is a proper choice for modeling a stock market .we regard companies as nodes ( vertices ) of the network , interacting relations between stocks as links ( edges ) and correlation coefficients as weights .the minimum spanning tree ( mst ) is widely used to study the stock market since mantegna first constructed the network based on the correlations .the minimum spanning tree is generated by selecting the most important links .we construct a correlation matrix of n stocks .this matrix is symmetric and diagonal with .the mst is determined by the distance matrix where .there have been several attempts to identify the cluster structure .the mst is very useful to observe the network topology and identify clusters of the market including the stock and foreign exchange ( fx ) market ._ introduced the topological properties of the msts through the real and model markets dataset .investigated the dynamical properties of the american market correlations and taxonomy analysis in detail .the s&p500 forms clusters with the business sectors and the portfolio optimization with these clusters is successful .the mst also can be applied to the portfolio analysis in practice .while there has been an abundance of literature concerning mature markets - especially , the us market - relatively little work has been published for emerging markets such as those of korea , brics and eastern europe .emerging markets often lack liquidity and reliable data , so they are generally unstable .these factors make the study of emerging markets more complex .even the universal features for mature markets can not be extended to emerging markets for every cases .it seems that the model appropriate to emerging market should be exploited .  in this paper, we aim to explore the topological characteristics of the korean market as a representative emerging market .we construct the non - binary network by following the method introduced and applied for s&p500 companies by kim _ _ et al__ .we study the taxonomy and network topology of the korean market with it .the korean stock market is much smaller than the us stock market .there are two stock markets in korea - the korea stock exchange ( kse ) and the kosdaq .there are 700 and 900 listed companies and total capitalizations are 30 billion , respectively . for nyse and nasdaq , there are thousands of listed companies and the total market capitalization is approximately 2 million .there are two predominant types of stock price indices ; a price - equally - weighted index is an arithmetic average and a value - weighted index is an value weighted average of current stock prices .the former such as djia assumes that every stock has the same influencing power , while the latter such as s&p500 assumes that each stocks have the power proportional to their market capitalization .kospi200 is a value - weighted index of 200 representative stocks in kse , that is appropriate for the purpose of this study .table [ table - top10 ] shows the market capitalization of some largest companies listed on the s&p500 and kospi200 .this quantity reflects the financial scale of a given company and the fraction of total market capitalization in a stock market .( ) denotes stock symbol .the main distinction between two markets is the influence of several top companies .the portion of top 10 kospi200 companies is 49.13% where that of s&p500 is 22.82% .it means that kospi200 index is more sensitive to the influence of a few top companies .table [ table - investor ] shows shareholding composition of kse by investor group . we can notice that foreign investors possess the bulk of stocks of large companies and a large part of market liquidity is supplied by them .thus , the foreign investors trading activities are crucial to the kse .so naturally the korean stock market is highly correlated with the foreign stock markets such as the us market .we construct a network of kospi 200 companies ; each node ( company ) has a different number of links ( connections ) and weights ( correlations ) .we use the cross - correlations in stock price changes between kospi200 companies from jan/2001 to jun/2004 .the dataset is daily closure prices in terms of korean won ( krw ) , the korean local currency . in 1997 , the asian financial crisis made the exchange rate to fluctuate violently .however , during the period analyzed the korean fx market does nt have an experience of external impact or violent fluctuation .let be the stock price of company .then , the log - return of the stock price is defined as where t is time interval . in this paper, we analyzed daily data ; =1day .the cross - correlations between stock i and j can be written as where means a time average over the period .these correlation coefficients form a correlation matrix .this matrix is a symmetric n matrix . if stock i and j are completely correlated ( anti - correlated ) , .the case of means they are uncorrelated .each node of the network corresponds to a company , which is fully connected to every another nodes .each link has a weight , simply as the same value with the cross - correlation coefficient ; .the influence strength ( is ) is a physical quantity to measure how strongly a node influences other nodes .this quantity is defined as the sum of the weights of all links incident upon a given node , where denotes the links connected to the node .since the weight is distributed in the range [ -1,1 ] , the is can be negative .here we just need to determine the influencing structure , and the sign of is not important. thus we only deal with the absolute magnitude of the is denoted by .in fig . [ kospipowerlaw ] , we plot the is distribution of kospi200 .et al_. found the is distribution of s&p500 follows a power law distribution , where the exponent is estimated to be .it is known that as the degree exponent is smaller in sf networks , the connectivity of a node with a large degree becomes higher , and hence the network tends to be more centralized to a few nodes . in other words ,several powerful companies make a dominant effect to the whole market .it is also noticeable that the is component of the s&p500 is smaller than the degree exponent values for sf networks in the real world such as the internet and the world - wide web .  by table[ table - top10 ] , the largest company from the viewpoint of a market capitalization in the s&p500 is general electric ( ge ) ; its fraction is 3.39% . in the case of the kospi200 ,samsung electronics corporations ( sec ) occupies this position ; its fraction is 21.94% .so we can consider the kospi200 s hub to be more powerful , and the kse network is more centralized to this company than the s&p500 .however , fig .[ kospipowerlaw ] shows that the kospi200 s is distribution does not follow a power law distribution , but an exponential distribution .the korean stock market is less centralized than the s&p500 or other scale - free networks in the real world .we construct the asset tree through the minimum spanning tree ( mst ) to find the difference between the s&p500 and kospi200 .ge acts as the hub of the s&p500 s mst .however , we can not find any comparable hub in the whole market of the kospi200 contrary to the dominant position of sec in kse .sec node is located far away from the center ( fig .[ isdist ] ) .this means the fraction of sec s market capitalization is large , and as such the kospi index moves with sec while most companies stocks do not follow this trend .neither sec nor the others in table [ table - top10 ] is located at the center of kospi s mst .the weak influence of sec shows weak correlations with other stocks .hence , we can not find such scale - free behaviors in the korean market as the american market .one possible explanation of this difference is the market maturity .the american stock market is a mature market .there are numerous powerful companies such as ge , microsoft and citigroup .these companies have similar market capitalization and influence power on the market . in the korean stock market , an emerging market, there is a great gap between the sec and the others - even though , 9 companies of table [ table - top10 ] - with a viewpoint of the market capitalization .  for the application of portfolio optimization, the identification of groups of stocks in common dynamics is necessary to diversify the risks . at first, we introduce some terminology .the term _ branch _ is defined as a subset of a tree , to all nodes that share a specified common parent and _ cluster _ as a subset of a branch .there are two kinds of clusters .complete _ cluster and the other is _ incomplete_. a complete cluster contains all the companies of the studied set belonging to the corresponding branch , so that none are left outside the cluster .et al_. found that clusters of s&p500 with business sector or industry categories are mostly incomplete , but come very close to being complete clusters , only missing one or two companies of the cluster .we consider this situation as a complete cluster from the viewpoint of practical portfolio optimization .however , the clusters of kospi200 do not coincide with business sectors or industry categories .in addition , they made the portfolio using the central node ( ge ) , but the kospi200 has no single central hub , and thus this method can not be applied to the korean situation .we attempted to identify groups of kospi200 with other rules than business sectors or industry category .most major korean companies are members of conglomerate forms of enterprise , commonly known as _chaebeol_. for example , samsung electronics co. is a member of samsung conglomerate .this conglomerate is comprised of many companies over different sectors , i.e. , samsung electronics co. , samsung life insurance , samsung heavy industries co. , samsung petrochemical co. , samsung corporation , and so on .their ownerships are controlled by complex shareholding structures . so their stocks can be considered a group .however , we can not find any group structure related with korean major conglomerates - samsung , lg , sk , hyundai , and so on .we also consider the influence of foreign investors on the trading patterns of domestic investors .foreign investors are generally believed to employ superior techniques and information and their strategies are considered as benchmarks by domestic counter parties in the korean stock market .so we apply the msci index to make groups of korean stocks .morgan stanley capital international inc .( msci ) is one of the leading providers of equity indices and offers the most widely used international equity benchmarks by international investors .msci equity indices are designed to fulfill the investment needs of a wide variety of global institutional market participants .these include many categories of indices , i.e. sector , industry group and industry indices , global , regional and country equity indices , and so on .we focus on the msci korea index - one of the msci country equity indices .  fig .[ mst ] supports the validity of msci index grouping .we can identify two types of clusters by mainly composed of stocks included in msci index or not .while all of them are incomplete clusters , they can be considered as complete clusters in practice .it seems that msci index grouping is the most acceptable method for the korean market . in fig [ mst ] ,the weight of link is the second lowest and that of is the fifth lowest one .so we can divide the whole market into three clusters separated by these two links , and each cluster forms a sub - market .another noticeable feature of this mst is the absence of a global hub .the node in the center of cluster seems to be a hub , but it is just a local hub for isolated sub - market .we can also see that highly capitalized stock like sec is far from a hub even for a sub - market .bonanno _ _ et al.__ constructed the mst using market models ; random market model and one - factor model .random market model assumes that the return distribution is uncorrelated gaussian and one - factor model assumes that the return is controlled by a single factor like index .the degree distribution for the mst of mature market follows a power law distribution , and the degree distribution of the one - factor model is decayed rapidly and contains an asset with a very high value of the degree .[ kospipowerlaw ] shows that the degree distribution of the kospi200 follows neither a power law distribution nor a distribution of the one - factor model .it seems close to a distribution of the random market model .we have studied the korean stock market and obtained some characteristics that differ from the characteristics of the us market .the pertinent question is , why does the korean stock market have different properties ?one possible reason is the composition of firms .the history of mature markets is longer than that of emerging markets .thus , the mature markets have many companies including several large firms . in the case of the korean market, there are only a few large firms , e.g. sec ; these corporations are very large in comparison with others . as such ,these large firms are separated from other companies of the market .this accounts for why there are no hubs in the korean stock market .we do nt know yet whether this is the characteristics of an emerging market or only korean characteristics .the other is the trading culture and globalization .foreigners trading patterns are much important in the korean market .globalization has progressed very rapidly and influence of a few developed countries has become more and more powerful . at present , many stock markets synchronization to the us market is observed . in other words ,the whole markets in the world are synchronized .we may thus find clusters in terms of the msci index .if a specified company s stock is included in the msci index , it is more synchronized to a foreign market and regarded as a good company s stock to the korean market .all markets throughout the world have characteristics of their own .we need to study each market with its own properties .the 1997 asian financial crisis was a very important event to the korean market .after the crisis , the market s response to the external market is more sensitive . the correlation coefficient of the korean market is smaller than that of the american market andsometimes shows unusual distribution .the correlation and the mst have more information about the market than this paper s analysis , i.e. average length , positive correlation and negative correlation .the investigation about the points mentioned with the knowledge on the history of the korean market is our future work .                        :rectangle ( , ) , : circle ( , ) , : triangle ( , ) and : diamond ( , ) . and are the clusters of the stocks which are not listed on the msci index , is the cluster of the stock listed on the msci index . is shuffled area , so can not be a meaningful cluster ., scaledwidth=100.0% ]

Abstract: we establish in this study a network structure of the korean stock market , one of the emerging markets , with its minimum spanning tree through the correlation matrix . based on this analysis , it is found that the korean stock market does not form the clusters of the business sectors or of the industry categories . when the msci ( morgan stanley capital international inc . ) index is exploited , we find that the clusters of the korean stock market is formed . this finding implicates that the korean market , in this context , is characteristically different from the mature markets .   correlation - based clustering , emerging market , minimum spanning tree , econophysics + 89.65.gh , 89.75.fb , 89.75.hc


as more and more machine learning algorithms automate data - driven processes in education , recruitment , banking , and judiciary systems , one thing has become evident algorithms can have biases .given that these algorithms have far - reaching social and economic consequences , it is important to ensure that they comply with non - discrimination and fairness policies based on race , gender , and other sensitive attributes . towards this, there is an ongoing effort to understand and incorporate fairness in machine learning algorithms ( e.g. , see ) .we study the problem of subsampling a large data set a basic task in machine learning .subsamples are used both as an end - goal in data summarization ( where fairness could either be a legal , political or moral requirement ) and to train algorithms ( where biases in the samples are often a source of bias in the resulting model ) . a crucial requirement for either taskis that the sample be _ diverse _ in the feature space ; this is important both to provide a comprehensive viewpoint if the sample is the end - goal , and to make algorithms trained on such samples robust . ensuring diversity in samples is well - studied ; there are several notions of diversity and approaches for attaining it ( see , e.g. , ) . however , diversity may not guarantee fairness on sensitive attributes and may propagate biases , leading to broken models and algorithmic prejudice .mathematically , fairness can be viewed as a measure of diversity in the combinatorial space of sensitive attributes , as opposed to the geometric space of features .this brings us to the central question of this work : _ how do we select samples from a large dataset that are both diverse in features and fair to sensitive attributes ?_ simple examples ( such as those in figure [ fig : example ] ) show that , in certain settings , diversity does not necessarily imply fairness and vice - versa ; however , both seem simultaneously achievable . while both geometric and combinatorial diversities have been studied in independent works ( e.g. , and ) , to the best of our knowledge , this is the first systematic study that addresses both _simultaneously_.  [ [ diversity - combinatorial - and - geometric . ] ] diversity : combinatorial and geometric .+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +  formally , we study the following problem : given a large dataset of items , output a geometrically and combinatorially _ diverse _ of size . to make this well - defined, we need to specify two things : 1 ) how the data is given and 2 ) measures of diversity .there are two extremes   1.  * combinatorial diversity . *each data point has an attribute from a small set , which leads to a combinatorial measure of diversity : the diversity of a set is the shannon entropy of the distribution , where is the set of elements in with attribute value .intuitively , the larger the entropy , the more diverse is with respect to the given attributes .* geometric diversity .* each data point has a high - dimensional feature vector , which motivates a geometric measure of diversity : the diversity of a set is the ( squared ) volume of the -dimensional parallelepiped formed by the vectors .intuitively , the larger this volume , the more diverse is in the feature space .the combinatorial notion works with much less information , and is known as the _ diversity index _ in social and biological sciences .it is more suited to quantify fairness in sensitive or human - interpretable attributes that take a small set of discrete values .the geometric notion gives rise to a probability distribution known as _determinantal point process _( or -dpp ) , and such measures have been used to quantify feature diversity in a variety of machine learning applications for images , videos , documents , recommendation systems , and sensor placement . besides quantification of diversity in feature - rich datasets , an important reason for the deployment of -dpps is the recent efficient algorithms to sample from these distributions .[ [ our - contribution . ] ] our contribution .+ + + + + + + + + + + + + + + + +  we present an algorithmic framework that allows a user to integrate both notions of diversity , and experimentally demonstrate a marked improvement in fairness without compromising geometric diversity by much resulting in the best of both the worlds .conceptually , we propose a novel generalization of -dpps which we call _ -dpp_. given the feature vectors and the partition of the dataset based on the different values of a sensitive attribute , -dpp samples a -sized subset with probability proportional to the squared volume of the parallelepiped formed by the feature vectors in ( as is done in -dpps ) but _ only _ over sets that satisfy , for given for all .algorithmically , a polynomial time algorithm for sampling -dpps generalizes , albeit non - trivially , to -dpps with a constant number of disjoint partitions ( i.e. , , making our approach feasible .we experimentally compare the performance of sampling with -dpps against three natural baselines for an image summarization task .we consider an image dataset that consists of male and female scientists and artists .we observe that -dpp outperforms or matches other approaches with respect to both and in three different scenarios : 1 ) when we can ensure perfect fairness , see section [ sec : exp1 ] and figure [ fig : exp1 ] , 2 ) when some sensitive attributes remain hidden , see section [ sec : exp2 ] and figure [ fig : exp2 ] , and 3 ) when the underlying dataset is biased , see section [ sec : exp3 ] and figure [ fig : exp3 ] .these experiments give strong evidence that sampling with -dpps is a successful approach for data summarization .subsampling is also an important subroutine in various machine learning tasks ( see , e.g. , ) , and it remains an important avenue for future work to study if -dpps can also help mitigate algorithmic bias in such settings .here we give the formal definitions and theoretical constructs used in this paper .an attribute that takes one of different values gives a natural partition of the underlying data into parts .the fairness of a dataset ( or its subset ) with respect to such an attribute can then be quantified by the fairness or diversity index .  *( fairness or diversity index ) * [ def : fairness ] given a set of items and its partition into parts , the diversity index of any subset is defined as the shannon entropy where .  for feature - rich data , where a kernel defines the dot product of feature vectors , ( sub)determinantsextend this notion to define diversity over subsets .  *( geometric diversity ) * [ def : diversity ] given a dataset and a positive semidefinite kernel matrix , the geometric diversity of a subset is defined as , which is the determinant of the principal submatrix given by the row and column indices in .geometric diversity defines a distribution on subsets known as a ( discrete ) determinantal point process .  *( dpps and -dpps ) * [ def : kdpp ] given a dataset and a positive semidefinite kernel matrix , the dpp is a distribution over subsets such that the probability .the induced probability distribution over -sized subsets is called -dpp .now we define -dpp ; our generalization of -dpp to subsets that have the same relative partition as .  *( -dpp ) * [ def : pdpp ] given a dataset , a positive semidefinite kernel matrix , a partition into parts , and numbers , -dpp defines a distribution over -sized subsets such that if and , otherwise .lastly , we introduce a natural baseline which we also compare against in our experiments .  * ( -dpp ) * [ def : kidpp ] given a dataset , a positive semidefinite kernel matrix , a partition into parts , and numbers , -dpp defines a distribution over -sized subsets that is a product distribution : for each we obtain a sample of size independently with probability proportional to , and combine these samples to output .we emphasize that the difference between a -dpp and a -dpp with the same parameters is that the samples from each part in -dpp are not _ independent _ as in -dpp . indeed , this is what makes them more powerful .polynomial time sampling from -dpps uses a linear algebraic fact that the partition function as well as the marginals of -dpp can be computed using the characteristic polynomial of the underlying kernel matrix .a multivariate generalization of this can incorporate partition constraints ( and beyond ) to sample from -dpps in time , which is polynomial for  .we ran our experiments on a collection of images curated using google image search as follows : four search terms were used : ( a ) `` scientist male '' , ( b ) `` scientist female '' , ( c ) `` painter male '' , and ( d ) `` painter female '' .the search was restricted to medium sized jpeg files that passed the strictest level of safe search filtering .the top 200 distinct images from each were collected to create the following three datasets :   hence , each dataset has inherent labels ( a)-(d ) over which we can measure the combinatorial diversity of a sample . in order to measure geometric diversity , following , each image was processed with the ` vlfeat ` toolbox to obtain sets of 128-dimensional sift descriptors .the descriptors are combined , subsampled to a set of 36,000 and then clustered using -means into 256 clusters .the feature vector for an image is the normalized histogram of the nearest clusters to the descriptors in the image .finally , the kernel value for any pair of images and is obtained by taking the dot - product of the sift features of and .   in each experiment, we compare four different probability distributions from which to select samples from a dataset : 1 ) our proposed -dpp ( see def [ def : pdpp ] ) , 2 ) the classic -dpp ( see def [ def : kdpp ] ) , 3 ) -dpp ( see def [ def : kidpp ] ) , and 4 ) unif , which takes a uniformly random subset of size .  in order to sample from -dpp , -dpp and -dpp , instead of using the polynomial time algorithms of , we appeal to a markov chain monte carlo ( mcmc ) heuristic inspired by as the latter seems faster in practice .the markov chain is defined over the space of subsets of cardinality .the algorithm first chooses a `` warm start state '' obtained by greedily maximizing the determinant while satisfying the partition constraints .then , in each iteration , elements and are chosen uniformly at random . the chain moves to state with probability , if it satisfies the constraints .otherwise , it stays in state .this is repeated for a suitable number of iterations to guarantee that samples drawn from this chain are `` close '' to that of the desired distribution . in each experiment ,given a sample selected by algorithm , we report the combinatorial diversity using the fairness index ( see def [ def : fairness ] ) and the geometric diversity ( see def [ def : diversity ] ) .we first consider the performance as we vary the sample size from 20 to 100 on the scientist dataset ( see figure [ fig : exp1 ] ) ; recall that the dataset has two parts , male and female , and that the dataset is unbiased .we place fairness constraints so that -dpp and -dpp select exactly 50% of their samples from the male and female parts .hence , we have set up the experiment to guarantee optimal for -dpp and -dpp , and measure the resulting degradation in .both -dpp and -dpp attain the optimal of .as expected , this is significantly higher than unif and -dpp ( paired one - sided t - tests , ) . in fact , even unif has significantly higher fairness than -dpp ( paired one - sided t - test , ) . with respect to ,the performance of -dpp and -dpp is comparable , with neither significantly outperforming the other .this is notable as -dpp has constraints that -dpp need not abide by ; hence , a priori , -dpp could be significantly better .moreover , both -dpp and -dpp have significantly higher than unif and -dpp ( paired one - sided t - tests , ) .outperforming unif is expected as random selection makes no effort to increase , however the outperformance of -dpp is notable for two reasons : 1 ) -dpp is the only other algorithm that matched the fairness index of -dpp , and 2 ) -dpp is also explicitly attempting to improve .however , while -dpp improves _ within _ a part of the dataset , it does not diversify _ across _ parts ; -dpp avoids exactly this pitfall .this experiment demonstrates that -dpp can match or outperform the other approaches with respect to both fairness and diversity .this conclusion is not unique to this dataset we also conducted the same experiment on the artist dataset , and the results are very similar with the same significance findings holding ; we omit the full details due to length constraints . exploringwhether such results are consistent on other types of datasets would be a clear direction for future work .we then consider the performance of the algorithms as we vary the sample size from 10 to 50 on the scientist+artist dataset , but consider the case where there is a hidden underlying partition ( see figure [ fig : exp2 ] ) . here, we place fairness constraints so that -dpp and -dpp select exactly of their samples from the male ( a and c ) images and female ( b and d ) images , but _ do not _ enforce constraints across scientist ( a and b ) images and artist ( c and d ) images , allowing for disproportionality across this dimension .however , we measure the fairness with respect to all four parts .   with respect to the , -dpp and -dppno longer attain the optimal fairness of 4 .however , -dpp significantly outperforms -dpp , unif _ and _ -dpp ( paired one - sided t - tests , ) , with -dpp being the worst performer despite the partial constraints . with respect to , as in experiment 1, the performance of -dpp and -dpp is comparable , and both have significantly higher than unif ( paired one - sided t - tests , ) . for this experiment, -dpp is also comparable to -dpp , with a mean determinant that is higher , but not significantly so ; this is largely due to the fact that for this experiment is smaller while the dataset size is larger , and hence the drop - off in performance of -dpp is not as evident as it was in experiment 1 .hence , this experiment demonstrates that -dpp can match or outperform the other approaches with respect to both fairness and diversity , even when some of the underlying attributes are unknown .this is an important consideration as we should not inadvertently boost one kind of fairness at the expense of another .lastly , we consider the situation where the underlying dataset is biased ( see figure [ fig : exp3 ] ) .we include all female ( b and d ) images , but only include a subsample of male images ( a and c ) in the dataset in order to create biased datasets that have between to male images .the subsampled images are selected uniformly at random from all male scientists and artists for each repetition in the experiment .we place fairness constraints so that -dpp and -dpp select exactly of their samples from the male ( a and c ) images and female ( b and d ) images , _ regardless of the bias in the underlying dataset_. as in experiment 2 , we _ do not _ enforce constraints across scientist ( a and b ) images and artist ( c and d ) images , but measure with respect to all four attributes .   with respect to ,-dpp significantly outperforms -dpp , unif and -dpp ( paired one - sided t - tests , ) . here, we see that the bias in the underlying dataset can dramatically affect the fairness of unif and -dpp as neither approach is designed to correct for such biases .however , -dpp and -dpp are able to remain relatively stable throughout . with respect to , -dpp has significantly higher than unif and -dpp ( paired one - sided t - tests , ) .however , now -dpp significantly outperforms -dpp ( paired one - sided t - test , ) .this is due to the fact that when the dataset is highly biased , the available selection of images in the smaller partition is limited , and hence it is more difficult for -dpp to diversify across the feature space .indeed , we expect this gap to close as the size ( but not proportion ) of the smaller part increases .   in this experimentwe observe that , when the underlying data is highly biased , there is now a tradeoff between ( for which -dpp performs best ) and ( for which -dpp performs best ) . despite these differences, we note that the gap in -dpp s geometric diversity gradually decreases , while -dpps fairness index drops rapidly as the bias increases , leading us to conclude that -dpps remain the best of both worlds , allowing for fairness _ and _ diversity .

Abstract: due to the recent cases of _ algorithmic bias _ in data - driven decision - making , machine learning methods are being put under the microscope in order to understand the root cause of these biases and how to correct them . here , we consider a basic algorithmic task that is central in machine learning : subsampling from a large data set . subsamples are used both as an end - goal in data summarization ( where fairness could either be a legal , political or moral requirement ) and to train algorithms ( where biases in the samples are often a source of bias in the resulting model ) . consequently , there is a growing effort to modify either the subsampling methods or the algorithms themselves in order to ensure fairness . however , in doing so , a question that seems to be overlooked is whether it is possible to produce fair subsamples that are also adequately representative of the feature space of the data set an important and classic requirement in machine learning . can diversity and fairness be simultaneously ensured ? we start by noting that , in some applications , guaranteeing one does not necessarily guarantee the other , and a new approach is required . subsequently , we present an algorithmic framework which allows us to produce both fair and diverse samples . our experimental results on an image summarization task show marked improvements in fairness without compromising feature diversity by much , giving us the best of both the worlds .


voting and assignment are two of the most widely applied and important settings in social choice theory . in both settings , although one could also use _ discrete _ or _rules , randomization is crucial to achieve minimal fairness requirements such as anonymity and neutrality . in voting ,_ agents _ express preferences over _ alternatives _ and a _ social decision scheme _ returns a probability distribution over the alternatives based on the agents preferences  . in the assignmentsetting , _agents _ express preferences over _ objects _ and a _ random assignment rule _ returns a random assignment of the objects specifying the probability with which each object is allocated to each agent  .the objects are referred to as _ houses _ in the literature and the assignment setting is also known as _ house allocation_. for the two settings , a desirable social decision scheme  and random assignment rule  , respectively .  in the voting setting , _ random serial dictatorship _ ( ) takes a permutation of agents uniformly at random and then selects an alternative by serially allowing agents in the permutation to refine the set of feasible alternatives . in the assignmentsetting , a permutation uniformly at random and then lets the agents in the permutation serially take their most preferred house that has not yet been allocated .  for both the settings mentioned above , a well - known rule that is anonymous , strategyproof , and ex post efficient ( randomizes over pareto optimal alternatives ) . in fact ,it has been conjectured to be the only rule that satisfies these properties ( see e.g. , * ? ? ?* ; * ? ? ? well - established and commonly used especially in resource allocation . in particular , the resulting probabilities of be viewed as fractional allocations in scheduling and other applications ( in which the houses are in fact divisible ) and hence important to compute ( see e.g. , * ? ? ?* ; * ? ? ?* ; * ? ? ?* ; * ? ? ?similarly , in voting , the probabilities returned by the can be interpreted as fractions of time or resource allotted to the alternatives and hence crucial to compute .the probability of each alternative can also be used as a suggestion for the proportional representation of the alternative in representative democracy or seat allocation of a parliament  .the definition of both the settings suggests natural exponential - time algorithms to compute the : enumerate all the permutations and for each permutation , perform a linear number of operations. however these algorithms are naive and the question arises whether there are more efficient algorithms to compute the .recently , showed that the resulting probabilities of # p - complete to compute both in the voting and the assignment settings .independently , also showed the same result for the assignment problem . in view of the inherent complexity of computing the , mentioned that identifying the conditions under which the problem is polynomial time as an open problem . random hybrid assignment mechanisms that hinge on the probabilities .they termed the problem of computing in the assignment domain as a `` very difficult research problem . ''  in view of the importance of in both voting and resource allocation and the recent negative computational results , we undertake an algorithmic study of .we show that amenable to efficient computation provided certain structural parameters are small .more precisely , we undertake a _parametrized _ complexity analysis of both voting and assignment .[ [ standard - vs .- parametrized - complexity ] ] standard vs. parametrized complexity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +  in _ standard computational complexity theory _, only the size of the problem instance is considered as a measure of the problem s complexity .an algorithm is deemed to be efficient if its running time is bounded by a polynomial function of the size of the instance ; in other words , for every instance of the problem , the running time of the algorithm is bounded by where is a fixed polynomial independent of the instance and is the size of the instance .unfortunately , not every problem is known to admit an efficient algorithm .indeed , researchers have identified certain classes of problems that are thought not to admit efficient algorithms .for example , the fact that is # p - complete strongly suggests that there is no efficient algorithm for computing the probabilities .  in _ parametrized complexity theory _, a finer multivariate analysis is undertaken by considering multiple _ parameters _ of the problem instance  .intuively , a parameter is some aspect of the problem input .for example , for computational problems on graphs , the maximum degree of the graph is a natural parameter .let be a parameter of an instance .a problem with parameter belongs to the class fpt , or is said to be _ fixed - parameter tractable _ , if there exists an algorithm that solves the problem in time , where  is some computable function and is a polynomial both independent of .the key idea behind fpt is to separate out the complexity into two components a component that depends solely on the size of the input , and a component that depends on the parameter .an fpt algorithm with parameter can solve instances in which the input size of the instance is large as long as is small and hence the growth of is relatively small .of course if is not small and is , say , exponential in , then the running time of the fpt algorithm can become too slow for practical purposes .nevertheless , designing fpt algorithms with different parameters is important as they expand tractability frontier for problems that are otherwise intractable in general .[ [ contributions ] ] contributions + + + + + + + + + + + + +  we propose algorithms to compute the that under reasonable assumptions are significantly more efficient than the naive method of going over permutations of the agents . to be precise , we present fpt algorithms with parameters such as # agent types , # alternatives , # alternative types and # houses .many of our algorithms exploit different dynamic programming formulations where the recursion is based on new insights into to voting and assignment . in this sense , our work not only yields more efficient algorithms for computing an , but also furthers our understanding of a keystone algorithm in social choice theory .we first define the voting setting and . we follow the notation used in . a voting setting consists of a set of _ agents _ having preferences over a finite set of _ alternatives _ where .the preferences of agents over alternatives are represented by a preference profile where each agent has complete and transitive preferences over . by ,also denoted by , we mean that alternative is at least as preferred by agent as alternative .we denote with the strict part of  ( if  but not  ) , and with  the symmetric part of  ( if  and  ) . a preference relation is _ linear _ if or  for all distinct alternatives .the size of an instance of a voting setting will be denoted by which is equal to .we let denote the set of all permutations of and write a permutation as .if is a preference relation and a subset of alternatives , then is the set of most preferred alternatives from according to .let be the -th agent in permutation .then , where and is the uniform lottery over the multi - set . in the literature, is simply referred to as _ serial dictatorship _ with respect to ordering .we illustrate how with the aid of a simple example .consider the following preference profile .  then let us consider the prio outcomes for each permutation over the voters .    thus the is  x ] , so if we can compute , we are done . in the rest of the proof , we derive a recurrence to do just that .  for each define the set of _ admissible signatures _ to be and the key observation is that every lucky permutation in the residual problem defined by must start with an agent having an admissible signature .  to compute the value of the dp ( dynamic program ) states , we use the following recurrence .   =      \begin{cases }       t(x ) ! & \text{if } \phi(x ) = x \\       0 & \text{if }\phi(x ) = \emptyset \\\displaystyle \sum_{i \in \phi(x ) } t_i ! { t(x ) -1 \choose t_i - 1 } m[x \setminus { \left\ { i \right\ } } ] & \text{otherwise }     \end{cases}\ ] ]  let us briefly justify each case of the recurrence .first , consider the case , which means that in the residual problem defined by every agent has in its top equivalence class . if that is the case , then every permutation of the agents is lucky .since there are agents in the residual problem , it follows that there are lucky permutations .second , consider the case , which means that in the residual problem defined by , not a single agent has in its top equivalence class . if that is the case , then there are no lucky permutations.  finally , consider the case .recall that every lucky permutation must begin with an agent with a signature .notice that after such an agent is chosen the set of possible alternatives is reduced to .also , the remaining agents agents with signature do not further constrain the set of alternatives . therefore , if we take a lucky permutation in the residual problem defined by and we strip from it all agents with signature , we are left with a lucky permutation for the residual problem defined by . similarly , if we take a lucky permutation for the residual problem defined by and we prepend one agent with signature and insert the remaining agents with signature any way we want , we have a lucky permutation for the residual problem defined by . notice that for each lucky permutation for there are ways of choosing the positions for the agents with signature and for each one of those there are ways of distributing the individual agents .if follows that there are  ( \vec{s } , \vec{b}) ] .we begin with some base cases .first , if there are no agents of type left or if the house is not available anymore , then there are no lucky permutations ; more formally , = 0 \quad \text { if } s_{j^ * } = 0 \text { or } h \in \operatorname{\textrm{dom}}(\vec{b}).\ ] ]  we say that is _ degenerate _ if for some . for such degenerate vectors ,let us define to be the vector such that is the most preferred house by agents of type that does not belong to or if all acceptable houses for agents of type belong to .it follows that if is degenerate then = m[\vec{s},\operatorname{\textrm{closure}}(\vec{b})].\ ] ]  let be the house that comes after in the total order of type preferences . if happens to be the last acceptable house for type- agents then .it is worth noting that can be defined recursively in terms of the operator : where the notation denotes the vector that is identical to except for coordinate , which takes the value ; in other words ,    our final corner case is that where there is an agent of type such that and . in this caseit does not matter where the remaining agents of type are placed in the permutation since none of them will get a house .therefore , we get = { s_1 + \cdots + s_t \choose s_j } s_j !      \cdot m[(\vec{s}_{-j } , 0 ) , \vec{b}].\ ] ]  for the recursive case of the recurrence , we condition on the type of agent that is chosen to lead the lucky permutation .if the agent is of type and , assuming , there are agents to choose from , so the number of such permutations will be .\ ] ] if the agent is of type , assuming , and the agent is not , then the number of such permutations is .\ ] ] finally , if the agent of type leading the lucky permutation is itself , then the number of such permutations is   putting everything together we get the following recurrence for for the case when is non - degenerate , , : =      & \sum_{\mathclap{j \neq j^ * : \atop s_j > 0 \wedge b_j \neq \textrm{nil } } } s_j \cdot m[(\vec{s}_{-j } , s_j -1 ) , ( \vec{b}_{-j } , \operatorname{\textrm{next}}_j(b_j ) ) ] \notag \\           & + ( s_{j^ * } - 1 ) \cdot m[(\vec{s}_{-j^ * } , s_{j^ * } -1 ) , ( \vec{b}_{-j^ * } , \operatorname{\textrm{next}}_{j^*}(b_{j^ * } ) ] \notag \\      & + \begin{cases }       ( -1 + \sum_{j } s_j ) ! & \text{if } b_{j^ * } = h \\       0 & \text{if } b_{j^ * } \neq h      \end{cases }   \end{aligned}\ ] ]  once the table is filled , the probability we are after is simply }{n!},\ ] ] where is the house most preferred by agents of type .let us bound the running time of the algorithm .first , we show how to efficiently compute the set of agent types present in the instance , their frequencies and preferences .think of the linear preference relation of some agent as a `` string '' whose `` letters '' are houses .notice that two agents of the same type give rise to the same string . in timewe can generate the set of all string and build a trie ( ch . 5 ,* ) out of them , keeping a frequency count of how many strings of each kind we have seen , which correspond to how many agents of that type there are .next , we need to bound the time it takes to fill the dp table .notice that the total number of entries  ] using takes time , while using other cases of the recurrence takes time provided the function is already computed , which takes time overall . adding everything up , we get that the total running time is as it appears in the theorem statement .[ cor : houses ] there is an fpt algorithm for computing with parameter .the running time is .notice that when we have houses , there can be at most agent types , one for each total ordering of every subset of the houses .the time bound follows from plugging into theorem [ th : fptassign ] :    where the last inequality follows from the upper bound , which is an easy consequence of stirling s approximation for factorial numbers .[ cor : assign - agent - types ] there is an algorithm for computing whose running time is .  the time bound follows directly from theorem [ th : fptassign ] : this paper , we presented the first parametrized complexity analysis of for the voting and assignment setting . for voting , we presented fpt algorithms for parameters # agent types and # alternatives . for the assignment setting, we presented an fpt algorithm for parameter # houses .although an fpt algorithm for the assignment setting with parameter # agent types still eludes us , we showed that the problem is polynomial - time solvable if # agent types is constant .we leave as an open problem to settle the parametrized complexity of in the assignment setting for the parameter .the authors thank the anonymous reviewers whose comments helped to improve the presentation of the paper .nicta is funded by the australian government through the department of communications and the australian research council through the ict centre of excellence program .h. aziz , f. brandt , and m. brill . on the tradeoff between economic efficiency and strategyproofness in randomized social choice . in _ proceedings of the 12th international conference on autonomous agents and multi - agent systems ( aamas )_ , pages 455462 .ifaamas , 2013 .d. saban and j. sethuraman .the complexity of computing the random priority allocation matrix . in y.chen and n. immorlica , editors , _ proceedings of the 9th international workshop on internet and network economics ( wine ) _ , lecture notes in computer science ( lncs ) , http://www.columbia.edu/ js1353/pubs / rpcomplexity.pdf , 2013 .

Abstract: voting and assignment are two of the most fundamental settings in social choice theory . for both settings , _ random serial dictatorship _ ( ) is a well - known rule that satisfies anonymity , ex post efficiency , and strategyproofness . recently , it was shown that computing the resulting probabilities is # p - complete both in the voting and assignment setting . in this paper , we present efficient parametrized algorithms to compute the probabilities for parameters such as the number of agent types , alternatives , or objects . when the parameters are small , then the respective algorithms are considerably more efficient than the naive approach of going through all permutations of agents .  social choice theory , random serial dictatorship , random priority , computational complexity , assignment setting . + _ jel _ : c6 , c7 .