Struct GhostSubseq

Source
pub struct GhostSubseq<V> { /* private fields */ }

Implementations§

Source§

impl<V> GhostSubseq<V>

Source

pub closed spec fn view(self) -> Seq<V>

Source

pub open spec fn len(self) -> nat

{ self@.len() }
Source

pub open spec fn spec_index(self, idx: int) -> V

recommends
0 <= idx < self.len(),
{ self@[idx] }
Source

pub open spec fn subrange_abs(self, start_inclusive: int, end_exclusive: int) -> Seq<V>

recommends
self.off() <= start_inclusive <= end_exclusive <= self.off() + self@.len(),
{ self@.subrange(start_inclusive - self.off(), end_exclusive - self.off()) }
Source

pub closed spec fn off(self) -> nat

Source

pub closed spec fn id(self) -> int

Source

pub proof fn agree(tracked self: &GhostSubseq<V>, tracked auth: &GhostSeqAuth<V>)

requires
self.id() == auth.id(),
ensures
self@.len() > 0
    ==> {
        &&& self@
            =~= auth@
                .subrange(
                    self.off() as int - auth.off(),
                    self.off() - auth.off() + self@.len() as int,
                )
        &&& self.off() >= auth.off()
        &&& self.off() + self@.len() <= auth.off() + auth@.len()

    },
Source

pub proof fn agree_map(tracked self: &GhostSubseq<V>, tracked auth: &GhostMapAuth<int, V>)

requires
self.id() == auth.id(),
ensures
forall |i| {
    0 <= i < self@.len()
        ==> #[trigger] auth@.contains_key(self.off() + i)
            && auth@[self.off() + i] == self@[i]
},
Source

pub proof fn update(tracked self: &mut GhostSubseq<V>, tracked auth: &mut GhostSeqAuth<V>, v: Seq<V>)

requires
old(self).id() == old(auth).id(),
v.len() == old(self)@.len(),
ensures
self.id() == auth.id(),
self.off() == old(self).off(),
auth.id() == old(auth).id(),
self@ =~= v,
auth@ =~= old(auth)@.update_subrange_with(self.off() - auth.off(), v),
self.off() == old(self).off(),
auth.off() == old(auth).off(),
Source

pub proof fn update_map(tracked self: &mut GhostSubseq<V>, tracked auth: &mut GhostMapAuth<int, V>, v: Seq<V>, )

requires
old(self).id() == old(auth).id(),
v.len() == old(self)@.len(),
ensures
self.id() == auth.id(),
self.off() == old(self).off(),
auth.id() == old(auth).id(),
self@ =~= v,
auth@
    =~= Map::new(
        |i: int| old(auth)@.contains_key(i),
        |i: int| {
            if self.off() <= i < self.off() + v.len() {
                v[i - self.off()]
            } else {
                old(auth)@[i]
            }
        },
    ),
Source

pub proof fn split(tracked self: &mut GhostSubseq<V>, n: int) -> tracked result : GhostSubseq<V>

requires
0 <= n <= old(self)@.len(),
ensures
self.id() == old(self).id(),
self.off() == old(self).off(),
result.id() == self.id(),
result.off() == old(self).off() + n,
self@ =~= old(self)@.subrange(0, n),
result@ =~= old(self)@.subrange(n, old(self)@.len() as int),
Source

pub proof fn combine(tracked self: &mut GhostSubseq<V>, tracked r: GhostSubseq<V>)

requires
r.id() == old(self).id(),
r.off() == old(self).off() + old(self)@.len(),
ensures
self.id() == old(self).id(),
self@ =~= old(self)@ + r@,
self.off() == old(self).off(),
Source

pub proof fn disjoint(tracked &mut self, tracked other: &GhostSubseq<V>)

requires
old(self).id() == other.id(),
ensures
self.id() == old(self).id(),
self.off() == old(self).off(),
self@ == old(self)@,
self@.len() == 0 || other@.len() == 0 || self.off() + self@.len() <= other.off()
    || other.off() + other@.len() <= self.off(),
Source

pub proof fn dummy() -> tracked result : Self

Source

pub proof fn new(off: nat, len: nat, tracked f: GhostSubmap<int, V>) -> tracked result : GhostSubseq<V>

requires
f@.dom() == Set::new(|i: int| off <= i < off + len),
ensures
result.id() == f.id(),
result.off() == off,
result@ == Seq::new(len, |i| f@[off + i]),

Auto Trait Implementations§

§

impl<V> Freeze for GhostSubseq<V>

§

impl<V> RefUnwindSafe for GhostSubseq<V>
where V: RefUnwindSafe,

§

impl<V> Send for GhostSubseq<V>
where V: Send,

§

impl<V> Sync for GhostSubseq<V>
where V: Sync,

§

impl<V> Unpin for GhostSubseq<V>
where V: Unpin,

§

impl<V> UnwindSafe for GhostSubseq<V>
where V: 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<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, 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.