summaryrefslogtreecommitdiff
path: root/Test/inline/codeexpr.bpl
blob: 0b4ebeb6503e11e5d1c6a5771b727a5b6edf9fa9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// RUN: %boogie "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
var g: bool;

procedure {:inline 1} bar() returns (l: bool) 
{
  l := g;
}

procedure {:inline 1} baz() returns (l: bool)
{
  call l := bar();
}

procedure A1() 
modifies g;
{
    g := true;
    assert |{ var l: bool; A: call l := bar(); return l; }|;
    assert (exists p: bool :: |{ var l: bool; A: call l := bar(); return l; }|);
    assert (forall p: bool :: |{ var l: bool; A: call l := bar(); return l; }|);
}

procedure A2() 
{
    assert |{ var l: bool; A: assume g; call l := bar(); return l; }|;
    assert g ==> |{ var l: bool; A: call l := bar(); return l; }|;
    assert (exists p: bool :: g ==> |{ var l: bool; A: call l := bar(); return l; }|);
    assert (forall p: bool :: g ==> |{ var l: bool; A: call l := bar(); return l; }|);
}

procedure A3() 
{
    assume |{ var l: bool; A: call l := bar(); return l; }|;
    assert |{ var l: bool; A: call l := bar(); return l; }|;
}

procedure A4()
modifies g;
{
    g := true;
    assert |{ var l: bool; A: call l := bar(); return !l; }|;
}

procedure A5() 
modifies g;
{
    var m: bool;

    g := true;
    m := |{ var l: bool; A: call l := bar(); return l; }|;
    assert m;
}

procedure A6() 
modifies g;
{
    g := true;
    assert |{ var l: bool; A: call l := baz(); return l; }|;
    assert (exists p: bool :: |{ var l: bool; A: call l := baz(); return l; }|);
    assert (forall p: bool :: |{ var l: bool; A: call l := baz(); return l; }|);
}