Skip to main content

Positive

Struct Positive 

Source
pub struct Positive(/* private fields */);
Expand description

Positive numbers, i.e. numbers that are strictly greater than 0.

Implementations§

Source§

impl Positive

Source

pub fn to_int(self) -> Int

logic

ensures

result > 0

Source

pub fn new(n: Int) -> Self

logic

requires

n > 0

ensures

result.to_int() == n

Source

pub fn ext_eq(self, other: Self) -> bool

logic(open)

let _ = Subset::<PositiveInner>::inner_inj;
self.to_int() == other.to_int()

ensures

#[trigger(self == other)] result == (self == other)

Trait Implementations§

Source§

impl AddLogic for Positive

Source§

fn add_logic(self, other: Self) -> Self

logic

ensures

result@ == self@ + other@

Source§

type Output = Positive

Source§

impl Clone for Positive

Source§

fn clone(&self) -> Self

ghost

ensures

result == *self

1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Positive

Source§

impl MulLogic for Positive

Source§

fn mul_logic(self, other: Self) -> Self

logic

ensures

result@ == self@ * other@

Source§

type Output = Positive

Source§

impl OrdLogic for Positive

Source§

fn lt_log_total(self, other: Self)

logic(law)

ensures

self < other || self == other || other < self

Source§

fn cmp_log(self, other: Self) -> Ordering

The comparison operation. Read more
Source§

impl PartialOrdLogic for Positive

Source§

fn lt_log(self, other: Self) -> bool

logic(open)

self.to_int() < other.to_int()

Source§

fn le_log(self, other: Self) -> bool

logic(open)

self.to_int() <= other.to_int()

Source§

fn irreflexive(self)

logic

ensures

!(self < self)

Source§

fn transitive(x: Self, y: Self, z: Self)

logic

requires

x < y

requires

y < z

ensures

x < z

Source§

fn le_lt_log(self, other: Self)

logic(law)

ensures

(self <= other) == (self < other || self == other)

Source§

fn gt_log(self, other: Self) -> bool

The logical > operation. Read more
Source§

fn ge_log(self, other: Self) -> bool

The logical >= operation. Read more
Source§

fn partial_cmp_log(self, other: Self) -> Option<Ordering>

logic(open, sealed) Read more

Source§

impl Plain for Positive

Source§

fn into_ghost(s: Snapshot<Self>) -> Ghost<Self>

ghost

ensures

*result == *s

Source§

impl RA for Positive

Source§

fn op(self, other: Self) -> Option<Self>

logic(open)

Some(self + other)

Source§

fn incl(self, other: Self) -> bool

logic(open)

let _ = Self::ext_eq;
let r = self < other;
proof_assert!(r ==> self.op(Self::new(other@ - self@)) == Some(other));
r

ensures

result == (exists<factor> self.op(factor) == Some(other))

Source§

fn commutative(a: Self, b: Self)

logic(law)

ensures

a.op(b) == b.op(a)

Source§

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(self) -> Option<Self>

logic(open)

None

Source§

fn core_idemp(self)

logic

requires

self.core() != None

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)

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

logic(open)

let _ = Self::ext_eq;
true

ensures

result == (forall<x, y> self.op(x) != None ==>
    self.op(x) == self.op(y) ==> x == y)
Source§

fn eq(self, other: Self) -> bool

logic(open, inline) Read more

Source§

fn incl_op(self, other: Self, comb: Self)

logic(law) Read more
Source§

fn incl_eq(self, other: Self) -> bool

logic(open, sealed) Read more

Source§

fn incl_eq_op(a: Self, b: Self, x: Self) -> bool

logic(open, sealed) Read more
Source§

fn factor(self, factor: Self) -> Self

Factorizing elements of the RA Read more
Source§

fn update(self, x: Self) -> bool

Ensures that we can go from self to x without making composition with the frame invalid. Read more
Source§

fn update_nondet(self, s: Set<Self>) -> bool

Source§

fn associative_none(a: Self, b: Self, c: Self, bc: Self)

Specialized version of Self::associative, in the case where a.op(b) == None. Read more
Source§

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 more
Source§

fn incl_transitive(a: Self, b: Self, c: Self)

RA::incl is transitive. Read more
Source§

impl View for Positive

Source§

fn view(self) -> Int

logic(open)

self.to_int()

Source§

type ViewTy = Int

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.