pub trait WellFounded: Sized {
// Required methods
fn well_founded_relation(self, other: Self) -> bool;
fn no_infinite_decreasing_sequence(s: Mapping<Int, Self>) -> Int;
}Expand description
Instances of this trait are types which are allowed as variants of recursive definitions.
Required Methods§
Sourcefn well_founded_relation(self, other: Self) -> bool
fn well_founded_relation(self, other: Self) -> bool
Relation used to specify well-foundedness.
⚠
Sourcefn no_infinite_decreasing_sequence(s: Mapping<Int, Self>) -> Int
fn no_infinite_decreasing_sequence(s: Mapping<Int, Self>) -> Int
Being well-founded means that there is no infinitely decreasing sequence.
If you can map your type to another that already implements WellFounded
(and the mapping preserves well_founded_relation), this lemma is quite
easy to prove:
struct MyInt(Int);
impl WellFounded for MyInt {
#[logic(open, inline)]
fn well_founded_relation(self, other: Self) -> bool {
Int::well_founded_relation(self.0, other.0)
}
#[logic]
#[ensures(!Self::well_founded_relation(s[result], s[result + 1]))]
fn no_infinite_decreasing_sequence(s: Mapping<Int, Self>) -> Int {
Int::no_infinite_decreasing_sequence(|i| s[i].0)
}
}⚠
ensures
result >= 0ensures
!Self::well_founded_relation(s[result], s[result + 1])Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl WellFounded for i8
impl WellFounded for i8
Source§fn well_founded_relation(self, other: Self) -> bool
fn well_founded_relation(self, other: Self) -> bool
(open, inline)
self > otherSource§impl WellFounded for i16
impl WellFounded for i16
Source§fn well_founded_relation(self, other: Self) -> bool
fn well_founded_relation(self, other: Self) -> bool
(open, inline)
self > otherSource§impl WellFounded for i32
impl WellFounded for i32
Source§fn well_founded_relation(self, other: Self) -> bool
fn well_founded_relation(self, other: Self) -> bool
(open, inline)
self > otherSource§impl WellFounded for i64
impl WellFounded for i64
Source§fn well_founded_relation(self, other: Self) -> bool
fn well_founded_relation(self, other: Self) -> bool
(open, inline)
self > otherSource§impl WellFounded for i128
impl WellFounded for i128
Source§fn well_founded_relation(self, other: Self) -> bool
fn well_founded_relation(self, other: Self) -> bool
(open, inline)
self > otherSource§impl WellFounded for isize
impl WellFounded for isize
Source§fn well_founded_relation(self, other: Self) -> bool
fn well_founded_relation(self, other: Self) -> bool
(open, inline)
self > otherSource§impl WellFounded for u8
impl WellFounded for u8
Source§fn well_founded_relation(self, other: Self) -> bool
fn well_founded_relation(self, other: Self) -> bool
(open, inline)
self > otherSource§impl WellFounded for u16
impl WellFounded for u16
Source§fn well_founded_relation(self, other: Self) -> bool
fn well_founded_relation(self, other: Self) -> bool
(open, inline)
self > otherSource§impl WellFounded for u32
impl WellFounded for u32
Source§fn well_founded_relation(self, other: Self) -> bool
fn well_founded_relation(self, other: Self) -> bool
(open, inline)
self > otherSource§impl WellFounded for u64
impl WellFounded for u64
Source§fn well_founded_relation(self, other: Self) -> bool
fn well_founded_relation(self, other: Self) -> bool
(open, inline)
self > otherSource§impl WellFounded for u128
impl WellFounded for u128
Source§fn well_founded_relation(self, other: Self) -> bool
fn well_founded_relation(self, other: Self) -> bool
(open, inline)
self > otherSource§impl WellFounded for ()
impl WellFounded for ()
Source§fn well_founded_relation(self, _: Self) -> bool
fn well_founded_relation(self, _: Self) -> bool
(open, inline)
falseSource§impl WellFounded for usize
impl WellFounded for usize
Source§fn well_founded_relation(self, other: Self) -> bool
fn well_founded_relation(self, other: Self) -> bool
(open, inline)
self > otherSource§impl<T0> WellFounded for (T0,)where
T0: WellFounded,
impl<T0> WellFounded for (T0,)where
T0: WellFounded,
Source§fn well_founded_relation(self, other: Self) -> bool
fn well_founded_relation(self, other: Self) -> bool
(open, inline)
$resSource§impl<T0, T1> WellFounded for (T0, T1)where
T0: WellFounded,
T1: WellFounded,
impl<T0, T1> WellFounded for (T0, T1)where
T0: WellFounded,
T1: WellFounded,
Source§fn well_founded_relation(self, other: Self) -> bool
fn well_founded_relation(self, other: Self) -> bool
(open, inline)
$resSource§impl<T0, T1, T2> WellFounded for (T0, T1, T2)
impl<T0, T1, T2> WellFounded for (T0, T1, T2)
Source§fn well_founded_relation(self, other: Self) -> bool
fn well_founded_relation(self, other: Self) -> bool
(open, inline)
$resSource§impl<T0, T1, T2, T3> WellFounded for (T0, T1, T2, T3)
impl<T0, T1, T2, T3> WellFounded for (T0, T1, T2, T3)
Source§fn well_founded_relation(self, other: Self) -> bool
fn well_founded_relation(self, other: Self) -> bool
(open, inline)
$resSource§impl<T0, T1, T2, T3, T4> WellFounded for (T0, T1, T2, T3, T4)
impl<T0, T1, T2, T3, T4> WellFounded for (T0, T1, T2, T3, T4)
Source§fn well_founded_relation(self, other: Self) -> bool
fn well_founded_relation(self, other: Self) -> bool
(open, inline)
$resSource§impl<T0, T1, T2, T3, T4, T5> WellFounded for (T0, T1, T2, T3, T4, T5)where
T0: WellFounded,
T1: WellFounded,
T2: WellFounded,
T3: WellFounded,
T4: WellFounded,
T5: WellFounded,
impl<T0, T1, T2, T3, T4, T5> WellFounded for (T0, T1, T2, T3, T4, T5)where
T0: WellFounded,
T1: WellFounded,
T2: WellFounded,
T3: WellFounded,
T4: WellFounded,
T5: WellFounded,
Source§fn well_founded_relation(self, other: Self) -> bool
fn well_founded_relation(self, other: Self) -> bool
(open, inline)
$resSource§impl<T0, T1, T2, T3, T4, T5, T6> WellFounded for (T0, T1, T2, T3, T4, T5, T6)where
T0: WellFounded,
T1: WellFounded,
T2: WellFounded,
T3: WellFounded,
T4: WellFounded,
T5: WellFounded,
T6: WellFounded,
impl<T0, T1, T2, T3, T4, T5, T6> WellFounded for (T0, T1, T2, T3, T4, T5, T6)where
T0: WellFounded,
T1: WellFounded,
T2: WellFounded,
T3: WellFounded,
T4: WellFounded,
T5: WellFounded,
T6: WellFounded,
Source§fn well_founded_relation(self, other: Self) -> bool
fn well_founded_relation(self, other: Self) -> bool
(open, inline)
$resSource§impl<T0, T1, T2, T3, T4, T5, T6, T7> WellFounded for (T0, T1, T2, T3, T4, T5, T6, T7)where
T0: WellFounded,
T1: WellFounded,
T2: WellFounded,
T3: WellFounded,
T4: WellFounded,
T5: WellFounded,
T6: WellFounded,
T7: WellFounded,
impl<T0, T1, T2, T3, T4, T5, T6, T7> WellFounded for (T0, T1, T2, T3, T4, T5, T6, T7)where
T0: WellFounded,
T1: WellFounded,
T2: WellFounded,
T3: WellFounded,
T4: WellFounded,
T5: WellFounded,
T6: WellFounded,
T7: WellFounded,
Source§fn well_founded_relation(self, other: Self) -> bool
fn well_founded_relation(self, other: Self) -> bool
(open, inline)
$resSource§impl<T: WellFounded> WellFounded for &T
impl<T: WellFounded> WellFounded for &T
Source§fn well_founded_relation(self, other: Self) -> bool
fn well_founded_relation(self, other: Self) -> bool
(open, inline)
T::well_founded_relation(*self, *other)Source§impl<T: WellFounded> WellFounded for Box<T>
impl<T: WellFounded> WellFounded for Box<T>
Source§fn well_founded_relation(self, other: Self) -> bool
fn well_founded_relation(self, other: Self) -> bool
(open, inline)
T::well_founded_relation(*self, *other)