-
Notifications
You must be signed in to change notification settings - Fork 11
Implement soundness checking & corresponding diagnostics in lsp #103
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
Open
umutdural
wants to merge
4
commits into
moves-rwth:main
Choose a base branch
from
umutdural:75-tracking-soundness-for-proofs-and-refutations
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
aa35777
Implement soundness checking & corresponding diagnostics in lsp
umutdural fec92f2
Refactor SoundnessBlame and ApproximationKind
umutdural 1f30b0d
Refactor ApproximationList, correct and simplify ApproximationKind an…
umutdural 96c2220
clean up doc comments
umutdural File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -12,8 +12,7 @@ use crate::{ | |
| resolve::{Resolve, ResolveError}, | ||
| tycheck::{Tycheck, TycheckError}, | ||
| }, | ||
| proof_rules::calculus::RecursiveProcBlame, | ||
| proof_rules::Encoding, | ||
| proof_rules::{calculus::RecursiveProcBlame, Encoding, FixpointSemanticsKind}, | ||
| slicing::selection::SliceAnnotation, | ||
| tyctx::TyCtx, | ||
| }; | ||
|
|
@@ -54,12 +53,6 @@ pub enum AnnotationUnsoundnessError { | |
| span: Span, | ||
| enc_name: Ident, | ||
| }, | ||
| CalculusEncodingMismatch { | ||
| direction: Direction, | ||
| span: Span, | ||
| calculus_name: Ident, | ||
| enc_name: Ident, | ||
| }, | ||
| CalculusCallMismatch { | ||
| span: Span, | ||
| context_calculus: Ident, | ||
|
|
@@ -125,16 +118,6 @@ impl AnnotationUnsoundnessError { | |
| "There must not be any statements after this annotated statement (and the annotated statement must not be nested in a block).", | ||
| )) | ||
| } | ||
| AnnotationUnsoundnessError::CalculusEncodingMismatch{direction, span, calculus_name, enc_name } => { | ||
|
Collaborator
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. Do we still have a corresponding test now for this case? |
||
| Diagnostic::new(ReportKind::Error, span) | ||
| .with_message(format!( | ||
| "In {}s, the `{}` calculus does not support the `{}` proof rule.", | ||
| direction.prefix("proc"), calculus_name.name, enc_name.name | ||
| )) | ||
| .with_label(Label::new(span).with_message( | ||
| "The calculus, proof rule, and direction are incompatible.", | ||
| )) | ||
| } | ||
| AnnotationUnsoundnessError::CalculusCallMismatch{span,context_calculus,call_calculus} => { | ||
| Diagnostic::new(ReportKind::Error, span) | ||
| .with_message(format!( | ||
|
|
@@ -175,13 +158,29 @@ pub struct Calculus { | |
| pub calculus_type: CalculusType, | ||
| } | ||
|
|
||
| impl std::fmt::Display for Calculus { | ||
| fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
| write!(f, "{}", self.name) | ||
| } | ||
| } | ||
|
|
||
| #[derive(Debug, Clone, Copy, PartialEq)] | ||
| pub enum CalculusType { | ||
| Wp, | ||
| Wlp, | ||
| Ert, | ||
| } | ||
|
|
||
| impl std::fmt::Display for CalculusType { | ||
| fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
| match self { | ||
| CalculusType::Wp => write!(f, "wp"), | ||
| CalculusType::Wlp => write!(f, "wlp"), | ||
| CalculusType::Ert => write!(f, "ert"), | ||
| } | ||
| } | ||
| } | ||
|
|
||
| impl CalculusType { | ||
| pub fn is_induction_allowed(&self, direction: Direction) -> bool { | ||
| matches!( | ||
|
|
@@ -191,6 +190,13 @@ impl CalculusType { | |
| | (CalculusType::Ert, Direction::Up) | ||
| ) | ||
| } | ||
|
|
||
| pub fn to_fixed_point_semantics_kind(self) -> FixpointSemanticsKind { | ||
| match self { | ||
| CalculusType::Wp | CalculusType::Ert => FixpointSemanticsKind::LeastFixedPoint, | ||
| CalculusType::Wlp => FixpointSemanticsKind::GreatestFixedPoint, | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #[derive(Debug, Clone)] | ||
|
|
||
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
How does this map work? Is it really ever not a bug if an item has no associated
SoundnessBlame?