|
38 | 38 | \schemaVar \program Variable #heapBefore_LOOP; |
39 | 39 | \schemaVar \program Variable #savedHeapBefore_LOOP; |
40 | 40 | \schemaVar \program Variable #permissionsBefore_LOOP; |
| 41 | + \schemaVar \program [list] Statement #localVarDeclsBefore_LOOP; |
| 42 | + \schemaVar \update #updateBefore_LOOP; |
| 43 | + \schemaVar \update #updateFrame_LOOP; |
41 | 44 |
|
42 | 45 | \find((\modality{#dia} {.. while (#nse) #body ... }\endmodality (post))) |
43 | 46 |
|
|
46 | 49 | \varcond(\new(#heapBefore_LOOP, Heap)) |
47 | 50 | \varcond(\new(#savedHeapBefore_LOOP, Heap)) |
48 | 51 | \varcond(\new(#permissionsBefore_LOOP, Heap)) |
| 52 | + \varcond(\newLocalVars(#localVarDeclsBefore_LOOP, #updateBefore_LOOP, #updateFrame_LOOP, #body)) |
49 | 53 |
|
50 | 54 | \varcond(\storeTermIn(loopFormula, \modality{#dia}{ while (#nse) #body }\endmodality (post))) |
51 | 55 | // Implementation Note (DS, 2019-04-11): We have to separately store the active statement |
|
71 | 75 | #typeof(#savedHeapBefore_LOOP) #savedHeapBefore_LOOP; |
72 | 76 | #typeof(#permissionsBefore_LOOP) #permissionsBefore_LOOP; |
73 | 77 | #typeof(#variant) #variant; |
| 78 | + #localVarDeclsBefore_LOOP |
74 | 79 | }\endmodality ( |
75 | | - {#createBeforeLoopUpdate(loopFormula, #heapBefore_LOOP, #savedHeapBefore_LOOP, #permissionsBefore_LOOP) |
| 80 | + {#createBeforeLoopUpdate( |
| 81 | + loopFormula, |
| 82 | + #heapBefore_LOOP, |
| 83 | + #savedHeapBefore_LOOP, |
| 84 | + #permissionsBefore_LOOP) |
| 85 | + || #updateBefore_LOOP |
76 | 86 | || #createLocalAnonUpdate(loopFormula) |
77 | 87 | || #createHeapAnonUpdate(loopFormula, anon_heap_LOOP, anon_savedHeap_LOOP, anon_permissions_LOOP)} |
78 | 88 | {#variant := variantTerm} |
|
93 | 103 | (#x<<loopScopeIndex>> = TRUE -> post) & |
94 | 104 | (#x<<loopScopeIndex>> = FALSE -> |
95 | 105 | inv |
96 | | - & #createFrameCond(loopFormula, #heapBefore_LOOP, #savedHeapBefore_LOOP, #permissionsBefore_LOOP) |
| 106 | + & {#updateFrame_LOOP} #createFrameCond( |
| 107 | + loopFormula, |
| 108 | + #heapBefore_LOOP, |
| 109 | + #savedHeapBefore_LOOP, |
| 110 | + #permissionsBefore_LOOP) |
97 | 111 | & prec(variantTerm, #variant)) |
98 | 112 | ))) |
99 | 113 | ) |
|
117 | 131 | \schemaVar \program Variable #heapBefore_LOOP; |
118 | 132 | \schemaVar \program Variable #savedHeapBefore_LOOP; |
119 | 133 | \schemaVar \program Variable #permissionsBefore_LOOP; |
| 134 | + \schemaVar \program [list] Statement #localVarDeclsBefore_LOOP; |
| 135 | + \schemaVar \update #updateBefore_LOOP; |
| 136 | + \schemaVar \update #updateFrame_LOOP; |
120 | 137 |
|
121 | 138 | \find((\modality{#box} {.. while (#nse) #body ... }\endmodality (post))) |
122 | 139 |
|
123 | 140 | \varcond(\new(#x, boolean)) |
124 | 141 | \varcond(\new(#heapBefore_LOOP, Heap)) |
125 | 142 | \varcond(\new(#savedHeapBefore_LOOP, Heap)) |
126 | 143 | \varcond(\new(#permissionsBefore_LOOP, Heap)) |
| 144 | + \varcond(\newLocalVars(#localVarDeclsBefore_LOOP, #updateBefore_LOOP, #updateFrame_LOOP, #body)) |
127 | 145 |
|
128 | 146 | \varcond(\storeTermIn(loopFormula, \modality{#box}{ while (#nse) #body }\endmodality (post))) |
129 | 147 | \varcond(\storeStmtIn(#loopStmt, \modality{#box}{ while (#nse) #body }\endmodality (post))) |
|
140 | 158 | #typeof(#heapBefore_LOOP) #heapBefore_LOOP; |
141 | 159 | #typeof(#savedHeapBefore_LOOP) #savedHeapBefore_LOOP; |
142 | 160 | #typeof(#permissionsBefore_LOOP) #permissionsBefore_LOOP; |
| 161 | + #localVarDeclsBefore_LOOP |
143 | 162 | } |
144 | 163 | \endmodality ( |
145 | 164 | {#createBeforeLoopUpdate(loopFormula, #heapBefore_LOOP, #savedHeapBefore_LOOP, #permissionsBefore_LOOP) |
146 | 165 | || #createLocalAnonUpdate(loopFormula) |
| 166 | + || #updateBefore_LOOP |
147 | 167 | || #createHeapAnonUpdate(loopFormula, anon_heap_LOOP, anon_savedHeap_LOOP, anon_permissions_LOOP)} |
148 | 168 | (inv & freeInv -> |
149 | 169 | (\modality{#box}{ |
|
162 | 182 | (#x<<loopScopeIndex>> = TRUE -> post) & |
163 | 183 | (#x<<loopScopeIndex>> = FALSE -> |
164 | 184 | inv |
165 | | - & #createFrameCond(loopFormula, #heapBefore_LOOP, #savedHeapBefore_LOOP, #permissionsBefore_LOOP)) |
| 185 | + & {#updateFrame_LOOP} #createFrameCond( |
| 186 | + loopFormula, |
| 187 | + #heapBefore_LOOP, |
| 188 | + #savedHeapBefore_LOOP, |
| 189 | + #permissionsBefore_LOOP)) |
166 | 190 | ))) |
167 | 191 | ) |
168 | 192 | ) |
|
221 | 245 | \schemaVar \program Variable #heapBefore_LOOP; |
222 | 246 | \schemaVar \program Variable #savedHeapBefore_LOOP; |
223 | 247 | \schemaVar \program Variable #permissionsBefore_LOOP; |
| 248 | + \schemaVar \program [list] Statement #localVarDeclsBefore_LOOP; |
| 249 | + \schemaVar \update #updateBefore_LOOP; |
| 250 | + \schemaVar \update #updateFrame_LOOP; |
224 | 251 |
|
225 | 252 | \find((\modality{#dia} {.. while (#nse) #body ... }\endmodality (post))) |
226 | 253 |
|
|
229 | 256 | \varcond(\new(#heapBefore_LOOP, Heap)) |
230 | 257 | \varcond(\new(#savedHeapBefore_LOOP, Heap)) |
231 | 258 | \varcond(\new(#permissionsBefore_LOOP, Heap)) |
| 259 | + \varcond(\newLocalVars(#localVarDeclsBefore_LOOP, #updateBefore_LOOP, #updateFrame_LOOP, #body)) |
232 | 260 |
|
233 | 261 | \varcond(\storeTermIn(loopFormula, \modality{#dia}{ while (#nse) #body }\endmodality (post))) |
234 | 262 | \varcond(\storeStmtIn(#loopStmt, \modality{#dia}{ while (#nse) #body }\endmodality (post))) |
|
247 | 275 | #typeof(#savedHeapBefore_LOOP) #savedHeapBefore_LOOP; |
248 | 276 | #typeof(#permissionsBefore_LOOP) #permissionsBefore_LOOP; |
249 | 277 | #typeof(#variant) #variant; |
| 278 | + #localVarDeclsBefore_LOOP |
250 | 279 | } |
251 | 280 | \endmodality ( |
252 | 281 | {#createBeforeLoopUpdate(loopFormula, #heapBefore_LOOP, #savedHeapBefore_LOOP, #permissionsBefore_LOOP) |
253 | 282 | || #createLocalAnonUpdate(loopFormula) |
| 283 | + || #updateBefore_LOOP |
254 | 284 | || #createHeapAnonUpdate(loopFormula, anon_heap_LOOP, anon_savedHeap_LOOP, anon_permissions_LOOP)} |
255 | 285 | {#variant := variantTerm} |
256 | 286 | (inv & freeInv -> |
|
269 | 299 | }\endmodality ( |
270 | 300 | #x<<loopScopeIndex>> = FALSE -> |
271 | 301 | inv |
272 | | - & #createFrameCond(loopFormula, #heapBefore_LOOP, #savedHeapBefore_LOOP, #permissionsBefore_LOOP) |
| 302 | + & {#updateFrame_LOOP} #createFrameCond( |
| 303 | + loopFormula, |
| 304 | + #heapBefore_LOOP, |
| 305 | + #savedHeapBefore_LOOP, |
| 306 | + #permissionsBefore_LOOP) |
273 | 307 | & prec(variantTerm, #variant) |
274 | 308 | ))) |
275 | 309 | ) |
|
327 | 361 | \schemaVar \program Variable #heapBefore_LOOP; |
328 | 362 | \schemaVar \program Variable #savedHeapBefore_LOOP; |
329 | 363 | \schemaVar \program Variable #permissionsBefore_LOOP; |
| 364 | + \schemaVar \program [list] Statement #localVarDeclsBefore_LOOP; |
| 365 | + \schemaVar \update #updateBefore_LOOP; |
| 366 | + \schemaVar \update #updateFrame_LOOP; |
330 | 367 |
|
331 | 368 | \find((\modality{#box} {.. while (#nse) #body ... }\endmodality (post))) |
332 | 369 |
|
333 | 370 | \varcond(\new(#x, boolean)) |
334 | 371 | \varcond(\new(#heapBefore_LOOP, Heap)) |
335 | 372 | \varcond(\new(#savedHeapBefore_LOOP, Heap)) |
336 | 373 | \varcond(\new(#permissionsBefore_LOOP, Heap)) |
| 374 | + \varcond(\newLocalVars(#localVarDeclsBefore_LOOP, #updateBefore_LOOP, #updateFrame_LOOP, #body)) |
337 | 375 |
|
338 | 376 | \varcond(\storeTermIn(loopFormula, \modality{#box}{ while (#nse) #body }\endmodality (post))) |
339 | 377 | \varcond(\storeStmtIn(#loopStmt, \modality{#box}{ while (#nse) #body }\endmodality (post))) |
|
349 | 387 | \modality{#box}{ #typeof(#heapBefore_LOOP) #heapBefore_LOOP; |
350 | 388 | #typeof(#savedHeapBefore_LOOP) #savedHeapBefore_LOOP; |
351 | 389 | #typeof(#permissionsBefore_LOOP) #permissionsBefore_LOOP; |
| 390 | + #localVarDeclsBefore_LOOP |
352 | 391 | } |
353 | 392 | \endmodality ( |
354 | 393 | {#createBeforeLoopUpdate(loopFormula, #heapBefore_LOOP, #savedHeapBefore_LOOP, #permissionsBefore_LOOP) |
355 | 394 | || #createLocalAnonUpdate(loopFormula) |
| 395 | + || #updateBefore_LOOP |
356 | 396 | || #createHeapAnonUpdate(loopFormula, anon_heap_LOOP, anon_savedHeap_LOOP, anon_permissions_LOOP)} |
357 | 397 | (inv & freeInv -> |
358 | 398 | (\modality{#box}{ |
|
370 | 410 | }\endmodality ( |
371 | 411 | #x<<loopScopeIndex>> = FALSE -> |
372 | 412 | inv |
373 | | - & #createFrameCond(loopFormula, #heapBefore_LOOP, #savedHeapBefore_LOOP, #permissionsBefore_LOOP) |
| 413 | + & {#updateFrame_LOOP} #createFrameCond( |
| 414 | + loopFormula, |
| 415 | + #heapBefore_LOOP, |
| 416 | + #savedHeapBefore_LOOP, |
| 417 | + #permissionsBefore_LOOP) |
374 | 418 | ))) |
375 | 419 | ) |
376 | 420 | ) |
|
0 commit comments