Datasets:
Download experiments/t2/examples/INDEX.md from PV-SJTU/PV-Bench: direct link, hf CLI and curl.
- Browser
- Download file 2.44 kB
-
https://huggingface.co/datasets/PV-SJTU/PV-Bench/resolve/main/experiments/t2/examples/INDEX.md
- Command line
-
hf download hf://datasets/PV-SJTU/PV-Bench/experiments/t2/examples/INDEX.md
-
curl -L -o INDEX.md https://huggingface.co/datasets/PV-SJTU/PV-Bench/resolve/main/experiments/t2/examples/INDEX.md
T2 teaching examples — v3
Start with D02 for a direct loop (D08 for the same loop with its counter declared in the for header), R01 for a refinement loop, or R03 for named-specification connections.
These are annotated source and definition excerpts for reading. Ten are extracted from existing QCP demos and have not been rebuilt as standalone programs; D08 was written for this bundle and checked in the task image. Dependencies are limited to the selected operations; support excerpts explain their vocabulary. Use your workspace IMPORTS.md for the answer. Generated goal excerpts come from upstream artifacts (for D08, from the task image), not this run.
The examples illustrate useful annotations, not certified minimal solutions. Read only the units relevant to your program.
The extracted demo loops declare their counters before the loop (int i; ... for (i = 0; ...)) because their source programs do. Your program may write for (int i = 0; ...) instead: keep that form and put the Inv immediately before the for; the counter is in scope for it (D08). Never change executable code to match a demo.
- D01 (direct): Open field ownership and preserve entry values when swapping a pair.
- D02 (direct): Relate the accumulator to a processed prefix; retain bounds and array ownership.
- D03 (direct): Grow an initialized output prefix, with pointwise correspondence and an uninitialized suffix.
- D04 (direct): Relate exchanged prefixes and unchanged suffixes of two disjoint arrays.
- D05 (direct): Keep an upper bound and an attained witness; a bound alone is insufficient.
- D06 (direct): Name an existential returned by a helper with Given and use that witness later.
- D07 (direct): Represent a FIFO queue by two lists and reconcile resource states after a branch.
- D08 (direct): Annotate a
forthat declares its counter and has an unbraced body; the code itself stays untouched. - R01 (safeExec): Carry safeExec for the remaining split and connect each abstract step to concrete list resources.
- R02 (safeExec): Carry the same continuation through three merge loops and shrinking array segments.
- R03 (safeExec): Connect the public prefix-table property to a low-level refinement spec and instantiate a bind helper call.