#[non_exhaustive]#[repr(transparent)]pub struct PeanoInt(pub u64);Expand description
A peano integer wrapping a 64-bits integer.
See the module explanation.
Tuple Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.0: u64Implementations§
Source§impl PeanoInt
impl PeanoInt
Sourcepub fn incr(self) -> Self
pub fn incr(self) -> Self
Increase the integer by one.
This method guarantees that increments cannot get optimized together, e.g. that
let mut x = PeanoInt::new();
for _ in 0..1_000_000 {
x.incr();
}Does not get optimized down to a single addition.
Since the backing integer is 64 bits long, no program could ever actually reach the point where the integer overflows.
terminates
ensures
result.0@ == self.0@ + 1Trait Implementations§
impl Copy for PeanoInt
Source§impl DeepModel for PeanoInt
impl DeepModel for PeanoInt
Source§fn deep_model(self) -> u64
fn deep_model(self) -> u64
logic(open, inline)
self.0type DeepModelTy = u64
impl Eq for PeanoInt
Source§impl Ord for PeanoInt
impl Ord for PeanoInt
Source§impl OrdLogic for PeanoInt
impl OrdLogic for PeanoInt
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§impl PartialOrd for PeanoInt
impl PartialOrd for PeanoInt
Source§fn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
ghost
ensures
result == Some((*self).cmp_log(*other))Auto Trait Implementations§
impl Freeze for PeanoInt
impl Objective for PeanoInt
impl RefUnwindSafe for PeanoInt
impl Send for PeanoInt
impl Sync for PeanoInt
impl Unpin for PeanoInt
impl UnsafeUnpin for PeanoInt
impl UnwindSafe for PeanoInt
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