Skip to main content

ExactSupport

Trait ExactSupport 

Source
pub trait ExactSupport<F>: FiniteRelation
where F: Ord + Clone,
{ // Required method fn exact_support(&self) -> UnaryRelation<F>; }
Expand description

Shared exact-support and materialization capability traits for add-on relation surfaces. Relation-level exact support for add-on relation surfaces.

ExactSupport makes explicit the deterministic relation-level boundary already used by the released provenance, annotated, and valid-time surfaces: forget the add-on payload and keep only the exact stored facts.

The forgotten payload differs by surface:

Do not confuse this relation-level exact support with crate::temporal::ValidTimeSupport, which is the canonical interval support for one stored fact rather than the exact support of the whole relation.

§Examples

use relmath::{
    ExactSupport,
    annotated::{AnnotatedRelation, BooleanSemiring},
    provenance::ProvenanceRelation,
    temporal::{Interval, ValidTimeRelation},
};

let evidence = ProvenanceRelation::from_facts([
    (("alice", "review"), "directory"),
    (("bob", "approve"), "policy"),
]);
let permissions = AnnotatedRelation::from_facts([
    (("alice", "review"), BooleanSemiring::TRUE),
    (("bob", "approve"), BooleanSemiring::TRUE),
]);
let schedule = ValidTimeRelation::from_facts([
    (
        ("alice", "review"),
        Interval::new(1, 3).expect("expected valid interval"),
    ),
    (
        ("bob", "approve"),
        Interval::new(2, 4).expect("expected valid interval"),
    ),
]);

assert_eq!(
    evidence.exact_support().to_vec(),
    vec![("alice", "review"), ("bob", "approve")]
);
assert_eq!(permissions.exact_support().to_vec(), evidence.exact_support().to_vec());
assert_eq!(schedule.exact_support().to_vec(), evidence.exact_support().to_vec());

Required Methods§

Source

fn exact_support(&self) -> UnaryRelation<F>

Returns the exact support of stored facts in deterministic fact order.

Implementors§