Skip to main content

deep_causality_ethos/traits/
deontic_inferable.rs

1/*
2 * SPDX-License-Identifier: MIT
3 * Copyright (c) 2023 - 2026. The DeepCausality Authors and Contributors. All Rights Reserved.
4 */
5
6use crate::{DeonticError, TeloidTag, Verdict};
7use deep_causality::{
8    Context, Datable, ProposedAction, SpaceTemporal, Spatial, Symbolic, Temporal,
9};
10
11/// Defines the public API for a deontic reasoning engine.
12#[allow(clippy::type_complexity)]
13pub trait DeonticInferable<D, S, T, ST, SYM, VS, VT>
14where
15    D: Datable + Clone,
16    S: Spatial<VS> + Clone,
17    T: Temporal<VT> + Clone,
18    ST: SpaceTemporal<VS, VT> + Clone,
19    SYM: Symbolic + Clone,
20    VS: Clone,
21    VT: Clone,
22{
23    /// Evaluates a proposed action against the set of norms within a given context.
24    ///
25    /// # Arguments
26    /// * `action` - A reference to the `ProposedAction` being evaluated.
27    /// * `context` - A reference to the current `Context` providing the state of the world.
28    /// * `tags` - A slice of `TeloidTag`s used to retrieve relevant norms from the tag index.
29    ///
30    /// # Returns
31    /// A `Result` containing either:
32    /// * `Ok(Verdict)` - A rich `Verdict` struct with the deontic outcome and justification.
33    /// * `Err(DeonticError)` - An error indicating why the evaluation could not be completed.
34    fn evaluate_action(
35        &self,
36        action: &ProposedAction,
37        context: &Context<D, S, T, ST, SYM, VS, VT>,
38        tags: &[TeloidTag],
39    ) -> Result<Verdict, DeonticError>;
40}