pub struct Proven<P, T> { /* private fields */ }Expand description
A value of type T accompanied by a compile-time witness
that property P holds for T.
Construction is deliberately restricted: safe constructors
require the relevant trait bound (e.g., from_semigroup requires
T: Semigroup). The trait implementation is the proof.
For properties verified externally (proptest, SMT solver, inspection),
use the unsafe Proven::axiom constructor.
Implementations§
Source§impl<P, T> Proven<P, T>
impl<P, T> Proven<P, T>
Sourcepub unsafe fn axiom(value: T) -> Proven<P, T>
pub unsafe fn axiom(value: T) -> Proven<P, T>
Create a witness without checking.
§Safety
Caller asserts that property P genuinely holds for type T.
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Unwrap the witness, discarding the proof.
Source§impl<P, Q, T> Proven<And<P, Q>, T>
impl<P, Q, T> Proven<And<P, Q>, T>
Sourcepub fn derive_second(self) -> Proven<Q, T>
pub fn derive_second(self) -> Proven<Q, T>
Extract the second component from a conjunction proof.
(The first component is available via .derive() since
And<P, Q>: Implies<P>.)
Source§impl<T> Proven<IsAssociative, T>where
T: Semigroup,
impl<T> Proven<IsAssociative, T>where
T: Semigroup,
Sourcepub fn from_semigroup(value: T) -> Proven<IsAssociative, T>
pub fn from_semigroup(value: T) -> Proven<IsAssociative, T>
Witness associativity from a Semigroup implementation.
Source§impl<T> Proven<IsMonoid, T>where
T: Monoid,
impl<T> Proven<IsMonoid, T>where
T: Monoid,
Sourcepub fn from_monoid(value: T) -> Proven<IsMonoid, T>
pub fn from_monoid(value: T) -> Proven<IsMonoid, T>
Witness monoid laws from a Monoid implementation.
Source§impl<T> Proven<IsGroup, T>where
T: Group,
impl<T> Proven<IsGroup, T>where
T: Group,
Sourcepub fn from_group(value: T) -> Proven<IsGroup, T>
pub fn from_group(value: T) -> Proven<IsGroup, T>
Witness group laws from a Group implementation.
Source§impl<T> Proven<IsAbelianGroup, T>where
T: AbelianGroup,
impl<T> Proven<IsAbelianGroup, T>where
T: AbelianGroup,
Sourcepub fn from_abelian(value: T) -> Proven<IsAbelianGroup, T>
pub fn from_abelian(value: T) -> Proven<IsAbelianGroup, T>
Witness abelian group from an AbelianGroup implementation.