logic_eval/
lib.rs

1#![doc = include_str!("../README.md")]
2
3mod parse;
4mod prove;
5
6// === Re-exports ===
7
8pub use parse::{
9    inner::VAR_PREFIX,
10    inner::{Parse, parse_str},
11    repr::{Clause, ClauseDataset, Expr, Predicate, Term},
12    text::Name,
13};
14pub use prove::{
15    db::{ClauseIter, ClauseRef, Database},
16    prover::ProveCx,
17};
18
19pub mod intern {
20    pub use any_intern::*;
21}
22
23// === Hash map and set used within this crate ===
24
25pub(crate) type Map<K, V> = std::collections::HashMap<K, V, fxhash::FxBuildHasher>;
26
27#[derive(Default, Clone, Copy)]
28struct PassThroughHasher {
29    hash: u64,
30}
31
32impl std::hash::Hasher for PassThroughHasher {
33    fn write(&mut self, _bytes: &[u8]) {
34        panic!("u64 is only allowed");
35    }
36
37    fn write_u64(&mut self, i: u64) {
38        self.hash = i;
39    }
40
41    fn finish(&self) -> u64 {
42        self.hash
43    }
44}
45
46pub(crate) type PassThroughState = std::hash::BuildHasherDefault<PassThroughHasher>;
47
48// === Result/Error used within this crate ===
49
50pub(crate) type Result<T> = std::result::Result<T, Error>;
51pub(crate) type Error = Box<dyn std::error::Error + Send + Sync>;