Skip to main content

Instance

Struct Instance 

Source
pub struct Instance<K, V, Pred: InvariantPredicate<K, V>> { /* private fields */ }

Implementations§

Source§

impl<K, V, Pred: InvariantPredicate<K, V>> Instance<K, V, Pred>

Source

pub fn clone(&self) -> Self

Source

pub fn id(&self) -> InstanceId

Source

pub fn k(&self) -> K

Source

pub fn pred(&self) -> PhantomData<Pred>

Source

pub proof fn initialize_full( k: K, t: V, tracked param_token_storage: Option<V>, ) -> tracked tmp_tuple : (Tracked<Instance<K, V, Pred>>, Tracked<flag_exc<K, V, Pred>>, Tracked<flag_rc<K, V, Pred>>, Tracked<Option<pending_writer<K, V, Pred>>>, Tracked<Option<writer<K, V, Pred>>>, Tracked<MultisetToken<(), pending_reader<K, V, Pred>>>, Tracked<MultisetToken<V, reader<K, V, Pred>>>)

requires
(Pred::inv(k, t)),
(crate::prelude::equal(param_token_storage, Option::Some(t))),
ensures
({
    let (
        instance,
        param_token_flag_exc,
        param_token_flag_rc,
        param_token_pending_writer,
        param_token_writer,
        param_token_pending_reader,
        param_token_reader,
    ) = tmp_tuple;
    let instance = instance.view();
    let param_token_flag_exc = param_token_flag_exc.view();
    let param_token_flag_rc = param_token_flag_rc.view();
    let param_token_pending_writer = param_token_pending_writer.view();
    let param_token_writer = param_token_writer.view();
    let param_token_pending_reader = param_token_pending_reader.view();
    let param_token_reader = param_token_reader.view();
    (crate::prelude::equal(
        <flag_exc<
            K,
            V,
            Pred,
        > as crate::tokens::ValueToken<bool>>::instance_id(&(param_token_flag_exc)),
        Self::id(&instance),
    ))
        && (crate::prelude::equal(
            <flag_rc<
                K,
                V,
                Pred,
            > as crate::tokens::ValueToken<nat>>::instance_id(&(param_token_flag_rc)),
            Self::id(&instance),
        )) && (crate::prelude::equal(Self::k(&instance), k))
        && (crate::prelude::equal(Self::pred(&instance), PhantomData))
        && (crate::prelude::equal(
            <flag_exc<
                K,
                V,
                Pred,
            > as crate::tokens::ValueToken<bool>>::value(&(param_token_flag_exc)),
            false,
        ))
        && (crate::prelude::equal(
            <flag_rc<
                K,
                V,
                Pred,
            > as crate::tokens::ValueToken<nat>>::value(&(param_token_flag_rc)),
            0,
        ))
        && (crate::tokens::option_value_eq_option_token(
            Option::None,
            param_token_pending_writer,
            Self::id(&instance),
        ))
        && (crate::tokens::option_value_eq_option_token(
            Option::None,
            param_token_writer,
            Self::id(&instance),
        ))
        && (crate::prelude::equal(
            Multiset::empty(),
            (param_token_pending_reader).multiset(),
        )
            && crate::prelude::equal(
                (param_token_pending_reader).instance_id(),
                Self::id(&instance),
            ))
        && (crate::prelude::equal(Multiset::empty(), (param_token_reader).multiset())
            && crate::prelude::equal(
                (param_token_reader).instance_id(),
                Self::id(&instance),
            ))
}),
Source

pub proof fn acquire_read_start( tracked &self, tracked param_token_flag_rc: &mut flag_rc<K, V, Pred>, ) -> tracked param_token_0_pending_reader : pending_reader<K, V, Pred>

requires
(crate::prelude::equal(
    <flag_rc<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<
        nat,
    >>::instance_id(&(*crate::prelude::old(param_token_flag_rc))),
    Self::id(self),
)),
ensures
(crate::prelude::equal(
    <flag_rc<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<nat>>::instance_id(&(*param_token_flag_rc)),
    Self::id(self),
)),
(crate::prelude::equal(
    <pending_reader<
        K,
        V,
        Pred,
    > as crate::tokens::ElementToken<()>>::instance_id(&(param_token_0_pending_reader)),
    Self::id(self),
)),
(crate::prelude::equal(
    <pending_reader<
        K,
        V,
        Pred,
    > as crate::tokens::ElementToken<()>>::element(&(param_token_0_pending_reader)),
    (),
)),
(crate::prelude::equal(
    <flag_rc<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<nat>>::value(&(*param_token_flag_rc)),
    <flag_rc<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<
        nat,
    >>::value(&(*crate::prelude::old(param_token_flag_rc))) + 1,
)),
Source

pub proof fn acquire_read_end( tracked &self, tracked param_token_flag_exc: &flag_exc<K, V, Pred>, tracked param_token_0_pending_reader: pending_reader<K, V, Pred>, ) -> tracked tmp_tuple : (Ghost<Option<V>>, Tracked<reader<K, V, Pred>>)

requires
(crate::prelude::equal(
    <flag_exc<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<bool>>::instance_id(&(*param_token_flag_exc)),
    Self::id(self),
)),
(crate::prelude::equal(
    <pending_reader<
        K,
        V,
        Pred,
    > as crate::tokens::ElementToken<()>>::instance_id(&(param_token_0_pending_reader)),
    Self::id(self),
)),
((<flag_exc<
    K,
    V,
    Pred,
> as crate::tokens::ValueToken<bool>>::value(&(*param_token_flag_exc)) == false)),
(crate::prelude::equal(
    <pending_reader<
        K,
        V,
        Pred,
    > as crate::tokens::ElementToken<()>>::element(&(param_token_0_pending_reader)),
    (),
)),
ensures
({
    let (original_field_storage, param_token_1_reader) = tmp_tuple;
    let original_field_storage = original_field_storage.view();
    let param_token_1_reader = param_token_1_reader.view();
    (crate::prelude::equal(
        <reader<
            K,
            V,
            Pred,
        > as crate::tokens::ElementToken<V>>::instance_id(&(param_token_1_reader)),
        Self::id(self),
    ))
        && ({
            let x: V = original_field_storage->0;
            crate::prelude::equal(
                <reader<
                    K,
                    V,
                    Pred,
                > as crate::tokens::ElementToken<V>>::element(&(param_token_1_reader)),
                x,
            )
        })
        && ({
            let x: V = original_field_storage->0;
            Pred::inv(Self::k(&(*self)), x)
        })
}),
Source

pub proof fn acquire_read_abandon( tracked &self, tracked param_token_flag_rc: &mut flag_rc<K, V, Pred>, tracked param_token_0_pending_reader: pending_reader<K, V, Pred>, )

requires
(crate::prelude::equal(
    <flag_rc<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<
        nat,
    >>::instance_id(&(*crate::prelude::old(param_token_flag_rc))),
    Self::id(self),
)),
(crate::prelude::equal(
    <pending_reader<
        K,
        V,
        Pred,
    > as crate::tokens::ElementToken<()>>::instance_id(&(param_token_0_pending_reader)),
    Self::id(self),
)),
(crate::prelude::equal(
    <pending_reader<
        K,
        V,
        Pred,
    > as crate::tokens::ElementToken<()>>::element(&(param_token_0_pending_reader)),
    (),
)),
ensures
(crate::prelude::equal(
    <flag_rc<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<nat>>::instance_id(&(*param_token_flag_rc)),
    Self::id(self),
)),
((<flag_rc<
    K,
    V,
    Pred,
> as crate::tokens::ValueToken<nat>>::value(&(*crate::prelude::old(param_token_flag_rc)))
    >= 1)),
(crate::prelude::equal(
    <flag_rc<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<nat>>::value(&(*param_token_flag_rc)),
    (<flag_rc<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<
        nat,
    >>::value(&(*crate::prelude::old(param_token_flag_rc))) - 1) as nat,
)),
Source

pub proof fn acquire_exc_start( tracked &self, tracked param_token_flag_exc: &mut flag_exc<K, V, Pred>, ) -> tracked param_token_0_pending_writer : pending_writer<K, V, Pred>

requires
(crate::prelude::equal(
    <flag_exc<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<
        bool,
    >>::instance_id(&(*crate::prelude::old(param_token_flag_exc))),
    Self::id(self),
)),
((<flag_exc<
    K,
    V,
    Pred,
> as crate::tokens::ValueToken<
    bool,
>>::value(&(*crate::prelude::old(param_token_flag_exc))) == false)),
ensures
(crate::prelude::equal(
    <flag_exc<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<bool>>::instance_id(&(*param_token_flag_exc)),
    Self::id(self),
)),
(crate::prelude::equal(
    <pending_writer<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<()>>::instance_id(&(param_token_0_pending_writer)),
    Self::id(self),
)),
(crate::prelude::equal(
    <pending_writer<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<()>>::value(&(param_token_0_pending_writer)),
    (),
)),
(crate::prelude::equal(
    <flag_exc<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<bool>>::value(&(*param_token_flag_exc)),
    true,
)),
Source

pub proof fn acquire_exc_end( tracked &self, tracked param_token_flag_rc: &flag_rc<K, V, Pred>, tracked param_token_0_pending_writer: pending_writer<K, V, Pred>, ) -> tracked tmp_tuple : (Ghost<Option<V>>, Tracked<V>, Tracked<writer<K, V, Pred>>)

requires
(crate::prelude::equal(
    <flag_rc<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<nat>>::instance_id(&(*param_token_flag_rc)),
    Self::id(self),
)),
(crate::prelude::equal(
    <pending_writer<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<()>>::instance_id(&(param_token_0_pending_writer)),
    Self::id(self),
)),
((<flag_rc<K, V, Pred> as crate::tokens::ValueToken<nat>>::value(&(*param_token_flag_rc))
    == 0)),
(crate::prelude::equal(
    <pending_writer<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<()>>::value(&(param_token_0_pending_writer)),
    (),
)),
ensures
({
    let (original_field_storage, param_token_2_storage, param_token_1_writer) = tmp_tuple;
    let original_field_storage = original_field_storage.view();
    let param_token_2_storage = param_token_2_storage.view();
    let param_token_1_writer = param_token_1_writer.view();
    (crate::prelude::equal(
        <writer<
            K,
            V,
            Pred,
        > as crate::tokens::ValueToken<()>>::instance_id(&(param_token_1_writer)),
        Self::id(self),
    ))
        && (crate::prelude::equal(
            <writer<
                K,
                V,
                Pred,
            > as crate::tokens::ValueToken<()>>::value(&(param_token_1_writer)),
            (),
        ))
        && ({
            let x = original_field_storage->0;
            crate::prelude::equal(param_token_2_storage, x)
        })
        && ({
            let x = original_field_storage->0;
            Pred::inv(Self::k(&(*self)), x)
        })
}),
Source

pub proof fn release_exc( tracked &self, x: V, tracked param_token_flag_exc: &mut flag_exc<K, V, Pred>, tracked param_token_1_storage: V, tracked param_token_0_writer: writer<K, V, Pred>, )

requires
(crate::prelude::equal(
    <flag_exc<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<
        bool,
    >>::instance_id(&(*crate::prelude::old(param_token_flag_exc))),
    Self::id(self),
)),
(crate::prelude::equal(
    <writer<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<()>>::instance_id(&(param_token_0_writer)),
    Self::id(self),
)),
(Pred::inv(Self::k(&(*self)), x)),
(crate::prelude::equal(
    <writer<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<()>>::value(&(param_token_0_writer)),
    (),
)),
(crate::prelude::equal(param_token_1_storage, x)),
ensures
(crate::prelude::equal(
    <flag_exc<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<bool>>::instance_id(&(*param_token_flag_exc)),
    Self::id(self),
)),
(crate::prelude::equal(
    <flag_exc<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<bool>>::value(&(*param_token_flag_exc)),
    false,
)),
Source

pub proof fn read_guard<'a>( tracked &self, x: V, tracked param_token_0_reader: &'a reader<K, V, Pred>, ) -> tracked param_token_1_storage : &'a V

requires
(crate::prelude::equal(
    <reader<
        K,
        V,
        Pred,
    > as crate::tokens::ElementToken<V>>::instance_id(&(*param_token_0_reader)),
    Self::id(self),
)),
(crate::prelude::equal(
    <reader<
        K,
        V,
        Pred,
    > as crate::tokens::ElementToken<V>>::element(&(*param_token_0_reader)),
    x,
)),
ensures
(crate::prelude::equal(*param_token_1_storage, x)),
Source

pub proof fn read_match( tracked &self, x: V, y: V, tracked param_token_0_reader: &reader<K, V, Pred>, tracked param_token_1_reader: &reader<K, V, Pred>, )

requires
(crate::prelude::equal(
    <reader<
        K,
        V,
        Pred,
    > as crate::tokens::ElementToken<V>>::instance_id(&(*param_token_0_reader)),
    Self::id(self),
)),
(crate::prelude::equal(
    <reader<
        K,
        V,
        Pred,
    > as crate::tokens::ElementToken<V>>::instance_id(&(*param_token_1_reader)),
    Self::id(self),
)),
(crate::prelude::equal(
    <reader<
        K,
        V,
        Pred,
    > as crate::tokens::ElementToken<V>>::element(&(*param_token_0_reader)),
    x,
)),
(crate::prelude::equal(
    <reader<
        K,
        V,
        Pred,
    > as crate::tokens::ElementToken<V>>::element(&(*param_token_1_reader)),
    y,
)),
ensures
((equal(x, y))),
Source

pub proof fn release_shared( tracked &self, x: V, tracked param_token_flag_rc: &mut flag_rc<K, V, Pred>, tracked param_token_0_reader: reader<K, V, Pred>, )

requires
(crate::prelude::equal(
    <flag_rc<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<
        nat,
    >>::instance_id(&(*crate::prelude::old(param_token_flag_rc))),
    Self::id(self),
)),
(crate::prelude::equal(
    <reader<
        K,
        V,
        Pred,
    > as crate::tokens::ElementToken<V>>::instance_id(&(param_token_0_reader)),
    Self::id(self),
)),
(crate::prelude::equal(
    <reader<
        K,
        V,
        Pred,
    > as crate::tokens::ElementToken<V>>::element(&(param_token_0_reader)),
    x,
)),
ensures
(crate::prelude::equal(
    <flag_rc<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<nat>>::instance_id(&(*param_token_flag_rc)),
    Self::id(self),
)),
((<flag_rc<
    K,
    V,
    Pred,
> as crate::tokens::ValueToken<nat>>::value(&(*crate::prelude::old(param_token_flag_rc)))
    >= 1)),
(crate::prelude::equal(
    <flag_rc<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<nat>>::value(&(*param_token_flag_rc)),
    (<flag_rc<
        K,
        V,
        Pred,
    > as crate::tokens::ValueToken<
        nat,
    >>::value(&(*crate::prelude::old(param_token_flag_rc))) - 1) as nat,
)),

Trait Implementations§

Source§

impl<K, V, Pred: InvariantPredicate<K, V>> Clone for Instance<K, V, Pred>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<K, V, Pred: InvariantPredicate<K, V>> Copy for Instance<K, V, Pred>

Auto Trait Implementations§

§

impl<K, V, Pred> Freeze for Instance<K, V, Pred>

§

impl<K, V, Pred> RefUnwindSafe for Instance<K, V, Pred>

§

impl<K, V, Pred> Send for Instance<K, V, Pred>
where V: Sync + Send,

§

impl<K, V, Pred> Sync for Instance<K, V, Pred>
where V: Sync + Send,

§

impl<K, V, Pred> Unpin for Instance<K, V, Pred>
where V: Unpin, K: Unpin, Pred: Unpin,

§

impl<K, V, Pred> UnsafeUnpin for Instance<K, V, Pred>

§

impl<K, V, Pred> UnwindSafe for Instance<K, V, Pred>
where V: UnwindSafe, K: UnwindSafe, Pred: UnwindSafe,

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<Borrowed, VERUS_SPEC__A> BorrowSpec<Borrowed> for VERUS_SPEC__A
where VERUS_SPEC__A: Borrow<Borrowed> + ?Sized, Borrowed: ?Sized,

Source§

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

Source§

open spec fn obeys_borrow_spec() -> bool

{ true }
Source§

open spec fn borrow_spec(&self) -> &T

{ self }
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, VERUS_SPEC__A> FromSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: From<T>,

Source§

exec fn obeys_from_spec() -> bool

Source§

exec fn from_spec(v: T) -> VERUS_SPEC__A

Source§

impl<T> FromSpecImpl<T> for T

Source§

open spec fn obeys_from_spec() -> bool

{ true }
Source§

open spec fn from_spec(v: T) -> T

{ v }
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, VERUS_SPEC__A> IntoSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: Into<T>,

Source§

exec fn obeys_into_spec() -> bool

Source§

exec fn into_spec(self) -> T

Source§

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

Source§

open spec fn obeys_into_spec() -> bool

{ <U as FromSpec<Self>>::obeys_from_spec() }
Source§

open spec fn into_spec(self) -> U

{ <U as FromSpec<Self>>::from_spec(self) }
§

impl<A> SpecEq<&A> for A
where A: ?Sized,

§

impl<A> SpecEq<&mut A> for A
where A: ?Sized,

§

impl<A> SpecEq<A> for A
where A: ?Sized,

§

impl<A> SpecEq<Ghost<A>> for A

§

impl<A> SpecEq<Tracked<A>> for A

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, VERUS_SPEC__A> TryFromSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: TryFrom<T>,

Source§

exec fn obeys_try_from_spec() -> bool

Source§

exec fn try_from_spec( v: T, ) -> Result<VERUS_SPEC__A, <VERUS_SPEC__A as TryFrom<T>>::Error>

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

impl<T, VERUS_SPEC__A> TryIntoSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: TryInto<T>,

Source§

exec fn obeys_try_into_spec() -> bool

Source§

exec fn try_into_spec(self) -> Result<T, <VERUS_SPEC__A as TryInto<T>>::Error>

Source§

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

Source§

open spec fn obeys_try_into_spec() -> bool

{ <U as TryFromSpec<Self>>::obeys_try_from_spec() }
Source§

open spec fn try_into_spec(self) -> Result<U, <U as TryFrom<T>>::Error>

{ <U as TryFromSpec<Self>>::try_from_spec(self) }