algebraeon_sets/structure/
singleton_set.rs

1use super::{EqSignature, OrdSignature, SetSignature, Signature};
2use crate::structure::{CountableSetSignature, FiniteSetSignature};
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 OrdSignature for SingletonSetStructure {
25    fn cmp(&self, x: &Self::Set, y: &Self::Set) -> std::cmp::Ordering {
26        x.cmp(y)
27    }
28}
29
30impl CountableSetSignature for SingletonSetStructure {
31    fn generate_all_elements(&self) -> impl Iterator<Item = Self::Set> {
32        [()].into_iter()
33    }
34}
35
36impl FiniteSetSignature for SingletonSetStructure {
37    fn size(&self) -> usize {
38        1
39    }
40}