pub enum CsumR<A, B> {
Unit,
Cinl(A),
Cinr(B),
CsumInvalid,
}Expand description
Csum PCM
In modern Iris, it uses CMRA instead of PCM, which uses a core for every element instead of a unit element. Here we add a unit element to stick to the PCM definition.
Variants§
Implementations§
Source§impl<A, B> CsumR<A, B>
impl<A, B> CsumR<A, B>
pub fn arrow_Cinl_0(self) -> A
pub fn arrow_Cinr_0(self) -> B
Trait Implementations§
Source§impl<A: PCM, B: PCM> PCM for CsumR<A, B>
impl<A: PCM, B: PCM> PCM for CsumR<A, B>
Source§open spec fn valid(self) -> bool
open spec fn valid(self) -> bool
{
match self {
CsumR::Unit => true,
CsumR::Cinl(a) => A::valid(a),
CsumR::Cinr(b) => B::valid(b),
CsumR::CsumInvalid => false,
}
}Source§open spec fn op(self, other: Self) -> Self
open spec fn op(self, other: Self) -> Self
{
match (self, other) {
(CsumR::Unit, x) => x,
(x, CsumR::Unit) => x,
(CsumR::Cinl(a1), CsumR::Cinl(a2)) => CsumR::Cinl(A::op(a1, a2)),
(CsumR::Cinr(b1), CsumR::Cinr(b2)) => CsumR::Cinr(B::op(b1, b2)),
_ => CsumR::CsumInvalid,
}
}Source§proof fn closed_under_incl(a: Self, b: Self)
proof fn closed_under_incl(a: Self, b: Self)
Source§proof fn commutative(a: Self, b: Self)
proof fn commutative(a: Self, b: Self)
Source§proof fn associative(a: Self, b: Self, c: Self)
proof fn associative(a: Self, b: Self, c: Self)
Source§proof fn unit_valid()
proof fn unit_valid()
Auto Trait Implementations§
impl<A, B> Freeze for CsumR<A, B>
impl<A, B> RefUnwindSafe for CsumR<A, B>where
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Send for CsumR<A, B>
impl<A, B> Sync for CsumR<A, B>
impl<A, B> Unpin for CsumR<A, B>
impl<A, B> UnwindSafe for CsumR<A, B>where
A: UnwindSafe,
B: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more