1
use merc_lts::LTS;
2
use merc_utilities::Timing;
3

            
4
use crate::CounterExample;
5
use crate::ExplorationStrategy;
6
use crate::is_failures_refinement;
7

            
8
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
10
pub enum RefinementType {
11
    Trace,
12
    Weaktrace,
13
}
14

            
15
/// Checks whether `impl_lts` refines `spec_lts` according to the given
16
/// `refinement`.
17
///
18
/// # Details
19
///
20
/// The `preprocess` flag indicates whether preprocessing should be applied to
21
/// the LTSs. The refinement checks often involve product constructions, and
22
/// reducing the state space beforehand can lead to significant performance
23
/// improvements. However, for quick failing checks the preprocessing could cause
24
/// unnecessary overhead.
25
pub fn refines<L: LTS>(
26
    impl_lts: L,
27
    spec_lts: L,
28
    refinement: RefinementType,
29
    preprocess: bool,
30
    counter_example: bool,
31
    timing: &mut Timing,
32
) -> (bool, Option<CounterExample<L::Label>>) {
33
    is_failures_refinement(
34
        impl_lts,
35
        spec_lts,
36
        refinement,
37
        ExplorationStrategy::BFS,
38
        preprocess,
39
        counter_example,
40
        timing,
41
    )
42
}