babylon.systems
Game systems for Babylon.
The core formulas implementing MLM-TW theory: - Imperial Rent calculation - Survival Calculus (P(S|A), P(S|R)) - Consciousness Drift - Unequal Exchange
For the modular System implementations, see babylon.engine.systems.
- babylon.systems.calculate_imperial_rent(alpha, periphery_wages, periphery_consciousness)[source]
Calculate Imperial Rent: Φ(Wp, Ψp) = α × Wp × (1 - Ψp).
Imperial Rent is the value extracted from the periphery that flows to the core, enabling the labor aristocracy.
- Parameters:
- Return type:
- Returns:
Imperial rent value (always >= 0)
Examples
>>> calculate_imperial_rent(0.5, 0.3, 0.2) 0.12 >>> calculate_imperial_rent(1.0, 0.5, 0.0) 0.5 >>> calculate_imperial_rent(0.0, 0.5, 0.5) 0.0 >>> calculate_imperial_rent(0.8, 0.6, 1.0) # Full consciousness = no extraction 0.0
- babylon.systems.calculate_labor_aristocracy_ratio(core_wages, value_produced)[source]
Calculate labor aristocracy ratio: Wc/Vc.
When this ratio > 1, the worker receives more than they produce, with the difference coming from Imperial Rent.
- Parameters:
- Return type:
- Returns:
Labor aristocracy ratio
- Raises:
ValueError – If value_produced is zero or negative
Examples
>>> calculate_labor_aristocracy_ratio(120.0, 100.0) # Labor aristocracy 1.2 >>> calculate_labor_aristocracy_ratio(80.0, 100.0) # Exploited worker 0.8 >>> calculate_labor_aristocracy_ratio(100.0, 100.0) # Fair exchange 1.0
- babylon.systems.is_labor_aristocracy(core_wages, value_produced)[source]
Determine if a worker is part of the labor aristocracy.
A worker is labor aristocracy when Wc/Vc > 1, meaning they receive more in wages than the value they produce.
- Parameters:
- Return type:
- Returns:
True if worker is labor aristocracy
- Raises:
ValueError – If value_produced is zero or negative
Examples
>>> is_labor_aristocracy(120.0, 100.0) True >>> is_labor_aristocracy(80.0, 100.0) False >>> is_labor_aristocracy(100.0, 100.0) # Exact equality = not aristocracy False
- babylon.systems.calculate_consciousness_drift(core_wages, value_produced, current_consciousness, sensitivity_k, decay_lambda, solidarity_pressure=0.0, wage_change=0.0)[source]
Calculate consciousness drift with Fascist Bifurcation mechanic.
Base formula: dΨc/dt = k(1 - Wc/Vc) - λΨc
Extended with Fascist Bifurcation (Sprint 3.4.2b): When wages are FALLING (wage_change < 0), crisis creates “agitation energy” that channels into either: - Revolution (if solidarity_pressure > 0) - negative drift - Fascism (if solidarity_pressure = 0) - positive drift via loss aversion
This encodes the historical insight: “Agitation without solidarity produces fascism, not revolution.” (Germany 1933 vs Russia 1917)
- Parameters:
core_wages (
float) – Wages received by core workervalue_produced (
float) – Value produced by core workercurrent_consciousness (
float) – Current consciousness level (0 to 1)sensitivity_k (
float) – Sensitivity coefficient for material conditionsdecay_lambda (
float) – Decay coefficient (consciousness fades without basis)solidarity_pressure (
float) – Sum of incoming SOLIDARITY edge strengths [0, 1+]wage_change (
float) – Change in wages since last tick (negative = falling)
- Return type:
- Returns:
Rate of change of consciousness (positive = revolutionary drift, negative = reactionary/fascist drift when wages fall without solidarity)
- Raises:
ValueError – If value_produced is zero or negative
- babylon.systems.calculate_acquiescence_probability(wealth, subsistence_threshold, steepness_k)[source]
Calculate P(S|A) = 1 / (1 + e^(-k(x - x_critical))).
Sigmoid function modeling survival through compliance. At the threshold, probability is 0.5 (coin flip).
- Parameters:
- Return type:
- Returns:
Probability of survival through acquiescence [0, 1]
Examples
>>> calculate_acquiescence_probability(100.0, 100.0, 0.1) # At threshold 0.5 >>> p = calculate_acquiescence_probability(150.0, 100.0, 0.1) # Above threshold >>> p > 0.99 True >>> p = calculate_acquiescence_probability(50.0, 100.0, 0.1) # Below threshold >>> p < 0.01 True
- babylon.systems.calculate_revolution_probability(cohesion, repression)[source]
Calculate P(S|R) = Cohesion / (Repression + ε).
Survival through collective action depends on organization outpacing state repression.
- Parameters:
- Return type:
- Returns:
Probability of survival through revolution [0, 1]
Examples
>>> calculate_revolution_probability(0.8, 0.2) # Strong org, weak state 1.0 >>> round(calculate_revolution_probability(0.2, 0.8), 2) # Weak org, strong state 0.25 >>> calculate_revolution_probability(0.0, 0.5) # No organization 0.0 >>> p = calculate_revolution_probability(0.5, 0.5) # Balanced >>> p > 0.99 True
- babylon.systems.calculate_crossover_threshold(cohesion, repression, subsistence_threshold, steepness_k)[source]
Find wealth level where P(S|R) = P(S|A) (revolution becomes rational).
This is the critical point where collective action becomes a rational survival strategy.
- babylon.systems.apply_loss_aversion(value)[source]
Apply Kahneman-Tversky loss aversion (λ = 2.25).
Losses are perceived as 2.25x more impactful than equivalent gains. This affects decision-making under risk.
- Parameters:
value (
float) – Raw value change (negative = loss, positive = gain)- Return type:
- Returns:
Perceived value after loss aversion
Examples
>>> apply_loss_aversion(100.0) # Gains unchanged 100.0 >>> apply_loss_aversion(-100.0) # Losses amplified -225.0 >>> apply_loss_aversion(0.0) # Zero unchanged 0.0
- babylon.systems.calculate_exchange_ratio(periphery_labor_hours, core_labor_hours, core_wage, periphery_wage)[source]
Calculate exchange ratio: ε = (Lp/Lc) × (Wc/Wp).
The exchange ratio quantifies unequal exchange. When ε > 1, the periphery gives more value than it receives.
- Parameters:
- Return type:
- Returns:
Exchange ratio
- Raises:
ValueError – If any denominator value is zero or negative
Examples
>>> calculate_exchange_ratio(100.0, 100.0, 20.0, 5.0) # Equal labor, 4x wage gap 4.0 >>> calculate_exchange_ratio(200.0, 100.0, 20.0, 10.0) # 2x labor, 2x wage 4.0 >>> calculate_exchange_ratio(100.0, 100.0, 10.0, 10.0) # Fair exchange 1.0
- babylon.systems.calculate_exploitation_rate(exchange_ratio)[source]
Convert exchange ratio to exploitation rate percentage.
ε = 2 means 100% exploitation (double value extracted). ε = 1 means 0% exploitation (fair exchange).
- babylon.systems.calculate_value_transfer(production_value, exchange_ratio)[source]
Calculate value transferred from periphery to core.
Value transfer = production × (1 - 1/ε)
- babylon.systems.prebisch_singer_effect(initial_price, production_increase, elasticity)[source]
Calculate Prebisch-Singer effect on commodity prices.
Terms of trade decline for commodity exporters: More production → lower prices → same poverty.
Modules
Mathematical formulas for the Babylon simulation. |