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>
logic(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
logic(open, inline)
self.ext_eq(other)ensures
result == (self == other)Source§fn commutative(a: Self, b: Self)
fn commutative(a: Self, b: Self)
logic(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)
logic ⚠
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)
logic ⚠
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)
logic ⚠
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
logic(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
logic(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
logic(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
logic(open, inline)
Nat::new(0)ensures
self.core() == Some(result)Source§fn core_total_idemp(self)
fn core_total_idemp(self)
logic ⚠
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 UnsafeUnpin 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