File size: 6,025 Bytes
33e433e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99bb81c
5abb449
33e433e
 
 
 
 
 
 
 
 
 
99bb81c
33e433e
 
 
99bb81c
 
 
33e433e
 
 
99bb81c
33e433e
 
 
99bb81c
33e433e
 
 
 
 
99bb81c
33e433e
99bb81c
33e433e
 
 
5abb449
 
 
 
1f7bf00
5abb449
 
 
 
 
 
 
33e433e
 
5abb449
 
 
 
33e433e
 
5abb449
 
 
33e433e
47b3ccd
 
 
 
 
 
 
1c34a5c
47b3ccd
99bb81c
5abb449
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: cdla-permissive-2.0
task_categories:
- text-generation
- text2text-generation
- other
tags:
- code
- fstar
- popai
pretty_name: PoPAI-FStarDataSet-V2
size_categories:
- 10K<n<100K
language:
- code
- fst
---

This dataset is the Version 2.0 of [`microsoft/FStarDataSet`](https://huggingface.co/datasets/microsoft/FStarDataSet).


## Primary-Objective
This dataset's primary objective is to train and evaluate Proof-oriented Programming with AI (PoPAI, in short). Given a specification of a program and proof in F*, 
the objective of a AI model is to synthesize the implemantation (see [below](#usage) for details about the usage of this dataset, including the input and output). 

## Data Format
Each of the examples in this dataset are organized as dictionaries with the following schema
```json
{
    "file_name": <str: Name of the file>,
    "name": <str: name of the example, can be used to uniquely identify the example>,
    "original_source_type": <str: actual source type, to be used for type checking>,
    "source_type": <str: modified source type, to be used to formulate prompt>,
    "source_definition": <str: target definition>,
    "source": <dict: contains metadata about the source of this example, including project_name, git url, git sha, etc.>,
    "source_range": <dict: metadata containing start and end lines and columns of this definition in the source file>,
    "file_context": <str: extracted file context upto the point of current definition>, 
    "dependencies": <dict: build dependencies for this file>,
    "opens_and_abbrevs": <list[dict]: List of opened modules and abbreviated modules in the file, necessary for evaluation.>,
    "vconfig": <dict: SMT solver flags for this definition>,
    "interleaved": <bool: whether this definition is interleaved from the interface file>,
    "verbose_type": <str: the verbose type of this definition as resolved by the type checker>,
    "effect": <str: effect>,
    "effect_flags": <list[str]: any effect flags>,
    "mutual_with": <list: if this definition is mutually recursive with another, list of those names>,
    "ideal_premises": <list[str]: Other definitions that are used in the ground truth definition>,
    "proof_features": <list[str]>,
    "is_simple_lemma": <bool/null>,
    "is_div": <bool: if this definition has the divergent effect>,
    "is_proof": <bool>,
    "is_simply_typed": <bool>,
    "is_type": <bool/null>,
    "partial_definition": <str>,
    "completed_definiton": <str>,
    "isa_cross_project_example": <bool: if this example belongs to the cross-project evaluation set>
}

```

# Usage
To use this dataset with [`datasets`](https://pypi.org/project/datasets/), 
```python
from datasets import load_dataset

data = load_dataset("microsoft/FStarDataSet-V2")
train_data = data["train"]
eval_data = data["validation"]
test_data = data["test"]

intra_project_test = test_data.filter(lambda x: x["isa_cross_project_example"] == False)
cross_project_test = test_data.filter(lambda x: x["isa_cross_project_example"] == True)
```

## Input
The primary input for generating F* definition is **`source_type`**. 
All other information in an example may be used directly or to derive an input except 
**`source_definition`**, **`ideal_premises`**, and **`completed_definiton`**.


## Output
The primary output is **`source_definition`**, which is the ground truth definition, that can be evaluated with the [proof checker](#evaluation-on-this-dataset). 
The **`completed_definiton`** may be used as ground truth when a model is used as a text completion setting (though the evaluator does not support evaluation in this setting). 
In addition, **`ideal_premises`** may be used for evaluating premise selection models. 

# Evaluation on this dataset
Generated F* definitions should be evaluated the proof checker tool from 
[https://github.com/FStarLang/fstar_dataset/releases/tag/eval-v2.0](https://github.com/FStarLang/fstar_dataset/releases/tag/eval-v2.0). 
Download the source code and the `helpers.zip` file from the release. 
  
## Troubleshooting
The attached binaries in the evaluator (i.e., `fstar.exe` and `z3`) are built on 
**`Ubuntu 20.04.6 LTS (GNU/Linux 5.4.0-189-generic x86_64)`**,  **`gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2)`**,  **`OCaml 4.12.0`**. 
If any of the binaries do not work properly, build F* from [this commit (10183ea187da8e8c426b799df6c825e24c0767d3)](https://github.com/FStarLang/FStar/commit/10183ea187da8e8c426b799df6c825e24c0767d3) 
from the [F* repository](https://github.com/FStarLang/FStar), using the [installation guide](https://github.com/FStarLang/FStar/blob/master/INSTALL.md).

# Data Source
In addition to the eight projects in `microsoft/FStarDataSet`, data from four more projects are included in this version. 
1. [Starmada](https://github.com/microsoft/Armada):  a framework for doing proofs by stepwise refinement for concurrent programs in a weak memory model. Starmada is an experimental version of Armada implemented in F⋆, relying on various advanced features of F⋆’s dependent type system for more generic and abstract proofs.
2. [Zeta](https://github.com/project-everest/zeta): a high performance, concurrent monitor for stateful services proven correct in F⋆ and its Steel concurrent separation logic
3. [Dice-star](https://github.com/verified-HRoT/dice-star):  a verified implementation of the DICE measured boot protocol for embedded devices
4. [Noise-star](https://github.com/Inria-Prosecco/noise-star): a verified compiler for implementations of Noise protocols, a family of key-exchange protocols

# Limitations
**TDB**

# Citation
```
@inproceedings{chakraborty2024towards,
  title={Towards Neural Synthesis for SMT-Assisted Proof-Oriented Programming},
  author={Chakraborty, Saikat and Ebner, Gabriel and Bhat, Siddharth and Fakhoury, Sarah and Fatima, Sakina and Lahiri, Shuvendu and Swamy, Nikhil},
  booktitle={Proceedings of the IEEE/ACM 47th International Conference on Software Engineering (To Appear)},
  pages={1--12},
  year={2025}
}
```