pub trait IteratorSpec: Iterator {
// Required methods
fn produces(self, visited: Seq<Self::Item>, o: Self) -> bool;
fn completed(&mut self) -> bool;
fn produces_refl(self);
fn produces_trans(
a: Self,
ab: Seq<Self::Item>,
b: Self,
bc: Seq<Self::Item>,
c: Self,
);
// Provided method
fn map_inv<B, F>(self, func: F) -> MapInv<Self, F> ⓘ
where Self: Sized,
F: FnMut(Self::Item, Snapshot<Seq<Self::Item>>) -> B { ... }
}Required Methods§
Sourcefn produces_refl(self)
fn produces_refl(self)
logic(law, prophetic) ⚠
ensures
self.produces(Seq::empty(), self)Provided Methods§
Sourcefn map_inv<B, F>(self, func: F) -> MapInv<Self, F> ⓘ
fn map_inv<B, F>(self, func: F) -> MapInv<Self, F> ⓘ
ghost
requires
forall<e, i2> self.produces(Seq::singleton(e), i2) && inv(e) ==> func.precondition((e, Snapshot::new(Seq::empty())))
requires
MapInv::<Self, F>::reinitialize()requires
MapInv::<Self, F>::preservation(self, func)ensures
result == MapInv { iter: self, func, produced: Snapshot::new(Seq::empty())}
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<'a, I: IteratorSpec<Item = &'a T>, T: Clone + 'a> IteratorSpec for Cloned<I>
impl<'a, I: IteratorSpec<Item = &'a T>, T: Clone + 'a> IteratorSpec for Cloned<I>
Source§fn completed(&mut self) -> bool
fn completed(&mut self) -> bool
logic(open, prophetic)
exists<inner: &mut _> *inner == self.iter() && ^inner == (^self).iter() && inner.completed()
Source§fn produces(self, visited: Seq<T>, o: Self) -> bool
fn produces(self, visited: Seq<T>, o: Self) -> bool
logic(open, prophetic)
exists<s: Seq<&'a T>> self.iter().produces(s, o.iter()) && visited.len() == s.len() && forall<i> 0 <= i && i < s.len() ==> T::clone.postcondition((s[i],), visited[i])
Source§fn produces_refl(self)
fn produces_refl(self)
logic(law) ⚠
ensures
self.produces(Seq::empty(), self)Source§fn produces_trans(a: Self, ab: Seq<T>, b: Self, bc: Seq<T>, c: Self)
fn produces_trans(a: Self, ab: Seq<T>, b: Self, bc: Seq<T>, c: Self)
logic(law) ⚠
requires
a.produces(ab, b)requires
b.produces(bc, c)ensures
a.produces(ab.concat(bc), c)Source§impl<'a, I: IteratorSpec<Item = &'a T>, T: Copy + 'a> IteratorSpec for Copied<I>
impl<'a, I: IteratorSpec<Item = &'a T>, T: Copy + 'a> IteratorSpec for Copied<I>
Source§fn completed(&mut self) -> bool
fn completed(&mut self) -> bool
logic(open, prophetic)
exists<inner: &mut _> *inner == self.iter() && ^inner == (^self).iter() && inner.completed()
Source§fn produces(self, visited: Seq<Self::Item>, o: Self) -> bool
fn produces(self, visited: Seq<Self::Item>, o: Self) -> bool
logic(open, prophetic)
exists<s: Seq<&'a T>> self.iter().produces(s, o.iter()) && visited.len() == s.len() && forall<i> 0 <= i && i < s.len() ==> visited[i] == *s[i]
Source§fn produces_refl(self)
fn produces_refl(self)
logic(law) ⚠
ensures
self.produces(Seq::empty(), self)Source§impl<'a, K: DeepModel, V> IteratorSpec for Iter<'a, K, V>
impl<'a, K: DeepModel, V> IteratorSpec for Iter<'a, K, V>
Source§impl<'a, K: DeepModel, V> IteratorSpec for IterMut<'a, K, V>
impl<'a, K: DeepModel, V> IteratorSpec for IterMut<'a, K, V>
Source§impl<'a, T: DeepModel> IteratorSpec for Iter<'a, T>
impl<'a, T: DeepModel> IteratorSpec for Iter<'a, T>
Source§impl<'a, T: Eq + Hash + DeepModel, S: BuildHasher> IteratorSpec for Difference<'a, T, S>
impl<'a, T: Eq + Hash + DeepModel, S: BuildHasher> IteratorSpec for Difference<'a, T, S>
Source§impl<'a, T: Eq + Hash + DeepModel, S: BuildHasher> IteratorSpec for Intersection<'a, T, S>
impl<'a, T: Eq + Hash + DeepModel, S: BuildHasher> IteratorSpec for Intersection<'a, T, S>
Source§impl<'a, T> IteratorSpec for Iter<'a, T>
impl<'a, T> IteratorSpec for Iter<'a, T>
Source§fn completed(&mut self) -> bool
fn completed(&mut self) -> bool
logic(open, prophetic)
resolve(self) && (*self@)@ == Seq::empty()Source§fn produces(self, visited: Seq<Self::Item>, tl: Self) -> bool
fn produces(self, visited: Seq<Self::Item>, tl: Self) -> bool
logic(open)
self@.to_ref_seq() == visited.concat(tl@.to_ref_seq())Source§fn produces_refl(self)
fn produces_refl(self)
logic(law) ⚠
ensures
self.produces(Seq::empty(), self)Source§impl<'a, T> IteratorSpec for Iter<'a, T>
impl<'a, T> IteratorSpec for Iter<'a, T>
Source§impl<'a, T> IteratorSpec for IterMut<'a, T>
impl<'a, T> IteratorSpec for IterMut<'a, T>
Source§fn completed(&mut self) -> bool
fn completed(&mut self) -> bool
logic(open, prophetic)
resolve(self) && (*self@)@ == Seq::empty()Source§fn produces(self, visited: Seq<Self::Item>, tl: Self) -> bool
fn produces(self, visited: Seq<Self::Item>, tl: Self) -> bool
logic(open)
self@.to_mut_seq() == visited.concat(tl@.to_mut_seq())Source§fn produces_refl(self)
fn produces_refl(self)
logic(law) ⚠
ensures
self.produces(Seq::empty(), self)Source§impl<A: IteratorSpec, B: IteratorSpec<Item = A::Item>> IteratorSpec for Chain<A, B>
impl<A: IteratorSpec, B: IteratorSpec<Item = A::Item>> IteratorSpec for Chain<A, B>
Source§fn produces(self, visited: Seq<Self::Item>, o: Self) -> bool
fn produces(self, visited: Seq<Self::Item>, o: Self) -> bool
logic(open, prophetic, inline)
exists<visited_a: Seq<A::Item>, visited_b: Seq<B::Item>> visited == visited_a.concat(visited_b) && chain_produces_inner(self, visited_a, visited_b, o)
Source§fn produces_refl(self)
fn produces_refl(self)
logic(law) ⚠
ensures
self.produces(Seq::empty(), self)Source§impl<A: IteratorSpec, B: IteratorSpec> IteratorSpec for Zip<A, B>
impl<A: IteratorSpec, B: IteratorSpec> IteratorSpec for Zip<A, B>
Source§fn completed(&mut self) -> bool
fn completed(&mut self) -> bool
logic(open, prophetic)
exists<a: &mut A, b: &mut B> *a == (*self).iter_a() && *b == (*self).iter_b() && ^a == (^self).iter_a() && ^b == (^self).iter_b() && (a.completed() && resolve(b) || exists<x: A::Item> inv(x) && (*a).produces(Seq::singleton(x), ^a) && resolve(x) && (*b).completed())
Source§fn produces(self, visited: Seq<Self::Item>, o: Self) -> bool
fn produces(self, visited: Seq<Self::Item>, o: Self) -> bool
logic(open, prophetic)
exists<p1: Seq<_>, p2: Seq<_>> p1.len() == p2.len() && p2.len() == visited.len() && (forall<i> 0 <= i && i < visited.len() ==> visited[i] == (p1[i], p2[i])) && self.iter_a().produces(p1, o.iter_a()) && self.iter_b().produces(p2, o.iter_b())
Source§fn produces_refl(self)
fn produces_refl(self)
logic(law) ⚠
ensures
self.produces(Seq::empty(), self)Source§impl<I: DoubleEndedIteratorSpec> IteratorSpec for Rev<I>
impl<I: DoubleEndedIteratorSpec> IteratorSpec for Rev<I>
Source§impl<I: IteratorSpec + ?Sized> IteratorSpec for &mut I
impl<I: IteratorSpec + ?Sized> IteratorSpec for &mut I
Source§fn produces(self, visited: Seq<Self::Item>, o: Self) -> bool
fn produces(self, visited: Seq<Self::Item>, o: Self) -> bool
logic(open, prophetic)
(*self).produces(visited, *o) && ^self == ^oSource§fn completed(&mut self) -> bool
fn completed(&mut self) -> bool
logic(open, prophetic)
(*self).completed() && ^*self == ^^selfSource§fn produces_refl(self)
fn produces_refl(self)
logic(law) ⚠
ensures
self.produces(Seq::empty(), self)Source§impl<I: IteratorSpec, B, F: FnMut(I::Item) -> B> IteratorSpec for Map<I, F>
impl<I: IteratorSpec, B, F: FnMut(I::Item) -> B> IteratorSpec for Map<I, F>
Source§fn completed(&mut self) -> bool
fn completed(&mut self) -> bool
logic(open, prophetic)
(exists<inner: &mut _> *inner == self.iter() && ^inner == (^self).iter() && inner.completed()) && (*self).func() == (^self).func()
Source§fn produces(self, visited: Seq<Self::Item>, succ: Self) -> bool
fn produces(self, visited: Seq<Self::Item>, succ: Self) -> bool
logic(open, prophetic, inline)
/* Macro-generated */Source§fn produces_refl(self)
fn produces_refl(self)
logic(law) ⚠
ensures
self.produces(Seq::empty(), self)Source§impl<I: IteratorSpec, B, F: FnMut(I::Item) -> Option<B>> IteratorSpec for FilterMap<I, F>
impl<I: IteratorSpec, B, F: FnMut(I::Item) -> Option<B>> IteratorSpec for FilterMap<I, F>
Source§fn completed(&mut self) -> bool
fn completed(&mut self) -> bool
logic(open, prophetic)
(exists<s: Seq<_>, e: &mut I > self.iter().produces(s, *e) && e.completed() && forall<i> 0 <= i && i < s.len() ==> (*self).func().postcondition_mut((s[i],), (^self).func(), None)) && (*self).func() == (^self).func()
Source§fn produces(self, visited: Seq<Self::Item>, succ: Self) -> bool
fn produces(self, visited: Seq<Self::Item>, succ: Self) -> bool
logic(open, prophetic)
/* Macro-generated */Source§fn produces_refl(self)
fn produces_refl(self)
logic(law) ⚠
ensures
self.produces(Seq::empty(), self)Source§impl<I: IteratorSpec, F: FnMut(&I::Item) -> bool> IteratorSpec for Filter<I, F>
impl<I: IteratorSpec, F: FnMut(&I::Item) -> bool> IteratorSpec for Filter<I, F>
Source§fn completed(&mut self) -> bool
fn completed(&mut self) -> bool
logic(open, prophetic)
(exists<s: Seq<_>, e: &mut I > self.iter().produces(s, *e) && e.completed() && forall<i> 0 <= i && i < s.len() ==> (*self).func().postcondition_mut((&s[i],), (^self).func(), false)) && (*self).func() == (^self).func()
Source§fn produces(self, visited: Seq<Self::Item>, succ: Self) -> bool
fn produces(self, visited: Seq<Self::Item>, succ: Self) -> bool
logic(open, prophetic)
/* Macro-generated */Source§fn produces_refl(self)
fn produces_refl(self)
logic(law) ⚠
ensures
self.produces(Seq::empty(), self)Source§impl<I: IteratorSpec> IteratorSpec for Enumerate<I>
impl<I: IteratorSpec> IteratorSpec for Enumerate<I>
Source§fn completed(&mut self) -> bool
fn completed(&mut self) -> bool
logic(open, prophetic)
exists<inner: &mut _> *inner == self.iter() && ^inner == (^self).iter() && inner.completed() && self.n()@ == (^self).n()@
Source§fn produces(self, visited: Seq<Self::Item>, o: Self) -> bool
fn produces(self, visited: Seq<Self::Item>, o: Self) -> bool
logic(open, prophetic)
visited.len() == o.n()@ - self.n()@ && exists<s: Seq<I::Item>> self.iter().produces(s, o.iter()) && visited.len() == s.len() && forall<i> 0 <= i && i < s.len() ==> visited[i].0@ == self.n()@ + i && visited[i].1 == s[i]
Source§fn produces_refl(self)
fn produces_refl(self)
logic(law) ⚠
ensures
self.produces(Seq::empty(), self)Source§impl<I: IteratorSpec> IteratorSpec for Fuse<I>
impl<I: IteratorSpec> IteratorSpec for Fuse<I>
Source§fn completed(&mut self) -> bool
fn completed(&mut self) -> bool
logic(open, prophetic)
(self@ == None || exists<it:&mut I> it.completed() && self@ == Some(*it)) && (^self)@ == None
Source§fn produces(self, prod: Seq<Self::Item>, other: Self) -> bool
fn produces(self, prod: Seq<Self::Item>, other: Self) -> bool
logic(open, prophetic)
/* Macro-generated */Source§fn produces_refl(self)
fn produces_refl(self)
logic(law) ⚠
ensures
self.produces(Seq::empty(), self)Source§impl<I: IteratorSpec> IteratorSpec for Skip<I>
impl<I: IteratorSpec> IteratorSpec for Skip<I>
Source§fn produces(self, visited: Seq<Self::Item>, o: Self) -> bool
fn produces(self, visited: Seq<Self::Item>, o: Self) -> bool
logic(open, prophetic)
visited == Seq::empty() && self == o || o.n()@ == 0 && visited.len() > 0 && exists<s: Seq<Self::Item>> s.len() == self.n()@ && self.iter().produces(s.concat(visited), o.iter()) && forall<i> 0 <= i && i < s.len() ==> resolve(s[i])
Source§fn produces_refl(self)
fn produces_refl(self)
logic(law) ⚠
ensures
self.produces(Seq::empty(), self)Source§impl<I: IteratorSpec> IteratorSpec for Take<I>
impl<I: IteratorSpec> IteratorSpec for Take<I>
Source§fn completed(&mut self) -> bool
fn completed(&mut self) -> bool
logic(open, prophetic)
self.n()@ == 0 && resolve(self) || (*self).n()@ > 0 && (*self).n()@ == (^self).n()@ + 1 && self.iter_mut().completed()
Source§fn produces(self, visited: Seq<Self::Item>, o: Self) -> bool
fn produces(self, visited: Seq<Self::Item>, o: Self) -> bool
logic(open, prophetic)
self.n()@ == o.n()@ + visited.len() && self.iter().produces(visited, o.iter())
Source§fn produces_refl(self)
fn produces_refl(self)
logic(law) ⚠
ensures
self.produces(Seq::empty(), self)Source§impl<Idx: DeepModel<DeepModelTy = Int> + Step> IteratorSpec for Range<Idx>
Available on crate feature nightly only.
impl<Idx: DeepModel<DeepModelTy = Int> + Step> IteratorSpec for Range<Idx>
nightly only.Source§fn completed(&mut self) -> bool
fn completed(&mut self) -> bool
logic(open, prophetic)
resolve(self) && self.start.deep_model() >= self.end.deep_model()
Source§fn produces(self, visited: Seq<Self::Item>, o: Self) -> bool
fn produces(self, visited: Seq<Self::Item>, o: Self) -> bool
logic(open)
self.end == o.end && self.start.deep_model() <= o.start.deep_model() && (visited.len() > 0 ==> o.start.deep_model() <= o.end.deep_model()) && visited.len() == o.start.deep_model() - self.start.deep_model() && forall<i> 0 <= i && i < visited.len() ==> visited[i].deep_model() == self.start.deep_model() + i
Source§fn produces_refl(self)
fn produces_refl(self)
logic(law) ⚠
ensures
self.produces(Seq::empty(), self)Source§impl<Idx: DeepModel<DeepModelTy = Int> + Step> IteratorSpec for RangeInclusive<Idx>
Available on crate feature nightly only.
impl<Idx: DeepModel<DeepModelTy = Int> + Step> IteratorSpec for RangeInclusive<Idx>
nightly only.Source§fn completed(&mut self) -> bool
fn completed(&mut self) -> bool
logic(open, prophetic)
self.is_empty_log() && (^self).is_empty_log()Source§fn produces(self, visited: Seq<Self::Item>, o: Self) -> bool
fn produces(self, visited: Seq<Self::Item>, o: Self) -> bool
logic(open)
visited.len() == range_inclusive_len(self) - range_inclusive_len(o) && (self.is_empty_log() ==> o.is_empty_log()) && (o.is_empty_log() || self.end_log() == o.end_log()) && forall<i> 0 <= i && i < visited.len() ==> visited[i].deep_model() == self.start_log().deep_model() + i
Source§fn produces_refl(self)
fn produces_refl(self)
logic(law) ⚠
ensures
self.produces(Seq::empty(), self)Source§impl<K: DeepModel, V, A: Allocator> IteratorSpec for IntoIter<K, V, A>
Available on crate feature nightly only.
impl<K: DeepModel, V, A: Allocator> IteratorSpec for IntoIter<K, V, A>
nightly only.Source§impl<T, A: Allocator> IteratorSpec for IntoIter<T, A>
Available on crate feature nightly only.
impl<T, A: Allocator> IteratorSpec for IntoIter<T, A>
nightly only.Source§fn completed(&mut self) -> bool
fn completed(&mut self) -> bool
logic(open, prophetic)
resolve(self) && self@ == Seq::empty()Source§fn produces(self, visited: Seq<T>, rhs: Self) -> bool
fn produces(self, visited: Seq<T>, rhs: Self) -> bool
logic(open)
self@ == visited.concat(rhs@)Source§fn produces_refl(self)
fn produces_refl(self)
logic(law) ⚠
ensures
self.produces(Seq::empty(), self)Source§fn produces_trans(a: Self, ab: Seq<T>, b: Self, bc: Seq<T>, c: Self)
fn produces_trans(a: Self, ab: Seq<T>, b: Self, bc: Seq<T>, c: Self)
logic(law) ⚠
requires
a.produces(ab, b)requires
b.produces(bc, c)ensures
a.produces(ab.concat(bc), c)Source§impl<T, const N: usize> IteratorSpec for IntoIter<T, N>
impl<T, const N: usize> IteratorSpec for IntoIter<T, N>
Source§fn produces(self, visited: Seq<T>, o: Self) -> bool
fn produces(self, visited: Seq<T>, o: Self) -> bool
logic(open, prophetic)
self@ == visited.concat(o@)Source§fn completed(&mut self) -> bool
fn completed(&mut self) -> bool
logic(open, prophetic)
resolve(self) && self@ == Seq::empty()Source§fn produces_refl(self)
fn produces_refl(self)
logic(law) ⚠
ensures
self.produces(Seq::empty(), self)Source§fn produces_trans(a: Self, ab: Seq<T>, b: Self, bc: Seq<T>, c: Self)
fn produces_trans(a: Self, ab: Seq<T>, b: Self, bc: Seq<T>, c: Self)
logic(law) ⚠
requires
a.produces(ab, b)requires
b.produces(bc, c)ensures
a.produces(ab.concat(bc), c)Source§impl<T: Clone> IteratorSpec for Repeat<T>
impl<T: Clone> IteratorSpec for Repeat<T>
Source§impl<T: DeepModel, A: Allocator> IteratorSpec for IntoIter<T, A>
Available on crate feature nightly only.
impl<T: DeepModel, A: Allocator> IteratorSpec for IntoIter<T, A>
nightly only.Source§impl<T> IteratorSpec for Empty<T>
impl<T> IteratorSpec for Empty<T>
Source§fn produces(self, visited: Seq<T>, o: Self) -> bool
fn produces(self, visited: Seq<T>, o: Self) -> bool
logic(open)
visited == Seq::empty() && self == oSource§fn produces_refl(self)
fn produces_refl(self)
logic(law) ⚠
ensures
self.produces(Seq::empty(), self)Source§fn produces_trans(a: Self, ab: Seq<T>, b: Self, bc: Seq<T>, c: Self)
fn produces_trans(a: Self, ab: Seq<T>, b: Self, bc: Seq<T>, c: Self)
logic(law) ⚠
requires
a.produces(ab, b)requires
b.produces(bc, c)ensures
a.produces(ab.concat(bc), c)