-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
annotations: calculus annotations (wp,ert,wlp) #7
Changes from 1 commit
a286130
ad861f3
a10ff34
59c6bc9
068757a
d28c5c6
62ae301
bd5bbb6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,17 +84,12 @@ impl Encoding for InvariantAnnotation { | |
resolve.visit_expr(invariant) | ||
} | ||
|
||
fn check_calculus(&self, calculus: &Calculus, direction: Direction) -> Result<(), ()> { | ||
if direction | ||
!= match calculus.calculus_type { | ||
CalculusType::WP | CalculusType::ERT => Direction::Up, | ||
CalculusType::WLP => Direction::Down, | ||
} | ||
{ | ||
return Err(()); | ||
} | ||
|
||
Ok(()) | ||
fn is_calculus_allowed(&self, calculus: &Calculus, direction: Direction) -> bool { | ||
matches!( | ||
(&calculus.calculus_type, direction), | ||
(CalculusType::Wp | CalculusType::Ert, Direction::Up) | ||
| (CalculusType::Wlp, Direction::Down) | ||
) | ||
} | ||
|
||
fn transform( | ||
|
@@ -207,17 +202,17 @@ impl Encoding for KIndAnnotation { | |
resolve.visit_expr(invariant) | ||
} | ||
|
||
fn check_calculus(&self, calculus: &Calculus, direction: Direction) -> Result<(), ()> { | ||
fn is_calculus_allowed(&self, calculus: &Calculus, direction: Direction) -> bool { | ||
if direction | ||
!= match calculus.calculus_type { | ||
CalculusType::WP | CalculusType::ERT => Direction::Up, | ||
CalculusType::WLP => Direction::Down, | ||
CalculusType::Wp | CalculusType::Ert => Direction::Up, | ||
CalculusType::Wlp => Direction::Down, | ||
} | ||
{ | ||
return Err(()); | ||
return false; | ||
} | ||
|
||
Ok(()) | ||
true | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should be an empty line after an |
||
fn transform( | ||
&self, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,14 +92,8 @@ impl Encoding for OSTAnnotation { | |
resolve.visit_expr(post) | ||
} | ||
|
||
fn check_calculus(&self, calculus: &Calculus, direction: Direction) -> Result<(), ()> { | ||
if let CalculusType::WP = calculus.calculus_type { | ||
if direction == Direction::Down { | ||
return Ok(()); | ||
} | ||
} | ||
|
||
Err(()) | ||
fn is_calculus_allowed(&self, calculus: &Calculus, direction: Direction) -> bool { | ||
matches!(calculus.calculus_type, CalculusType::Wp) && direction == Direction::Down | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a side note, if you derive |
||
} | ||
|
||
fn transform( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,18 +82,14 @@ impl Encoding for UnrollAnnotation { | |
resolve.visit_expr(invariant) | ||
} | ||
|
||
fn check_calculus(&self, calculus: &Calculus, direction: Direction) -> Result<(), ()> { | ||
if direction | ||
!= match calculus.calculus_type { | ||
CalculusType::WP | CalculusType::ERT => Direction::Up, | ||
CalculusType::WLP => Direction::Down, | ||
} | ||
{ | ||
return Err(()); | ||
} | ||
|
||
Ok(()) | ||
fn is_calculus_allowed(&self, calculus: &Calculus, direction: Direction) -> bool { | ||
matches!( | ||
(&calculus.calculus_type, direction), | ||
(CalculusType::Wp | CalculusType::Ert, Direction::Up) | ||
| (CalculusType::Wlp, Direction::Down) | ||
) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Empty line after |
||
|
||
fn transform( | ||
&self, | ||
tcx: &TyCtx, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic here seems a bit convoluted. Why not simply immediately return
direction == match calculus.calculus_type { CalculusType::Wp | CalculusType::Ert => Direction::Up, CalculusType::Wlp => Direction::Down, }
?