code wiki / (root) / nx_caplab_market_test.nx

nx_caplab_market_test.nx

buildroot/runtime/nx_caplab_market_test.nx

3843 B83 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind gate/prooftopic caplab
docsdependenciesstructsconstsfunctions

about

nx_caplab_market_test.nx -- gate for Capitalism Lab R0 (the market atom). Proves, bit-exact: (1) the linear demand curve, (2) revenue/profit, (3) NEG-CONTROL that pricing below cost loses money, (4) NEG-CONTROL that no units sell past the choke price, (5) the optimal-pricing solver finds the TRUE monopoly peak (matches the closed form AND is a strict local max, not an endpoint artifact). Market under test: a=100 (max demand), b=2 (slope), unit_cost=10. Closed-form monopoly price p* = (a + b*c)/(2b) = 120/4 = 30, profit 800.

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_runtime.nx nx_tier.nx nx_caplab_market.nx nx_caplab_market_test.nx

imports: nx_syscalls.nxnx_runtime.nxnx_tier.nxnx_caplab_market.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap println sys_write strlen sys_mmap ↻ nx_assert_eq print sys_write ↻ strlen ↻ print_i64 sys_mmap ↻ itoa sys_mmap ↻ sys_write ↻ println ↻ nx_clab_demand nx_clab_revenue nx_clab_demand ↻ nx_clab_profit nx_clab_demand ↻ nx_clab_optimal_price nx_clab_profit ↻ nx_clab_demand ↻ nx_assert_gt print ↻ print_i64 ↻ println ↻ print ↻ print_i64 ↻

structs

none

consts

none

functions

17func nx_assert_eq(label: *u8, got: nx_int, want: nx_int, pass_n: *nx_int, fail_n: *nx_int)
called by 1: main calls 3: printprint_i64println
29func nx_assert_gt(label: *u8, got: nx_int, floor: nx_int, pass_n: *nx_int, fail_n: *nx_int)
called by 1: main calls 3: printprint_i64println
40func main() -> nx_exit