Datasets:
Download experiments/t2/examples/D01/annotated.c from PV-SJTU/PV-Bench: direct link, hf CLI and curl.
- Browser
- Download file 459 Bytes
-
https://huggingface.co/datasets/PV-SJTU/PV-Bench/resolve/main/experiments/t2/examples/D01/annotated.c
- Command line
-
hf download hf://datasets/PV-SJTU/PV-Bench/experiments/t2/examples/D01/annotated.c
-
curl -L -o annotated.c https://huggingface.co/datasets/PV-SJTU/PV-Bench/resolve/main/experiments/t2/examples/D01/annotated.c
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; | |
| } | |