1pub mod rotation;
2
3use crypto_primitives::Semiring;
4use std::fmt::Debug;
5use thiserror::Error;
6use zinc_utils::from_ref::FromRef;
7
8pub trait Ideal: FromRef<Self> + Clone + Debug + Send + Sync {}
10
11pub trait IdealCheck<T> {
15 fn contains(&self, value: &T) -> Result<bool, IdealCheckError>;
18}
19
20#[derive(Clone, Copy, Debug)]
23pub struct ImpossibleIdeal;
24
25impl Ideal for ImpossibleIdeal {}
26
27impl<R: Semiring> IdealCheck<R> for ImpossibleIdeal {
28 #[inline(always)]
29 fn contains(&self, _value: &R) -> Result<bool, IdealCheckError> {
30 Ok(false)
31 }
32}
33
34impl<I: Ideal> FromRef<I> for ImpossibleIdeal {
35 #[inline(always)]
36 fn from_ref(_ideal: &I) -> Self {
37 ImpossibleIdeal
38 }
39}
40
41pub type DegreeOneIdeal<F> = rotation::RotationIdeal<F, 1>;
44
45#[derive(Clone, Debug, Error)]
46#[error("Ideal check failed: {0}")]
47pub struct IdealCheckError(String);