pub struct FpCategory { /* private fields */ }Expand description
A finitely presented category backed by an e-graph.
A data structure for a f.p. category in which the congruence relation generated by the path equations is maintained by an e-graph. The question of whether paths in the presented category are equivalent is referred to the e-graph.
§Interior mutability
Checking equivalence of paths requires mutating the underlying e-graph. However, we do not want to regard this check as mutating, for the theoretical reason that the check does not change the category presented and the practical reason that it would cause mutable references to be aggressively propagated throughout the codebase. Thus, we use the interior mutability pattern to encapsulate the mutability of the e-graph and perform borrow checking at runtime. The current implementation allows only single-threaded usage.
Implementations§
Source§impl FpCategory
impl FpCategory
Source§impl FpCategory
impl FpCategory
Sourcepub fn generators(&self) -> &impl FinGraph<V = QualifiedName, E = QualifiedName>
pub fn generators(&self) -> &impl FinGraph<V = QualifiedName, E = QualifiedName>
Gets the generating graph of the category presentation.
Sourcepub fn equations(
&self,
) -> impl Iterator<Item = (QualifiedName, &QualifiedPathEq)>
pub fn equations( &self, ) -> impl Iterator<Item = (QualifiedName, &QualifiedPathEq)>
Gets the path equations of the category presentation.
Sourcepub fn add_ob_generator(&mut self, v: QualifiedName)
pub fn add_ob_generator(&mut self, v: QualifiedName)
Adds an object generator.
Sourcepub fn add_ob_generators(
&mut self,
iter: impl IntoIterator<Item = QualifiedName>,
)
pub fn add_ob_generators( &mut self, iter: impl IntoIterator<Item = QualifiedName>, )
Adds several object generators at once.
Sourcepub fn add_mor_generator(
&mut self,
e: QualifiedName,
dom: QualifiedName,
cod: QualifiedName,
)
pub fn add_mor_generator( &mut self, e: QualifiedName, dom: QualifiedName, cod: QualifiedName, )
Adds a morphism generator.
Sourcepub fn make_mor_generator(&mut self, e: QualifiedName)
pub fn make_mor_generator(&mut self, e: QualifiedName)
Adds a morphism generator without declaring its (co)domain.
Sourcepub fn get_dom(&self, e: &QualifiedName) -> Option<&QualifiedName>
pub fn get_dom(&self, e: &QualifiedName) -> Option<&QualifiedName>
Gets the domain of a morphism generator.
Sourcepub fn get_cod(&self, e: &QualifiedName) -> Option<&QualifiedName>
pub fn get_cod(&self, e: &QualifiedName) -> Option<&QualifiedName>
Gets the codomain of a morphism generator.
Sourcepub fn set_dom(&mut self, e: QualifiedName, v: QualifiedName)
pub fn set_dom(&mut self, e: QualifiedName, v: QualifiedName)
Sets the domain of a morphism generator.
Sourcepub fn set_cod(&mut self, e: QualifiedName, v: QualifiedName)
pub fn set_cod(&mut self, e: QualifiedName, v: QualifiedName)
Sets the codomain of a morphism generator.
Sourcepub fn add_equation(&mut self, name: QualifiedName, eq: QualifiedPathEq)
pub fn add_equation(&mut self, name: QualifiedName, eq: QualifiedPathEq)
Adds a path equation to the presentation.
Sourcepub fn equate(
&mut self,
name: QualifiedName,
lhs: QualifiedPath,
rhs: QualifiedPath,
)
pub fn equate( &mut self, name: QualifiedName, lhs: QualifiedPath, rhs: QualifiedPath, )
Equates two path in the presentation.
Sourcepub fn iter_invalid(&self) -> impl Iterator<Item = InvalidFpCategory> + '_
pub fn iter_invalid(&self) -> impl Iterator<Item = InvalidFpCategory> + '_
Iterates over failures to be a well-defined presentation of a category.
Trait Implementations§
Source§impl Category for FpCategory
impl Category for FpCategory
Source§type Ob = QualifiedName
type Ob = QualifiedName
Source§type Mor = Path<QualifiedName, QualifiedName>
type Mor = Path<QualifiedName, QualifiedName>
Source§fn has_mor(&self, path: &Self::Mor) -> bool
fn has_mor(&self, path: &Self::Mor) -> bool
Source§fn compose(&self, path: Path<Self::Ob, Self::Mor>) -> Self::Mor
fn compose(&self, path: Path<Self::Ob, Self::Mor>) -> Self::Mor
Source§fn compose2(&self, path1: Self::Mor, path2: Self::Mor) -> Self::Mor
fn compose2(&self, path1: Self::Mor, path2: Self::Mor) -> Self::Mor
Source§impl Clone for FpCategory
impl Clone for FpCategory
Source§fn clone(&self) -> FpCategory
fn clone(&self) -> FpCategory
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FpCategory
impl Debug for FpCategory
Source§impl Default for FpCategory
impl Default for FpCategory
Source§impl FgCategory for FpCategory
impl FgCategory for FpCategory
Source§type ObGen = QualifiedName
type ObGen = QualifiedName
Source§type MorGen = QualifiedName
type MorGen = QualifiedName
Source§fn ob_generators(&self) -> impl Iterator<Item = Self::ObGen>
fn ob_generators(&self) -> impl Iterator<Item = Self::ObGen>
Source§fn mor_generators(&self) -> impl Iterator<Item = Self::MorGen>
fn mor_generators(&self) -> impl Iterator<Item = Self::MorGen>
Source§fn mor_generator_dom(&self, f: &Self::MorGen) -> Self::Ob
fn mor_generator_dom(&self, f: &Self::MorGen) -> Self::Ob
Source§fn mor_generator_cod(&self, f: &Self::MorGen) -> Self::Ob
fn mor_generator_cod(&self, f: &Self::MorGen) -> Self::Ob
Source§impl From<FpCategory> for DiscreteDblTheory
impl From<FpCategory> for DiscreteDblTheory
Source§fn from(value: FpCategory) -> Self
fn from(value: FpCategory) -> Self
Source§impl PartialEq for FpCategory
impl PartialEq for FpCategory
Source§impl Validate for FpCategory
impl Validate for FpCategory
Source§type ValidationError = InvalidFpCategory
type ValidationError = InvalidFpCategory
impl Eq for FpCategory
Auto Trait Implementations§
impl !Freeze for FpCategory
impl !RefUnwindSafe for FpCategory
impl Send for FpCategory
impl !Sync for FpCategory
impl Unpin for FpCategory
impl UnsafeUnpin for FpCategory
impl !UnwindSafe for FpCategory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.