boofun.analysis.arrow

Arrow’s Impossibility Theorem and Social Choice Theory.

Arrow’s Theorem (1951): Any social welfare function satisfying: 1. Unrestricted Domain (UD) 2. Pareto Efficiency (PE) 3. Independence of Irrelevant Alternatives (IIA) 4. Non-Dictatorship (ND)

…does not exist for 3+ alternatives.

For Boolean functions (2 alternatives), the theorem states: Any Boolean function f: {±1}^n → {±1} that is: - Unanimous (Pareto): If all voters agree, output matches - Independent: Output depends only on individual preferences - Non-dictatorial: Not controlled by a single voter

…must be dictatorial! (Only exception is constant functions)

Connection to Fourier Analysis: - A function is “close to dictator” if its degree-1 Fourier weight is high - The FKN theorem formalizes this

This module provides tools to: 1. Check if a function satisfies Arrow’s conditions 2. Quantify “distance to dictator” 3. Analyze voting functions in the social choice framework

References: - Arrow, “Social Choice and Individual Values” (1951) - O’Donnell, “Analysis of Boolean Functions” Chapter 2 - Kalai, “Social Indeterminacy” (2002)

Functions

arrow_analysis(f)

Analyze a voting function through the lens of Arrow's theorem.

find_dictator(f)

Find which variable is the dictator, if f is dictatorial.

is_dictatorial(f)

Check if f is a dictator function.

is_non_dictatorial(f)

Check if f is non-dictatorial.

is_unanimous(f)

Check if f satisfies unanimity (Pareto efficiency).

social_welfare_properties(f)

Analyze social welfare properties of a voting function.

voting_power_analysis(f)

Analyze voting power using different power indices.

Classes

ArrowAnalyzer(f)

Comprehensive Arrow's Theorem analysis for voting functions.

boofun.analysis.arrow.is_unanimous(f: BooleanFunction) bool[source]

Check if f satisfies unanimity (Pareto efficiency).

Unanimity: f(1,1,…,1) = 1 and f(0,0,…,0) = 0 (or in ±1: f(+1,…,+1) = +1 and f(-1,…,-1) = -1)

Parameters:

f – Boolean function (voting rule)

Returns:

True if function satisfies unanimity

boofun.analysis.arrow.is_dictatorial(f: BooleanFunction) bool[source]

Check if f is a dictator function.

A dictator function depends on exactly one variable: f(x) = x_i for some i (or f(x) = 1 - x_i)

Parameters:

f – Boolean function

Returns:

True if f is a dictator

boofun.analysis.arrow.is_non_dictatorial(f: BooleanFunction) bool[source]

Check if f is non-dictatorial.

Parameters:

f – Boolean function

Returns:

True if f is NOT a dictator

boofun.analysis.arrow.find_dictator(f: BooleanFunction) Tuple[int, bool] | None[source]

Find which variable is the dictator, if f is dictatorial.

Returns:

Tuple (variable_index, is_negated) if f is a dictator, None otherwise.

is_negated=False means f(x) = x_i is_negated=True means f(x) = 1 - x_i

boofun.analysis.arrow.arrow_analysis(f: BooleanFunction) Dict[str, Any][source]

Analyze a voting function through the lens of Arrow’s theorem.

For 2 alternatives (Boolean), Arrow says: Unanimous + IIA + Non-dictator = Impossible

Returns:

Dict with Arrow analysis results

boofun.analysis.arrow.social_welfare_properties(f: BooleanFunction) Dict[str, Any][source]

Analyze social welfare properties of a voting function.

Returns dict with: - Symmetry: Are all voters equally powerful? - Monotonicity: Does voting “yes” never hurt outcome? - Neutrality: Is the function balanced?

boofun.analysis.arrow.voting_power_analysis(f: BooleanFunction) Dict[str, Any][source]

Analyze voting power using different power indices.

Computes: - Banzhaf power index (= influence) - Shapley-Shubik power index (for simple games) - Pivotal voter analysis

class boofun.analysis.arrow.ArrowAnalyzer(f: BooleanFunction)[source]

Comprehensive Arrow’s Theorem analysis for voting functions.

Combines all social choice analysis tools.

__init__(f: BooleanFunction)[source]

Initialize with a voting function.

Parameters:

f – Boolean function representing the voting rule

arrow_properties() Dict[str, Any][source]

Get Arrow’s theorem analysis.

welfare_properties() Dict[str, Any][source]

Get social welfare properties.

voting_power() Dict[str, Any][source]

Get voting power analysis.

full_analysis() Dict[str, Any][source]

Get complete social choice analysis.

summary() str[source]

Get text summary of the analysis.