argumentation_bipolar/types.rs
1//! Foundational types for bipolar argumentation.
2
3/// Which kind of directed edge is in the framework: an attack (A defeats B)
4/// or a support (A is required for B under necessary-support semantics).
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
6pub enum EdgeKind {
7 /// `A` attacks `B` — the Dung-standard attack relation.
8 Attack,
9 /// `A` supports `B` — under necessary-support semantics, `A` must be
10 /// in any extension that contains `B`.
11 Support,
12}
13
14/// Identifier for a coalition detected via strongly-connected components
15/// of the support graph. Coalition ids are assigned at detection time by
16/// [`crate::coalition::detect_coalitions`] and are only stable within a
17/// single call — they change if the framework is mutated.
18#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct CoalitionId(pub u32);
20
21#[cfg(test)]
22mod tests {
23 use super::*;
24
25 #[test]
26 fn edge_kind_distinguishes_attack_from_support() {
27 assert_ne!(EdgeKind::Attack, EdgeKind::Support);
28 }
29
30 #[test]
31 fn coalition_id_equality_is_value_based() {
32 assert_eq!(CoalitionId(1), CoalitionId(1));
33 assert_ne!(CoalitionId(1), CoalitionId(2));
34 }
35}