-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port lemmas on network liveness (#527)
Signed-off-by: Xudong Sun <[email protected]>
- Loading branch information
1 parent
b031420
commit 4474340
Showing
8 changed files
with
552 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2022 VMware, Inc. | ||
// SPDX-License-Identifier: MIT | ||
#![allow(unused_imports)] | ||
use crate::kubernetes_api_objects::spec::prelude::*; | ||
use crate::temporal_logic::{defs::*, rules::*}; | ||
use crate::v2::kubernetes_cluster::spec::{ | ||
api_server::types::*, cluster_state_machine::*, message::*, | ||
}; | ||
use vstd::prelude::*; | ||
|
||
verus! { | ||
|
||
impl Cluster { | ||
|
||
pub proof fn lemma_pre_leads_to_post_by_api_server( | ||
self, spec: TempPred<ClusterState>, input: Option<Message>, next: ActionPred<ClusterState>, step: APIServerStep, pre: StatePred<ClusterState>, post: StatePred<ClusterState> | ||
) | ||
requires | ||
forall |s, s_prime| pre(s) && #[trigger] next(s, s_prime) ==> pre(s_prime) || post(s_prime), | ||
forall |s, s_prime| pre(s) && #[trigger] next(s, s_prime) && self.api_server_next().forward(input)(s, s_prime) ==> post(s_prime), | ||
forall |s| #[trigger] pre(s) ==> self.api_server_action_pre(step, input)(s), | ||
spec.entails(always(lift_action(next))), | ||
spec.entails(tla_forall(|i| self.api_server_next().weak_fairness(i))), | ||
ensures spec.entails(lift_state(pre).leads_to(lift_state(post))), | ||
{ | ||
use_tla_forall::<ClusterState, Option<Message>>(spec, |i| self.api_server_next().weak_fairness(i), input); | ||
self.api_server_action_pre_implies_next_pre(step, input); | ||
valid_implies_trans::<ClusterState>( | ||
lift_state(pre), | ||
lift_state(self.api_server_action_pre(step, input)), | ||
lift_state(self.api_server_next().pre(input)) | ||
); | ||
self.api_server_next().wf1(input, spec, next, pre, post); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2022 VMware, Inc. | ||
// SPDX-License-Identifier: MIT | ||
#![allow(unused_imports)] | ||
use crate::kubernetes_api_objects::spec::prelude::*; | ||
use crate::temporal_logic::{defs::*, rules::*}; | ||
use crate::v2::kubernetes_cluster::spec::{ | ||
cluster_state_machine::*, external::types::*, message::*, | ||
}; | ||
use vstd::prelude::*; | ||
|
||
verus! { | ||
|
||
impl Cluster { | ||
|
||
pub proof fn lemma_pre_leads_to_post_by_external( | ||
self, spec: TempPred<ClusterState>, controller_id: int, input: Option<Message>, next: ActionPred<ClusterState>, | ||
step: ExternalStep, pre: StatePred<ClusterState>, post: StatePred<ClusterState> | ||
) | ||
requires | ||
forall |s, s_prime| pre(s) && #[trigger] next(s, s_prime) ==> pre(s_prime) || post(s_prime), | ||
forall |s, s_prime| pre(s) && #[trigger] next(s, s_prime) && self.external_next().forward((controller_id, input))(s, s_prime) ==> post(s_prime), | ||
forall |s| #[trigger] pre(s) ==> self.external_action_pre(step, (controller_id, input))(s), | ||
spec.entails(always(lift_action(next))), | ||
spec.entails(tla_forall(|i| self.external_next().weak_fairness((controller_id, i)))), | ||
ensures spec.entails(lift_state(pre).leads_to(lift_state(post))), | ||
{ | ||
use_tla_forall::<ClusterState, Option<Message>>(spec, |i| self.external_next().weak_fairness((controller_id, i)), input); | ||
self.external_action_pre_implies_next_pre(step, (controller_id, input)); | ||
valid_implies_trans::<ClusterState>( | ||
lift_state(pre), | ||
lift_state(self.external_action_pre(step, (controller_id, input))), | ||
lift_state(self.external_next().pre((controller_id, input))) | ||
); | ||
self.external_next().wf1((controller_id, input), spec, next, pre, post); | ||
} | ||
|
||
} | ||
|
||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.