interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / src / omega_synthesis.h

96 lines · 3147 bytes Raw Blame History
1/* SPDX-License-Identifier: Apache-2.0
2 * Copyright 2026 Drake Stapleton (AIEN / aien-dev)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef OMEGA_SYNTHESIS_H
18#define OMEGA_SYNTHESIS_H
19
20#include "omega_program.h"
21#include <stdbool.h>
22#include <stddef.h>
23
24#define SYNTH_MAX_PRIMITIVES 32
25#define SYNTH_MAX_CANDIDATES 512
26#define SYNTH_MAX_SIGNATURES 1024
27#define SYNTH_PROBE_COUNT 6
28
29typedef struct {
30 size_t candidates_generated;
31 size_t candidates_pruned_type;
32 size_t candidates_pruned_equiv;
33 size_t candidates_failed_v1;
34 size_t solutions_found;
35} SynthesisStats;
36
37typedef struct {
38 uint32_t max_depth; /* Max composition depth (1, 2, or 3) */
39 uint32_t max_cost; /* Maximum instruction count budget */
40 size_t max_candidates; /* Global candidate cutoff */
41 bool deduplicate_equiv; /* Enable observational equivalence pruning */
42} SynthesisConfig;
43
44typedef struct {
45 bool solved;
46 OmegaProgram solution;
47 VerifyReport verify_report;
48 SynthesisStats stats;
49} SynthesisResult;
50
51typedef struct {
52 OmegaProgram programs[SYNTH_MAX_PRIMITIVES];
53 size_t count;
54} SynthPrimitiveBank;
55
56typedef struct {
57 uint8_t hash[32];
58 uint32_t cost;
59} EquivSignature;
60
61typedef struct {
62 EquivSignature entries[SYNTH_MAX_SIGNATURES];
63 size_t count;
64} EquivTable;
65
66/* The default primitive vocabulary as (name, op, imm) rows. omega_synth_bank_init
67 * builds its bank from exactly these rows; other searches (Crumbline) start from
68 * the same vocabulary instead of copying it. */
69typedef struct {
70 const char *name;
71 OpCode op;
72 uint64_t imm;
73} OmegaSynthPrimDef;
74
75size_t omega_synth_base_prim_defs(const OmegaSynthPrimDef **out);
76
77/* Initialize default primitive bank (add, sub, mul, and, or with diverse imm) */
78int omega_synth_bank_init(SynthPrimitiveBank *bank);
79
80/* Destroy primitive bank */
81void omega_synth_bank_destroy(SynthPrimitiveBank *bank);
82
83/* Equivalence table functions */
84void omega_synth_equiv_init(EquivTable *tbl);
85bool omega_synth_equiv_contains_or_add(EquivTable *tbl, const uint8_t hash[32], uint32_t cost);
86int omega_synth_compute_signature(const OmegaProgram *prog, uint8_t out_hash[32]);
87
88/* Main deterministic synthesis entrypoint */
89int omega_synthesize(const SynthesisTask *task, const SynthPrimitiveBank *bank,
90 const SynthesisConfig *config, SynthesisResult *result);
91
92/* High-level synthesis routines for canonical milestones / demonstrations */
93int omega_synthesize_target_affine(SynthesisResult *result);
94int omega_synthesize_target_composed(SynthesisResult *result);
95
96#endif /* OMEGA_SYNTHESIS_H */