pub struct EffectEthos<D, S, T, ST, SYM, VS, VT>where
D: Datable + Clone,
S: Spatial<VS> + Clone,
T: Temporal<VT> + Clone,
ST: SpaceTemporal<VS, VT> + Clone,
SYM: Symbolic + Clone,
VS: Clone,
VT: Clone,{ /* private fields */ }Expand description
The EffectEthos provides a reasoning engine for deontic inference.
It encapsulates all the necessary components to evaluate a proposed action
against a set of teleological norms (Teloids).
For more details, see section 5 (Causality as EPP) and 8 (Teleology) in The EPP reference paper: https://github.com/deepcausality-rs/papers/blob/main/effect_propagation_process/epp.pdf
Implementations§
Source§impl<D, S, T, ST, SYM, VS, VT> EffectEthos<D, S, T, ST, SYM, VS, VT>
impl<D, S, T, ST, SYM, VS, VT> EffectEthos<D, S, T, ST, SYM, VS, VT>
Sourcepub fn add_deterministic_norm(
self,
id: TeloidID,
action_identifier: &str,
tags: &[TeloidTag],
predicate: fn(&Context<D, S, T, ST, SYM, VS, VT>, &ProposedAction) -> bool,
modality: TeloidModal,
timestamp: u64,
specificity: u32,
priority: u32,
) -> Result<Self, DeonticError>
pub fn add_deterministic_norm( self, id: TeloidID, action_identifier: &str, tags: &[TeloidTag], predicate: fn(&Context<D, S, T, ST, SYM, VS, VT>, &ProposedAction) -> bool, modality: TeloidModal, timestamp: u64, specificity: u32, priority: u32, ) -> Result<Self, DeonticError>
Adds a new deterministic norm to the ethos using a builder-style pattern.
This high-level method simplifies the process of adding norms by accepting
all necessary components as arguments, constructing the Teloid internally,
and handling all necessary updates to the store, graph, and indices.
§Arguments
id- The unique identifier for the new norm.action_identifier- A string slice identifying the action this norm governs.tags- A slice of string tags for categorization.predicate- The function pointer that determines if the norm is active.modality- The deontic status (Obligatory,Impermissible,Optional).timestamp- The creation time of the norm forLex Posterior.specificity- The specificity level forLex Specialis.priority- The priority level forLex Superior.
§Returns
A Result containing self for method chaining, or a DeonticError if the
id already exists.
Sourcepub fn add_uncertain_norm(
self,
id: TeloidID,
action_identifier: &str,
tags: &[TeloidTag],
predicate: UncertainActivationPredicate<D, S, T, ST, SYM, VS, VT>,
predicate_parameter: UncertainParameter,
modality: TeloidModal,
timestamp: u64,
specificity: u32,
priority: u32,
) -> Result<Self, DeonticError>
pub fn add_uncertain_norm( self, id: TeloidID, action_identifier: &str, tags: &[TeloidTag], predicate: UncertainActivationPredicate<D, S, T, ST, SYM, VS, VT>, predicate_parameter: UncertainParameter, modality: TeloidModal, timestamp: u64, specificity: u32, priority: u32, ) -> Result<Self, DeonticError>
Adds a new uncertain norm to the ethos using a builder-style pattern.
Sourcepub fn get_norm(
&self,
id: TeloidID,
) -> Option<&Teloid<D, S, T, ST, SYM, VS, VT>>
pub fn get_norm( &self, id: TeloidID, ) -> Option<&Teloid<D, S, T, ST, SYM, VS, VT>>
Retrieves a reference to a norm by its unique identifier.
This method provides read-only access to a Teloid stored within the EffectEthos
based on its TeloidID.
§Arguments
id- The unique identifier of the norm to retrieve.
§Returns
An Option containing a reference to the Teloid if found, or None otherwise.
Sourcepub fn link_inheritance(
self,
parent_id: TeloidID,
child_id: TeloidID,
) -> Result<Self, DeonticError>
pub fn link_inheritance( self, parent_id: TeloidID, child_id: TeloidID, ) -> Result<Self, DeonticError>
Defines an inheritance relationship between two norms by their IDs.
§Arguments
parent_id- The ID of the more general norm.child_id- The ID of the more specific norm that inherits from the parent.
§Returns
A Result containing self for method chaining, or a DeonticError if either ID
is not found or the graph is frozen.
Sourcepub fn link_defeasance(
self,
defeater_id: TeloidID,
defeated_id: TeloidID,
) -> Result<Self, DeonticError>
pub fn link_defeasance( self, defeater_id: TeloidID, defeated_id: TeloidID, ) -> Result<Self, DeonticError>
Defines a defeasance relationship between two norms by their IDs.
§Arguments
defeater_id- The ID of the norm that can defeat the other.defeated_id- The ID of the norm that can be defeated.
§Returns
A Result containing self for method chaining, or a DeonticError if either ID
is not found or the graph is frozen.
Source§impl<D, S, T, ST, SYM, VS, VT> EffectEthos<D, S, T, ST, SYM, VS, VT>
impl<D, S, T, ST, SYM, VS, VT> EffectEthos<D, S, T, ST, SYM, VS, VT>
Source§impl<D, S, T, ST, SYM, VS, VT> EffectEthos<D, S, T, ST, SYM, VS, VT>
impl<D, S, T, ST, SYM, VS, VT> EffectEthos<D, S, T, ST, SYM, VS, VT>
pub fn is_verified(&self) -> bool
Sourcepub fn verify_graph(&mut self) -> Result<(), DeonticError>
pub fn verify_graph(&mut self) -> Result<(), DeonticError>
Verifies the integrity of the internal TeloidGraph, primarily checking for cycles. This is a required step before evaluation can proceed.
Source§impl<D, S, T, ST, SYM, VS, VT> EffectEthos<D, S, T, ST, SYM, VS, VT>
impl<D, S, T, ST, SYM, VS, VT> EffectEthos<D, S, T, ST, SYM, VS, VT>
Sourcepub fn from(
teloid_store: TeloidStore<D, S, T, ST, SYM, VS, VT>,
tag_index: TagIndex,
teloid_graph: TeloidGraph,
) -> Self
pub fn from( teloid_store: TeloidStore<D, S, T, ST, SYM, VS, VT>, tag_index: TagIndex, teloid_graph: TeloidGraph, ) -> Self
Build an effect ethos
Trait Implementations§
Source§impl<D, S, T, ST, SYM, VS, VT> Clone for EffectEthos<D, S, T, ST, SYM, VS, VT>
impl<D, S, T, ST, SYM, VS, VT> Clone for EffectEthos<D, S, T, ST, SYM, VS, VT>
Source§fn clone(&self) -> EffectEthos<D, S, T, ST, SYM, VS, VT>
fn clone(&self) -> EffectEthos<D, S, T, ST, SYM, VS, VT>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<D, S, T, ST, SYM, VS, VT> Debug for EffectEthos<D, S, T, ST, SYM, VS, VT>
impl<D, S, T, ST, SYM, VS, VT> Debug for EffectEthos<D, S, T, ST, SYM, VS, VT>
Source§impl<D, S, T, ST, SYM, VS, VT> Default for EffectEthos<D, S, T, ST, SYM, VS, VT>
impl<D, S, T, ST, SYM, VS, VT> Default for EffectEthos<D, S, T, ST, SYM, VS, VT>
Source§fn default() -> EffectEthos<D, S, T, ST, SYM, VS, VT>
fn default() -> EffectEthos<D, S, T, ST, SYM, VS, VT>
Source§impl<D, S, T, ST, SYM, VS, VT> DeonticExplainable<D, S, T, ST, SYM, VS, VT> for EffectEthos<D, S, T, ST, SYM, VS, VT>
impl<D, S, T, ST, SYM, VS, VT> DeonticExplainable<D, S, T, ST, SYM, VS, VT> for EffectEthos<D, S, T, ST, SYM, VS, VT>
Source§fn explain_verdict(&self, verdict: &Verdict) -> Result<String, DeonticError>
fn explain_verdict(&self, verdict: &Verdict) -> Result<String, DeonticError>
Source§impl<D, S, T, ST, SYM, VS, VT> DeonticInferable<D, S, T, ST, SYM, VS, VT> for EffectEthos<D, S, T, ST, SYM, VS, VT>
impl<D, S, T, ST, SYM, VS, VT> DeonticInferable<D, S, T, ST, SYM, VS, VT> for EffectEthos<D, S, T, ST, SYM, VS, VT>
Source§fn evaluate_action(
&self,
action: &ProposedAction,
context: &Context<D, S, T, ST, SYM, VS, VT>,
tags: &[TeloidTag],
) -> Result<Verdict, DeonticError>
fn evaluate_action( &self, action: &ProposedAction, context: &Context<D, S, T, ST, SYM, VS, VT>, tags: &[TeloidTag], ) -> Result<Verdict, DeonticError>
Evaluates a proposed action against the established norms and beliefs within the EffectEthos system.
This method orchestrates the deontic inference process, which involves several key steps:
- Graph State Check: Ensures the internal teloid graph is frozen and verified for acyclicity to guarantee a stable and reliable evaluation.
- Filtering (Step 1): Identifies a candidate set of
Teloids (norms/beliefs) relevant to theProposedActionusing a list of tags. - Activation (Step 2): Filters the candidate
Teloids based on their activation predicates, which determine if aTeloidis applicable in the givenContext. - Belief Inference & Conflict Resolution (Steps 3 & 4): Resolves any conflicts among the
active
Teloids to arrive at a final set of applicable norms. - Verdict Finding (Step 5): Derives a final
Verdictbased on the resolved norms.
§Arguments
action- A reference to theProposedActionto be evaluated.context- A reference to theContextproviding environmental and situational data.tags- A slice ofTeloidTags used to retrieve relevant norms from the tag index.
§Returns
A Result which is:
Ok(Verdict)if a verdict can be successfully derived.Err(DeonticError)if the graph is not frozen, is cyclic, no relevant norms are found, no teloids are active, or if conflict resolution fails.