use crate::HostTypes;
pub trait Simplex<H: HostTypes> {
fn dimension(&self) -> i64;
type Constraint: crate::user::type_::Constraint<H>;
fn vertex(&self) -> &[Self::Constraint];
fn vertex_count(&self) -> u64;
type SimplexTarget: Simplex<H>;
fn is_face_of(&self) -> &[Self::SimplexTarget];
type SiteIndex: crate::bridge::partition::SiteIndex<H>;
fn pin_intersection(&self) -> &[Self::SiteIndex];
}
pub trait SimplicialComplex<H: HostTypes> {
type Simplex: Simplex<H>;
fn has_simplex(&self) -> &[Self::Simplex];
fn max_dimension(&self) -> i64;
fn euler_characteristic(&self) -> i64;
fn simplicial_vertex_count(&self) -> u64;
}
pub trait FaceMap<H: HostTypes> {
fn removes_vertex(&self) -> u64;
type Simplex: Simplex<H>;
fn source_simplex(&self) -> &Self::Simplex;
fn target_face(&self) -> &Self::Simplex;
}
pub trait ChainGroup<H: HostTypes> {
fn degree(&self) -> i64;
type Simplex: Simplex<H>;
fn generated_by(&self) -> &[Self::Simplex];
}
pub trait BoundaryOperator<H: HostTypes> {
type ChainGroup: ChainGroup<H>;
fn source_group(&self) -> &Self::ChainGroup;
fn target_group(&self) -> &Self::ChainGroup;
fn satisfies_boundary_squared_zero(&self) -> bool;
}
pub trait ChainComplex<H: HostTypes> {
type ChainGroup: ChainGroup<H>;
fn has_chain_group(&self) -> &[Self::ChainGroup];
type BoundaryOperator: BoundaryOperator<H>;
fn has_boundary(&self) -> &[Self::BoundaryOperator];
}
pub trait HomologyGroup<H: HostTypes> {
fn homology_degree(&self) -> i64;
fn betti_number(&self) -> u64;
}
pub trait NerveFunctor<H: HostTypes> {}
pub trait ChainFunctor<H: HostTypes> {}
pub trait KanComplex<H: HostTypes>: SimplicialComplex<H> {
type HornFiller: HornFiller<H>;
fn kan_witness(&self) -> &[Self::HornFiller];
}
pub trait HornFiller<H: HostTypes> {
fn horn_dimension(&self) -> u64;
fn horn_position(&self) -> u64;
}
pub trait PostnikovTruncation<H: HostTypes> {
fn truncation_level(&self) -> u64;
type KanComplex: KanComplex<H>;
fn truncation_source(&self) -> &Self::KanComplex;
type KInvariant: KInvariant<H>;
fn k_invariant(&self) -> &Self::KInvariant;
}
pub trait KInvariant<H: HostTypes> {
fn k_invariant_trivial(&self) -> bool;
}
pub trait DeformationComplex<H: HostTypes>: ChainComplex<H> {
type CompleteType: crate::user::type_::CompleteType<H>;
fn deformation_base(&self) -> &Self::CompleteType;
fn tangent_dimension(&self) -> u64;
fn obstruction_dimension(&self) -> u64;
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullSimplex<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullSimplex<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullSimplex<H> {
pub const ABSENT: NullSimplex<H> = NullSimplex {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Simplex<H> for NullSimplex<H> {
fn dimension(&self) -> i64 {
0
}
type Constraint = crate::user::type_::NullConstraint<H>;
fn vertex(&self) -> &[Self::Constraint] {
&[]
}
fn vertex_count(&self) -> u64 {
0
}
type SimplexTarget = NullSimplex<H>;
fn is_face_of(&self) -> &[Self::SimplexTarget] {
&[]
}
type SiteIndex = crate::bridge::partition::NullSiteIndex<H>;
fn pin_intersection(&self) -> &[Self::SiteIndex] {
&[]
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullSimplicialComplex<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullSimplicialComplex<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullSimplicialComplex<H> {
pub const ABSENT: NullSimplicialComplex<H> = NullSimplicialComplex {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> SimplicialComplex<H> for NullSimplicialComplex<H> {
type Simplex = NullSimplex<H>;
fn has_simplex(&self) -> &[Self::Simplex] {
&[]
}
fn max_dimension(&self) -> i64 {
0
}
fn euler_characteristic(&self) -> i64 {
0
}
fn simplicial_vertex_count(&self) -> u64 {
0
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullFaceMap<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullFaceMap<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullFaceMap<H> {
pub const ABSENT: NullFaceMap<H> = NullFaceMap {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> FaceMap<H> for NullFaceMap<H> {
fn removes_vertex(&self) -> u64 {
0
}
type Simplex = NullSimplex<H>;
fn source_simplex(&self) -> &Self::Simplex {
&<NullSimplex<H>>::ABSENT
}
fn target_face(&self) -> &Self::Simplex {
&<NullSimplex<H>>::ABSENT
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullChainGroup<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullChainGroup<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullChainGroup<H> {
pub const ABSENT: NullChainGroup<H> = NullChainGroup {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> ChainGroup<H> for NullChainGroup<H> {
fn degree(&self) -> i64 {
0
}
type Simplex = NullSimplex<H>;
fn generated_by(&self) -> &[Self::Simplex] {
&[]
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullBoundaryOperator<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullBoundaryOperator<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullBoundaryOperator<H> {
pub const ABSENT: NullBoundaryOperator<H> = NullBoundaryOperator {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> BoundaryOperator<H> for NullBoundaryOperator<H> {
type ChainGroup = NullChainGroup<H>;
fn source_group(&self) -> &Self::ChainGroup {
&<NullChainGroup<H>>::ABSENT
}
fn target_group(&self) -> &Self::ChainGroup {
&<NullChainGroup<H>>::ABSENT
}
fn satisfies_boundary_squared_zero(&self) -> bool {
false
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullChainComplex<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullChainComplex<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullChainComplex<H> {
pub const ABSENT: NullChainComplex<H> = NullChainComplex {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> ChainComplex<H> for NullChainComplex<H> {
type ChainGroup = NullChainGroup<H>;
fn has_chain_group(&self) -> &[Self::ChainGroup] {
&[]
}
type BoundaryOperator = NullBoundaryOperator<H>;
fn has_boundary(&self) -> &[Self::BoundaryOperator] {
&[]
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullHomologyGroup<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullHomologyGroup<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullHomologyGroup<H> {
pub const ABSENT: NullHomologyGroup<H> = NullHomologyGroup {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> HomologyGroup<H> for NullHomologyGroup<H> {
fn homology_degree(&self) -> i64 {
0
}
fn betti_number(&self) -> u64 {
0
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullNerveFunctor<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullNerveFunctor<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullNerveFunctor<H> {
pub const ABSENT: NullNerveFunctor<H> = NullNerveFunctor {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> NerveFunctor<H> for NullNerveFunctor<H> {}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullChainFunctor<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullChainFunctor<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullChainFunctor<H> {
pub const ABSENT: NullChainFunctor<H> = NullChainFunctor {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> ChainFunctor<H> for NullChainFunctor<H> {}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullKanComplex<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullKanComplex<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullKanComplex<H> {
pub const ABSENT: NullKanComplex<H> = NullKanComplex {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> SimplicialComplex<H> for NullKanComplex<H> {
type Simplex = NullSimplex<H>;
fn has_simplex(&self) -> &[Self::Simplex] {
&[]
}
fn max_dimension(&self) -> i64 {
0
}
fn euler_characteristic(&self) -> i64 {
0
}
fn simplicial_vertex_count(&self) -> u64 {
0
}
}
impl<H: HostTypes> KanComplex<H> for NullKanComplex<H> {
type HornFiller = NullHornFiller<H>;
fn kan_witness(&self) -> &[Self::HornFiller] {
&[]
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullHornFiller<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullHornFiller<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullHornFiller<H> {
pub const ABSENT: NullHornFiller<H> = NullHornFiller {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> HornFiller<H> for NullHornFiller<H> {
fn horn_dimension(&self) -> u64 {
0
}
fn horn_position(&self) -> u64 {
0
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullPostnikovTruncation<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullPostnikovTruncation<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullPostnikovTruncation<H> {
pub const ABSENT: NullPostnikovTruncation<H> = NullPostnikovTruncation {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> PostnikovTruncation<H> for NullPostnikovTruncation<H> {
fn truncation_level(&self) -> u64 {
0
}
type KanComplex = NullKanComplex<H>;
fn truncation_source(&self) -> &Self::KanComplex {
&<NullKanComplex<H>>::ABSENT
}
type KInvariant = NullKInvariant<H>;
fn k_invariant(&self) -> &Self::KInvariant {
&<NullKInvariant<H>>::ABSENT
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullKInvariant<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullKInvariant<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullKInvariant<H> {
pub const ABSENT: NullKInvariant<H> = NullKInvariant {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> KInvariant<H> for NullKInvariant<H> {
fn k_invariant_trivial(&self) -> bool {
false
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullDeformationComplex<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullDeformationComplex<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullDeformationComplex<H> {
pub const ABSENT: NullDeformationComplex<H> = NullDeformationComplex {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> ChainComplex<H> for NullDeformationComplex<H> {
type ChainGroup = NullChainGroup<H>;
fn has_chain_group(&self) -> &[Self::ChainGroup] {
&[]
}
type BoundaryOperator = NullBoundaryOperator<H>;
fn has_boundary(&self) -> &[Self::BoundaryOperator] {
&[]
}
}
impl<H: HostTypes> DeformationComplex<H> for NullDeformationComplex<H> {
type CompleteType = crate::user::type_::NullCompleteType<H>;
fn deformation_base(&self) -> &Self::CompleteType {
&<crate::user::type_::NullCompleteType<H>>::ABSENT
}
fn tangent_dimension(&self) -> u64 {
0
}
fn obstruction_dimension(&self) -> u64 {
0
}
}
#[derive(Debug)]
pub struct SimplexHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for SimplexHandle<H> {}
impl<H: HostTypes> Clone for SimplexHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for SimplexHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for SimplexHandle<H> {}
impl<H: HostTypes> core::hash::Hash for SimplexHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> SimplexHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait SimplexResolver<H: HostTypes> {
fn resolve(&self, handle: SimplexHandle<H>) -> Option<SimplexRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct SimplexRecord<H: HostTypes> {
pub dimension: i64,
pub vertex_count: u64,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedSimplex<'r, R: SimplexResolver<H>, H: HostTypes> {
handle: SimplexHandle<H>,
resolver: &'r R,
record: Option<SimplexRecord<H>>,
}
impl<'r, R: SimplexResolver<H>, H: HostTypes> ResolvedSimplex<'r, R, H> {
#[inline]
pub fn new(handle: SimplexHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> SimplexHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&SimplexRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: SimplexResolver<H>, H: HostTypes> Simplex<H> for ResolvedSimplex<'r, R, H> {
fn dimension(&self) -> i64 {
match &self.record {
Some(r) => r.dimension,
None => 0,
}
}
type Constraint = crate::user::type_::NullConstraint<H>;
fn vertex(&self) -> &[Self::Constraint] {
&[]
}
fn vertex_count(&self) -> u64 {
match &self.record {
Some(r) => r.vertex_count,
None => 0,
}
}
type SimplexTarget = NullSimplex<H>;
fn is_face_of(&self) -> &[Self::SimplexTarget] {
&[]
}
type SiteIndex = crate::bridge::partition::NullSiteIndex<H>;
fn pin_intersection(&self) -> &[Self::SiteIndex] {
&[]
}
}
#[derive(Debug)]
pub struct SimplicialComplexHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for SimplicialComplexHandle<H> {}
impl<H: HostTypes> Clone for SimplicialComplexHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for SimplicialComplexHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for SimplicialComplexHandle<H> {}
impl<H: HostTypes> core::hash::Hash for SimplicialComplexHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> SimplicialComplexHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait SimplicialComplexResolver<H: HostTypes> {
fn resolve(&self, handle: SimplicialComplexHandle<H>) -> Option<SimplicialComplexRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct SimplicialComplexRecord<H: HostTypes> {
pub max_dimension: i64,
pub euler_characteristic: i64,
pub simplicial_vertex_count: u64,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedSimplicialComplex<'r, R: SimplicialComplexResolver<H>, H: HostTypes> {
handle: SimplicialComplexHandle<H>,
resolver: &'r R,
record: Option<SimplicialComplexRecord<H>>,
}
impl<'r, R: SimplicialComplexResolver<H>, H: HostTypes> ResolvedSimplicialComplex<'r, R, H> {
#[inline]
pub fn new(handle: SimplicialComplexHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> SimplicialComplexHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&SimplicialComplexRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: SimplicialComplexResolver<H>, H: HostTypes> SimplicialComplex<H>
for ResolvedSimplicialComplex<'r, R, H>
{
type Simplex = NullSimplex<H>;
fn has_simplex(&self) -> &[Self::Simplex] {
&[]
}
fn max_dimension(&self) -> i64 {
match &self.record {
Some(r) => r.max_dimension,
None => 0,
}
}
fn euler_characteristic(&self) -> i64 {
match &self.record {
Some(r) => r.euler_characteristic,
None => 0,
}
}
fn simplicial_vertex_count(&self) -> u64 {
match &self.record {
Some(r) => r.simplicial_vertex_count,
None => 0,
}
}
}
#[derive(Debug)]
pub struct FaceMapHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for FaceMapHandle<H> {}
impl<H: HostTypes> Clone for FaceMapHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for FaceMapHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for FaceMapHandle<H> {}
impl<H: HostTypes> core::hash::Hash for FaceMapHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> FaceMapHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait FaceMapResolver<H: HostTypes> {
fn resolve(&self, handle: FaceMapHandle<H>) -> Option<FaceMapRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct FaceMapRecord<H: HostTypes> {
pub removes_vertex: u64,
pub source_simplex_handle: SimplexHandle<H>,
pub target_face_handle: SimplexHandle<H>,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedFaceMap<'r, R: FaceMapResolver<H>, H: HostTypes> {
handle: FaceMapHandle<H>,
resolver: &'r R,
record: Option<FaceMapRecord<H>>,
}
impl<'r, R: FaceMapResolver<H>, H: HostTypes> ResolvedFaceMap<'r, R, H> {
#[inline]
pub fn new(handle: FaceMapHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> FaceMapHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&FaceMapRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: FaceMapResolver<H>, H: HostTypes> FaceMap<H> for ResolvedFaceMap<'r, R, H> {
fn removes_vertex(&self) -> u64 {
match &self.record {
Some(r) => r.removes_vertex,
None => 0,
}
}
type Simplex = NullSimplex<H>;
fn source_simplex(&self) -> &Self::Simplex {
&<NullSimplex<H>>::ABSENT
}
fn target_face(&self) -> &Self::Simplex {
&<NullSimplex<H>>::ABSENT
}
}
impl<'r, R: FaceMapResolver<H>, H: HostTypes> ResolvedFaceMap<'r, R, H> {
#[inline]
pub fn resolve_source_simplex<'r2, R2: SimplexResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<ResolvedSimplex<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(ResolvedSimplex::new(record.source_simplex_handle, r))
}
#[inline]
pub fn resolve_target_face<'r2, R2: SimplexResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<ResolvedSimplex<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(ResolvedSimplex::new(record.target_face_handle, r))
}
}
#[derive(Debug)]
pub struct ChainGroupHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for ChainGroupHandle<H> {}
impl<H: HostTypes> Clone for ChainGroupHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for ChainGroupHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for ChainGroupHandle<H> {}
impl<H: HostTypes> core::hash::Hash for ChainGroupHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> ChainGroupHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait ChainGroupResolver<H: HostTypes> {
fn resolve(&self, handle: ChainGroupHandle<H>) -> Option<ChainGroupRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct ChainGroupRecord<H: HostTypes> {
pub degree: i64,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedChainGroup<'r, R: ChainGroupResolver<H>, H: HostTypes> {
handle: ChainGroupHandle<H>,
resolver: &'r R,
record: Option<ChainGroupRecord<H>>,
}
impl<'r, R: ChainGroupResolver<H>, H: HostTypes> ResolvedChainGroup<'r, R, H> {
#[inline]
pub fn new(handle: ChainGroupHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> ChainGroupHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&ChainGroupRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: ChainGroupResolver<H>, H: HostTypes> ChainGroup<H> for ResolvedChainGroup<'r, R, H> {
fn degree(&self) -> i64 {
match &self.record {
Some(r) => r.degree,
None => 0,
}
}
type Simplex = NullSimplex<H>;
fn generated_by(&self) -> &[Self::Simplex] {
&[]
}
}
#[derive(Debug)]
pub struct BoundaryOperatorHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for BoundaryOperatorHandle<H> {}
impl<H: HostTypes> Clone for BoundaryOperatorHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for BoundaryOperatorHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for BoundaryOperatorHandle<H> {}
impl<H: HostTypes> core::hash::Hash for BoundaryOperatorHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> BoundaryOperatorHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait BoundaryOperatorResolver<H: HostTypes> {
fn resolve(&self, handle: BoundaryOperatorHandle<H>) -> Option<BoundaryOperatorRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct BoundaryOperatorRecord<H: HostTypes> {
pub source_group_handle: ChainGroupHandle<H>,
pub target_group_handle: ChainGroupHandle<H>,
pub satisfies_boundary_squared_zero: bool,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedBoundaryOperator<'r, R: BoundaryOperatorResolver<H>, H: HostTypes> {
handle: BoundaryOperatorHandle<H>,
resolver: &'r R,
record: Option<BoundaryOperatorRecord<H>>,
}
impl<'r, R: BoundaryOperatorResolver<H>, H: HostTypes> ResolvedBoundaryOperator<'r, R, H> {
#[inline]
pub fn new(handle: BoundaryOperatorHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> BoundaryOperatorHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&BoundaryOperatorRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: BoundaryOperatorResolver<H>, H: HostTypes> BoundaryOperator<H>
for ResolvedBoundaryOperator<'r, R, H>
{
type ChainGroup = NullChainGroup<H>;
fn source_group(&self) -> &Self::ChainGroup {
&<NullChainGroup<H>>::ABSENT
}
fn target_group(&self) -> &Self::ChainGroup {
&<NullChainGroup<H>>::ABSENT
}
fn satisfies_boundary_squared_zero(&self) -> bool {
match &self.record {
Some(r) => r.satisfies_boundary_squared_zero,
None => false,
}
}
}
impl<'r, R: BoundaryOperatorResolver<H>, H: HostTypes> ResolvedBoundaryOperator<'r, R, H> {
#[inline]
pub fn resolve_source_group<'r2, R2: ChainGroupResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<ResolvedChainGroup<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(ResolvedChainGroup::new(record.source_group_handle, r))
}
#[inline]
pub fn resolve_target_group<'r2, R2: ChainGroupResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<ResolvedChainGroup<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(ResolvedChainGroup::new(record.target_group_handle, r))
}
}
#[derive(Debug)]
pub struct ChainComplexHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for ChainComplexHandle<H> {}
impl<H: HostTypes> Clone for ChainComplexHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for ChainComplexHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for ChainComplexHandle<H> {}
impl<H: HostTypes> core::hash::Hash for ChainComplexHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> ChainComplexHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait ChainComplexResolver<H: HostTypes> {
fn resolve(&self, handle: ChainComplexHandle<H>) -> Option<ChainComplexRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct ChainComplexRecord<H: HostTypes> {
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedChainComplex<'r, R: ChainComplexResolver<H>, H: HostTypes> {
handle: ChainComplexHandle<H>,
resolver: &'r R,
record: Option<ChainComplexRecord<H>>,
}
impl<'r, R: ChainComplexResolver<H>, H: HostTypes> ResolvedChainComplex<'r, R, H> {
#[inline]
pub fn new(handle: ChainComplexHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> ChainComplexHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&ChainComplexRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: ChainComplexResolver<H>, H: HostTypes> ChainComplex<H>
for ResolvedChainComplex<'r, R, H>
{
type ChainGroup = NullChainGroup<H>;
fn has_chain_group(&self) -> &[Self::ChainGroup] {
&[]
}
type BoundaryOperator = NullBoundaryOperator<H>;
fn has_boundary(&self) -> &[Self::BoundaryOperator] {
&[]
}
}
#[derive(Debug)]
pub struct HomologyGroupHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for HomologyGroupHandle<H> {}
impl<H: HostTypes> Clone for HomologyGroupHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for HomologyGroupHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for HomologyGroupHandle<H> {}
impl<H: HostTypes> core::hash::Hash for HomologyGroupHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> HomologyGroupHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait HomologyGroupResolver<H: HostTypes> {
fn resolve(&self, handle: HomologyGroupHandle<H>) -> Option<HomologyGroupRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct HomologyGroupRecord<H: HostTypes> {
pub homology_degree: i64,
pub betti_number: u64,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedHomologyGroup<'r, R: HomologyGroupResolver<H>, H: HostTypes> {
handle: HomologyGroupHandle<H>,
resolver: &'r R,
record: Option<HomologyGroupRecord<H>>,
}
impl<'r, R: HomologyGroupResolver<H>, H: HostTypes> ResolvedHomologyGroup<'r, R, H> {
#[inline]
pub fn new(handle: HomologyGroupHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> HomologyGroupHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&HomologyGroupRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: HomologyGroupResolver<H>, H: HostTypes> HomologyGroup<H>
for ResolvedHomologyGroup<'r, R, H>
{
fn homology_degree(&self) -> i64 {
match &self.record {
Some(r) => r.homology_degree,
None => 0,
}
}
fn betti_number(&self) -> u64 {
match &self.record {
Some(r) => r.betti_number,
None => 0,
}
}
}
#[derive(Debug)]
pub struct NerveFunctorHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for NerveFunctorHandle<H> {}
impl<H: HostTypes> Clone for NerveFunctorHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for NerveFunctorHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for NerveFunctorHandle<H> {}
impl<H: HostTypes> core::hash::Hash for NerveFunctorHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> NerveFunctorHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait NerveFunctorResolver<H: HostTypes> {
fn resolve(&self, handle: NerveFunctorHandle<H>) -> Option<NerveFunctorRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct NerveFunctorRecord<H: HostTypes> {
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedNerveFunctor<'r, R: NerveFunctorResolver<H>, H: HostTypes> {
handle: NerveFunctorHandle<H>,
resolver: &'r R,
record: Option<NerveFunctorRecord<H>>,
}
impl<'r, R: NerveFunctorResolver<H>, H: HostTypes> ResolvedNerveFunctor<'r, R, H> {
#[inline]
pub fn new(handle: NerveFunctorHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> NerveFunctorHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&NerveFunctorRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: NerveFunctorResolver<H>, H: HostTypes> NerveFunctor<H>
for ResolvedNerveFunctor<'r, R, H>
{
}
#[derive(Debug)]
pub struct ChainFunctorHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for ChainFunctorHandle<H> {}
impl<H: HostTypes> Clone for ChainFunctorHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for ChainFunctorHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for ChainFunctorHandle<H> {}
impl<H: HostTypes> core::hash::Hash for ChainFunctorHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> ChainFunctorHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait ChainFunctorResolver<H: HostTypes> {
fn resolve(&self, handle: ChainFunctorHandle<H>) -> Option<ChainFunctorRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct ChainFunctorRecord<H: HostTypes> {
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedChainFunctor<'r, R: ChainFunctorResolver<H>, H: HostTypes> {
handle: ChainFunctorHandle<H>,
resolver: &'r R,
record: Option<ChainFunctorRecord<H>>,
}
impl<'r, R: ChainFunctorResolver<H>, H: HostTypes> ResolvedChainFunctor<'r, R, H> {
#[inline]
pub fn new(handle: ChainFunctorHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> ChainFunctorHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&ChainFunctorRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: ChainFunctorResolver<H>, H: HostTypes> ChainFunctor<H>
for ResolvedChainFunctor<'r, R, H>
{
}
#[derive(Debug)]
pub struct KanComplexHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for KanComplexHandle<H> {}
impl<H: HostTypes> Clone for KanComplexHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for KanComplexHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for KanComplexHandle<H> {}
impl<H: HostTypes> core::hash::Hash for KanComplexHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> KanComplexHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait KanComplexResolver<H: HostTypes> {
fn resolve(&self, handle: KanComplexHandle<H>) -> Option<KanComplexRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct KanComplexRecord<H: HostTypes> {
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedKanComplex<'r, R: KanComplexResolver<H>, H: HostTypes> {
handle: KanComplexHandle<H>,
resolver: &'r R,
record: Option<KanComplexRecord<H>>,
}
impl<'r, R: KanComplexResolver<H>, H: HostTypes> ResolvedKanComplex<'r, R, H> {
#[inline]
pub fn new(handle: KanComplexHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> KanComplexHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&KanComplexRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: KanComplexResolver<H>, H: HostTypes> SimplicialComplex<H>
for ResolvedKanComplex<'r, R, H>
{
type Simplex = NullSimplex<H>;
fn has_simplex(&self) -> &[Self::Simplex] {
&[]
}
fn max_dimension(&self) -> i64 {
0
}
fn euler_characteristic(&self) -> i64 {
0
}
fn simplicial_vertex_count(&self) -> u64 {
0
}
}
impl<'r, R: KanComplexResolver<H>, H: HostTypes> KanComplex<H> for ResolvedKanComplex<'r, R, H> {
type HornFiller = NullHornFiller<H>;
fn kan_witness(&self) -> &[Self::HornFiller] {
&[]
}
}
#[derive(Debug)]
pub struct HornFillerHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for HornFillerHandle<H> {}
impl<H: HostTypes> Clone for HornFillerHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for HornFillerHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for HornFillerHandle<H> {}
impl<H: HostTypes> core::hash::Hash for HornFillerHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> HornFillerHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait HornFillerResolver<H: HostTypes> {
fn resolve(&self, handle: HornFillerHandle<H>) -> Option<HornFillerRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct HornFillerRecord<H: HostTypes> {
pub horn_dimension: u64,
pub horn_position: u64,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedHornFiller<'r, R: HornFillerResolver<H>, H: HostTypes> {
handle: HornFillerHandle<H>,
resolver: &'r R,
record: Option<HornFillerRecord<H>>,
}
impl<'r, R: HornFillerResolver<H>, H: HostTypes> ResolvedHornFiller<'r, R, H> {
#[inline]
pub fn new(handle: HornFillerHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> HornFillerHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&HornFillerRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: HornFillerResolver<H>, H: HostTypes> HornFiller<H> for ResolvedHornFiller<'r, R, H> {
fn horn_dimension(&self) -> u64 {
match &self.record {
Some(r) => r.horn_dimension,
None => 0,
}
}
fn horn_position(&self) -> u64 {
match &self.record {
Some(r) => r.horn_position,
None => 0,
}
}
}
#[derive(Debug)]
pub struct PostnikovTruncationHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for PostnikovTruncationHandle<H> {}
impl<H: HostTypes> Clone for PostnikovTruncationHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for PostnikovTruncationHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for PostnikovTruncationHandle<H> {}
impl<H: HostTypes> core::hash::Hash for PostnikovTruncationHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> PostnikovTruncationHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait PostnikovTruncationResolver<H: HostTypes> {
fn resolve(&self, handle: PostnikovTruncationHandle<H>)
-> Option<PostnikovTruncationRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct PostnikovTruncationRecord<H: HostTypes> {
pub truncation_level: u64,
pub truncation_source_handle: KanComplexHandle<H>,
pub k_invariant_handle: KInvariantHandle<H>,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedPostnikovTruncation<'r, R: PostnikovTruncationResolver<H>, H: HostTypes> {
handle: PostnikovTruncationHandle<H>,
resolver: &'r R,
record: Option<PostnikovTruncationRecord<H>>,
}
impl<'r, R: PostnikovTruncationResolver<H>, H: HostTypes> ResolvedPostnikovTruncation<'r, R, H> {
#[inline]
pub fn new(handle: PostnikovTruncationHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> PostnikovTruncationHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&PostnikovTruncationRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: PostnikovTruncationResolver<H>, H: HostTypes> PostnikovTruncation<H>
for ResolvedPostnikovTruncation<'r, R, H>
{
fn truncation_level(&self) -> u64 {
match &self.record {
Some(r) => r.truncation_level,
None => 0,
}
}
type KanComplex = NullKanComplex<H>;
fn truncation_source(&self) -> &Self::KanComplex {
&<NullKanComplex<H>>::ABSENT
}
type KInvariant = NullKInvariant<H>;
fn k_invariant(&self) -> &Self::KInvariant {
&<NullKInvariant<H>>::ABSENT
}
}
impl<'r, R: PostnikovTruncationResolver<H>, H: HostTypes> ResolvedPostnikovTruncation<'r, R, H> {
#[inline]
pub fn resolve_truncation_source<'r2, R2: KanComplexResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<ResolvedKanComplex<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(ResolvedKanComplex::new(record.truncation_source_handle, r))
}
#[inline]
pub fn resolve_k_invariant<'r2, R2: KInvariantResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<ResolvedKInvariant<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(ResolvedKInvariant::new(record.k_invariant_handle, r))
}
}
#[derive(Debug)]
pub struct KInvariantHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for KInvariantHandle<H> {}
impl<H: HostTypes> Clone for KInvariantHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for KInvariantHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for KInvariantHandle<H> {}
impl<H: HostTypes> core::hash::Hash for KInvariantHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> KInvariantHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait KInvariantResolver<H: HostTypes> {
fn resolve(&self, handle: KInvariantHandle<H>) -> Option<KInvariantRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct KInvariantRecord<H: HostTypes> {
pub k_invariant_trivial: bool,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedKInvariant<'r, R: KInvariantResolver<H>, H: HostTypes> {
handle: KInvariantHandle<H>,
resolver: &'r R,
record: Option<KInvariantRecord<H>>,
}
impl<'r, R: KInvariantResolver<H>, H: HostTypes> ResolvedKInvariant<'r, R, H> {
#[inline]
pub fn new(handle: KInvariantHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> KInvariantHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&KInvariantRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: KInvariantResolver<H>, H: HostTypes> KInvariant<H> for ResolvedKInvariant<'r, R, H> {
fn k_invariant_trivial(&self) -> bool {
match &self.record {
Some(r) => r.k_invariant_trivial,
None => false,
}
}
}
#[derive(Debug)]
pub struct DeformationComplexHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for DeformationComplexHandle<H> {}
impl<H: HostTypes> Clone for DeformationComplexHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for DeformationComplexHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for DeformationComplexHandle<H> {}
impl<H: HostTypes> core::hash::Hash for DeformationComplexHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> DeformationComplexHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait DeformationComplexResolver<H: HostTypes> {
fn resolve(&self, handle: DeformationComplexHandle<H>) -> Option<DeformationComplexRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct DeformationComplexRecord<H: HostTypes> {
pub deformation_base_handle: crate::user::type_::CompleteTypeHandle<H>,
pub tangent_dimension: u64,
pub obstruction_dimension: u64,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedDeformationComplex<'r, R: DeformationComplexResolver<H>, H: HostTypes> {
handle: DeformationComplexHandle<H>,
resolver: &'r R,
record: Option<DeformationComplexRecord<H>>,
}
impl<'r, R: DeformationComplexResolver<H>, H: HostTypes> ResolvedDeformationComplex<'r, R, H> {
#[inline]
pub fn new(handle: DeformationComplexHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> DeformationComplexHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&DeformationComplexRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: DeformationComplexResolver<H>, H: HostTypes> ChainComplex<H>
for ResolvedDeformationComplex<'r, R, H>
{
type ChainGroup = NullChainGroup<H>;
fn has_chain_group(&self) -> &[Self::ChainGroup] {
&[]
}
type BoundaryOperator = NullBoundaryOperator<H>;
fn has_boundary(&self) -> &[Self::BoundaryOperator] {
&[]
}
}
impl<'r, R: DeformationComplexResolver<H>, H: HostTypes> DeformationComplex<H>
for ResolvedDeformationComplex<'r, R, H>
{
type CompleteType = crate::user::type_::NullCompleteType<H>;
fn deformation_base(&self) -> &Self::CompleteType {
&<crate::user::type_::NullCompleteType<H>>::ABSENT
}
fn tangent_dimension(&self) -> u64 {
match &self.record {
Some(r) => r.tangent_dimension,
None => 0,
}
}
fn obstruction_dimension(&self) -> u64 {
match &self.record {
Some(r) => r.obstruction_dimension,
None => 0,
}
}
}
impl<'r, R: DeformationComplexResolver<H>, H: HostTypes> ResolvedDeformationComplex<'r, R, H> {
#[inline]
pub fn resolve_deformation_base<'r2, R2: crate::user::type_::CompleteTypeResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::user::type_::ResolvedCompleteType<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::user::type_::ResolvedCompleteType::new(
record.deformation_base_handle,
r,
))
}
}
pub mod boundary_squared_zero {
pub const FOR_ALL: &str = "https://uor.foundation/schema/term_boundarySquaredZero_forAll";
pub const LHS: &str = "https://uor.foundation/schema/term_boundarySquaredZero_lhs";
pub const RHS: &str = "https://uor.foundation/schema/term_boundarySquaredZero_rhs";
pub const VERIFICATION_DOMAIN: &str = "https://uor.foundation/op/Topological";
}
pub mod nerve_functor_n {}
pub mod chain_functor_c {}
pub mod psi_4 {
pub const FOR_ALL: &str = "https://uor.foundation/schema/term_psi_4_forAll";
pub const LHS: &str = "https://uor.foundation/schema/term_psi_4_lhs";
pub const RHS: &str = "https://uor.foundation/schema/term_psi_4_rhs";
pub const VERIFICATION_DOMAIN: &str = "https://uor.foundation/op/Topological";
}
pub mod index_bridge {
pub const FOR_ALL: &str = "https://uor.foundation/schema/term_indexBridge_forAll";
pub const LHS: &str = "https://uor.foundation/schema/term_indexBridge_lhs";
pub const RHS: &str = "https://uor.foundation/schema/term_indexBridge_rhs";
pub const VERIFICATION_DOMAIN: &str = "https://uor.foundation/op/Topological";
}