use crate::enums::ProofStrategy;
use crate::enums::WittLevel;
use crate::HostTypes;
pub trait Certificate<H: HostTypes> {
fn method(&self) -> ProofStrategy;
fn verified(&self) -> bool;
fn witt_length(&self) -> u64;
fn timestamp(&self) -> &H::WitnessBytes;
fn certifies(&self) -> &H::HostString;
}
pub trait TransformCertificate<H: HostTypes>: Certificate<H> {
type TermExpression: crate::kernel::schema::TermExpression<H>;
fn transform_type(&self) -> &Self::TermExpression;
}
pub trait IsometryCertificate<H: HostTypes>: Certificate<H> {}
pub trait InvolutionCertificate<H: HostTypes>: Certificate<H> {
type Operation: crate::kernel::op::Operation<H>;
fn operation(&self) -> &Self::Operation;
}
pub trait CompletenessCertificate<H: HostTypes>: Certificate<H> {
type CompleteType: crate::user::type_::CompleteType<H>;
fn certified_type(&self) -> &Self::CompleteType;
type CompletenessAuditTrail: CompletenessAuditTrail<H>;
fn audit_trail(&self) -> &Self::CompletenessAuditTrail;
}
pub trait CompletenessAuditTrail<H: HostTypes> {
fn witness_count(&self) -> u64;
}
pub trait GroundingCertificate<H: HostTypes>: Certificate<H> {
type GroundedContext: crate::user::state::GroundedContext<H>;
fn certified_grounding(&self) -> &Self::GroundedContext;
type GroundingWitness: crate::user::state::GroundingWitness<H>;
fn grounding_witness(&self) -> &Self::GroundingWitness;
}
pub trait GeodesicCertificate<H: HostTypes>: Certificate<H> {
type GeodesicTrace: crate::bridge::trace::GeodesicTrace<H>;
fn certified_geodesic(&self) -> &Self::GeodesicTrace;
fn geodesic_trace(&self) -> &Self::GeodesicTrace;
type GeodesicEvidenceBundle: GeodesicEvidenceBundle<H>;
fn evidence_bundle(&self) -> &Self::GeodesicEvidenceBundle;
}
pub trait MeasurementCertificate<H: HostTypes>: Certificate<H> {
type MeasurementEvent: crate::bridge::trace::MeasurementEvent<H>;
fn certified_measurement(&self) -> &Self::MeasurementEvent;
fn von_neumann_entropy(&self) -> H::Decimal;
fn landauer_cost(&self) -> H::Decimal;
}
pub trait GeodesicEvidenceBundle<H: HostTypes> {
fn is_ar1_ordered(&self) -> bool;
fn is_dc10_selected(&self) -> bool;
}
pub trait BornRuleVerification<H: HostTypes>: Certificate<H> {
fn born_rule_verified(&self) -> bool;
}
pub trait LiftChainCertificate<H: HostTypes>: Certificate<H> {
type LiftChain: crate::user::type_::LiftChain<H>;
fn certified_chain(&self) -> &Self::LiftChain;
type ChainAuditTrail: ChainAuditTrail<H>;
fn chain_audit_trail(&self) -> &Self::ChainAuditTrail;
fn target_level(&self) -> WittLevel;
fn source_level(&self) -> WittLevel;
}
pub trait ChainAuditTrail<H: HostTypes> {
fn chain_step_count(&self) -> u64;
}
pub trait InhabitanceCertificate<H: HostTypes>:
crate::bridge::proof::ComputationCertificate<H> + Certificate<H>
{
type ValueTuple: crate::kernel::schema::ValueTuple<H>;
fn witness(&self) -> &[Self::ValueTuple];
type InhabitanceSearchTrace: crate::bridge::trace::InhabitanceSearchTrace<H>;
fn search_trace(&self) -> &Self::InhabitanceSearchTrace;
type ConstrainedType: crate::user::type_::ConstrainedType<H>;
fn grounded(&self) -> &Self::ConstrainedType;
}
pub trait MultiplicationCertificate<H: HostTypes>: Certificate<H> {
fn splitting_factor(&self) -> u64;
fn sub_multiplication_count(&self) -> u64;
fn landauer_cost_nats(&self) -> H::Decimal;
}
pub trait PartitionCertificate<H: HostTypes>: Certificate<H> {}
pub trait GenericImpossibilityCertificate<H: HostTypes>: Certificate<H> {}
pub trait InhabitanceImpossibilityCertificate<H: HostTypes>: Certificate<H> {}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullCertificate<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullCertificate<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullCertificate<H> {
pub const ABSENT: NullCertificate<H> = NullCertificate {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Certificate<H> for NullCertificate<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
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullTransformCertificate<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullTransformCertificate<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullTransformCertificate<H> {
pub const ABSENT: NullTransformCertificate<H> = NullTransformCertificate {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Certificate<H> for NullTransformCertificate<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> TransformCertificate<H> for NullTransformCertificate<H> {
type TermExpression = crate::kernel::schema::NullTermExpression<H>;
fn transform_type(&self) -> &Self::TermExpression {
&<crate::kernel::schema::NullTermExpression<H>>::ABSENT
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullIsometryCertificate<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullIsometryCertificate<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullIsometryCertificate<H> {
pub const ABSENT: NullIsometryCertificate<H> = NullIsometryCertificate {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Certificate<H> for NullIsometryCertificate<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> IsometryCertificate<H> for NullIsometryCertificate<H> {}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullInvolutionCertificate<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullInvolutionCertificate<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullInvolutionCertificate<H> {
pub const ABSENT: NullInvolutionCertificate<H> = NullInvolutionCertificate {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Certificate<H> for NullInvolutionCertificate<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> InvolutionCertificate<H> for NullInvolutionCertificate<H> {
type Operation = crate::kernel::op::NullOperation<H>;
fn operation(&self) -> &Self::Operation {
&<crate::kernel::op::NullOperation<H>>::ABSENT
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullCompletenessCertificate<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullCompletenessCertificate<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullCompletenessCertificate<H> {
pub const ABSENT: NullCompletenessCertificate<H> = NullCompletenessCertificate {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Certificate<H> for NullCompletenessCertificate<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> CompletenessCertificate<H> for NullCompletenessCertificate<H> {
type CompleteType = crate::user::type_::NullCompleteType<H>;
fn certified_type(&self) -> &Self::CompleteType {
&<crate::user::type_::NullCompleteType<H>>::ABSENT
}
type CompletenessAuditTrail = NullCompletenessAuditTrail<H>;
fn audit_trail(&self) -> &Self::CompletenessAuditTrail {
&<NullCompletenessAuditTrail<H>>::ABSENT
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullCompletenessAuditTrail<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullCompletenessAuditTrail<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullCompletenessAuditTrail<H> {
pub const ABSENT: NullCompletenessAuditTrail<H> = NullCompletenessAuditTrail {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> CompletenessAuditTrail<H> for NullCompletenessAuditTrail<H> {
fn witness_count(&self) -> u64 {
0
}
}
#[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> 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 GroundedContext = crate::user::state::NullGroundedContext<H>;
fn certified_grounding(&self) -> &Self::GroundedContext {
&<crate::user::state::NullGroundedContext<H>>::ABSENT
}
type GroundingWitness = crate::user::state::NullGroundingWitness<H>;
fn grounding_witness(&self) -> &Self::GroundingWitness {
&<crate::user::state::NullGroundingWitness<H>>::ABSENT
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullGeodesicCertificate<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullGeodesicCertificate<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullGeodesicCertificate<H> {
pub const ABSENT: NullGeodesicCertificate<H> = NullGeodesicCertificate {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Certificate<H> for NullGeodesicCertificate<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> GeodesicCertificate<H> for NullGeodesicCertificate<H> {
type GeodesicTrace = crate::bridge::trace::NullGeodesicTrace<H>;
fn certified_geodesic(&self) -> &Self::GeodesicTrace {
&<crate::bridge::trace::NullGeodesicTrace<H>>::ABSENT
}
fn geodesic_trace(&self) -> &Self::GeodesicTrace {
&<crate::bridge::trace::NullGeodesicTrace<H>>::ABSENT
}
type GeodesicEvidenceBundle = NullGeodesicEvidenceBundle<H>;
fn evidence_bundle(&self) -> &Self::GeodesicEvidenceBundle {
&<NullGeodesicEvidenceBundle<H>>::ABSENT
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullMeasurementCertificate<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullMeasurementCertificate<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullMeasurementCertificate<H> {
pub const ABSENT: NullMeasurementCertificate<H> = NullMeasurementCertificate {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Certificate<H> for NullMeasurementCertificate<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> MeasurementCertificate<H> for NullMeasurementCertificate<H> {
type MeasurementEvent = crate::bridge::trace::NullMeasurementEvent<H>;
fn certified_measurement(&self) -> &Self::MeasurementEvent {
&<crate::bridge::trace::NullMeasurementEvent<H>>::ABSENT
}
fn von_neumann_entropy(&self) -> H::Decimal {
H::EMPTY_DECIMAL
}
fn landauer_cost(&self) -> H::Decimal {
H::EMPTY_DECIMAL
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullGeodesicEvidenceBundle<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullGeodesicEvidenceBundle<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullGeodesicEvidenceBundle<H> {
pub const ABSENT: NullGeodesicEvidenceBundle<H> = NullGeodesicEvidenceBundle {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> GeodesicEvidenceBundle<H> for NullGeodesicEvidenceBundle<H> {
fn is_ar1_ordered(&self) -> bool {
false
}
fn is_dc10_selected(&self) -> bool {
false
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullBornRuleVerification<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullBornRuleVerification<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullBornRuleVerification<H> {
pub const ABSENT: NullBornRuleVerification<H> = NullBornRuleVerification {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Certificate<H> for NullBornRuleVerification<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> BornRuleVerification<H> for NullBornRuleVerification<H> {
fn born_rule_verified(&self) -> bool {
false
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullLiftChainCertificate<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullLiftChainCertificate<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullLiftChainCertificate<H> {
pub const ABSENT: NullLiftChainCertificate<H> = NullLiftChainCertificate {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Certificate<H> for NullLiftChainCertificate<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> LiftChainCertificate<H> for NullLiftChainCertificate<H> {
type LiftChain = crate::user::type_::NullLiftChain<H>;
fn certified_chain(&self) -> &Self::LiftChain {
&<crate::user::type_::NullLiftChain<H>>::ABSENT
}
type ChainAuditTrail = NullChainAuditTrail<H>;
fn chain_audit_trail(&self) -> &Self::ChainAuditTrail {
&<NullChainAuditTrail<H>>::ABSENT
}
fn target_level(&self) -> WittLevel {
<WittLevel>::default()
}
fn source_level(&self) -> WittLevel {
<WittLevel>::default()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullChainAuditTrail<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullChainAuditTrail<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullChainAuditTrail<H> {
pub const ABSENT: NullChainAuditTrail<H> = NullChainAuditTrail {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> ChainAuditTrail<H> for NullChainAuditTrail<H> {
fn chain_step_count(&self) -> u64 {
0
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullInhabitanceCertificate<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullInhabitanceCertificate<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullInhabitanceCertificate<H> {
pub const ABSENT: NullInhabitanceCertificate<H> = NullInhabitanceCertificate {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> crate::bridge::proof::Proof<H> for NullInhabitanceCertificate<H> {
fn verified(&self) -> bool {
false
}
fn timestamp(&self) -> &H::WitnessBytes {
H::EMPTY_WITNESS_BYTES
}
type WitnessData = crate::bridge::proof::NullWitnessData<H>;
fn witness(&self) -> &[Self::WitnessData] {
&[]
}
type Identity = crate::kernel::op::NullIdentity<H>;
fn proves_identity(&self) -> &Self::Identity {
&<crate::kernel::op::NullIdentity<H>>::ABSENT
}
fn verified_at_level(&self) -> &[WittLevel] {
&[]
}
fn strategy(&self) -> ProofStrategy {
<ProofStrategy>::default()
}
fn depends_on(&self) -> &[Self::Identity] {
&[]
}
type DerivationTerm = crate::bridge::proof::NullDerivationTerm<H>;
fn formal_derivation(&self) -> &Self::DerivationTerm {
&<crate::bridge::proof::NullDerivationTerm<H>>::ABSENT
}
}
impl<H: HostTypes> crate::bridge::proof::ComputationCertificate<H>
for NullInhabitanceCertificate<H>
{
fn at_witt_level(&self) -> WittLevel {
<WittLevel>::default()
}
}
impl<H: HostTypes> Certificate<H> for NullInhabitanceCertificate<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> InhabitanceCertificate<H> for NullInhabitanceCertificate<H> {
type ValueTuple = crate::kernel::schema::NullValueTuple<H>;
fn witness(&self) -> &[Self::ValueTuple] {
&[]
}
type InhabitanceSearchTrace = crate::bridge::trace::NullInhabitanceSearchTrace<H>;
fn search_trace(&self) -> &Self::InhabitanceSearchTrace {
&<crate::bridge::trace::NullInhabitanceSearchTrace<H>>::ABSENT
}
type ConstrainedType = crate::user::type_::NullConstrainedType<H>;
fn grounded(&self) -> &Self::ConstrainedType {
&<crate::user::type_::NullConstrainedType<H>>::ABSENT
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullMultiplicationCertificate<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullMultiplicationCertificate<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullMultiplicationCertificate<H> {
pub const ABSENT: NullMultiplicationCertificate<H> = NullMultiplicationCertificate {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Certificate<H> for NullMultiplicationCertificate<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> MultiplicationCertificate<H> for NullMultiplicationCertificate<H> {
fn splitting_factor(&self) -> u64 {
0
}
fn sub_multiplication_count(&self) -> u64 {
0
}
fn landauer_cost_nats(&self) -> H::Decimal {
H::EMPTY_DECIMAL
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullPartitionCertificate<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullPartitionCertificate<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullPartitionCertificate<H> {
pub const ABSENT: NullPartitionCertificate<H> = NullPartitionCertificate {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Certificate<H> for NullPartitionCertificate<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> PartitionCertificate<H> for NullPartitionCertificate<H> {}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullGenericImpossibilityCertificate<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullGenericImpossibilityCertificate<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullGenericImpossibilityCertificate<H> {
pub const ABSENT: NullGenericImpossibilityCertificate<H> =
NullGenericImpossibilityCertificate {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Certificate<H> for NullGenericImpossibilityCertificate<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> GenericImpossibilityCertificate<H> for NullGenericImpossibilityCertificate<H> {}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct NullInhabitanceImpossibilityCertificate<H: HostTypes> {
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Default for NullInhabitanceImpossibilityCertificate<H> {
fn default() -> Self {
Self {
_phantom: core::marker::PhantomData,
}
}
}
impl<H: HostTypes> NullInhabitanceImpossibilityCertificate<H> {
pub const ABSENT: NullInhabitanceImpossibilityCertificate<H> =
NullInhabitanceImpossibilityCertificate {
_phantom: core::marker::PhantomData,
};
}
impl<H: HostTypes> Certificate<H> for NullInhabitanceImpossibilityCertificate<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> InhabitanceImpossibilityCertificate<H>
for NullInhabitanceImpossibilityCertificate<H>
{
}
#[derive(Debug)]
pub struct CertificateHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for CertificateHandle<H> {}
impl<H: HostTypes> Clone for CertificateHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for CertificateHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for CertificateHandle<H> {}
impl<H: HostTypes> core::hash::Hash for CertificateHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> CertificateHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait CertificateResolver<H: HostTypes> {
fn resolve(&self, handle: CertificateHandle<H>) -> Option<CertificateRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct CertificateRecord<H: HostTypes> {
pub method: ProofStrategy,
pub verified: bool,
pub witt_length: u64,
pub timestamp: &'static H::WitnessBytes,
pub certifies: &'static H::HostString,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedCertificate<'r, R: CertificateResolver<H>, H: HostTypes> {
handle: CertificateHandle<H>,
resolver: &'r R,
record: Option<CertificateRecord<H>>,
}
impl<'r, R: CertificateResolver<H>, H: HostTypes> ResolvedCertificate<'r, R, H> {
#[inline]
pub fn new(handle: CertificateHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> CertificateHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&CertificateRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: CertificateResolver<H>, H: HostTypes> Certificate<H> for ResolvedCertificate<'r, R, H> {
fn method(&self) -> ProofStrategy {
match &self.record {
Some(r) => r.method,
None => <ProofStrategy>::default(),
}
}
fn verified(&self) -> bool {
match &self.record {
Some(r) => r.verified,
None => false,
}
}
fn witt_length(&self) -> u64 {
match &self.record {
Some(r) => r.witt_length,
None => 0,
}
}
fn timestamp(&self) -> &H::WitnessBytes {
match &self.record {
Some(r) => r.timestamp,
None => H::EMPTY_WITNESS_BYTES,
}
}
fn certifies(&self) -> &H::HostString {
H::EMPTY_HOST_STRING
}
}
#[derive(Debug)]
pub struct TransformCertificateHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for TransformCertificateHandle<H> {}
impl<H: HostTypes> Clone for TransformCertificateHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for TransformCertificateHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for TransformCertificateHandle<H> {}
impl<H: HostTypes> core::hash::Hash for TransformCertificateHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> TransformCertificateHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait TransformCertificateResolver<H: HostTypes> {
fn resolve(
&self,
handle: TransformCertificateHandle<H>,
) -> Option<TransformCertificateRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct TransformCertificateRecord<H: HostTypes> {
pub transform_type_handle: crate::kernel::schema::TermExpressionHandle<H>,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedTransformCertificate<'r, R: TransformCertificateResolver<H>, H: HostTypes> {
handle: TransformCertificateHandle<H>,
resolver: &'r R,
record: Option<TransformCertificateRecord<H>>,
}
impl<'r, R: TransformCertificateResolver<H>, H: HostTypes> ResolvedTransformCertificate<'r, R, H> {
#[inline]
pub fn new(handle: TransformCertificateHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> TransformCertificateHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&TransformCertificateRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: TransformCertificateResolver<H>, H: HostTypes> Certificate<H>
for ResolvedTransformCertificate<'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: TransformCertificateResolver<H>, H: HostTypes> TransformCertificate<H>
for ResolvedTransformCertificate<'r, R, H>
{
type TermExpression = crate::kernel::schema::NullTermExpression<H>;
fn transform_type(&self) -> &Self::TermExpression {
&<crate::kernel::schema::NullTermExpression<H>>::ABSENT
}
}
impl<'r, R: TransformCertificateResolver<H>, H: HostTypes> ResolvedTransformCertificate<'r, R, H> {
#[inline]
pub fn resolve_transform_type<'r2, R2: crate::kernel::schema::TermExpressionResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::kernel::schema::ResolvedTermExpression<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::kernel::schema::ResolvedTermExpression::new(
record.transform_type_handle,
r,
))
}
}
#[derive(Debug)]
pub struct IsometryCertificateHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for IsometryCertificateHandle<H> {}
impl<H: HostTypes> Clone for IsometryCertificateHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for IsometryCertificateHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for IsometryCertificateHandle<H> {}
impl<H: HostTypes> core::hash::Hash for IsometryCertificateHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> IsometryCertificateHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait IsometryCertificateResolver<H: HostTypes> {
fn resolve(&self, handle: IsometryCertificateHandle<H>)
-> Option<IsometryCertificateRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct IsometryCertificateRecord<H: HostTypes> {
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedIsometryCertificate<'r, R: IsometryCertificateResolver<H>, H: HostTypes> {
handle: IsometryCertificateHandle<H>,
resolver: &'r R,
record: Option<IsometryCertificateRecord<H>>,
}
impl<'r, R: IsometryCertificateResolver<H>, H: HostTypes> ResolvedIsometryCertificate<'r, R, H> {
#[inline]
pub fn new(handle: IsometryCertificateHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> IsometryCertificateHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&IsometryCertificateRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: IsometryCertificateResolver<H>, H: HostTypes> Certificate<H>
for ResolvedIsometryCertificate<'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: IsometryCertificateResolver<H>, H: HostTypes> IsometryCertificate<H>
for ResolvedIsometryCertificate<'r, R, H>
{
}
#[derive(Debug)]
pub struct InvolutionCertificateHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for InvolutionCertificateHandle<H> {}
impl<H: HostTypes> Clone for InvolutionCertificateHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for InvolutionCertificateHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for InvolutionCertificateHandle<H> {}
impl<H: HostTypes> core::hash::Hash for InvolutionCertificateHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> InvolutionCertificateHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait InvolutionCertificateResolver<H: HostTypes> {
fn resolve(
&self,
handle: InvolutionCertificateHandle<H>,
) -> Option<InvolutionCertificateRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct InvolutionCertificateRecord<H: HostTypes> {
pub operation_handle: crate::kernel::op::OperationHandle<H>,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedInvolutionCertificate<'r, R: InvolutionCertificateResolver<H>, H: HostTypes> {
handle: InvolutionCertificateHandle<H>,
resolver: &'r R,
record: Option<InvolutionCertificateRecord<H>>,
}
impl<'r, R: InvolutionCertificateResolver<H>, H: HostTypes>
ResolvedInvolutionCertificate<'r, R, H>
{
#[inline]
pub fn new(handle: InvolutionCertificateHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> InvolutionCertificateHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&InvolutionCertificateRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: InvolutionCertificateResolver<H>, H: HostTypes> Certificate<H>
for ResolvedInvolutionCertificate<'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: InvolutionCertificateResolver<H>, H: HostTypes> InvolutionCertificate<H>
for ResolvedInvolutionCertificate<'r, R, H>
{
type Operation = crate::kernel::op::NullOperation<H>;
fn operation(&self) -> &Self::Operation {
&<crate::kernel::op::NullOperation<H>>::ABSENT
}
}
impl<'r, R: InvolutionCertificateResolver<H>, H: HostTypes>
ResolvedInvolutionCertificate<'r, R, H>
{
#[inline]
pub fn resolve_operation<'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.operation_handle,
r,
))
}
}
#[derive(Debug)]
pub struct CompletenessCertificateHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for CompletenessCertificateHandle<H> {}
impl<H: HostTypes> Clone for CompletenessCertificateHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for CompletenessCertificateHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for CompletenessCertificateHandle<H> {}
impl<H: HostTypes> core::hash::Hash for CompletenessCertificateHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> CompletenessCertificateHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait CompletenessCertificateResolver<H: HostTypes> {
fn resolve(
&self,
handle: CompletenessCertificateHandle<H>,
) -> Option<CompletenessCertificateRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct CompletenessCertificateRecord<H: HostTypes> {
pub certified_type_handle: crate::user::type_::CompleteTypeHandle<H>,
pub audit_trail_handle: CompletenessAuditTrailHandle<H>,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedCompletenessCertificate<'r, R: CompletenessCertificateResolver<H>, H: HostTypes>
{
handle: CompletenessCertificateHandle<H>,
resolver: &'r R,
record: Option<CompletenessCertificateRecord<H>>,
}
impl<'r, R: CompletenessCertificateResolver<H>, H: HostTypes>
ResolvedCompletenessCertificate<'r, R, H>
{
#[inline]
pub fn new(handle: CompletenessCertificateHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> CompletenessCertificateHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&CompletenessCertificateRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: CompletenessCertificateResolver<H>, H: HostTypes> Certificate<H>
for ResolvedCompletenessCertificate<'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: CompletenessCertificateResolver<H>, H: HostTypes> CompletenessCertificate<H>
for ResolvedCompletenessCertificate<'r, R, H>
{
type CompleteType = crate::user::type_::NullCompleteType<H>;
fn certified_type(&self) -> &Self::CompleteType {
&<crate::user::type_::NullCompleteType<H>>::ABSENT
}
type CompletenessAuditTrail = NullCompletenessAuditTrail<H>;
fn audit_trail(&self) -> &Self::CompletenessAuditTrail {
&<NullCompletenessAuditTrail<H>>::ABSENT
}
}
impl<'r, R: CompletenessCertificateResolver<H>, H: HostTypes>
ResolvedCompletenessCertificate<'r, R, H>
{
#[inline]
pub fn resolve_certified_type<'r2, R2: crate::user::type_::CompleteTypeResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::user::type_::ResolvedCompleteType<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::user::type_::ResolvedCompleteType::new(
record.certified_type_handle,
r,
))
}
#[inline]
pub fn resolve_audit_trail<'r2, R2: CompletenessAuditTrailResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<ResolvedCompletenessAuditTrail<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(ResolvedCompletenessAuditTrail::new(
record.audit_trail_handle,
r,
))
}
}
#[derive(Debug)]
pub struct CompletenessAuditTrailHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for CompletenessAuditTrailHandle<H> {}
impl<H: HostTypes> Clone for CompletenessAuditTrailHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for CompletenessAuditTrailHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for CompletenessAuditTrailHandle<H> {}
impl<H: HostTypes> core::hash::Hash for CompletenessAuditTrailHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> CompletenessAuditTrailHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait CompletenessAuditTrailResolver<H: HostTypes> {
fn resolve(
&self,
handle: CompletenessAuditTrailHandle<H>,
) -> Option<CompletenessAuditTrailRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct CompletenessAuditTrailRecord<H: HostTypes> {
pub witness_count: u64,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedCompletenessAuditTrail<'r, R: CompletenessAuditTrailResolver<H>, H: HostTypes> {
handle: CompletenessAuditTrailHandle<H>,
resolver: &'r R,
record: Option<CompletenessAuditTrailRecord<H>>,
}
impl<'r, R: CompletenessAuditTrailResolver<H>, H: HostTypes>
ResolvedCompletenessAuditTrail<'r, R, H>
{
#[inline]
pub fn new(handle: CompletenessAuditTrailHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> CompletenessAuditTrailHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&CompletenessAuditTrailRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: CompletenessAuditTrailResolver<H>, H: HostTypes> CompletenessAuditTrail<H>
for ResolvedCompletenessAuditTrail<'r, R, H>
{
fn witness_count(&self) -> u64 {
match &self.record {
Some(r) => r.witness_count,
None => 0,
}
}
}
#[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 certified_grounding_handle: crate::user::state::GroundedContextHandle<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> 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 GroundedContext = crate::user::state::NullGroundedContext<H>;
fn certified_grounding(&self) -> &Self::GroundedContext {
&<crate::user::state::NullGroundedContext<H>>::ABSENT
}
type GroundingWitness = crate::user::state::NullGroundingWitness<H>;
fn grounding_witness(&self) -> &Self::GroundingWitness {
&<crate::user::state::NullGroundingWitness<H>>::ABSENT
}
}
impl<'r, R: GroundingCertificateResolver<H>, H: HostTypes> ResolvedGroundingCertificate<'r, R, H> {
#[inline]
pub fn resolve_certified_grounding<'r2, R2: crate::user::state::GroundedContextResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::user::state::ResolvedGroundedContext<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::user::state::ResolvedGroundedContext::new(
record.certified_grounding_handle,
r,
))
}
}
#[derive(Debug)]
pub struct GeodesicCertificateHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for GeodesicCertificateHandle<H> {}
impl<H: HostTypes> Clone for GeodesicCertificateHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for GeodesicCertificateHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for GeodesicCertificateHandle<H> {}
impl<H: HostTypes> core::hash::Hash for GeodesicCertificateHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> GeodesicCertificateHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait GeodesicCertificateResolver<H: HostTypes> {
fn resolve(&self, handle: GeodesicCertificateHandle<H>)
-> Option<GeodesicCertificateRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct GeodesicCertificateRecord<H: HostTypes> {
pub certified_geodesic_handle: crate::bridge::trace::GeodesicTraceHandle<H>,
pub geodesic_trace_handle: crate::bridge::trace::GeodesicTraceHandle<H>,
pub evidence_bundle_handle: GeodesicEvidenceBundleHandle<H>,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedGeodesicCertificate<'r, R: GeodesicCertificateResolver<H>, H: HostTypes> {
handle: GeodesicCertificateHandle<H>,
resolver: &'r R,
record: Option<GeodesicCertificateRecord<H>>,
}
impl<'r, R: GeodesicCertificateResolver<H>, H: HostTypes> ResolvedGeodesicCertificate<'r, R, H> {
#[inline]
pub fn new(handle: GeodesicCertificateHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> GeodesicCertificateHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&GeodesicCertificateRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: GeodesicCertificateResolver<H>, H: HostTypes> Certificate<H>
for ResolvedGeodesicCertificate<'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: GeodesicCertificateResolver<H>, H: HostTypes> GeodesicCertificate<H>
for ResolvedGeodesicCertificate<'r, R, H>
{
type GeodesicTrace = crate::bridge::trace::NullGeodesicTrace<H>;
fn certified_geodesic(&self) -> &Self::GeodesicTrace {
&<crate::bridge::trace::NullGeodesicTrace<H>>::ABSENT
}
fn geodesic_trace(&self) -> &Self::GeodesicTrace {
&<crate::bridge::trace::NullGeodesicTrace<H>>::ABSENT
}
type GeodesicEvidenceBundle = NullGeodesicEvidenceBundle<H>;
fn evidence_bundle(&self) -> &Self::GeodesicEvidenceBundle {
&<NullGeodesicEvidenceBundle<H>>::ABSENT
}
}
impl<'r, R: GeodesicCertificateResolver<H>, H: HostTypes> ResolvedGeodesicCertificate<'r, R, H> {
#[inline]
pub fn resolve_certified_geodesic<'r2, R2: crate::bridge::trace::GeodesicTraceResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::bridge::trace::ResolvedGeodesicTrace<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::bridge::trace::ResolvedGeodesicTrace::new(
record.certified_geodesic_handle,
r,
))
}
#[inline]
pub fn resolve_geodesic_trace<'r2, R2: crate::bridge::trace::GeodesicTraceResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::bridge::trace::ResolvedGeodesicTrace<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::bridge::trace::ResolvedGeodesicTrace::new(
record.geodesic_trace_handle,
r,
))
}
#[inline]
pub fn resolve_evidence_bundle<'r2, R2: GeodesicEvidenceBundleResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<ResolvedGeodesicEvidenceBundle<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(ResolvedGeodesicEvidenceBundle::new(
record.evidence_bundle_handle,
r,
))
}
}
#[derive(Debug)]
pub struct MeasurementCertificateHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for MeasurementCertificateHandle<H> {}
impl<H: HostTypes> Clone for MeasurementCertificateHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for MeasurementCertificateHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for MeasurementCertificateHandle<H> {}
impl<H: HostTypes> core::hash::Hash for MeasurementCertificateHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> MeasurementCertificateHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait MeasurementCertificateResolver<H: HostTypes> {
fn resolve(
&self,
handle: MeasurementCertificateHandle<H>,
) -> Option<MeasurementCertificateRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct MeasurementCertificateRecord<H: HostTypes> {
pub certified_measurement_handle: crate::bridge::trace::MeasurementEventHandle<H>,
pub von_neumann_entropy: H::Decimal,
pub landauer_cost: H::Decimal,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedMeasurementCertificate<'r, R: MeasurementCertificateResolver<H>, H: HostTypes> {
handle: MeasurementCertificateHandle<H>,
resolver: &'r R,
record: Option<MeasurementCertificateRecord<H>>,
}
impl<'r, R: MeasurementCertificateResolver<H>, H: HostTypes>
ResolvedMeasurementCertificate<'r, R, H>
{
#[inline]
pub fn new(handle: MeasurementCertificateHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> MeasurementCertificateHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&MeasurementCertificateRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: MeasurementCertificateResolver<H>, H: HostTypes> Certificate<H>
for ResolvedMeasurementCertificate<'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: MeasurementCertificateResolver<H>, H: HostTypes> MeasurementCertificate<H>
for ResolvedMeasurementCertificate<'r, R, H>
{
type MeasurementEvent = crate::bridge::trace::NullMeasurementEvent<H>;
fn certified_measurement(&self) -> &Self::MeasurementEvent {
&<crate::bridge::trace::NullMeasurementEvent<H>>::ABSENT
}
fn von_neumann_entropy(&self) -> H::Decimal {
match &self.record {
Some(r) => r.von_neumann_entropy,
None => H::EMPTY_DECIMAL,
}
}
fn landauer_cost(&self) -> H::Decimal {
match &self.record {
Some(r) => r.landauer_cost,
None => H::EMPTY_DECIMAL,
}
}
}
impl<'r, R: MeasurementCertificateResolver<H>, H: HostTypes>
ResolvedMeasurementCertificate<'r, R, H>
{
#[inline]
pub fn resolve_certified_measurement<
'r2,
R2: crate::bridge::trace::MeasurementEventResolver<H>,
>(
&self,
r: &'r2 R2,
) -> Option<crate::bridge::trace::ResolvedMeasurementEvent<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::bridge::trace::ResolvedMeasurementEvent::new(
record.certified_measurement_handle,
r,
))
}
}
#[derive(Debug)]
pub struct GeodesicEvidenceBundleHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for GeodesicEvidenceBundleHandle<H> {}
impl<H: HostTypes> Clone for GeodesicEvidenceBundleHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for GeodesicEvidenceBundleHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for GeodesicEvidenceBundleHandle<H> {}
impl<H: HostTypes> core::hash::Hash for GeodesicEvidenceBundleHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> GeodesicEvidenceBundleHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait GeodesicEvidenceBundleResolver<H: HostTypes> {
fn resolve(
&self,
handle: GeodesicEvidenceBundleHandle<H>,
) -> Option<GeodesicEvidenceBundleRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct GeodesicEvidenceBundleRecord<H: HostTypes> {
pub is_ar1_ordered: bool,
pub is_dc10_selected: bool,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedGeodesicEvidenceBundle<'r, R: GeodesicEvidenceBundleResolver<H>, H: HostTypes> {
handle: GeodesicEvidenceBundleHandle<H>,
resolver: &'r R,
record: Option<GeodesicEvidenceBundleRecord<H>>,
}
impl<'r, R: GeodesicEvidenceBundleResolver<H>, H: HostTypes>
ResolvedGeodesicEvidenceBundle<'r, R, H>
{
#[inline]
pub fn new(handle: GeodesicEvidenceBundleHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> GeodesicEvidenceBundleHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&GeodesicEvidenceBundleRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: GeodesicEvidenceBundleResolver<H>, H: HostTypes> GeodesicEvidenceBundle<H>
for ResolvedGeodesicEvidenceBundle<'r, R, H>
{
fn is_ar1_ordered(&self) -> bool {
match &self.record {
Some(r) => r.is_ar1_ordered,
None => false,
}
}
fn is_dc10_selected(&self) -> bool {
match &self.record {
Some(r) => r.is_dc10_selected,
None => false,
}
}
}
#[derive(Debug)]
pub struct LiftChainCertificateHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for LiftChainCertificateHandle<H> {}
impl<H: HostTypes> Clone for LiftChainCertificateHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for LiftChainCertificateHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for LiftChainCertificateHandle<H> {}
impl<H: HostTypes> core::hash::Hash for LiftChainCertificateHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> LiftChainCertificateHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait LiftChainCertificateResolver<H: HostTypes> {
fn resolve(
&self,
handle: LiftChainCertificateHandle<H>,
) -> Option<LiftChainCertificateRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct LiftChainCertificateRecord<H: HostTypes> {
pub certified_chain_handle: crate::user::type_::LiftChainHandle<H>,
pub chain_audit_trail_handle: ChainAuditTrailHandle<H>,
pub target_level: WittLevel,
pub source_level: WittLevel,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedLiftChainCertificate<'r, R: LiftChainCertificateResolver<H>, H: HostTypes> {
handle: LiftChainCertificateHandle<H>,
resolver: &'r R,
record: Option<LiftChainCertificateRecord<H>>,
}
impl<'r, R: LiftChainCertificateResolver<H>, H: HostTypes> ResolvedLiftChainCertificate<'r, R, H> {
#[inline]
pub fn new(handle: LiftChainCertificateHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> LiftChainCertificateHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&LiftChainCertificateRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: LiftChainCertificateResolver<H>, H: HostTypes> Certificate<H>
for ResolvedLiftChainCertificate<'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: LiftChainCertificateResolver<H>, H: HostTypes> LiftChainCertificate<H>
for ResolvedLiftChainCertificate<'r, R, H>
{
type LiftChain = crate::user::type_::NullLiftChain<H>;
fn certified_chain(&self) -> &Self::LiftChain {
&<crate::user::type_::NullLiftChain<H>>::ABSENT
}
type ChainAuditTrail = NullChainAuditTrail<H>;
fn chain_audit_trail(&self) -> &Self::ChainAuditTrail {
&<NullChainAuditTrail<H>>::ABSENT
}
fn target_level(&self) -> WittLevel {
match &self.record {
Some(r) => r.target_level,
None => <WittLevel>::default(),
}
}
fn source_level(&self) -> WittLevel {
match &self.record {
Some(r) => r.source_level,
None => <WittLevel>::default(),
}
}
}
impl<'r, R: LiftChainCertificateResolver<H>, H: HostTypes> ResolvedLiftChainCertificate<'r, R, H> {
#[inline]
pub fn resolve_certified_chain<'r2, R2: crate::user::type_::LiftChainResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::user::type_::ResolvedLiftChain<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::user::type_::ResolvedLiftChain::new(
record.certified_chain_handle,
r,
))
}
#[inline]
pub fn resolve_chain_audit_trail<'r2, R2: ChainAuditTrailResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<ResolvedChainAuditTrail<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(ResolvedChainAuditTrail::new(
record.chain_audit_trail_handle,
r,
))
}
}
#[derive(Debug)]
pub struct ChainAuditTrailHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for ChainAuditTrailHandle<H> {}
impl<H: HostTypes> Clone for ChainAuditTrailHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for ChainAuditTrailHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for ChainAuditTrailHandle<H> {}
impl<H: HostTypes> core::hash::Hash for ChainAuditTrailHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> ChainAuditTrailHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait ChainAuditTrailResolver<H: HostTypes> {
fn resolve(&self, handle: ChainAuditTrailHandle<H>) -> Option<ChainAuditTrailRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct ChainAuditTrailRecord<H: HostTypes> {
pub chain_step_count: u64,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedChainAuditTrail<'r, R: ChainAuditTrailResolver<H>, H: HostTypes> {
handle: ChainAuditTrailHandle<H>,
resolver: &'r R,
record: Option<ChainAuditTrailRecord<H>>,
}
impl<'r, R: ChainAuditTrailResolver<H>, H: HostTypes> ResolvedChainAuditTrail<'r, R, H> {
#[inline]
pub fn new(handle: ChainAuditTrailHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> ChainAuditTrailHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&ChainAuditTrailRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: ChainAuditTrailResolver<H>, H: HostTypes> ChainAuditTrail<H>
for ResolvedChainAuditTrail<'r, R, H>
{
fn chain_step_count(&self) -> u64 {
match &self.record {
Some(r) => r.chain_step_count,
None => 0,
}
}
}
#[derive(Debug)]
pub struct InhabitanceCertificateHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for InhabitanceCertificateHandle<H> {}
impl<H: HostTypes> Clone for InhabitanceCertificateHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for InhabitanceCertificateHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for InhabitanceCertificateHandle<H> {}
impl<H: HostTypes> core::hash::Hash for InhabitanceCertificateHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> InhabitanceCertificateHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait InhabitanceCertificateResolver<H: HostTypes> {
fn resolve(
&self,
handle: InhabitanceCertificateHandle<H>,
) -> Option<InhabitanceCertificateRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct InhabitanceCertificateRecord<H: HostTypes> {
pub search_trace_handle: crate::bridge::trace::InhabitanceSearchTraceHandle<H>,
pub grounded_handle: crate::user::type_::ConstrainedTypeHandle<H>,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedInhabitanceCertificate<'r, R: InhabitanceCertificateResolver<H>, H: HostTypes> {
handle: InhabitanceCertificateHandle<H>,
resolver: &'r R,
record: Option<InhabitanceCertificateRecord<H>>,
}
impl<'r, R: InhabitanceCertificateResolver<H>, H: HostTypes>
ResolvedInhabitanceCertificate<'r, R, H>
{
#[inline]
pub fn new(handle: InhabitanceCertificateHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> InhabitanceCertificateHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&InhabitanceCertificateRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: InhabitanceCertificateResolver<H>, H: HostTypes> crate::bridge::proof::Proof<H>
for ResolvedInhabitanceCertificate<'r, R, H>
{
fn verified(&self) -> bool {
false
}
fn timestamp(&self) -> &H::WitnessBytes {
H::EMPTY_WITNESS_BYTES
}
type WitnessData = crate::bridge::proof::NullWitnessData<H>;
fn witness(&self) -> &[Self::WitnessData] {
&[]
}
type Identity = crate::kernel::op::NullIdentity<H>;
fn proves_identity(&self) -> &Self::Identity {
&<crate::kernel::op::NullIdentity<H>>::ABSENT
}
fn verified_at_level(&self) -> &[WittLevel] {
&[]
}
fn strategy(&self) -> ProofStrategy {
<ProofStrategy>::default()
}
fn depends_on(&self) -> &[Self::Identity] {
&[]
}
type DerivationTerm = crate::bridge::proof::NullDerivationTerm<H>;
fn formal_derivation(&self) -> &Self::DerivationTerm {
&<crate::bridge::proof::NullDerivationTerm<H>>::ABSENT
}
}
impl<'r, R: InhabitanceCertificateResolver<H>, H: HostTypes>
crate::bridge::proof::ComputationCertificate<H> for ResolvedInhabitanceCertificate<'r, R, H>
{
fn at_witt_level(&self) -> WittLevel {
<WittLevel>::default()
}
}
impl<'r, R: InhabitanceCertificateResolver<H>, H: HostTypes> Certificate<H>
for ResolvedInhabitanceCertificate<'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: InhabitanceCertificateResolver<H>, H: HostTypes> InhabitanceCertificate<H>
for ResolvedInhabitanceCertificate<'r, R, H>
{
type ValueTuple = crate::kernel::schema::NullValueTuple<H>;
fn witness(&self) -> &[Self::ValueTuple] {
&[]
}
type InhabitanceSearchTrace = crate::bridge::trace::NullInhabitanceSearchTrace<H>;
fn search_trace(&self) -> &Self::InhabitanceSearchTrace {
&<crate::bridge::trace::NullInhabitanceSearchTrace<H>>::ABSENT
}
type ConstrainedType = crate::user::type_::NullConstrainedType<H>;
fn grounded(&self) -> &Self::ConstrainedType {
&<crate::user::type_::NullConstrainedType<H>>::ABSENT
}
}
impl<'r, R: InhabitanceCertificateResolver<H>, H: HostTypes>
ResolvedInhabitanceCertificate<'r, R, H>
{
#[inline]
pub fn resolve_search_trace<
'r2,
R2: crate::bridge::trace::InhabitanceSearchTraceResolver<H>,
>(
&self,
r: &'r2 R2,
) -> Option<crate::bridge::trace::ResolvedInhabitanceSearchTrace<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::bridge::trace::ResolvedInhabitanceSearchTrace::new(
record.search_trace_handle,
r,
))
}
#[inline]
pub fn resolve_grounded<'r2, R2: crate::user::type_::ConstrainedTypeResolver<H>>(
&self,
r: &'r2 R2,
) -> Option<crate::user::type_::ResolvedConstrainedType<'r2, R2, H>> {
let record = self.record.as_ref()?;
Some(crate::user::type_::ResolvedConstrainedType::new(
record.grounded_handle,
r,
))
}
}
#[derive(Debug)]
pub struct MultiplicationCertificateHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for MultiplicationCertificateHandle<H> {}
impl<H: HostTypes> Clone for MultiplicationCertificateHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for MultiplicationCertificateHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for MultiplicationCertificateHandle<H> {}
impl<H: HostTypes> core::hash::Hash for MultiplicationCertificateHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> MultiplicationCertificateHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait MultiplicationCertificateResolver<H: HostTypes> {
fn resolve(
&self,
handle: MultiplicationCertificateHandle<H>,
) -> Option<MultiplicationCertificateRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct MultiplicationCertificateRecord<H: HostTypes> {
pub splitting_factor: u64,
pub sub_multiplication_count: u64,
pub landauer_cost_nats: H::Decimal,
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedMultiplicationCertificate<
'r,
R: MultiplicationCertificateResolver<H>,
H: HostTypes,
> {
handle: MultiplicationCertificateHandle<H>,
resolver: &'r R,
record: Option<MultiplicationCertificateRecord<H>>,
}
impl<'r, R: MultiplicationCertificateResolver<H>, H: HostTypes>
ResolvedMultiplicationCertificate<'r, R, H>
{
#[inline]
pub fn new(handle: MultiplicationCertificateHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> MultiplicationCertificateHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&MultiplicationCertificateRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: MultiplicationCertificateResolver<H>, H: HostTypes> Certificate<H>
for ResolvedMultiplicationCertificate<'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: MultiplicationCertificateResolver<H>, H: HostTypes> MultiplicationCertificate<H>
for ResolvedMultiplicationCertificate<'r, R, H>
{
fn splitting_factor(&self) -> u64 {
match &self.record {
Some(r) => r.splitting_factor,
None => 0,
}
}
fn sub_multiplication_count(&self) -> u64 {
match &self.record {
Some(r) => r.sub_multiplication_count,
None => 0,
}
}
fn landauer_cost_nats(&self) -> H::Decimal {
match &self.record {
Some(r) => r.landauer_cost_nats,
None => H::EMPTY_DECIMAL,
}
}
}
#[derive(Debug)]
pub struct PartitionCertificateHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for PartitionCertificateHandle<H> {}
impl<H: HostTypes> Clone for PartitionCertificateHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for PartitionCertificateHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for PartitionCertificateHandle<H> {}
impl<H: HostTypes> core::hash::Hash for PartitionCertificateHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> PartitionCertificateHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait PartitionCertificateResolver<H: HostTypes> {
fn resolve(
&self,
handle: PartitionCertificateHandle<H>,
) -> Option<PartitionCertificateRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct PartitionCertificateRecord<H: HostTypes> {
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedPartitionCertificate<'r, R: PartitionCertificateResolver<H>, H: HostTypes> {
handle: PartitionCertificateHandle<H>,
resolver: &'r R,
record: Option<PartitionCertificateRecord<H>>,
}
impl<'r, R: PartitionCertificateResolver<H>, H: HostTypes> ResolvedPartitionCertificate<'r, R, H> {
#[inline]
pub fn new(handle: PartitionCertificateHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> PartitionCertificateHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&PartitionCertificateRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: PartitionCertificateResolver<H>, H: HostTypes> Certificate<H>
for ResolvedPartitionCertificate<'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: PartitionCertificateResolver<H>, H: HostTypes> PartitionCertificate<H>
for ResolvedPartitionCertificate<'r, R, H>
{
}
#[derive(Debug)]
pub struct GenericImpossibilityCertificateHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for GenericImpossibilityCertificateHandle<H> {}
impl<H: HostTypes> Clone for GenericImpossibilityCertificateHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for GenericImpossibilityCertificateHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for GenericImpossibilityCertificateHandle<H> {}
impl<H: HostTypes> core::hash::Hash for GenericImpossibilityCertificateHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> GenericImpossibilityCertificateHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait GenericImpossibilityCertificateResolver<H: HostTypes> {
fn resolve(
&self,
handle: GenericImpossibilityCertificateHandle<H>,
) -> Option<GenericImpossibilityCertificateRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct GenericImpossibilityCertificateRecord<H: HostTypes> {
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedGenericImpossibilityCertificate<
'r,
R: GenericImpossibilityCertificateResolver<H>,
H: HostTypes,
> {
handle: GenericImpossibilityCertificateHandle<H>,
resolver: &'r R,
record: Option<GenericImpossibilityCertificateRecord<H>>,
}
impl<'r, R: GenericImpossibilityCertificateResolver<H>, H: HostTypes>
ResolvedGenericImpossibilityCertificate<'r, R, H>
{
#[inline]
pub fn new(handle: GenericImpossibilityCertificateHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> GenericImpossibilityCertificateHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&GenericImpossibilityCertificateRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: GenericImpossibilityCertificateResolver<H>, H: HostTypes> Certificate<H>
for ResolvedGenericImpossibilityCertificate<'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: GenericImpossibilityCertificateResolver<H>, H: HostTypes>
GenericImpossibilityCertificate<H> for ResolvedGenericImpossibilityCertificate<'r, R, H>
{
}
#[derive(Debug)]
pub struct InhabitanceImpossibilityCertificateHandle<H: HostTypes> {
pub fingerprint: crate::enforcement::ContentFingerprint,
_phantom: core::marker::PhantomData<H>,
}
impl<H: HostTypes> Copy for InhabitanceImpossibilityCertificateHandle<H> {}
impl<H: HostTypes> Clone for InhabitanceImpossibilityCertificateHandle<H> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<H: HostTypes> PartialEq for InhabitanceImpossibilityCertificateHandle<H> {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.fingerprint == other.fingerprint
}
}
impl<H: HostTypes> Eq for InhabitanceImpossibilityCertificateHandle<H> {}
impl<H: HostTypes> core::hash::Hash for InhabitanceImpossibilityCertificateHandle<H> {
#[inline]
fn hash<S: core::hash::Hasher>(&self, state: &mut S) {
self.fingerprint.hash(state);
}
}
impl<H: HostTypes> InhabitanceImpossibilityCertificateHandle<H> {
#[inline]
#[must_use]
pub const fn new(fingerprint: crate::enforcement::ContentFingerprint) -> Self {
Self {
fingerprint,
_phantom: core::marker::PhantomData,
}
}
}
pub trait InhabitanceImpossibilityCertificateResolver<H: HostTypes> {
fn resolve(
&self,
handle: InhabitanceImpossibilityCertificateHandle<H>,
) -> Option<InhabitanceImpossibilityCertificateRecord<H>>;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct InhabitanceImpossibilityCertificateRecord<H: HostTypes> {
#[doc(hidden)]
pub _phantom: core::marker::PhantomData<H>,
}
pub struct ResolvedInhabitanceImpossibilityCertificate<
'r,
R: InhabitanceImpossibilityCertificateResolver<H>,
H: HostTypes,
> {
handle: InhabitanceImpossibilityCertificateHandle<H>,
resolver: &'r R,
record: Option<InhabitanceImpossibilityCertificateRecord<H>>,
}
impl<'r, R: InhabitanceImpossibilityCertificateResolver<H>, H: HostTypes>
ResolvedInhabitanceImpossibilityCertificate<'r, R, H>
{
#[inline]
pub fn new(handle: InhabitanceImpossibilityCertificateHandle<H>, resolver: &'r R) -> Self {
let record = resolver.resolve(handle);
Self {
handle,
resolver,
record,
}
}
#[inline]
#[must_use]
pub const fn handle(&self) -> InhabitanceImpossibilityCertificateHandle<H> {
self.handle
}
#[inline]
#[must_use]
pub const fn resolver(&self) -> &'r R {
self.resolver
}
#[inline]
#[must_use]
pub const fn record(&self) -> Option<&InhabitanceImpossibilityCertificateRecord<H>> {
self.record.as_ref()
}
}
impl<'r, R: InhabitanceImpossibilityCertificateResolver<H>, H: HostTypes> Certificate<H>
for ResolvedInhabitanceImpossibilityCertificate<'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: InhabitanceImpossibilityCertificateResolver<H>, H: HostTypes>
InhabitanceImpossibilityCertificate<H>
for ResolvedInhabitanceImpossibilityCertificate<'r, R, H>
{
}