relmath
relmath is the G1 library crate inside the relmath-rs repository.
It provides exact finite unary and binary relations with deterministic
BTreeSet-backed iteration order.
Current G1 Surface
The current public API covers:
UnaryRelation<T>for finite unary relations (sets)BinaryRelation<A, B>for finite binary relations- union, intersection, and difference
- domain, range, converse, and composition
- domain/range restriction plus image/preimage with unary relations
- identity on a carrier
- transitive and reflexive-transitive closure on homogeneous relations
- relation property checks for reflexivity, irreflexivity, symmetry, antisymmetry, transitivity, equivalence, and partial order
Composition uses relational order:
r.compose(&s)meansr ; s- the result contains
(a, c)when somebsatisfies(a, b) in rand(b, c) in s
Current Limits
This crate currently implements the exact G1 core only:
- no n-ary relations
- no weighted or temporal relations
- no solver-backed or symbolic evaluation
The repository ships three focused examples under examples/:
familyfor ancestry and reachabilityaccess_controlfor role-permission propagationworkflowfor state reachability
Example
use ;
let parent = from_pairs;
let people = from_values;
let grandparent = parent.compose;
let ancestor_or_self = parent.reflexive_transitive_closure;
assert_eq!;
assert!;
assert!;
Status
This crate is the exact unary/binary relation core for the first public G1 release candidate.