pub struct Nat(/* private fields */);Expand description
Natural numbers, i.e., integers that are greater or equal to 0.
Implementations§
Trait Implementations§
Source§impl RA for Nat
impl RA for Nat
Source§fn factor(self, factor: Self) -> Option<Self>
fn factor(self, factor: Self) -> Option<Self>
(open, inline)
let _ = Nat::ext_eq; if self.to_int() >= factor.to_int() { Some(Nat::new(self.to_int() - factor.to_int())) } else { None }
ensures
match result { Some(c) => factor.op(c) == Some(self), None => forall<c: Self> factor.op(c) != Some(self), }
Source§fn eq(self, other: Self) -> bool
fn eq(self, other: Self) -> bool
(open, inline)
self.ext_eq(other)ensures
result == (self == other)Source§fn commutative(a: Self, b: Self)
fn commutative(a: Self, b: Self)
(law) ⚠
ensures
a.op(b) == b.op(a)Source§fn associative(a: Self, b: Self, c: Self)
fn associative(a: Self, b: Self, c: Self)
⚠
ensures
a.op(b).and_then_logic(|ab: Self| ab.op(c)) == b.op(c).and_then_logic(|bc| a.op(bc))
Source§fn core_idemp(self)
fn core_idemp(self)
⚠
ensures
let c = self.core().unwrap_logic(); c.op(c) == Some(c)
ensures
self.core().unwrap_logic().op(self) == Some(self)Source§fn core_is_maximal_idemp(self, i: Self)
fn core_is_maximal_idemp(self, i: Self)
⚠
requires
i.op(i) == Some(i)requires
i.op(self) == Some(self)ensures
match self.core() { Some(c) => i.incl(c), None => false, }
Source§fn incl_eq(self, other: Self) -> bool
fn incl_eq(self, other: Self) -> bool
(open, sealed) Read more
Source§fn incl_eq_op(a: Self, b: Self, x: Self) -> bool
fn incl_eq_op(a: Self, b: Self, x: Self) -> bool
(open, sealed) Read more
Source§fn update_nondet(self, s: Set<Self>) -> bool
fn update_nondet(self, s: Set<Self>) -> bool
This is used in
Resource::update_nondet. Read moreSource§fn associative_none(a: Self, b: Self, c: Self, bc: Self)
fn associative_none(a: Self, b: Self, c: Self, bc: Self)
Source§fn associative_some(a: Self, b: Self, c: Self, ab: Self, bc: Self)
fn associative_some(a: Self, b: Self, c: Self, ab: Self, bc: Self)
Specialized version of
Self::associative, in the case where a.op(b) and b.op(c)
are both valid. Read moreSource§fn incl_transitive(a: Self, b: Self, c: Self)
fn incl_transitive(a: Self, b: Self, c: Self)
Source§impl UnitRA for Nat
impl UnitRA for Nat
Source§fn unit() -> Self
fn unit() -> Self
(open, inline)
let _ = Nat::ext_eq; Nat::new(0)
ensures
forall<x: Self> #[trigger(x.op(result))] x.op(result) == Some(x)Source§fn core_total(self) -> Self
fn core_total(self) -> Self
(open, inline)
Nat::new(0)ensures
self.core() == Some(result)Source§fn core_total_idemp(self)
fn core_total_idemp(self)
⚠
ensures
self.core_total().op(self.core_total()) == Some(self.core_total())ensures
self.core_total().op(self) == Some(self)Auto Trait Implementations§
impl Freeze for Nat
impl RefUnwindSafe for Nat
impl Send for Nat
impl Sync for Nat
impl Unpin for Nat
impl UnwindSafe for Nat
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