pub enum FracR<T> {
Unit,
Frac(real, T),
Invalid,
}Expand description
Fractional PCM
Variants§
Implementations§
Trait Implementations§
Source§impl<T: PartialEq> PCM for FracR<T>
impl<T: PartialEq> PCM for FracR<T>
Source§open spec fn valid(self) -> bool
open spec fn valid(self) -> bool
{
match self {
FracR::Unit => true,
FracR::Frac(q, _) => 0.0real < q && q <= 1.0real,
FracR::Invalid => false,
}
}Source§open spec fn op(self, other: Self) -> Self
open spec fn op(self, other: Self) -> Self
{
match (self, other) {
(FracR::Unit, x) => x,
(x, FracR::Unit) => x,
(FracR::Frac(q1, a1), FracR::Frac(q2, a2)) => {
if a1 == a2 && 0.0real < q1 && 0.0real < q2 && q1 + q2 <= 1.0real {
FracR::Frac(q1 + q2, a1)
} else {
FracR::Invalid
}
}
_ => FracR::Invalid,
}
}Two Frac combine iff they agree on the value and the sum of fractions does not exceed 1.0. This follows the original Iris design.
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<T> Freeze for FracR<T>where
T: Freeze,
impl<T> RefUnwindSafe for FracR<T>where
T: RefUnwindSafe,
impl<T> Send for FracR<T>where
T: Send,
impl<T> Sync for FracR<T>where
T: Sync,
impl<T> Unpin for FracR<T>where
T: Unpin,
impl<T> UnwindSafe for FracR<T>where
T: 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