1use crate::HostTypes;
8
9pub trait ConvergenceLevel<H: HostTypes> {
11 fn algebra_dimension(&self) -> u64;
13 fn betti_signature(&self) -> &H::HostString;
15 type HopfFiber: HopfFiber<H>;
17 fn fiber_type(&self) -> &Self::HopfFiber;
19 fn characteristic_identity(&self) -> &H::HostString;
21 fn level_name(&self) -> &H::HostString;
23}
24
25pub trait HopfFiber<H: HostTypes> {
27 fn fiber_dimension(&self) -> u64;
29 fn total_space(&self) -> &H::HostString;
31 fn base_space(&self) -> &H::HostString;
33 fn fiber_sphere(&self) -> &H::HostString;
35}
36
37pub trait ConvergenceResidual<H: HostTypes> {
39 fn residual_betti(&self) -> u64;
41 fn residual_dimension(&self) -> u64;
43}
44
45pub trait CommutativeSubspace<H: HostTypes> {
47 type CommutativeSubspaceTarget: CommutativeSubspace<H>;
49 fn subspace_ref(&self) -> &Self::CommutativeSubspaceTarget;
51 type Commutator: crate::bridge::observable::Commutator<H>;
53 fn commutator_ref(&self) -> &Self::Commutator;
55}
56
57pub trait AssociativeSubalgebra<H: HostTypes> {
59 type AssociativeSubalgebraTarget: AssociativeSubalgebra<H>;
61 fn subalgebra_ref(&self) -> &Self::AssociativeSubalgebraTarget;
63 type AssociatorTriple: crate::bridge::interaction::AssociatorTriple<H>;
65 fn associator_ref(&self) -> &Self::AssociatorTriple;
67}
68
69#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
75pub struct NullConvergenceLevel<H: HostTypes> {
76 _phantom: core::marker::PhantomData<H>,
77}
78impl<H: HostTypes> Default for NullConvergenceLevel<H> {
79 fn default() -> Self {
80 Self {
81 _phantom: core::marker::PhantomData,
82 }
83 }
84}
85impl<H: HostTypes> NullConvergenceLevel<H> {
86 pub const ABSENT: NullConvergenceLevel<H> = NullConvergenceLevel {
88 _phantom: core::marker::PhantomData,
89 };
90}
91impl<H: HostTypes> ConvergenceLevel<H> for NullConvergenceLevel<H> {
92 fn algebra_dimension(&self) -> u64 {
93 0
94 }
95 fn betti_signature(&self) -> &H::HostString {
96 H::EMPTY_HOST_STRING
97 }
98 type HopfFiber = NullHopfFiber<H>;
99 fn fiber_type(&self) -> &Self::HopfFiber {
100 &<NullHopfFiber<H>>::ABSENT
101 }
102 fn characteristic_identity(&self) -> &H::HostString {
103 H::EMPTY_HOST_STRING
104 }
105 fn level_name(&self) -> &H::HostString {
106 H::EMPTY_HOST_STRING
107 }
108}
109
110#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
116pub struct NullHopfFiber<H: HostTypes> {
117 _phantom: core::marker::PhantomData<H>,
118}
119impl<H: HostTypes> Default for NullHopfFiber<H> {
120 fn default() -> Self {
121 Self {
122 _phantom: core::marker::PhantomData,
123 }
124 }
125}
126impl<H: HostTypes> NullHopfFiber<H> {
127 pub const ABSENT: NullHopfFiber<H> = NullHopfFiber {
129 _phantom: core::marker::PhantomData,
130 };
131}
132impl<H: HostTypes> HopfFiber<H> for NullHopfFiber<H> {
133 fn fiber_dimension(&self) -> u64 {
134 0
135 }
136 fn total_space(&self) -> &H::HostString {
137 H::EMPTY_HOST_STRING
138 }
139 fn base_space(&self) -> &H::HostString {
140 H::EMPTY_HOST_STRING
141 }
142 fn fiber_sphere(&self) -> &H::HostString {
143 H::EMPTY_HOST_STRING
144 }
145}
146
147#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
153pub struct NullConvergenceResidual<H: HostTypes> {
154 _phantom: core::marker::PhantomData<H>,
155}
156impl<H: HostTypes> Default for NullConvergenceResidual<H> {
157 fn default() -> Self {
158 Self {
159 _phantom: core::marker::PhantomData,
160 }
161 }
162}
163impl<H: HostTypes> NullConvergenceResidual<H> {
164 pub const ABSENT: NullConvergenceResidual<H> = NullConvergenceResidual {
166 _phantom: core::marker::PhantomData,
167 };
168}
169impl<H: HostTypes> ConvergenceResidual<H> for NullConvergenceResidual<H> {
170 fn residual_betti(&self) -> u64 {
171 0
172 }
173 fn residual_dimension(&self) -> u64 {
174 0
175 }
176}
177
178#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
184pub struct NullCommutativeSubspace<H: HostTypes> {
185 _phantom: core::marker::PhantomData<H>,
186}
187impl<H: HostTypes> Default for NullCommutativeSubspace<H> {
188 fn default() -> Self {
189 Self {
190 _phantom: core::marker::PhantomData,
191 }
192 }
193}
194impl<H: HostTypes> NullCommutativeSubspace<H> {
195 pub const ABSENT: NullCommutativeSubspace<H> = NullCommutativeSubspace {
197 _phantom: core::marker::PhantomData,
198 };
199}
200impl<H: HostTypes> CommutativeSubspace<H> for NullCommutativeSubspace<H> {
201 type CommutativeSubspaceTarget = NullCommutativeSubspace<H>;
202 fn subspace_ref(&self) -> &Self::CommutativeSubspaceTarget {
203 &<NullCommutativeSubspace<H>>::ABSENT
204 }
205 type Commutator = crate::bridge::observable::NullCommutator<H>;
206 fn commutator_ref(&self) -> &Self::Commutator {
207 &<crate::bridge::observable::NullCommutator<H>>::ABSENT
208 }
209}
210
211#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
217pub struct NullAssociativeSubalgebra<H: HostTypes> {
218 _phantom: core::marker::PhantomData<H>,
219}
220impl<H: HostTypes> Default for NullAssociativeSubalgebra<H> {
221 fn default() -> Self {
222 Self {
223 _phantom: core::marker::PhantomData,
224 }
225 }
226}
227impl<H: HostTypes> NullAssociativeSubalgebra<H> {
228 pub const ABSENT: NullAssociativeSubalgebra<H> = NullAssociativeSubalgebra {
230 _phantom: core::marker::PhantomData,
231 };
232}
233impl<H: HostTypes> AssociativeSubalgebra<H> for NullAssociativeSubalgebra<H> {
234 type AssociativeSubalgebraTarget = NullAssociativeSubalgebra<H>;
235 fn subalgebra_ref(&self) -> &Self::AssociativeSubalgebraTarget {
236 &<NullAssociativeSubalgebra<H>>::ABSENT
237 }
238 type AssociatorTriple = crate::bridge::interaction::NullAssociatorTriple<H>;
239 fn associator_ref(&self) -> &Self::AssociatorTriple {
240 &<crate::bridge::interaction::NullAssociatorTriple<H>>::ABSENT
241 }
242}
243
244#[derive(Debug)]
249pub struct ConvergenceLevelHandle<H: HostTypes> {
250 pub fingerprint: crate::enforcement::ContentFingerprint,
252 _phantom: core::marker::PhantomData<H>,
253}
254impl<H: HostTypes> Copy for ConvergenceLevelHandle<H> {}
255impl<H: HostTypes> Clone for ConvergenceLevelHandle<H> {
256 #[inline]
257 fn clone(&self) -> Self {
258 *self
259 }
260}
261impl<H: HostTypes> PartialEq for ConvergenceLevelHandle<H> {
262 #[inline]
263 fn eq(&self, other: &Self) -> bool {
264 self.fingerprint == other.fingerprint
265 }
266}
267impl<H: HostTypes> Eq for ConvergenceLevelHandle<H> {}
268impl<H: HostTypes> core::hash::Hash for ConvergenceLevelHandle<H> {
269 #[inline]
270 fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
271 self.fingerprint.hash(state);
272 }
273}
274impl<H: HostTypes> ConvergenceLevelHandle<H> {
275 #[inline]
277 #[must_use]
278 pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
279 Self {
280 fingerprint,
281 _phantom: core::marker::PhantomData,
282 }
283 }
284}
285
286pub trait ConvergenceLevelResolver<H: HostTypes> {
292 fn resolve(&self, handle: ConvergenceLevelHandle<H>) -> Option<ConvergenceLevelRecord<H>>;
295}
296
297#[derive(Clone, Debug, PartialEq, Eq, Hash)]
303pub struct ConvergenceLevelRecord<H: HostTypes> {
304 pub algebra_dimension: u64,
305 pub betti_signature: &'static H::HostString,
306 pub fiber_type_handle: HopfFiberHandle<H>,
307 pub characteristic_identity: &'static H::HostString,
308 pub level_name: &'static H::HostString,
309 #[doc(hidden)]
310 pub _phantom: core::marker::PhantomData<H>,
311}
312
313pub struct ResolvedConvergenceLevel<'r, R: ConvergenceLevelResolver<H>, H: HostTypes> {
321 handle: ConvergenceLevelHandle<H>,
322 resolver: &'r R,
323 record: Option<ConvergenceLevelRecord<H>>,
324}
325impl<'r, R: ConvergenceLevelResolver<H>, H: HostTypes> ResolvedConvergenceLevel<'r, R, H> {
326 #[inline]
328 pub fn new(handle: ConvergenceLevelHandle<H>, resolver: &'r R) -> Self {
329 let record = resolver.resolve(handle);
330 Self {
331 handle,
332 resolver,
333 record,
334 }
335 }
336 #[inline]
338 #[must_use]
339 pub const fn handle(&self) -> ConvergenceLevelHandle<H> {
340 self.handle
341 }
342 #[inline]
344 #[must_use]
345 pub const fn resolver(&self) -> &'r R {
346 self.resolver
347 }
348 #[inline]
350 #[must_use]
351 pub const fn record(&self) -> Option<&ConvergenceLevelRecord<H>> {
352 self.record.as_ref()
353 }
354}
355impl<'r, R: ConvergenceLevelResolver<H>, H: HostTypes> ConvergenceLevel<H>
356 for ResolvedConvergenceLevel<'r, R, H>
357{
358 fn algebra_dimension(&self) -> u64 {
359 match &self.record {
360 Some(r) => r.algebra_dimension,
361 None => 0,
362 }
363 }
364 fn betti_signature(&self) -> &H::HostString {
365 match &self.record {
366 Some(r) => r.betti_signature,
367 None => H::EMPTY_HOST_STRING,
368 }
369 }
370 type HopfFiber = NullHopfFiber<H>;
371 fn fiber_type(&self) -> &Self::HopfFiber {
372 &<NullHopfFiber<H>>::ABSENT
373 }
374 fn characteristic_identity(&self) -> &H::HostString {
375 match &self.record {
376 Some(r) => r.characteristic_identity,
377 None => H::EMPTY_HOST_STRING,
378 }
379 }
380 fn level_name(&self) -> &H::HostString {
381 match &self.record {
382 Some(r) => r.level_name,
383 None => H::EMPTY_HOST_STRING,
384 }
385 }
386}
387impl<'r, R: ConvergenceLevelResolver<H>, H: HostTypes> ResolvedConvergenceLevel<'r, R, H> {
388 #[inline]
392 pub fn resolve_fiber_type<'r2, R2: HopfFiberResolver<H>>(
393 &self,
394 r: &'r2 R2,
395 ) -> Option<ResolvedHopfFiber<'r2, R2, H>> {
396 let record = self.record.as_ref()?;
397 Some(ResolvedHopfFiber::new(record.fiber_type_handle, r))
398 }
399}
400
401#[derive(Debug)]
406pub struct HopfFiberHandle<H: HostTypes> {
407 pub fingerprint: crate::enforcement::ContentFingerprint,
409 _phantom: core::marker::PhantomData<H>,
410}
411impl<H: HostTypes> Copy for HopfFiberHandle<H> {}
412impl<H: HostTypes> Clone for HopfFiberHandle<H> {
413 #[inline]
414 fn clone(&self) -> Self {
415 *self
416 }
417}
418impl<H: HostTypes> PartialEq for HopfFiberHandle<H> {
419 #[inline]
420 fn eq(&self, other: &Self) -> bool {
421 self.fingerprint == other.fingerprint
422 }
423}
424impl<H: HostTypes> Eq for HopfFiberHandle<H> {}
425impl<H: HostTypes> core::hash::Hash for HopfFiberHandle<H> {
426 #[inline]
427 fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
428 self.fingerprint.hash(state);
429 }
430}
431impl<H: HostTypes> HopfFiberHandle<H> {
432 #[inline]
434 #[must_use]
435 pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
436 Self {
437 fingerprint,
438 _phantom: core::marker::PhantomData,
439 }
440 }
441}
442
443pub trait HopfFiberResolver<H: HostTypes> {
449 fn resolve(&self, handle: HopfFiberHandle<H>) -> Option<HopfFiberRecord<H>>;
452}
453
454#[derive(Clone, Debug, PartialEq, Eq, Hash)]
460pub struct HopfFiberRecord<H: HostTypes> {
461 pub fiber_dimension: u64,
462 pub total_space: &'static H::HostString,
463 pub base_space: &'static H::HostString,
464 pub fiber_sphere: &'static H::HostString,
465 #[doc(hidden)]
466 pub _phantom: core::marker::PhantomData<H>,
467}
468
469pub struct ResolvedHopfFiber<'r, R: HopfFiberResolver<H>, H: HostTypes> {
477 handle: HopfFiberHandle<H>,
478 resolver: &'r R,
479 record: Option<HopfFiberRecord<H>>,
480}
481impl<'r, R: HopfFiberResolver<H>, H: HostTypes> ResolvedHopfFiber<'r, R, H> {
482 #[inline]
484 pub fn new(handle: HopfFiberHandle<H>, resolver: &'r R) -> Self {
485 let record = resolver.resolve(handle);
486 Self {
487 handle,
488 resolver,
489 record,
490 }
491 }
492 #[inline]
494 #[must_use]
495 pub const fn handle(&self) -> HopfFiberHandle<H> {
496 self.handle
497 }
498 #[inline]
500 #[must_use]
501 pub const fn resolver(&self) -> &'r R {
502 self.resolver
503 }
504 #[inline]
506 #[must_use]
507 pub const fn record(&self) -> Option<&HopfFiberRecord<H>> {
508 self.record.as_ref()
509 }
510}
511impl<'r, R: HopfFiberResolver<H>, H: HostTypes> HopfFiber<H> for ResolvedHopfFiber<'r, R, H> {
512 fn fiber_dimension(&self) -> u64 {
513 match &self.record {
514 Some(r) => r.fiber_dimension,
515 None => 0,
516 }
517 }
518 fn total_space(&self) -> &H::HostString {
519 match &self.record {
520 Some(r) => r.total_space,
521 None => H::EMPTY_HOST_STRING,
522 }
523 }
524 fn base_space(&self) -> &H::HostString {
525 match &self.record {
526 Some(r) => r.base_space,
527 None => H::EMPTY_HOST_STRING,
528 }
529 }
530 fn fiber_sphere(&self) -> &H::HostString {
531 match &self.record {
532 Some(r) => r.fiber_sphere,
533 None => H::EMPTY_HOST_STRING,
534 }
535 }
536}
537
538#[derive(Debug)]
543pub struct ConvergenceResidualHandle<H: HostTypes> {
544 pub fingerprint: crate::enforcement::ContentFingerprint,
546 _phantom: core::marker::PhantomData<H>,
547}
548impl<H: HostTypes> Copy for ConvergenceResidualHandle<H> {}
549impl<H: HostTypes> Clone for ConvergenceResidualHandle<H> {
550 #[inline]
551 fn clone(&self) -> Self {
552 *self
553 }
554}
555impl<H: HostTypes> PartialEq for ConvergenceResidualHandle<H> {
556 #[inline]
557 fn eq(&self, other: &Self) -> bool {
558 self.fingerprint == other.fingerprint
559 }
560}
561impl<H: HostTypes> Eq for ConvergenceResidualHandle<H> {}
562impl<H: HostTypes> core::hash::Hash for ConvergenceResidualHandle<H> {
563 #[inline]
564 fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
565 self.fingerprint.hash(state);
566 }
567}
568impl<H: HostTypes> ConvergenceResidualHandle<H> {
569 #[inline]
571 #[must_use]
572 pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
573 Self {
574 fingerprint,
575 _phantom: core::marker::PhantomData,
576 }
577 }
578}
579
580pub trait ConvergenceResidualResolver<H: HostTypes> {
586 fn resolve(&self, handle: ConvergenceResidualHandle<H>)
589 -> Option<ConvergenceResidualRecord<H>>;
590}
591
592#[derive(Clone, Debug, PartialEq, Eq, Hash)]
598pub struct ConvergenceResidualRecord<H: HostTypes> {
599 pub residual_betti: u64,
600 pub residual_dimension: u64,
601 #[doc(hidden)]
602 pub _phantom: core::marker::PhantomData<H>,
603}
604
605pub struct ResolvedConvergenceResidual<'r, R: ConvergenceResidualResolver<H>, H: HostTypes> {
613 handle: ConvergenceResidualHandle<H>,
614 resolver: &'r R,
615 record: Option<ConvergenceResidualRecord<H>>,
616}
617impl<'r, R: ConvergenceResidualResolver<H>, H: HostTypes> ResolvedConvergenceResidual<'r, R, H> {
618 #[inline]
620 pub fn new(handle: ConvergenceResidualHandle<H>, resolver: &'r R) -> Self {
621 let record = resolver.resolve(handle);
622 Self {
623 handle,
624 resolver,
625 record,
626 }
627 }
628 #[inline]
630 #[must_use]
631 pub const fn handle(&self) -> ConvergenceResidualHandle<H> {
632 self.handle
633 }
634 #[inline]
636 #[must_use]
637 pub const fn resolver(&self) -> &'r R {
638 self.resolver
639 }
640 #[inline]
642 #[must_use]
643 pub const fn record(&self) -> Option<&ConvergenceResidualRecord<H>> {
644 self.record.as_ref()
645 }
646}
647impl<'r, R: ConvergenceResidualResolver<H>, H: HostTypes> ConvergenceResidual<H>
648 for ResolvedConvergenceResidual<'r, R, H>
649{
650 fn residual_betti(&self) -> u64 {
651 match &self.record {
652 Some(r) => r.residual_betti,
653 None => 0,
654 }
655 }
656 fn residual_dimension(&self) -> u64 {
657 match &self.record {
658 Some(r) => r.residual_dimension,
659 None => 0,
660 }
661 }
662}
663
664#[derive(Debug)]
669pub struct CommutativeSubspaceHandle<H: HostTypes> {
670 pub fingerprint: crate::enforcement::ContentFingerprint,
672 _phantom: core::marker::PhantomData<H>,
673}
674impl<H: HostTypes> Copy for CommutativeSubspaceHandle<H> {}
675impl<H: HostTypes> Clone for CommutativeSubspaceHandle<H> {
676 #[inline]
677 fn clone(&self) -> Self {
678 *self
679 }
680}
681impl<H: HostTypes> PartialEq for CommutativeSubspaceHandle<H> {
682 #[inline]
683 fn eq(&self, other: &Self) -> bool {
684 self.fingerprint == other.fingerprint
685 }
686}
687impl<H: HostTypes> Eq for CommutativeSubspaceHandle<H> {}
688impl<H: HostTypes> core::hash::Hash for CommutativeSubspaceHandle<H> {
689 #[inline]
690 fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
691 self.fingerprint.hash(state);
692 }
693}
694impl<H: HostTypes> CommutativeSubspaceHandle<H> {
695 #[inline]
697 #[must_use]
698 pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
699 Self {
700 fingerprint,
701 _phantom: core::marker::PhantomData,
702 }
703 }
704}
705
706pub trait CommutativeSubspaceResolver<H: HostTypes> {
712 fn resolve(&self, handle: CommutativeSubspaceHandle<H>)
715 -> Option<CommutativeSubspaceRecord<H>>;
716}
717
718#[derive(Clone, Debug, PartialEq, Eq, Hash)]
724pub struct CommutativeSubspaceRecord<H: HostTypes> {
725 pub subspace_ref_handle: CommutativeSubspaceHandle<H>,
726 pub commutator_ref_handle: crate::bridge::observable::CommutatorHandle<H>,
727 #[doc(hidden)]
728 pub _phantom: core::marker::PhantomData<H>,
729}
730
731pub struct ResolvedCommutativeSubspace<'r, R: CommutativeSubspaceResolver<H>, H: HostTypes> {
739 handle: CommutativeSubspaceHandle<H>,
740 resolver: &'r R,
741 record: Option<CommutativeSubspaceRecord<H>>,
742}
743impl<'r, R: CommutativeSubspaceResolver<H>, H: HostTypes> ResolvedCommutativeSubspace<'r, R, H> {
744 #[inline]
746 pub fn new(handle: CommutativeSubspaceHandle<H>, resolver: &'r R) -> Self {
747 let record = resolver.resolve(handle);
748 Self {
749 handle,
750 resolver,
751 record,
752 }
753 }
754 #[inline]
756 #[must_use]
757 pub const fn handle(&self) -> CommutativeSubspaceHandle<H> {
758 self.handle
759 }
760 #[inline]
762 #[must_use]
763 pub const fn resolver(&self) -> &'r R {
764 self.resolver
765 }
766 #[inline]
768 #[must_use]
769 pub const fn record(&self) -> Option<&CommutativeSubspaceRecord<H>> {
770 self.record.as_ref()
771 }
772}
773impl<'r, R: CommutativeSubspaceResolver<H>, H: HostTypes> CommutativeSubspace<H>
774 for ResolvedCommutativeSubspace<'r, R, H>
775{
776 type CommutativeSubspaceTarget = NullCommutativeSubspace<H>;
777 fn subspace_ref(&self) -> &Self::CommutativeSubspaceTarget {
778 &<NullCommutativeSubspace<H>>::ABSENT
779 }
780 type Commutator = crate::bridge::observable::NullCommutator<H>;
781 fn commutator_ref(&self) -> &Self::Commutator {
782 &<crate::bridge::observable::NullCommutator<H>>::ABSENT
783 }
784}
785impl<'r, R: CommutativeSubspaceResolver<H>, H: HostTypes> ResolvedCommutativeSubspace<'r, R, H> {
786 #[inline]
790 pub fn resolve_subspace_ref<'r2, R2: CommutativeSubspaceResolver<H>>(
791 &self,
792 r: &'r2 R2,
793 ) -> Option<ResolvedCommutativeSubspace<'r2, R2, H>> {
794 let record = self.record.as_ref()?;
795 Some(ResolvedCommutativeSubspace::new(
796 record.subspace_ref_handle,
797 r,
798 ))
799 }
800 #[inline]
804 pub fn resolve_commutator_ref<'r2, R2: crate::bridge::observable::CommutatorResolver<H>>(
805 &self,
806 r: &'r2 R2,
807 ) -> Option<crate::bridge::observable::ResolvedCommutator<'r2, R2, H>> {
808 let record = self.record.as_ref()?;
809 Some(crate::bridge::observable::ResolvedCommutator::new(
810 record.commutator_ref_handle,
811 r,
812 ))
813 }
814}
815
816#[derive(Debug)]
821pub struct AssociativeSubalgebraHandle<H: HostTypes> {
822 pub fingerprint: crate::enforcement::ContentFingerprint,
824 _phantom: core::marker::PhantomData<H>,
825}
826impl<H: HostTypes> Copy for AssociativeSubalgebraHandle<H> {}
827impl<H: HostTypes> Clone for AssociativeSubalgebraHandle<H> {
828 #[inline]
829 fn clone(&self) -> Self {
830 *self
831 }
832}
833impl<H: HostTypes> PartialEq for AssociativeSubalgebraHandle<H> {
834 #[inline]
835 fn eq(&self, other: &Self) -> bool {
836 self.fingerprint == other.fingerprint
837 }
838}
839impl<H: HostTypes> Eq for AssociativeSubalgebraHandle<H> {}
840impl<H: HostTypes> core::hash::Hash for AssociativeSubalgebraHandle<H> {
841 #[inline]
842 fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
843 self.fingerprint.hash(state);
844 }
845}
846impl<H: HostTypes> AssociativeSubalgebraHandle<H> {
847 #[inline]
849 #[must_use]
850 pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
851 Self {
852 fingerprint,
853 _phantom: core::marker::PhantomData,
854 }
855 }
856}
857
858pub trait AssociativeSubalgebraResolver<H: HostTypes> {
864 fn resolve(
867 &self,
868 handle: AssociativeSubalgebraHandle<H>,
869 ) -> Option<AssociativeSubalgebraRecord<H>>;
870}
871
872#[derive(Clone, Debug, PartialEq, Eq, Hash)]
878pub struct AssociativeSubalgebraRecord<H: HostTypes> {
879 pub subalgebra_ref_handle: AssociativeSubalgebraHandle<H>,
880 pub associator_ref_handle: crate::bridge::interaction::AssociatorTripleHandle<H>,
881 #[doc(hidden)]
882 pub _phantom: core::marker::PhantomData<H>,
883}
884
885pub struct ResolvedAssociativeSubalgebra<'r, R: AssociativeSubalgebraResolver<H>, H: HostTypes> {
893 handle: AssociativeSubalgebraHandle<H>,
894 resolver: &'r R,
895 record: Option<AssociativeSubalgebraRecord<H>>,
896}
897impl<'r, R: AssociativeSubalgebraResolver<H>, H: HostTypes>
898 ResolvedAssociativeSubalgebra<'r, R, H>
899{
900 #[inline]
902 pub fn new(handle: AssociativeSubalgebraHandle<H>, resolver: &'r R) -> Self {
903 let record = resolver.resolve(handle);
904 Self {
905 handle,
906 resolver,
907 record,
908 }
909 }
910 #[inline]
912 #[must_use]
913 pub const fn handle(&self) -> AssociativeSubalgebraHandle<H> {
914 self.handle
915 }
916 #[inline]
918 #[must_use]
919 pub const fn resolver(&self) -> &'r R {
920 self.resolver
921 }
922 #[inline]
924 #[must_use]
925 pub const fn record(&self) -> Option<&AssociativeSubalgebraRecord<H>> {
926 self.record.as_ref()
927 }
928}
929impl<'r, R: AssociativeSubalgebraResolver<H>, H: HostTypes> AssociativeSubalgebra<H>
930 for ResolvedAssociativeSubalgebra<'r, R, H>
931{
932 type AssociativeSubalgebraTarget = NullAssociativeSubalgebra<H>;
933 fn subalgebra_ref(&self) -> &Self::AssociativeSubalgebraTarget {
934 &<NullAssociativeSubalgebra<H>>::ABSENT
935 }
936 type AssociatorTriple = crate::bridge::interaction::NullAssociatorTriple<H>;
937 fn associator_ref(&self) -> &Self::AssociatorTriple {
938 &<crate::bridge::interaction::NullAssociatorTriple<H>>::ABSENT
939 }
940}
941impl<'r, R: AssociativeSubalgebraResolver<H>, H: HostTypes>
942 ResolvedAssociativeSubalgebra<'r, R, H>
943{
944 #[inline]
948 pub fn resolve_subalgebra_ref<'r2, R2: AssociativeSubalgebraResolver<H>>(
949 &self,
950 r: &'r2 R2,
951 ) -> Option<ResolvedAssociativeSubalgebra<'r2, R2, H>> {
952 let record = self.record.as_ref()?;
953 Some(ResolvedAssociativeSubalgebra::new(
954 record.subalgebra_ref_handle,
955 r,
956 ))
957 }
958 #[inline]
962 pub fn resolve_associator_ref<
963 'r2,
964 R2: crate::bridge::interaction::AssociatorTripleResolver<H>,
965 >(
966 &self,
967 r: &'r2 R2,
968 ) -> Option<crate::bridge::interaction::ResolvedAssociatorTriple<'r2, R2, H>> {
969 let record = self.record.as_ref()?;
970 Some(crate::bridge::interaction::ResolvedAssociatorTriple::new(
971 record.associator_ref_handle,
972 r,
973 ))
974 }
975}
976
977pub mod l0_state {
979 pub const ALGEBRA_DIMENSION: i64 = 1;
981 pub const BETTI_SIGNATURE: &str = "[1]";
983 pub const CHARACTERISTIC_IDENTITY: &str = "existence";
985 pub const FIBER_TYPE: &str = "https://uor.foundation/convergence/hopf_S0";
987 pub const LEVEL_NAME: &str = "R";
989}
990
991pub mod l1_memory {
993 pub const ALGEBRA_DIMENSION: i64 = 2;
995 pub const BETTI_SIGNATURE: &str = "[1,1]";
997 pub const CHARACTERISTIC_IDENTITY: &str = "feedback";
999 pub const FIBER_TYPE: &str = "https://uor.foundation/convergence/hopf_S1";
1001 pub const LEVEL_NAME: &str = "C";
1003}
1004
1005pub mod l2_agency {
1007 pub const ALGEBRA_DIMENSION: i64 = 4;
1009 pub const BETTI_SIGNATURE: &str = "[1,0,0,1]";
1011 pub const CHARACTERISTIC_IDENTITY: &str = "choice";
1013 pub const FIBER_TYPE: &str = "https://uor.foundation/convergence/hopf_S3";
1015 pub const LEVEL_NAME: &str = "H";
1017}
1018
1019pub mod l3_self {
1021 pub const ALGEBRA_DIMENSION: i64 = 8;
1023 pub const BETTI_SIGNATURE: &str = "[1,0,0,0,0,0,0,1]";
1025 pub const CHARACTERISTIC_IDENTITY: &str = "self-reference";
1027 pub const FIBER_TYPE: &str = "https://uor.foundation/convergence/hopf_S7";
1029 pub const LEVEL_NAME: &str = "O";
1031}
1032
1033pub mod hopf_s0 {
1035 pub const BASE_SPACE: &str = "pt";
1037 pub const FIBER_DIMENSION: i64 = 0;
1039 pub const FIBER_SPHERE: &str = "S⁰";
1041 pub const TOTAL_SPACE: &str = "S¹";
1043}
1044
1045pub mod hopf_s1 {
1047 pub const BASE_SPACE: &str = "S²";
1049 pub const FIBER_DIMENSION: i64 = 1;
1051 pub const FIBER_SPHERE: &str = "S¹";
1053 pub const TOTAL_SPACE: &str = "S³";
1055}
1056
1057pub mod hopf_s3 {
1059 pub const BASE_SPACE: &str = "S⁴";
1061 pub const FIBER_DIMENSION: i64 = 3;
1063 pub const FIBER_SPHERE: &str = "S³";
1065 pub const TOTAL_SPACE: &str = "S⁷";
1067}
1068
1069pub mod hopf_s7 {
1071 pub const BASE_SPACE: &str = "S⁸";
1073 pub const FIBER_DIMENSION: i64 = 7;
1075 pub const FIBER_SPHERE: &str = "S⁷";
1077 pub const TOTAL_SPACE: &str = "S¹⁵";
1079}