ternlang-core 1.2.9

Compiler and VM for Ternlang — balanced ternary language with affirm/tend/reject trit semantics, @sparseskip codegen, and BET bytecode execution.
Documentation
// Module:  stdlib/research/constitutional_trit.tern
// Purpose: Constitutional AI via Trits
// Author:  RFI-IRFOS
// Ref:     https://ternlang.com

// Direct implementation of Anthropic's Constitutional AI, but the critique
// is returned as a trit signal.

fn principle_check_trit(response: trit, principle: trit) -> trit {
    if response == principle { return affirm; } // Safe
    return reject; // Violates principle
}

fn revision_signal_trit(critique: trit) -> trit {
    if critique == reject { return affirm; } // Needs revision
    return tend; // Good enough
}

fn harmless_gate_trit(score: trit) -> trit {
    if score == tend { return tend; } // Human review
    match score {
        affirm => { return affirm; }
        tend   => { return tend;   }
        reject => { return reject; }
    }
}