Election Methods: A typed classification

Electoral systems consist of sets of rules that govern all aspects of the voting process: when elections occur, who is allowed to vote, who can stand as a candidate, how ballots are marked and cast, how the ballots are counted (electoral method), limits on campaign spending, and other factors that can affect the outcome.

A large variety of electoral systems are employed throughout the world, each with their specific characteristics. Classifying them is not easy, and existing classifications are broad rather than fine grained. The most common classification is the one we can see for example in Golder 2005 [1]:

Similarly, Norris 2007 [2] proposes:

where a distinction is made between purely proportional systems using party lists and semi-proportional methods. Wikipedia follows Golder 2005, although the concept of semi-proportional systems is mentioned in several places.

Again, the main categories are Majoritarian, Proportional and Mixed.

A typed classification

We can also propose a more technical classification geared towards software engineering. By this we mean a classification which serves to construct software that implements electoral methods for the purposes of electronic voting. With this approach we focus more on the data representation and counting properties of electoral systems, and leave other details as practiced in traditional voting aside. Our classification must be precise enough to start writing code.

The structure of the data that describes ballot information. For example, a unique choice, or a ranked set of choices.

Voting rule

The algorithm that takes ballot data as input and produces result data as output. For example, plurality.

Result data

The structure of the data that describes result information. For example, a unique winner, or a set of winners.

We can encode this classification scheme in a programming language. In this case we are doing it with Scala, and since this it is not a full implementation we can create the necessary structure with abstract types. Besides the added precision, this encoding allows us to type-check our classification and reveal inconsistencies. Here’s the structure that represents an electoral method.

Where we can see data types corresponding to ballot data (Option, Choice), voting rule (Rule) and result data (Result). The types at the bottom are extra technical details required for type checking. The Method trait is then refined for each particular electoral method. Before that, we need to specify the types for voting rules, for which we choose a set of commonly used ones:

Above we can see, for example, that STV is a voting rule that uses ranked ballots since it uses a SortedSet data structure. Finally, here’s an example of a specific method, in this case first-past-the-post:

which is an electoral method that uses accepts single choice on the ballot, uses the Plurality rule, and produces a single winner. You can see the full Scala encoding here.