DeepCausality Ethos
DeepCausality Ethos is a programmable deontic reasoning layer for the DeepCausality stack. It evaluates a ProposedAction against a set of norms and returns a justified Verdict (Obligatory, Impermissible, or Optional(cost)).
The crate implements the teleological layer described in section 8 of the Effect Propagation Process paper. It pairs a defeasible deontic logic with the DeepCausality Context so that norms can read the same spatio-temporal state that causal reasoning operates on.
Overview
The unit of regulation is a Teloid: a single norm that names an action, an activation predicate over (Context, ProposedAction), a modality, and three heuristics used for conflict resolution (specificity, priority, timestamp). Teloids are kept in a TeloidStore, indexed by tag in a TagIndex, and linked in a TeloidGraph whose edges carry a TeloidRelation of either Inherits or Defeats.
The EffectEthos struct owns these components and exposes the reasoning API. Evaluation runs in five steps:
- Tag-based filtering selects candidate norms from the
TagIndex. - Each candidate's activation predicate is run against the
Contextand theProposedAction. Uncertain predicates are tested with the teloid'sUncertainParameter(threshold, confidence, epsilon, sample bound). - Active norms are reduced through the
Defeatsedges in the graph (defeasance). - Survivors are checked for consistency under
Lex Specialis,Lex Superior, andLex Posterior. - A
Verdictis returned, carrying the final modality and the IDs of the norms that justify it.
The graph must be frozen and verified for acyclicity before evaluation; calling verify_graph() performs both.
Features
- Deterministic and uncertain norms:
add_deterministic_normtakes afnpredicate.add_uncertain_normtakes anUncertainActivationPredicateand anUncertainParameter, lifting probabilistic activation into the deontic layer. - Explicit conflict resolution: specificity, priority, and recency are first-class fields on every
Teloid. Resolution is deterministic and reproducible. - Auditable verdicts: every
Verdictcarries ajustification: Vec<TeloidID>so a decision can be traced back to the norms that produced it. TheDeonticExplainabletrait exposes this trail. - Context-aware predicates: norms read the full DeepCausality
Context<D, S, T, ST, SYM, VS, VT>, so deontic rules can depend on space, time, symbolic state, and data in one expression. - Static dispatch: no
dynin the public API; the engine is generic over the same seven type parameters as the rest of the DeepCausality core.
Public API
lib.rs exports:
- Types:
EffectEthos,Teloid,TeloidStore,TeloidGraph,TagIndex,TeloidModal,TeloidRelation,Verdict. - Traits:
DeonticInferable,DeonticExplainable,TeloidStorable,Teloidable. - Aliases:
BaseTeloidStore,TeloidID(u64),TeloidTag. - Errors:
DeonticError.
Usage
Add this to your Cargo.toml:
[]
= "0.2"
= "0.13"
Building an EffectEthos
use ;
use ;
use HashMap;
// Define a deterministic predicate over Context and ProposedAction.
// "A drone must not take off when battery is below 20%."
// Build the ethos with a single norm, then freeze and verify the graph.
let mut ethos = new
.add_deterministic_norm
.expect;
ethos.verify_graph.expect;
Evaluating a proposed action
let mut params = new;
params.insert;
let action = new;
let context = /* a deep_causality::Context */;
let verdict = ethos
.evaluate_action
.expect;
match verdict.outcome
for norm_id in verdict.justification
A full worked example, including the Context setup and a CSM integration, lives at
examples/csm_examples/csm_effect_ethos.
Modalities
| Modality | Meaning |
|---|---|
Obligatory |
The action must be taken; omission is a violation. |
Impermissible |
The action must not be taken; performing it is a violation. |
Optional(i64) |
The action is permitted and carries an explicit cost. |
Relation to other DeepCausality crates
deep_causalitysuppliesContext,ProposedAction,Uncertain, and the seven generic parameters used here.ultragraphbacks theTeloidGraph; freeze and acyclicity checks come from it.
References
- Olson, T., Salas-Damian, R., and Forbus, K. D. A Defeasible Deontic Calculus for Resolving Norm Conflicts. Department of Computer Science, Northwestern University. The DDIC formalism underlying the conflict resolution rules used here: docs/papers/ddic.pdf
- Effect Propagation Process paper, section 8 (Teleology): https://github.com/deepcausality-rs/papers/blob/main/effect_propagation_process/epp.pdf
- In-repo overview: docs/ETHOS.md
Contribution
Contributions are welcomed especially related to documentation, example code, and fixes. If unsure where to start, just open an issue and ask.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in deep_causality by you, shall be licensed under the MIT licence, without any additional terms or conditions.
Licence
This project is licensed under the MIT license.
Security
For details about security, please read the security policy.