use crate::Primitives;
pub trait Partition<P: Primitives> {
type IrreducibleSet: IrreducibleSet<P>;
fn irreducibles(&self) -> &Self::IrreducibleSet;
type ReducibleSet: ReducibleSet<P>;
fn reducibles(&self) -> &Self::ReducibleSet;
type UnitSet: UnitSet<P>;
fn units(&self) -> &Self::UnitSet;
type ExteriorSet: ExteriorSet<P>;
fn exterior(&self) -> &Self::ExteriorSet;
fn density(&self) -> P::Decimal;
type TypeDefinition: crate::user::type_::TypeDefinition<P>;
fn source_type(&self) -> &Self::TypeDefinition;
fn quantum(&self) -> P::PositiveInteger;
type FiberBudget: FiberBudget<P>;
fn fiber_budget(&self) -> &Self::FiberBudget;
fn is_exhaustive(&self) -> P::Boolean;
}
pub trait Component<P: Primitives> {
type Datum: crate::kernel::schema::Datum<P>;
fn member(&self) -> &[Self::Datum];
fn cardinality(&self) -> P::NonNegativeInteger;
}
pub trait IrreducibleSet<P: Primitives>: Component<P> {}
pub trait ReducibleSet<P: Primitives>: Component<P> {}
pub trait UnitSet<P: Primitives>: Component<P> {}
pub trait ExteriorSet<P: Primitives>: Component<P> {
type TermExpression: crate::kernel::schema::TermExpression<P>;
fn exterior_criteria(&self) -> &Self::TermExpression;
}
pub trait FiberCoordinate<P: Primitives> {
fn fiber_position(&self) -> P::NonNegativeInteger;
fn fiber_state(&self) -> P::NonNegativeInteger;
type FiberCoordinateTarget: FiberCoordinate<P>;
fn ancilla_fiber(&self) -> &Self::FiberCoordinateTarget;
}
pub trait FiberBudget<P: Primitives> {
fn total_fibers(&self) -> P::NonNegativeInteger;
fn pinned_count(&self) -> P::NonNegativeInteger;
fn free_count(&self) -> P::NonNegativeInteger;
fn is_closed(&self) -> P::Boolean;
type FiberCoordinate: FiberCoordinate<P>;
fn has_fiber(&self) -> &[Self::FiberCoordinate];
type FiberPinning: FiberPinning<P>;
fn has_pinning(&self) -> &[Self::FiberPinning];
fn reversible_strategy(&self) -> P::Boolean;
}
pub trait FiberPinning<P: Primitives> {
type Constraint: crate::user::type_::Constraint<P>;
fn pinned_by(&self) -> &Self::Constraint;
type FiberCoordinate: FiberCoordinate<P>;
fn pins_coordinate(&self) -> &Self::FiberCoordinate;
}
pub trait PartitionProduct<P: Primitives> {
type Partition: Partition<P>;
fn left_factor(&self) -> &Self::Partition;
fn right_factor(&self) -> &Self::Partition;
}
pub trait PartitionCoproduct<P: Primitives> {
type Partition: Partition<P>;
fn left_summand(&self) -> &Self::Partition;
fn right_summand(&self) -> &Self::Partition;
}