code wiki / _hdl_build / nx_connect_lds_free.nx
nx_connect_lds_free.nx source
↩ module page · 96 lines · 5382 B
1// nx_connect_lds_free.nx -- CONNECT / LDS vertical: FREE-FOREVER enforced as a WALL, not a slogan.
2// The operator's core promise: LDS members from youth to adults connect "without cost". This makes it
3// an invariant the platform CANNOT violate: every CONNECTION feature's price MUST be 0. Prices live in
4// a data table (no magic numbers); the checker counts any connection feature carrying a nonzero price.
5//
6// The ONLY paid slot allowed is a business buying a "brought to you by" local-business ad -- that is a
7// BUSINESS paying, is NOT a connection feature (is_connection=0), and is never shown to minors anyway.
8// NEG-CONTROL: a would-be paywalled connection feature (e.g. Tandem-style rationed translation behind
9// Pro) is FLAGGED by the checker, proving the invariant is load-bearing, not vacuous.
10// 100% sovereign. license_tier: ORIGINAL expect_exit: 0
11import "nx_syscalls.nx"
12
13const N: i64 = 8
14
15func sw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
16func sn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1} sys_write(1,bb,k); return 0 }
17
18// count connection features (is_connection==1) carrying a nonzero price -- MUST be 0 for free-forever.
19func count_paywalled_connection(prices: *i64, isconn: *i64, n: i64) -> i64 {
20 var c: i64=0; var i: i64=0
21 while i<n {
22 if isconn[i]==1 { if prices[i]>0 { c=c+1 } }
23 i=i+1
24 }
25 return c
26}
27
28// count features that are connection features at all (anti-vacuous: the table must actually cover them)
29func count_connection(isconn: *i64, n: i64) -> i64 {
30 var c: i64=0; var i: i64=0
31 while i<n { if isconn[i]==1 { c=c+1 } i=i+1 }
32 return c
33}
34
35func tcheck(pass: i64, label: *u8, fails: *i64) -> i64 {
36 sw(" " as *u8); sw(label); sw(": " as *u8)
37 if pass==1 { sw("PASS\n" as *u8) } else { sw("FAIL\n" as *u8); fails[0]=fails[0]+1 }
38 return 0
39}
40
41func main() -> i64 {
42 let fails: *i64 = sys_mmap(16) as *i64
43 fails[0]=0
44
45 // feature table (data-driven). idx: 0 messaging 1 reconnection 2 discovery 3 groups
46 // 4 calls 5 translation 6 youth-game/hangout-rooms 7 brought-to-you-by ad slot
47 let prices: *i64 = sys_mmap(64) as *i64 // price in cents
48 let isconn: *i64 = sys_mmap(64) as *i64 // 1 = a connection feature (must be free)
49 prices[0]=0; prices[1]=0; prices[2]=0; prices[3]=0; prices[4]=0; prices[5]=0; prices[6]=0; prices[7]=500
50 isconn[0]=1; isconn[1]=1; isconn[2]=1; isconn[3]=1; isconn[4]=1; isconn[5]=1; isconn[6]=1; isconn[7]=0
51
52 let viol: i64 = count_paywalled_connection(prices, isconn, N)
53 let nconn: i64 = count_connection(isconn, N)
54 let transl_price: i64 = prices[5] // translation: Tandem rations/paywalls; we don't
55
56 // NEG-CONTROL table: paywall the translation feature (Tandem-style Pro) -> the checker MUST flag it
57 let neg_prices: *i64 = sys_mmap(64) as *i64
58 let neg_isconn: *i64 = sys_mmap(64) as *i64
59 var j: i64=0
60 while j<N { neg_prices[j]=prices[j]; neg_isconn[j]=isconn[j]; j=j+1 }
61 neg_prices[5]=499 // someone tries to paywall translation
62 let neg_viol: i64 = count_paywalled_connection(neg_prices, neg_isconn, N)
63
64 sw("=== nx_connect_lds_free -- free-forever enforced as a wall (no connection feature is paid) ===\n" as *u8)
65 sw(" connection features in table = " as *u8); sn(nconn); sw("\n" as *u8)
66 sw(" paywalled connection features = " as *u8); sn(viol); sw(" (MUST be 0)\n" as *u8)
67 sw(" translation price (cents) = " as *u8); sn(transl_price); sw(" (Tandem rations 3-5/day free; we don't)\n" as *u8)
68 sw(" NEG table (translation paywalled) flagged = " as *u8); sn(neg_viol); sw("\n" as *u8)
69 sw("-- gate checks --\n" as *u8)
70
71 // T1: the real table has ZERO paywalled connection features -> free forever holds
72 var t1: i64=0; if viol==0 { t1=1 }
73 tcheck(t1, "T1 free forever: 0 connection features paywalled" as *u8, fails)
74
75 // T2: anti-vacuous -- the table actually covers connection features (not an empty win)
76 var t2: i64=0; if nconn>=6 { t2=1 }
77 tcheck(t2, "T2 anti-vacuous: table covers the real connection features (>=6)" as *u8, fails)
78
79 // T3: translation specifically is free (the axis Tandem rations)
80 var t3: i64=0; if transl_price==0 { t3=1 }
81 tcheck(t3, "T3 translation is free (Tandem rations it; we don't)" as *u8, fails)
82
83 // T4: the only paid slot is a business ad, and it is NOT a connection feature
84 var t4: i64=0; if isconn[7]==0 { if prices[7]>0 { t4=1 } }
85 tcheck(t4, "T4 the one paid slot (brought-to-you-by ad) is a business, not a connection feature" as *u8, fails)
86
87 // T5: NEG-CONTROL -- a paywalled connection feature is FLAGGED (the invariant is load-bearing)
88 var t5: i64=0; if neg_viol>=1 { if viol==0 { t5=1 } }
89 tcheck(t5, "T5 NEG-CONTROL paywalled connection feature is caught (check not vacuous)" as *u8, fails)
90
91 sw(" fails=" as *u8); sn(fails[0]); sw("\n" as *u8)
92 if fails[0]==0 { sw("VERDICT: GREEN (every connection feature is free by construction; only businesses pay; the wall catches paywalls)\n" as *u8); sys_exit(0) }
93 sw("VERDICT: RED\n" as *u8)
94 sys_exit(1)
95 return 1
96}