pub struct Nat(/* private fields */);Expand description
Natural numbers, i.e., integers that are greater or equal to 0.
Implementations§
Trait Implementations§
Source§impl OrdLogic for Nat
impl OrdLogic for Nat
Source§fn cmp_le_log(x: Self, y: Self)
fn cmp_le_log(x: Self, y: Self)
logic(open(pub(self)), law) ⚠
ensures
x.le_log(y) == (x.cmp_log(y) != core::cmp::Ordering::Greater)Source§fn cmp_lt_log(x: Self, y: Self)
fn cmp_lt_log(x: Self, y: Self)
logic(open(pub(self)), law) ⚠
ensures
x.lt_log(y) == (x.cmp_log(y) == core::cmp::Ordering::Less)Source§fn cmp_ge_log(x: Self, y: Self)
fn cmp_ge_log(x: Self, y: Self)
logic(open(pub(self)), law) ⚠
ensures
x.ge_log(y) == (x.cmp_log(y) != core::cmp::Ordering::Less)Source§fn cmp_gt_log(x: Self, y: Self)
fn cmp_gt_log(x: Self, y: Self)
logic(open(pub(self)), law) ⚠
ensures
x.gt_log(y) == (x.cmp_log(y) == core::cmp::Ordering::Greater)Source§fn refl(x: Self)
fn refl(x: Self)
logic(open(pub(self)), law) ⚠
ensures
x.cmp_log(x) == core::cmp::Ordering::EqualSource§fn trans(x: Self, y: Self, z: Self, o: Ordering)
fn trans(x: Self, y: Self, z: Self, o: Ordering)
logic(open(pub(self)), law) ⚠
requires
x.cmp_log(y) == orequires
y.cmp_log(z) == oensures
x.cmp_log(z) == oSource§fn antisym1(x: Self, y: Self)
fn antisym1(x: Self, y: Self)
logic(open(pub(self)), law) ⚠
requires
x.cmp_log(y) == core::cmp::Ordering::Lessensures
y.cmp_log(x) == core::cmp::Ordering::GreaterSource§fn antisym2(x: Self, y: Self)
fn antisym2(x: Self, y: Self)
logic(open(pub(self)), law) ⚠
requires
x.cmp_log(y) == core::cmp::Ordering::Greaterensures
y.cmp_log(x) == core::cmp::Ordering::LessSource§impl Plain for Nat
impl Plain for Nat
Source§fn into_ghost(s: Snapshot<Self>) -> Ghost<Self>
fn into_ghost(s: Snapshot<Self>) -> Ghost<Self>
terminates
ghost
ensures
*result == *sSource§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
#[trigger(self == other)]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 cancelable(self) -> bool
fn cancelable(self) -> bool
logic(open)
let _ = Nat::ext_eq; true
ensures
result == (forall<x, y> self.op(x) != None ==> self.op(x) == self.op(y) ==> x == y)
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
Source§fn update_nondet(self, s: Set<Self>) -> bool
fn update_nondet(self, s: Set<Self>) -> bool
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)
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)