PV-Bench / experiments /t2 /examples /D01 /annotated.c
cielseven's picture
add the experiment harnesses for t1 to t4 and t3-flat
28adce7
Raw History Blame Contribute Delete
459 Bytes
/*@ Import Coq Require Import SimpleC.EE.QCP_demos_tutorial.swap_simple1_lib */
/*@ Extern Coq (store_int_pair : Z -> Z -> Z -> Assertion) */
struct int_pair {
int a;
int b;
};
void swap_int_pair(struct int_pair *p)
/*@ With x y
Require store_int_pair(p, x, y)
Ensure store_int_pair(p, y, x)
*/
{
/*@ Assert
p == p@pre && store(&(p->a), x) * store(&(p->b), y)
*/
int temp = p->a;
p->a = p->b;
p->b = temp;
}