# Datasets: ccdv /arxiv-classification

Languages: en
Size Categories: 10K<n<100K
Dataset Preview
text (string)label (class label)
8 (cs.DS)
9 (cs.NE)
3 (cs.SY)
8 (cs.DS)
5 (cs.CE)
8 (cs.DS)
1 (cs.CV)
6 (cs.PL)
8 (cs.DS)
0 (math.AC)
9 (cs.NE)
Alignment Elimination from Adams’ Grammars Härmel Nestra1 1 Institute of Computer Science, University of Tartu, J. Liivi 2, 50409 Tartu, Estonia harmel.nestra@ut.ee arXiv:1706.06497v1 [cs.PL] 20 Jun 2017 Abstract Adams’ extension of parsing expression grammars enables specifying indentation sensitivity using two non-standard grammar constructs — indentation by a binary relation and alignment. This paper proposes a step-by-step transformation of well-formed Adams’ grammars for elimination of the alignment construct from the grammar. The idea that alignment could be avoided was suggested by Adams but no process for achieving this aim has been described before. 1998 ACM Subject Classification D.3.1 Formal Definitions and Theory; D.3.4 Processors; F.4.2 Grammars and Other Rewriting Systems Keywords and phrases Parsing expression grammars, indentation, grammar transformation 1 Introduction Parsing expression grammars (PEG) introduced by Ford [6] serve as a modern framework for specifying the syntax of programming languages and are an alternative to the classic context-free grammars (CFG). The core difference between CFG and PEG is that descriptions in CFG can be ambiguous while PEGs are inherently deterministic. A syntax specification written in PEG can in principle be interpreted as a top-down parser for that syntax; in the case of left recursion, this treatment is not straightforward but doable (see, e.g., [8]). Formally, a PEG is a quadruple G = (N, T, δ, s) where: N is a finite set of non-terminals; T is a finite set of terminals; δ is a function mapping each non-terminal to its replacement (corresponding to the set of productions of CFG); s is the start expression (corresponding to the start symbol of CFG). So δ : N → EG and s ∈ EG , where the set EG of all parsing expressions writable in G is defined inductively as follows: 1. ε ∈ EG (the empty string); 2. a ∈ EG for every a ∈ T (the terminals); 3. X ∈ EG for every X ∈ N (the non-terminals); 4. pq ∈ EG whenever p ∈ EG , q ∈ EG (concatenation) 5. p/q ∈ EG whenever p ∈ EG , q ∈ EG (choice); 6. !p ∈ EG whenever p ∈ EG (negation, or lookahead); 7. p ∗ ∈ EG whenever p ∈ EG (repetition). All constructs of PEG except for negation are direct analogues of constructs of the EBNF form of CFG, but their semantics is always deterministic. So p ∗ repeats parsing of p until failure, and p/q always tries to parse p first, q is parsed only if p fails. For example, the expression ab/a consumes the input string ab entirely while a/ab only consumes its first character. The corresponding EBNF expressions ab | a and a | ab are equivalent, both can match either a or ab from the input string. Negation !p tries to parse p and fails if p succeeds; © Härmel Nestra; licensed under Creative Commons License CC-BY 2 Alignment Elimination from Adams’ Grammars if p fails then !p succeeds with consuming no input. Other constructs of EBNF like non-null repetition p + and optional occurrence [p] can be introduced to PEG as syntactic sugar. Languages like Python and Haskell allow the syntactic structure of programs to be shown by indentation and alignment, instead of the more conventional braces and semicolons. Handling indentation and alignment in Python has been specified in terms of extra tokens INDENT and DEDENT that mark increasing and decreasing of indentation and must be generated by the lexer. In Haskell, rules for handling indentation and alignment are more sophisticated. Both these languages enable to locally use a different layout mode where indentation does not matter, which additionally complicates the task of formal syntax specification. Adams and Ağacan [3] proposed an extension of PEG notation for specifying indentation sensitivity and argued that it considerably simplifies this task for Python, Haskell and many other indentation-sensitive languages. In this extension, expression p > , for example, denotes parsing of p while assuming a greater indentation than that of the surrounding block. In general, parsing expressions may be equipped with binary relations (as was > in the example) that must hold between the baselines of the local and the current indentation block. In addition, ¦p¦ denotes parsing of p while assuming the first token of the input being aligned, i.e., positioned on the current indentation baseline. For example, the do expressions in Haskell can be specified by <doexp> <istmts> <stmts> ::= ::= ::= do> (<istmts>/<stmts>) + (¦<stmt>¦ )> > { (<stmt>(;<stmt>)∗ [;]})~ Here, <istmts> and <stmts> stand for statement lists in the indentation and relaxed mode, respectively. In the indentation mode, a statement list is indented (marked by > in the second production) and all statements in it are aligned (marked by ¦ · ¦). In the relaxed mode, however, relation ~ is used to indicate that the indentation baseline of the contents can be anything. (Technically, ~ is the binary relation containing all pairs of natural numbers.) Terminals do and { are also equipped with > to meet the Haskell requirement that subsequent tokens of aligned blocks must be indented more than the first token. Alignment construct provides fulcra for disambiguating the often large variety of indentation baseline candidates. Besides simplicity of this grammar extension and its use, a strength of it lies in the fact that grammars can still serve as parsers. The rest of the paper is organized as follows. Section 2 formally introduces additional constructs of PEG for specifying code layout, defines their semantics and studies their semantic properties. In Sect. 3, a semantics-preserving process of eliminating the alignment construct from grammars is described. Section 4 refers to related work and Sect. 5 concludes. 2 Indentation extension of PEG Adams and Ağacan [3] extend PEGs with the indentation and alignment constructs. We propose a slightly different extension with three rather than two extra constructs. Our approach agrees with that implemented by Adams in his indentation package for Haskell [1], whence calling the grammars in our approach Adams’ grammars is justified. All differences between the definitions in this paper and in [3] are listed and discussed in Subsect. 2.4. Let N denote the set of all natural numbers, and let B = {tt, ff } (the Boolean domain). Denote by ℘(X) the set of all subsets of set X, and let <(X) denote the set of all binary relations on set X, i.e., <(X) = ℘(X × X). Standard examples are >∈ <(N) (consisting of all pairs (n, m) of natural numbers such that n > m) and 4 ∈ <(N) (the identity H. Nestra relation consisting of all pairs of equal natural numbers); the indentation extension also makes use of ~ ∈ <(N) (the relation containing all pairs of natural numbers). Whenever ρ ∈ <(X) and Y ⊆ X, denote ρ(Y ) = {x ∈ X : ∃y ∈ Y.(y, x) ∈ ρ} (the image of Y under relation ρ). The inverse relation of ρ is defined by ρ−1 = {(x, y) : (y, x) ∈ ρ}, and the composition of relations σ and ρ by σ ◦ ρ = {(x, z) : ∃y.(x, y) ∈ σ ∧ (y, z) ∈ ρ}. Finally,  denote <+ (X) = ρ ∈ <(X) : ∀x ∈ X.ρ−1 ({x}) 6= ∅ = {ρ ∈ <(X) : ρ(X) = X}. 2.1 Adams’ grammars Extend the definition of EG given in Sect. 1 with the following three additional clauses: 8. p ρ ∈ EG for every p ∈ EG and ρ ∈ <(N) (indentation); 9. p σ ∈ EG for every p ∈ EG and σ ∈ <(N) (token position); 10. ¦p¦ ∈ EG for every p ∈ EG (alignment). Parsing of an expression p ρ means parsing of p while assuming that the part of the input string corresponding to p forms a new indentation block whose baseline is in relation ρ to the baseline of the surrounding block. (Baselines are identified with column numbers.) The position construct p σ , missing in [3], determines how tokens of the input can be situated w.r.t. the current indentation baseline. Finally, parsing an expression ¦p¦ means parsing of p while assuming the first token of the input being positioned on the current indentation baseline (unlike the position operator, this construct does not affect processing the subsequent tokens). Inspired by the indentation package [1], we call the relations that determine token positioning w.r.t. the indentation baseline token modes. In the token mode > for example, tokens may appear only to the right of the indentation baseline. Applying the position operator with relation > to parts of Haskell grammar to be parsed in the indentation mode avoids indenting every single terminal in the example in Sect. 1. Also, indenting terminals with > is inadequate for do expressions occurring inside a block of relaxed mode but the position construct can be easily used to change the token mode for such blocks (e.g., to ≥). We call a PEG extended with these three constructs a PEG> . Recall from Sect. 1 that N and T denote the set of non-terminal and terminal symbols of the grammar, respectively, and δ : N → EG is the production function. Concerning the semantics of PEG> , each expression parses an input string of terminals (w ∈ T ∗ ) in the context of a current set of indentation baseline candidates (I ∈ ℘(N)) and a current alignment flag indicating whether the next terminal should be aligned or not (b ∈ B), assuming a certain token mode (τ ∈ <(N)). Parsing may succeed, fail, or diverge. If parsing succeeds, it returns as a result a new triple containing the rest of the input w0 , a new set I 0 of baseline candidates updated according to the information gathered during parsing, and a new alignment flag b0 . This result is denoted by >(w0 , I 0 , b0 ). If parsing fails, there is no result in a triple form; failure is denoted by ⊥. Triples of the form (w, I, b) ∈ T ∗ × ℘(N) × B are behaving as operation states of parsing, as each parsing step may use these data and update them. We will write State = T ∗ × ℘(N) × B (as we never deal with different terminal sets, dependence on T is not explicitly marked), and denote by State + 1 the set of possible results of parsing, i.e., {>(s) : s ∈ State} ∪ {⊥}. The assertion that parsing expression e in grammar G with input string w in the context of I and b assuming token mode τ results in o ∈ State + 1 is denoted by e, τ G (w, I, b) → o. The formal definition below must be interpreted inductively, i.e., an assertion of the form G, τ e s → o is valid iff it has a finite derivation by the following ten rules: 1. ε, τ G s → >(s). 2. For every a ∈ T , a, τ G (w, I, b) → o holds in two cases: 3 4 Alignment Elimination from Adams’ Grammars If o = >(w0 , I 0 , ff ) for w0 , I 0 , i such that w = ai w0 (ai denotes a occurring at column i) and either b = ff and i ∈ τ−1 (I), I 0 = I ∩ τ({i}), or b = tt and i ∈ I, I 0 = {i}; If o = ⊥, and there are no w0 and i such that w = ai w0 with either b = ff and i ∈ τ−1 (I) or b = tt and i ∈ I. 3. For every X ∈ N , X, τ G s → o holds if δ(X), τ G s → o holds. 4. For every p, q ∈ EG , pq, τ G s → o holds in two cases: If there exists a triple s0 such that p, τ G s → >(s0 ) and q, τ G s0 → o; If p, τ G s → ⊥ and o = ⊥. 5. For every p, q ∈ EG , p/q, τ G s → o holds in two cases: If there exists a triple s0 such that p, τ G s → >(s0 ) and o = >(s0 ); If p, τ G s → ⊥ and q, τ G s → o. 6. For every p ∈ EG , !p, τ G s → o holds in two cases: If p, τ G s → ⊥ and o = >(s); If there exists a triple s0 such that p, τ G s → >(s0 ) and o = ⊥. 7. For every p ∈ EG , p ∗ , τ G s → o holds in two cases: If p, τ G s → ⊥ and o = >(s); If there exists a triple s0 such that p, τ G s → >(s0 ) and p ∗ , τ G s0 → o. 8. For every p ∈ EG and ρ ∈ <(N), p ρ , τ G (w, I, b) → o holds in two cases: If there exists a triple (w0 , I 0 , b0 ) such that p, τ G (w, ρ−1 (I), b) → >(w0 , I 0 , b0 ) and o = >(w0 , I ∩ ρ(I 0 ), b0 ); If p, τ G (w, ρ−1 (I), b) → ⊥ and o = ⊥. 9. For every p ∈ EG and σ ∈ <(N), p σ , τ G s → o holds if p, σ G s → o holds. 10. For every p ∈ EG , ¦p¦, τ G (w, I, b) → o holds in two cases: If there exists a triple (w0 , I 0 , b0 ) such that p, τ G (w, I, tt) → >(w0 , I 0 , b0 ) and o = >(w0 , I 0 , b ∧ b0 ); If p, τ G (w, I, tt) → ⊥ and o = ⊥. The idea behind the conditions i ∈ τ−1 (I) and i ∈ I occurring in clause 2 is that any column i where a token may appear is in relation τ with the current indentation baseline (known to be in I) if no alignment flag is set, and coincide with the indentation baseline otherwise. For the same reason, consuming a token in column i restricts the set of allowed indentations to τ({i}) or {i} depending on the alignment flag. In both cases, the alignment flag is set to ff . In clause 8 for p ρ , the set I of allowed indentation is replaced by ρ−1 (I) as the local indentation baseline must be in relation ρ with the current indentation baseline known to be in I. After successful parsing of p with the resulting set of allowed local indentations being I 0 , the set of allowed indentations of the surrounding block is restricted to ρ(I 0 ). Clause 10 similarly operates on the alignment flag. > For a toy example, consider parsing of ¦ab¦ with the operation state (a2 b3 , N, ff ) assuming the token mode ≥. For that, we must parse ¦ab¦ with (a2 b3 , N \ {0} , ff ) by clause 8 since >−1 (N) = N \ {0}. For that in turn, we must parse ab with (a2 b3 , N \ {0} , tt) by clause 10. By clause 2, we have a, ≥ G (a2 b3 , N \ {0} , tt) → >(b3 , {2} , ff ) (as 2 ∈ N \ {0}) and b, ≥ G (b3 , {2} , ff ) → >(ε, {2} , ff ) (as (2, 3) ∈ ≥−1 ). Therefore, by clause 4, ab, ≥ G (a2 b3 , N \ {0} , tt) → >(ε, {2} , ff ). Finally, ¦ab¦, ≥ G (a2 b3 , N \ {0} , ff ) → >(ε, {2} , ff ) and > ¦ab¦ , ≥ G (a2 b3 , N, ff ) → >(ε, {0, 1} , ff ) by clauses 10 and 8. The set {0, 1} in the final state shows that only 0 and 1 are still candidates for the indentation baseline outside the parsed part of the input (before parsing, the candidate set was the whole N). Note that this definition involves circular dependencies. For instance, if δ(X) = X for some X ∈ N then X, τ G s → o if X, τ G s → o by clause 3. There is no result of parsing in such cases (not even ⊥). We call this behaviour divergence. H. Nestra 2.2 5 Properties of the semantics Ford [6] proves that parsing in PEG is unambiguous, whereby the consumed part of an input string always is its prefix. Theorem 2.1 below is an analogous result for PEG> . Besides the uniqueness of the result of parsing, it states that if we only consider relations in <+ (N) then the whole operation state in our setting is in a certain sense decreasing during parsing. Denote by ≥ the suffix order of strings (i.e., w ≥ w0 iff w = uw0 for some u ∈ T ∗ ) and by w the implication order of truth values (i.e., tt A ff ). Denote by > the pointwise order on operation states, i.e., (w, I, b) > (w0 , I 0 , b0 ) iff w ≥ w0 , I ⊇ I 0 and b w b0 . I Theorem 2.1. Let G = (N, T, δ, s) be a PEG> , e ∈ EG , τ ∈ <+ (N) and s ∈ State. Then e, τ G s → o for at most one o, whereby o = >(s0 ) implies s > s0 . Also if s = (w, I, b) and s0 = (w0 , I 0 , b0 ) then s 6= s0 implies both w > w0 and b0 = ff , and I 6= ∅ implies I 0 6= ∅. Proof. By induction on the shape of the derivation tree of the assertion e, τ G s → o. J Theorem 2.1 enables to observe a common pattern in the semantics of indentation and alignment. Denoting by κ(p) either p ρ or ¦p¦, both clauses 8 and 10 have the following form, parametrized on two mappings α, γ : State → State: For p ∈ EG , κ(p), τ G s → o holds in two cases: If there exists a state s0 such that p, τ G α(s) → >(s0 ) and o = >(s ∧ γ(s0 )); If p, τ G α(s) → ⊥ and o = ⊥. The meanings of indentation and alignment constructs are distinguished solely by α and γ. For many properties, proofs that rely on this abstract common definition can be carried out, assuming that γ is monotone, preserves the largest element and follows together with α the axiom x ∧ γ(y) ≤ γ(α(x) ∧ y). The class of all meet semilattices L with top element, equipped with mappings α, γ satisfying these three conditions, contains identities (i.e., semilattices L with α = γ = idL ) and is closed under compositions (of different α, γ defined on the same semilattice L) and under direct products. If ρ ∈ <+ (N) then the conditions hold for α1 , γ1 : ℘(N) → ℘(N) with α1 (I) = ρ−1 (I), γ1 (I) = ρ(I), similarly in the case if α2 , γ2 : B → B with α2 (b) = tt, γ2 (b) = b. Now the direct product of the identities of T ∗ and B with (α1 , γ1 ) on ℘(N) gives the indentation case, and the direct product of the identities of T ∗ and ℘(N) and the Boolean lattice B with (α2 , γ2 ) gives the alignment case. If α, γ satisfy the conditions then γ(α(x)) ≥ x since x = x∧> = x∧γ(>) ≤ γ(α(x)∧>) = γ(α(x)). Adding dual conditions (α monotone, α(⊥) = ⊥ and α(x) ∨ y ≥ α(x ∨ γ(y))) would make (α, γ) a Galois’ connection. In our cases, the dual axioms do not hold. 2.3 Semantic equivalence I Definition 2.2. Let G = (N, T, δ, s) be a PEG> and p, q ∈ EG . We say that p and q are semantically equivalent in G and denote p ∼G q iff p, τ G s → o ⇐⇒ q, τ G s → o for every τ ∈ <+ (N), s ∈ State and o ∈ State + 1. For example, one can easily prove that pε ∼G p ∼G εp, p(qr ) ∼G (pq)r , p/(q/r ) ∼G (p/q)/r , p(q/r ) ∼G pq/pr , p/q ∼G p/!pq for all p, q, r ∈ EG [6]. We are particularly interested in equivalences involving the additional operators of PEG> . In Sect. 3, they will be useful in eliminating alignment and position operators. The following Theorem 2.3 states distributivity laws of the three new operators of PEG> w.r.t. other constructs: I Theorem 2.3. Let G = (N, T, δ, s) be a PEG> . Then: 6 Alignment Elimination from Adams’ Grammars 1. εσ ∼G ε, (pq)σ ∼G p σ q σ , (p/q)σ ∼G p σ /q σ , (!p)σ ∼G !p σ , (p ∗ )σ ∼G (p σ )∗ , (p ρ )σ ∼G (p σ )ρ , ¦p¦σ ∼G ¦p σ ¦ for all σ ∈ <+ (N); 2. ερ ∼G ε, (p/q)ρ ∼G p ρ /q ρ , (!p)ρ ∼G !p ρ , (p σ )ρ ∼G (p ρ )σ for all ρ ∈ <+ (N); 3. ¦ε¦ ∼G ε, ¦p/q¦ ∼G ¦p¦/¦q¦, ¦!p¦ ∼G !¦p¦, ¦p σ ¦ ∼G ¦p¦σ . Proof. The equivalences in claim 1 hold as the token mode steadily distributes to each case of the semantics definition. Those in claims 2 and 3 have straightforward proofs using the joint form of the semantics of indentation and alignment and the axioms of α, γ. J Note that indentation does not distribute with concatenation, i.e., (pq)ρ G p ρ q ρ . This is because (pq)ρ assumes one indentation block with a baseline common to p and q while p ρ q ρ tolerates different baselines for p and q. For example, take p = a ∈ T , q = b ∈ T , let the token mode be 4 and the input state be (a1 b2 , N, ff ) (recall that ai means terminal a occurring in column i). We have a, 4 G (a1 b2 , N \ {0} , ff ) → >(b2 , {1} , ff ) and b, 4 G (b2 , {1} , ff ) → ⊥ (since (2, 1) ∈ / 4), therefore ab, 4 G (a1 b2 , N \ {0} , ff ) → ⊥ > 1 2 and (ab) , 4 G (a b , N, ff ) → ⊥. On the other hand, a, 4 G (a1 b2 , N \ {0} , ff ) → >(b2 , {1} , ff ) implies a> , 4 G (a1 b2 , N, ff ) → >(b2 , {0} , ff ) (since N ∩ (> ({1})) = {0}) and, analogously, b> , 4 G (b2 , {0} , ff ) → >(ε, {0} , ff ) (since >−1 ({0}) = N \ {0} 3 2 and {0} ∩ (> ({2})) = {0}). Consequently, a> b> , 4 G (a1 b2 , N, ff ) → >(ε, {0} , ff ). We can however prove the following facts: I Theorem 2.4. Let G = (N, T, δ, s) be a PEG> . 1. Identity indentation law: For all p ∈ EG , p 4 ∼G p. 2. Composition law of indentations: For all p ∈ EG and ρ, σ ∈ <+ (N), (p ρ )σ ∼G p σ◦ρ . ρ 3. Distributivity of indentation and alignment: For all p ∈ EG and ρ ∈ <+ (N), ¦p¦ ∼G ¦p ρ ¦. 4. Idempotence of alignment: For all p ∈ EG , ¦¦p¦¦ ∼G ¦p¦. 5. Cancellation of outer token modes: For all p ∈ EG and σ, τ ∈ <(N), (p σ )τ ∼G p σ . 6. Terminal alignment property: For all a ∈ T , ¦a¦ ∼G a4 . Proof. For claim 1, note that an indentation with the identity relation 4 corresponds to α, γ being identity mappings. Hence   0 0 0  ∃s .p, τ G s → >(s ) ∧ o = >(s ∧ s )  p 4 , τ G s → o ⇐⇒ or   p, τ G s → ⊥ ∧ o = ⊥   0 0 0  ∃s .p, τ G s → >(s ) ∧ o = >(s )  ⇐⇒ or   p, τ G s → ⊥ ∧ o = ⊥ ⇐⇒ p, τ G s → o, where s ∧ s0 can be replaced with s0 because s > s0 by Theorem 2.1. Concerning claims 2–4, let κ1 , κ2 be two constructs whose semantics follow the common pattern of indentation and alignment with mapping pairs (α1 , γ1 ) and (α2 , γ2 ), respectively. Then κ2 (κ1 (p)), τ G s → o   0 0 0  ∃s .κ1 (p), τ G α2 (s) → >(s ) ∧ o = >(s ∧ γ2 (s ))  ⇐⇒ or   κ1 (p), τ G α2 (s) → ⊥ ∧ o = ⊥   00 00 00  ∃s .p, τ G α1 (α2 (s)) → >(s ) ∧ o = >(s ∧ γ2 (α2 (s) ∧ γ1 (s )))  ⇐⇒ . or   p, τ G α1 (α2 (s)) → ⊥ ∧ o = ⊥ H. Nestra 7 By monotonicity of γ2 and the fact that s 6 γ2 (α2 (s)), we have s ∧ γ2 (α2 (s) ∧ γ1 (s00 )) 6 s ∧ γ2 (α2 (s)) ∧ γ2 (γ1 (s00 )) = s ∧ γ2 (γ1 (s00 )). By the third axiom of α2 and γ2 , we also have γ2 (α2 (s) ∧ γ1 (s00 )) > s ∧ γ2 (γ1 (s00 )) whence s ∧ γ2 (α2 (s) ∧ γ1 (s00 )) > s ∧ γ2 (γ1 (s00 )). Consequently, s ∧ γ2 (α2 (s) ∧ γ1 (s00 )) can be replaced with s ∧ γ2 (γ1 (s00 )). Hence the semantics of the composition of κ1 and κ2 follows the pattern of semantics of indentation and alignment for mappings α1 ◦α2 and γ2 ◦γ1 . To prove claim 2, it now suffices to observe that the mappings α, γ in the semantics of (·)σ◦ρ equal the compositions of the corresponding mappings for the semantics of (·)ρ and (·)σ . For claim 3, it suffices to observe that the mappings α, γ given for an indentation and for alignment modify different parts of the operation state whence their order of application is irrelevant. Claim 4 holds because the mappings α, γ in the alignment semantics are both idempotent. Finally, claim 5 is trivial and claim 6 follows from a straightforward case study. J Theorems 2.3 and 2.4 enact bringing alignments through all syntactic constructs except concatenation. Alignment does not distribute with concatenation, because in parsing of an expression of the form ¦pq¦, the terminal to be aligned can be in the part of the input consumed by p or (if parsing of p succeeds with consuming no input) by q. Alignment can nevertheless be moved through concatenation if any successful parsing of the first expression in the concatenation either never consumes any input or always consumes some input: I Theorem 2.5. Let G = (N, T, δ, s) be a PEG> and p, q ∈ EG . 1. If p, τ G s → >(s0 ) implies s0 = s for all τ ∈ <+ (N), s, s0 ∈ State, then ¦pq¦ ∼G ¦p¦¦q¦. 2. If p, τ G s → >(s0 ) implies s0 6= s for all τ ∈ <+ (N), s, s0 ∈ State, then ¦pq¦ ∼G ¦p¦q. Proof. Straightforward case study. J Theorem 2.5 (1) holds also for indentation (instead of alignment), the same proof in terms of α, γ is valid. Finally, the following theorem states that position and indentation of terminals are equivalent if the alignment flag is false and the token mode is the identity: I Theorem 2.6. Let G = (N, T, δ, s) be a PEG> . Let a ∈ T , σ ∈ <+ (N) and w ∈ T ∗ , I ∈ ℘(N), o ∈ State + 1. Then aσ , 4 G (w, I, ff ) → o ⇐⇒ aσ , 4 G (w, I, ff ) → o. Proof. Straightforward case study. 2.4 J Differences of our approach from previous work Our specification of PEG> differs from the definition used by Adams and Ağacan [3] by three essential aspects listed below. The last two discrepancies can be understood as bugs in the original description that have been corrected in the Haskell indentation package by Adams [1]. This package also provides means for locally changing the token mode. All in all, our modifications fully agree with the indentation package. 1. The position operator p σ is missing in [3]. The treatment there assumes just one default token mode applying to the whole grammar, whence token positions deviating from the default must be specified using the indentation operator. The benefits of the position operator were shortly discussed in Subsect. 2.1. 2. According to the grammar semantics provided in [3], the alignment flag is never changed at the end of parsing of an expression of the form ¦p¦. This is not appropriate if p succeeds without consuming any token, as the alignment flag would unexpectedly remain true during parsing of the next token that is out of scope of the alignment operator. The value the alignment flag had before starting parsing ¦p¦ should be restored in this case. This is the purpose of conjunction in the alignment semantics described in this paper. 8 Alignment Elimination from Adams’ Grammars 3. In [3], an alignment is interpreted w.r.t. the indentation baseline of the block that corresponds to the parsing expression to which the alignment operator is applied. Indentation operators occurring inside this expression and processed while the alignment flag is true are neglected. In the semantics described in our paper, raising the alignment flag does not suppress new indentations. Alignments are interpreted w.r.t. the indentation baseline in force at the aligned token site. This seems more appropriate than the former approach where the indentations cancelled because of an alignment do not apply even to the subsequent non-aligned tokens. Distributivity of indentation and alignment fails in the semantics of [3]. Note that alignment of a block nevertheless suppresses the influence of position operators whose scope extend over the first token of the block. Our grammar semantics has also two purely formal deviations from the semantics used by Adams and Ağacan [3] and Ford [6]. 1. We keep track of the rest of the input in the operation state while both [3, 6] expose the consumed part of the input instead. This difference was introduced for simplicity and to achieve uniform decreasing of operation states in Theorem 2.1. 2. We do not have explicit step counts. They were used in [6] to compose proofs by induction. We provide analogous proofs by induction on the shape of derivation trees. 3 Elimination of alignment and position operators Adams [2] describes alignment elimination in the context of CFGs. In [3], Adams and Ağacan claim that alignment elimination process for PEGs is more difficult due to the lookahead construct. To our knowledge, no concrete process of semantics-preserving alignment elimination is described for PEGs before. We provide one below for well-formed grammars. We rely on the existence of position operators in the grammar; this is not an issue since we also show that position operators can be eliminated from alignment-free grammars. 3.1 Approximation semantics and well-formed expressions For defining well-formedness, we first need to introduce approximation semantics that consists of assertions of the form e *G n where e ∈ EG and n ∈ {−1, 0, 1}. This semantics is a decidable extension of the predicate that tells whether parsing of e may succeed with consuming no input (result 0), succeed with consuming some input (result 1) or fail (result −1). No particular input strings, indentation sets etc. are involved, whence the semantics is not deterministic. The following set of clauses define the approximation semantics inductively. ε *G 0. For every a ∈ T , a *G 1 and a *G −1. For every X ∈ N , X *G n if δ(X) *G n. For every p, q ∈ EG , pq *G n holds in four cases: p *G 0, q *G 0 and n = 0; There exist n0 , n00 ∈ {0, 1} such that p *G n0 , q *G n00 , 1 ∈ {n0 , n00 } and n = 1; There exists n0 ∈ {0, 1} such that p *G n0 , q *G −1 and n = −1; p *G −1 and n = −1. 5. For every p, q ∈ EG , p/q *G n holds in two cases: p *G n and n ∈ {0, 1}; p *G −1 and q *G n. 6. For every p ∈ EG , !p *G n holds in two cases: 1. 2. 3. 4. H. Nestra 7. 8. 9. 10. 9 p *G −1 and n = 0; There exists n0 ∈ {0, 1} such that p *G n0 and n = −1. For every p ∈ EG , p ∗ *G n holds in two cases: p *G −1 and n = 0; p *G −1, p *G 1 and n = 1. For every p ∈ EG and ρ ∈ <(N), p ρ *G n if p *G n. For every p ∈ EG and σ ∈ <(N), p σ *G n if p *G n. For every p ∈ EG , ¦p¦ *G n if p *G n. On the PEG constructs (1–7), our definition basically copies that given by Ford [6], except for the case p ∗ *G 1 where our definition requires p *G −1 besides p *G 1. This is sound since if parsing of p never fails then parsing of p ∗ cannot terminate. The difference does not matter in the grammar transformations below as they assume repetition-free grammars. I Theorem 3.1. Let G = (N, T, δ, s) be a PEG> . Assume that e, τ G s → o for some τ ∈ <(N) and s ∈ State, o ∈ State + 1. Then: 1. If o = >(s) then e *G 0; 2. If o = >(s0 ) for some s0 6= s then e *G 1; 3. If o = ⊥ then e *G −1. Proof. By induction on the shape of the derivation tree of the assertion e, τ G s → o. J Well-formedness is a decidable conservative approximation of the predicate that is true iff parsing in G never diverges (it definitely excludes grammars with left recursion but can exclude also some safe grammars). Well-formedness of PEGs was introduced by Ford [6]. The following set of clauses is an inductive definition of predicate WF G , well-formedness of expressions, for PEG> : 1. ε ∈ WF G ; 2. For every a ∈ T , a ∈ WF G ; 3. For every X ∈ N , X ∈ WF G if δ(X) ∈ WF G ; 4. For every p, q ∈ EG , pq ∈ WF G if p ∈ WF G and, in addition, p *G 0 implies q ∈ WF G ; 5. For every p, q ∈ EG , p/q ∈ WF G if p ∈ WF G and, in addition, p *G −1 implies q ∈ WF G ; 6. For every p ∈ EG , !p ∈ WF G if p ∈ WF G ; 7. For every p ∈ EG , p ∗ ∈ WF G if p 6*G 0 and p ∈ WF G ; 8. For every p ∈ EG and ρ ∈ <+ (N), p ρ ∈ WF G if p ∈ WF G ; 9. For every p ∈ EG and σ ∈ <+ (N), p σ ∈ WF G if p ∈ WF G ; 10. For every p ∈ EG , ¦p¦ ∈ WF G if p ∈ WF G . This definition rejects non-terminals with directly or indirectly left recursive rules since for a concatenation pq to be well-formed, p must be well-formed, leading to an infinite derivation in the case of any kind of left recursion. On the other hand, requiring both p ∈ WF G and q ∈ WF G in the clause for pq ∈ WF G would be too restrictive since this would reject non-terminals with meaningful recursive productions like X 7→ aX/ε. Again, clauses for PEG constructs (1–7) mostly copy the definition given by Ford [6]. This time, the choice case is an exception. In [6], p/q is considered well-formed only if both p and q are well-formed, which needlessly rejects non-terminals with safe recursive rules like X 7→ ε/X. We require q ∈ WF G only if q could possibly be executed, i.e. if p *G −1. A grammar G = (N, T, δ, s) is called well-formed if p ∈ WF G for every expression p occurring as a subexpression in some δ(X) or s. Ford [6] proves by induction on the length 10 Alignment Elimination from Adams’ Grammars of the input string that, in well-formed grammars, parsing of every expression whose all subexpressions are well-formed terminates on every input string. We can prove an analogous result in a similar way but we prefer to generalize the statement to a stricter semantics which enables to occasionally construct easier proofs later. The new semantics, which we call strict, is defined by replacing the choice clause in the definition of Subsect. 2.1 with the following: 5. For every p, q ∈ EG , p/q, τ G s → o holds in two cases: There exists a triple s0 such that p, τ G s → >(s0 ), o = >(s0 ) and, in addition, p *G −1 implies q, τ G s → o0 for some o0 ∈ State + 1; p, τ G s → ⊥ and q, τ G s → o. The new semantics is more restrictive since, to finish parsing of an expression of the form p/q after parsing p successfully, also q must be parsed if p *G −1 happens to be the case. In the standard semantics, parsing of p/q does not have to try q if parsing of p is successful. So, if parsing of an expression terminates in the strict semantics then it terminates with the same result in the standard semantics (but not necessarily vice versa). Therefore proving that parsing always gives a result in the strict semantics will establish this also for the standard semantics. In the rest, we sign strict semantics with exclamation mark, i.e., parsing assertions will be of the form e, τ ! G s → o. I Theorem 3.2. Let G = (N, T, δ, s) be a well-formed PEG> and let e ∈ EG . Assume that all subexpressions of e are well-formed. Then for every τ ∈ <+ (N) and s ∈ State, there exists o ∈ State + 1 such that e, τ ! G s → o. Proof. By induction on the length of the input string (i.e., the first component of s). The induction step uses induction on the shape of the derivation tree of the assertion e ∈ WF G . J 3.2 Splitting As the repetition operator can always be eliminated (by adding a new non-terminal Ap with δ(Ap ) = pAp /ε for each subexpression p that occurs under the star operator), we may assume that the input grammar G is repetition-free. The first stage of our process also assumes that G is well-formed, all negations are applied to atomic expressions, and all choices are disjoint. A choice expression p/q is called disjoint if parsing of p and q cannot succeed in the same input state and token mode. Achieving the last two preconditions can be considered as a preparatory and previously studied (e.g. in [6] as stage 1 of negation elimination) step of the process. Issues concerning this are discussed briefly in Subsect. 3.5. We use in principle the same splitting algorithm as in stage 2 of the negation elimination process described by Ford [6], adding clauses for the extra operators in PEG> . The approach defines two functions γ0 : WF G → EG and γ1 : EG → EG as follows (F is a metavariable denoting any expression that always fails, e.g., !ε): γ0 (ε) γ0 (a) γ0 (X) γ0 (pq) γ0 (p/q) γ0 (!p) γ0 (p ρ ) γ0 (p σ ) γ0 (¦p¦) =ε = F = γ0 (δ(X))   γ0 (p)γ0 (q) if p *G 0 = F otherwise   γ0 (p)/γ0 (q) if p *G −1 = γ0 (p) otherwise = !(γ1 (p)/γ0 (p)) = (γ0 (p))ρ = (γ0 (p))σ = ¦γ0 (p)¦ γ1 (ε) γ1 (a) γ1 (X) =F = a =X γ1 (pq) = γ1 (p)γ1 (q)/γ1 (p)γ0 (q)/γ0 (p)γ1 (q)   γ1 (p)/γ1 (q) if p *G −1 γ1 (p/q) = γ1 (p) otherwise γ1 (!p) = F γ1 (p ρ ) = (γ1 (p))ρ γ1 (p σ ) = (γ1 (p))σ γ1 (¦p¦) = ¦γ1 (p)¦ H. Nestra 11 Correctness of the definition of γ0 follows by induction on the shape of the derivation tree of the assertion e ∈ WF G . In the negation case, we use that negations are applied to atomic expressions, whence the reference to γ1 can be eliminated by a replacement from its definition. The definition of γ1 is sound by induction on the shape of the expression e. A new grammar G0 = (N, T, δ0 , s 0 ) is defined using γ0 , γ1 by equations δ0 (X) = γ1 (δ(X)), 0 s = γ1 (s)/γ0 (s). The equivalence of the input and output grammars relies on the splitting invariant established by Theorem 3.3 below which allows instead of each parsing expression e with negations in front of atoms and disjoint choices in G to equivalently use parsing expression γ1 (e)/γ0 (e) in G0 . The claim is analogous to the splitting invariant used by [6] but we can provide a simpler proof using the strict semantics (an analogous proof using the standard semantics would fail in the choice case). I Theorem 3.3. Let e, τ G s → o where e ∈ EG , τ ∈ <+ (N) and s ∈ State, o ∈ State + 1. Assuming that all choices in the rules of G and expression e are disjoint and the negations are applied to atoms, the following holds: 1. If o = >(s) then γ0 (e), τ G0 s → >(s) and γ1 (e), τ G0 s → ⊥; 2. If o = >(s0 ) where s0 6= s then γ0 (e), τ G0 s → ⊥ and γ1 (e), τ G0 s → >(s0 ); 3. If o = ⊥ then γ0 (e), τ G0 s → ⊥ and γ1 (e), τ G0 s → ⊥. Proof. We don’t use the repetition operator, whence all expressions in well-formed grammars are well-formed (this fact follows from an easy induction on the expression structure). By Theorems 3.2 and 2.1, e, τ ! G s → o. The desired result follows by induction of the shape of the derivation tree of e, τ ! G s → o, using the disjointness assumption in the choice case. J As the result of this transformation, the sizes of the right-hand sides of the productions can grow exponentially though the number of productions stays unchanged. Preprocessing the grammar via introducing new non-terminals in such a way that all concatenations were applied to atoms (similarly to Ford [6]) would hinder the growth, but the size in the worst case remains exponential. The subsequent transformations cause at most a linear growth of right-hand sides. 3.3 Alignment elimination In a grammar G = (N, T, δ, s) obtained via splitting, we can eliminate alignments using the following three steps: 1. Introduce a copy X 0 of each non-terminal X and define δ(X 0 ) = ¦δ(X)¦. 2. In all right-hand sides of productions and the start expression, apply distributivity laws (Theorem 2.3 (3), Theorem 2.4 (3), Theorem 2.5) and idempotence (Theorem 2.4 (4)) to bring all alignment operators down to terminals and non-terminals. Replace alignment of terminals by position (Theorem 2.4 (6)). 3. In all right-hand sides of productions and the start expression, replace all subexpressions of the form ¦X¦ with the corresponding new non-terminal X 0 . For establishing the equivalence of the original and the obtained grammar, the following general theorem can be used. I Theorem 3.4. Let G1 = (N, T, δ1 , s 1 ) and G2 = (N, T, δ2 , s 2 ) be PEG> s. If for every X ∈ N , δ1 (X) ∼G1 δ2 (X) then e, τ G2 s → o always implies e, τ G1 s → o. Proof. Easy induction on the shape of the derivation tree of e, τ G2 s → o. J 12 Alignment Elimination from Adams’ Grammars Denote by φ the function defined on EG that performs transformations of steps 2–3, i.e., distributes alignment operators to the non-terminals and replaces aligned non-terminals with corresponding new non-terminals. Denote by G0 the grammar obtained after step 3. Note that step 1 does not change the semantics of expressions written in the original grammar. Steps 2 and 3 replace the right-hand sides of productions with expressions that are semantically equivalent with them in the grammar obtained after step 1. By Theorem 3.4, this implies that whenever parsing of some e ∈ EG in the final grammar G0 produces some result then the same result is obtained when parsing e with the same input state and token mode in the original grammar G. In order to be able to apply Theorem 3.4 with grammars interchanged, we need the equivalence of the right-hand sides of productions also in grammar G0 . For this, it is sufficient to show ¦X¦ ∼G0 X 0 for every X ∈ N , which in turn would follow from the statement ¦φ(δ(X))¦ ∼G0 φ(¦δ(X)¦). Consequently, the equivalence of the initial and final grammars is implied by the following theorem. I Theorem 3.5. For every e ∈ EG , φ(¦e¦) ∼G0 ¦φ(e)¦. Proof. The claim is a direct consequence of the following two lemmas, both holding for arbitrary s ∈ State, o ∈ State + 1: If φ(¦e¦), τ G0 s → o then ¦φ(e)¦, τ G0 s → o and ¦φ(¦e¦)¦, τ G0 s → o; If ¦φ(e)¦, τ G0 s → o or ¦φ(¦e¦)¦, τ G0 s → o then φ(¦e¦), τ G0 s → o. Both lemmas are proven by induction on the shape of derivation trees. The assertion with two alignments (both outside and inside) is needed in the case where e itself is of the form ¦p¦. J 3.4 Elimination of position operators In an alignment-free PEG> G = (N, T, δ, s), we can get rid of position operations using a process largely analogous to the alignment elimination, consisting of the following four steps: 1. Introduce a new non-terminal hX, τi for each existing non-terminal X and relation τ used by a position operator, with δ(hX, τi) = (δ(X))τ . 2. Apply distributivity laws (Theorem 2.3 (1)) and cancellation (Theorem 2.4 (5)) to bring all position operators down to terminals and non-terminals. 3. Replace all subexpressions of the form Xτ with corresponding new non-terminals hX, τi. 4. Replace all subexpressions of the form aτ with aτ . Again, denote by φ the function defined on EG that performs transformations of steps 2–3, i.e., distributes position operators to the terminals and non-terminals and replaces non-terminals under position operators with corresponding new non-terminals. Denote by G0 the grammar obtained after step 3. Theorem 3.4 applies here as well, whence the equivalence of the grammar obtained after step 3 and the initial grammar is implied by the following Theorem 3.6. I Theorem 3.6. For every e ∈ EG and σ ∈ <+ (N), φ(e σ ) ∼G0 (φ(e))σ . Proof. The claim is a direct consequence of the following two lemmas, both holding for arbitrary s ∈ State, o ∈ State + 1 and τ, υ ∈ <+ (N): If φ(e σ ), τ G0 s → o then (φ(e))σ , τ G0 s → o and (φ(e σ ))υ , τ G0 s → o; If (φ(e))σ , τ G0 s → o or (φ(e σ ))υ , τ G0 s → o then φ(e σ ), τ G0 s → o. Both lemmas are proven by induction on the shape of the derivation trees. The claim with position operator both outside and inside ((φ(e σ ))υ ) is needed in the case when e itself is an application of the position operator. J H. Nestra Correctness of step 4 can be proven by induction on the shape of the derivation trees, using Theorem 2.6. Note that here we must assume that parsing according to the final grammar is performed with the alignment flag false (a natural assumption as the grammar is alignment-free) and the token mode 4. 3.5 Discussion on the preconditions Alignment elimination was correctly defined under the assumption that the input grammar is well-formed, has negations only in front of atoms, and disjoint choices (all these conditions are needed at stage 1 only). The second assumption can be easily established by introducing a new non-terminal for each expression p such that !p occurs in the productions or in the start expression. This can be done in the lines of the first stage of the negation elimination process described by Ford [6]. This transformation preserves well-formedness of the grammar. Achieving disjoint choices is a more subtle topic. A straightforward way would be replacing choices of the form p/q with disjoint choices p/!pq which seems to work well as p/q and p/!pq are equivalent in the standard semantics. Alas, p/q and p/!pq are not equivalent in the approximation semantics, because if p *G 1, p *G −1, q *G 0 but q 6*G −1, then p/!pq *G −1 while p/q 6*G −1. Due to this, replacing p/q with p/!pq can break well-formedness. Take X ∈ N such that δ(X) =!(a/ε)X. Then X ∈ WF G due to !(a/ε) ∈ WF G alone, no recursive call to X ∈ WF G arises as !(a/ε) 6*G 0. However, if δ0 (X) =!(a/!aε)X in G0 then !(a/!aε) *G0 0 whence well-formedness of X now recursively requires well-formedness of X. Thus X ∈ / WF G0 . (An argument similar to this shows that the first stage of the negation elimination process in Ford [6] also can break well-formedness. As the second stage is correctly defined only for well-formed grammars, the whole process fails.) One solution would be changing the approximation semantics by adding, to the inductive definition in Subsect. 3.1, a general clause 0. e *G −1 if e *G 0 or e *G 1. This forces e *G −1 to hold whenever an assertion of the form e *G n holds, and in particular, p/q becomes equivalent to p/!pq. Then replacing p/q with p/!pq preserves well-formedness. Although well-formedness predicate becomes more restrictive and rejects more safe grammars, the loss seems to be little and acceptable in practice (expressions q such that q *G 0 or q *G 1 while q 6*G −1 seem to occur not very commonly in influenced productions such as X 7→!(p/q)X, but a further investigation is needed to clarify this). 4 Related work PEGs were first introduced and studied by Ford [6] who also showed them to be closely related with the TS system [5] and TDPL [4], as well as to their generalized forms [5, 4]. Adams [2] and Adams and Ağacan [3] provide an excellent overview of previous approaches to describing indentation-sensitive languages and attempts of building indentation features into parser libraries. Our work is a theoretical study of the approach proposed in [3] while some details of the semantics used in our paper were “corrected” in the lines of Adams’ indentation package for Haskell [1]. This package enables specifying indentation sensitivity within the Parsec and Trifecta parser combinator libraries. A process of alignment operator elimination is previously described for CFGs by Adams [2]. Matsumura and Kuramitsu [7] develop a very general extension of PEG that also enables to specify indentation. Their framework is powerful but complicated. The approach proposed 13 14 Alignment Elimination from Adams’ Grammars in [3] and followed by us is in contrast with [7] by focusing on indentation and aiming to maximal simplicity and convenience of usage. 5 Conclusion We studied the extension of PEG proposed by Adams and Ağacan [3] for indentationsensitive parsing. This extension uses operators for marking indentation and alignment besides the classic ones. Having added one more operator (position) for convenience, we found a lot of useful semantic equivalences that are valid on expressions written in the extended grammars. We applied these equivalences subsequently for defining a process that algorithmically eliminates all alignment and position operators from well-formed grammars. References 1 2 3 4 5 6 7 8 Michael D. Adams. The indentation package. URL: http://hackage.haskell.org/ package/indentation. Michael D. Adams. Principled parsing for indentation-sensitive languages: Revisiting Landin’s offside rule. In Roberto Giacobazzi and Radhia Cousot, editors, The 40th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’13, Rome, Italy - January 23 - 25, 2013, pages 511–522. ACM, 2013. URL: http://doi.acm.org/10.1145/2429069.2429129, doi:10.1145/2429069.2429129. Michael D. Adams and Ömer S. Ağacan. Indentation-sensitive parsing for Parsec. In Wouter Swierstra, editor, Proceedings of the 2014 ACM SIGPLAN symposium on Haskell, Gothenburg, Sweden, September 4-5, 2014, pages 121–132. ACM, 2014. URL: http://doi. acm.org/10.1145/2633357.2633369, doi:10.1145/2633357.2633369. Alfred V. Aho and Jeffrey D. Ullman. The Theory of Parsing, Translation, and Compiling. Prentice-Hall, Inc., Upper Saddle River, NJ, USA, 1972. Alexander Birman and Jeffrey D. Ullman. Parsing algorithms with backtrack. Information and Control, 23(1):1–34, 1973. URL: http://dx.doi.org/10.1016/S0019-9958(73) 90851-6, doi:10.1016/S0019-9958(73)90851-6. Bryan Ford. Parsing expression grammars: A recognition-based syntactic foundation. In Neil D. Jones and Xavier Leroy, editors, Proceedings of the 31st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2004, Venice, Italy, January 14-16, 2004, pages 111–122. ACM, 2004. URL: http://doi.acm.org/10.1145/964001. 964011, doi:10.1145/964001.964011. Tetsuro Matsumura and Kimio Kuramitsu. A declarative extension of parsing expression grammars for recognizing most programming languages. JIP, 24(2):256–264, 2016. URL: http://dx.doi.org/10.2197/ipsjjip.24.256, doi:10.2197/ipsjjip.24.256. Sérgio Medeiros, Fabio Mascarenhas, and Roberto Ierusalimschy. Left recursion in parsing expression grammars. In Francisco Heron de Carvalho Junior and Luís Soares Barbosa, editors, Programming Languages - 16th Brazilian Symposium, SBLP 2012, Natal, Brazil, September 23-28, 2012. Proceedings, volume 7554 of Lecture Notes in Computer Science, pages 27–41. Springer, 2012. URL: http://dx.doi.org/10.1007/978-3-642-33182-4_4, doi:10.1007/978-3-642-33182-4_4.
6 (cs.PL)
6 (cs.PL)
Complexity of Manipulation with Partial Information in Voting arXiv:1604.04359v2 [cs.MA] 13 Jul 2017 Palash Dey Tata Institute of Fundamental Research, Mumbai palash.dey@tifr.res.in Neeldhara Misra Indian Institute of Technology, Gandhinagar mail@neeldhara.com Y. Narahari Indian Institute of Science, Bangalore hari@csa.iisc.ernet.in January 2, 2018 Abstract The Coalitional Manipulation problem has been studied extensively in the literature for many voting rules. However, most studies have focused on the complete information setting, wherein the manipulators know the votes of the non-manipulators. While this assumption is reasonable for purposes of showing intractability, it is unrealistic for algorithmic considerations. In most real-world scenarios, it is impractical to assume that the manipulators to have accurate knowledge of all the other votes. In this work, we investigate manipulation with incomplete information. In our framework, the manipulators know a partial order for each voter that is consistent with the true preference of that voter. In this setting, we formulate three natural computational notions of manipulation, namely weak, opportunistic, and strong manipulation. We say that an extension of a partial order is viable if there exists a manipulative vote for that extension. We propose the following notions of manipulation when manipulators have incomplete information about the votes of other voters. 1. W EAK M ANIPULATION: the manipulators seek to vote in a way that makes their preferred candidate win in at least one extension of the partial votes of the non-manipulators. 2. O PPORTUNISTIC M ANIPULATION: the manipulators seek to vote in a way that makes their preferred candidate win in every viable extension of the partial votes of the nonmanipulators. 3. S TRONG M ANIPULATION: the manipulators seek to vote in a way that makes their preferred candidate win in every extension of the partial votes of the non-manipulators. We consider several scenarios for which the traditional manipulation problems are easy (for instance, Borda with a single manipulator). For many of them, the corresponding manipulative questions that we propose turn out to be computationally intractable. Our hardness results often hold even when very little information is missing, or in other words, even when the instances are very close to the complete information setting. Our results show that the impact of paucity of information on the computational complexity of manipulation crucially depends on the notion of manipulation under consideration. Our overall conclusion is that computational hardness continues to be a valid obstruction to manipulation, in the context of a more realistic model. Keywords: voting, manipulation, incomplete information, algorithm, computational complexity 1 1 Introduction In many real life and AI related applications, agents often need to agree upon a common decision although they have different preferences over the available alternatives. A natural tool used in these situations is voting. Some classic examples of the use of voting rules in the context of multiagent systems include Clarke tax [ER91], collaborative filtering [PHG00], and similarity search [FKS03], etc. In a typical voting scenario, we have a set of candidates and a set of voters reporting their rankings of the candidates called their preferences or votes. A voting rule selects one candidate as the winner once all voters provide their votes. A set of votes over a set of candidates along with a voting rule is called an election. A central issue in voting is the possibility of manipulation. For many voting rules, it turns out that even a single vote, if cast differently, can alter the outcome. In particular, a voter manipulates an election if, by misrepresenting her preference, she obtains an outcome that she prefers over the “honest” outcome. In a cornerstone impossibility result, Gibbard and Satterthwaite [Gib73, Sat75] show that every unanimous and non-dictatorial voting rule with three candidates or more is manipulable. We refer to [BCE+ 15] for an excellent introduction to various strategic issues in computational social choice theory. Considering that voting rules are indeed susceptible to manipulation, it is natural to seek ways by which elections can be protected from manipulations. The works of Bartholdi et al. [BITT89, BIO91] approach the problem from the perspective of computational intractability. They exploit the possibility that voting rules, despite being vulnerable to manipulation in theory, may be hard to manipulate in practice. Indeed, a manipulator is faced with the following decision problem: given a collection of votes P and a distinguished candidate c, does there exist a vote v that, when tallied with P, makes c win for a (fixed) voting rule r? The manipulation problem has subsequently been generalized to the problem of C OALITIONAL MANIPULATION by Conitzer et al. [CSL07], where one or more manipulators collude together and try to make a distinguished candidate win the election. The manipulation problem, fortunately, turns out to be NP-hard in several settings. This established the success of the approach of demonstrating a computational barrier to manipulation. However, despite having set out to demonstrate the hardness of manipulation, the initial results in [BITT89] were to the contrary, indicating that many voting rules are in fact easy to manipulate. Moreover, even with multiple manipulators involved, popular voting rules like plurality, veto, kapproval, Bucklin, and Fallback continue to be easy to manipulate [XZP+ 09]. While we know that the computational intractability may not provide a strong barrier [PR06, PR07, FKN08, XC08a, XC08b, FHH10, Wal10, Wal11, IKM12, Dey15, DMN15b, DMN16, DMN15a, DN14, DN15] even for rules for which the coalitional manipulation problem turns out to be NP-hard, in all other cases the possibility of manipulation is a much more serious concern. 1.1 Motivation and Problem Formulation In our work, we propose to extend the argument of computational intractability to address the cases where the approach appears to fail. We note that most incarnations of the manipulation problem studied so far are in the complete information setting, where the manipulators have complete knowledge of the preferences of the truthful voters. While these assumptions are indeed the best possible for the computationally negative results, we note that they are not reflective of typical real-world scenarios. Indeed, concerns regarding privacy of information, and in other cases, the sheer volume of information, would be significant hurdles for manipulators to obtain complete information. Motivated by this, we consider the manipulation problem in a natural partial infor2 mation setting. In particular, we model the partial information of the manipulators about the votes of the non-manipulators as partial orders over the set of candidates. A partial order over the set of candidates will be called a partial vote. Our results show that several of the voting rules that are easy to manipulate in the complete information setting become intractable when the manipulators know only partial votes. Indeed, for many voting rules, we show that even if the ordering of a small number of pairs of candidates is missing from the profile, manipulation becomes an intractable problem. Our results therefore strengthen the view that manipulation may not be practical if we limit the information the manipulators have at their disposal about the votes of other voters [CWX11]. We introduce three new computational problems that, in a natural way, extend the question of manipulation to the partial information setting. In these problems, the input is a set of partial votes P corresponding to the votes of the non-manipulators, a non-empty set of manipulators M, and a preferred candidate c. The task in the W EAK M ANIPULATION (WM) problem is to determine if there is a way to cast the manipulators’ votes such that c wins the election for at least one extension of the partial votes in P. On the other hand, in the S TRONG M ANIPULATION (SM) problem, we would like to know if there is a way of casting the manipulators’ votes such that c wins the election in every extension of the partial votes in P. We also introduce the problem of O PPORTUNISTIC M ANIPULATION (OM), which is an “intermediate” notion of manipulation. Let us call an extension of a partial profile viable if it is possible for the manipulators to vote in such a way that the manipulators’ desired candidate wins in that extension. In other words, a viable extension is a Y ES-instance of the standard C OALITIONAL M ANIPULATION problem. We have an opportunistic manipulation when it is possible for the manipulators to cast a vote which makes c win the election in all viable extensions. Note that any Y ES-instance of S TRONG M ANIPULATION is also an Y ES-instance of O PPORTUNISTIC M ANIPULATION, but this may not be true in the reverse direction. As a particularly extreme example, consider a partial profile where there are no viable extensions: this would be a N O-instance for S TRONG M ANIPULATION, but a (vacuous) Y ES-instance of O PPORTUNISTIC M ANIPULATION. The O PPORTUNISTIC M ANIPULATION problem allows us to explore a more relaxed notion of manipulation: one where the manipulators are obliged to be successful only in extensions where it is possible to be successful. Note that the goal with S TRONG M ANIPULATION is to be successful in all extensions, and therefore the only interesting instances are the ones where all extensions are viable. It is easy to see that Y ES instance of S TRONG M ANIPULATION is also a Y ES instance of O PPOR TUNISTIC M ANIPULATION and W EAK M ANIPULATION . Beyond this, we remark that all the three problems are questions with different goals, and neither of them render the other redundant. We refer the reader to Figure 1 for a simple example distinguishing these scenarios. All the problems above generalize C OALITIONAL M ANIPULATION, and hence any computational intractability result for C OALITIONAL M ANIPULATION immediately yields a corresponding intractability result for W EAK M ANIPULATION, S TRONG M ANIPULATION, and O PPORTUNISTIC M A NIPULATION under the same setting. For example, it is known that the C OALITIONAL M ANIPULA TION problem is intractable for the maximin voting rule when we have at least two manipulators [XZP+ 09]. Hence, the W EAK M ANIPULATION, S TRONG M ANIPULATION, and O PPORTUNISTIC M ANIPULATION problems are intractable for the maximin voting rule when we have at least two manipulators. 3 Figure 1: An example of a partial profile. Consider the plurality voting rule with one manipulator. If the favorite candidate is A, then the manipulator simply has to place A on the top of his vote to make A win in any extension. If the favorite candidate is B, there is no vote that makes B win in any extension. Finally, if the favorite candidate is C, then with a vote that places C on top, the manipulator can make C win in the only viable extension (Extension 2). 1.2 Related Work A notion of manipulation under partial information has been considered by Conitzer et al. [CWX11]. They focus on whether or not there exists a dominating manipulation and show that this problem is NP-hard for many common voting rules. Given some partial votes, a dominating manipulation is a non-truthful vote that the manipulator can cast which makes the winner at least as preferable (and sometimes more preferable) as the winner when the manipulator votes truthfully. The dominating manipulation problem and the W EAK M ANIPULATION, O PPOR TUNISTIC M ANIPULATION , and S TRONG M ANIPULATION problems do not seem to have any apparent complexity-theoretic connection. For example, the dominating manipulation problem is NP-hard for all the common voting rules except plurality and veto, whereas, the S TRONG M ANIPULATION problem is easy for most of the cases (see Table 1). However, the results in [CWX11] establish the fact that it is indeed possible to make manipulation intractable by restricting the amount of information the manipulators possess about the votes of the other voters. Elkind and Erdélyi [EE12] study manipulation under voting rule uncertainty. However, in our work, the voting rule is fixed and known to the manipulators. Two closely related problems that have been extensively studied in the context of incomplete votes are P OSSIBLE W INNER and N ECESSARY W INNER [KL05]. In the P OSSIBLE W INNER problem, we are given a set of partial votes P and a candidate c, and the question is whether there exists an extension of P where c wins, while in the N ECESSARY W INNER problem, the question is whether c is a winner in every extension of P. Following the work in [KL05], a number of special cases and variants of the P OSSIBLE W INNER problem have been studied in the literature [CLMM10, BBF10, BRR11, BRR+ 12, GNNW14, XC11, DL13, NW14, BFLR12, ML15]. The flavor of the W EAK M ANIPULATION problem is clearly similar to P OSSIBLE W INNER. However, we emphasize that there are subtle distinctions between the two problems. A more elaborate comparison is made in the next section. 4 1.3 Our Contribution Our primary contribution in this work is to propose and study three natural and realistic generalizations of the computational problem of manipulation in the incomplete information setting. We summarize the complexity results in this work in Table 1. Our results provide the following interesting insights on the impact of lack of information on the computational difficulty of manipulation. We note that the number of undetermined pairs of candidates per vote are small constants in all our hardness results. B We observe that the computational problem of manipulation for the plurality and veto voting rules remains polynomial time solvable even with lack of information, irrespective of the notion of manipulation under consideration [Proposition 1, Theorem 11 and 15, and Observation 4]. We note that the plurality and veto voting rule also remain vulnerable under the notion of dominating manipulation [CWX11]. B The impact of absence of information on the computational complexity of manipulation is more dynamic for the k-approval, k-veto, Bucklin, Borda, and maximin voting rules. Only the W EAK M ANIPULATION and O PPORTUNISTIC M ANIPULATION problems are computationally intractable for the k-approval [Theorem 1 and 5], k-veto [Theorem 2 and 6], Bucklin [Theorem 3 and 10], Borda [Observation 3 and Theorem 7], and maximin [Observation 3 and Theorem 8] voting rules, whereas the S TRONG M ANIPULATION problem remains computationally tractable [Theorem 11 to 14]. B Table 1 shows an interesting behavior of the Fallback voting rule. The Fallback voting rule is the only voting rule among the voting rules we study here for which the W EAK M ANIPULATION problem is NP-hard [Theorem 3] but both the O PPORTUNISTIC M ANIPULATION and S TRONG M ANIPULATION problems are polynomial time solvable [Theorem 13 and Observation 4]. This is because the O PPORTUNISTIC M ANIPULATION problem can be solved for the Fallback voting rule by simply making manipulators vote for their desired candidate. B Our results show that absence of information makes all the three notions of manipulations intractable for the Copelandα voting rule for every rational α ∈ [0, 1] \ {0.5} for the W EAK M ANIPULATION problem [Observation 3] and for every α ∈ [0, 1] for the O PPORTUNISTIC M ANIPULATION and S TRONG M ANIPULATION problems [Theorem 4 and 9]. Our results (see Table 1) show that whether lack of information makes the manipulation problems harder, crucially depends on the notion of manipulation applicable to the situation under consideration. All the three notions of manipulations are, in our view, natural extension of manipulation to the incomplete information setting and tries to capture different behaviors of manipulators. For example, the W EAK M ANIPULATION problem maybe applicable to an optimistic manipulator whereas for an pessimistic manipulator, the S TRONG M ANIPULATION problem may make more sense. Organization of the paper: We define the problems and introduce the basic terminology in the next section. We present our hardness results in Section 3. In Section 4, we present our polynomially solvable algorithms. Finally we conclude with future directions of research in Section 5. 5 WM,  = 1 Plurality Veto k-Approval k-Veto Bucklin Fallback Borda maximin Copelandα WM OM,  = 1 P NP-complete OM SM,  = 1 SM P P coNP-hard P NP-complete coNP-hard P NP-hard coNP-hard Table 1: Summary of Results ( denotes the number of manipulators). The results in white follow immediately from the literature (Observation 1 to 3). Our results for the Copelandα voting rule hold for every rational α ∈ [0, 1]\{0.5} for the W EAK M ANIPULATION problem and for every α ∈ [0, 1] for the O PPORTUNISTIC M ANIPULATION and S TRONG M ANIPULATION problems. 2 Preliminaries In this section, we begin by providing the technical definitions and notations that we will need in the subsequent sections. We then formulate the problems that capture our notions of manipulation when the votes are given as partial orders, and finally draw comparisons with related problems that are already studied in the literature of computational social choice theory. 2.1 Notations and Definitions Let V = {v1 , . . . , vn } be the set of all voters and C = {c1 , . . . , cm } the set of all candidates. If not specified explicitly, n and m denote the total number of voters and the total number of candidates respectively. Each voter vi ’s vote is a preference i over the candidates which is a linear order over C. For example, for two candidates a and b, a i b means that the voter vi prefers a to b. We denote the set of all linear orders over C by L(C). Hence, L(C)n denotes the set of all n-voters’ preference profile (1 , . . . , n ). A map r : ∪n,|C|∈N+ L(C)n −→ 2C \ {∅} is called a voting rule. For some preference profile  ∈ L(C)n , if r() = {w}, then we say w wins uniquely and we write r() = w. From here on, whenever we say some candidate w wins, we mean that the candidate w wins uniquely. For simplicity, we restrict ourselves to the unique winner case in this paper. All our proofs can be easily extended in the co-winner case. A more general setting is an election where the votes are only partial orders over candidates. A partial order is a relation that is reflexive, antisymmetric, and transitive. A partial vote can be extended to possibly more than one linear vote depending on how we fix the order of the unspecified pairs of candidates. For example, in an election with the set of candidates C = {a, b, c}, a valid partial vote can be a  b. This partial vote can be extended to three linear votes namely, a  b  c, 6 a  c  b, c  a  b. In this paper, we often define a partial vote like  \A, where  ∈ L(C) and A ⊂ C × C, by which we mean the partial vote obtained by removing the order among the pair of candidates in A from . Also, whenever we do not specify the order among a set of candidates while describing a complete vote, the statement/proof is correct in whichever way we fix the order among them. We now give examples of some common voting rules. B Positional scoring rules: An m-dimensional vector α ~ = (α1 , α2 , . . . , αm ) ∈ Rm with α1 > α2 > . . . > αm and α1 > αm naturally defines a voting rule – a candidate gets score αi from a vote if it is placed at the ith position, and the score of a candidate is the sum of the scores it receives from all the votes. The winners are the candidates with maximum score. Scoring rules remain unchanged if we multiply every αi by any constant λ > 0 and/or add any constant µ. Hence, we assume without loss of generality that for any score vector α ~ , there exists a j such that αj − αj+1 = 1 and αk = 0 for all k > j. We call such a α ~ a normalized score vector. For α ~ = (m − 1, m − 2, . . . , 1, 0), we get the Borda voting rule. With αi = 1 ∀i 6 k and 0 else, the voting rule we get is known as k-approval. For the k-veto voting rule, we have αi = 0 ∀i 6 m − k and −1 else. Plurality is 1-approval and veto is 1-veto. B Bucklin and simplified Bucklin: Let  be the minimum integer such that at least one candidate gets majority within top  positions of the votes. The winners under the simplified Bucklin voting rule are the candidates having more than n/2 votes within top  positions. The winners under the Bucklin voting rule are the candidates appearing within top  positions of the votes highest number of times. B Fallback and simplified Fallback: For these voting rules, each voter v ranks a subset Xv ⊂ C of candidates and disapproves the rest of the candidates [BS09]. Now for the Fallback and simplified Fallback voting rules, we apply the Bucklin and simplified Bucklin voting rules respectively to define winners. If there is no integer  for which at least one candidate gets more than n/2 votes, both the Fallback and simplified Fallback voting rules output the candidates with most approvals as winners. We assume, for simplicity, that the number of candidates each partial vote approves is known. B Maximin: For any two candidates x and y, let D(x, y) be N(x, y) − N(y, x), where N(x, y) (respectively N(y, x)) is the number of voters who prefer x to y (respectively y to x). The election we get by restricting all the votes to x and y only is called the pairwise election between x and y. The maximin score of a candidate x is miny6=x D(x, y). The winners are the candidates with maximum maximin score. B Copelandα . The Copelandα score of a candidate x is |{y 6= x : DE (x, y) > 0}| + α|{y 6= x : DE (x, y) = 0}|, where α ∈ [0, 1]. That is, the Copelandα of a candidate x is the number of other candidates it defeats in pairwise election plus α times the number of other candidates it ties with in pairwise elections. The winners are the candidates with the maximum Copelandα score. 2.2 Problem Definitions We now formally define the three problems that we consider in this work, namely W EAK M ANIPU LATION , O PPORTUNISTIC M ANIPULATION , and S TRONG M ANIPULATION . Let r be a fixed voting rule. We first introduce the W EAK M ANIPULATION problem. 7 Definition 1. r-W EAK M ANIPULATION Given a set of partial votes P over a set of candidates C, a positive integer  (> 0) denoting the number of manipulators, and a candidate c, do there exist votes 1 , . . . ,  ∈ L(C) such that there exists an extension  ∈ L(C)|P| of P with r(, 1 , . . . ,  ) = c? To define the O PPORTUNISTIC M ANIPULATION problem, we first introduce the notion of an (r, c)opportunistic voting profile, where r is a voting rule and c is any particular candidate. Definition 2. (r, c)-Opportunistic Voting Profile Let  be the number of manipulators and P a set of partial votes. An -voter profile (i )i∈[] ∈ L(C) is called an (r, c)-opportunistic voting  profile if for each extension P  of P for which  there exists an -vote profile (0i )i∈[] ∈ L(C) with r P ∪ 0i i∈[] = c, we have r P ∪ (i )i∈[] = c. In other words, an -vote profile is (r, c)-opportunistic with respect to a partial profile if, when put together with the truthful votes of any extension, c wins if the extension is viable to begin with. We are now ready to define the O PPORTUNISTIC M ANIPULATION problem. Definition 3. r-O PPORTUNISTIC M ANIPULATION Given a set of partial votes P over a set of candidates C, a positive integer  (> 0) denoting the number of manipulators, and a candidate c, does there exist an (r, c)-opportunistic -vote profile? We finally define the S TRONG M ANIPULATION problem. Definition 4. r-S TRONG M ANIPULATION Given a set of partial votes P over a set of candidates C, a positive integer  (> 0) denoting the number of manipulators, and a candidate c, do there exist votes (i )i∈ ∈ L(C) such that for every extension  ∈ L(C)|P| of P, we have r(, (i )i∈[] ) = c? We use (P, , c) to denote instances of W EAK M ANIPULATION, O PPORTUNISTIC M ANIPULATION, and S TRONG M ANIPULATION, where P denotes a profile of partial votes,  denotes the number of manipulators, and c denotes the desired winner. For the sake of completeness, we provide the definitions of the C OALITIONAL M ANIPULATION and P OSSIBLE W INNER problems below. Definition 5. r-C OALITIONAL M ANIPULATION Given a set of complete votes  over a set of candidates C, a positive integer  (> 0) denoting the number    of manipulators, and a candidate c, do there exist votes (i )i∈ ∈ L(C) such that r , (i )i∈[] = c? Definition 6. r-P OSSIBLE W INNER Given a set of partial votes P and a candidate c, does there exist an extension  of the partial votes in P to linear votes such that r() = c? 2.3 Comparison with Possible Winner and Coalitional Manipulation For any fixed voting rule, the W EAK M ANIPULATION problem with  manipulators reduces to the P OSSIBLE W INNER problem. This is achieved by simply using the same set as truthful votes and introducing  empty votes. We summarize this in the observation below. 8 Observation 1. The W EAK M ANIPULATION problem many-to-one reduces to the P OSSIBLE W INNER problem for every voting rule. Proof. Let (P, , c) be an instance of W EAK M ANIPULATION. Let Q be the set consisting of  many copies of partial votes {∅}. Clearly the W EAK M ANIPULATION instance (P, , c) is equivalent to the P OSSIBLE W INNER instance (P ∪ Q, c). However, whether the P OSSIBLE W INNER problem reduces to the W EAK M ANIPULATION problem or not is not clear since in any W EAK M ANIPULATION problem instance, there must exist at least one manipulator and a P OSSIBLE W INNER instance may have no empty vote. From a technical point of view, the difference between the W EAK M ANIPULATION and P OSSIBLE W INNER problems may look marginal; however we believe that the W EAK M ANIPULATION problem is a very natural generalization of the C OALITIONAL M ANIPULATION problem in the partial information setting and thus worth studying. Similarly, it is easy to show, that the C OALITIONAL M ANIPULATION problem with  manipulators reduces to W EAK M ANIPULATION, O PPORTUNISTIC M ANIPULATION, and S TRONG M ANIPULATION problems with  manipulators, since the former is a special case of the latter ones. Observation 2. The C OALITIONAL M ANIPULATION problem with  manipulators many-to-one reduces to W EAK M ANIPULATION, O PPORTUNISTIC M ANIPULATION, and S TRONG M ANIPULATION problems with  manipulators for all voting rules and for all positive integers . Proof. Follows from the fact that every instance of the C OALITIONAL M ANIPULATION problem is also an equivalent instance of the W EAK M ANIPULATION, O PPORTUNISTIC M ANIPULATION, and S TRONG M ANIPULATION problems. Finally, we note that the C OALITIONAL M ANIPULATION problem with  manipulators can be reduced to the W EAK M ANIPULATION problem with just one manipulator, by introducing −1 empty votes. These votes can be used to witness a good extension in the forward direction. In the reverse direction, given an extension where the manipulator is successful, the extension can be used as the manipulator’s votes. This argument leads to the following observation. Observation 3. The C OALITIONAL M ANIPULATION problem with  manipulators many-to-one reduces to the W EAK M ANIPULATION problem with one manipulator for every voting rule and for every positive integer . Proof. Let (P, , c) be an instance of C OALITIONAL M ANIPULATION. Let Q be the set of consisting of −1 many copies of partial vote {c  others}. Clearly the W EAK M ANIPULATION instance (P∪Q, 1, c) is equivalent to the C OALITIONAL M ANIPULATION instance (P, , 1). This observation can be used to derive the hardness of W EAK M ANIPULATION even for one manipulator whenever the hardness for C OALITIONAL M ANIPULATION is known for any fixed number of manipulators (for instance, this is the case for the voting rules such as Borda, maximin and Copeland). However, determining the complexity of W EAK M ANIPULATION with one manipulator requires further work for voting rules where C OALITIONAL M ANIPULATION is polynomially solvable for any number of manipulators (such as k-approval, Plurality, Bucklin, and so on). 9 3 Hardness Results In this section, we present our hardness results. While some of our reductions are from the P OS SIBLE W INNER problem, the other reductions in this section are from the E XACT C OVER BY 3-S ETS problem, also referred to as X3C. This is a well-known NP-complete [GJ79] problem, and is defined as follows. Definition 7 (Exact Cover by 3-Sets (X3C)). Given a set U and a collection S = {S1 , S2 , . . . , St } of t subsets of U with |Si | = 3 ∀i = 1, . . . , t, does there exist a T ⊂ S with |T| = |U| 3 such that ∪X∈T X = U? We use X3C to refer to the complement of X3C, which is to say that an instance of X3C is a Y ES instance if and only if it is a N O instance of X3C. The rest of this section is organized according to the problems being addressed. 3.1 Weak Manipulation To begin with, recall that the C OALITIONAL M ANIPULATION problem is NP-complete for the Borda [DKNW11, BNW11], maximin [XZP+ 09], and Copelandα [FHS08, FHHR09, FHS10] voting rules for every rational α ∈ [0, 1] \ {0.5}, when we have two manipulators. Therefore, it follows from Observation 3 that the W EAK M ANIPULATION problem is NP-complete for the Borda, maximin, and Copelandα voting rules for every rational α ∈ [0, 1] \ {0.5}, even with one manipulator. For the k-approval and k-veto voting rules, we reduce from the corresponding P OSSIBLE W IN NER problems. While it is natural to start from the same voting profile, the main challenge is in undoing the advantage that the favorite candidate receives from the manipulator’s vote, in the reverse direction. We begin with proving that the W EAK M ANIPULATION problem is NP-complete for the k-approval voting rule even with one manipulator and at most 4 undetermined pairs per vote. Theorem 1. The W EAK M ANIPULATION problem is NP-complete for the k-approval voting rule even with one manipulator for any constant k > 1, even when the number of undetermined pairs in each vote is no more than 4. Proof. For simplicity of presentation, we prove the theorem for 2-approval. We reduce from the P OSSIBLE W INNER problem for 2-approval which is NP-complete [XC11], even when the number of undetermined pairs in each vote is no more than 4. Let P be the set of partial votes in a P OSSIBLE W INNER instance, and let C = {c1 , . . . , cm , c} be the set of candidates, where the goal is to check if there is an extension of P that makes c win. For developing the instance of W EAK M ANIPULATION, we need to “reverse” any advantage that the candidate c obtains from the vote of the manipulator. Notice that the most that the manipulator can do is to increase the score of c by one. Therefore, in our construction, we “artificially” increase the score of all the other candidates by one, so that despite of the manipulator’s vote, c will win the new election if and only if it was a possible winner in the P OSSIBLE W INNER instance. To this end, we introduce (m + 1) many dummy candidates d1 , . . . , dm+1 and the complete votes: wi = ci  di  others, for every i ∈ {1, . . . , m} Further, we extend the given partial votes of the P OSSIBLE W INNER instance to force the dummy candidates to be preferred least over the rest - by defining, for every vi ∈ P, the corresponding 10 partial vote v0i as follows. v0i = vi ∪ {C  {d1 , . . . , dm+1 }}. This ensures that all the dummy candidates do not receive any score from the modified partial votes corresponding to the partial votes of the P OSSIBLE W INNER instance. Notice that since the number of undetermined pairs in vi is no more than 4, the number of undetermined pairs in v0i is also no more than 4. Let (C0 , Q, c) denote this constructed W EAK M ANIPULATION instance. We claim that the two instances are equivalent. In the forward direction, suppose c is a possible winner with respect to P, and let P be an extension where c wins. Then it is easy to see that the manipulator can make c win in some extension by placing c and dm+1 in the first two positions of her vote (note that the partial score of dm+1 is zero in Q). Indeed, consider the extension of Q obtained by mimicking the extension P on the “common” partial votes, {v0i | vi ∈ P}. Notice that this is well-defined since vi and v0i have exactly the same set of incomparable pairs. In this extension, the score of c is strictly greater than the scores of all the other candidates, since the scores of all candidates in C is exactly one more than their scores in P, and all the dummy candidates have a score of at most one. In the reverse direction, notice that the manipulator puts the candidates c and dm+1 in the top two positions without loss of generality. Now suppose the manipulator’s vote c  dm+1  others makes c win the election for an extension Q of Q. Then consider the extension P obtained by restricting Q to C. Notice that the score of each candidate in C in this extension is one less than their scores in Q. Therefore, the candidate c wins this election as well, concluding the proof. The above proof can be imitated for any other constant values of k by reducing it from the P OSSIBLE W INNER problem for k-approval and introducing (m + 1)(k − 1) dummy candidates. We will use Lemma 1 in subsequent proofs which has been used before [BRR11, DMN15b, DMN16]. Lemma 1. Let C = {c1 , . . . , cm } ] D, (|D| > 0) be a set of candidates, and α ~ a normalized score vector of length |C|. Then, for any given X = (X1 , . . . , Xm ) ∈ Zm , there exists λ ∈ R and a voting profile such that the α ~ -score of ci is λ + Xi for all 1 6 i 6 m, and the score of candidates d ∈ D is less than λ. Pm Moreover, the number of votes is O(poly(|C| · i=1 |Xi |, λ)). Note that the number of votes used in Lemma 1 is polynomial in m if λ and |Xi | is polynomial in m for every i ∈ [m], which indeed is the case in all the proofs that use Lemma 1. We next show that the WM problem is NP-complete for the k-veto voting rule. Theorem 2. The W EAK M ANIPULATION problem for the k-veto voting rule is NP-complete even with one manipulator for any constant k > 1. Proof. We reduce from the P OSSIBLE W INNER problem for the k-veto voting rule which is known to be NP-complete [BD09]. Let P be the set of partial votes in a P OSSIBLE W INNER problem instance, and let C = {c1 , . . . , cm , c} be the set of candidates, where the goal is to check if there is an extension that makes c win with respect to k-veto. We assume without loss of generality that c’s position is fixed in all the partial votes (if not, then we fix the position of c as high as possible in every vote). We introduce k + 1 many dummy candidates d1 , . . . , dk , d. The role of the first k dummy candidates is to ensure that the manipulator is forced to place them at the “bottom k” positions of her vote, so that all the original candidates get the same score from the additional vote of the manipulator. The most natural way of achieving this is to ensure that the dummy candidates have the 11 same score as c in any extension (note that we know the score of c since c’s position is fixed in all the partial votes). This would force the manipulator to place these k candidates in the last k positions. Indeed, doing anything else will cause these candidates to tie with c, even when there is an extension of P that makes c win. To this end, we begin by placing the dummy candidates in the top k positions in all the partial votes. Formally, we modify every partial vote as follows: w = di  others, for every i ∈ {1, . . . , k} At this point, we know the scores of c and di , for every i ∈ {1, . . . , k}. Using Lemma 1, we add complete votes such that the final score of c is the same with the score of every di and the score of c is strictly more than the score of d. The relative score of every other candidate remains the same. This completes the description of the construction. We denote the augmented set of partial votes by P. We now argue the correctness. In the forward direction, if there is an extension of the votes that makes c win, then we repeat this extension, and the vote of the manipulator puts the candidate di at the position m + i + 2; and all the other candidates in an arbitrary fashion. Formally, we let the manipulator’s vote be: v = c  c1  · · ·  cm  d  d 1  · · ·  d k . By construction c wins the election in this particular setup. In the reverse direction, consider a vote of the manipulator and an extension Q of P in which c wins. Note that the manipulator’s vote necessarily places the candidates di in the bottom k positions — indeed, if not, then c cannot win the election by construction. We extend a partial vote w ∈ P by mimicking the extension of the corresponding partial vote w0 ∈ P, that is, we simply project the extension of w0 on the original set of candidates C. Let Q denote this proposed extension of P. We claim that c wins the election given by Q. Indeed, suppose not. Let ci be a candidate whose score is at least the score of c in the extension Q. Note that the scores of ci and c in the extension Q are exactly the same as their scores in Q, except for a constant offset — importantly, their scores are offset by the same amount. This implies that the score of ci is at least the score of c in Q as well, which is a contradiction. Hence, the two instances are equivalent. We next prove, by a reduction from X3C, that the W EAK M ANIPULATION problem for the Bucklin and simplified Bucklin voting rules is NP-complete even with one manipulator and at most 16 undetermined pairs per vote. Theorem 3. The W EAK M ANIPULATION problem is NP-complete for Bucklin, simplified Bucklin, Fallback, and simplified Fallback voting rules, even when we have only one manipulator and the number of undetermined pairs in each vote is no more than 16. Proof. We reduce the X3C problem to W EAK M ANIPULATION for simplified Bucklin. Let (U = {u1 , . . . , um }, S := {S1 , S2 , . . . , St }) be an instance of X3C, where each Si is a subset of U of size three. We construct a W EAK M ANIPULATION instance based on (U, S) as follows. Candidate set: C = W ∪ X ∪ D ∪ U ∪ {c, w, a, b}, where |W| = m − 3, |X| = 4, |D| = m + 1 We first introduce the following partial votes P in correspondence with the sets in the family as follows. W  X  Si  c  (U \ Si )  D \ ({X × ({c} ∪ Si )}) , ∀i 6 t 12 Notice that the number of undetermined pairs in every vote in P is 16. We introduce the following additional complete votes Q: B t copies of U  c  others B m/3 − 1 copies of U  a  c  others B m/3 + 1 copies of D  b  others The total number of voters, including the manipulator, is 2t + 2m/3 + 1. Now we show equivalence of the two instances. In the forward direction, suppose we have an exact set cover T ⊂ S. Let the vote of the manipulator v be c  D  others. We consider the following extension P of P. W  Si  c  X  (U \ Si )  D On the other hand, if Si ∈ S \ T, then we have: W  X  Si  c  (U \ Si )  D We claim that c is the unique simplified Bucklin winner in the profile (P, W, v). Notice that the simplified Bucklin score of c is m + 1 in this extension, since it appears in the top m + 1 positions in the m/3 votes corresponding to the set cover, t votes from the complete profile Q and one vote v of the manipulator. For any other candidate ui ∈ U, ui appears in the top m + 1 positions once in P and t + m 3 − 1 times in Q. Thus, ui does not get majority in top m + 1 positions making its simplified Bucklin score at least m + 2. Hence, c is the unique simplified Bucklin winner in the profile (P, W, v). Similarly, the candidate w1 appears only t times in the top m + 1 positions. The same can be argued for the remaining candidates in D, W, and w. In the reverse direction, suppose the W EAK M ANIPULATION is a Y ES instance. We may assume without loss of generality that the manipulator’s vote v is c  D  others, since the simplified Bucklin score of the candidates in D is at least 2m. Let P be the extension of P such that c is the unique winner in the profile (P, Q, v). As every candidate in W is ranked within top m + 2 positions m in t + m 3 + 1 votes in Q, for c to win, c  X must hold in at least 3 votes in P. In those votes, all the candidates in Si are also within top m + 2 positions. Now if any candidate in U is within top m + 1 positions in P more than once, then c will not be the unique winner. Hence, the Si ’s corresponding to the votes where c  X in P form an exact set cover. The reduction above also works for the Bucklin voting rule. Specifically, the argument for the forward direction is exactly the same as the simplified Bucklin above and the argument for the reverse direction is as follows. Every candidate in W is ranked within top m + 2 positions in t+ m 3 + 1 votes in Q and c is never placed within top m + 2 positions in any vote in Q. Hence, for c to win, c  X must hold in at least m 3 votes in P. In those votes, all the candidates in Si are also within top m positions. Notice that c never gets placed within top m positions in any vote in (P, Q). Now if any candidate x ∈ U is within top m positions in P more than once, then x gets majority within top m positions and thus c cannot win. The result for the Fallback and simplified Fallback voting rules follow from the corresponding results for the Bucklin and simplified Bucklin voting rules respectively since every Bucklin and simplified Bucklin election is also a Fallback and simplified Fallback election respectively. 13 3.2 Strong Manipulation We know that the C OALITIONAL M ANIPULATION problem is NP-complete for the Borda, maximin, and Copelandα voting rules for every rational α ∈ [0, 1] \ {0.5}, when we have two manipulators. Thus, it follows from Observation 2 that S TRONG M ANIPULATION is NP-hard for Borda, maximin, and Copelandα voting rules for every rational α ∈ [0, 1] \ {0.5} for at least two manipulators. For the case of one manipulator, S TRONG M ANIPULATION turns out to be polynomial-time solvable for most other voting rules. For Copelandα , however, we show that the problem is co-NP-hard for every α ∈ [0, 1] for a single manipulator, even when the number of undetermined pairs in each vote is bounded by a constant. This is achieved by a careful reduction from X3C. The following lemma has been used before [McG53]. Lemma 2. For any function f : C × C −→ Z, such that 1. ∀a, b ∈ C, f(a, b) = −f(b, a). 2. ∀a, b, c, d ∈ C, f(a, b) + f(c, d) is even, there exists a n-voters’ profile such that for all a, b ∈ C, a defeats b with a margin of f(a, b). Moreover,   X n is even and n = O  |f(a, b)| {a,b}∈C×C We have following intractability result for the S TRONG M ANIPULATION problem for the Copelandα rule with one manipulator and at most 10 undetermined pairs per vote. Theorem 4. S TRONG M ANIPULATION is co-NP-hard for Copelandα voting rule for every α ∈ [0, 1] even when we have only one manipulator and the number of undetermined pairs in each vote is no more than 10. Proof. We reduce X3C to S TRONG M ANIPULATION for Copelandα rule. Let (U = {u1 , . . . , um }, S = {S1 , S2 , . . . , St }) is an X3C instance. We assume, without loss of generality, t to be an even integer (if not, replicate any set from S). We construct a corresponding W EAK M ANIPULATION instance for Copelandα as follows. Candidate set C = U ∪ {c, w, z, d} Partial votes P: ∀i 6 t, (U \ Si )  c  z  d  Si  w \ {{z, c} × (Si ∪ {d, w})} Notice that the number of undetermined pairs in every vote in P is 10. Now we add a set Q of complete votes with |Q| even and |Q| = poly(m, t) using Lemma 2 to achieve the following margin of victories in pairwise elections. Figure 2 shows the weighted majority graph of the resulting election. B DQ (d, z) = DQ (z, c) = DQ (c, d) = DQ (w, z) = 4t B DQ (ui , d) = DQ (c, ui ) = 4t ∀ui ∈ U B DQ (z, ui ) = t ∀ui ∈ U 14 B DQ (c, w) = t − B DQ (ui , ui+1 2m 3 −2 (mod ∗)m ) = 4t ∀ui ∈ U B DQ (a, b) = 0 for every a, b ∈ C, a 6= b, not mentioned above d 4t uj 4t uj+1 w 4t 4t t 4t t− c 2m 3 4t −2 4t z Figure 2: Weighted majority graph of the reduced instance in Theorem 4. The weight of all the edges not shown in the figure are 0. For simplicity, we do not show edges among {u1 , . . . , um }. We have only one manipulator who tries to make c winner. Notice that the number of votes in the S TRONG M ANIPULATION instance (P ∪ Q, 1, c) including the manipulator’s vote is odd (since |P| and |Q| are even integers). Therefore, DP∗ ∪Q∪{v∗ } (a, b) is never zero for every a, b ∈ C, a 6= b in every extension P∗ of P and manipulators vote v∗ and consequently the particular value of α does not play any role in this reduction. Hence, we assume, without loss of generality, α to be zero from here on and simply use the term Copeland instead of Copelandα . Now we show that the X3C instance (U, S) is a Y ES instance if and only if the S TRONG M ANIPU LATION instance (P ∪ Q, 1, c) is a N O instance (a S TRONG M ANIPULATION instance is a N O instance if there does not exist a vote of the manipulator which makes c the unique winner in every extension of the partial votes). We can assume without loss of generality that manipulator puts c at first position and z at last position in her vote v. Assume that the X3C instance is a Y ES instance. Suppose (by renaming) that S1 , . . . , S m3 forms an exact set cover. We claim that the following extension P of P makes both z and c Copeland co-winners. Extension P of P: m i 6 , (U \ Si )  c  z  d  Si  w 3 m + 1, (U \ Si )  d  Si  w  c  z i> 3 We have summarize the pairwise margins between z and c and the rest of the candidates from the profile (P ∪ Q ∪ v) in Table 2. The candidates z and c are the co-winners with Copeland score (m + 1). 15 C \ {z} DP∪Q∪v (z, ·) C \ {c} DP∪Q∪v (c, ·) c > 3t z, ui ∈ U > 3t w, d 6 −3t w −1 ui ∈ U 1 d 6 −3t Table 2: DP∪Q∪v (z, ·) and DP∪Q∪v (c, ·) For the other direction, notice that Copeland score of c is at least m + 1 since c defeats d and every candidate in U in every extension of P. Also notice that the Copeland score of z can be at most m + 1 since z loses to w and d in every extension of P. Hence the only way c cannot be the unique winner is that z defeats all candidates in U and w defeats c. This requires w  c in at least t− m 3 extensions of P. We claim that the sets Si in the remaining of the extensions where c  w forms an exact set cover for (U, S). Indeed, otherwise some candidate ui ∈ U is not covered. Then, notice that ui  z in all t votes, making D(z, ui ) = −1. 3.3 Opportunistic Manipulation All our reductions for the co-NP-hardness for O PPORTUNISTIC M ANIPULATION start from X3C. We note that all our hardness results hold even when there is only one manipulator. Our overall approach is the following. We engineer a set of partial votes in such a way that the manipulator is forced to vote in a limited number of ways to have any hope of making her favorite candidate win. For each such vote, we demonstrate a viable extension where the vote fails to make the candidate a winner, leading to a N O instance of O PPORTUNISTIC M ANIPULATION. These extensions rely on the existence of an exact cover. On the other hand, we show that if there is no exact set cover, then there is no viable extension, thereby leading to an instance that is vacuously a Y ES instance of O PPORTUNISTIC M ANIPULATION. Our first result on O PPORTUNISTIC M ANIPULATION shows that the O PPORTUNISTIC M ANIPULATION problem is co-NP-hard for the k-approval voting rule for constant k > 3 even when the number of manipulators is one and the number of undetermined pairs in each vote is no more than 15. Theorem 5. The O PPORTUNISTIC M ANIPULATION problem is co-NP-hard for the k-approval voting rule for constant k > 3 even when the number of manipulators is one and the number of undetermined pairs in each vote is no more than 15. Proof. We reduce X3C to O PPORTUNISTIC M ANIPULATION for k-approval rule. Let (U = {u1 , . . . , um }, S = {S1 , S2 , . . . , St }) is an X3C instance. We construct a corresponding O PPORTUNISTIC M ANIPULATION instance for k-approval voting rule as follows. We begin by introducing a candidate for every element of the universe, along with k − 3 dummy candidates (denoted by W), and special candidates {c, z1 , z2 , d, x, y}. Formally, we have: Candidate set C = U ∪ {c, z1 , z2 , d, x, y} ∪ W. Now, for every set Si in the universe, we define the following total order on the candidate set, which we denote by P0i : W  Si  y  z1  z2  x  (U \ Si )  c  d 16 Using P0i , we define the partial vote Pi as follows: Pi = P0i \ ({{y, x, z1 , z2 } × Si } ∪ {(z1 , z2 ), (x, z1 ), (x, z2 )}). We denote the set of partial votes {Pi : i ∈ [t]} by P and {P0i : i ∈ [t]} by P0 . We remark that the number of undetermined pairs in each partial vote Pi is 15. We now invoke Lemma 1 from [DMN16], which allows to achieve any pre-defined scores on the candidates using only polynomially many additional votes. Using this, we add a set Q of complete votes with |Q| = poly(m, t) to ensure the following scores, where we denote the k-approval score of a candidate from a set of votes V by sV (·): sQ (z1 ) = sQ (z2 ) = sQ (y) = sQ (c) − m/3; sQ (d), sQ (w) 6 sQ (c) − 2t ∀w ∈ W; sQ (x) = sQ (c) − 1; sP0 ∪Q (uj ) = sQ (c) + 1 ∀j ∈ [m]. Our reduced instance is (P ∪ Q, 1, c). The reasoning for this score configuration will be apparent as we argue the equivalence. We first argue that if we had a Y ES instance of X3C (in other words, there is no exact cover), then we have a Y ES instance of O PPORTUNISTIC M ANIPULATION. It turns out that this will follow from the fact that there are no viable extensions, because, as we will show next, a viable extension implies the existence of an exact set cover. To this end, first observe that the partial votes are constructed in such a way that c gets no additional score from any extension. Assuming that the manipulator approves c (without loss of generality), the final score of c in any extension is going to be sQ (c) + 1. Now, in any viable extension, every candidate uj has to be “pushed out” of the top k positions at least once. Observe that whenever this happens, y is forced into the top k positions. Since y is behind the score of c by only m/3 votes, Si ’s can be pushed out of place in only m/3 votes. For every uj to lose one point, these votes must correspond to an exact cover. Therefore, if there is no exact cover, then there is no viable extension, showing one direction of the reduction. On the other hand, suppose we have a N O instance of X3C – that is, there is an exact cover. Let {Si : i ∈ [m/3]} forms an exact cover of U. We will now use the exact cover to come up with two viable extensions, both of which require the manipulator to vote in different ways to make c win. Therefore, there is no single manipulative vote that accounts for both extensions, leading us to a N O instance of O PPORTUNISTIC M ANIPULATION. First, consider this completion of the partial votes: i = 1, W  y  x  z1  z2  Si  (U \ Si )  c  d 2 6 i 6 m/3, W  y  z1  z2  x  Si  (U \ Si )  c  d m/3 + 1 6 i 6 t, W  Si  y  z1  z2  x  (U \ Si )  c  d Notice that in this completion, once accounted for along with the votes in Q, the score of c is tied with the scores of all uj ’s, z1 , x and y, while the score of z2 is one less than the score of c. Therefore, the only k candidates that the manipulator can afford to approve are W, the candidates c, d and z2 . However, consider the extension that is identical to the above except with the first vote changed to: W  y  x  z2  z1  Si  (U \ Si )  c  d Here, on the other hand, the only way for c to be an unique winner is if the manipulator approves W, c, d and z1 . Therefore, it is clear that there is no way for the manipulator to provide a consolidated vote for both these profiles. Therefore, we have a N O instance of O PPORTUNISTIC M ANIPULATION. 17 We next move on to the k-veto voting rule and show that the O PPORTUNISTIC M ANIPULATION problem for the k-veto is co-NP-hard for every constant k > 4 even when the number of manipulators is one and the number of undetermined pairs in each vote is no more than 15. Theorem 6. The O PPORTUNISTIC M ANIPULATION problem is co-NP-hard for the k-veto voting rule for every constant k > 4 even when the number of manipulators is one and the number of undetermined pairs in each vote is no more than 15. Proof. We reduce X3C to O PPORTUNISTIC M ANIPULATION for k-veto rule. Let (U = {u1 , . . . , um }, S = {S1 , S2 , . . . , St }) is an X3C instance. We construct a corresponding O PPORTUNISTIC M ANIPULATION instance for k-veto voting rule as follows. Candidate set C = U ∪ {c, z1 , z2 , d, x, y} ∪ A ∪ W, where A = {a1 , a2 , a3 }, |W| = k − 4 For every i ∈ [t], we define P0i as follows: ∀i 6 t, c  A  (U \ Si )  d  Si  y  x  z1  z2  W Using P0i , we define partial vote Pi = P0i \ ({{y, x, z1 , z2 } × Si } ∪ {(z1 , z2 ), (x, z1 ), (x, z2 )}) for every i ∈ [t]. We denote the set of partial votes {Pi : i ∈ [t]} by P and {P0i : i ∈ [t]} by P0 . We note that the number of undetermined pairs in each partial vote Pi is 15. Using Lemma 1, we add a set Q of complete votes with |Q| = poly(m, t) to ensure the following. We denote the k-veto score of a candidate from a set of votes W by sW (·). B sP0 ∪Q (z1 ) = sP0 ∪Q (z2 ) = sP0 ∪Q (c) − m/3 B sP0 ∪Q (ai ) = sP0 ∪Q (uj ) = sP0 ∪Q (w) = sP0 ∪Q (c) ∀ai ∈ A, uj ∈ U, w ∈ W B sP0 ∪Q (y) = sP0 ∪Q (c) − m/3 − 1 B sP0 ∪Q (x) = sP0 ∪Q (c) − 2 We have only one manipulator who tries to make c winner. Now we show that the X3C instance (U, S) is a Y ES instance if and only if the O PPORTUNISTIC M ANIPULATION instance (P ∪ Q, 1, c) is a N O instance. In the forward direction, let us now assume that the X3C instance is a Y ES instance. Suppose (by renaming) that S1 , . . . , Sm/3 forms an exact set cover. Let us assume that the manipulator’s vote v disapproves every candidate in W ∪ A since otherwise c can never win uniquely. We now show that if v does not disapprove z1 then, v is not a c-optimal vote. Suppose v does not disapprove z1 . Then we consider the following extension P of P. i = 1, c  A  (U \ Si )  d  y  z1  x  z2  Si  W 2 6 i 6 m/3, c  A  (U \ Si )  d  y  z1  z2  x  Si  W m/3 + 1 6 i 6 t, c  A  (U \ Si )  d  Si  y  x  z1  z2  W We have the following scores sP∪Q (c) = sP∪Q (z1 ) = sP∪Q (z2 ) + 1 = sP∪Q (x) + 1 = sP∪Q (uj ) + 1 ∀uj ∈ U. Hence, both c and z1 win for the votes P∪Q∪{v}. However, the vote v0 which disapproves a1 , a2 , a3 , z1 makes c a unique winner for the votes P ∪ Q ∪ {v0 }. Hence, v is not a c-optimal vote. Similarly, we can show that if the manipulator’s vote does not disapprove z2 then, the vote is not 18 c-optimal. Hence, there does not exist any c-optimal vote and the O PPORTUNISTIC M ANIPULATION instance is a N O instance. In the reverse direction, we show that if the X3C instance is a N O instance, then there does not exist a vote v of the manipulator and an extension P of P such that c is the unique winner for the votes P ∪ Q ∪ {v0 } thereby proving that the O PPORTUNISTIC M ANIPULATION instance is vacuously Y ES (and thus every vote is c-optimal). Notice that, there must be at least m/3 votes P1 in P where the corresponding Si gets pushed in bottom k positions since sP0 ∪Q (uj ) = sP0 ∪Q (c) ∀ai ∈ A, uj ∈ U. However, in each vote in P1 , y is placed within top m − k many position and thus we have |P1 | is exactly m/3 since sP0 ∪Q (y) = sP0 ∪Q (c) − m/3 − 1. Now notice that there must be at least one candidate u ∈ U which is not covered by the sets Si s corresponding to the votes P1 because the X3C instance is a N O instance. Hence, c cannot win the election uniquely irrespective of the manipulator’s vote. Thus every vote is c-optimal and the O PPORTUNISTIC M ANIPULATION instance is a Y ES instance. We show next similar intractability result for the Borda voting rule too with only at most 7 undetermined pairs per vote. Theorem 7. The O PPORTUNISTIC M ANIPULATION problem is co-NP-hard for the Borda voting rule even when the number of manipulators is one and the number of undetermined pairs in every vote is no more than 7. Proof. We reduce X3C to O PPORTUNISTIC M ANIPULATION for the Borda rule. Let (U = {u1 , . . . , um }, S = {S1 , S2 , . . . , St }) is an X3C instance. Without loss of generality we assume that m is not divisible by 6 (if not, then we add three new elements b1 , b2 , b3 to U and a set {b1 , b2 , b3 } to S). We construct a corresponding O PPORTUNISTIC M ANIPULATION instance for the Borda voting rule as follows. Candidate set C = U ∪ {c, z1 , z2 , d, y} For every i ∈ [t], we define P0i as follows: ∀i 6 t, y  Si  z1  z2  (U \ Si )  d  c Using P0i , we define partial vote Pi = P0i \ ({({y} ∪ Si ) × {z1 , z2 }} ∪ {(z1 , z2 )}) for every i ∈ [t]. We denote the set of partial votes {Pi : i ∈ [t]} by P and {P0i : i ∈ [t]} by P0 . We note that the number of undetermined pairs in each partial vote Pi is 7. Using Lemma 1, we add a set Q of complete votes with |Q| = poly(m, t) to ensure the following. We denote the Borda score of a candidate from a set of votes W by sW (·). B sP0 ∪Q (y) = sP0 ∪Q (c) + m + m/3 + 3 B sP0 ∪Q (z1 ) = sP0 ∪Q (c) − 3bm/6c − 2 B sP0 ∪Q (z2 ) = sP0 ∪Q (c) − 5bm/6c − 3 B sP0 ∪Q (ui ) = sP0 ∪Q (c) + m + 5 − i ∀i ∈ [m] B sP0 ∪Q (d) 6 sP0 ∪Q (c) − 5m 19 We have only one manipulator who tries to make c winner. Now we show that the X3C instance (U, S) is a Y ES instance if and only if the O PPORTUNISTIC M ANIPULATION instance (P∪Q, 1, c) is a N O instance. Notice that we can assume without loss of generality that the manipulator places c at the first position, d at the second position, the candidate ui at (m + 5 − i)th position for every i ∈ [m], and y at the last position, since otherwise c can never win uniquely irrespective of the extension of P (that it, the manipulator’s vote looks like c  d  {z1 , z2 }  um  um−1  · · ·  u1  y). In the forward direction, let us now assume that the X3C instance is a Y ES instance. Suppose (by renaming) that S1 , . . . , Sm/3 forms an exact set cover. Let the manipulator’s vote v be c  d  z1  z2  um  · · ·  u1  y. We now argue that v is not a c-optimal vote. The other case where the manipulator’s vote v0 be c  d  z2  z1  um  · · ·  u1  y can be argued similarly. We consider the following extension P of P. 1 6 i 6 bm/6c, z2  y  Si  z1  (U \ Si )  d  c dm/6e 6 i 6 m/3, z1  y  Si  z2  (U \ Si )  d  c m/3 + 1 6 i 6 t, y  Si  z1  z2  (U \ Si )  d  c We have the following Borda scores sP∪Q∪{v} (c) = sP∪Q∪{v} (y) + 1 = sP∪Q∪{v} (z2 ) + 6 = sP∪Q∪{v} (z1 ) = sP∪Q∪{v} (ui ) + 1 ∀i ∈ [m]. Hence, c does not win uniquely for the votes P ∪ Q ∪ {v}. However, c is the unique winner for the votes P ∪ Q ∪ {v0 }. Hence, there does not exist any c-optimal vote and the O PPORTUNISTIC M ANIPULATION instance is a N O instance. In the reverse direction, we show that if the X3C instance is a N O instance, then there does not exist a vote v of the manipulator and an extension P of P such that c is the unique winner for the votes P ∪ Q ∪ {v0 } thereby proving that the O PPORTUNISTIC M ANIPULATION instance is vacuously Y ES (and thus every vote is c-optimal). Notice that the score of y must decrease by at least m/3 for c to win uniquely. However, in every vote v where the score of y decreases by at least one in any extension P of P, at least one of z1 or z2 must be placed at top position of the vote v. However, the candidates z1 and z2 can be placed at top positions of the votes in P at most m/3 many times while ensuring c does not lose the election. Also, even after manipulator places the candidate ui at (m + 5 − i)th position for every i ∈ [m], for c to win uniquely, the score of every ui must decrease by at least one. Hence, altogether, there will be exactly m/3 votes (denoted by the set P1 ) in any extension of P where y is placed at the second position. However, since the X3C instance is a N O instance, the Si s corresponding to the votes in P1 does not form a set cover. Let u ∈ U be an element not covered by the Si s corresponding to the votes in P1 . Notice that the score of u does not decrease in the extension P and thus c does not win uniquely irrespective of the manipulator’s vote. Thus every vote is c-optimal and thus the O PPORTUNISTIC M ANIPULATION instance is a Y ES instance. Thus every vote is c-optimal and the O PPORTUNISTIC M ANIPULATION instance is a Y ES instance. For the maximin voting rule, we show intractability of O PPORTUNISTIC M ANIPULATION with one manipulator even when the number of undetermined pairs in every vote is at most 8. Theorem 8. The O PPORTUNISTIC M ANIPULATION problem is co-NP-hard for the maximin voting rule even when the number of manipulators is one and the number of undetermined pairs in every vote is no more than 8. 20 Proof. We reduce X3C to O PPORTUNISTIC M ANIPULATION for the maximin rule. Let (U = {u1 , . . . , um }, S = {S1 , S2 , . . . , St }) is an X3C instance. We construct a corresponding O PPORTUNISTIC M ANIPULATION instance for the maximin voting rule as follows. Candidate set C = U ∪ {c, z1 , z2 , z3 , d, x, y} For every i ∈ [t], we define P0i as follows: ∀i 6 t, Si  x  d  y  (U \ Si )  z1  z2  z3 Using P0i , we define partial vote Pi = P0i \ ({({x} ∪ Si ) × {d, y}}) for every i ∈ [t]. We denote the set of partial votes {Pi : i ∈ [t]} by P and {P0i : i ∈ [t]} by P0 . We note that the number of undetermined pairs in each partial vote Pi is 8. We define another partial vote p as follows. p = (z1  z2  z3  others ) \ {(z1 , z2 ), (z2 , z3 ), (z1 , z3 )} Using Lemma 2, we add a set Q of complete votes with |Q| = poly(m, t) to ensure the following pairwise margins (notice that the pairwise margins among z1 , z2 , and z3 does not include the partial vote p). Figure 3 shows the weighted majority graph of the resulting election. B DP0 ∪Q∪{p} (d, c) = 4t + 1 B DP0 ∪Q∪{p} (x, d) = 4t + 2m/3 + 1 B DP0 ∪Q∪{p} (y, x) = 4t − 2m/3 + 1 B DP0 ∪Q∪{p} (d, uj ) = 4t − 1 ∀uj ∈ U B DP0 ∪Q (z1 , z2 ) = DP0 ∪Q (z2 , z3 ) = DP0 ∪Q (z3 , z1 ) = 4t + 2 B |DP0 ∪Q∪{p} (a, b)| 6 1 for every a, b ∈ C not defined above. We have only one manipulator who tries to make c winner. Now we show that the X3C instance (U, S) is a Y ES instance if and only if the O PPORTUNISTIC M ANIPULATION instance (P ∪ Q ∪ {p}, 1, c) is a N O instance. Notice that we can assume without loss of generality that the manipulator’s vote prefers c to every other candidate, y to x, x to d, and d to uj for every uj ∈ U. In the forward direction, let us now assume that the X3C instance is a Y ES instance. Suppose (by renaming) that S1 , . . . , Sm/3 forms an exact set cover. Notice that the manipulator’s vote must prefer either z2 to z1 or z1 to z3 or z3 to z2 . We show that if the manipulator’s vote v prefers z2 to z1 , then v is not a c-optimal vote. The other two cases are symmetrical. Consider the following extension P of P and p of p. 1 6 i 6 m/3, d  y  Si  x  (U \ Si )  z1  z2  z3 m/3 + 1 6 i 6 t, Si  x  d  y  (U \ Si )  z1  z2  z3 p = z2  z3  z1  others From the votes in P ∪ Q ∪ {v, p}, the maximin score of c is −4t, of d, x, uj ∀uj ∈ U are −4t − 2, of z1 , z3 are at most than −4t − 2, and of z2 is −4t. Hence, c is not the unique maximn winner. 21 d 4t − 1 uj z1 4t + 2 4t + 2 z3 4t + 2 z2 4t + 1 4t + 2m/3 + 1 c y x 4t − 2m/3 + 1 Figure 3: Weighted majority graph of the reduced instance in Theorem 8. Solid line and dashed line represent pairwise margins in P0 ∪Q∪{p} and P0 ∪Q respectively. The weight of all the edges not shown in the figure are within −1 to 1. For simplicity, we do not show edges among {u1 , . . . , um }. However, the manipulator’s vote c  z1  z2  z3  other makes c the unique maximin winner. Hence, v is not a c-optimal vote. For the reverse direction, we show that if the X3C instance is a N O instance, then there does not exist a vote v of the manipulator and an extension P of P such that c is the unique winner for the votes P ∪ Q ∪ {v0 } thereby proving that the O PPORTUNISTIC M ANIPULATION instance is vacuously Y ES (and thus every vote is c-optimal). Consider any extension P of P. Notice that, for c to win uniquely, y  x must be at least m/3 of the votes in P; call these set of votes P1 . However, d  x in every vote in P1 and d  x can be in at most m/3 votes in P for c to win uniquely. Hence, we have |P1 | = m/3. Also for c to win, each d  uj must be at least one vote of P and d  uj is possible only in the votes in P1 . However, the sets Si s corresponding to the votes in P1 does not form a set cover since the X3C instance is a N O instance. Hence, there must exist a uj ∈ U for which uj  d in every vote in P and thus c cannot win uniquely irrespective of the vote of the manipulator. Thus every vote is c-optimal and the O PPORTUNISTIC M ANIPULATION instance is a Y ES instance. Our next result proves that the O PPORTUNISTIC M ANIPULATION problem is co-NP-hard for the Copelandα voting rule too for every α ∈ [0, 1] even with one manipulator and at most 8 undetermined pairs per vote. Theorem 9. The O PPORTUNISTIC M ANIPULATION problem is co-NP-hard for the Copelandα voting rule for every α ∈ [0, 1] even when the number of manipulators is one and the number of undetermined pairs in each vote is no more than 8. Proof. We reduce X3C to O PPORTUNISTIC M ANIPULATION for the Copelandα voting rule. Let (U = {u1 , . . . , um }, S = {S1 , S2 , . . . , St }) is an X3C instance. We construct a corresponding O PPORTUNISTIC M ANIPULATION instance for the Copelandα voting rule as follows. Candidate set C = U ∪ {c, z1 , z2 , z3 , d1 , d2 , d3 , x, y} For every i ∈ [t], we define P0i as follows: 22 ∀i 6 t, Si  x  y  c  others Using P0i , we define partial vote Pi = P0i \({({x}∪Si )×{c, y}}) for every i ∈ [t]. We denote the set of partial votes {Pi : i ∈ [t]} by P and {P0i : i ∈ [t]} by P0 . We note that the number of undetermined pairs in each partial vote Pi is 8. We define another partial vote p as follows. p = (z1  z2  z3  others ) \ {(z1 , z2 ), (z2 , z3 ), (z1 , z3 )} Using Lemma 2, we add a set Q of complete votes with |Q| = poly(m, t) to ensure the following pairwise margins (notice that the pairwise margins among z1 , z2 , and z3 does not include the partial vote p). Figure 4 shows the weighted majority graph of the resulting election. B DP0 ∪Q∪{p} (uj , c) = 2 ∀uj ∈ U B DP0 ∪Q∪{p} (x, y) = 2m/3 B DP0 ∪Q∪{p} (c, y) = DP0 ∪Q∪{p} (x, c) = DP0 ∪Q∪{p} (di , c) = DP0 ∪Q∪{p} (zk , c) DP0 ∪Q∪{p} (uj , x) = DP0 ∪Q∪{p} (x, zk ) = DP0 ∪Q∪{p} (di , x) = DP0 ∪Q∪{p} (y, uj ) DP0 ∪Q∪{p} (di , y) = DP0 ∪Q∪{p} (y, zk ) = DP0 ∪Q∪{p} (zk , uj ) = DP0 ∪Q∪{p} (uj , di ) DP0 ∪Q∪{p} (zk , d1 ) = DP0 ∪Q∪{p} (zk , d2 ) = DP0 ∪Q∪{p} (d3 , zk ) = 4t ∀i, k ∈ [3], j ∈ [m] = = = B DP0 ∪Q∪{p} (uj , u ) = −4t for at least m/3 many u ∈ U B DP0 ∪Q (z1 , z2 ) = DP0 ∪Q (z2 , z3 ) = DP0 ∪Q (z3 , z1 ) = 1 B |DP0 ∪Q∪{p} (a, b)| 6 1 for every a, b ∈ C not defined above. We have only one manipulator who tries to make c winner. Now we show that the X3C instance (U, S) is a Y ES instance if and only if the O PPORTUNISTIC M ANIPULATION instance (P ∪ Q ∪ {p}, 1, c) is a N O instance. Since the number of voters is odd, α does not play any role in the reduction and thus from here on we simply omit α. Notice that we can assume without loss of generality that the manipulator’s vote prefers c to every other candidate and x to y. In the forward direction, let us now assume that the X3C instance is a Y ES instance. Suppose (by renaming) that S1 , . . . , Sm/3 forms an exact set cover. Suppose the manipulator’s vote v order z1 , z2 , and z3 as z1  z2  z3 . We will show that v is not a c-optimal vote. Symmetrically, we can show that the manipulator’s vote ordering z1 , z2 , and z3 in any other order is not c-optimal. Consider the following extension P of P and p of p. 1 6 i 6 m/3, y  c  Si  x  others m/3 + 1 6 i 6 t, Si  x  y  c  others p = z1  z2  z3  others From the votes in P ∪ Q ∪ {v, p}, the Copeland score of c is m + 4 (defeating y, zk , uj ∀k ∈ [3], j ∈ [m]), of y is m+3 (defeating zk , uj ∀k ∈ [3], j ∈ [m]), of uj is at most 2m/3+4 (defeating x, di ∀i ∈ [3] and at most 2m/3 many u ∈ U), of x is 5 (defeating c, y, zk ∀l ∈ [3]), of d1 , d2 is 2 (defeating y and c), of d3 is 5 (defeating y, c, zk ∀k ∈ [3]). of z3 is m + 3 (defeating di , uj ∀i ∈ [3], j ∈ [m]) for every k ∈ [3], of z3 is m + 2 (defeating d1 , d2 , uj i ∈ [3], j ∈ [m]), z2 is m + 3 (defeating 23 uj z1 1 2 z2 y c 1 z3 d1 2m/3 x d2 d3 1 Figure 4: Weighted majority graph of the reduced instance in Theorem 9. Solid line and dashed line represent pairwise margins in P0 ∪ Q ∪ {p} and P0 ∪ Q respectively. The weight of all the edges not shown in the figure are within −1 to 1. The weight of all unlabeled edges are 4t. For simplicity, we do not show edges among {u1 , . . . , um }. 24 d1 , d2 , z3 , uj i ∈ [3], j ∈ [m]), z1 is m + 4 (defeating d1 , d2 , z2 , z3 , uj i ∈ [3], j ∈ [m]). Hence, c co-wins with z1 with Copeland score m + 4. However, the manipulator’s vote c  z3  z2  z1 makes c win uniquely. Hence, v is not a c-optimal vote and thus the O PPORTUNISTIC M ANIPULATION instance is a N O instance. For the reverse direction, we show that if the X3C instance is a N O instance, then there does not exist a vote v of the manipulator and an extension P of P such that c is the unique winner for the votes P ∪ Q ∪ {v0 } thereby proving that the O PPORTUNISTIC M ANIPULATION instance is vacuously Y ES (and thus every vote is c-optimal). Consider any extension P of P. Notice that, for c to win uniquely, c must defeat each uj ∈ U and thus c is preferred over uj in at least one vote in P; we call these votes P1 . However, in every vote in P1 , y is preferred over x and thus |P1 | 6 m/3 because x must defeat y for c to win uniquely. Since the X3C instance is a N O instance, there must be a candidate u ∈ U which is not covered by the sets corresponding to the votes in P1 and thus u is preferred over c in every vote in P. Hence, c cannot win uniquely irrespective of the vote of the manipulator. Thus every vote is c-optimal and the O PPORTUNISTIC M ANIPULATION instance is a Y ES instance. For the Bucklin and simplified Bucklin voting rules, we show intractability of the O PPORTUNIS TIC M ANIPULATION problem with at most 15 undetermined pairs per vote and only one manipulator. Theorem 10. The O PPORTUNISTIC M ANIPULATION problem is co-NP-hard for the Bucklin and simplified Bucklin voting rules even when the number of manipulators is one and the number of undetermined pairs in each vote is no more than 15. Proof. We reduce X3C to O PPORTUNISTIC M ANIPULATION for the Bucklin and simplified Bucklin voting rules. Let (U = {u1 , . . . , um }, S = {S1 , S2 , . . . , St }) is an X3C instance. We assume without loss of generality that m is not divisible by 6 (if not, we introduce three elements in U and a set containing them in S) and t is an even integer (if not, we duplicate any set in S). We construct a corresponding O PPORTUNISTIC M ANIPULATION instance for the Bucklin and simplified Bucklin voting rules as follows. Candidate set C = U ∪ {c, z1 , z2 , x1 , x2 , d} ∪ W, where |W| = m − 3 For every i ∈ [t], we define P0i as follows: ∀i 6 t, (U \ Si )  Si  d  x1  x2  z1  z2  others P0i , Using we define partial vote Pi = P0i \ ({({d} ∪ Si ) × {x1 , x2 , z1 , z2 }} ∪ {(z1 , z2 )}) for every i ∈ [t]. We denote the set of partial votes {Pi : i ∈ [t]} by P and {P0i : i ∈ [t]} by P0 . We note that the number of undetermined pairs in each partial vote Pi is 15. We introduce the following additional complete votes Q: B t/2 − bm/6c − 1 copies of W  z1  z2  x1  c  others B t/2 − bm/6c − 1 copies of W  z1  z2  x2  c  others B 2dm/6e copies of W  z1  z2  d  c  others B bm/6c copies of W  z1  d  x1  c  others B bm/6c copies of W  z1  d  x2  c  others 25 B 2dm/6e − 1 copies of U  x1  others B One U  c  others We have only one manipulator who tries to make c winner. Now we show that the X3C instance (U, S) is a Y ES instance if and only if the O PPORTUNISTIC M ANIPULATION instance (P∪Q, 1, c) is a N O instance. The total number of voters in the O PPORTUNISTIC M ANIPULATION instance is 2t + 2m/3 + 1. We notice that within top m + 1 positions of the votes in P0 ∪ Q, c appears t + m/3 times, z1 and z2 appear t + bm/6c times, x1 appears t/2 + m/3 − 1 times, x2 appears t/2 − 1 times, every candidate in W appears t + m/3 − 1 times, every candidate in U appears t + m/3 + 1 times. Also every candidate in U appears t + m/3 + 1 times within top m positions of the votes in P ∪ Q. Hence, for both Bucklin and simplified Bucklin voting rules, we can assume without loss of generality that the manipulator puts c, every candidate in W, x1 , x2 , and exactly one of z1 and z2 . In the forward direction, let us now assume that the X3C instance is a Y ES instance. Suppose (by renaming) that S1 , . . . , Sm/3 forms an exact set cover. Suppose the manipulator’s vote v puts c, every candidate in W, x1 , x2 , and z1 within top m + 1 positions. We will show that v is not c-optimal. The other case where the manipulator’s vote v0 puts c, every candidate in W, x1 , x2 , and z2 within top m + 1 positions is symmetrical. Consider the following extension P of P: 1 6 i 6 bm/6c, (U \ Si )d  x1  x2  z2  Si  z1  others dm/6e 6 i 6 m/3, (U \ Si )d  x1  x2  z1  Si  z2  others m/3 + 1 6 i 6 t, (U \ Si )  Si  d  x1  x2  z1  z2  others For both Bucklin and simplified Bucklin voting rules, c co-wins with z1 for the votes in P ∪ Q ∪ {v}. However, c wins uniquely for the votes in P ∪ Q ∪ {v0 }. Hence, v is not a c-optimal vote and thus the O PPORTUNISTIC M ANIPULATION instance is a N O instance. For the reverse direction, we show that if the X3C instance is a N O instance, then there does not exist a vote v of the manipulator and an extension P of P such that c is the unique winner for the votes P ∪ Q ∪ {v0 } thereby proving that the O PPORTUNISTIC M ANIPULATION instance is vacuously Y ES (and thus every vote is c-optimal). Consider any extension P of P. Notice that, for c to win uniquely, every candidate must be pushed out of top m + 1 positions in at least one vote in P; we call these set of votes P1 . Notice that, |P1 | > m/3. However, in every vote in P1 , at least one of z1 and z2 appears within top m + 1 many positions. Since, the manipulator has to put at least one of z1 and z2 within its top m + 1 positions and z1 and z2 appear t + bm/6c times in the votes in P0 ∪ Q, we must have |P1 | 6 m/3 and thus |P1 | = m/3, for c to win uniquely. However, there exists a candidate u ∈ U not covered by the Si s corresponding to the votes in P1 . Notice that u gets majority within top m positions of the votes and c can never get majority within top m + 1 positions of the votes. Hence, c cannot win uniquely irrespective of the vote of the manipulator. Thus every vote is c-optimal and the O PPORTUNISTIC M ANIPULATION instance is a Y ES instance. 4 Polynomial Time Algorithms We now turn to the polynomial time cases depicted in Table 1. This section is organized in three parts, one for each problem considered. 26 4.1 Weak Manipulation Since the P OSSIBLE W INNER problem is in P for the plurality and the veto voting rules [BD09], it follows from Observation 1 that the W EAK M ANIPULATION problem is in P for the plurality and veto voting rules for any number of manipulators. Proposition 1. The W EAK M ANIPULATION problem is in P for the plurality and veto voting rules for any number of manipulators. Proof. The P OSSIBLE W INNER problem is in P for the plurality and the veto voting rules [BD09]. Hence, the result follows from Observation 1. 4.2 Strong Manipulation We now discuss our algorithms for the S TRONG M ANIPULATION problem. The common flavor in all our algorithms is the following: we try to devise an extension that is as adversarial as possible for the favorite candidate c, and if we can make c win in such an extension, then roughly speaking, such a strategy should work for other extensions as well (where the situation only improves for c). However, it is challenging to come up with an extension that is globally dominant over all the others in the sense that we just described. So what we do instead is we consider every potential nemesis w who might win instead of c, and we build profiles that are “as good as possible” for w and “as bad as possible” for c. Each such profile leads us to constraints on how much the manipulators can afford to favor w (in terms of which positions among the manipulative votes are safe for w). We then typically show that we can determine whether there exists a set of votes that respects these constraints, either by using a greedy strategy or by an appropriate reduction to a flow problem. We note that the overall spirit here is similar to the approaches commonly used for solving the N ECESSARY W INNER problem, but as we will see, there are non-trivial differences in the details. We begin with the k-approval and k-veto voting rules. Theorem 11. The S TRONG M ANIPULATION problem is in P for the k-approval and k-veto voting rules, for any k and any number of manipulators. Proof. For the time being, we just concentrate on non-manipulators’ votes. For each candidate 0 0 c0 ∈ C \ {c}, calculate the maximum possible value of smax NM (c, c ) = sNM (c ) − sNM (c) from nonmanipulators’ votes, where sNM (a) is the score that candidate a receives from the votes of the non-manipulators. This can be done by checking all 4 possible score combinations that c and c0 can get in each vote v and choosing the one which maximizes sv (c0 ) − sv (c) from that vote. We now fix the position of c at the top position for the manipulators’ votes and we check if it is possible to place 0 0 other candidates in the manipulators’ votes such that the final value of smax NM (c, c )+sM (c )−sM (c) is negative which can be solved easily by reducing it to the max flow problem which is polynomial time solvable. We now prove that the S TRONG M ANIPULATION problem for scoring rules is in P for one manipulator. Theorem 12. The S TRONG M ANIPULATION problem is in P for any scoring rule when we have only one manipulator. 27 0 Proof. For each candidate c0 ∈ C \ {c}, calculate smax NM (c, c ) using same technique described in the proof of Theorem 11. We now put c at the top position of the manipulator’s vote. For each candidate c0 ∈ C \ {c}, c0 can be placed at positions i ∈ {2, . . . , m} in the manipulator’s vote which 0 makes smax NM (c, c ) + αi − α1 negative. Using this, construct a bipartite graph with C \ {c} on left and {2, . . . , m} on right and there is an edge between c0 and i iff the candidate c0 can be placed at i in the manipulator’s vote according to the above criteria. Now solve the problem by finding existence of perfect matching in this graph. Our next result proves that the S TRONG M ANIPULATION problem for the Bucklin, simplified Bucklin, Fallback, and simplified Fallback voting rules are in P. Theorem 13. The S TRONG M ANIPULATION problem is in P for the Bucklin, simplified Bucklin, Fallback, and simplified Fallback voting rules, for any number of manipulators. Proof. Let (C, P, M, c) be an instance of S TRONG M ANIPULATION for simplified Bucklin, and let m denote the total number of candidates in this instance. Recall that the manipulators have to cast their votes so as to ensure that the candidate c wins in every possible extension of P. We use Q to denote the set of manipulating votes that we will construct. To begin with, without loss of generality, the manipulators place c in the top position of all their votes. We now have to organize the positioning of the remaining candidates across the votes of the manipulators to ensure that c is a necessary winner of the profile (P, Q). To this end, we would like to develop a system of constraints indicating the overall number of times that we are free to place a candidate w ∈ C \ {c} among the top  positions in the profile Q. In particular, let us fix w ∈ C \ {c} and 2 6  6 m. Let ηw, be the maximum number of votes of Q in which w can appear in the top  positions. Our first step is to compute necessary conditions for ηw, . We use Pw, to denote a set of complete votes that we will construct based on the given partial votes. Intuitively, these votes will represent the “worst” possible extensions from the point of view of c when pitted against w. These votes are engineered to ensure that the manipulators can make c win the elections Pw, for all w ∈ C \ {c} and  ∈ {2, . . . , m}, if, and only if, they can strongly manipulate in favor of c. More formally, there exists a voting profile Q of the manipulators so that c wins the election Pw, ∪ Q, for all w ∈ C \ {c} and  ∈ {2, . . . , m} if and only if c wins in every extension of the profile P ∪ Q. We now describe the profile Pw, . The construction is based on the following case analysis, where our goal is to ensure that, to the extent possible, we position c out of the top  − 1 positions, and incorporate w among the top  positions. B Let v ∈ P be such that either c and w are incomparable or w  c. We add the complete vote v0 to Pw, , where v0 is obtained from v by placing w at the highest possible position and c at the lowest possible position, and extending the remaining vote arbitrarily. B Let v ∈ P be such that c  w, but there are at least  candidates that are preferred over w in v. We add the complete vote v0 to Pw, , where v0 is obtained from v by placing c at the lowest possible position, and extending the remaining vote arbitrarily. B Let v ∈ P be such that c is forced to be within the top  − 1 positions, then we add the complete vote v0 to Pw, , where v0 is obtained from v by first placing w at the highest possible position followed by placing c at the lowest possible position, and extending the remaining vote arbitrarily. 28 B In the remaining votes, notice that whenever w is in the top  positions, c is also in the top  − 1 positions. Let P∗w, denote this set of votes, and let t be the number of votes in P∗w, . We now consider two cases. Let d (c) be the number of times c is placed in the top  − 1 positions in the profile Pw, ∪ Q, and let d (w) be the number of times w is placed in the top  positions in the profile Pw, . Let us now formulate the requirement that in Pw, ∪ Q, the candidate c does not have a majority in the top  − 1 positions and w does have a majority in the top  positions. Note that if this requirement holds for any w and , then strong manipulation is not possible. Therefore, to strongly manipulate in favor of c, we must ensure that for every choice of w and , we are able to negate the conditions that we derive. The first condition from above simply translates to d (c) 6 n/2. The second condition amounts to requiring first, that there are at least n/2 votes where w appears in the top  positions, that is, d (w) + ηw, + t > n/2. Further, note that the gap between d (w) + ηw, and majority will be filled by using votes from P∗w, to “push” w forward. However, these votes contribute equally to w and c being in the top  and  − 1 positions, respectively. Therefore, the difference between d (w) + ηw, and n/2 must be less than the difference between d (c) and n/2. Summarizing, the following conditions, which we collectively denote by (?), are sufficient to defeat c in some extension: d (c) 6 n/2, d (w) + ηw, + t > n/2, n/2 − d (w) + ηw, < n/2 − d (c). From the manipulator’s point of view, the above provides a set of constraints to be satisfied as they place the remaining candidates across their votes. Whenever d (c) > n/2, the manipulators place any of the other candidates among the top  positions freely, because c already has majority. On the other hand, if d (c) 6 n/2, then the manipulators must respect at least one of the following constraints: ηw, 6 n/2 − t − d (w) and ηw, 6 d (c) − d (w). Extending the votes of the manipulator while respecting these constraints (or concluding that this is impossible to do) can be achieved by a natural greedy strategy — construct the manipulators’ votes by moving positionally from left to right. For each position, consider each manipulator and populate her vote for that position with any available candidate. We output the profile if the process terminates by completing all the votes, otherwise, we say N O. We now argue the proof of correctness. Suppose the algorithm returns N O. This implies that there exists a choice of w ∈ C \ {c} and  ∈ {2, . . . , m} such that for any voting profile Q of the manipulators, the conditions in (?) are satisfied. (Indeed, if there exists a voting profile that violated at least one of these conditions, then the greedy algorithm would have discovered it.) Therefore, no matter how the manipulators cast their vote, there exists an extension where c is defeated. In particular, for the votes in P \ P∗w, , this extension is given by Pw, . Further, we choose n/2 − ηw, − d (w) votes among the votes in P∗w, and extend them by placing w in the top  positions (and extending the rest of the profile arbitrary). We extend the remaining votes in P∗w, by positioning w outside the top  positions. Clearly, in this extension, c fails to achieve majority in the top  − 1 positions while w does achieve majority in the top  positions. On the other hand, if the algorithm returns Y ES, then consider the voting profile of the manipulators. We claim that c wins in every extension of P ∪ Q. Suppose, to the contrary, that there exists an extension R and a candidate w such that the simplified Bucklin score of c is no more than the simplified Bucklin score of w in R. In this extension, therefore, there exists  ∈ {2, . . . , m} for which w attains majority in the top  positions and c fails to attain majority in the top  − 1 positions. However, note that this is already impossible in any extension of the profile Pw,l ∪ P∗w, , because of the design of the constraints. By construction, the number of votes in which c appears in the top  − 1 positions in R is only greater than the number of times c appears in the top  − 1 positions in 29 any extension of Pw,l ∪ P∗w, (and similarly for w). This leads us to the desired contradiction. For the Bucklin voting rule, we do the following modifications to the algorithm. If d (c) > d (w) for some w ∈ C \ {c} and  < m, then we make ηw, = ∞. The proof of correctness for the Bucklin voting rule is similar to the proof of correctness for the simplified Bucklin voting rule above. For Fallback and simplified Fallback voting rules, we consider the number of candidates each voter approves while computing ηw, . We output Y ES if and only if ηw, > 0 for every w ∈ C \ {c} and every  6 m, since we can assume, without loss of generality, that the manipulator approves the candidate c only. Again the proof of correctness is along similar lines to the proof of correctness for the simplified Bucklin voting rule. We next show that the S TRONG M ANIPULATION problem for the maximin voting rule is polynomial-time solvable when we have only one manipulator. Theorem 14. The S TRONG M ANIPULATION problem for the maximin voting rules are in P, when we have only one manipulator. Proof. For the time being, just concentrate on non-manipulators’ votes. Using the algorithm for NW for maximin in [XC11], we compute for all pairs w, w0 ∈ C, N(w,w0 ) (w, d) and N(w,w0 ) (c, w0 ) for all d ∈ C \ {c}. This can be computed in polynomial time. Now we place c at the top position in the manipulator’s vote and increase all N(w,w0 ) (c, w0 ) by one. Now we place a candidate w at the second position if for all w0 ∈ C, N0(w,w0 ) (w, d) < N(w,w0 ) (c, w0 ) for all d ∈ C \ {c}, where N0(w,w0 ) (w, d) = N(w,w0 ) (w, d) of the candidate d has already been assigned some position in the manipulator’s vote, and N0(w,w0 ) (w, d) = N(w,w0 ) (w, d) + 1 else. The correctness argument is in the similar lines of the classical greedy manipulation algorithm of [BITT89]. 4.3 Opportunistic Manipulation For the plurality, Fallback, and simplified Fallback voting rules, it turns out that the voting profile where all the manipulators approve only c is a c-opportunistic voting profile, and therefore it is easy to devise a manipulative vote. Observation 4. The O PPORTUNISTIC M ANIPULATION problem is in P for the plurality and Fallback voting rules for a any number of manipulators. For the veto voting rule, however, a more intricate argument is needed, that requires building a system of constraints and a reduction to a suitable instance of the maximum flow problem in a network, to show polynomial time tractability of O PPORTUNISTIC M ANIPULATION. Theorem 15. The O PPORTUNISTIC M ANIPULATION problem is in P for the veto voting rule for a constant number of manipulators. Proof. Let (P, , c) be an input instance of O PPORTUNISTIC M ANIPULATION. We may assume without loss of generality that the manipulators approve P c. We view the voting profile of the manipulators as a tuple (na )a∈C\{c} ∈ (N ∪ {0})m−1 with a∈C\{c} na = , where the na many manipulators disapprove a. We denote the set of such tuples as T and we have |T| = O((2m) ) which is polynomial in m since  is a constant. A tuple (na )a∈C\{c} ∈ T is not c-optimal if there exists another tuple (n0a )a∈C\{c} ∈ T and an extension P of P with the following properties. We denote the veto score of a candidate from P by s(·). For every candidate a ∈ C \ {c}, we define two quantities w(a) and d(a) as follows. 30 B s(c) > s(a) for every a ∈ C \ {c} with na = n0a = 0 and we define w(a) = s(c) − 1, d(a) = 0 B s(c) > s(a)−n0a for every a ∈ C\{c} with na > n0a and we define w(a) = s(c)−n0a −1, d(a) = 0 B s(a) − na > s(c) > s(a) − n0a for every a ∈ C \ {c} with na < n0a and we define w(a) = s(c) − n0a , d(a) = s(a) − na We guess the value of s(c). Given a value of s(c), we check the above two conditions by reducing this to a max flow problem instance as follows. We have a source vertex s and a sink t. We have a vertex for every a ∈ C (call this set of vertices Y) and a vertex for every vote v ∈ P (call this set of vertices X). We add an edge from s to each in X of capacity one. We add an edge of capacity one from a vertex x ∈ X to a vertex y ∈ Y if the candidate corresponding to the vertex y can be placed at the last position in an extension of the partial vote corresponding to the vertex x. We add an edge from a vertex y to t of capacity w(a), where a is the voter corresponding to the vertex y. We also set the demand of every vertex y d(a) (that is the total amount of flow coming into vertex y must be at least d(a)), where a is the voter corresponding to the vertex y. Clearly, the above three conditions are met if and only if there is a feasible |P| amount of flow in the above flow graph. Since s(c) can have only |P| + 1 possible values (from 0 to P) and |T| = O((2m) ), we can iterate over all possible pairs of tuples in T and all possible values of s(c) and find a c-optimal voting profile if there exists a one. 5 Conclusion We revisited many settings where the complexity barrier for manipulation was non-existent, and studied the problem under an incomplete information setting. Our results present a fresh perspective on the use of computational complexity as a barrier to manipulation, particularly in cases that were thought to be dead-ends (because the traditional manipulation problem was polynomially solvable). To resurrect the argument of computational hardness, we have to relax the model of complete information, but we propose that the incomplete information setting is more realistic, and many of our hardness results work even with very limited incompleteness of information. Our work is likely to be the starting point for further explorations. To begin with, we leave open the problem of completely establishing the complexity of strong, opportunistic, and weak manipulations for all the scoring rules. Other fundamental forms of manipulation and control do exist in voting, such as destructive manipulation and control by adding candidates. It would be interesting to investigate the complexity of these problems in a partial information setting. Another exciting direction is the study of average case complexity, as opposed to the worst case results that we have pursued. These studies have already been carried out in the setting of complete information [PR06, FP10, Wal10]. Studying the problems that we propose in the averagecase model would reveal further insights on the robustness of the incomplete information setting as captured by our model involving partial orders. Our results showed that the impact of paucity of information on the computational complexity of manipulation crucially depends on the notion of manipulation under consideration. We also argued that different notions of manipulation may be applicable to different situations, maybe based of how optimistic (or pessimistic) the manipulators are. One important direction of future research 31 is to run extensive experimentations on real and synthetic data to know how people manipulate in the absence of complete information. Acknowledgement Palash Dey wishes to gratefully acknowledge support from Google India for providing him with a special fellowship for carrying out his doctoral work. Neeldhara Misra acknowledges support by the INSPIRE Faculty Scheme, DST India (project IFA12-ENG-31). References [BBF10] Yoram Bachrach, Nadja Betzler, and Piotr Faliszewski. Probabilistic possible winner determination. In International Conference on Artificial Intelligence (AAAI), volume 10, pages 697–702, 2010. [BCE+ 15] Felix Brandt, Vincent Conitzer, Ulle Endriss, Jérôme Lang, and Ariel D Procaccia. Handbook of computational social choice, 2015. [BD09] Nadja Betzler and Britta Dorn. Towards a dichotomy of finding possible winners in elections based on scoring rules. In Mathematical Foundations of Computer Science (MFCS), pages 124–136. Springer, 2009. [BFLR12] Dorothea Baumeister, Piotr Faliszewski, Jérôme Lang, and Jörg Rothe. Campaigns for lazy voters: truncated ballots. In International Conference on Autonomous Agents and Multiagent Systems, AAMAS 2012, Valencia, Spain, June 4-8, 2012 (3 Volumes), pages 577–584, 2012. [BIO91] John Bartholdi III and James B. Orlin. Single transferable vote resists strategic voting. Soc. Choice Welf., 8(4):341–354, 1991. [BITT89] John Bartholdi III, C.A. Tovey, and M.A. Trick. The computational difficulty of manipulating an election. Soc. Choice Welf., 6(3):227–241, 1989. [BNW11] Nadja Betzler, Rolf Niedermeier, and Gerhard J Woeginger. Unweighted coalitional manipulation under the borda rule is NP-hard. In IJCAI, volume 11, pages 55–60, 2011. [BRR11] Dorothea Baumeister, Magnus Roos, and Jörg Rothe. Computational complexity of two variants of the possible winner problem. In The 10th International Conference on Autonomous Agents and Multiagent Systems (AAMAS), pages 853–860, 2011. [BRR+ 12] Dorothea Baumeister, Magnus Roos, Jörg Rothe, Lena Schend, and Lirong Xia. The possible winner problem with uncertain weights. In ECAI, pages 133–138, 2012. [BS09] Steven J Brams and M Remzi Sanver. Voting systems that combine approval and preference. In The mathematics of preference, choice and order, pages 215–237. Springer, 2009. 32 [CLMM10] Yann Chevaleyre, Jérôme Lang, Nicolas Maudet, and Jérôme Monnot. Possible winners when new candidates are added: The case of scoring rules. In Proc. International Conference on Artificial Intelligence (AAAI), 2010. [CSL07] Vincent Conitzer, Tuomas Sandholm, and Jérôme Lang. When are elections with few candidates hard to manipulate? J. ACM, 54(3):14, 2007. [CWX11] Vincent Conitzer, Toby Walsh, and Lirong Xia. Dominating manipulations in voting with partial information. In International Conference on Artificial Intelligence (AAAI), volume 11, pages 638–643, 2011. [Dey15] Palash Dey. Computational complexity of fundamental problems in social choice theory. In Proc. 2015 International Conference on Autonomous Agents and Multiagent Systems, pages 1973–1974. International Foundation for Autonomous Agents and Multiagent Systems, 2015. [DKNW11] Jessica Davies, George Katsirelos, Nina Narodytska, and Toby Walsh. Complexity of and algorithms for borda manipulation. In Proc. International Conference on Artificial Intelligence (AAAI), pages 657–662, 2011. [DL13] Ning Ding and Fangzhen Lin. Voting with partial information: what questions to ask? In Proc. 12th International Conference on Autonomous Agents and Multi-agent Systems (AAMAS), pages 1237–1238. International Foundation for Autonomous Agents and Multiagent Systems, 2013. [DMN15a] Palash Dey, Neeldhara Misra, and Y. Narahari. Detecting possible manipulators in elections. In Proc. 2015 International Conference on Autonomous Agents and Multiagent Systems, AAMAS 2015, Istanbul, Turkey, May 4-8, 2015, pages 1441–1450, 2015. [DMN15b] Palash Dey, Neeldhara Misra, and Y. Narahari. Kernelization complexity of possible winner and coalitional manipulation problems in voting. In Proc. 2015 International Conference on Autonomous Agents and Multiagent Systems, AAMAS 2015, Istanbul, Turkey, May 4-8, 2015, pages 87–96, 2015. [DMN16] Palash Dey, Neeldhara Misra, and Y. Narahari. Kernelization complexity of possible winner and coalitional manipulation problems in voting. Theor. Comput. Sci., 616:111– 125, 2016. [DN14] Palash Dey and Y Narahari. Asymptotic collusion-proofness of voting rules: the case of large number of candidates. In Proc. 13th International Conference on Autonomous Agents and Multiagent Systems (AAMAS), pages 1419–1420. International Foundation for Autonomous Agents and Multiagent Systems, 2014. [DN15] Palash Dey and Y Narahari. Asymptotic collusion-proofness of voting rules: The case of large number of candidates. Studies in Microeconomics, 3(2):120–139, 2015. [EE12] Edith Elkind and Gábor Erdélyi. Manipulation under voting rule uncertainty. In Proc. 11th International Conference on Autonomous Agents and Multiagent Systems (AAMAS), pages 627–634. International Foundation for Autonomous Agents and Multiagent Systems, 2012. 33 [ER91] Eithan Ephrati and Jeffrey S Rosenschein. The Clarke tax as a consensus mechanism among automated agents. In Proc. Ninth International Conference on Artificial Intelligence (AAAI), pages 173–178, 1991. [FHH10] Piotr Faliszewski, Edith Hemaspaandra, and Lane A Hemaspaandra. Using complexity to protect elections. Commun ACM, 53(11):74–82, 2010. [FHHR09] Piotr Faliszewski, Edith Hemaspaandra, Lane A. Hemaspaandra, and Jörg Rothe. Llull and copeland voting computationally resist bribery and constructive control. J. Artif. Intell. Res., 35:275–341, 2009. [FHS08] Piotr Faliszewski, Edith Hemaspaandra, and Henning Schnoor. Copeland voting: Ties matter. In Proc. 7th International Conference on Autonomous Agents and Multiagent Systems (AAMAS), pages 983–990. International Foundation for Autonomous Agents and Multiagent Systems, 2008. [FHS10] Piotr Faliszewski, Edith Hemaspaandra, and Henning Schnoor. Manipulation of copeland elections. In Proc. 9th International Conference on Autonomous Agents and Multiagent Systems (AAMAS), pages 367–374. International Foundation for Autonomous Agents and Multiagent Systems, 2010. [FKN08] Ehud Friedgut, Gil Kalai, and Noam Nisan. Elections can be manipulated often. In IEEE 49th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 243–249. IEEE, 2008. [FKS03] Ronald Fagin, Ravi Kumar, and D. Sivakumar. Efficient similarity search and classification via rank aggregation. In Proc. 2003 ACM SIGMOD International Conference on Management of Data, SIGMOD ’03, pages 301–312, New York, NY, USA, 2003. ACM. [FP10] Piotr Faliszewski and Ariel D Procaccia. Ai’s war on manipulation: Are we winning? AI Magazine, 31(4):53–64, 2010. [Gib73] Allan Gibbard. Manipulation of voting schemes: a general result. Econometrica, pages 587–601, 1973. [GJ79] Michael R Garey and David S Johnson. Computers and Intractability, volume 174. freeman New York, 1979. [GNNW14] Serge Gaspers, Victor Naroditskiy, Nina Narodytska, and Toby Walsh. Possible and necessary winner problem in social polls. In Proc. 13th International Conference on Autonomous Agents and Multiagent Systems (AAMAS), pages 613–620. International Foundation for Autonomous Agents and Multiagent Systems, 2014. [IKM12] M. Isaksson, G. Kindler, and E. Mossel. The geometry of manipulation - a quantitative proof of the gibbard-satterthwaite theorem. Combinatorica, 32(2):221–250, 2012. [KL05] Kathrin Konczak and Jérôme Lang. Voting procedures with incomplete preferences. In Proc. International Joint Conference on Artificial Intelligence-05 Multidisciplinary Workshop on Advances in Preference Handling, volume 20, 2005. 34 [McG53] David C McGarvey. A theorem on the construction of voting paradoxes. Econometrica, pages 608–610, 1953. [ML15] Vijay Menon and Kate Larson. Complexity of manipulation in elections with partial votes. CoRR, abs/1505.05900, 2015. [NW14] Nina Narodytska and Toby Walsh. The computational impact of partial votes on strategic voting. In Proc. 21st European Conference on Artificial Intelligence, 18-22 August 2014, Prague, Czech Republic - Including Prestigious Applications of Intelligent Systems (PAIS 2014), pages 657–662, 2014. [PHG00] David M. Pennock, Eric Horvitz, and C. Lee Giles. Social choice theory and recommender systems: Analysis of the axiomatic foundations of collaborative filtering. In Proc. Seventeenth National Conference on Artificial Intelligence and Twelfth Conference on on Innovative Applications of Artificial Intelligence, July 30 - August 3, 2000, Austin, Texas, USA., pages 729–734, 2000. [PR06] Ariel D Procaccia and Jeffrey S Rosenschein. Junta distributions and the averagecase complexity of manipulating elections. In Proc. Fifth International Conference on Autonomous Agents and Multiagent Systems (AAMAS), pages 497–504. ACM, 2006. [PR07] Ariel D. Procaccia and Jeffrey S. Rosenschein. Average-case tractability of manipulation in voting via the fraction of manipulators. In Proc. 6th International Joint Conference on Autonomous Agents and Multiagent Systems (AAMAS 2007), Honolulu, Hawaii, USA, May 14-18, 2007, page 105, 2007. [Sat75] Mark Allen Satterthwaite. Strategy-proofness and Arrow’s conditions: Existence and correspondence theorems for voting procedures and social welfare functions. J. Econ. Theory, 10(2):187–217, 1975. [Wal10] Toby Walsh. An empirical study of the manipulability of single transferable voting. In Proc. 19th European Conference on Artificial Intelligence (ECAI), pages 257–262, 2010. [Wal11] Toby Walsh. Where are the hard manipulation problems? J. Artif. Intell. Res., pages 1–29, 2011. [XC08a] Lirong Xia and Vincent Conitzer. Generalized scoring rules and the frequency of coalitional manipulability. In Proc. 9th ACM conference on Electronic Commerce (EC), pages 109–118. ACM, 2008. [XC08b] Lirong Xia and Vincent Conitzer. A sufficient condition for voting rules to be frequently manipulable. In Proc. 9th ACM conference on Electronic Commerce (EC), pages 99–108. ACM, 2008. [XC11] Lirong Xia and Vincent Conitzer. Determining possible and necessary winners under common voting rules given partial orders. volume 41, pages 25–67. AI Access Foundation, 2011. 35 [XZP+ 09] Lirong Xia, Michael Zuckerman, Ariel D Procaccia, Vincent Conitzer, and Jeffrey S Rosenschein. Complexity of unweighted coalitional manipulation under some common voting rules. In Proc. 21st International Joint Conference on Artificial Intelligence (IJCAI), volume 9, pages 348–352, 2009. 36
8 (cs.DS)
10 (math.ST)

Arxiv Classification: a classification of Arxiv Papers (11 classes).

This dataset is intended for long context classification (documents have all > 4k tokens).
Copied from "Long Document Classification From Local Word Glimpses via Recurrent Attention Learning"

@ARTICLE{8675939,
author={He, Jun and Wang, Liqun and Liu, Liu and Feng, Jiao and Wu, Hao},
journal={IEEE Access},
title={Long Document Classification From Local Word Glimpses via Recurrent Attention Learning},
year={2019},
volume={7},
number={},
pages={40707-40718},
doi={10.1109/ACCESS.2019.2907992}
}


It contains 11 slightly unbalanced classes, 33k Arxiv Papers divided into 3 splits: train (28k), val (2.5k) and test (2.5k).

2 configs:

• default
• no_ref, removes references to the class inside the document (eg: [cs.LG] -> [])

Compatible with run_glue.py script:

export MODEL_NAME=roberta-base
export MAX_SEQ_LENGTH=512

python run_glue.py \
--model_name_or_path $MODEL_NAME \ --dataset_name ccdv/arxiv-classification \ --do_train \ --do_eval \ --max_seq_length$MAX_SEQ_LENGTH \
--per_device_train_batch_size 8 \