rust_lstar/eqtest/mod.rs
1//! Equivalence-test strategy interfaces and implementations.
2//!
3//! These strategies search for a counterexample that disproves a current
4//! hypothesis automaton.
5
6use crate::word::Word;
7
8/// BDist method implementation.
9pub mod bdist_method;
10/// Composition of multiple equivalence tests.
11pub mod multiple_eqtests;
12/// Random-walk based equivalence testing.
13pub mod random_walk;
14/// W-method implementation.
15pub mod w_method;
16
17/// BDist equivalence-test strategy.
18pub use bdist_method::BDistMethod;
19/// Composite equivalence-test strategy.
20pub use multiple_eqtests::MultipleEqtests;
21/// Random-walk equivalence-test strategy.
22pub use random_walk::RandomWalkMethod;
23/// W-method equivalence-test strategy.
24pub use w_method::WMethodEQ;
25/// Alias for the Wp-method name used by some literature.
26pub type WpMethodEQ = WMethodEQ;
27
28/// Represents a counterexample found during equivalence testing
29#[derive(Clone, Debug)]
30pub struct Counterexample {
31 /// Input sequence that exposes the mismatch.
32 pub input_word: Word,
33 /// Observed output sequence from the system under learning.
34 pub output_word: Word,
35}
36
37/// Trait for equivalence testing methods
38pub trait EquivalenceTest {
39 /// Find a counterexample for the given hypothesis
40 /// Returns None if the automaton is equivalent to the system under learning
41 fn find_counterexample(&self, hypothesis: &mut crate::automata::Automata)
42 -> Option<Counterexample>;
43}