nx_caplab_compete.nx
buildroot/runtime/nx_caplab_compete.nx
about
nx_caplab_compete.nx -- Capitalism Lab R1: multi-firm price competition.
Builds on the R0 atom (nx_caplab_market): instead of one firm, N firms
set prices into ONE market. A single market willingness-to-pay (choke
price A) bounds demand; each firm's "appeal" is how far it undercuts the
choke; the market's customers split among firms in proportion to appeal
(cheaper -> bigger share). Allocation uses largest-remainder so the
split is CONSERVED: sum of firm quantities == total market customers
(no customers vanish or get invented), unless every firm is priced out.
MODEL:
appeal_i = max(0, A - price_i) (0 if priced >= choke)
share_i = market_M * appeal_i / sum(appeal) (largest-remainder)
profit_i = (price_i - unit_cost_i) * share_i
This is the heart of "capitalism": a lower price wins more of the market,
but margin x volume decides who actually earns the most.
nx_safety_envelope:
intended_use: capitalism-lab competition core (pure functions, no I/O)
sil_target: SIL1
verdict: NOT_YET_EVALUATED
genealogy_id: capitalism_lab_competition_canon
lineage_id: nx_caplab_compete_v1
dependencies 2 imports · 3 importers
imports: nx_syscalls.nxnx_tier.nx
imported by: nx_caplab_compete_test.nxnx_caplab_sim.nxnx_econsim_page.nx
structs
| none |
consts
| none |
functions
| 31 | func nx_clab_appeal(choke_a: nx_int, price: nx_int) -> nx_int |
| 37 | func nx_clab_appeal_sum(n: nx_int, prices: *i64, choke_a: nx_int) -> nx_int |
| 51 | func nx_clab_split(n: nx_int, prices: *i64, choke_a: nx_int, |
| 96 | func nx_clab_firm_profit(price: nx_int, unit_cost: nx_int, qty: nx_int) -> nx_int |