algebraeon_sets/structure/
singleton_set.rs1use super::{EqSignature, OrdSignature, SetSignature, Signature};
2use crate::structure::{CountableSetSignature, FiniteSetSignature, orderings::PartialOrdSignature};
3use std::fmt::Debug;
4
5#[derive(Default, Debug, Clone, PartialEq, Eq)]
6pub struct SingletonSetStructure {}
7
8impl Signature for SingletonSetStructure {}
9
10impl SetSignature for SingletonSetStructure {
11 type Set = ();
12
13 fn is_element(&self, _: &Self::Set) -> Result<(), String> {
14 Ok(())
15 }
16}
17
18impl EqSignature for SingletonSetStructure {
19 fn equal(&self, x: &Self::Set, y: &Self::Set) -> bool {
20 x == y
21 }
22}
23
24impl PartialOrdSignature for SingletonSetStructure {
25 fn partial_cmp(&self, a: &Self::Set, b: &Self::Set) -> Option<std::cmp::Ordering> {
26 Some(self.cmp(a, b))
27 }
28}
29
30impl OrdSignature for SingletonSetStructure {
31 fn cmp(&self, x: &Self::Set, y: &Self::Set) -> std::cmp::Ordering {
32 x.cmp(y)
33 }
34}
35
36impl CountableSetSignature for SingletonSetStructure {
37 fn generate_all_elements(&self) -> impl Iterator<Item = Self::Set> + Clone {
38 [()].into_iter()
39 }
40}
41
42impl FiniteSetSignature for SingletonSetStructure {
43 fn size(&self) -> usize {
44 1
45 }
46}