Skip to main content

Aggregatable

Trait Aggregatable 

Source
pub trait Aggregatable: Verdict + Sized {
    // Required method
    fn aggregate(
        effects: &[CausalEffect<Self>],
        logic: &AggregateLogic,
        threshold: Option<f64>,
    ) -> Result<CausalEffect<Self>, CausalityError>;
}
Expand description

Defines how to aggregate a collection of effects of type T.

Carrier bound (Verdict). Aggregation is only defined over a lawful verdict algebra — a bounded lattice with complement — so Verdict is a supertrait: All/Any/None/Some(k) are closed operations in that algebra, which is what makes a collection of causaloids again a causaloid (core.verdict.closure, lean/DeepCausalityFormal/Core/VerdictClosure.lean; assumption #5). Implementing Aggregatable for a carrier with no Verdict instance is a compile error:

use deep_causality::{Aggregatable, AggregateLogic, CausalityError};
use deep_causality_core::CausalEffect;

struct NotAVerdict(u8);

// error[E0277]: the trait bound `NotAVerdict: Verdict` is not satisfied
impl Aggregatable for NotAVerdict {
    fn aggregate(
        _effects: &[CausalEffect<Self>],
        _logic: &AggregateLogic,
        _threshold: Option<f64>,
    ) -> Result<CausalEffect<Self>, CausalityError> {
        unimplemented!()
    }
}

Migration: implement Verdict for your carrier (bottom/top/meet/join/complement, lawful per num.verdict.*), or aggregate into a shipped carrier (bool, f64, UncertainBool, UncertainF64).

Required Methods§

Source

fn aggregate( effects: &[CausalEffect<Self>], logic: &AggregateLogic, threshold: Option<f64>, ) -> Result<CausalEffect<Self>, CausalityError>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Aggregatable for UncertainBool

Source§

impl Aggregatable for UncertainF64

Source§

impl Aggregatable for bool

Source§

impl Aggregatable for f64

Implementors§