use vstd::prelude::*;
verus! {
pub open spec fn recovery_permits(
namespace_attested: bool,
namespace_matches: bool,
attempt_unconfirmed: bool,
) -> bool {
namespace_attested && namespace_matches && attempt_unconfirmed
}
pub fn recovery_admitted(
namespace_attested: bool,
namespace_matches: bool,
attempt_unconfirmed: bool,
) -> (admitted: bool)
ensures admitted == recovery_permits(
namespace_attested, namespace_matches, attempt_unconfirmed,
),
{
namespace_attested && namespace_matches && attempt_unconfirmed
}
proof fn namespace_change_never_verifies(
namespace_attested: bool,
namespace_matches: bool,
attempt_unconfirmed: bool,
)
requires !namespace_attested || !namespace_matches,
ensures !recovery_permits(
namespace_attested, namespace_matches, attempt_unconfirmed,
),
{
}
proof fn confirmed_attempt_never_recovers(
namespace_attested: bool,
namespace_matches: bool,
attempt_unconfirmed: bool,
)
requires !attempt_unconfirmed,
ensures !recovery_permits(
namespace_attested, namespace_matches, attempt_unconfirmed,
),
{
}
pub open spec fn delivered(observed: bool, cancelling: bool) -> bool {
observed && !cancelling
}
pub fn ready_to_deliver(observed: bool, cancelling: bool) -> (deliver: bool)
ensures deliver == delivered(observed, cancelling),
{
observed && !cancelling
}
proof fn cancellation_defers_but_never_drops(
observed: bool,
cancelling: bool,
later_cancelling: bool,
)
requires observed && cancelling && !later_cancelling,
ensures delivered(observed, later_cancelling),
{
}
}