nx_commons_price_gate.nx source
↩ module page · 108 lines · 5465 B
1// nx_commons_price_gate.nx -- proves the commensuration rule, and proves that the CHOICE of base unit
2// is what does the work rather than asserting it.
3//
4// T1 is the tooth the whole programme rests on: for one hour of work each, a janitor and an investment
5// banker must price IDENTICALLY. It is bite-proven against the market-rate pricer kept in the library
6// as a negative control -- the market rule must FIRE (price them apart) and the time rule must be
7// SILENT (price them equal). If the market rule ever agreed, the fixture would be too weak to detect
8// the thing this design exists to prevent.
9// license_tier: ORIGINAL expect_exit: 0
10import "nx_gate_verdict.nx"
11import "nx_commons_price.nx"
12
13const PG_HOUR: i64 = 3600
14const PG_BASE: i64 = 1000 // declared base multiplier: an ordinary hour
15const PG_HAZARD: i64 = 2500 // declared: boiler repair, 2am, in the rain
16const PG_GREEDY: i64 = 8000 // a commons tries to declare 8x for a prestige skill
17const PG_DEMEAN: i64 = 200 // ...and 0.2x for "unskilled" labour
18const PG_JANITOR_CENTS: i64 = 2500 // market: $25/hr
19const PG_BANKER_CENTS: i64 = 120000 // market: $1200/hr
20const PG_GPU_SECONDS: i64 = 7200
21const PG_GPU_RATE: i64 = 500 // declared: 0.5 commons-units per GPU-second
22
23func main() -> i64 {
24 let ctr: *i64 = gv_ctr()
25 gv_head("nx_commons_price_gate -- can an hour of shovelling be compared to a borrowed GPU?" as *u8)
26
27 // ---- the two hours ----
28 let t_jan: i64 = cp_price_time(PG_HOUR, PG_BASE)
29 let t_bank: i64 = cp_price_time(PG_HOUR, PG_BASE)
30 let m_jan: i64 = cp_market_price(PG_HOUR, PG_JANITOR_CENTS)
31 let m_bank: i64 = cp_market_price(PG_HOUR, PG_BANKER_CENTS)
32
33 gv_puts(" one hour each TIME-BASE janitor=" as *u8); gv_num(t_jan)
34 gv_puts(" banker=" as *u8); gv_num(t_bank)
35 gv_puts(" MARKET janitor=" as *u8); gv_num(m_jan); gv_puts(" banker=" as *u8); gv_num(m_bank); gv_puts("\n" as *u8)
36
37 // ---- bounded band ----
38 let c_greedy: i64 = cp_clamp_mult(PG_GREEDY)
39 let c_demean: i64 = cp_clamp_mult(PG_DEMEAN)
40 let hazard: i64 = cp_price_time(PG_HOUR, PG_HAZARD)
41 gv_puts(" declared 8.0x -> " as *u8); gv_num(c_greedy)
42 gv_puts(" declared 0.2x -> " as *u8); gv_num(c_demean)
43 gv_puts(" hazard hour = " as *u8); gv_num(hazard)
44 gv_puts(" spread cap = " as *u8); gv_num(cp_spread_permil()); gv_puts(" permil\n" as *u8)
45
46 // ---- mixed contribution: 1 hour + 7200 GPU-seconds, and one undeclared kind ----
47 let parts_ok: *i64 = sys_mmap(2 * 8) as *i64
48 parts_ok[0] = cp_price_time(PG_HOUR, PG_BASE)
49 parts_ok[1] = cp_price_kind(PG_GPU_SECONDS, PG_GPU_RATE)
50 let total_ok: i64 = cp_total(parts_ok, 2)
51
52 let parts_gap: *i64 = sys_mmap(3 * 8) as *i64
53 parts_gap[0] = cp_price_time(PG_HOUR, PG_BASE)
54 parts_gap[1] = cp_price_kind(PG_GPU_SECONDS, PG_GPU_RATE)
55 parts_gap[2] = cp_price_kind(500, CP_UNPRICED) // a kind the commons never declared
56 let total_gap: i64 = cp_total(parts_gap, 3)
57
58 gv_puts(" mixed fully-declared total = " as *u8); gv_num(total_ok)
59 gv_puts(" with one undeclared kind = " as *u8); gv_num(total_gap)
60 gv_puts(" (" as *u8); gv_num(CP_UNPRICED); gv_puts(" = UNPRICED)\n\n" as *u8)
61
62 // ---- T1: THE TOOTH ----
63 var mkt_splits: i64 = 0
64 if m_jan != m_bank { mkt_splits = 1 }
65 var time_splits: i64 = 0
66 if t_jan != t_bank { time_splits = 1 }
67 gv_bite("T1 equal hours price EQUAL: market rule splits them (fires), time base does not" as *u8,
68 mkt_splits, time_splits, ctr)
69
70 // ---- T2: no hour may be devalued, ever ----
71 var t2: i64 = 0
72 if c_demean == CP_MULT_FLOOR_PERMIL { t2 = 1 }
73 gv_check("T2 a declared 0.2x is refused upward to 1.0x -- NOBODY'S HOUR IS WORTH LESS THAN AN HOUR" as *u8, t2, ctr)
74
75 // ---- T3: nor may any hour run away ----
76 var t3: i64 = 0
77 if c_greedy == CP_MULT_CAP_PERMIL { t3 = 1 }
78 gv_check("T3 a declared 8.0x is clamped to the 3.0x cap -- the spread is BOUNDED BY CONSTRUCTION" as *u8, t3, ctr)
79
80 // ---- T4: NEG-CONTROL -- scarcity/hazard must still get a real signal, or the boiler stays broken ----
81 var t4: i64 = 0
82 if hazard > t_jan { if hazard <= (t_jan * 3) { t4 = 1 } }
83 gv_check("T4 NEG-CONTROL hazardous work IS rewarded above an ordinary hour, within the band" as *u8, t4, ctr)
84
85 // ---- T5: the third state ----
86 var t5: i64 = 0
87 if total_gap == CP_UNPRICED { t5 = 1 }
88 gv_check("T5 a total containing an undeclared kind is UNPRICED, never a partial sum" as *u8, t5, ctr)
89
90 // ---- T6: NEG-CONTROL -- a rule that prices nothing is a wall, not a rule ----
91 var t6: i64 = 0
92 if cp_is_priced(total_ok) == 1 { if total_ok > 0 { t6 = 1 } }
93 gv_check("T6 NEG-CONTROL a fully-declared mixed contribution DOES price (not a wall)" as *u8, t6, ctr)
94
95 // ---- T7: the market spread, measured, so the magnitude is on the record ----
96 var ratio: i64 = 0
97 if m_jan > 0 { ratio = m_bank / m_jan }
98 gv_puts(" measured market spread = " as *u8); gv_num(ratio)
99 gv_puts(":1 commons spread cap = 3:1\n" as *u8)
100 var t7: i64 = 0
101 if ratio > 3 { t7 = 1 }
102 gv_check("T7 the market spread EXCEEDS what this commons can represent (so the bound bites)" as *u8, t7, ctr)
103
104 let rc: i64 = gv_verdict("COMMONS-PRICE" as *u8, ctr,
105 "time is the base unit, the spread is bounded at 3:1, and undeclared kinds refuse to price" as *u8)
106 sys_exit(rc)
107 return rc
108}