File tree Expand file tree Collapse file tree 5 files changed +63
-6
lines changed
prusti-tests/tests/verify Expand file tree Collapse file tree 5 files changed +63
-6
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,15 @@ fn vir_statement_to_fol_statements(
32
32
33
33
vec ! [ FolStatement :: Assume ( eq) ]
34
34
}
35
+ Statement :: Conditional ( cond) => {
36
+ if !( cond. then_branch . is_empty ( ) && cond. else_branch . is_empty ( ) ) {
37
+ log:: warn!(
38
+ "Conditional statement with non-empty branches, guard: {:?}" ,
39
+ cond. guard
40
+ ) ;
41
+ }
42
+ vec ! [ ]
43
+ }
35
44
Statement :: MethodCall ( method_call) => {
36
45
let method_decl = known_methods
37
46
. get ( & method_call. method_name )
Original file line number Diff line number Diff line change @@ -357,6 +357,8 @@ impl SMTTranslatable for MethodDecl {
357
357
// we assume these to be correct by default and collect their signatures
358
358
if self . body . is_none ( ) {
359
359
smt. methods . insert ( self . name . clone ( ) , self . clone ( ) ) ;
360
+ } else {
361
+ unimplemented ! ( "Method bodies are not yet supported" ) ;
360
362
}
361
363
}
362
364
}
@@ -430,11 +432,7 @@ impl SMTTranslatable for Expression {
430
432
ConstantValue :: Int ( i64) => i64. to_string ( ) ,
431
433
ConstantValue :: BigInt ( s) => s. clone ( ) ,
432
434
} ,
433
- Expression :: MagicWand ( magic_wand) => format ! (
434
- "(=> {} {})" , // TODO: is this correct?
435
- magic_wand. left. to_smt( ) ,
436
- magic_wand. right. to_smt( )
437
- ) ,
435
+ Expression :: MagicWand ( magic_wand) => unimplemented ! ( "Magic wands" ) ,
438
436
Expression :: PredicateAccessPredicate ( _access) => {
439
437
// TODO: access predicates for predicates
440
438
warn ! ( "PredicateAccessPredicate not supported" ) ;
Original file line number Diff line number Diff line change 1
1
use crate :: dump_viper_program;
2
+ use backend_common:: VerificationResult ;
2
3
use prusti_common:: {
3
4
config,
4
5
vir:: { LoweringContext , ToViper } ,
@@ -38,7 +39,7 @@ impl<'a> Backend<'a> {
38
39
} )
39
40
}
40
41
Backend :: Lithium ( lithium) => {
41
- Stopwatch :: start ( "prusti-server" , "verifierication " ) ;
42
+ Stopwatch :: start ( "prusti-server" , "vir verification " ) ;
42
43
lithium. verify ( program)
43
44
}
44
45
}
Original file line number Diff line number Diff line change
1
+ // compile-flags: -Pviper_backend=Lithium
2
+
3
+ use prusti_contracts:: * ;
4
+
5
+ const N : i32 = 10 ;
6
+
7
+ #[ requires( i <= N ) ]
8
+ #[ ensures( result == N ) ]
9
+ fn wrong_invariant ( i : i32 ) -> i32 {
10
+ let mut ret = i;
11
+ while ret < N {
12
+ body_invariant ! ( ret == i) ; //~ ERROR loop invariant might not hold
13
+ ret += 1 ;
14
+ }
15
+ ret
16
+ }
17
+
18
+ #[ requires( i <= N ) ]
19
+ #[ ensures( result == N ) ] //~ ERROR might not hold
20
+ fn weak_invariant ( i : i32 ) -> i32 {
21
+ let mut ret = i;
22
+ while ret < N {
23
+ body_invariant ! ( ret <= N ) ;
24
+ ret += 1 ;
25
+ }
26
+ ret
27
+ }
28
+
29
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ // compile-flags: -Pviper_backend=Lithium
2
+
3
+ use prusti_contracts:: * ;
4
+
5
+ const N : i32 = 10 ;
6
+
7
+ #[ requires( i <= N ) ]
8
+ #[ ensures( result == N ) ]
9
+ fn test ( i : i32 ) -> i32 {
10
+ let mut ret = i;
11
+ while ret < N {
12
+ body_invariant ! ( ret < N ) ;
13
+ ret += 1 ;
14
+ }
15
+ ret
16
+ }
17
+
18
+ fn main ( ) {
19
+ assert ! ( test( 3 ) == N ) ;
20
+ }
You can’t perform that action at this time.
0 commit comments