use crate::enums::ProofStrategy;
use crate::HostTypes;
pub trait Transform<H: HostTypes> {
fn source(&self) -> &H::HostString;
fn target(&self) -> &H::HostString;
fn preserves_count(&self) -> usize;
fn preserves_at(&self, index: usize) -> &H::HostString;
type ComputationTrace: crate::bridge::trace::ComputationTrace<H>;
fn trace(&self) -> &Self::ComputationTrace;
type TransformTarget: Transform<H>;
fn composes_with(&self) -> &[Self::TransformTarget];
type Identity: crate::kernel::op::Identity<H>;
fn preserved_invariant(&self) -> &Self::Identity;
fn input_class(&self) -> &H::HostString;
fn output_class(&self) -> &H::HostString;
type Witness: Witness<H>;
fn has_witness(&self) -> &[Self::Witness];
}
pub trait Isometry<H: HostTypes>: Transform<H> {
type MetricObservable: crate::bridge::observable::MetricObservable<H>;
fn preserves_metric(&self) -> &[Self::MetricObservable];
}
pub trait Embedding<H: HostTypes>: Transform<H> {
fn source_quantum(&self) -> u64;
fn target_quantum(&self) -> u64;
fn address_coherence(&self) -> &Self::Identity;
}
pub trait Action<H: HostTypes> {
type Group: crate::kernel::op::Group<H>;
fn group(&self) -> &Self::Group;
fn acting_on(&self) -> &H::HostString;
fn action_isometry(&self) -> bool;
}
pub trait Composition<H: HostTypes>: Transform<H> {
type Transform: Transform<H>;
fn composition_result(&self) -> &Self::Transform;
fn composition_components(&self) -> &[Self::Transform];
}
pub trait Identity<H: HostTypes>: Transform<H> {
type TypeDefinition: crate::user::type_::TypeDefinition<H>;
fn identity_on(&self) -> &Self::TypeDefinition;
}
pub trait CompositionLaw<H: HostTypes> {
fn is_associative(&self) -> bool;
fn is_commutative(&self) -> bool;
type Operation: crate::kernel::op::Operation<H>;
fn law_components(&self) -> &[Self::Operation];
fn law_result(&self) -> &Self::Operation;
}
pub trait GroundingMap<H: HostTypes>: Transform<H> {
type Derivation: crate::bridge::derivation::Derivation<H>;
fn grounding_derivation(&self) -> &Self::Derivation;
type Constraint: crate::user::type_::Constraint<H>;
fn symbol_constraints(&self) -> &[Self::Constraint];
}
pub trait ProjectionMap<H: HostTypes>: Transform<H> {
type Frame: crate::user::state::Frame<H>;
fn projection_frame(&self) -> &Self::Frame;
type Conjunction: crate::user::type_::Conjunction<H>;
fn projection_order(&self) -> &Self::Conjunction;
fn round_trip_coherence(&self) -> bool;
fn output_element_class(&self) -> &H::HostString;
}
pub trait GroundingCertificate<H: HostTypes>: crate::bridge::cert::Certificate<H> {
type GroundingMap: GroundingMap<H>;
fn grounding_cert_map(&self) -> &Self::GroundingMap;
type ProjectionMap: ProjectionMap<H>;
fn grounding_cert_projection(&self) -> &Self::ProjectionMap;
type Literal: crate::kernel::schema::Literal<H>;
fn grounding_cert_source_symbol(&self) -> &Self::Literal;
type Element: crate::kernel::address::Element<H>;
fn grounding_cert_address(&self) -> &Self::Element;
}
pub trait TopologicalDelta<H: HostTypes> {
type BettiNumber: crate::bridge::observable::BettiNumber<H>;
fn bettis_before(&self) -> &Self::BettiNumber;
fn bettis_after(&self) -> &Self::BettiNumber;
fn euler_before(&self) -> i64;
fn euler_after(&self) -> i64;
type SimplicialComplex: crate::bridge::homology::SimplicialComplex<H>;
fn nerve_before(&self) -> &Self::SimplicialComplex;
fn nerve_after(&self) -> &Self::SimplicialComplex;
}
pub trait ComputationDatum<H: HostTypes>: crate::kernel::schema::Datum<H> {
type TransformCertificate: crate::bridge::cert::TransformCertificate<H>;
fn referenced_certificate(&self) -> &Self::TransformCertificate;
fn computation_address(&self) -> &Self::Element;
}
pub trait ApplicationMorphism<H: HostTypes>: Transform<H> {
type ComputationDatum: ComputationDatum<H>;
fn application_target(&self) -> &Self::ComputationDatum;
type Datum: crate::kernel::schema::Datum<H>;
fn application_input(&self) -> &Self::Datum;
}
pub trait PartialApplication<H: HostTypes>: ComputationDatum<H> {
type ComputationDatum: ComputationDatum<H>;
fn partial_base(&self) -> &Self::ComputationDatum;
type Datum: crate::kernel::schema::Datum<H>;
fn bound_arguments(&self) -> &[Self::Datum];
fn remaining_arity(&self) -> u64;
}
pub trait TransformComposition<H: HostTypes>: ComputationDatum<H> {
type ComputationDatum: ComputationDatum<H>;
fn composition_left(&self) -> &Self::ComputationDatum;
fn composition_right(&self) -> &Self::ComputationDatum;
}
pub trait Witness<H: HostTypes> {}
pub trait GroundingWitness<H: HostTypes>: Witness<H> {
type SurfaceSymbol: crate::kernel::schema::SurfaceSymbol<H>;
fn surface_symbol(&self) -> &Self::SurfaceSymbol;
type Element: crate::kernel::address::Element<H>;
fn grounded_address(&self) -> &Self::Element;
}
pub trait ProjectionWitness<H: HostTypes>: Witness<H> {
type Partition: crate::bridge::partition::Partition<H>;
fn projection_source(&self) -> &Self::Partition;
type SymbolSequence: SymbolSequence<H>;
fn projection_output(&self) -> &Self::SymbolSequence;
}
pub trait SymbolSequence<H: HostTypes> {
type SequenceElement: SequenceElement<H>;
fn has_element(&self) -> &[Self::SequenceElement];
}
pub trait SequenceElement<H: HostTypes> {
type SurfaceSymbol: crate::kernel::schema::SurfaceSymbol<H>;
fn element_value(&self) -> &Self::SurfaceSymbol;
fn element_index(&self) -> u64;
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullTransform<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullTransform<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullTransform<H> {
pub const ABSENT: NullTransform<H> = NullTransform {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Transform<H> for NullTransform<H> {
fn source(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn target(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn preserves_count(&self) -> usize {
0
}
fn preserves_at(&self, _index: usize) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type ComputationTrace = crate::bridge::trace::NullComputationTrace<H>;
fn trace(&self) -> &Self::ComputationTrace {
&<crate::bridge::trace::NullComputationTrace<H>>::ABSENT
}
type TransformTarget = NullTransform<H>;
fn composes_with(&self) -> &[Self::TransformTarget] {
&[]
}
type Identity = crate::kernel::op::NullIdentity<H>;
fn preserved_invariant(&self) -> &Self::Identity {
&<crate::kernel::op::NullIdentity<H>>::ABSENT
}
fn input_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn output_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type Witness = NullWitness<H>;
fn has_witness(&self) -> &[Self::Witness] {
&[]
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullIsometry<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullIsometry<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullIsometry<H> {
pub const ABSENT: NullIsometry<H> = NullIsometry {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Transform<H> for NullIsometry<H> {
fn source(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn target(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn preserves_count(&self) -> usize {
0
}
fn preserves_at(&self, _index: usize) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type ComputationTrace = crate::bridge::trace::NullComputationTrace<H>;
fn trace(&self) -> &Self::ComputationTrace {
&<crate::bridge::trace::NullComputationTrace<H>>::ABSENT
}
type TransformTarget = NullTransform<H>;
fn composes_with(&self) -> &[Self::TransformTarget] {
&[]
}
type Identity = crate::kernel::op::NullIdentity<H>;
fn preserved_invariant(&self) -> &Self::Identity {
&<crate::kernel::op::NullIdentity<H>>::ABSENT
}
fn input_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn output_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type Witness = NullWitness<H>;
fn has_witness(&self) -> &[Self::Witness] {
&[]
}
}
impl<H: HostTypes> Isometry<H> for NullIsometry<H> {
type MetricObservable = crate::bridge::observable::NullMetricObservable<H>;
fn preserves_metric(&self) -> &[Self::MetricObservable] {
&[]
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullEmbedding<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullEmbedding<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullEmbedding<H> {
pub const ABSENT: NullEmbedding<H> = NullEmbedding {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Transform<H> for NullEmbedding<H> {
fn source(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn target(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn preserves_count(&self) -> usize {
0
}
fn preserves_at(&self, _index: usize) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type ComputationTrace = crate::bridge::trace::NullComputationTrace<H>;
fn trace(&self) -> &Self::ComputationTrace {
&<crate::bridge::trace::NullComputationTrace<H>>::ABSENT
}
type TransformTarget = NullTransform<H>;
fn composes_with(&self) -> &[Self::TransformTarget] {
&[]
}
type Identity = crate::kernel::op::NullIdentity<H>;
fn preserved_invariant(&self) -> &Self::Identity {
&<crate::kernel::op::NullIdentity<H>>::ABSENT
}
fn input_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn output_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type Witness = NullWitness<H>;
fn has_witness(&self) -> &[Self::Witness] {
&[]
}
}
impl<H: HostTypes> Embedding<H> for NullEmbedding<H> {
fn source_quantum(&self) -> u64 {
0
}
fn target_quantum(&self) -> u64 {
0
}
fn address_coherence(&self) -> &Self::Identity {
&<crate::kernel::op::NullIdentity<H>>::ABSENT
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullAction<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullAction<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullAction<H> {
pub const ABSENT: NullAction<H> = NullAction {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Action<H> for NullAction<H> {
type Group = crate::kernel::op::NullGroup<H>;
fn group(&self) -> &Self::Group {
&<crate::kernel::op::NullGroup<H>>::ABSENT
}
fn acting_on(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn action_isometry(&self) -> bool {
false
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullComposition<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullComposition<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullComposition<H> {
pub const ABSENT: NullComposition<H> = NullComposition {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Transform<H> for NullComposition<H> {
fn source(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn target(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn preserves_count(&self) -> usize {
0
}
fn preserves_at(&self, _index: usize) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type ComputationTrace = crate::bridge::trace::NullComputationTrace<H>;
fn trace(&self) -> &Self::ComputationTrace {
&<crate::bridge::trace::NullComputationTrace<H>>::ABSENT
}
type TransformTarget = NullTransform<H>;
fn composes_with(&self) -> &[Self::TransformTarget] {
&[]
}
type Identity = crate::kernel::op::NullIdentity<H>;
fn preserved_invariant(&self) -> &Self::Identity {
&<crate::kernel::op::NullIdentity<H>>::ABSENT
}
fn input_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn output_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type Witness = NullWitness<H>;
fn has_witness(&self) -> &[Self::Witness] {
&[]
}
}
impl<H: HostTypes> Composition<H> for NullComposition<H> {
type Transform = NullTransform<H>;
fn composition_result(&self) -> &Self::Transform {
&<NullTransform<H>>::ABSENT
}
fn composition_components(&self) -> &[Self::Transform] {
&[]
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullIdentity<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullIdentity<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullIdentity<H> {
pub const ABSENT: NullIdentity<H> = NullIdentity {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Transform<H> for NullIdentity<H> {
fn source(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn target(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn preserves_count(&self) -> usize {
0
}
fn preserves_at(&self, _index: usize) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type ComputationTrace = crate::bridge::trace::NullComputationTrace<H>;
fn trace(&self) -> &Self::ComputationTrace {
&<crate::bridge::trace::NullComputationTrace<H>>::ABSENT
}
type TransformTarget = NullTransform<H>;
fn composes_with(&self) -> &[Self::TransformTarget] {
&[]
}
type Identity = crate::kernel::op::NullIdentity<H>;
fn preserved_invariant(&self) -> &Self::Identity {
&<crate::kernel::op::NullIdentity<H>>::ABSENT
}
fn input_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn output_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type Witness = NullWitness<H>;
fn has_witness(&self) -> &[Self::Witness] {
&[]
}
}
impl<H: HostTypes> Identity<H> for NullIdentity<H> {
type TypeDefinition = crate::user::type_::NullTypeDefinition<H>;
fn identity_on(&self) -> &Self::TypeDefinition {
&<crate::user::type_::NullTypeDefinition<H>>::ABSENT
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullCompositionLaw<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullCompositionLaw<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullCompositionLaw<H> {
pub const ABSENT: NullCompositionLaw<H> = NullCompositionLaw {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> CompositionLaw<H> for NullCompositionLaw<H> {
fn is_associative(&self) -> bool {
false
}
fn is_commutative(&self) -> bool {
false
}
type Operation = crate::kernel::op::NullOperation<H>;
fn law_components(&self) -> &[Self::Operation] {
&[]
}
fn law_result(&self) -> &Self::Operation {
&<crate::kernel::op::NullOperation<H>>::ABSENT
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullGroundingMap<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullGroundingMap<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullGroundingMap<H> {
pub const ABSENT: NullGroundingMap<H> = NullGroundingMap {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Transform<H> for NullGroundingMap<H> {
fn source(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn target(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn preserves_count(&self) -> usize {
0
}
fn preserves_at(&self, _index: usize) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type ComputationTrace = crate::bridge::trace::NullComputationTrace<H>;
fn trace(&self) -> &Self::ComputationTrace {
&<crate::bridge::trace::NullComputationTrace<H>>::ABSENT
}
type TransformTarget = NullTransform<H>;
fn composes_with(&self) -> &[Self::TransformTarget] {
&[]
}
type Identity = crate::kernel::op::NullIdentity<H>;
fn preserved_invariant(&self) -> &Self::Identity {
&<crate::kernel::op::NullIdentity<H>>::ABSENT
}
fn input_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn output_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type Witness = NullWitness<H>;
fn has_witness(&self) -> &[Self::Witness] {
&[]
}
}
impl<H: HostTypes> GroundingMap<H> for NullGroundingMap<H> {
type Derivation = crate::bridge::derivation::NullDerivation<H>;
fn grounding_derivation(&self) -> &Self::Derivation {
&<crate::bridge::derivation::NullDerivation<H>>::ABSENT
}
type Constraint = crate::user::type_::NullConstraint<H>;
fn symbol_constraints(&self) -> &[Self::Constraint] {
&[]
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullProjectionMap<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullProjectionMap<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullProjectionMap<H> {
pub const ABSENT: NullProjectionMap<H> = NullProjectionMap {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Transform<H> for NullProjectionMap<H> {
fn source(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn target(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn preserves_count(&self) -> usize {
0
}
fn preserves_at(&self, _index: usize) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type ComputationTrace = crate::bridge::trace::NullComputationTrace<H>;
fn trace(&self) -> &Self::ComputationTrace {
&<crate::bridge::trace::NullComputationTrace<H>>::ABSENT
}
type TransformTarget = NullTransform<H>;
fn composes_with(&self) -> &[Self::TransformTarget] {
&[]
}
type Identity = crate::kernel::op::NullIdentity<H>;
fn preserved_invariant(&self) -> &Self::Identity {
&<crate::kernel::op::NullIdentity<H>>::ABSENT
}
fn input_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn output_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type Witness = NullWitness<H>;
fn has_witness(&self) -> &[Self::Witness] {
&[]
}
}
impl<H: HostTypes> ProjectionMap<H> for NullProjectionMap<H> {
type Frame = crate::user::state::NullFrame<H>;
fn projection_frame(&self) -> &Self::Frame {
&<crate::user::state::NullFrame<H>>::ABSENT
}
type Conjunction = crate::user::type_::NullConjunction<H>;
fn projection_order(&self) -> &Self::Conjunction {
&<crate::user::type_::NullConjunction<H>>::ABSENT
}
fn round_trip_coherence(&self) -> bool {
false
}
fn output_element_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullGroundingCertificate<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullGroundingCertificate<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullGroundingCertificate<H> {
pub const ABSENT: NullGroundingCertificate<H> = NullGroundingCertificate {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> crate::bridge::cert::Certificate<H> for NullGroundingCertificate<H> {
fn method(&self) -> ProofStrategy {
<ProofStrategy>::default()
}
fn verified(&self) -> bool {
false
}
fn witt_length(&self) -> u64 {
0
}
fn timestamp(&self) -> &H::WitnessBytes {
H::EMPTY_WITNESS_BYTES
}
fn certifies(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
}
impl<H: HostTypes> GroundingCertificate<H> for NullGroundingCertificate<H> {
type GroundingMap = NullGroundingMap<H>;
fn grounding_cert_map(&self) -> &Self::GroundingMap {
&<NullGroundingMap<H>>::ABSENT
}
type ProjectionMap = NullProjectionMap<H>;
fn grounding_cert_projection(&self) -> &Self::ProjectionMap {
&<NullProjectionMap<H>>::ABSENT
}
type Literal = crate::kernel::schema::NullLiteral<H>;
fn grounding_cert_source_symbol(&self) -> &Self::Literal {
&<crate::kernel::schema::NullLiteral<H>>::ABSENT
}
type Element = crate::kernel::address::NullElement<H>;
fn grounding_cert_address(&self) -> &Self::Element {
&<crate::kernel::address::NullElement<H>>::ABSENT
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullTopologicalDelta<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullTopologicalDelta<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullTopologicalDelta<H> {
pub const ABSENT: NullTopologicalDelta<H> = NullTopologicalDelta {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> TopologicalDelta<H> for NullTopologicalDelta<H> {
type BettiNumber = crate::bridge::observable::NullBettiNumber<H>;
fn bettis_before(&self) -> &Self::BettiNumber {
&<crate::bridge::observable::NullBettiNumber<H>>::ABSENT
}
fn bettis_after(&self) -> &Self::BettiNumber {
&<crate::bridge::observable::NullBettiNumber<H>>::ABSENT
}
fn euler_before(&self) -> i64 {
0
}
fn euler_after(&self) -> i64 {
0
}
type SimplicialComplex = crate::bridge::homology::NullSimplicialComplex<H>;
fn nerve_before(&self) -> &Self::SimplicialComplex {
&<crate::bridge::homology::NullSimplicialComplex<H>>::ABSENT
}
fn nerve_after(&self) -> &Self::SimplicialComplex {
&<crate::bridge::homology::NullSimplicialComplex<H>>::ABSENT
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullComputationDatum<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullComputationDatum<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullComputationDatum<H> {
pub const ABSENT: NullComputationDatum<H> = NullComputationDatum {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> crate::kernel::schema::Datum<H> for NullComputationDatum<H> {
fn value(&self) -> u64 {
0
}
fn witt_length(&self) -> u64 {
0
}
fn stratum(&self) -> u64 {
0
}
fn spectrum(&self) -> u64 {
0
}
type Element = crate::kernel::address::NullElement<H>;
fn element(&self) -> &Self::Element {
&<crate::kernel::address::NullElement<H>>::ABSENT
}
}
impl<H: HostTypes> ComputationDatum<H> for NullComputationDatum<H> {
type TransformCertificate = crate::bridge::cert::NullTransformCertificate<H>;
fn referenced_certificate(&self) -> &Self::TransformCertificate {
&<crate::bridge::cert::NullTransformCertificate<H>>::ABSENT
}
fn computation_address(&self) -> &Self::Element {
&<crate::kernel::address::NullElement<H>>::ABSENT
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullApplicationMorphism<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullApplicationMorphism<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullApplicationMorphism<H> {
pub const ABSENT: NullApplicationMorphism<H> = NullApplicationMorphism {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Transform<H> for NullApplicationMorphism<H> {
fn source(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn target(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn preserves_count(&self) -> usize {
0
}
fn preserves_at(&self, _index: usize) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type ComputationTrace = crate::bridge::trace::NullComputationTrace<H>;
fn trace(&self) -> &Self::ComputationTrace {
&<crate::bridge::trace::NullComputationTrace<H>>::ABSENT
}
type TransformTarget = NullTransform<H>;
fn composes_with(&self) -> &[Self::TransformTarget] {
&[]
}
type Identity = crate::kernel::op::NullIdentity<H>;
fn preserved_invariant(&self) -> &Self::Identity {
&<crate::kernel::op::NullIdentity<H>>::ABSENT
}
fn input_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn output_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type Witness = NullWitness<H>;
fn has_witness(&self) -> &[Self::Witness] {
&[]
}
}
impl<H: HostTypes> ApplicationMorphism<H> for NullApplicationMorphism<H> {
type ComputationDatum = NullComputationDatum<H>;
fn application_target(&self) -> &Self::ComputationDatum {
&<NullComputationDatum<H>>::ABSENT
}
type Datum = crate::kernel::schema::NullDatum<H>;
fn application_input(&self) -> &Self::Datum {
&<crate::kernel::schema::NullDatum<H>>::ABSENT
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullPartialApplication<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullPartialApplication<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullPartialApplication<H> {
pub const ABSENT: NullPartialApplication<H> = NullPartialApplication {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> crate::kernel::schema::Datum<H> for NullPartialApplication<H> {
fn value(&self) -> u64 {
0
}
fn witt_length(&self) -> u64 {
0
}
fn stratum(&self) -> u64 {
0
}
fn spectrum(&self) -> u64 {
0
}
type Element = crate::kernel::address::NullElement<H>;
fn element(&self) -> &Self::Element {
&<crate::kernel::address::NullElement<H>>::ABSENT
}
}
impl<H: HostTypes> ComputationDatum<H> for NullPartialApplication<H> {
type TransformCertificate = crate::bridge::cert::NullTransformCertificate<H>;
fn referenced_certificate(&self) -> &Self::TransformCertificate {
&<crate::bridge::cert::NullTransformCertificate<H>>::ABSENT
}
fn computation_address(&self) -> &Self::Element {
&<crate::kernel::address::NullElement<H>>::ABSENT
}
}
impl<H: HostTypes> PartialApplication<H> for NullPartialApplication<H> {
type ComputationDatum = NullComputationDatum<H>;
fn partial_base(&self) -> &Self::ComputationDatum {
&<NullComputationDatum<H>>::ABSENT
}
type Datum = crate::kernel::schema::NullDatum<H>;
fn bound_arguments(&self) -> &[Self::Datum] {
&[]
}
fn remaining_arity(&self) -> u64 {
0
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullTransformComposition<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullTransformComposition<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullTransformComposition<H> {
pub const ABSENT: NullTransformComposition<H> = NullTransformComposition {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> crate::kernel::schema::Datum<H> for NullTransformComposition<H> {
fn value(&self) -> u64 {
0
}
fn witt_length(&self) -> u64 {
0
}
fn stratum(&self) -> u64 {
0
}
fn spectrum(&self) -> u64 {
0
}
type Element = crate::kernel::address::NullElement<H>;
fn element(&self) -> &Self::Element {
&<crate::kernel::address::NullElement<H>>::ABSENT
}
}
impl<H: HostTypes> ComputationDatum<H> for NullTransformComposition<H> {
type TransformCertificate = crate::bridge::cert::NullTransformCertificate<H>;
fn referenced_certificate(&self) -> &Self::TransformCertificate {
&<crate::bridge::cert::NullTransformCertificate<H>>::ABSENT
}
fn computation_address(&self) -> &Self::Element {
&<crate::kernel::address::NullElement<H>>::ABSENT
}
}
impl<H: HostTypes> TransformComposition<H> for NullTransformComposition<H> {
type ComputationDatum = NullComputationDatum<H>;
fn composition_left(&self) -> &Self::ComputationDatum {
&<NullComputationDatum<H>>::ABSENT
}
fn composition_right(&self) -> &Self::ComputationDatum {
&<NullComputationDatum<H>>::ABSENT
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullWitness<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullWitness<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullWitness<H> {
pub const ABSENT: NullWitness<H> = NullWitness {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Witness<H> for NullWitness<H> {}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullGroundingWitness<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullGroundingWitness<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullGroundingWitness<H> {
pub const ABSENT: NullGroundingWitness<H> = NullGroundingWitness {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Witness<H> for NullGroundingWitness<H> {}
impl<H: HostTypes> GroundingWitness<H> for NullGroundingWitness<H> {
type SurfaceSymbol = crate::kernel::schema::NullSurfaceSymbol<H>;
fn surface_symbol(&self) -> &Self::SurfaceSymbol {
&<crate::kernel::schema::NullSurfaceSymbol<H>>::ABSENT
}
type Element = crate::kernel::address::NullElement<H>;
fn grounded_address(&self) -> &Self::Element {
&<crate::kernel::address::NullElement<H>>::ABSENT
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullProjectionWitness<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullProjectionWitness<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullProjectionWitness<H> {
pub const ABSENT: NullProjectionWitness<H> = NullProjectionWitness {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Witness<H> for NullProjectionWitness<H> {}
impl<H: HostTypes> ProjectionWitness<H> for NullProjectionWitness<H> {
type Partition = crate::enforcement::NullPartition<H>;
fn projection_source(&self) -> &Self::Partition {
&<crate::enforcement::NullPartition<H>>::ABSENT
}
type SymbolSequence = NullSymbolSequence<H>;
fn projection_output(&self) -> &Self::SymbolSequence {
&<NullSymbolSequence<H>>::ABSENT
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullSymbolSequence<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullSymbolSequence<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullSymbolSequence<H> {
pub const ABSENT: NullSymbolSequence<H> = NullSymbolSequence {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> SymbolSequence<H> for NullSymbolSequence<H> {
type SequenceElement = NullSequenceElement<H>;
fn has_element(&self) -> &[Self::SequenceElement] {
&[]
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullSequenceElement<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullSequenceElement<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullSequenceElement<H> {
pub const ABSENT: NullSequenceElement<H> = NullSequenceElement {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> SequenceElement<H> for NullSequenceElement<H> {
type SurfaceSymbol = crate::kernel::schema::NullSurfaceSymbol<H>;
fn element_value(&self) -> &Self::SurfaceSymbol {
&<crate::kernel::schema::NullSurfaceSymbol<H>>::ABSENT
}
fn element_index(&self) -> u64 {
0
}
}
#[derive(Debug)]
pub struct TransformHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for TransformHandle<H> {}
impl<H: HostTypes> Clone for TransformHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for TransformHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for TransformHandle<H> {}
impl<H: HostTypes> core::hash::Hash for TransformHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> TransformHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait TransformResolver<H: HostTypes> {
fn resolve(&self, handle: TransformHandle<H>) -> Option<TransformRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct TransformRecord<H: HostTypes> {
pub source: &'static H::HostString,
pub target: &'static H::HostString,
pub trace_handle: crate::bridge::trace::ComputationTraceHandle<H>,
pub preserved_invariant_handle: crate::kernel::op::IdentityHandle<H>,
pub input_class: &'static H::HostString,
pub output_class: &'static H::HostString,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedTransform<'r, R: TransformResolver<H>, H: HostTypes> {
handle: TransformHandle<H>,
resolver: &'r R,
record: Option<TransformRecord<H>>,
}
impl<'r, R: TransformResolver<H>, H: HostTypes> ResolvedTransform<'r, R, H> {
#[inline]
pub fn new(handle: TransformHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> TransformHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&TransformRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: TransformResolver<H>, H: HostTypes> Transform<H> for ResolvedTransform<'r, R, H> {
fn source(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn target(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn preserves_count(&self) -> usize {
0
}
fn preserves_at(&self, _index: usize) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type ComputationTrace = crate::bridge::trace::NullComputationTrace<H>;
fn trace(&self) -> &Self::ComputationTrace {
&<crate::bridge::trace::NullComputationTrace<H>>::ABSENT
}
type TransformTarget = NullTransform<H>;
fn composes_with(&self) -> &[Self::TransformTarget] {
&[]
}
type Identity = crate::kernel::op::NullIdentity<H>;
fn preserved_invariant(&self) -> &Self::Identity {
&<crate::kernel::op::NullIdentity<H>>::ABSENT
}
fn input_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn output_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type Witness = NullWitness<H>;
fn has_witness(&self) -> &[Self::Witness] {
&[]
}
}
impl<'r, R: TransformResolver<H>, H: HostTypes> ResolvedTransform<'r, R, H> {
#[inline]
pub fn resolve_trace<'r2, R2: crate::bridge::trace::ComputationTraceResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::bridge::trace::ResolvedComputationTrace<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::bridge::trace::ResolvedComputationTrace::new(
record.trace_handle,
r,
))
}
#[inline]
pub fn resolve_preserved_invariant<'r2, R2: crate::kernel::op::IdentityResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::kernel::op::ResolvedIdentity<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::kernel::op::ResolvedIdentity::new(
record.preserved_invariant_handle,
r,
))
}
}
#[derive(Debug)]
pub struct IsometryHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for IsometryHandle<H> {}
impl<H: HostTypes> Clone for IsometryHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for IsometryHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for IsometryHandle<H> {}
impl<H: HostTypes> core::hash::Hash for IsometryHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> IsometryHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait IsometryResolver<H: HostTypes> {
fn resolve(&self, handle: IsometryHandle<H>) -> Option<IsometryRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct IsometryRecord<H: HostTypes> {
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedIsometry<'r, R: IsometryResolver<H>, H: HostTypes> {
handle: IsometryHandle<H>,
resolver: &'r R,
record: Option<IsometryRecord<H>>,
}
impl<'r, R: IsometryResolver<H>, H: HostTypes> ResolvedIsometry<'r, R, H> {
#[inline]
pub fn new(handle: IsometryHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> IsometryHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&IsometryRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: IsometryResolver<H>, H: HostTypes> Transform<H> for ResolvedIsometry<'r, R, H> {
fn source(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn target(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn preserves_count(&self) -> usize {
0
}
fn preserves_at(&self, _index: usize) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type ComputationTrace = crate::bridge::trace::NullComputationTrace<H>;
fn trace(&self) -> &Self::ComputationTrace {
&<crate::bridge::trace::NullComputationTrace<H>>::ABSENT
}
type TransformTarget = NullTransform<H>;
fn composes_with(&self) -> &[Self::TransformTarget] {
&[]
}
type Identity = crate::kernel::op::NullIdentity<H>;
fn preserved_invariant(&self) -> &Self::Identity {
&<crate::kernel::op::NullIdentity<H>>::ABSENT
}
fn input_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn output_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type Witness = NullWitness<H>;
fn has_witness(&self) -> &[Self::Witness] {
&[]
}
}
impl<'r, R: IsometryResolver<H>, H: HostTypes> Isometry<H> for ResolvedIsometry<'r, R, H> {
type MetricObservable = crate::bridge::observable::NullMetricObservable<H>;
fn preserves_metric(&self) -> &[Self::MetricObservable] {
&[]
}
}
#[derive(Debug)]
pub struct EmbeddingHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for EmbeddingHandle<H> {}
impl<H: HostTypes> Clone for EmbeddingHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for EmbeddingHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for EmbeddingHandle<H> {}
impl<H: HostTypes> core::hash::Hash for EmbeddingHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> EmbeddingHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait EmbeddingResolver<H: HostTypes> {
fn resolve(&self, handle: EmbeddingHandle<H>) -> Option<EmbeddingRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct EmbeddingRecord<H: HostTypes> {
pub source_quantum: u64,
pub target_quantum: u64,
pub address_coherence_handle: crate::kernel::op::IdentityHandle<H>,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedEmbedding<'r, R: EmbeddingResolver<H>, H: HostTypes> {
handle: EmbeddingHandle<H>,
resolver: &'r R,
record: Option<EmbeddingRecord<H>>,
}
impl<'r, R: EmbeddingResolver<H>, H: HostTypes> ResolvedEmbedding<'r, R, H> {
#[inline]
pub fn new(handle: EmbeddingHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> EmbeddingHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&EmbeddingRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: EmbeddingResolver<H>, H: HostTypes> Transform<H> for ResolvedEmbedding<'r, R, H> {
fn source(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn target(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn preserves_count(&self) -> usize {
0
}
fn preserves_at(&self, _index: usize) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type ComputationTrace = crate::bridge::trace::NullComputationTrace<H>;
fn trace(&self) -> &Self::ComputationTrace {
&<crate::bridge::trace::NullComputationTrace<H>>::ABSENT
}
type TransformTarget = NullTransform<H>;
fn composes_with(&self) -> &[Self::TransformTarget] {
&[]
}
type Identity = crate::kernel::op::NullIdentity<H>;
fn preserved_invariant(&self) -> &Self::Identity {
&<crate::kernel::op::NullIdentity<H>>::ABSENT
}
fn input_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn output_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type Witness = NullWitness<H>;
fn has_witness(&self) -> &[Self::Witness] {
&[]
}
}
impl<'r, R: EmbeddingResolver<H>, H: HostTypes> Embedding<H> for ResolvedEmbedding<'r, R, H> {
fn source_quantum(&self) -> u64 {
match &self.record {
Some(r) => r.source_quantum,
None => 0,
}
}
fn target_quantum(&self) -> u64 {
match &self.record {
Some(r) => r.target_quantum,
None => 0,
}
}
fn address_coherence(&self) -> &Self::Identity {
&<crate::kernel::op::NullIdentity<H>>::ABSENT
}
}
impl<'r, R: EmbeddingResolver<H>, H: HostTypes> ResolvedEmbedding<'r, R, H> {
#[inline]
pub fn resolve_address_coherence<'r2, R2: crate::kernel::op::IdentityResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::kernel::op::ResolvedIdentity<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::kernel::op::ResolvedIdentity::new(
record.address_coherence_handle,
r,
))
}
}
#[derive(Debug)]
pub struct ActionHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for ActionHandle<H> {}
impl<H: HostTypes> Clone for ActionHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for ActionHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for ActionHandle<H> {}
impl<H: HostTypes> core::hash::Hash for ActionHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> ActionHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait ActionResolver<H: HostTypes> {
fn resolve(&self, handle: ActionHandle<H>) -> Option<ActionRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct ActionRecord<H: HostTypes> {
pub group_handle: crate::kernel::op::GroupHandle<H>,
pub acting_on: &'static H::HostString,
pub action_isometry: bool,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedAction<'r, R: ActionResolver<H>, H: HostTypes> {
handle: ActionHandle<H>,
resolver: &'r R,
record: Option<ActionRecord<H>>,
}
impl<'r, R: ActionResolver<H>, H: HostTypes> ResolvedAction<'r, R, H> {
#[inline]
pub fn new(handle: ActionHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> ActionHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&ActionRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: ActionResolver<H>, H: HostTypes> Action<H> for ResolvedAction<'r, R, H> {
type Group = crate::kernel::op::NullGroup<H>;
fn group(&self) -> &Self::Group {
&<crate::kernel::op::NullGroup<H>>::ABSENT
}
fn acting_on(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn action_isometry(&self) -> bool {
match &self.record {
Some(r) => r.action_isometry,
None => false,
}
}
}
impl<'r, R: ActionResolver<H>, H: HostTypes> ResolvedAction<'r, R, H> {
#[inline]
pub fn resolve_group<'r2, R2: crate::kernel::op::GroupResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::kernel::op::ResolvedGroup<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::kernel::op::ResolvedGroup::new(
record.group_handle,
r,
))
}
}
#[derive(Debug)]
pub struct CompositionHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for CompositionHandle<H> {}
impl<H: HostTypes> Clone for CompositionHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for CompositionHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for CompositionHandle<H> {}
impl<H: HostTypes> core::hash::Hash for CompositionHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> CompositionHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait CompositionResolver<H: HostTypes> {
fn resolve(&self, handle: CompositionHandle<H>) -> Option<CompositionRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct CompositionRecord<H: HostTypes> {
pub composition_result_handle: TransformHandle<H>,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedComposition<'r, R: CompositionResolver<H>, H: HostTypes> {
handle: CompositionHandle<H>,
resolver: &'r R,
record: Option<CompositionRecord<H>>,
}
impl<'r, R: CompositionResolver<H>, H: HostTypes> ResolvedComposition<'r, R, H> {
#[inline]
pub fn new(handle: CompositionHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> CompositionHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&CompositionRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: CompositionResolver<H>, H: HostTypes> Transform<H> for ResolvedComposition<'r, R, H> {
fn source(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn target(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn preserves_count(&self) -> usize {
0
}
fn preserves_at(&self, _index: usize) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type ComputationTrace = crate::bridge::trace::NullComputationTrace<H>;
fn trace(&self) -> &Self::ComputationTrace {
&<crate::bridge::trace::NullComputationTrace<H>>::ABSENT
}
type TransformTarget = NullTransform<H>;
fn composes_with(&self) -> &[Self::TransformTarget] {
&[]
}
type Identity = crate::kernel::op::NullIdentity<H>;
fn preserved_invariant(&self) -> &Self::Identity {
&<crate::kernel::op::NullIdentity<H>>::ABSENT
}
fn input_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn output_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type Witness = NullWitness<H>;
fn has_witness(&self) -> &[Self::Witness] {
&[]
}
}
impl<'r, R: CompositionResolver<H>, H: HostTypes> Composition<H> for ResolvedComposition<'r, R, H> {
type Transform = NullTransform<H>;
fn composition_result(&self) -> &Self::Transform {
&<NullTransform<H>>::ABSENT
}
fn composition_components(&self) -> &[Self::Transform] {
&[]
}
}
impl<'r, R: CompositionResolver<H>, H: HostTypes> ResolvedComposition<'r, R, H> {
#[inline]
pub fn resolve_composition_result<'r2, R2: TransformResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<ResolvedTransform<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(ResolvedTransform::new(record.composition_result_handle, r))
}
}
#[derive(Debug)]
pub struct IdentityHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for IdentityHandle<H> {}
impl<H: HostTypes> Clone for IdentityHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for IdentityHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for IdentityHandle<H> {}
impl<H: HostTypes> core::hash::Hash for IdentityHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> IdentityHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait IdentityResolver<H: HostTypes> {
fn resolve(&self, handle: IdentityHandle<H>) -> Option<IdentityRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct IdentityRecord<H: HostTypes> {
pub identity_on_handle: crate::user::type_::TypeDefinitionHandle<H>,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedIdentity<'r, R: IdentityResolver<H>, H: HostTypes> {
handle: IdentityHandle<H>,
resolver: &'r R,
record: Option<IdentityRecord<H>>,
}
impl<'r, R: IdentityResolver<H>, H: HostTypes> ResolvedIdentity<'r, R, H> {
#[inline]
pub fn new(handle: IdentityHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> IdentityHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&IdentityRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: IdentityResolver<H>, H: HostTypes> Transform<H> for ResolvedIdentity<'r, R, H> {
fn source(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn target(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn preserves_count(&self) -> usize {
0
}
fn preserves_at(&self, _index: usize) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type ComputationTrace = crate::bridge::trace::NullComputationTrace<H>;
fn trace(&self) -> &Self::ComputationTrace {
&<crate::bridge::trace::NullComputationTrace<H>>::ABSENT
}
type TransformTarget = NullTransform<H>;
fn composes_with(&self) -> &[Self::TransformTarget] {
&[]
}
type Identity = crate::kernel::op::NullIdentity<H>;
fn preserved_invariant(&self) -> &Self::Identity {
&<crate::kernel::op::NullIdentity<H>>::ABSENT
}
fn input_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn output_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type Witness = NullWitness<H>;
fn has_witness(&self) -> &[Self::Witness] {
&[]
}
}
impl<'r, R: IdentityResolver<H>, H: HostTypes> Identity<H> for ResolvedIdentity<'r, R, H> {
type TypeDefinition = crate::user::type_::NullTypeDefinition<H>;
fn identity_on(&self) -> &Self::TypeDefinition {
&<crate::user::type_::NullTypeDefinition<H>>::ABSENT
}
}
impl<'r, R: IdentityResolver<H>, H: HostTypes> ResolvedIdentity<'r, R, H> {
#[inline]
pub fn resolve_identity_on<'r2, R2: crate::user::type_::TypeDefinitionResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::user::type_::ResolvedTypeDefinition<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::user::type_::ResolvedTypeDefinition::new(
record.identity_on_handle,
r,
))
}
}
#[derive(Debug)]
pub struct CompositionLawHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for CompositionLawHandle<H> {}
impl<H: HostTypes> Clone for CompositionLawHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for CompositionLawHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for CompositionLawHandle<H> {}
impl<H: HostTypes> core::hash::Hash for CompositionLawHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> CompositionLawHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait CompositionLawResolver<H: HostTypes> {
fn resolve(&self, handle: CompositionLawHandle<H>) -> Option<CompositionLawRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct CompositionLawRecord<H: HostTypes> {
pub is_associative: bool,
pub is_commutative: bool,
pub law_result_handle: crate::kernel::op::OperationHandle<H>,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedCompositionLaw<'r, R: CompositionLawResolver<H>, H: HostTypes> {
handle: CompositionLawHandle<H>,
resolver: &'r R,
record: Option<CompositionLawRecord<H>>,
}
impl<'r, R: CompositionLawResolver<H>, H: HostTypes> ResolvedCompositionLaw<'r, R, H> {
#[inline]
pub fn new(handle: CompositionLawHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> CompositionLawHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&CompositionLawRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: CompositionLawResolver<H>, H: HostTypes> CompositionLaw<H>
for ResolvedCompositionLaw<'r, R, H>
{
fn is_associative(&self) -> bool {
match &self.record {
Some(r) => r.is_associative,
None => false,
}
}
fn is_commutative(&self) -> bool {
match &self.record {
Some(r) => r.is_commutative,
None => false,
}
}
type Operation = crate::kernel::op::NullOperation<H>;
fn law_components(&self) -> &[Self::Operation] {
&[]
}
fn law_result(&self) -> &Self::Operation {
&<crate::kernel::op::NullOperation<H>>::ABSENT
}
}
impl<'r, R: CompositionLawResolver<H>, H: HostTypes> ResolvedCompositionLaw<'r, R, H> {
#[inline]
pub fn resolve_law_result<'r2, R2: crate::kernel::op::OperationResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::kernel::op::ResolvedOperation<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::kernel::op::ResolvedOperation::new(
record.law_result_handle,
r,
))
}
}
#[derive(Debug)]
pub struct GroundingMapHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for GroundingMapHandle<H> {}
impl<H: HostTypes> Clone for GroundingMapHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for GroundingMapHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for GroundingMapHandle<H> {}
impl<H: HostTypes> core::hash::Hash for GroundingMapHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> GroundingMapHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait GroundingMapResolver<H: HostTypes> {
fn resolve(&self, handle: GroundingMapHandle<H>) -> Option<GroundingMapRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct GroundingMapRecord<H: HostTypes> {
pub grounding_derivation_handle: crate::bridge::derivation::DerivationHandle<H>,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedGroundingMap<'r, R: GroundingMapResolver<H>, H: HostTypes> {
handle: GroundingMapHandle<H>,
resolver: &'r R,
record: Option<GroundingMapRecord<H>>,
}
impl<'r, R: GroundingMapResolver<H>, H: HostTypes> ResolvedGroundingMap<'r, R, H> {
#[inline]
pub fn new(handle: GroundingMapHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> GroundingMapHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&GroundingMapRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: GroundingMapResolver<H>, H: HostTypes> Transform<H> for ResolvedGroundingMap<'r, R, H> {
fn source(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn target(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn preserves_count(&self) -> usize {
0
}
fn preserves_at(&self, _index: usize) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type ComputationTrace = crate::bridge::trace::NullComputationTrace<H>;
fn trace(&self) -> &Self::ComputationTrace {
&<crate::bridge::trace::NullComputationTrace<H>>::ABSENT
}
type TransformTarget = NullTransform<H>;
fn composes_with(&self) -> &[Self::TransformTarget] {
&[]
}
type Identity = crate::kernel::op::NullIdentity<H>;
fn preserved_invariant(&self) -> &Self::Identity {
&<crate::kernel::op::NullIdentity<H>>::ABSENT
}
fn input_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn output_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type Witness = NullWitness<H>;
fn has_witness(&self) -> &[Self::Witness] {
&[]
}
}
impl<'r, R: GroundingMapResolver<H>, H: HostTypes> GroundingMap<H>
for ResolvedGroundingMap<'r, R, H>
{
type Derivation = crate::bridge::derivation::NullDerivation<H>;
fn grounding_derivation(&self) -> &Self::Derivation {
&<crate::bridge::derivation::NullDerivation<H>>::ABSENT
}
type Constraint = crate::user::type_::NullConstraint<H>;
fn symbol_constraints(&self) -> &[Self::Constraint] {
&[]
}
}
impl<'r, R: GroundingMapResolver<H>, H: HostTypes> ResolvedGroundingMap<'r, R, H> {
#[inline]
pub fn resolve_grounding_derivation<
'r2,
R2: crate::bridge::derivation::DerivationResolver<H>,
>(
&self,
r: &'r2 R2,
) -> Option<crate::bridge::derivation::ResolvedDerivation<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::bridge::derivation::ResolvedDerivation::new(
record.grounding_derivation_handle,
r,
))
}
}
#[derive(Debug)]
pub struct ProjectionMapHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for ProjectionMapHandle<H> {}
impl<H: HostTypes> Clone for ProjectionMapHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for ProjectionMapHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for ProjectionMapHandle<H> {}
impl<H: HostTypes> core::hash::Hash for ProjectionMapHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> ProjectionMapHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait ProjectionMapResolver<H: HostTypes> {
fn resolve(&self, handle: ProjectionMapHandle<H>) -> Option<ProjectionMapRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct ProjectionMapRecord<H: HostTypes> {
pub projection_frame_handle: crate::user::state::FrameHandle<H>,
pub projection_order_handle: crate::user::type_::ConjunctionHandle<H>,
pub round_trip_coherence: bool,
pub output_element_class: &'static H::HostString,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedProjectionMap<'r, R: ProjectionMapResolver<H>, H: HostTypes> {
handle: ProjectionMapHandle<H>,
resolver: &'r R,
record: Option<ProjectionMapRecord<H>>,
}
impl<'r, R: ProjectionMapResolver<H>, H: HostTypes> ResolvedProjectionMap<'r, R, H> {
#[inline]
pub fn new(handle: ProjectionMapHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> ProjectionMapHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&ProjectionMapRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: ProjectionMapResolver<H>, H: HostTypes> Transform<H>
for ResolvedProjectionMap<'r, R, H>
{
fn source(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn target(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn preserves_count(&self) -> usize {
0
}
fn preserves_at(&self, _index: usize) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type ComputationTrace = crate::bridge::trace::NullComputationTrace<H>;
fn trace(&self) -> &Self::ComputationTrace {
&<crate::bridge::trace::NullComputationTrace<H>>::ABSENT
}
type TransformTarget = NullTransform<H>;
fn composes_with(&self) -> &[Self::TransformTarget] {
&[]
}
type Identity = crate::kernel::op::NullIdentity<H>;
fn preserved_invariant(&self) -> &Self::Identity {
&<crate::kernel::op::NullIdentity<H>>::ABSENT
}
fn input_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn output_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type Witness = NullWitness<H>;
fn has_witness(&self) -> &[Self::Witness] {
&[]
}
}
impl<'r, R: ProjectionMapResolver<H>, H: HostTypes> ProjectionMap<H>
for ResolvedProjectionMap<'r, R, H>
{
type Frame = crate::user::state::NullFrame<H>;
fn projection_frame(&self) -> &Self::Frame {
&<crate::user::state::NullFrame<H>>::ABSENT
}
type Conjunction = crate::user::type_::NullConjunction<H>;
fn projection_order(&self) -> &Self::Conjunction {
&<crate::user::type_::NullConjunction<H>>::ABSENT
}
fn round_trip_coherence(&self) -> bool {
match &self.record {
Some(r) => r.round_trip_coherence,
None => false,
}
}
fn output_element_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
}
impl<'r, R: ProjectionMapResolver<H>, H: HostTypes> ResolvedProjectionMap<'r, R, H> {
#[inline]
pub fn resolve_projection_frame<'r2, R2: crate::user::state::FrameResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::user::state::ResolvedFrame<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::user::state::ResolvedFrame::new(
record.projection_frame_handle,
r,
))
}
#[inline]
pub fn resolve_projection_order<'r2, R2: crate::user::type_::ConjunctionResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::user::type_::ResolvedConjunction<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::user::type_::ResolvedConjunction::new(
record.projection_order_handle,
r,
))
}
}
#[derive(Debug)]
pub struct GroundingCertificateHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for GroundingCertificateHandle<H> {}
impl<H: HostTypes> Clone for GroundingCertificateHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for GroundingCertificateHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for GroundingCertificateHandle<H> {}
impl<H: HostTypes> core::hash::Hash for GroundingCertificateHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> GroundingCertificateHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait GroundingCertificateResolver<H: HostTypes> {
fn resolve(
&self,
handle: GroundingCertificateHandle<H>,
) -> Option<GroundingCertificateRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct GroundingCertificateRecord<H: HostTypes> {
pub grounding_cert_map_handle: GroundingMapHandle<H>,
pub grounding_cert_projection_handle: ProjectionMapHandle<H>,
pub grounding_cert_source_symbol_handle: crate::kernel::schema::LiteralHandle<H>,
pub grounding_cert_address_handle: crate::kernel::address::ElementHandle<H>,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedGroundingCertificate<'r, R: GroundingCertificateResolver<H>, H: HostTypes> {
handle: GroundingCertificateHandle<H>,
resolver: &'r R,
record: Option<GroundingCertificateRecord<H>>,
}
impl<'r, R: GroundingCertificateResolver<H>, H: HostTypes> ResolvedGroundingCertificate<'r, R, H> {
#[inline]
pub fn new(handle: GroundingCertificateHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> GroundingCertificateHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&GroundingCertificateRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: GroundingCertificateResolver<H>, H: HostTypes> crate::bridge::cert::Certificate<H>
for ResolvedGroundingCertificate<'r, R, H>
{
fn method(&self) -> ProofStrategy {
<ProofStrategy>::default()
}
fn verified(&self) -> bool {
false
}
fn witt_length(&self) -> u64 {
0
}
fn timestamp(&self) -> &H::WitnessBytes {
H::EMPTY_WITNESS_BYTES
}
fn certifies(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
}
impl<'r, R: GroundingCertificateResolver<H>, H: HostTypes> GroundingCertificate<H>
for ResolvedGroundingCertificate<'r, R, H>
{
type GroundingMap = NullGroundingMap<H>;
fn grounding_cert_map(&self) -> &Self::GroundingMap {
&<NullGroundingMap<H>>::ABSENT
}
type ProjectionMap = NullProjectionMap<H>;
fn grounding_cert_projection(&self) -> &Self::ProjectionMap {
&<NullProjectionMap<H>>::ABSENT
}
type Literal = crate::kernel::schema::NullLiteral<H>;
fn grounding_cert_source_symbol(&self) -> &Self::Literal {
&<crate::kernel::schema::NullLiteral<H>>::ABSENT
}
type Element = crate::kernel::address::NullElement<H>;
fn grounding_cert_address(&self) -> &Self::Element {
&<crate::kernel::address::NullElement<H>>::ABSENT
}
}
impl<'r, R: GroundingCertificateResolver<H>, H: HostTypes> ResolvedGroundingCertificate<'r, R, H> {
#[inline]
pub fn resolve_grounding_cert_map<'r2, R2: GroundingMapResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<ResolvedGroundingMap<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(ResolvedGroundingMap::new(
record.grounding_cert_map_handle,
r,
))
}
#[inline]
pub fn resolve_grounding_cert_projection<'r2, R2: ProjectionMapResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<ResolvedProjectionMap<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(ResolvedProjectionMap::new(
record.grounding_cert_projection_handle,
r,
))
}
#[inline]
pub fn resolve_grounding_cert_source_symbol<
'r2,
R2: crate::kernel::schema::LiteralResolver<H>,
>(
&self,
r: &'r2 R2,
) -> Option<crate::kernel::schema::ResolvedLiteral<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::kernel::schema::ResolvedLiteral::new(
record.grounding_cert_source_symbol_handle,
r,
))
}
#[inline]
pub fn resolve_grounding_cert_address<'r2, R2: crate::kernel::address::ElementResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::kernel::address::ResolvedElement<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::kernel::address::ResolvedElement::new(
record.grounding_cert_address_handle,
r,
))
}
}
#[derive(Debug)]
pub struct TopologicalDeltaHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for TopologicalDeltaHandle<H> {}
impl<H: HostTypes> Clone for TopologicalDeltaHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for TopologicalDeltaHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for TopologicalDeltaHandle<H> {}
impl<H: HostTypes> core::hash::Hash for TopologicalDeltaHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> TopologicalDeltaHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait TopologicalDeltaResolver<H: HostTypes> {
fn resolve(&self, handle: TopologicalDeltaHandle<H>) -> Option<TopologicalDeltaRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct TopologicalDeltaRecord<H: HostTypes> {
pub bettis_before_handle: crate::bridge::observable::BettiNumberHandle<H>,
pub bettis_after_handle: crate::bridge::observable::BettiNumberHandle<H>,
pub euler_before: i64,
pub euler_after: i64,
pub nerve_before_handle: crate::bridge::homology::SimplicialComplexHandle<H>,
pub nerve_after_handle: crate::bridge::homology::SimplicialComplexHandle<H>,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedTopologicalDelta<'r, R: TopologicalDeltaResolver<H>, H: HostTypes> {
handle: TopologicalDeltaHandle<H>,
resolver: &'r R,
record: Option<TopologicalDeltaRecord<H>>,
}
impl<'r, R: TopologicalDeltaResolver<H>, H: HostTypes> ResolvedTopologicalDelta<'r, R, H> {
#[inline]
pub fn new(handle: TopologicalDeltaHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> TopologicalDeltaHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&TopologicalDeltaRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: TopologicalDeltaResolver<H>, H: HostTypes> TopologicalDelta<H>
for ResolvedTopologicalDelta<'r, R, H>
{
type BettiNumber = crate::bridge::observable::NullBettiNumber<H>;
fn bettis_before(&self) -> &Self::BettiNumber {
&<crate::bridge::observable::NullBettiNumber<H>>::ABSENT
}
fn bettis_after(&self) -> &Self::BettiNumber {
&<crate::bridge::observable::NullBettiNumber<H>>::ABSENT
}
fn euler_before(&self) -> i64 {
match &self.record {
Some(r) => r.euler_before,
None => 0,
}
}
fn euler_after(&self) -> i64 {
match &self.record {
Some(r) => r.euler_after,
None => 0,
}
}
type SimplicialComplex = crate::bridge::homology::NullSimplicialComplex<H>;
fn nerve_before(&self) -> &Self::SimplicialComplex {
&<crate::bridge::homology::NullSimplicialComplex<H>>::ABSENT
}
fn nerve_after(&self) -> &Self::SimplicialComplex {
&<crate::bridge::homology::NullSimplicialComplex<H>>::ABSENT
}
}
impl<'r, R: TopologicalDeltaResolver<H>, H: HostTypes> ResolvedTopologicalDelta<'r, R, H> {
#[inline]
pub fn resolve_bettis_before<'r2, R2: crate::bridge::observable::BettiNumberResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::bridge::observable::ResolvedBettiNumber<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::bridge::observable::ResolvedBettiNumber::new(
record.bettis_before_handle,
r,
))
}
#[inline]
pub fn resolve_bettis_after<'r2, R2: crate::bridge::observable::BettiNumberResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::bridge::observable::ResolvedBettiNumber<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::bridge::observable::ResolvedBettiNumber::new(
record.bettis_after_handle,
r,
))
}
#[inline]
pub fn resolve_nerve_before<'r2, R2: crate::bridge::homology::SimplicialComplexResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::bridge::homology::ResolvedSimplicialComplex<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::bridge::homology::ResolvedSimplicialComplex::new(
record.nerve_before_handle,
r,
))
}
#[inline]
pub fn resolve_nerve_after<'r2, R2: crate::bridge::homology::SimplicialComplexResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::bridge::homology::ResolvedSimplicialComplex<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::bridge::homology::ResolvedSimplicialComplex::new(
record.nerve_after_handle,
r,
))
}
}
#[derive(Debug)]
pub struct ComputationDatumHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for ComputationDatumHandle<H> {}
impl<H: HostTypes> Clone for ComputationDatumHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for ComputationDatumHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for ComputationDatumHandle<H> {}
impl<H: HostTypes> core::hash::Hash for ComputationDatumHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> ComputationDatumHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait ComputationDatumResolver<H: HostTypes> {
fn resolve(&self, handle: ComputationDatumHandle<H>) -> Option<ComputationDatumRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct ComputationDatumRecord<H: HostTypes> {
pub referenced_certificate_handle: crate::bridge::cert::TransformCertificateHandle<H>,
pub computation_address_handle: crate::kernel::address::ElementHandle<H>,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedComputationDatum<'r, R: ComputationDatumResolver<H>, H: HostTypes> {
handle: ComputationDatumHandle<H>,
resolver: &'r R,
record: Option<ComputationDatumRecord<H>>,
}
impl<'r, R: ComputationDatumResolver<H>, H: HostTypes> ResolvedComputationDatum<'r, R, H> {
#[inline]
pub fn new(handle: ComputationDatumHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> ComputationDatumHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&ComputationDatumRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: ComputationDatumResolver<H>, H: HostTypes> crate::kernel::schema::Datum<H>
for ResolvedComputationDatum<'r, R, H>
{
fn value(&self) -> u64 {
0
}
fn witt_length(&self) -> u64 {
0
}
fn stratum(&self) -> u64 {
0
}
fn spectrum(&self) -> u64 {
0
}
type Element = crate::kernel::address::NullElement<H>;
fn element(&self) -> &Self::Element {
&<crate::kernel::address::NullElement<H>>::ABSENT
}
}
impl<'r, R: ComputationDatumResolver<H>, H: HostTypes> ComputationDatum<H>
for ResolvedComputationDatum<'r, R, H>
{
type TransformCertificate = crate::bridge::cert::NullTransformCertificate<H>;
fn referenced_certificate(&self) -> &Self::TransformCertificate {
&<crate::bridge::cert::NullTransformCertificate<H>>::ABSENT
}
fn computation_address(&self) -> &Self::Element {
&<crate::kernel::address::NullElement<H>>::ABSENT
}
}
impl<'r, R: ComputationDatumResolver<H>, H: HostTypes> ResolvedComputationDatum<'r, R, H> {
#[inline]
pub fn resolve_referenced_certificate<
'r2,
R2: crate::bridge::cert::TransformCertificateResolver<H>,
>(
&self,
r: &'r2 R2,
) -> Option<crate::bridge::cert::ResolvedTransformCertificate<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::bridge::cert::ResolvedTransformCertificate::new(
record.referenced_certificate_handle,
r,
))
}
#[inline]
pub fn resolve_computation_address<'r2, R2: crate::kernel::address::ElementResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::kernel::address::ResolvedElement<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::kernel::address::ResolvedElement::new(
record.computation_address_handle,
r,
))
}
}
#[derive(Debug)]
pub struct ApplicationMorphismHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for ApplicationMorphismHandle<H> {}
impl<H: HostTypes> Clone for ApplicationMorphismHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for ApplicationMorphismHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for ApplicationMorphismHandle<H> {}
impl<H: HostTypes> core::hash::Hash for ApplicationMorphismHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> ApplicationMorphismHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait ApplicationMorphismResolver<H: HostTypes> {
fn resolve(&self, handle: ApplicationMorphismHandle<H>)
-> Option<ApplicationMorphismRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct ApplicationMorphismRecord<H: HostTypes> {
pub application_target_handle: ComputationDatumHandle<H>,
pub application_input_handle: crate::kernel::schema::DatumHandle<H>,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedApplicationMorphism<'r, R: ApplicationMorphismResolver<H>, H: HostTypes> {
handle: ApplicationMorphismHandle<H>,
resolver: &'r R,
record: Option<ApplicationMorphismRecord<H>>,
}
impl<'r, R: ApplicationMorphismResolver<H>, H: HostTypes> ResolvedApplicationMorphism<'r, R, H> {
#[inline]
pub fn new(handle: ApplicationMorphismHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> ApplicationMorphismHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&ApplicationMorphismRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: ApplicationMorphismResolver<H>, H: HostTypes> Transform<H>
for ResolvedApplicationMorphism<'r, R, H>
{
fn source(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn target(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn preserves_count(&self) -> usize {
0
}
fn preserves_at(&self, _index: usize) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type ComputationTrace = crate::bridge::trace::NullComputationTrace<H>;
fn trace(&self) -> &Self::ComputationTrace {
&<crate::bridge::trace::NullComputationTrace<H>>::ABSENT
}
type TransformTarget = NullTransform<H>;
fn composes_with(&self) -> &[Self::TransformTarget] {
&[]
}
type Identity = crate::kernel::op::NullIdentity<H>;
fn preserved_invariant(&self) -> &Self::Identity {
&<crate::kernel::op::NullIdentity<H>>::ABSENT
}
fn input_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
fn output_class(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
type Witness = NullWitness<H>;
fn has_witness(&self) -> &[Self::Witness] {
&[]
}
}
impl<'r, R: ApplicationMorphismResolver<H>, H: HostTypes> ApplicationMorphism<H>
for ResolvedApplicationMorphism<'r, R, H>
{
type ComputationDatum = NullComputationDatum<H>;
fn application_target(&self) -> &Self::ComputationDatum {
&<NullComputationDatum<H>>::ABSENT
}
type Datum = crate::kernel::schema::NullDatum<H>;
fn application_input(&self) -> &Self::Datum {
&<crate::kernel::schema::NullDatum<H>>::ABSENT
}
}
impl<'r, R: ApplicationMorphismResolver<H>, H: HostTypes> ResolvedApplicationMorphism<'r, R, H> {
#[inline]
pub fn resolve_application_target<'r2, R2: ComputationDatumResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<ResolvedComputationDatum<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(ResolvedComputationDatum::new(
record.application_target_handle,
r,
))
}
#[inline]
pub fn resolve_application_input<'r2, R2: crate::kernel::schema::DatumResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::kernel::schema::ResolvedDatum<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::kernel::schema::ResolvedDatum::new(
record.application_input_handle,
r,
))
}
}
#[derive(Debug)]
pub struct PartialApplicationHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for PartialApplicationHandle<H> {}
impl<H: HostTypes> Clone for PartialApplicationHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for PartialApplicationHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for PartialApplicationHandle<H> {}
impl<H: HostTypes> core::hash::Hash for PartialApplicationHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> PartialApplicationHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait PartialApplicationResolver<H: HostTypes> {
fn resolve(&self, handle: PartialApplicationHandle<H>) -> Option<PartialApplicationRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct PartialApplicationRecord<H: HostTypes> {
pub partial_base_handle: ComputationDatumHandle<H>,
pub remaining_arity: u64,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedPartialApplication<'r, R: PartialApplicationResolver<H>, H: HostTypes> {
handle: PartialApplicationHandle<H>,
resolver: &'r R,
record: Option<PartialApplicationRecord<H>>,
}
impl<'r, R: PartialApplicationResolver<H>, H: HostTypes> ResolvedPartialApplication<'r, R, H> {
#[inline]
pub fn new(handle: PartialApplicationHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> PartialApplicationHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&PartialApplicationRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: PartialApplicationResolver<H>, H: HostTypes> crate::kernel::schema::Datum<H>
for ResolvedPartialApplication<'r, R, H>
{
fn value(&self) -> u64 {
0
}
fn witt_length(&self) -> u64 {
0
}
fn stratum(&self) -> u64 {
0
}
fn spectrum(&self) -> u64 {
0
}
type Element = crate::kernel::address::NullElement<H>;
fn element(&self) -> &Self::Element {
&<crate::kernel::address::NullElement<H>>::ABSENT
}
}
impl<'r, R: PartialApplicationResolver<H>, H: HostTypes> ComputationDatum<H>
for ResolvedPartialApplication<'r, R, H>
{
type TransformCertificate = crate::bridge::cert::NullTransformCertificate<H>;
fn referenced_certificate(&self) -> &Self::TransformCertificate {
&<crate::bridge::cert::NullTransformCertificate<H>>::ABSENT
}
fn computation_address(&self) -> &Self::Element {
&<crate::kernel::address::NullElement<H>>::ABSENT
}
}
impl<'r, R: PartialApplicationResolver<H>, H: HostTypes> PartialApplication<H>
for ResolvedPartialApplication<'r, R, H>
{
type ComputationDatum = NullComputationDatum<H>;
fn partial_base(&self) -> &Self::ComputationDatum {
&<NullComputationDatum<H>>::ABSENT
}
type Datum = crate::kernel::schema::NullDatum<H>;
fn bound_arguments(&self) -> &[Self::Datum] {
&[]
}
fn remaining_arity(&self) -> u64 {
match &self.record {
Some(r) => r.remaining_arity,
None => 0,
}
}
}
impl<'r, R: PartialApplicationResolver<H>, H: HostTypes> ResolvedPartialApplication<'r, R, H> {
#[inline]
pub fn resolve_partial_base<'r2, R2: ComputationDatumResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<ResolvedComputationDatum<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(ResolvedComputationDatum::new(record.partial_base_handle, r))
}
}
#[derive(Debug)]
pub struct TransformCompositionHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for TransformCompositionHandle<H> {}
impl<H: HostTypes> Clone for TransformCompositionHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for TransformCompositionHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for TransformCompositionHandle<H> {}
impl<H: HostTypes> core::hash::Hash for TransformCompositionHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> TransformCompositionHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait TransformCompositionResolver<H: HostTypes> {
fn resolve(
&self,
handle: TransformCompositionHandle<H>,
) -> Option<TransformCompositionRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct TransformCompositionRecord<H: HostTypes> {
pub composition_left_handle: ComputationDatumHandle<H>,
pub composition_right_handle: ComputationDatumHandle<H>,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedTransformComposition<'r, R: TransformCompositionResolver<H>, H: HostTypes> {
handle: TransformCompositionHandle<H>,
resolver: &'r R,
record: Option<TransformCompositionRecord<H>>,
}
impl<'r, R: TransformCompositionResolver<H>, H: HostTypes> ResolvedTransformComposition<'r, R, H> {
#[inline]
pub fn new(handle: TransformCompositionHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> TransformCompositionHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&TransformCompositionRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: TransformCompositionResolver<H>, H: HostTypes> crate::kernel::schema::Datum<H>
for ResolvedTransformComposition<'r, R, H>
{
fn value(&self) -> u64 {
0
}
fn witt_length(&self) -> u64 {
0
}
fn stratum(&self) -> u64 {
0
}
fn spectrum(&self) -> u64 {
0
}
type Element = crate::kernel::address::NullElement<H>;
fn element(&self) -> &Self::Element {
&<crate::kernel::address::NullElement<H>>::ABSENT
}
}
impl<'r, R: TransformCompositionResolver<H>, H: HostTypes> ComputationDatum<H>
for ResolvedTransformComposition<'r, R, H>
{
type TransformCertificate = crate::bridge::cert::NullTransformCertificate<H>;
fn referenced_certificate(&self) -> &Self::TransformCertificate {
&<crate::bridge::cert::NullTransformCertificate<H>>::ABSENT
}
fn computation_address(&self) -> &Self::Element {
&<crate::kernel::address::NullElement<H>>::ABSENT
}
}
impl<'r, R: TransformCompositionResolver<H>, H: HostTypes> TransformComposition<H>
for ResolvedTransformComposition<'r, R, H>
{
type ComputationDatum = NullComputationDatum<H>;
fn composition_left(&self) -> &Self::ComputationDatum {
&<NullComputationDatum<H>>::ABSENT
}
fn composition_right(&self) -> &Self::ComputationDatum {
&<NullComputationDatum<H>>::ABSENT
}
}
impl<'r, R: TransformCompositionResolver<H>, H: HostTypes> ResolvedTransformComposition<'r, R, H> {
#[inline]
pub fn resolve_composition_left<'r2, R2: ComputationDatumResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<ResolvedComputationDatum<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(ResolvedComputationDatum::new(
record.composition_left_handle,
r,
))
}
#[inline]
pub fn resolve_composition_right<'r2, R2: ComputationDatumResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<ResolvedComputationDatum<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(ResolvedComputationDatum::new(
record.composition_right_handle,
r,
))
}
}
#[derive(Debug)]
pub struct SymbolSequenceHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for SymbolSequenceHandle<H> {}
impl<H: HostTypes> Clone for SymbolSequenceHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for SymbolSequenceHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for SymbolSequenceHandle<H> {}
impl<H: HostTypes> core::hash::Hash for SymbolSequenceHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> SymbolSequenceHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait SymbolSequenceResolver<H: HostTypes> {
fn resolve(&self, handle: SymbolSequenceHandle<H>) -> Option<SymbolSequenceRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct SymbolSequenceRecord<H: HostTypes> {
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedSymbolSequence<'r, R: SymbolSequenceResolver<H>, H: HostTypes> {
handle: SymbolSequenceHandle<H>,
resolver: &'r R,
record: Option<SymbolSequenceRecord<H>>,
}
impl<'r, R: SymbolSequenceResolver<H>, H: HostTypes> ResolvedSymbolSequence<'r, R, H> {
#[inline]
pub fn new(handle: SymbolSequenceHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> SymbolSequenceHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&SymbolSequenceRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: SymbolSequenceResolver<H>, H: HostTypes> SymbolSequence<H>
for ResolvedSymbolSequence<'r, R, H>
{
type SequenceElement = NullSequenceElement<H>;
fn has_element(&self) -> &[Self::SequenceElement] {
&[]
}
}
#[derive(Debug)]
pub struct SequenceElementHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for SequenceElementHandle<H> {}
impl<H: HostTypes> Clone for SequenceElementHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for SequenceElementHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for SequenceElementHandle<H> {}
impl<H: HostTypes> core::hash::Hash for SequenceElementHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> SequenceElementHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait SequenceElementResolver<H: HostTypes> {
fn resolve(&self, handle: SequenceElementHandle<H>) -> Option<SequenceElementRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct SequenceElementRecord<H: HostTypes> {
pub element_value_handle: crate::kernel::schema::SurfaceSymbolHandle<H>,
pub element_index: u64,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedSequenceElement<'r, R: SequenceElementResolver<H>, H: HostTypes> {
handle: SequenceElementHandle<H>,
resolver: &'r R,
record: Option<SequenceElementRecord<H>>,
}
impl<'r, R: SequenceElementResolver<H>, H: HostTypes> ResolvedSequenceElement<'r, R, H> {
#[inline]
pub fn new(handle: SequenceElementHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> SequenceElementHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&SequenceElementRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: SequenceElementResolver<H>, H: HostTypes> SequenceElement<H>
for ResolvedSequenceElement<'r, R, H>
{
type SurfaceSymbol = crate::kernel::schema::NullSurfaceSymbol<H>;
fn element_value(&self) -> &Self::SurfaceSymbol {
&<crate::kernel::schema::NullSurfaceSymbol<H>>::ABSENT
}
fn element_index(&self) -> u64 {
match &self.record {
Some(r) => r.element_index,
None => 0,
}
}
}
impl<'r, R: SequenceElementResolver<H>, H: HostTypes> ResolvedSequenceElement<'r, R, H> {
#[inline]
pub fn resolve_element_value<'r2, R2: crate::kernel::schema::SurfaceSymbolResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::kernel::schema::ResolvedSurfaceSymbol<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::kernel::schema::ResolvedSurfaceSymbol::new(
record.element_value_handle,
r,
))
}
}
pub mod critical_composition {
pub const IS_ASSOCIATIVE: bool = false;
pub const IS_COMMUTATIVE: bool = false;
pub const LAW_COMPONENTS: &[&str] = &[
"https://uor.foundation/op/neg",
"https://uor.foundation/op/bnot",
];
pub const LAW_RESULT: &str = "https://uor.foundation/op/succ";
}
pub mod integer_grounding_map {
pub const INPUT_CLASS: &str = "https://uor.foundation/schema/Literal";
pub const OUTPUT_CLASS: &str = "https://uor.foundation/u/Element";
}
pub mod utf8_grounding_map {
pub const INPUT_CLASS: &str = "https://uor.foundation/schema/HostStringLiteral";
pub const OUTPUT_CLASS: &str = "https://uor.foundation/u/Element";
}
pub mod json_grounding_map {
pub const INPUT_CLASS: &str = "https://uor.foundation/schema/HostStringLiteral";
pub const OUTPUT_CLASS: &str = "https://uor.foundation/u/Element";
}
pub mod digest_grounding_map {
pub const INPUT_CLASS: &str = "https://uor.foundation/schema/HostStringLiteral";
pub const OUTPUT_CLASS: &str = "https://uor.foundation/u/Element";
}
pub mod binary_grounding_map {
pub const INPUT_CLASS: &str = "https://uor.foundation/schema/HostStringLiteral";
pub const OUTPUT_CLASS: &str = "https://uor.foundation/u/Element";
}
pub mod integer_projection_map {
pub const INPUT_CLASS: &str = "https://uor.foundation/partition/Partition";
pub const OUTPUT_CLASS: &str = "https://uor.foundation/morphism/SymbolSequence";
pub const OUTPUT_ELEMENT_CLASS: &str = "https://uor.foundation/schema/Literal";
}
pub mod utf8_projection_map {
pub const INPUT_CLASS: &str = "https://uor.foundation/partition/Partition";
pub const OUTPUT_CLASS: &str = "https://uor.foundation/morphism/SymbolSequence";
pub const OUTPUT_ELEMENT_CLASS: &str = "https://uor.foundation/schema/HostStringLiteral";
}
pub mod json_projection_map {
pub const INPUT_CLASS: &str = "https://uor.foundation/partition/Partition";
pub const OUTPUT_CLASS: &str = "https://uor.foundation/morphism/SymbolSequence";
pub const OUTPUT_ELEMENT_CLASS: &str = "https://uor.foundation/schema/HostStringLiteral";
}
pub mod digest_projection_map {
pub const INPUT_CLASS: &str = "https://uor.foundation/partition/Partition";
pub const OUTPUT_CLASS: &str = "https://uor.foundation/morphism/SymbolSequence";
pub const OUTPUT_ELEMENT_CLASS: &str = "https://uor.foundation/schema/Literal";
}
pub mod binary_projection_map {
pub const INPUT_CLASS: &str = "https://uor.foundation/partition/Partition";
pub const OUTPUT_CLASS: &str = "https://uor.foundation/morphism/SymbolSequence";
pub const OUTPUT_ELEMENT_CLASS: &str = "https://uor.foundation/schema/Literal";
}