Skip to main content

Module deontic_logic

Module deontic_logic 

Source
Expand description

Deontic logic engine — ODRL-based policy evaluation for credential-gated subgraph access.

The policy hierarchy maps agent Verifiable Credentials to SubgraphLayer access rights. Policy evaluation is:

  1. Extract VcAttributes from the agent’s NQuin slice (credential claims).
  2. Evaluate against the SubgraphPolicy for the requested layer.
  3. If the policy passes, call KeyVault::generate_layer_key() and return it.

The deontic_logic module is intentionally free of heap allocation in evaluation paths — all structures fit in fixed-size arrays.

Re-exports§

pub use crate::modalities::logic::deontic::DEFEATER_BIT;
pub use crate::modalities::logic::deontic::OP_FORBID;
pub use crate::modalities::logic::deontic::OP_OBLIGATE;
pub use crate::modalities::logic::deontic::OP_PERMIT;

Modules§

vc_roles
Compile-time hashes of canonical ODRL/Qualia role IRIs used in VC claims.

Structs§

VcAttributes
Parsed Verifiable Credential attributes for a single agent.

Enums§

DeonticResult
The result of a deontic policy evaluation for subgraph key release.

Functions§

compile_agreement_to_deontic_norms
Compile a ratified AgreementDID into authorized deontic norm Quins.
compile_n3_ast_rule_to_norm
Compile an uncompiled/borrowed N3 AST Rule directly into a norm Quin.
compile_n3_rule_to_norm
Compile an N3 rule into a norm Quin (or a defeater Quin if rule_type is Defeater).
compile_stack_rule_to_norm
Compile a zero-allocation StackRule directly into a norm Quin.
evaluate_accessible_layers
Convenience: evaluate which layers the agent can access and write the permitted keys into out, in ascending layer order.
evaluate_vc_for_subgraph_key_release
Evaluate an agent’s VCs against the ODRL policy for layer and, if permitted, return the derived SubgraphKey.
write_vc_claim_quins
Build the NQuins that record a VC credential claim for an agent, for insertion into the daemon graph.