elinvar-logic 0.1.2

The relational logic of Elinvar and its evaluator, the referee for every answer
Documentation
//! The relational logic of Elinvar, and its evaluator.
//!
//! A universe of atoms, relations bounded by sets of tuples, expressions and
//! formulas over them, instances, an evaluator that computes every
//! definition directly, and brute-force enumeration for tiny universes.
//! The specification is `docs/LOGIC.md`; this crate is the referee every
//! answer of the engine is checked by, so it depends on no part of the
//! engine (AGENTS.md law 12).
//!
//! ```
//! use elinvar_logic::{Expr, Instance, Relation, Universe, evaluate};
//!
//! let u = Universe::new(["A", "B", "C"]).unwrap();
//! let r = Relation::binary("r");
//! let mut i = Instance::new(&u);
//! i.set(&r, u.tuple_set(2, &[&["A", "B"], &["B", "C"]]).unwrap()).unwrap();
//!
//! let r = Expr::relation(&r);
//! // r.r in r: is r transitive? Not here: (A, C) is missing.
//! assert_eq!(evaluate(&i, &r.join(&r).is_in(&r)), Ok(false));
//! ```

mod ast;
mod bounds;
mod check;
mod enumerate;
mod error;
mod eval;
mod relation;
mod trace;
mod universe;

pub use ast::{
    BinaryOp, Decl, DeclMult, Expr, ExprKind, Formula, FormulaKind, IntComparison, IntExpr,
    IntExprKind, IntOp, Multiplicity, Quantifier, TemporalBinaryOp, TemporalOp, UnaryOp,
};
pub use bounds::{Bounds, Instance};
pub use check::{Against, check_expr, check_formula, check_formula_bound, check_int};
pub use enumerate::{Instances, count, count_traces, instances, traces};
pub use error::{CODES, Code, Error, Place, explain};
pub use eval::{
    evaluate, evaluate_expr, evaluate_int, evaluate_trace, evaluate_trace_at,
    evaluate_trace_expr_at, evaluate_trace_int_at,
};
pub use relation::{Relation, Variable};
pub use trace::Trace;
pub use universe::{DEFAULT_BITWIDTH, Tuple, TupleSet, Universe};