File: brute_force_why.v

package info (click to toggle)
why 2.26%2Bdfsg-2%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 19,796 kB
  • ctags: 19,175
  • sloc: ml: 115,078; java: 9,253; ansic: 4,757; makefile: 1,350; sh: 485; lisp: 3
file content (195 lines) | stat: -rw-r--r-- 5,647 bytes parent folder | download | duplicates (4)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
(* This file was originally generated by why.
   It can be modified; only the generated parts will be overwritten. *)

Require Import Why.
Require Export Match.

(*Why*) Parameter OUTPUT : forall (j: Z), unit.

(* Why obligation from file "brute_force.c", characters 369-373 *)
Lemma BF_po_1 : 
  forall (m: Z),
  forall (n: Z),
  forall (x: (array Z)),
  forall (y: (array Z)),
  forall (Pre10: (array_length x) = m /\ (array_length y) = n /\ 0 <= n /\
                 0 <= m),
  forall (j1: Z),
  forall (Post1: j1 = 0),
  forall (Variant1: Z),
  forall (j2: Z),
  forall (Pre9: Variant1 = (n - m + 1 - j2)),
  forall (Pre8: 0 <= j2),
  forall (Test8: j2 <= (n - m)),
  forall (i2: Z),
  forall (Post2: i2 = 0),
  forall (Variant3: Z),
  forall (i3: Z),
  forall (Pre6: Variant3 = (m - i3)),
  forall (Pre5: (0 <= i3 /\ i3 <= m) /\ (match_ x 0 y j2 i3)),
  forall (Test5: true = true),
  forall (Test4: i3 < m),
  0 <= i3 /\ i3 < (array_length x).
Proof.
auto with *.
Qed.

(* Why obligation from file "brute_force.c", characters 377-385 *)
Lemma BF_po_2 : 
  forall (m: Z),
  forall (n: Z),
  forall (x: (array Z)),
  forall (y: (array Z)),
  forall (Pre10: (array_length x) = m /\ (array_length y) = n /\ 0 <= n /\
                 0 <= m),
  forall (j1: Z),
  forall (Post1: j1 = 0),
  forall (Variant1: Z),
  forall (j2: Z),
  forall (Pre9: Variant1 = (n - m + 1 - j2)),
  forall (Pre8: 0 <= j2),
  forall (Test8: j2 <= (n - m)),
  forall (i2: Z),
  forall (Post2: i2 = 0),
  forall (Variant3: Z),
  forall (i3: Z),
  forall (Pre6: Variant3 = (m - i3)),
  forall (Pre5: (0 <= i3 /\ i3 <= m) /\ (match_ x 0 y j2 i3)),
  forall (Test5: true = true),
  forall (Test4: i3 < m),
  forall (Pre4: 0 <= i3 /\ i3 < (array_length x)),
  forall (c_aux_1: Z),
  forall (Post4: c_aux_1 = (access x i3)),
  0 <= (i3 + j2) /\ (i3 + j2) < (array_length y).
Proof.
auto with *.
Qed.

(* Why obligation from file "brute_force.c", characters 369-385 *)
Lemma BF_po_3 : 
  forall (m: Z),
  forall (n: Z),
  forall (x: (array Z)),
  forall (y: (array Z)),
  forall (Pre10: (array_length x) = m /\ (array_length y) = n /\ 0 <= n /\
                 0 <= m),
  forall (j1: Z),
  forall (Post1: j1 = 0),
  forall (Variant1: Z),
  forall (j2: Z),
  forall (Pre9: Variant1 = (n - m + 1 - j2)),
  forall (Pre8: 0 <= j2),
  forall (Test8: j2 <= (n - m)),
  forall (i2: Z),
  forall (Post2: i2 = 0),
  forall (Variant3: Z),
  forall (i3: Z),
  forall (Pre6: Variant3 = (m - i3)),
  forall (Pre5: (0 <= i3 /\ i3 <= m) /\ (match_ x 0 y j2 i3)),
  forall (Test5: true = true),
  forall (Test4: i3 < m),
  forall (Pre4: 0 <= i3 /\ i3 < (array_length x)),
  forall (c_aux_1: Z),
  forall (Post4: c_aux_1 = (access x i3)),
  forall (Pre3: 0 <= (i3 + j2) /\ (i3 + j2) < (array_length y)),
  forall (c_aux_2: Z),
  forall (Post3: c_aux_2 = (access y (i3 + j2))),
  forall (result4: bool),
  forall (Post25: (if result4 then c_aux_1 = c_aux_2 else c_aux_1 <> c_aux_2)),
  (if result4
   then (forall (i:Z),
         (i = (i3 + 1) -> ((0 <= i /\ i <= m) /\ (match_ x 0 y j2 i)) /\
          (Zwf 0 (m - i) (m - i3))))
   else ((i3 >= m ->
          (forall (j:Z),
           (j = (j2 + 1) -> 0 <= j /\
            (Zwf 0 (n - m + 1 - j) (n - m + 1 - j2)))) /\
          (match_ x 0 y j2 (array_length x)))) /\
   ((i3 < m ->
     (forall (j:Z),
      (j = (j2 + 1) -> 0 <= j /\ (Zwf 0 (n - m + 1 - j) (n - m + 1 - j2))))))).
Proof.
simple_destruct result4; intuition.
subst i.
apply match_right_extension; auto with *.
subst c_aux_1 c_aux_2; ring (0 + i3)%Z; ring (j2 + i3)%Z; assumption.
assert (i3 = array_length x).
 omega.
 subst i3; assumption.
Qed.

(* Why obligation from file "brute_force.c", characters 360-385 *)
Lemma BF_po_4 : 
  forall (m: Z),
  forall (n: Z),
  forall (x: (array Z)),
  forall (y: (array Z)),
  forall (Pre10: (array_length x) = m /\ (array_length y) = n /\ 0 <= n /\
                 0 <= m),
  forall (j1: Z),
  forall (Post1: j1 = 0),
  forall (Variant1: Z),
  forall (j2: Z),
  forall (Pre9: Variant1 = (n - m + 1 - j2)),
  forall (Pre8: 0 <= j2),
  forall (Test8: j2 <= (n - m)),
  forall (i2: Z),
  forall (Post2: i2 = 0),
  forall (Variant3: Z),
  forall (i3: Z),
  forall (Pre6: Variant3 = (m - i3)),
  forall (Pre5: (0 <= i3 /\ i3 <= m) /\ (match_ x 0 y j2 i3)),
  forall (Test5: true = true),
  forall (Test3: i3 >= m),
  ((i3 >= m ->
    (forall (j:Z),
     (j = (j2 + 1) -> 0 <= j /\ (Zwf 0 (n - m + 1 - j) (n - m + 1 - j2)))) /\
    (match_ x 0 y j2 (array_length x)))) /\
  ((i3 < m ->
    (forall (j:Z),
     (j = (j2 + 1) -> 0 <= j /\ (Zwf 0 (n - m + 1 - j) (n - m + 1 - j2)))))).
Proof.
intuition.
assert (i3 = array_length x).
 omega.
 subst i3; assumption.
Qed.

(* Why obligation from file "brute_force.c", characters 412-445 *)
Lemma BF_po_5 : 
  forall (m: Z),
  forall (n: Z),
  forall (x: (array Z)),
  forall (y: (array Z)),
  forall (Pre10: (array_length x) = m /\ (array_length y) = n /\ 0 <= n /\
                 0 <= m),
  forall (j1: Z),
  forall (Post1: j1 = 0),
  forall (Variant1: Z),
  forall (j2: Z),
  forall (Pre9: Variant1 = (n - m + 1 - j2)),
  forall (Pre8: 0 <= j2),
  forall (Test8: j2 <= (n - m)),
  forall (i2: Z),
  forall (Post2: i2 = 0),
  (0 <= i2 /\ i2 <= m) /\ (match_ x 0 y j2 i2).
Proof.
intuition.
subst i2; apply match_empty; auto with *.
Qed.

(* Why obligation from file "brute_force.c", characters 308-314 *)
Lemma BF_po_6 : 
  forall (m: Z),
  forall (n: Z),
  forall (x: (array Z)),
  forall (y: (array Z)),
  forall (Pre10: (array_length x) = m /\ (array_length y) = n /\ 0 <= n /\
                 0 <= m),
  forall (j1: Z),
  forall (Post1: j1 = 0),
  0 <= j1.
Proof.
intuition.
Qed.