omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / core / hive-not-swarm / main.om
| 1 | note core/hive-not-swarm/main.om: deterministic Hive-vs-Swarm experiment comparison CLI. |
| 2 | note Compose: si/directives/om2.om core/hive-not-swarm/lib.om core/hive-not-swarm/main.om |
| 3 | |
| 4 | text tm_banner "=== HIVE, NOT SWARM: EXACT CONCURRENCY MODEL ===\n" |
| 5 | text tm_grid_h "\n[Base Model Grid n=1..16]\n" |
| 6 | text tm_sc_h "\n[Upstream Reference Scenarios]\n" |
| 7 | text tm_inv_h "\n[Algebraic Invariants]\n" |
| 8 | text tm_inv_ok "discrete_difference=PASS (15/15) convexity=PASS (14/14)\n" |
| 9 | text tm_inv_fail "invariants=FAIL\n" |
| 10 | text tm_s_base "base" |
| 11 | text tm_s_h10 "H10" |
| 12 | text tm_s_p002 "p002" |
| 13 | text tm_s_p4 "P4" |
| 14 | text tm_s_c06 "c06" |
| 15 | text tm_s_a30 "A30" |
| 16 | text tm_s_a240 "A240H10" |
| 17 | |
| 18 | fn main to int |
| 19 | hns_ob_reset |
| 20 | hns_ob_str tm_banner |
| 21 | hns_ob_str tm_grid_h |
| 22 | hns_ob_flush |
| 23 | |
| 24 | m = new HiveModel 0 1 0 1 0 1 0 1 0 1 0 1 |
| 25 | lim = new HiveLimits 0 1 0 1 0 1 1 |
| 26 | hive_base_params edit m edit lim |
| 27 | hive_print_grid view m view lim |
| 28 | |
| 29 | hns_ob_reset |
| 30 | hns_ob_str tm_sc_h |
| 31 | hns_ob_flush |
| 32 | hive_print_scenario tm_s_base view m view lim |
| 33 | |
| 34 | hive_base_params edit m edit lim |
| 35 | put lim hnum 10 |
| 36 | put lim hden 1 |
| 37 | hive_print_scenario tm_s_h10 view m view lim |
| 38 | |
| 39 | hive_base_params edit m edit lim |
| 40 | put lim pnum 1 |
| 41 | put lim pden 50 |
| 42 | hive_print_scenario tm_s_p002 view m view lim |
| 43 | |
| 44 | hive_base_params edit m edit lim |
| 45 | put lim maxp 4 |
| 46 | hive_print_scenario tm_s_p4 view m view lim |
| 47 | |
| 48 | hive_base_params edit m edit lim |
| 49 | put m cnum 3 |
| 50 | put m cden 5 |
| 51 | hive_print_scenario tm_s_c06 view m view lim |
| 52 | |
| 53 | hive_base_params edit m edit lim |
| 54 | put m anum 30 |
| 55 | put m aden 1 |
| 56 | hive_print_scenario tm_s_a30 view m view lim |
| 57 | |
| 58 | hive_base_params edit m edit lim |
| 59 | put m anum 240 |
| 60 | put m aden 1 |
| 61 | put lim hnum 10 |
| 62 | put lim hden 1 |
| 63 | hive_print_scenario tm_s_a240 view m view lim |
| 64 | |
| 65 | hive_base_params edit m edit lim |
| 66 | inv_ok = true |
| 67 | for i ulong 15 |
| 68 | if not hive_discrete_diff_ok view m view lim add i 1 |
| 69 | inv_ok = false |
| 70 | end |
| 71 | end |
| 72 | for j ulong 14 |
| 73 | if not hive_convexity_ok view m view lim add j 1 |
| 74 | inv_ok = false |
| 75 | end |
| 76 | end |
| 77 | hns_ob_reset |
| 78 | hns_ob_str tm_inv_h |
| 79 | if inv_ok |
| 80 | hns_ob_str tm_inv_ok |
| 81 | hns_ob_flush |
| 82 | ret 0 |
| 83 | end |
| 84 | hns_ob_str tm_inv_fail |
| 85 | hns_ob_flush |
| 86 | ret 1 |
| 87 | end |