minif2f isabelle
Browse filesFiles changed (2)
- README.md+50
- minif2f_isabelle.pyAdded+160
123---license: mit---1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253---license: mittags:- math- theorem-proving---## Dataset Description- **Point of Contact:** [Sean Welleck](https://wellecks.com/)# miniF2F+informal in Isabelle[MiniF2F](https://arxiv.org/abs/2109.00110) is a formal mathematics benchmark (translated across multiple formal systems) consisting ofexercise statements from olympiads (AMC, AIME, IMO) as well as high-school and undergraduate mathsclasses.This dataset contains formal statements in Isabelle, each paired with an informal statement andan informal proof as described in [Draft, Sketch, Prove [Jiang et al 2023]](https://openreview.net/forum?id=SMa9EAovKMC).This dataset is derived from the latest [facebookresearch/miniF2F commit](https://github.com/facebookresearch/miniF2F/tree/5271ddec788677c815cf818a06f368ef6498a106) as of July 3, 2023.Please see the repository for additional information.### Licensing InformationMIT### Citation InformationThis dataset contains Isabelle problem statements from the miniF2F benchmark along with informal statements and proofs.The initial version of miniF2F is described in [Zheng et al ICLR 2022](https://arxiv.org/abs/2109.00110):```@inproceedings{zheng2022miniff,title={miniF2F: a cross-system benchmark for formal Olympiad-level mathematics},author={Kunhao Zheng and Jesse Michael Han and Stanislas Polu},booktitle={International Conference on Learning Representations},year={2022},url={https://openreview.net/forum?id=9ZPegFuFTFv}}```The informal statements and proofs were curated and described in [Draft, Sketch, and Prove; Jiang et al ICLR 2023](https://openreview.net/forum?id=SMa9EAovKMC), along with significant fixes and improvements to the initial version of miniF2F:```@inproceedings{jiang2023draft,title={Draft, Sketch, and Prove: Guiding Formal Theorem Provers with Informal Proofs},author={Albert Qiaochu Jiang and Sean Welleck and Jin Peng Zhou and Timothee Lacroix and Jiacheng Liu and Wenda Li and Mateja Jamnik and Guillaume Lample and Yuhuai Wu},booktitle={The Eleventh International Conference on Learning Representations },year={2023},url={https://openreview.net/forum?id=SMa9EAovKMC}}```
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.
"""MiniF2F+Informal in Isabelle
Loading script author: Sean Welleck"""
import reimport globimport jsonimport osimport datasetsfrom pathlib import Path
_CITATION = """\@inproceedings{jiang2023draft, title={Draft, Sketch, and Prove: Guiding Formal Theorem Provers with Informal Proofs}, author={Albert Qiaochu Jiang and Sean Welleck and Jin Peng Zhou and Timothee Lacroix and Jiacheng Liu and Wenda Li and Mateja Jamnik and Guillaume Lample and Yuhuai Wu}, booktitle={The Eleventh International Conference on Learning Representations }, year={2023}, url={https://openreview.net/forum?id=SMa9EAovKMC}}
@inproceedings{zheng2022miniff, title={miniF2F: a cross-system benchmark for formal Olympiad-level mathematics}, author={Kunhao Zheng and Jesse Michael Han and Stanislas Polu}, booktitle={International Conference on Learning Representations}, year={2022}, url={https://openreview.net/forum?id=9ZPegFuFTFv}}"""
_DESCRIPTION = """\MiniF2F is a formal mathematics benchmark (translated across multiple formal systems) consisting of exercise statements from olympiads (AMC, AIME, IMO) as well as high-school and undergraduate maths classes.
This dataset contains formal statements in Isabelle. Each statement is paired with an informal statement and an informal proof, as described in Draft, Sketch, Prove [Jiang et al 2023].
The problems in this dataset use the most recent facebookresearch/miniF2F commit on July 3, 2023. """
_HOMEPAGE = "https://github.com/facebookresearch/miniF2F"_LICENSE = "MIT"
_MINIF2F_COMMIT = '5271ddec788677c815cf818a06f368ef6498a106'_URLS = { "minif2f_repo": "https://github.com/facebookresearch/miniF2F/archive/%s.zip" % _MINIF2F_COMMIT}
_ISABELLEDIR = 'miniF2F-%s/isabelle' % _MINIF2F_COMMIT_INFORMALDIR = 'miniF2F-%s/informal' % _MINIF2F_COMMIT
_NAMES = [ 'miniF2F-isabelle-informal',]
VERSION = "1.1.0"
class MiniF2F(datasets.GeneratorBasedBuilder): """MiniF2F+Informal in Isabelle"""
BUILDER_CONFIGS = [ datasets.BuilderConfig(name=name, version=VERSION, description=name) for name in _NAMES ]
DEFAULT_CONFIG_NAME = "miniF2F-isabelle-informal"
def _info(self): features = datasets.Features( { "problem_name": datasets.Value("string"), "formal_statement": datasets.Value("string"), "informal_statement": datasets.Value("string"), "informal_proof": datasets.Value("string"), "header": datasets.Value("string"), } ) return datasets.DatasetInfo( description=_DESCRIPTION, features=features, homepage=_HOMEPAGE, license=_LICENSE, citation=_CITATION, )
def _split_generators(self, dl_manager): urls = _URLS data_dir = dl_manager.download_and_extract(urls)
minif2f_repo_dir = data_dir['minif2f_repo']
def extract_theorem(text): extract = re.findall(r"(theorem.*?:.*?(?=by |using |proof|sorry))[\s]*", text, re.DOTALL)[0].strip() assert extract != '' return extract
def extract_header(text): extract = re.findall(r"(.*?)theorem.*?", text, re.DOTALL)[0] assert extract != '' return extract
splits = {'valid': [], 'test': []} for split in ['valid', 'test']: for f in glob.glob( os.path.join(minif2f_repo_dir, _ISABELLEDIR, '%s/*.thy' % split) ): text = open(f).read() name = Path(f).name.replace('.thy', '') thm = extract_theorem(text) header = extract_header(text) informal = json.load(open( os.path.join(minif2f_repo_dir, _INFORMALDIR, '%s/%s.json' % (split, name)) ))
splits[split].append({ 'problem_name': name, 'formal_statement': thm, 'informal_statement': informal['informal_statement'], 'informal_proof': informal['informal_proof'], 'header': header })
assert len(splits['valid']) == 244 assert len(splits['test']) == 244
return [ datasets.SplitGenerator( name=datasets.Split.VALIDATION, gen_kwargs={ "split": "valid", "examples": splits['valid'] }, ), datasets.SplitGenerator( name=datasets.Split.TEST, gen_kwargs={ "split": "test", "examples": splits['test'] }, ), ]
def _generate_examples(self, split, examples): for example in examples: key = example["problem_name"] yield key, exampleREADME.md+50
minif2f_isabelle.pyAdded+160