Elamur Research⌕
☰
home / papers / 2022 / Towards Autoformalization of Mathematics and Code Correctness: Experiments with Elementary Proofs

Towards Autoformalization of Mathematics and Code Correctness: Experiments with Elementary Proofs

Paper · 2022 · Garett Cunningham, Razvan Bunescu and David Juedes

Summary

Checking long mathematical proofs by hand is cognitively demanding. Autoformalization aims to help by converting natural-language proofs into code that an interactive theorem prover can check. The authors frame this as semantic parsing: LaTeX theorem–proof pairs are mapped to Coq. They cover elementary arithmetic and, separately, the correctness of simple imperative programs annotated with Hoare triples.

Training data is synthetic. A few hand-written seed examples guided the design of a rich grammar that produces LaTeX and Coq versions roughly in parallel. This includes features such as sublemmas, coreference, and different proof directions.

The model is a Universal Transformer with relative positional encodings and a copying mechanism, which handles unseen numbers and variable names. Results are measured by exact token match and by a semantic check, in which Coq verifies the generated proof.

The models generalize well to intermediate expression lengths and program sizes absent from training, but fail on lengths beyond the training range. They also handle hand-written inputs, though less accurately. The work suggests autoformalization is feasible in narrow domains, with possible uses in teaching proofs and software verification.

Key points

  • Datasets: four classes of examples. EVEN-ODD, COMPOSITES and POWERS are arithmetic; POLY covers Hoare-logic code correctness. The grammars can in principle yield over 283 million arithmetic and over 491,000 code examples.
  • Splits: 5,000 EVEN-ODD, 5,000 COMPOSITES and 2,000 POWERS examples were generated for each of training and testing. Training used n ∈ {2, 3, 5, 7, 9}; testing covered n from 2 to 12.
  • Handwritten test set: an extra 45 human-written LaTeX pairs, 15 per arithmetic class, test robustness to grammatical structures outside the generator.
  • Positional encodings: with absolute positional encodings, a Transformer scored 0% sequence-level accuracy on unseen lengths, so relative encodings were essential.
  • POLY model: a deeper model (8 blocks, 8 recurrent passes, 8 heads) generalized to unseen program lengths of 4–10 lines, and depth clearly helped. Sequence-level and semantic-level accuracy coincided for POLY. Code and data are at github.com/gc974517/autoformalization.

Our summary of the paper, in our own words — not its text. The work belongs to its authors; read it at the links above.

 Institutions

 Fields, topics and concepts

Cite

Cite as Garett Cunningham, Razvan Bunescu and David Juedes. 2022. Towards Autoformalization of Mathematics and Code Correctness: Experiments with Elementary Proofs. Proceedings of the 1st Workshop on Mathematical Natural Language Processing (MathNLP).

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.18653/v1/2022.mathnlp-1.4 · arXiv 2301.02195

@inproceedings{cunningham2022autoformalization,
  title = {{Towards Autoformalization of Mathematics and Code Correctness: Experiments with Elementary Proofs}},
  author = {Garett Cunningham, Razvan Bunescu and David Juedes},
  booktitle = {Proceedings of the 1st Workshop on Mathematical Natural Language Processing (MathNLP)},
  year = {2022},
  doi = {10.18653/v1/2022.mathnlp-1.4},
  eprint = {2301.02195},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.18653/v1/2022.mathnlp-1.4}
}

References

1 references, 0 of them with a card of ours. ↗ leads to the work, «find» searches for one we have no id for yet.

  1. K. Appel and W. Haken. 1977. Every planar map is four colorable, part I: discharging. Illinois Journal of Mathematics, 21(3):429 – 490. \#\#\# 4.3 Handwritten Examples K. Appel, W. Haken, and J. Koch. 1977. Every planar map is four colorable. II: Reducibility. Ill. J. Math., 21:491–567. find

Updated

This page in Markdown → https://md.research.elamur.ai/free/en/papers/cunningham-2022-autoformalization-mathematics-code-correctness-experiments/