crustabri/solvers/
specs.rs

1use crate::{aa::Argument, utils::LabelType};
2
3/// A trait for solvers able to compute an extension.
4pub trait SingleExtensionComputer<T>
5where
6    T: LabelType,
7{
8    /// Computes a single extension.
9    ///
10    /// In case the problem admits no extension, [Option::None] is return.
11    /// In case an extension is found, it is returned as a vector of arguments.
12    fn compute_one_extension(&mut self) -> Option<Vec<&Argument<T>>>;
13}
14
15/// A trait for solvers able to check the credulous acceptance of an argument.
16pub trait CredulousAcceptanceComputer<T>
17where
18    T: LabelType,
19{
20    /// Checks the credulous acceptance of an argument.
21    ///
22    /// # Panic
23    ///
24    /// If the provided argument does not belong to the argument set, this function must panic.
25    fn is_credulously_accepted(&mut self, arg: &T) -> bool {
26        self.are_credulously_accepted([arg].as_slice())
27    }
28
29    /// Checks the credulous acceptance of an argument, and provide a certificate if it is the case.
30    ///
31    /// The certificate is set to `None` if the result of the test is `false`.
32    /// Otherwise, the certificate is provided as a set of arguments.
33    /// The exact nature of this certificate depends on underlying semantics.
34    ///
35    /// # Panic
36    ///
37    /// If the provided arguments does not belong to the argument set, this function must panic.
38    fn is_credulously_accepted_with_certificate(
39        &mut self,
40        arg: &T,
41    ) -> (bool, Option<Vec<&Argument<T>>>) {
42        self.are_credulously_accepted_with_certificate([arg].as_slice())
43    }
44
45    /// Checks the credulous acceptance of a disjunction of arguments.
46    ///
47    /// # Panic
48    ///
49    /// If one of the provided argument does not belong to the argument set, this function must panic.
50    fn are_credulously_accepted(&mut self, args: &[&T]) -> bool;
51
52    /// Checks the credulous acceptance of a disjunction of arguments, and provide a certificate if it is the case.
53    ///
54    /// The certificate is set to `None` if the result of the test is `false`.
55    /// Otherwise, the certificate is provided as a set of arguments.
56    /// The exact nature of this certificate depends on underlying semantics.
57    ///
58    /// # Panic
59    ///
60    /// If one of the provided arguments does not belong to the argument set, this function must panic.
61    fn are_credulously_accepted_with_certificate(
62        &mut self,
63        args: &[&T],
64    ) -> (bool, Option<Vec<&Argument<T>>>);
65}
66
67/// A trait for solvers able to check the skeptical acceptance of an argument.
68pub trait SkepticalAcceptanceComputer<T>
69where
70    T: LabelType,
71{
72    /// Checks the skeptical acceptance of an argument.
73    ///
74    /// # Panic
75    ///
76    /// If the provided argument does not belong to the argument set, this function must panic.
77    fn is_skeptically_accepted(&mut self, arg: &T) -> bool {
78        self.are_skeptically_accepted([arg].as_slice())
79    }
80
81    /// Checks the skeptical acceptance of an argument, and provide a certificate if it is the case.
82    ///
83    /// The certificate is set to `None` if the result of the test is `true`.
84    /// Otherwise, the certificate is provided as a set of arguments.
85    /// The exact nature of this certificate depends on underlying semantics.
86    ///
87    /// /// # Panic
88    ///
89    /// If the provided argument does not belong to the argument set, this function must panic.
90    fn is_skeptically_accepted_with_certificate(
91        &mut self,
92        arg: &T,
93    ) -> (bool, Option<Vec<&Argument<T>>>) {
94        self.are_skeptically_accepted_with_certificate([arg].as_slice())
95    }
96
97    /// Checks the skeptical acceptance of a disjunction of arguments.
98    ///
99    /// # Panic
100    ///
101    /// If one of the provided arguments does not belong to the argument set, this function must panic.
102    fn are_skeptically_accepted(&mut self, args: &[&T]) -> bool;
103
104    /// Checks the skeptical acceptance of a disjunction of arguments, and provide a certificate if it is the case.
105    ///
106    /// The certificate is set to `None` if the result of the test is `true`.
107    /// Otherwise, the certificate is provided as a set of arguments.
108    /// The exact nature of this certificate depends on underlying semantics.
109    ///
110    /// /// # Panic
111    ///
112    /// If one of the provided arguments does not belong to the argument set, this function must panic.
113    fn are_skeptically_accepted_with_certificate(
114        &mut self,
115        args: &[&T],
116    ) -> (bool, Option<Vec<&Argument<T>>>);
117}