nx_em_experiment.nx source
↩ module page · 176 lines · 7318 B
1// nx_em_experiment.nx -- substrate primitive that turns Tesla-class
2// claims into bits-up, repeatable, falsifiable Nishi experiments.
3//
4// Doctrinal stance: we do NOT take secondhand "mainstream physics
5// says no" or "Wardenclyffe never demonstrated it" as the verdict.
6// The substrate is the apparatus. Every claim is held as TBD until
7// our own measurements -- driven by nxc2-compiled .nx code with no
8// external dependency -- produce a sealed verdict.
9//
10// Each experiment is a record:
11// - claim_id (sealed enum, declared below)
12// - hypothesis_text (caller-provided pointer, audit-only)
13// - rig_id (sealed enum: which apparatus rig)
14// - protocol_seed (rng seed for reproducibility)
15// - measured_q10 (scalar result; Q10 fixed-point so MCUs work)
16// - threshold_q10 (verdict threshold, Q10)
17// - verdict (sealed enum below)
18//
19// Genealogy: this primitive composes nx_perf_verdict (sealed verdict
20// pattern) + nx_self_audit (introspection) + the cardinal
21// feedback-honest-perf-verdict-no-aspirational-claims. Every Tesla
22// claim becomes a row in our self-audit; the operator can read which
23// rig reached which verdict on which date, and what the next
24// improvement is.
25//
26// genealogy_id: feedback-honest-perf-verdict-no-aspirational-claims +
27// nx_perf_verdict + nx_self_audit + tesla_wardenclyffe_1901 +
28// schumann_1952_cavity_resonance + zenneck_1907_surface_wave
29// lineage_id: nishi_em_experiment_sealed_q10
30
31// nx_safety_envelope:
32// intended_use: AUTO_APPLIED -- primitive-specific tuning queued
33// sil_target: SIL1
34// evidence: [bulk_applied_2026-05-16, see-file-comment-for-detail]
35// verdict: NOT_YET_EVALUATED
36
37import "nx_syscalls_x86_64.nx"
38
39// Sealed enum of claims we are PROACTIVELY testing. Add rows as new
40// rigs come online -- never remove a row (history is sacred per
41// cardinal additive-only-data).
42const NX_EM_CLAIM_UNKNOWN: i64 = 0
43const NX_EM_CLAIM_SCHUMANN_DATA_BANDWIDTH: i64 = 1
44const NX_EM_CLAIM_SCHUMANN_VIDEO_BANDWIDTH: i64 = 2
45const NX_EM_CLAIM_LONGITUDINAL_WAVE_COUPLING: i64 = 3
46const NX_EM_CLAIM_SCALAR_FIELD_NONLOCAL: i64 = 4
47const NX_EM_CLAIM_EARTH_CURRENT_RETURN_EFFICIENCY: i64 = 5
48const NX_EM_CLAIM_GROUND_WAVE_RANGE_VS_FREQ: i64 = 6
49const NX_EM_CLAIM_NVIS_REGIONAL_COVERAGE: i64 = 7
50const NX_EM_CLAIM_RESONANT_WIRELESS_POWER_DISTANCE: i64 = 8
51const NX_EM_CLAIM_NEAR_FIELD_COUPLING_DROP_OFF: i64 = 9
52const NX_EM_CLAIM_METEOR_BURST_DATA_RATE: i64 = 10
53const NX_EM_CLAIM_FREE_SPACE_OPTICAL_NEIGHBOURHOOD: i64 = 11
54const NX_EM_CLAIM_POWERLINE_CARRIER_INTRA_HOME: i64 = 12
55const NX_EM_CLAIM_N: i64 = 13
56
57// Sealed rig ids -- what apparatus we ran the experiment on.
58const NX_EM_RIG_UNKNOWN: i64 = 0
59const NX_EM_RIG_SIMULATION_ONLY: i64 = 1 // pure NishiLang model; no RF
60const NX_EM_RIG_SDR_RTLSDR_RX: i64 = 2 // receive-only via RTL-SDR
61const NX_EM_RIG_SDR_HACKRF_DUPLEX: i64 = 3 // tx+rx via HackRF
62const NX_EM_RIG_LOOP_ANTENNA: i64 = 4
63const NX_EM_RIG_GROUND_DIPOLE: i64 = 5
64const NX_EM_RIG_RESONANT_COIL_PAIR: i64 = 6
65const NX_EM_RIG_FREE_SPACE_LASER: i64 = 7
66const NX_EM_RIG_POWERLINE_MODEM: i64 = 8
67const NX_EM_RIG_N: i64 = 9
68
69// Sealed verdict. This is the doctrinal core.
70const NX_EM_VERDICT_UNKNOWN: i64 = 0
71const NX_EM_VERDICT_REPRODUCED: i64 = 1 // measured >= threshold under our rig
72const NX_EM_VERDICT_NOT_REPRODUCED_HERE: i64 = 2 // measured < threshold; named improvement required
73const NX_EM_VERDICT_INCONCLUSIVE: i64 = 3 // SNR / sample count too low
74const NX_EM_VERDICT_NEEDS_HARDWARE: i64 = 4 // apparatus not yet built
75const NX_EM_VERDICT_PROTOCOL_ERROR: i64 = 5 // rig misconfigured
76const NX_EM_VERDICT_N: i64 = 6
77
78// Experiment record. Caller fills the upper fields; nx_em_grade fills
79// the verdict field based on measured_q10 vs threshold_q10.
80struct EmExperiment {
81 claim_id: i64,
82 rig_id: i64,
83 protocol_seed: i64,
84 measured_q10: i64,
85 threshold_q10: i64,
86 sample_count: i64, // > 0; how many measurements averaged
87 samples_required: i64, // minimum for INCONCLUSIVE escape
88 verdict: i64,
89 improvement_note_off: i64, // caller-supplied note buffer offset (audit)
90 improvement_note_len: i64,
91 note_buf: *u8 // pointer to the audit note buffer
92}
93
94// Q10 unity. Used by callers and gates.
95const NX_EM_Q10_ONE: i64 = 1024
96
97// Initialise a record. Caller can override any field before grading.
98func nx_em_init(e: *EmExperiment, claim_id: i64, rig_id: i64,
99 threshold_q10: i64, samples_required: i64,
100 note_buf: *u8) -> i64 {
101 e.claim_id = claim_id
102 e.rig_id = rig_id
103 e.protocol_seed = 0
104 e.measured_q10 = 0
105 e.threshold_q10 = threshold_q10
106 e.sample_count = 0
107 e.samples_required = samples_required
108 e.verdict = NX_EM_VERDICT_UNKNOWN
109 e.improvement_note_off = 0
110 e.improvement_note_len = 0
111 e.note_buf = note_buf
112 return 0
113}
114
115// Grade the experiment. Honest rules:
116// - rig == NEEDS_HARDWARE absent rig hardware -> NEEDS_HARDWARE
117// - sample_count < samples_required -> INCONCLUSIVE
118// - measured >= threshold -> REPRODUCED
119// - measured < threshold -> NOT_REPRODUCED_HERE
120//
121// Per cardinal feedback-honest-perf-verdict, NOT_REPRODUCED_HERE
122// MUST be accompanied by a named improvement. The caller writes it
123// into the note buffer before calling nx_em_grade. A LOSE row with
124// improvement_note_len == 0 collapses to PROTOCOL_ERROR.
125func nx_em_grade(e: *EmExperiment) -> i64 {
126 if e.rig_id == NX_EM_RIG_UNKNOWN { e.verdict = NX_EM_VERDICT_NEEDS_HARDWARE; return e.verdict }
127 if e.claim_id < 1 { e.verdict = NX_EM_VERDICT_PROTOCOL_ERROR; return e.verdict }
128 if e.claim_id >= NX_EM_CLAIM_N { e.verdict = NX_EM_VERDICT_PROTOCOL_ERROR; return e.verdict }
129 if e.sample_count < e.samples_required {
130 e.verdict = NX_EM_VERDICT_INCONCLUSIVE
131 return e.verdict
132 }
133 if e.measured_q10 >= e.threshold_q10 {
134 e.verdict = NX_EM_VERDICT_REPRODUCED
135 return e.verdict
136 }
137 // LOSE -- must have a named improvement to escape PROTOCOL_ERROR.
138 if e.improvement_note_len == 0 {
139 e.verdict = NX_EM_VERDICT_PROTOCOL_ERROR
140 return e.verdict
141 }
142 e.verdict = NX_EM_VERDICT_NOT_REPRODUCED_HERE
143 return e.verdict
144}
145
146// Write a UTF-8 byte sequence into the note buffer. Returns new
147// length written (so callers can chain). Trims at note_buf_cap.
148func nx_em_note(e: *EmExperiment, src: *u8, src_len: i64, note_buf_cap: i64) -> i64 {
149 var off: i64 = e.improvement_note_len
150 var i: i64 = 0
151 while i < src_len {
152 if off >= note_buf_cap { return off }
153 e.note_buf[off] = src[i]
154 off = off + 1
155 i = i + 1
156 }
157 e.improvement_note_len = off
158 return off
159}
160
161// Sealed-enum validity gates.
162func nx_em_claim_is_valid(c: i64) -> i64 {
163 if c < 0 { return 0 }
164 if c >= NX_EM_CLAIM_N { return 0 }
165 return 1
166}
167func nx_em_rig_is_valid(r: i64) -> i64 {
168 if r < 0 { return 0 }
169 if r >= NX_EM_RIG_N { return 0 }
170 return 1
171}
172func nx_em_verdict_is_valid(v: i64) -> i64 {
173 if v < 0 { return 0 }
174 if v >= NX_EM_VERDICT_N { return 0 }
175 return 1
176}