Commit dd5064f
Substrate-routed O(log_phi_pi_fibonacci N) primitives + README rewrite
Adds a complete O(log_phi_pi_fibonacci N) algorithm family to OMC's
native runtime, plus Zeckendorf encoding as a first-class integer format.
50+ new builtins exposing the F(k)/phi^(pi*k) substrate search algorithm
that already lived in phi_pi_fib::phi_pi_fib_search_v2.
Substrate primitives (interpreter + phi_pi_fib.rs):
- zeckendorf / from_zeckendorf / zeckendorf_weight / zeckendorf_bit
- substrate_search / substrate_lower_bound / substrate_upper_bound
- substrate_rank / substrate_count_range / substrate_slice_range
- substrate_intersect / substrate_difference / substrate_insert
- substrate_quantile / substrate_select_k / substrate_nearest
- substrate_min_distance / substrate_hash / attractor_bucket
- harmonic_align / harmonic_unalign / harmonic_score / harmonic_resample
- phi_pow / phi_pi_pow / phi_pi_log_distance
- resonance_band_histogram / is_phi_resonant / is_zeckendorf_valid
- nth_fibonacci / attractor_table / fib_chunks
Native baselines for apples-to-apples comparison:
- int_binary_search / int_lower_bound / int_upper_bound
- sorted_merge / sorted_union / sorted_dedupe
- arr_sum_int / arr_product / arr_sort_int / arr_is_sorted
- arr_min_int / arr_max_int / arr_avg_distance / arr_argmax / arr_argmin
- arr_cumsum / arr_diff / arr_range / arr_unique_count / arr_partition_by
- arr_min_float / arr_max_float / arr_gcd / fnv1a_hash
- Earlier session: 22 math/array/stats/substrate builtins (kept)
Dict/string helpers also added (carried from prior batch):
- dict_pop / dict_get_or / dict_size / dict_clear / dict_items
- str_split_lines / str_count / str_is_empty / str_to_int / str_to_float
- str_capitalize / mod_pow / bit_count / bit_length / digit_sum / digit_count
Compiler:
- Type tags for int / float returns so JIT lowering stays correct
- Suppressed warnings (gate_map, unused new(), import_module marker)
Tests:
- examples/tests/test_substrate_primitives.omc — 57 tests covering
every new primitive, including round-trip invariants for Zeckendorf,
cross-consistency (substrate_search == int_binary_search), boundary
cases, and monotonicity. All pass.
- examples/tests/test_new_builtins.omc — extended to 70 tests.
Benchmark:
- experiments/substrate_primitives/bench_substrate_search.omc — 4-way
comparison: linear vs OMC binary vs substrate vs int_binary at
N=1024 / 8192 / 65536. Shows substrate uses 7.3 vs binary's 16
probes at N=65536 (0.459x ratio matches log_phi_pi_fibonacci bound)
but pays more per probe.
High-level wrapper library:
- examples/lib/substrate.omc — s_*/i_*/h_* naming for the three
styles (substrate-routed / int-binary / harmonic-aligned).
README:
- Comprehensive rewrite emphasizing what makes OMC unique vs other
languages: substrate-as-primitive, dual-band execution,
O(log_phi_pi_fibonacci N) algorithms, Zeckendorf encoding,
CRT-PE winning on TinyShakespeare, self-healing compiler,
two-engine byte-identical parity, JIT pragmas.
- Added omnimcode-gdextension (Godot 4 binding) to repo layout.
Gitignore:
- Exclude omnimcode-gdextension/bin/ (built artifact).
Build: clean. Tests: 145 OMC tests + 41 codegen tests + cargo
unit tests all green.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent e831ec4 commit dd5064f
19 files changed
Lines changed: 43712 additions & 180 deletions
File tree
- examples
- lib
- tests
- experiments
- substrate_primitives
- transformerless_lm
- omnimcode-core/src
- omnimcode-gdextension
- include
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
0 commit comments