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_verify.h

69 lines · 2635 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_VERIFY_H
18#define OMEGA_VERIFY_H
19
20#include "omega_types.h"
21#include "omega_realize.h"
22#include <stdbool.h>
23
24typedef enum {
25 VERIFY_TIER_V0 = 0, /* Structural */
26 VERIFY_TIER_V1 = 1, /* Differential */
27 VERIFY_TIER_V2 = 2, /* Property / Invariant */
28 VERIFY_TIER_V3 = 3, /* Adversarial (stub) */
29 VERIFY_TIER_V4 = 4, /* Symbolic (stub) */
30 VERIFY_TIER_V5 = 5 /* Proof-Carrying (stub) */
31} VerifyTier;
32
33typedef struct {
34 bool passed;
35 VerifyTier tier;
36 uint32_t check_count;
37 uint32_t fail_count;
38 char error_detail[512];
39} VerifyReport;
40
41/* V0: Structural verification
42 * Validates graph typing & DAG integrity (if graph != NULL)
43 * Validates realization profile, size bounds, instruction stream, terminal RET (if real != NULL)
44 */
45int omega_verify_v0_structural(const OmegaGraph *graph, const RealizationObject *real, VerifyReport *report);
46
47/* V1: Differential verification
48 * For each 3-tuple (a, b, c) in test_inputs:
49 * Computes reference semantic result and native realization result.
50 * Checks exact equality.
51 */
52int omega_verify_v1_differential(const OmegaGraph *graph, const RealizationObject *real,
53 const uint64_t *test_inputs, size_t input_triplet_count,
54 VerifyReport *report);
55
56/* V2: Property / Invariant verification
57 * Evaluates declared properties:
58 * - Commutativity: op(a, b) == op(b, a) for all declared commutative operations
59 * - Identity element: op(a, identity) == a
60 * - Overflow wrapping: validates 2^64-1 + 1 == 0 when OVERFLOW_WRAP declared
61 * - Range preservation: output fits width
62 */
63int omega_verify_v2_properties(const OmegaGraph *graph, const RealizationObject *real, VerifyReport *report);
64
65/* Master verification pipeline running V0 up to max_tier */
66int omega_verify_pipeline(const OmegaGraph *graph, const RealizationObject *real,
67 VerifyTier max_tier, VerifyReport *report);
68
69#endif /* OMEGA_VERIFY_H */