uor-foundation 0.1.2

UOR Foundation — typed Rust traits for the complete ontology. Import and implement.
Documentation
// @generated by uor-crate from uor-ontology — do not edit manually

//! `cert/` namespace — Kernel-produced attestation certificates for transforms, isometries, and involutions. Each certificate verifies that a specific structural property holds..
//!
//! Space: Bridge

use crate::enums::QuantumLevel;
use crate::Primitives;

/// A kernel-produced attestation. The root class for all certificate types.
pub trait Certificate<P: Primitives> {
    /// The verification method used to produce this certificate (e.g., 'exhaustive_check', 'symbolic_proof', 'sampling').
    fn method(&self) -> &P::String;
    /// Whether this certificate has been verified by the kernel.
    fn verified(&self) -> P::Boolean;
    /// The quantum level at which this certificate was produced.
    fn quantum(&self) -> P::PositiveInteger;
    /// The time at which this certificate was issued.
    fn timestamp(&self) -> &P::String;
    /// The resource this certificate attests to. Links a certificate to the observable, transform, or other entity it covers.
    fn certifies(&self) -> &P::String;
}

/// A certificate attesting to the properties of a morphism:Transform. Certifies that the transform maps source to target correctly.
pub trait TransformCertificate<P: Primitives>: Certificate<P> {
    /// The type of transform this certificate attests to (e.g., 'isometry', 'embedding', 'action').
    fn transform_type(&self) -> &P::String;
}

/// A certificate attesting that a morphism:Isometry preserves metric distances. Certifies the transform is a metric isometry with respect to the specified metric.
pub trait IsometryCertificate<P: Primitives>: Certificate<P> {}

/// A certificate attesting that an operation is an involution: f(f(x)) = x for all x in R_n.
pub trait InvolutionCertificate<P: Primitives>: Certificate<P> {
    /// Associated type for `Operation`.
    type Operation: crate::kernel::op::Operation<P>;
    /// The operation this certificate applies to.
    fn operation(&self) -> &Self::Operation;
}

/// A certificate attesting that a type:CompleteType satisfies IT_7d: its constraint nerve has χ = n and all Betti numbers β_k = 0. Issued by the kernel after running the full ψ pipeline on the type's constraint set.
pub trait CompletenessCertificate<P: Primitives>: Certificate<P> {
    /// Associated type for `CompleteType`.
    type CompleteType: crate::user::type_::CompleteType<P>;
    /// The TypeDefinition whose completeness this certificate attests. The kernel issues this certificate after running the ψ pipeline on the type's constraint set and confirming IT_7d.
    fn certified_type(&self) -> &Self::CompleteType;
    /// Associated type for `CompletenessAuditTrail`.
    type CompletenessAuditTrail: CompletenessAuditTrail<P>;
    /// The audit trail attesting the certification provenance. Links a CompletenessCertificate to its ordered sequence of CompletenessWitness records.
    fn audit_trail(&self) -> &Self::CompletenessAuditTrail;
}

/// An ordered collection of CompletenessWitness records belonging to a CompletenessCertificate. Provides full provenance of the certification process: every constraint applied, every fiber closed, in sequence.
pub trait CompletenessAuditTrail<P: Primitives> {
    /// Total number of witness steps in this audit trail.
    fn witness_count(&self) -> P::NonNegativeInteger;
}

/// A certificate attesting that a state:SaturatedContext has reached full saturation (σ = 1, freeCount = 0, S = 0, T_ctx = 0) per SC_4. The session-layer dual of CompletenessCertificate.
pub trait SaturationCertificate<P: Primitives>: Certificate<P> {
    /// Associated type for `SaturatedContext`.
    type SaturatedContext: crate::user::state::SaturatedContext<P>;
    /// The SaturatedContext whose full saturation this certificate attests. Uses IRI string (cert cannot import state).
    fn certified_saturation(&self) -> &Self::SaturatedContext;
    /// Associated type for `SaturationWitness`.
    type SaturationWitness: crate::user::state::SaturationWitness<P>;
    /// The SaturationWitness providing step-by-step evidence of the saturation process.
    fn saturation_witness(&self) -> &Self::SaturationWitness;
}

/// A certificate attesting that a trace:GeodesicTrace satisfies both GD_1 conditions: AR_1-ordered and DC_10-selected. Transforms ComputationTrace from descriptive to normative.
pub trait GeodesicCertificate<P: Primitives>: Certificate<P> {
    /// Associated type for `GeodesicTrace`.
    type GeodesicTrace: crate::bridge::trace::GeodesicTrace<P>;
    /// The GeodesicTrace whose geodesic status this certificate attests. Uses IRI string (cert cannot import trace).
    fn certified_geodesic(&self) -> &Self::GeodesicTrace;
    /// The computation trace that this GeodesicCertificate covers. Redundant with certifiedGeodesic but expresses the inverse direction for queryability.
    fn geodesic_trace(&self) -> &Self::GeodesicTrace;
    /// Associated type for `GeodesicEvidenceBundle`.
    type GeodesicEvidenceBundle: GeodesicEvidenceBundle<P>;
    /// The GeodesicEvidenceBundle attesting to the decomposed sub-predicates (isAR1Ordered, isDC10Selected) of this GeodesicCertificate's geodesic claim.
    fn evidence_bundle(&self) -> &Self::GeodesicEvidenceBundle;
}

/// A certificate attesting that a trace:MeasurementEvent respected the von Neumann–Landauer bridge (QM_1): preCollapseEntropy = postCollapseLandauerCost at β* = ln 2.
pub trait MeasurementCertificate<P: Primitives>: Certificate<P> {
    /// Associated type for `MeasurementEvent`.
    type MeasurementEvent: crate::bridge::trace::MeasurementEvent<P>;
    /// The MeasurementEvent whose QM_1 compliance this certificate attests. Uses IRI string (cert cannot import trace).
    fn certified_measurement(&self) -> &Self::MeasurementEvent;
    /// The von Neumann entropy S_vN of the pre-measurement SuperposedFiberState, recorded by this certificate.
    fn von_neumann_entropy(&self) -> P::Decimal;
    /// The Landauer cost incurred by the projective collapse, recorded by this certificate. Equals vonNeumannEntropy at β* = ln 2 per QM_1.
    fn landauer_cost(&self) -> P::Decimal;
}

/// A structured evidence bundle attesting that each sub-predicate of the geodesic condition (GD_6) holds independently: isAR1Ordered and isDC10Selected. Linked from GeodesicCertificate via evidenceBundle.
pub trait GeodesicEvidenceBundle<P: Primitives> {
    /// True iff the linked GeodesicTrace is ordered by the AR_1 canonical rewriting rule (smallest lexicographic representative first).
    fn is_ar1_ordered(&self) -> P::Boolean;
    /// True iff each constraint in the trace was selected by the DC_10 Jacobian oracle at the step where it was applied.
    fn is_dc10_selected(&self) -> P::Boolean;
}

/// A certificate attesting that a MeasurementEvent outcome probability matches the Born rule: P(outcome k) = |α_k|² (QM_5). Linked from MeasurementCertificate to provide probability distribution verification.
pub trait BornRuleVerification<P: Primitives>: Certificate<P> {
    /// Whether this BornRuleVerification certificate confirms that all outcome probabilities match the Born rule (QM_5): P(k) = |α_k|² for every fiber k.
    fn born_rule_verified(&self) -> P::Boolean;
}

/// A kernel-issued certificate attesting that a LiftChain from liftSourceLevel to liftTargetLevel is complete.
pub trait LiftChainCertificate<P: Primitives>: Certificate<P> {
    /// Associated type for `LiftChain`.
    type LiftChain: crate::user::type_::LiftChain<P>;
    /// The LiftChain this certificate attests to.
    fn certified_chain(&self) -> &Self::LiftChain;
    /// Associated type for `ChainAuditTrail`.
    type ChainAuditTrail: ChainAuditTrail<P>;
    /// The ordered per-step evidence for this certificate.
    fn chain_audit_trail(&self) -> &Self::ChainAuditTrail;
    /// The quantum level Q_k at which the certificate was issued.
    fn target_level(&self) -> QuantumLevel;
    /// The quantum level Q_j from which the tower was started.
    fn source_level(&self) -> QuantumLevel;
}

/// An ordered collection of per-step evidence records for a LiftChainCertificate.
pub trait ChainAuditTrail<P: Primitives> {
    /// Number of lift steps in this ChainAuditTrail. Must equal chainLength of the certified LiftChain. Distinct from witnessCount (domain-locked to CompletenessAuditTrail).
    fn chain_step_count(&self) -> P::NonNegativeInteger;
}