├── src ├── __init__.py ├── dataset │ ├── __init__.py │ ├── raw_data │ │ ├── sf01-lf │ │ ├── sf02-plf │ │ ├── sf03-vfa │ │ ├── sf04-qc │ │ ├── sf05-vc │ │ ├── sf06-slf │ │ ├── lf │ │ │ ├── _CoqProject │ │ │ ├── .devcontainer │ │ │ │ ├── .zshrc │ │ │ │ ├── hack.sh │ │ │ │ ├── devcontainer.json │ │ │ │ └── Dockerfile │ │ │ ├── README │ │ │ ├── Makefile │ │ │ ├── LICENSE │ │ │ ├── impdriver.ml │ │ │ ├── Bib.v │ │ │ ├── imp2.mli │ │ │ ├── imp1.mli │ │ │ ├── AutoTest.v │ │ │ ├── BibTest.v │ │ │ ├── RelTest.v │ │ │ ├── PrefaceTest.v │ │ │ ├── ImpParserTest.v │ │ │ ├── ExtractionTest.v │ │ │ ├── PostscriptTest.v │ │ │ ├── ImpCEvalFunTest.v │ │ │ └── MapsTest.v │ │ ├── qc │ │ │ ├── _CoqProject │ │ │ ├── Bib.v │ │ │ ├── .devcontainer │ │ │ │ ├── .zshrc │ │ │ │ ├── hack.sh │ │ │ │ ├── devcontainer.json │ │ │ │ └── Dockerfile │ │ │ ├── Makefile │ │ │ ├── README │ │ │ ├── LICENSE │ │ │ ├── Postscript.v │ │ │ └── Preface.v │ │ ├── plf │ │ │ ├── _CoqProject │ │ │ ├── .devcontainer │ │ │ │ ├── .zshrc │ │ │ │ ├── hack.sh │ │ │ │ ├── devcontainer.json │ │ │ │ └── Dockerfile │ │ │ ├── README │ │ │ ├── Makefile │ │ │ ├── LICENSE │ │ │ ├── Bib.v │ │ │ ├── BibTest.v │ │ │ ├── PETest.v │ │ │ ├── PrefaceTest.v │ │ │ ├── UseAutoTest.v │ │ │ ├── LibTacticsTest.v │ │ │ ├── PostscriptTest.v │ │ │ ├── UseTacticsTest.v │ │ │ ├── NormTest.v │ │ │ └── MapsTest.v │ │ ├── vfa │ │ │ ├── _CoqProject │ │ │ ├── .devcontainer │ │ │ │ ├── .zshrc │ │ │ │ ├── hack.sh │ │ │ │ ├── devcontainer.json │ │ │ │ └── Dockerfile │ │ │ ├── searchtree.mli │ │ │ ├── redblack.mli │ │ │ ├── README │ │ │ ├── Makefile │ │ │ ├── test_searchtree.ml │ │ │ ├── searchtree.ml │ │ │ ├── LICENSE │ │ │ ├── PrefaceTest.v │ │ │ └── DecideTest.v │ │ ├── vc │ │ │ ├── triang2.h │ │ │ ├── stdlib.c │ │ │ ├── chain.gif │ │ │ ├── stdlib.h │ │ │ ├── stack2.h │ │ │ ├── main2.c │ │ │ ├── _CoqProject │ │ │ ├── sumarray.c │ │ │ ├── triang2.c │ │ │ ├── append.c │ │ │ ├── stdlib2.c │ │ │ ├── reverse.c │ │ │ ├── Makefile │ │ │ ├── stack2.c │ │ │ ├── cfiles-bitsize │ │ │ ├── LICENSE │ │ │ ├── strlib.c │ │ │ ├── stack.c │ │ │ ├── README │ │ │ ├── hints.v │ │ │ └── hash.c │ │ └── slf │ │ │ ├── _CoqProject │ │ │ ├── .devcontainer │ │ │ ├── .zshrc │ │ │ ├── hack.sh │ │ │ ├── devcontainer.json │ │ │ └── Dockerfile │ │ │ ├── LibSepTLCbuffer.v │ │ │ ├── LibCore.v │ │ │ ├── README │ │ │ ├── LibString.v │ │ │ ├── Makefile │ │ │ ├── LICENSE │ │ │ ├── LibUnit.v │ │ │ └── LibAxioms.v │ ├── reconstructed_files │ │ ├── Bib.v │ │ ├── Preface.v │ │ ├── Postscript.v │ │ ├── Extraction.v │ │ ├── BibTest.v │ │ ├── RelTest.v │ │ ├── AutoTest.v │ │ ├── PrefaceTest.v │ │ ├── ImpParserTest.v │ │ ├── ExtractionTest.v │ │ ├── PostscriptTest.v │ │ ├── ImpCEvalFunTest.v │ │ └── MapsTest.v │ ├── pre_processed_data │ │ ├── Bib.v │ │ ├── Postscript.v │ │ ├── Preface.v │ │ ├── Extraction.v │ │ ├── BibTest.v │ │ ├── RelTest.v │ │ ├── AutoTest.v │ │ ├── PrefaceTest.v │ │ ├── ExtractionTest.v │ │ ├── ImpParserTest.v │ │ ├── PostscriptTest.v │ │ ├── ImpCEvalFunTest.v │ │ ├── MapsTest.v │ │ └── IndPrinciplesTest.v │ ├── single_file_data │ │ ├── plf │ │ │ └── .gitignore │ │ ├── flocq │ │ │ └── .gitignore │ │ ├── lf │ │ │ ├── .gitignore │ │ │ └── EverythingLFGraph.v │ │ ├── qc │ │ │ └── .gitignore │ │ └── vfa │ │ │ └── .gitignore │ ├── schemas.py │ └── prepare.py ├── simple-tests │ ├── incomplete_statements.v │ ├── incomplete.v │ ├── proof.v │ └── StackMachine-statements.v ├── utils │ ├── inspect_utils.py │ ├── itertools_extra.py │ └── __init__.py ├── models.py ├── isomorphism_prover_heuristics.py ├── tasks │ ├── coq_complete_from_file.py │ └── coq_complete_from_json.py ├── scorers │ └── completion.py ├── solvers │ ├── agent.py │ └── workflows.py ├── tools │ └── itp.py └── prompts │ └── completion.py ├── .dockerignore ├── .gitattributes ├── iso-checker ├── _CoqProject ├── AutomationTests.v ├── README.md ├── Makefile └── IsomorphismDefinitions.v ├── .vscode └── extensions.json ├── renovate.json ├── CONTRIBUTORS ├── .pre-commit-config.yaml ├── install ├── coq_03_lean_import_install.sh ├── lean_install.sh ├── coq_01_opam_install.sh └── coq_02_coq_install.sh ├── .github └── pull_request_template.md ├── compose.yml ├── .gitmodules ├── pyproject.toml ├── LICENSE ├── .mailmap ├── README.md └── Dockerfile /src/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .venv/* -------------------------------------------------------------------------------- /src/dataset/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/dataset/raw_data/sf01-lf: -------------------------------------------------------------------------------- 1 | lf -------------------------------------------------------------------------------- /src/dataset/raw_data/sf02-plf: -------------------------------------------------------------------------------- 1 | plf -------------------------------------------------------------------------------- /src/dataset/raw_data/sf03-vfa: -------------------------------------------------------------------------------- 1 | vfa -------------------------------------------------------------------------------- /src/dataset/raw_data/sf04-qc: -------------------------------------------------------------------------------- 1 | qc -------------------------------------------------------------------------------- /src/dataset/raw_data/sf05-vc: -------------------------------------------------------------------------------- 1 | vc -------------------------------------------------------------------------------- /src/dataset/raw_data/sf06-slf: -------------------------------------------------------------------------------- 1 | slf -------------------------------------------------------------------------------- /src/dataset/reconstructed_files/Bib.v: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/dataset/pre_processed_data/Bib.v: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/dataset/reconstructed_files/Preface.v: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.sh text eol=lf -------------------------------------------------------------------------------- /src/dataset/pre_processed_data/Postscript.v: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/dataset/pre_processed_data/Preface.v: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/dataset/raw_data/lf/_CoqProject: -------------------------------------------------------------------------------- 1 | -Q . LF 2 | -------------------------------------------------------------------------------- /src/dataset/raw_data/qc/_CoqProject: -------------------------------------------------------------------------------- 1 | -Q . QC 2 | -------------------------------------------------------------------------------- /src/dataset/reconstructed_files/Postscript.v: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/dataset/raw_data/plf/_CoqProject: -------------------------------------------------------------------------------- 1 | -Q . PLF 2 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vfa/_CoqProject: -------------------------------------------------------------------------------- 1 | -Q . VFA 2 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vc/triang2.h: -------------------------------------------------------------------------------- 1 | #include 2 | int triang (int n); 3 | -------------------------------------------------------------------------------- /src/dataset/single_file_data/plf/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !EverythingPLF*.v 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /src/dataset/single_file_data/flocq/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !EverythingFlocq*.v 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vc/stdlib.c: -------------------------------------------------------------------------------- 1 | #include "stdlib.h" 2 | 3 | int placeholder (void) { 4 | return &malloc, &free, &exit, 0; 5 | } 6 | -------------------------------------------------------------------------------- /iso-checker/_CoqProject: -------------------------------------------------------------------------------- 1 | -R . IsomorphismChecker 2 | Automation.v 3 | EqualityLemmas.v 4 | IsomorphismDefinitions.v 5 | AutomationTests.v 6 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vc/chain.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasonGross/autoformalization-transpilation/HEAD/src/dataset/raw_data/vc/chain.gif -------------------------------------------------------------------------------- /src/dataset/single_file_data/lf/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !EverythingLF*.v 3 | EverythingLFRequires.v 4 | EverythingLF*PartialProgress.v 5 | !.gitignore 6 | -------------------------------------------------------------------------------- /src/dataset/single_file_data/qc/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !EverythingQC*.v 3 | EverythingQCRequires.v 4 | EverythingQC*PartialProgress.v 5 | !.gitignore 6 | -------------------------------------------------------------------------------- /src/dataset/single_file_data/vfa/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !EverythingVFA*.v 3 | EverythingVFARequires.v 4 | EverythingVFA*PartialProgress.v 5 | !.gitignore 6 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vc/stdlib.h: -------------------------------------------------------------------------------- 1 | #include 2 | extern void * malloc (size_t n); 3 | extern void free (void *p); 4 | extern void exit(int n); 5 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "maximedenes.vscoq", 4 | "ms-python.python", 5 | "GitHub.copilot", 6 | ] 7 | } -------------------------------------------------------------------------------- /src/dataset/raw_data/slf/_CoqProject: -------------------------------------------------------------------------------- 1 | -Q . SLF 2 | -arg -w 3 | -arg -implicit-core-hint-db,-ambiguous-paths,-notation-incompatible-prefix,-automatic-prop-lowering 4 | 5 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vc/stack2.h: -------------------------------------------------------------------------------- 1 | #include 2 | struct stack; 3 | struct stack *newstack(void); 4 | void push (struct stack *p, int i); 5 | int pop (struct stack *p); 6 | -------------------------------------------------------------------------------- /src/simple-tests/incomplete_statements.v: -------------------------------------------------------------------------------- 1 | Definition plus_0_r_statement := forall n : nat, n + 0 = n. 2 | 3 | Definition plus_comm_statement := forall a b : nat, a + b = b + a. 4 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vc/main2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "stdlib.h" 3 | #include "stack2.h" 4 | #include "triang2.h" 5 | 6 | int main(void) { 7 | return triang(10); 8 | } 9 | -------------------------------------------------------------------------------- /src/simple-tests/incomplete.v: -------------------------------------------------------------------------------- 1 | Theorem plus_0_r : forall n : nat, n + 0 = n. 2 | Proof. 3 | Admitted. 4 | 5 | Theorem plus_comm : forall a b : nat, a + b = b + a. 6 | Proof. 7 | Admitted. -------------------------------------------------------------------------------- /iso-checker/AutomationTests.v: -------------------------------------------------------------------------------- 1 | From IsomorphismChecker Require Import Automation. 2 | 3 | Axiom foo : forall a : nat, a + 0 = 0. 4 | Definition bar := forall a : nat, a + 0 = 0. 5 | 6 | Fail Check iso_statement foo bar. -------------------------------------------------------------------------------- /src/dataset/single_file_data/lf/EverythingLFGraph.v: -------------------------------------------------------------------------------- 1 | Require dpdgraph.dpdgraph. 2 | From LF Require EverythingLF. 3 | 4 | Set DependGraph File "EverythingLF.dpd". 5 | Print FileDependGraph EverythingLF. -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "config:recommended" 5 | ], 6 | "ignorePaths": [ 7 | "src/dataset/raw_data/**", 8 | "inspiration/**" 9 | ] 10 | } -------------------------------------------------------------------------------- /src/dataset/schemas.py: -------------------------------------------------------------------------------- 1 | from pydantic import BaseModel 2 | 3 | 4 | class TranslationResponse(BaseModel): 5 | percentage_translated: float 6 | foreseeable_issues: list[str] 7 | lean_translation: str 8 | mistake_tally: dict[str, int] 9 | -------------------------------------------------------------------------------- /CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Jacob Green 2 | Jason Gross 3 | Rajashree Agrawal 4 | Shiki Vaahan 5 | Twm Stone 6 | Vishesh Saraswat 7 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vc/_CoqProject: -------------------------------------------------------------------------------- 1 | -R /Users/bcpierce/tmp/VST/compcert compcert -Q /Users/bcpierce/tmp/VST/msl VST.msl -Q /Users/bcpierce/tmp/VST/sepcomp VST.sepcomp -Q /Users/bcpierce/tmp/VST/veric VST.veric -Q /Users/bcpierce/tmp/VST/floyd VST.floyd -Q . VC 2 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/astral-sh/ruff-pre-commit 3 | # Ruff version. 4 | rev: v0.9.1 5 | hooks: 6 | # Run the linter. 7 | - id: ruff 8 | args: [ --fix ] 9 | # Run the formatter. 10 | - id: ruff-format -------------------------------------------------------------------------------- /install/coq_03_lean_import_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # opam pin add -yn rocq-lean-import dev 5 | 6 | opam install -y coq rocq-lean-import 7 | 8 | # Allow for editing of coq-lean-import more easily 9 | cd /root 10 | ln -s "$(opam var rocq-lean-import:build)" coq-lean-import 11 | -------------------------------------------------------------------------------- /src/dataset/raw_data/qc/Bib.v: -------------------------------------------------------------------------------- 1 | (** * Bib: Bibliography *) 2 | 3 | (** 4 | 5 | [Wadler and Blott 1989] Philip Wadler, Stephen Blott, _How to Make 6 | ad-hoc Polymorphism Less ad-hoc_. POPL 1989. 7 | {https://dl.acm.org/citation.cfm?doid=75277.75283} 8 | 9 | *) 10 | 11 | 12 | (* 2024-12-27 10:32 *) 13 | -------------------------------------------------------------------------------- /src/dataset/raw_data/lf/.devcontainer/.zshrc: -------------------------------------------------------------------------------- 1 | autoload -U colors && colors 2 | precmd() { 3 | drawline="" 4 | for i in {1..$COLUMNS}; drawline=" $drawline" 5 | drawline="%U${drawline}%u" 6 | PS1="%F{252}${drawline} 7 | %B%F{124}%n:%~>%b%f " 8 | } 9 | 10 | eval $(opam env) 11 | 12 | alias ls="ls --color" 13 | 14 | -------------------------------------------------------------------------------- /src/dataset/raw_data/plf/.devcontainer/.zshrc: -------------------------------------------------------------------------------- 1 | autoload -U colors && colors 2 | precmd() { 3 | drawline="" 4 | for i in {1..$COLUMNS}; drawline=" $drawline" 5 | drawline="%U${drawline}%u" 6 | PS1="%F{252}${drawline} 7 | %B%F{124}%n:%~>%b%f " 8 | } 9 | 10 | eval $(opam env) 11 | 12 | alias ls="ls --color" 13 | 14 | -------------------------------------------------------------------------------- /src/dataset/raw_data/qc/.devcontainer/.zshrc: -------------------------------------------------------------------------------- 1 | autoload -U colors && colors 2 | precmd() { 3 | drawline="" 4 | for i in {1..$COLUMNS}; drawline=" $drawline" 5 | drawline="%U${drawline}%u" 6 | PS1="%F{252}${drawline} 7 | %B%F{124}%n:%~>%b%f " 8 | } 9 | 10 | eval $(opam env) 11 | 12 | alias ls="ls --color" 13 | 14 | -------------------------------------------------------------------------------- /src/dataset/raw_data/slf/.devcontainer/.zshrc: -------------------------------------------------------------------------------- 1 | autoload -U colors && colors 2 | precmd() { 3 | drawline="" 4 | for i in {1..$COLUMNS}; drawline=" $drawline" 5 | drawline="%U${drawline}%u" 6 | PS1="%F{252}${drawline} 7 | %B%F{124}%n:%~>%b%f " 8 | } 9 | 10 | eval $(opam env) 11 | 12 | alias ls="ls --color" 13 | 14 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vfa/.devcontainer/.zshrc: -------------------------------------------------------------------------------- 1 | autoload -U colors && colors 2 | precmd() { 3 | drawline="" 4 | for i in {1..$COLUMNS}; drawline=" $drawline" 5 | drawline="%U${drawline}%u" 6 | PS1="%F{252}${drawline} 7 | %B%F{124}%n:%~>%b%f " 8 | } 9 | 10 | eval $(opam env) 11 | 12 | alias ls="ls --color" 13 | 14 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ### Description 2 | - Describe what's changed 3 | 4 | ### Verification 5 | - Add evidence that your change(s) work (screenshots, tests etc.) 6 | 7 | ### Have you updated the [docs](https://docs.google.com/document/d/14DN504KJMK3bACEXI4xdmvsRHv4b1BclJsiSpBjVmb0/edit?tab=t.0)? 8 | - [ ] Yes 9 | - [ ] No 10 | -------------------------------------------------------------------------------- /src/utils/inspect_utils.py: -------------------------------------------------------------------------------- 1 | from typing import TypeVar 2 | 3 | 4 | T = TypeVar("T") 5 | 6 | 7 | def handle_none_string(x: T | str | None) -> T | str | None: 8 | """Since LLMs sometimes pass '"None"' instead of None, we need to handle this case.""" 9 | if isinstance(x, str) and x == "None": 10 | return None 11 | return x 12 | -------------------------------------------------------------------------------- /compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | autoformalization: 3 | container_name: autoformalization 4 | build: . 5 | entrypoint: ["tail", "-f", "/dev/null"] 6 | volumes: 7 | # Mount the working directory to the container so that changes in the 8 | # host are reflected in the container and vice versa. 9 | - ./:/root/autoformalization 10 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vc/sumarray.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | unsigned sumarray(unsigned a[], int n) { 4 | int i; unsigned s; 5 | i=0; 6 | s=0; 7 | while (i key -> 'a1 tree -> 'a1 11 | 12 | val insert : key -> 'a1 -> 'a1 tree -> 'a1 tree 13 | 14 | val elements_aux : 'a1 tree -> (key * 'a1) list -> (key * 'a1) list 15 | 16 | val elements : 'a1 tree -> (key * 'a1) list 17 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "src/dataset/raw_data/CompCert"] 2 | path = src/dataset/raw_data/CompCert 3 | url = https://github.com/AbsInt/CompCert.git 4 | [submodule "src/dataset/raw_data/flocq"] 5 | path = src/dataset/raw_data/flocq 6 | url = https://gitlab.inria.fr/flocq/flocq 7 | [submodule "inspiration/itp-interface"] 8 | path = inspiration/itp-interface 9 | url = https://github.com/trishullab/itp-interface.git 10 | -------------------------------------------------------------------------------- /src/dataset/raw_data/lf/.devcontainer/hack.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ### HACK - workaround ubuntu libc6 version number bug see: https://forum.odroid.com/viewtopic.php?p=344373 4 | 5 | mv /bin/uname /bin/uname.orig 6 | tee -a /bin/uname < script.sh && chmod +x script.sh && ./script.sh -y 5 | 6 | # Install lean4export 7 | cd /root 8 | git clone https://github.com/leanprover/lean4export.git 9 | cd lean4export 10 | git checkout d7978498 11 | . $HOME/.elan/env 12 | echo ". $HOME/.elan/env" >> ~/.bashrc 13 | lake build -------------------------------------------------------------------------------- /src/models.py: -------------------------------------------------------------------------------- 1 | from enum import StrEnum 2 | 3 | 4 | class AnthropicModel(StrEnum): 5 | DEBUG = "anthropic/claude-3-haiku-20240307" 6 | SONNET35 = "anthropic/claude-3-5-sonnet-20241022" 7 | BEST = "anthropic/claude-3-7-sonnet-20250219" 8 | 9 | 10 | class OpenAIModel(StrEnum): 11 | DEBUG = "openai/gpt-4o-mini-2024-07-18" 12 | O1MINI = "openai/o1-mini-2024-09-12" 13 | O1PREVIEW = "openai/o1-preview-2024-09-12" 14 | BEST = "openai/o3-mini-2025-01-31" 15 | O1 = "openai/o1-2024-12-17" 16 | -------------------------------------------------------------------------------- /src/dataset/raw_data/qc/Makefile: -------------------------------------------------------------------------------- 1 | COQMFFLAGS := -Q . QC 2 | 3 | ALLVFILES := Preface.v Introduction.v Typeclasses.v QC.v TImp.v QuickChickTool.v QuickChickInterface.v Postscript.v Bib.v 4 | 5 | build: Makefile.coq 6 | $(MAKE) -f Makefile.coq 7 | 8 | clean:: 9 | if [ -e Makefile.coq ]; then $(MAKE) -f Makefile.coq cleanall; fi 10 | $(RM) $(wildcard Makefile.coq Makefile.coq.conf) 11 | 12 | Makefile.coq: 13 | coq_makefile $(COQMFFLAGS) -o Makefile.coq $(ALLVFILES) 14 | 15 | -include Makefile.coq 16 | 17 | .PHONY: build clean 18 | -------------------------------------------------------------------------------- /src/simple-tests/proof.v: -------------------------------------------------------------------------------- 1 | (* First prove the helper lemma plus_0_r *) 2 | Theorem plus_0_r : forall n : nat, n + 0 = n. 3 | Proof. 4 | intros n. 5 | induction n as [| n' IHn']. 6 | - simpl. reflexivity. 7 | - simpl. rewrite IHn'. reflexivity. 8 | Qed. 9 | 10 | (* Now we can prove plus_comm *) 11 | Theorem plus_comm : forall a b : nat, a + b = b + a. 12 | Proof. 13 | intros a b. 14 | induction a as [| a' IHa']. 15 | - simpl. rewrite plus_0_r. reflexivity. 16 | - simpl. rewrite IHa'. rewrite plus_n_Sm. reflexivity. 17 | Qed. -------------------------------------------------------------------------------- /install/coq_01_opam_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | # Download OPAM installer and run it 4 | curl -fsSL https://opam.ocaml.org/install.sh > opam.sh 5 | echo "" | sh opam.sh 6 | 7 | # Disable sandboxing (required for Docker containers) 8 | export OPAMSANDBOX=none 9 | 10 | # Initialize OPAM without setup and source environment 11 | opam init -y --disable-sandboxing --auto-setup --comp=4.14.2 12 | opam repo add coq-core-dev https://coq.inria.fr/opam/core-dev 13 | opam repo add coq-extra-dev https://coq.inria.fr/opam/extra-dev 14 | 15 | echo 'eval $(opam env)' >> ~/.bashrc 16 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vfa/redblack.mli: -------------------------------------------------------------------------------- 1 | 2 | type key = int 3 | 4 | type color = 5 | | Red 6 | | Black 7 | 8 | type 'v tree = 9 | | E 10 | | T of color * 'v tree * key * 'v * 'v tree 11 | 12 | val empty_tree : 'a1 tree 13 | 14 | val lookup : 'a1 -> key -> 'a1 tree -> 'a1 15 | 16 | val balance : color -> 'a1 tree -> key -> 'a1 -> 'a1 tree -> 'a1 tree 17 | 18 | val ins : key -> 'a1 -> 'a1 tree -> 'a1 tree 19 | 20 | val make_black : 'a1 tree -> 'a1 tree 21 | 22 | val insert : key -> 'a1 -> 'a1 tree -> 'a1 tree 23 | 24 | val elements_aux : 'a1 tree -> (key * 'a1) list -> (key * 'a1) list 25 | 26 | val elements : 'a1 tree -> (key * 'a1) list 27 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vc/triang2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "stdlib.h" 3 | #include "stack2.h" 4 | #include "triang2.h" 5 | 6 | void push_increasing (struct stack *st, int n) { 7 | int i; 8 | i=0; 9 | while (i Iterable[T]: 7 | """Return a new iterable with duplicates removed""" 8 | seen = [] 9 | seen_set = set() 10 | for item in iterable: 11 | if seen_set is None and item in seen: 12 | continue 13 | if seen_set is not None and item in seen_set: 14 | continue 15 | yield item 16 | seen.append(item) 17 | if seen_set is not None: 18 | try: 19 | seen_set.add(item) 20 | except TypeError: 21 | seen_set = None 22 | -------------------------------------------------------------------------------- /src/dataset/raw_data/slf/LibSepTLCbuffer.v: -------------------------------------------------------------------------------- 1 | (** * LibSepTLCbuffer: Appendix - Temporary Additions to TLC *) 2 | 3 | (** 4 | 5 | This file contains temporary definitions that will eventually 6 | get merged into the various files from the TLC library. 7 | 8 | *) 9 | 10 | Set Implicit Arguments. 11 | (* 12 | From SLF Require Import LibTactics LibLogic LibList. 13 | From SLF Require Import LibReflect. 14 | From SLF Require LibListZ LibWf LibMultiset LibInt. 15 | *) 16 | From SLF Require Import LibTactics. 17 | From SLF Require Import LibInt. 18 | Generalizable Variables A B. 19 | 20 | Global Opaque Z.mul. 21 | Global Opaque Z.add. 22 | 23 | 24 | 25 | (* 2024-12-26 10:22 *) 26 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vc/append.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct list {int head; struct list *tail;}; 4 | 5 | struct list *append (struct list *x, struct list *y) { 6 | struct list *t, *u; 7 | if (x==NULL) 8 | return y; 9 | else { 10 | t = x; 11 | u = t->tail; 12 | while (u!=NULL) { 13 | t = u; 14 | u = t->tail; 15 | } 16 | t->tail = y; 17 | return x; 18 | } 19 | } 20 | 21 | struct list * append2 (struct list * x, struct list * y) { 22 | struct list * * retp, * * curp; 23 | retp = & x; 24 | curp = & x; 25 | while ( * curp != NULL ) { 26 | curp = & (( * curp ) -> tail); 27 | } 28 | * curp = y; 29 | return * retp; 30 | } 31 | -------------------------------------------------------------------------------- /src/dataset/raw_data/qc/README: -------------------------------------------------------------------------------- 1 | ######################################################################### 2 | SOFTWARE FOUNDATIONS 3 | ######################################################################### 4 | 5 | This directory contains both Coq scripts (.v files) and more readable 6 | HTML files for Volume 4 of the Software Foundations electronic 7 | textbook series. 8 | 9 | - Preface.v or Preface.html 10 | The place to start reading, including details on how to install 11 | required software 12 | 13 | - index.html 14 | The book's cover page and navigation starting point 15 | 16 | - LICENSE 17 | Explanation of how these files may be redistributed 18 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vc/stdlib2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "stdlib.h" 3 | 4 | struct cell {struct cell *a, *b, *c, *d;}; 5 | 6 | #define N 80000 7 | 8 | struct cell pool[N]; 9 | int pool_index = 0; 10 | struct cell *freelist=NULL; 11 | 12 | void *malloc (size_t n) { 13 | struct cell *p; 14 | if (n>sizeof(struct cell)) return NULL; 15 | if (freelist) { 16 | p = freelist; 17 | freelist = p->a; 18 | } else if (pool_index < N) { 19 | p = pool+pool_index++; 20 | } else p=NULL; 21 | return (void*)p; 22 | } 23 | 24 | void free (void *p) { 25 | struct cell *pp = p; 26 | if (pp==NULL) return; 27 | pp->a = freelist; 28 | freelist=pp; 29 | } 30 | 31 | void exit (int n) { 32 | while (1) ; 33 | } 34 | -------------------------------------------------------------------------------- /src/dataset/raw_data/lf/README: -------------------------------------------------------------------------------- 1 | ######################################################################### 2 | SOFTWARE FOUNDATIONS 3 | ######################################################################### 4 | 5 | This directory contains both Coq scripts (.v files) and generated HTML 6 | files for Volume 1 of the Software Foundations electronic textbook 7 | series. 8 | 9 | - Preface.v or Preface.html 10 | The place to start reading, including details on how to install 11 | required software 12 | 13 | - index.html 14 | The book's cover page and navigation starting point 15 | 16 | - deps.html 17 | Overview of the ordering of chapters 18 | 19 | - LICENSE 20 | Explanation of how these files may be redistributed -------------------------------------------------------------------------------- /src/dataset/raw_data/plf/README: -------------------------------------------------------------------------------- 1 | ######################################################################### 2 | SOFTWARE FOUNDATIONS 3 | ######################################################################### 4 | 5 | This directory contains both Coq scripts (.v files) and more readable 6 | HTML files for Volume 2 of the Software Foundations electronic 7 | textbook series. 8 | 9 | - Preface.v or Preface.html 10 | The place to start reading, including details on how to install 11 | required software 12 | 13 | - index.html 14 | The book's cover page and navigation starting point 15 | 16 | - deps.html 17 | Overview of the ordering of chapters 18 | 19 | - LICENSE 20 | Explanation of how these files may be redistributed -------------------------------------------------------------------------------- /src/dataset/raw_data/vfa/README: -------------------------------------------------------------------------------- 1 | ######################################################################### 2 | SOFTWARE FOUNDATIONS 3 | ######################################################################### 4 | 5 | This directory contains both Coq scripts (.v files) and more readable 6 | HTML files for Verified Functional Algorithms, by Andrew W. Appel, 7 | volume 3 of the Software Foundations series. 8 | 9 | - VFA.v or VFA.html 10 | The place to start reading, including details on how to install 11 | required software 12 | 13 | - index.html 14 | The book's cover page and navigation starting point 15 | 16 | - deps.html 17 | Overview of the ordering of chapters 18 | 19 | - LICENSE 20 | Explanation of how these files may be redistributed 21 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vc/reverse.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct list {unsigned head; struct list *tail;}; 4 | 5 | struct list three[] = { 6 | {1, three+1}, {2, three+2}, {3, NULL} 7 | }; 8 | 9 | unsigned sumlist (struct list *p) { 10 | unsigned s = 0; 11 | struct list *t = p; 12 | unsigned h; 13 | while (t) { 14 | h = t->head; 15 | t = t->tail; 16 | s = s + h; 17 | } 18 | return s; 19 | } 20 | 21 | struct list *reverse (struct list *p) { 22 | struct list *w, *t, *v; 23 | w = NULL; 24 | v = p; 25 | while (v) { 26 | t = v->tail; 27 | v->tail = w; 28 | w = v; 29 | v = t; 30 | } 31 | return w; 32 | } 33 | 34 | int main (void) { 35 | struct list *r; unsigned s; 36 | r = reverse(three); 37 | s = sumlist(r); 38 | return (int)s; 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vc/Makefile: -------------------------------------------------------------------------------- 1 | COQMFFLAGS := -Q . VC 2 | 3 | ALLVFILES := sumarray.v reverse.v append.v stack.v strlib.v hash.v hints.v stdlib.v stdlib2.v stack2.v triang2.v main2.v Preface.v Verif_sumarray.v Verif_reverse.v Verif_stack.v Verif_triang.v Verif_append1.v Verif_append2.v Verif_strlib.v Hashfun.v Verif_hash.v VSU_intro.v Spec_stack.v Spec_triang.v Spec_stdlib.v VSU_stack.v VSU_triang.v VSU_stdlib.v VSU_main.v VSU_stdlib2.v VSU_main2.v Postscript.v Bib.v 4 | 5 | build: Makefile.coq 6 | $(MAKE) -f Makefile.coq 7 | 8 | clean:: 9 | if [ -e Makefile.coq ]; then $(MAKE) -f Makefile.coq cleanall; fi 10 | $(RM) $(wildcard Makefile.coq Makefile.coq.conf) 11 | 12 | Makefile.coq: 13 | coq_makefile $(COQMFFLAGS) -o Makefile.coq $(ALLVFILES) 14 | 15 | -include Makefile.coq 16 | 17 | .PHONY: build clean 18 | -------------------------------------------------------------------------------- /src/dataset/raw_data/lf/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": "bcpierce00/cis5000:8.17.1", 3 | "customizations": { 4 | "vscode": { 5 | "extensions": ["maximedenes.vscoq"], 6 | "settings": { 7 | "coqtop.binPath" : "/home/coq/.opam/default/bin", 8 | "files.exclude": { 9 | "**/*.aux": true, 10 | "**/*.glob": true, 11 | "**/*.vo": true, 12 | "**/*.vos": true, 13 | "**/*.vok": true, 14 | "**/*.html": true, 15 | "**/.*.report": true, 16 | "**/.*.cache": true 17 | }, 18 | "coq.loadCoqProject": true, 19 | "coq.coqProjectRoot": ".", 20 | "[coq]": { 21 | "editor.tabSize": 2, 22 | "editor.insertSpaces": true 23 | } 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/dataset/raw_data/slf/LibCore.v: -------------------------------------------------------------------------------- 1 | (* This file is extracted from the TLC library. 2 | http://github.com/charguer/tlc 3 | DO NOT EDIT. *) 4 | 5 | (************************************************************************** 6 | * TLC: A library for Coq * 7 | * Packing the Core Modules * 8 | **************************************************************************) 9 | 10 | From SLF Require Export LibTactics LibLogic LibOperation LibReflect. 11 | From SLF Require Export LibUnit LibProd LibSum LibOption LibNat LibInt LibList. 12 | From SLF Require Export LibRelation LibOrder LibWf. 13 | Export LibTacticsCompatibility. 14 | 15 | Open Scope Z_scope. 16 | Open Scope Int_scope. 17 | Open Scope comp_scope. 18 | 19 | (* 2024-12-26 10:22 *) 20 | -------------------------------------------------------------------------------- /iso-checker/README.md: -------------------------------------------------------------------------------- 1 | Files in this directory: 2 | 3 | - `StackMachine.v`: a slightly modified version of [`StackMachine.v`](https://github.com/trishullab/itp-interface/blob/main/src/data/test/coq/stack_machine/StackMachine.v), separating out theorem statements and removing extraction 4 | - `demo.lean`: a Claude-assisted translation of the StackMachine statements to Lean 5 | - `demo.dump`: the lean4export dump of demo.lean 6 | - `LeanStackMachine.v`: the coq-lean-import of demo.dump 7 | - `IsomorphismDefinitions.v`: the definition of the isomorphism type 8 | - `EqualityLemmas.v`: various helper lemmas about equality and isomorphism 9 | - `Automation.v`: the tactics that automate isomorphism proving 10 | - `Demo.v`: the demo file where I have stated and proven the isomorphisms 11 | - `Makefile` and `_CoqProject`: allowing the build of these files via `make` 12 | -------------------------------------------------------------------------------- /src/dataset/raw_data/slf/README: -------------------------------------------------------------------------------- 1 | ######################################################################### 2 | SOFTWARE FOUNDATIONS 3 | ######################################################################### 4 | 5 | This directory contains both Coq scripts (.v files) and more readable 6 | HTML files for the Software Foundations electronic textbook, 7 | covering volume 6, entitled "Separation Logic Foundations". 8 | 9 | - index.html 10 | The book's cover page and navigation starting point 11 | 12 | - deps.html 13 | Overview of the ordering of chapters 14 | 15 | - LICENSE 16 | Explanation of how these files may be redistributed 17 | 18 | - Files SLF*.v 19 | Contents of the course 20 | 21 | - Files Lib*.v 22 | Contents of the TLC library 23 | 24 | - Other *.v files 25 | Implementation of CFML 26 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "autoformalization" 3 | version = "0.1.0" 4 | description = "For the AlphaProof for Software Verification MARS project" 5 | readme = "README.md" 6 | requires-python = ">=3.11" 7 | dependencies = [ 8 | "openai>=1.61.1", 9 | "pydantic>=2.10.6", 10 | "python-dotenv>=1.0.1", 11 | "mypy>=1.15.0", 12 | "dill>=0.3.9", 13 | "sympy>=1.13.3", 14 | "anthropic>=0.49.0", 15 | "frozendict>=2.4.6", 16 | "networkx>=3.4.2", 17 | "pandas>=2.2.3", 18 | "inspect-ai>=0.3.75", 19 | "itp-interface>=1.1.9", 20 | "coq-tools>=0.0.9", 21 | ] 22 | 23 | [tool.uv] 24 | dev-dependencies = [ 25 | "ruff>=0.6.2", 26 | "pre-commit>=4.0.1", 27 | ] 28 | 29 | [tool.ruff] 30 | line-length = 88 # Adjust as needed 31 | target-version = "py311" 32 | 33 | [tool.ruff.lint] 34 | select = ["I"] # Enable import sorting 35 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vfa/Makefile: -------------------------------------------------------------------------------- 1 | COQMFFLAGS := -Q . VFA -arg "-w -omega-is-deprecated,-implicit-core-hint-db" 2 | 3 | ALLVFILES := Preface.v Perm.v Sort.v Multiset.v BagPerm.v Selection.v Merge.v Maps.v SearchTree.v ADT.v Extract.v Redblack.v Trie.v Priqueue.v Binom.v Decide.v Color.v PrefaceTest.v PermTest.v SortTest.v MultisetTest.v BagPermTest.v SelectionTest.v MergeTest.v MapsTest.v SearchTreeTest.v ADTTest.v ExtractTest.v RedblackTest.v TrieTest.v PriqueueTest.v BinomTest.v DecideTest.v ColorTest.v 4 | 5 | build: Makefile.coq 6 | $(MAKE) -f Makefile.coq 7 | 8 | clean:: 9 | if [ -e Makefile.coq ]; then $(MAKE) -f Makefile.coq cleanall; fi 10 | $(RM) $(wildcard Makefile.coq Makefile.coq.conf) 11 | 12 | Makefile.coq: 13 | coq_makefile $(COQMFFLAGS) -o Makefile.coq $(ALLVFILES) 14 | 15 | -include Makefile.coq 16 | 17 | .PHONY: build clean 18 | -------------------------------------------------------------------------------- /src/isomorphism_prover_heuristics.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | from project_util import GenericIsoError, IsoError 4 | 5 | 6 | def can_autofix_nat_mul2_proof(e: IsoError) -> bool: 7 | if not isinstance(e, GenericIsoError): 8 | return False 9 | if not e.orig_source.endswith("Nat.mul"): 10 | return False 11 | if ( 12 | e.orig_proof 13 | == "iso. iso_rel_rewrite Nat.mul_comm. iso. iso_rel_rewrite Nat.add_comm. iso." 14 | ): 15 | return False 16 | return bool(re.search(r"rel_iso nat_iso \(\w+ \+ \w+ \* \w+\)", e.simplified_goals)) 17 | 18 | 19 | def autofix_nat_mul2_proof( 20 | error: IsoError, 21 | ) -> str: 22 | return "iso. iso_rel_rewrite Nat.mul_comm. iso. iso_rel_rewrite Nat.add_comm. iso." 23 | 24 | 25 | ALL_HEURISTICS = ( 26 | ("second Nat.mul heuristic", can_autofix_nat_mul2_proof, autofix_nat_mul2_proof), 27 | ) 28 | -------------------------------------------------------------------------------- /src/dataset/prepare.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | 3 | from inspect_ai.dataset import MemoryDataset, Sample 4 | from project_util import extract_coq_identifiers_str 5 | 6 | 7 | def prepare_sample(input_msg: str) -> Sample: 8 | return Sample(input=input_msg) 9 | 10 | 11 | def prepare_dataset(input_msgs: list[str]) -> MemoryDataset: 12 | return MemoryDataset([prepare_sample(msg) for msg in input_msgs]) 13 | 14 | 15 | def format_translation_input(prompt_template: str, coq_path: Path, coq_identifiers: list[str] | None = None) -> str: 16 | if not coq_path.exists(): 17 | raise FileNotFoundError(f"Coq file not found at {coq_path}") 18 | coq_input = coq_path.read_text() 19 | if coq_identifiers is None: 20 | coq_identifiers = extract_coq_identifiers_str(coq_input, sigil=False) 21 | return prompt_template.format(coq_script=coq_input, coq_identifiers=coq_identifiers) 22 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vc/stack2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "stdlib.h" 3 | #include "stack2.h" 4 | 5 | struct cons { 6 | int value; 7 | struct cons *next; 8 | }; 9 | 10 | struct stack { 11 | struct cons *top; 12 | }; 13 | 14 | void *surely_malloc (size_t n) { 15 | void *p = malloc(n); 16 | if (!p) exit(1); 17 | return p; 18 | } 19 | 20 | struct stack *newstack(void) { 21 | struct stack *p; 22 | p = (struct stack *) surely_malloc (sizeof (struct stack)); 23 | p->top = NULL; 24 | return p; 25 | } 26 | 27 | void push (struct stack *p, int i) { 28 | struct cons *q; 29 | q = (struct cons *) surely_malloc (sizeof (struct cons)); 30 | q->value = i; 31 | q->next = p->top; 32 | p->top = q; 33 | } 34 | 35 | int pop (struct stack *p) { 36 | struct cons *q; 37 | int i; 38 | q = p->top; 39 | p->top = q->next; 40 | i = q->value; 41 | free(q); 42 | return i; 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/dataset/raw_data/slf/LibString.v: -------------------------------------------------------------------------------- 1 | (* This file is extracted from the TLC library. 2 | http://github.com/charguer/tlc 3 | DO NOT EDIT. *) 4 | 5 | (************************************************************************** 6 | * TLC: A library for Coq * 7 | * Strings * 8 | **************************************************************************) 9 | 10 | Set Implicit Arguments. 11 | From SLF Require Import LibTactics LibReflect. 12 | From Coq Require Export String. 13 | 14 | (* ********************************************************************** *) 15 | (* ################################################################# *) 16 | (** * Inhabited *) 17 | 18 | #[global] 19 | Instance Inhab_string : Inhab string. 20 | Proof using. apply (Inhab_of_val EmptyString). Qed. 21 | 22 | (* 2025-01-06 19:51 *) 23 | -------------------------------------------------------------------------------- /src/dataset/raw_data/lf/Makefile: -------------------------------------------------------------------------------- 1 | COQMFFLAGS := -Q . LF 2 | 3 | ALLVFILES := Preface.v Basics.v Induction.v Lists.v Poly.v Tactics.v Logic.v IndProp.v Maps.v ProofObjects.v IndPrinciples.v Rel.v Imp.v ImpParser.v ImpCEvalFun.v Extraction.v Auto.v AltAuto.v Postscript.v Bib.v PrefaceTest.v BasicsTest.v InductionTest.v ListsTest.v PolyTest.v TacticsTest.v LogicTest.v IndPropTest.v MapsTest.v ProofObjectsTest.v IndPrinciplesTest.v RelTest.v ImpTest.v ImpParserTest.v ImpCEvalFunTest.v ExtractionTest.v AutoTest.v AltAutoTest.v PostscriptTest.v BibTest.v 4 | 5 | build: Makefile.coq 6 | $(MAKE) -f Makefile.coq 7 | 8 | clean:: 9 | if [ -e Makefile.coq ]; then $(MAKE) -f Makefile.coq cleanall; fi 10 | $(RM) $(wildcard Makefile.coq Makefile.coq.conf) imp.ml imp.mli imp1.ml imp1.mli imp2.ml imp2.mli 11 | 12 | Makefile.coq: 13 | coq_makefile $(COQMFFLAGS) -o Makefile.coq $(ALLVFILES) 14 | 15 | -include Makefile.coq 16 | 17 | .PHONY: build clean 18 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vc/cfiles-bitsize: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ $# -eq 1 ] 4 | then 5 | B=$1 6 | if [ $B != 32 ] && [ $B != 64 ] 7 | then 8 | echo "Use command-line argument 32 or 64" 9 | exit 1 10 | fi 11 | else 12 | echo "Use command-line argument 32 or 64" 13 | exit 1 14 | fi 15 | 16 | echo cp sumarray"$B".v sumarray.v 17 | cp sumarray"$B".v sumarray.v 18 | echo cp reverse"$B".v reverse.v 19 | cp reverse"$B".v reverse.v 20 | echo cp append"$B".v append.v 21 | cp append"$B".v append.v 22 | echo cp stack"$B".v stack.v 23 | cp stack"$B".v stack.v 24 | echo cp strlib"$B".v strlib.v 25 | cp strlib"$B".v strlib.v 26 | echo cp hash"$B".v hash.v 27 | cp hash"$B".v hash.v 28 | echo cp stdlib"$B".v stdlib.v 29 | cp stdlib"$B".v stdlib.v 30 | echo cp stdlib2"$B".v stdlib2.v 31 | cp stdlib2"$B".v stdlib2.v 32 | echo cp stack2"$B".v stack2.v 33 | cp stack2"$B".v stack2.v 34 | echo cp triang2"$B".v triang2.v 35 | cp triang2"$B".v triang2.v 36 | echo cp main2"$B".v main2.v 37 | cp main2"$B".v main2.v 38 | -------------------------------------------------------------------------------- /src/dataset/raw_data/plf/Makefile: -------------------------------------------------------------------------------- 1 | COQMFFLAGS := -Q . PLF 2 | 3 | ALLVFILES := Maps.v Imp.v Preface.v Equiv.v Hoare.v Hoare2.v HoareAsLogic.v Smallstep.v Types.v Stlc.v StlcProp.v MoreStlc.v Sub.v Typechecking.v Records.v References.v RecordSub.v Norm.v PE.v Postscript.v Bib.v LibTactics.v UseTactics.v UseAuto.v MapsTest.v ImpTest.v PrefaceTest.v EquivTest.v HoareTest.v Hoare2Test.v HoareAsLogicTest.v SmallstepTest.v TypesTest.v StlcTest.v StlcPropTest.v MoreStlcTest.v SubTest.v TypecheckingTest.v RecordsTest.v ReferencesTest.v RecordSubTest.v NormTest.v PETest.v PostscriptTest.v BibTest.v LibTacticsTest.v UseTacticsTest.v UseAutoTest.v 4 | 5 | build: Makefile.coq 6 | $(MAKE) -f Makefile.coq 7 | 8 | clean:: 9 | if [ -e Makefile.coq ]; then $(MAKE) -f Makefile.coq cleanall; fi 10 | $(RM) $(wildcard Makefile.coq Makefile.coq.conf) 11 | 12 | Makefile.coq: 13 | coq_makefile $(COQMFFLAGS) -o Makefile.coq $(ALLVFILES) 14 | 15 | -include Makefile.coq 16 | 17 | .PHONY: build clean 18 | -------------------------------------------------------------------------------- /src/dataset/reconstructed_files/Extraction.v: -------------------------------------------------------------------------------- 1 | From Coq Require Extraction. 2 | Extraction Language OCaml. 3 | 4 | From Coq Require Import Arith. 5 | 6 | From Coq Require Import Init.Nat. 7 | 8 | From Coq Require Import EqNat. 9 | 10 | From LF Require Import ImpCEvalFun. 11 | 12 | Extraction "imp1.ml" ceval_step. 13 | 14 | Extract Inductive bool => "bool" [ "true" "false" ]. 15 | 16 | Extract Inductive nat => "int" 17 | [ "0" "(fun x -> x + 1)" ] 18 | "(fun zero succ n -> 19 | if n=0 then zero () else succ (n-1))". 20 | 21 | Extract Constant plus => "( + )". 22 | Extract Constant mult => "( * )". 23 | Extract Constant eqb => "( = )". 24 | 25 | Extraction "imp2.ml" ceval_step. 26 | 27 | Require Import ExtrOcamlBasic. 28 | 29 | Require Import ExtrOcamlString. 30 | 31 | Extract Inductive sumbool => "bool" ["true" "false"]. 32 | 33 | From LF Require Import Imp. 34 | 35 | From LF Require Import ImpParser. 36 | 37 | From LF Require Import Maps. 38 | Extraction "imp.ml" empty_st ceval_step parse. 39 | 40 | -------------------------------------------------------------------------------- /install/coq_02_coq_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # These commits are not particularly principled 5 | 6 | # checkout Coq to 5c7f0150dd555e22b0830d9ca93b8aee5dff4d4c 7 | cd /root 8 | # git clone https://github.com/coq/coq.git 9 | git clone https://github.com/JasonGross/coq.git 10 | # (cd /root/coq && git checkout 5c7f0150dd555e22b0830d9ca93b8aee5dff4d4c) 11 | (cd /root/coq && git checkout unset-universe-checking-qsort) 12 | 13 | # checkout vscoq to d5629060e60dc5951dbf5a9c8e446254f667c5d2 14 | git clone https://github.com/coq/vscoq.git 15 | (cd /root/vscoq && git checkout d5629060e60dc5951dbf5a9c8e446254f667c5d2) 16 | 17 | # passing -n allows pinning multiple repositories simultaneously before installing any of them so that there is less risk of version conflicts 18 | opam pin add -yn --kind=path /root/coq 19 | opam pin add -yn --kind=path /root/vscoq/language-server 20 | opam pin add -yn menhir 20240715 21 | opam pin add -yn ocamlformat 0.27.0 22 | opam install -y coq vscoq-language-server coq-dpdgraph menhir ocamlformat 23 | -------------------------------------------------------------------------------- /iso-checker/Makefile: -------------------------------------------------------------------------------- 1 | # KNOWNTARGETS will not be passed along to CoqMakefile 2 | KNOWNTARGETS := Makefile.coq 3 | # KNOWNFILES will not get implicit targets from the final rule, and so 4 | # depending on them won't invoke the submake 5 | # Warning: These files get declared as PHONY, so any targets depending 6 | # on them always get rebuilt 7 | KNOWNFILES := Makefile _CoqProject 8 | 9 | .DEFAULT_GOAL := invoke-coqmakefile 10 | 11 | Makefile.coq: Makefile _CoqProject 12 | $(COQBIN)coq_makefile -f _CoqProject -o $@ 13 | 14 | invoke-coqmakefile: Makefile.coq 15 | $(MAKE) --no-print-directory -f Makefile.coq $(filter-out $(KNOWNTARGETS),$(MAKECMDGOALS)) 16 | 17 | .PHONY: invoke-coqmakefile $(KNOWNFILES) 18 | 19 | #################################################################### 20 | ## Your targets here ## 21 | #################################################################### 22 | 23 | # This should be the last rule, to handle any targets not declared above 24 | %: invoke-coqmakefile 25 | @true -------------------------------------------------------------------------------- /src/dataset/raw_data/vfa/test_searchtree.ml: -------------------------------------------------------------------------------- 1 | let test (f: int -> int) (n: int) = 2 | let rec build (j, t) = if j=0 then t 3 | else build(j-1, insert (f j) 1 t) 4 | in let t1 = build(n,empty_tree) 5 | in let rec g (j,count) = if j=0 then count 6 | else if lookup 0 (f j) t1 = 1 7 | then g(j-1,count+1) 8 | else g(j-1,count) 9 | in let start = Sys.time() 10 | in let answer = g(n,0) 11 | in (answer, Sys.time() -. start) 12 | 13 | let print_test name (f: int -> int) n = 14 | let (answer, time) = test f n 15 | in (print_string "Insert and lookup "; print_int n; 16 | print_string " "; print_string name; print_string " integers in "; 17 | print_float time; print_endline " seconds.") 18 | 19 | let test_random n = print_test "random" (fun _ -> Random.int n) n 20 | let test_consec n = print_test "consecutive" (fun i -> n-i) n 21 | 22 | let run_tests() = (test_random 1000000; test_random 20000; test_consec 20000) 23 | 24 | let _ = run_tests () 25 | -------------------------------------------------------------------------------- /src/dataset/raw_data/slf/Makefile: -------------------------------------------------------------------------------- 1 | COQMFFLAGS := -Q . SLF -arg "-w -implicit-core-hint-db,-ambiguous-paths,-notation-incompatible-prefix,-automatic-prop-lowering" 2 | 3 | ALLVFILES := LibAxioms.v LibTactics.v LibEqual.v LibLogic.v LibOperation.v LibBool.v LibReflect.v LibProd.v LibSum.v LibRelation.v LibOrder.v LibNat.v LibEpsilon.v LibInt.v LibMonoid.v LibContainer.v LibOption.v LibWf.v LibList.v LibListExec.v LibListZ.v LibMin.v LibSet.v LibChoice.v LibUnit.v LibFun.v LibString.v LibMultiset.v LibCore.v LibSepTLCbuffer.v LibSepFmap.v LibSepVar.v LibSepSimpl.v LibSepMinimal.v LibSepReference.v Preface.v Basic.v Repr.v Hprop.v Himpl.v Triples.v Rules.v Wand.v WPsem.v WPgen.v WPsound.v Affine.v Arrays.v Records.v Postscript.v Bib.v 4 | 5 | build: Makefile.coq 6 | $(MAKE) -f Makefile.coq 7 | 8 | clean:: 9 | if [ -e Makefile.coq ]; then $(MAKE) -f Makefile.coq cleanall; fi 10 | $(RM) $(wildcard Makefile.coq Makefile.coq.conf) 11 | 12 | Makefile.coq: 13 | coq_makefile $(COQMFFLAGS) -o Makefile.coq $(ALLVFILES) 14 | 15 | -include Makefile.coq 16 | 17 | .PHONY: build clean 18 | -------------------------------------------------------------------------------- /src/dataset/pre_processed_data/Extraction.v: -------------------------------------------------------------------------------- 1 | From Coq Require Extraction. 2 | Extraction Language OCaml. 3 | 4 | From Coq Require Import Arith. 5 | 6 | From Coq Require Import Init.Nat. 7 | 8 | From Coq Require Import EqNat. 9 | 10 | From LF Require Import ImpCEvalFun. 11 | 12 | 13 | 14 | Extraction "imp1.ml" ceval_step. 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | Extract Inductive bool => "bool" [ "true" "false" ]. 24 | 25 | 26 | 27 | Extract Inductive nat => "int" 28 | [ "0" "(fun x -> x + 1)" ] 29 | "(fun zero succ n -> 30 | if n=0 then zero () else succ (n-1))". 31 | 32 | 33 | 34 | Extract Constant plus => "( + )". 35 | Extract Constant mult => "( * )". 36 | Extract Constant eqb => "( = )". 37 | 38 | 39 | 40 | Extraction "imp2.ml" ceval_step. 41 | 42 | Require Import ExtrOcamlBasic. 43 | 44 | Require Import ExtrOcamlString. 45 | 46 | 47 | 48 | Extract Inductive sumbool => "bool" ["true" "false"]. 49 | 50 | From LF Require Import Imp. 51 | 52 | From LF Require Import ImpParser. 53 | 54 | From LF Require Import Maps. 55 | Extraction "imp.ml" empty_st ceval_step parse. 56 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vfa/searchtree.ml: -------------------------------------------------------------------------------- 1 | 2 | type key = int 3 | 4 | type 'v tree = 5 | | E 6 | | T of 'v tree * key * 'v * 'v tree 7 | 8 | (** val empty_tree : 'a1 tree **) 9 | 10 | let empty_tree = 11 | E 12 | 13 | (** val lookup : 'a1 -> key -> 'a1 tree -> 'a1 **) 14 | 15 | let rec lookup default x = function 16 | | E -> default 17 | | T (l, k, v, r) -> 18 | if ( < ) x k 19 | then lookup default x l 20 | else if ( < ) k x then lookup default x r else v 21 | 22 | (** val insert : key -> 'a1 -> 'a1 tree -> 'a1 tree **) 23 | 24 | let rec insert x v = function 25 | | E -> T (E, x, v, E) 26 | | T (l, y, v', r) -> 27 | if ( < ) x y 28 | then T ((insert x v l), y, v', r) 29 | else if ( < ) y x then T (l, y, v', (insert x v r)) else T (l, x, v, r) 30 | 31 | (** val elements_aux : 'a1 tree -> (key * 'a1) list -> (key * 'a1) list **) 32 | 33 | let rec elements_aux t acc = 34 | match t with 35 | | E -> acc 36 | | T (l, k, v, r) -> elements_aux l ((k , v)::(elements_aux r acc)) 37 | 38 | (** val elements : 'a1 tree -> (key * 'a1) list **) 39 | 40 | let elements t = 41 | elements_aux t [] 42 | -------------------------------------------------------------------------------- /src/dataset/raw_data/lf/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2024 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /src/dataset/raw_data/plf/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2024 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /src/dataset/raw_data/qc/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2024 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /src/dataset/raw_data/slf/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2024 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vc/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2023 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vfa/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2024 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Jason Gross 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/dataset/raw_data/lf/impdriver.ml: -------------------------------------------------------------------------------- 1 | open Imp 2 | 3 | let explode s = 4 | let rec exp i l = 5 | if i < 0 then l else exp (i - 1) (s.[i] :: l) in 6 | exp (String.length s - 1) [];; 7 | 8 | let test s = 9 | print_newline(); 10 | print_endline ("Propgram: " ^ s); 11 | let parse_res = parse (explode s) in 12 | (match parse_res with 13 | NoneE _ -> print_endline ("Syntax error"); 14 | | SomeE c -> 15 | let fuel = 1000 in 16 | match (ceval_step empty_st c fuel) with 17 | None -> 18 | print_endline 19 | ("Still running after " ^ string_of_int fuel ^ " steps") 20 | | Some res -> 21 | print_endline ( 22 | "Result: [" 23 | ^ string_of_int (res ['w']) ^ " " 24 | ^ string_of_int (res ['x']) ^ " " 25 | ^ string_of_int (res ['y']) ^ " " 26 | ^ string_of_int (res ['z']) ^ " ...]")) 27 | ;; 28 | 29 | test "x:=1 ; y:=2";; 30 | 31 | test "true";; (* syntax error *) 32 | test "skip";; 33 | test "skip;skip";; 34 | test "while true do skip end";; 35 | test "x:=3";; 36 | test "x:=3; while 0<=x do skip end";; 37 | test "x:=3; while 1<=x do y:=y+1; x:=x-1 end";; 38 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vc/strlib.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | size_t strlen(const char *str) { 4 | size_t i; 5 | for (i=0; ; i++) 6 | if (str[i]==0) return i; 7 | } 8 | 9 | char *strchr(const char *str, int c) { 10 | size_t i; 11 | for(i = 0;; i++){ 12 | char d = str[i]; 13 | if(d == c) return (str + i); 14 | if(d == 0) return 0; 15 | } 16 | } 17 | 18 | char *strcpy(char *dest, const char *src) { 19 | size_t i; 20 | for(i = 0;; i++){ 21 | char d = src[i]; 22 | dest[i] = d; 23 | if(d == 0) return dest; 24 | } 25 | } 26 | 27 | char *strcat(char *dest, const char *src) { 28 | size_t i,j; char d; 29 | for(i = 0;; i++){ 30 | d = dest[i]; 31 | if(d == 0) break; 32 | } 33 | for(j = 0;; j++){ 34 | d = src[j]; 35 | dest[i + j] = d; 36 | if(d == 0) return dest; 37 | } 38 | } 39 | 40 | int strcmp(const char *str1, const char *str2) { 41 | size_t i; 42 | for(i = 0;; i++){ 43 | char d1 = str1[i]; 44 | char d2 = str2[i]; 45 | if(d1 == 0 && d2 == 0) return 0; 46 | else if(d1 < d2) return -1; 47 | else if(d1 > d2) return 1; 48 | } 49 | } 50 | 51 | int example_call_strcpy(void) { 52 | char buf[10]; 53 | strcpy(buf,"Hello"); 54 | return buf[0]; 55 | } 56 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | Jacob Green Jacob Green 2 | Jacob Green Jacob Green 3 | Jacob Green jjacobgreen <44466997+jjacobgreen@users.noreply.github.com> 4 | Jason Gross Jason Gross 5 | Jason Gross Jason Gross 6 | Rajashree Agrawal Rajashree Agrawal 7 | Shiki Vaahan Shiki Mahesh Devan Shiki Mahesh Devan 8 | Shiki Vaahan Shiki Vaahan 9 | Twm Stone <24829306+Cloakless@users.noreply.github.com> Cloakless <24829306+Cloakless@users.noreply.github.com> 10 | Vishesh Saraswat Vishesh Saraswat <67602359+vishesh312@users.noreply.github.com> 11 | Vishesh Saraswat Vishesh Saraswat 12 | -------------------------------------------------------------------------------- /src/dataset/raw_data/lf/Bib.v: -------------------------------------------------------------------------------- 1 | (** * Bib: Bibliography *) 2 | 3 | (* ################################################################# *) 4 | (** * Resources cited in this volume *) 5 | 6 | (** 7 | 8 | [Bertot 2004] Interactive Theorem Proving and Program Development: 9 | Coq'Art: The Calculus of Inductive Constructions, by Yves Bertot and 10 | Pierre Casteran. Springer-Verlag, 2004. 11 | {https://tinyurl.com/z3o7nqu} 12 | 13 | [Chlipala 2013] Certified Programming with Dependent Types, by 14 | Adam Chlipala. MIT Press. 2013. {https://tinyurl.com/zqdnyg2} 15 | 16 | [Lipovaca 2011] Learn You a Haskell for Great Good! A Beginner's 17 | Guide, by Miran Lipovaca, No Starch Press, April 2011. 18 | {http://learnyouahaskell.com} 19 | 20 | [O'Sullivan 2008] Bryan O'Sullivan, John Goerzen, and Don Stewart: 21 | Real world Haskell - code you can believe in. O'Reilly 22 | 2008. {http://book.realworldhaskell.org} 23 | 24 | [Pugh 1991] Pugh, William. "The Omega test: a fast and practical 25 | integer programming algorithm for dependence analysis." Proceedings 26 | of the 1991 ACM/IEEE conference on Supercomputing. ACM, 1991. 27 | {https://dl.acm.org/citation.cfm?id=125848} 28 | 29 | [Wadler 2015] Philip Wadler. "Propositions as types." 30 | Communications of the ACM 58, no. 12 (2015): 75-84. 31 | {https://dl.acm.org/citation.cfm?id=2699407} 32 | 33 | *) 34 | 35 | (* 2024-12-25 16:46 *) 36 | -------------------------------------------------------------------------------- /src/dataset/raw_data/lf/imp2.mli: -------------------------------------------------------------------------------- 1 | 2 | val negb : bool -> bool 3 | 4 | type 'a option = 5 | | Some of 'a 6 | | None 7 | 8 | val eqb : bool -> bool -> bool 9 | 10 | module Nat : 11 | sig 12 | val add : int -> int -> int 13 | 14 | val mul : int -> int -> int 15 | 16 | val sub : int -> int -> int 17 | 18 | val eqb : int -> int -> bool 19 | 20 | val leb : int -> int -> bool 21 | end 22 | 23 | type ascii = 24 | | Ascii of bool * bool * bool * bool * bool * bool * bool * bool 25 | 26 | val eqb0 : ascii -> ascii -> bool 27 | 28 | type string = 29 | | EmptyString 30 | | String of ascii * string 31 | 32 | val eqb1 : string -> string -> bool 33 | 34 | type 'a total_map = string -> 'a 35 | 36 | val t_update : 'a1 total_map -> string -> 'a1 -> string -> 'a1 37 | 38 | type state = int total_map 39 | 40 | type aexp = 41 | | ANum of int 42 | | AId of string 43 | | APlus of aexp * aexp 44 | | AMinus of aexp * aexp 45 | | AMult of aexp * aexp 46 | 47 | type bexp = 48 | | BTrue 49 | | BFalse 50 | | BEq of aexp * aexp 51 | | BNeq of aexp * aexp 52 | | BLe of aexp * aexp 53 | | BGt of aexp * aexp 54 | | BNot of bexp 55 | | BAnd of bexp * bexp 56 | 57 | val aeval : state -> aexp -> int 58 | 59 | val beval : state -> bexp -> bool 60 | 61 | type com = 62 | | CSkip 63 | | CAsgn of string * aexp 64 | | CSeq of com * com 65 | | CIf of bexp * com * com 66 | | CWhile of bexp * com 67 | 68 | val ceval_step : state -> com -> int -> state option 69 | -------------------------------------------------------------------------------- /src/tasks/coq_complete_from_file.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | 3 | from inspect_ai import Task, eval, task 4 | from inspect_ai.solver import generate, system_message, use_tools 5 | 6 | from dataset.prepare import format_translation_input, prepare_dataset 7 | from models import AnthropicModel, OpenAIModel 8 | from prompts.completion import ALTERNATE_SYSTEM_MESSAGE, COQ_STATEMENTS 9 | from scorers.completion import coq_proven_scorer, coq_runs_scorer 10 | from tools.itp import coq_run_tool 11 | from tools.submission import coq_submit_tool, sample_definitions, sample_interface 12 | 13 | EXAMPLE_COQ_FILEPATH = Path(__file__).parent.parent / "simple-tests" / "incomplete.v" 14 | 15 | 16 | @task 17 | def coq_completion(): 18 | # dataset 19 | input_msg = format_translation_input(COQ_STATEMENTS, EXAMPLE_COQ_FILEPATH) 20 | dataset = prepare_dataset([input_msg]) 21 | 22 | # define task 23 | return Task( 24 | dataset=dataset, 25 | solver=[ 26 | system_message(ALTERNATE_SYSTEM_MESSAGE), 27 | use_tools( 28 | coq_run_tool(), 29 | coq_submit_tool( 30 | interface_file_contents=sample_interface, 31 | definitions=sample_definitions, 32 | ), 33 | ), 34 | generate(), 35 | ], 36 | scorer=coq_proven_scorer(), 37 | ) 38 | 39 | 40 | if __name__ == "__main__": 41 | eval(coq_completion(), model=OpenAIModel.BEST, message_limit=20) 42 | pass 43 | -------------------------------------------------------------------------------- /src/dataset/raw_data/lf/imp1.mli: -------------------------------------------------------------------------------- 1 | 2 | type bool = 3 | | True 4 | | False 5 | 6 | val negb : bool -> bool 7 | 8 | type nat = 9 | | O 10 | | S of nat 11 | 12 | type 'a option = 13 | | Some of 'a 14 | | None 15 | 16 | val eqb : bool -> bool -> bool 17 | 18 | module Nat : 19 | sig 20 | val add : nat -> nat -> nat 21 | 22 | val mul : nat -> nat -> nat 23 | 24 | val sub : nat -> nat -> nat 25 | 26 | val eqb : nat -> nat -> bool 27 | 28 | val leb : nat -> nat -> bool 29 | end 30 | 31 | type ascii = 32 | | Ascii of bool * bool * bool * bool * bool * bool * bool * bool 33 | 34 | val eqb0 : ascii -> ascii -> bool 35 | 36 | type string = 37 | | EmptyString 38 | | String of ascii * string 39 | 40 | val eqb1 : string -> string -> bool 41 | 42 | type 'a total_map = string -> 'a 43 | 44 | val t_update : 'a1 total_map -> string -> 'a1 -> string -> 'a1 45 | 46 | type state = nat total_map 47 | 48 | type aexp = 49 | | ANum of nat 50 | | AId of string 51 | | APlus of aexp * aexp 52 | | AMinus of aexp * aexp 53 | | AMult of aexp * aexp 54 | 55 | type bexp = 56 | | BTrue 57 | | BFalse 58 | | BEq of aexp * aexp 59 | | BNeq of aexp * aexp 60 | | BLe of aexp * aexp 61 | | BGt of aexp * aexp 62 | | BNot of bexp 63 | | BAnd of bexp * bexp 64 | 65 | val aeval : state -> aexp -> nat 66 | 67 | val beval : state -> bexp -> bool 68 | 69 | type com = 70 | | CSkip 71 | | CAsgn of string * aexp 72 | | CSeq of com * com 73 | | CIf of bexp * com * com 74 | | CWhile of bexp * com 75 | 76 | val ceval_step : state -> com -> nat -> state option 77 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vc/stack.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern void * malloc (size_t n); 4 | extern void free (void *p); 5 | extern void exit(int n); 6 | 7 | struct cons { 8 | int value; 9 | struct cons *next; 10 | }; 11 | 12 | struct stack { 13 | struct cons *top; 14 | }; 15 | 16 | /* Verification of the first 3 functions is in Verif_stack.v */ 17 | 18 | struct stack *newstack(void) { 19 | struct stack *p; 20 | p = (struct stack *) malloc (sizeof (struct stack)); 21 | if (!p) exit(1); 22 | p->top = NULL; 23 | return p; 24 | } 25 | 26 | void push (struct stack *p, int i) { 27 | struct cons *q; 28 | q = (struct cons *) malloc (sizeof (struct cons)); 29 | if (!q) exit(1); 30 | q->value = i; 31 | q->next = p->top; 32 | p->top = q; 33 | } 34 | 35 | int pop (struct stack *p) { 36 | struct cons *q; 37 | int i; 38 | q = p->top; 39 | p->top = q->next; 40 | i = q->value; 41 | free(q); 42 | return i; 43 | } 44 | 45 | /* Verification of the next 3 functions is in Verif_triang.v */ 46 | 47 | void push_increasing (struct stack *st, int n) { 48 | int i; 49 | i=0; 50 | while (i SProp 10 | := eq_refl : eq a a. 11 | (* Notation "x = y" := (eq x y) : lean_scope. *) 12 | #[local] Notation "x = y" := (eq x y) : type_scope. 13 | #[export] 14 | Hint Resolve eq_refl: core. 15 | Arguments eq {α} a _. 16 | Arguments eq_refl {α a} , [α] a. 17 | 18 | Arguments eq_ind [α] a P _ y _ : rename. 19 | Arguments eq_rec [α] a P _ y _ : rename. 20 | Arguments eq_rect [α] a P _ y _ : rename. 21 | 22 | Inductive sFalse : SProp := . 23 | Definition not@{u|s|} (A : Type@{u|s}) := A -> sFalse. 24 | #[local] Notation "x <> y" := (not@{SProp|Set} (eq x y)) : type_scope. 25 | 26 | From Stdlib Require Import CMorphisms. 27 | #[export] 28 | Set Implicit Arguments. 29 | Cumulative Record Iso@{s s'|u u'|} (A : Type@{s|u}) (B : Type@{s'|u'}) := { 30 | to :> A -> B; 31 | from : B -> A; 32 | to_from : forall x, to (from x) = x; 33 | from_to : forall x, from (to x) = x; 34 | }. 35 | 36 | Definition rel_iso@{s s'|u u'|} {A B} (i : Iso@{s s'|u u'} A B) : A -> B -> _ := fun x y => i.(to) x = y. 37 | 38 | Existing Class Iso. 39 | Existing Class rel_iso. 40 | 41 | (* Record IsoSProp (A : Prop) (B : SProp) := { to' : A -> B ; from' : B -> A }. 42 | Notation iff A B := (and (A -> B) (B -> A)) (only parsing). *) 43 | -------------------------------------------------------------------------------- /src/dataset/raw_data/plf/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the 2 | // README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu 3 | { 4 | "name": "Ubuntu", 5 | // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile 6 | "build": { 7 | "dockerfile": "Dockerfile" 8 | }, 9 | 10 | // Features to add to the dev container. More info: https://containers.dev/features. 11 | // "features": {}, 12 | 13 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 14 | // "forwardPorts": [], 15 | 16 | // Use 'postCreateCommand' to run commands after the container is created. 17 | // "postCreateCommand": "uname -a", 18 | 19 | // Configure tool-specific properties. 20 | "customizations": { 21 | "vscode": { 22 | "extensions": [ 23 | "maximedenes.vscoq" 24 | ], 25 | "settings": { 26 | "coqtop.binPath" : "/home/cis5000/.opam/4.14.0/bin", 27 | "files.exclude": { 28 | "**/*.aux": true, 29 | "**/*.glob": true, 30 | "**/*.vo": true, 31 | "**/*.vos": true, 32 | "**/*.vok": true, 33 | "**/*.html": true, 34 | "**/.*.report": true, 35 | "**/.*.cache": true 36 | }, 37 | "coq.loadCoqProject": true, 38 | "coq.coqProjectRoot": ".", 39 | "[coq]": { 40 | "editor.tabSize": 2, 41 | "editor.insertSpaces": true 42 | } 43 | } 44 | } 45 | } 46 | 47 | // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. 48 | // "remoteUser": "root" 49 | } 50 | -------------------------------------------------------------------------------- /src/dataset/raw_data/qc/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the 2 | // README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu 3 | { 4 | "name": "Ubuntu", 5 | // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile 6 | "build": { 7 | "dockerfile": "Dockerfile" 8 | }, 9 | 10 | // Features to add to the dev container. More info: https://containers.dev/features. 11 | // "features": {}, 12 | 13 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 14 | // "forwardPorts": [], 15 | 16 | // Use 'postCreateCommand' to run commands after the container is created. 17 | // "postCreateCommand": "uname -a", 18 | 19 | // Configure tool-specific properties. 20 | "customizations": { 21 | "vscode": { 22 | "extensions": [ 23 | "maximedenes.vscoq" 24 | ], 25 | "settings": { 26 | "coqtop.binPath" : "/home/cis5000/.opam/4.14.0/bin", 27 | "files.exclude": { 28 | "**/*.aux": true, 29 | "**/*.glob": true, 30 | "**/*.vo": true, 31 | "**/*.vos": true, 32 | "**/*.vok": true, 33 | "**/*.html": true, 34 | "**/.*.report": true, 35 | "**/.*.cache": true 36 | }, 37 | "coq.loadCoqProject": true, 38 | "coq.coqProjectRoot": ".", 39 | "[coq]": { 40 | "editor.tabSize": 2, 41 | "editor.insertSpaces": true 42 | } 43 | } 44 | } 45 | } 46 | 47 | // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. 48 | // "remoteUser": "root" 49 | } 50 | -------------------------------------------------------------------------------- /src/dataset/raw_data/slf/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the 2 | // README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu 3 | { 4 | "name": "Ubuntu", 5 | // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile 6 | "build": { 7 | "dockerfile": "Dockerfile" 8 | }, 9 | 10 | // Features to add to the dev container. More info: https://containers.dev/features. 11 | // "features": {}, 12 | 13 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 14 | // "forwardPorts": [], 15 | 16 | // Use 'postCreateCommand' to run commands after the container is created. 17 | // "postCreateCommand": "uname -a", 18 | 19 | // Configure tool-specific properties. 20 | "customizations": { 21 | "vscode": { 22 | "extensions": [ 23 | "maximedenes.vscoq" 24 | ], 25 | "settings": { 26 | "coqtop.binPath" : "/home/cis5000/.opam/4.14.0/bin", 27 | "files.exclude": { 28 | "**/*.aux": true, 29 | "**/*.glob": true, 30 | "**/*.vo": true, 31 | "**/*.vos": true, 32 | "**/*.vok": true, 33 | "**/*.html": true, 34 | "**/.*.report": true, 35 | "**/.*.cache": true 36 | }, 37 | "coq.loadCoqProject": true, 38 | "coq.coqProjectRoot": ".", 39 | "[coq]": { 40 | "editor.tabSize": 2, 41 | "editor.insertSpaces": true 42 | } 43 | } 44 | } 45 | } 46 | 47 | // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. 48 | // "remoteUser": "root" 49 | } 50 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vfa/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the 2 | // README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu 3 | { 4 | "name": "Ubuntu", 5 | // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile 6 | "build": { 7 | "dockerfile": "Dockerfile" 8 | }, 9 | 10 | // Features to add to the dev container. More info: https://containers.dev/features. 11 | // "features": {}, 12 | 13 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 14 | // "forwardPorts": [], 15 | 16 | // Use 'postCreateCommand' to run commands after the container is created. 17 | // "postCreateCommand": "uname -a", 18 | 19 | // Configure tool-specific properties. 20 | "customizations": { 21 | "vscode": { 22 | "extensions": [ 23 | "maximedenes.vscoq" 24 | ], 25 | "settings": { 26 | "coqtop.binPath" : "/home/cis5000/.opam/4.14.0/bin", 27 | "files.exclude": { 28 | "**/*.aux": true, 29 | "**/*.glob": true, 30 | "**/*.vo": true, 31 | "**/*.vos": true, 32 | "**/*.vok": true, 33 | "**/*.html": true, 34 | "**/.*.report": true, 35 | "**/.*.cache": true 36 | }, 37 | "coq.loadCoqProject": true, 38 | "coq.coqProjectRoot": ".", 39 | "[coq]": { 40 | "editor.tabSize": 2, 41 | "editor.insertSpaces": true 42 | } 43 | } 44 | } 45 | } 46 | 47 | // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. 48 | // "remoteUser": "root" 49 | } 50 | -------------------------------------------------------------------------------- /src/dataset/raw_data/plf/Bib.v: -------------------------------------------------------------------------------- 1 | (** * Bib: Bibliography *) 2 | 3 | (* ################################################################# *) 4 | (** * Resources cited in this volume *) 5 | 6 | (** 7 | 8 | [Aydemir 2008] Brian Aydemir, Arthur Charguéraud, Benjamin 9 | C. Pierce, Randy Pollack, and Stephanie Weirich. Engineering Formal 10 | Metatheory. In ACM SIGPLAN-SIGACT Symposium on Principles of 11 | Programming Languages (POPL), San Francisco, California, pages 12 | 3-15. ACM, January 2008. 13 | {https://www.cis.upenn.edu/~bcpierce/papers/binders.pdf} 14 | 15 | [Harper 2015] Practical Foundations for Programming Languages, by 16 | Robert Harper. Cambridge University Press. Second edition, 2016. 17 | {https://tinyurl.com/z82xwta} 18 | 19 | [Mitchell 1996] Foundations for Programming Languages, by John 20 | C. Mitchell. MIT Press, 1996. {https://tinyurl.com/zkosavw} 21 | 22 | [Nipkow 2014] Concrete Semantics with Isabelle/HOL, by Tobias 23 | Nipkow and Gerwin Klein. Springer 2014. 24 | {http://www.concrete-semantics.org} 25 | 26 | [Pierce 2002] Types and Programming Languages, by Benjamin 27 | C. Pierce. MIT Press, 2002. {https://tinyurl.com/gtnudmu} 28 | 29 | [Pugh 1991] Pugh, William. "The Omega test: a fast and practical 30 | integer programming algorithm for dependence analysis." Proceedings 31 | of the 1991 ACM/IEEE conference on Supercomputing. ACM, 1991. 32 | {https://dl.acm.org/citation.cfm?id=125848} 33 | 34 | [Winskel 1993] The Formal Semantics of Programming Languages: An 35 | Introduction, by Glynn Winskel. MIT Press, 1993. 36 | {https://tinyurl.com/j2k6ev7} 37 | 38 | *) 39 | 40 | (** $Date$ *) 41 | 42 | (* 2024-12-25 17:02 *) 43 | -------------------------------------------------------------------------------- /src/utils/__init__.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import subprocess 3 | import sys 4 | from pathlib import Path 5 | from typing import Iterable, Optional, Sequence, TypeVar 6 | 7 | # Simple logging setup 8 | logging.basicConfig( 9 | level=logging.DEBUG, 10 | format="%(asctime)s - %(levelname)s - %(message)s", 11 | filename="autoformalization.log", 12 | ) 13 | 14 | # Add console handler with INFO level 15 | console_handler = logging.StreamHandler(sys.stdout) 16 | console_handler.setLevel(logging.INFO) # Only show INFO and higher 17 | console_handler.setFormatter(logging.Formatter("%(levelname)s - %(message)s")) 18 | logging.getLogger().addHandler(console_handler) 19 | 20 | 21 | def run_cmd(cmd: str | list[str], shell=True, check=True, streaming=False): 22 | """Run subprocess command and log it""" 23 | assert isinstance(cmd, str) or not shell, "cmd must be a string if shell=True" 24 | logging.debug(f"Running: {cmd}") 25 | result = subprocess.run( 26 | cmd, shell=shell, check=check, text=True, capture_output=not streaming 27 | ) 28 | logging.debug(f"Output: {result.stdout}") 29 | if result.stderr: 30 | logging.debug(f"Stderr: {result.stderr}") 31 | return result 32 | 33 | 34 | def backup(filename: str | Path, ext: str = ".bak") -> Optional[Path]: 35 | filename = Path(filename) 36 | assert ext != "" 37 | backup_name = filename.with_suffix(filename.suffix + ext) 38 | if filename.exists(): 39 | if backup_name.exists(): 40 | backup(backup_name, ext=ext) 41 | assert not backup_name.exists() 42 | filename.rename(backup_name) 43 | return backup_name 44 | return None 45 | -------------------------------------------------------------------------------- /src/scorers/completion.py: -------------------------------------------------------------------------------- 1 | from inspect_ai.scorer import ( 2 | CORRECT, 3 | INCORRECT, 4 | Score, 5 | Target, 6 | accuracy, 7 | scorer, 8 | ) 9 | from inspect_ai.solver import TaskState 10 | from inspect_ai.util import Store 11 | import inspect_ai.util 12 | 13 | from run_itp import run_coq_str_in_project 14 | 15 | 16 | @scorer(metrics=[accuracy()]) 17 | def coq_proven_scorer(): 18 | async def score(state: TaskState, target: Target | None): 19 | store = state.store if state.store else inspect_ai.util.store() 20 | cur_index = store.get("cur_index", 0) 21 | if cur_index == 0: 22 | return Score(value=INCORRECT, explanation="No submission results found") 23 | for i in range(cur_index): 24 | result = store.get(f"result_{i}") 25 | if result["submission_status"]: 26 | return Score(value=CORRECT) 27 | return Score( 28 | value=INCORRECT, 29 | explanation="No correct submission found, total submissions: {cur_index}", 30 | ) 31 | 32 | return score 33 | 34 | 35 | @scorer(metrics=[accuracy()]) 36 | def coq_runs_scorer(): 37 | async def score(state: TaskState, target: Target | None): 38 | answer = state.output.completion 39 | try: 40 | answer = answer[answer.find("```coq") + 6 : answer.rfind("```")] 41 | result = run_coq_str_in_project(answer) 42 | correct = result["status"] == 0 43 | except Exception as e: 44 | return Score(value=INCORRECT, explanation=f"Error running Coq code: {e}") 45 | return Score( 46 | value=CORRECT if correct else INCORRECT, 47 | ) 48 | 49 | return score 50 | -------------------------------------------------------------------------------- /src/dataset/raw_data/lf/.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | 3 | ## BEGIN: RUNS AS ROOT 4 | 5 | # Create a user 6 | 7 | ARG USERNAME=cis5000 8 | ARG USER_UID=1000 9 | ARG USER_GID=$USER_UID 10 | 11 | RUN apt-get update -y 12 | 13 | RUN groupadd --gid $USER_GID $USERNAME \ 14 | && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME --shell /bin/zsh \ 15 | # 16 | # [Optional] Add sudo support. Omit if you don't need to install software after connecting. 17 | && apt-get install -y sudo \ 18 | && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ 19 | && chmod 0440 /etc/sudoers.d/$USERNAME 20 | 21 | ## Hack needs root permissions 22 | 23 | # See hack.sh 24 | COPY hack.sh /tmp/hack.sh 25 | RUN chmod +x /tmp/hack.sh 26 | RUN /tmp/hack.sh 27 | 28 | RUN apt-get install -y build-essential 29 | RUN apt-get install -y linux-libc-dev 30 | RUN apt-get install -y m4 31 | RUN apt-get install -y opam 32 | RUN apt-get install -y time 33 | RUN apt-get install -y zip 34 | RUN apt-get install -y zsh 35 | RUN apt-get install -y libgmp3-dev 36 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y pkg-config 37 | 38 | ## Set up user environmnent 39 | COPY .zshrc /home/$USERNAME/ 40 | 41 | 42 | ## Run in usermode 43 | 44 | # [Optional] Set the default user. Omit if you want to keep the default as root. 45 | USER $USERNAME 46 | 47 | # Configure opam/ocaml 48 | RUN opam init -y --disable-sandboxing --compiler=4.14.0 49 | RUN opam switch 4.14.0 50 | RUN opam install -y num 51 | RUN opam repo add -y coq-released https://coq.inria.fr/opam/released 52 | RUN opam pin add -y coq 8.19.1 53 | RUN opam install -y coq-simple-io 54 | RUN opam install -y vscoq-language-server 55 | RUN opam update -y 56 | RUN opam upgrade -y 57 | RUN eval `opam config env` 58 | 59 | -------------------------------------------------------------------------------- /src/dataset/raw_data/plf/.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | 3 | ## BEGIN: RUNS AS ROOT 4 | 5 | # Create a user 6 | 7 | ARG USERNAME=cis5000 8 | ARG USER_UID=1000 9 | ARG USER_GID=$USER_UID 10 | 11 | RUN apt-get update -y 12 | 13 | RUN groupadd --gid $USER_GID $USERNAME \ 14 | && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME --shell /bin/zsh \ 15 | # 16 | # [Optional] Add sudo support. Omit if you don't need to install software after connecting. 17 | && apt-get install -y sudo \ 18 | && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ 19 | && chmod 0440 /etc/sudoers.d/$USERNAME 20 | 21 | ## Hack needs root permissions 22 | 23 | # See hack.sh 24 | COPY hack.sh /tmp/hack.sh 25 | RUN chmod +x /tmp/hack.sh 26 | RUN /tmp/hack.sh 27 | 28 | RUN apt-get install -y build-essential 29 | RUN apt-get install -y linux-libc-dev 30 | RUN apt-get install -y m4 31 | RUN apt-get install -y opam 32 | RUN apt-get install -y time 33 | RUN apt-get install -y zip 34 | RUN apt-get install -y zsh 35 | RUN apt-get install -y libgmp3-dev 36 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y pkg-config 37 | 38 | ## Set up user environmnent 39 | COPY .zshrc /home/$USERNAME/ 40 | 41 | 42 | ## Run in usermode 43 | 44 | # [Optional] Set the default user. Omit if you want to keep the default as root. 45 | USER $USERNAME 46 | 47 | # Configure opam/ocaml 48 | RUN opam init -y --disable-sandboxing --compiler=4.14.0 49 | RUN opam switch 4.14.0 50 | RUN opam install -y num 51 | RUN opam repo add -y coq-released https://coq.inria.fr/opam/released 52 | RUN opam pin add -y coq 8.19.1 53 | RUN opam install -y coq-simple-io 54 | RUN opam install -y vscoq-language-server 55 | RUN opam update -y 56 | RUN opam upgrade -y 57 | RUN eval `opam config env` 58 | 59 | -------------------------------------------------------------------------------- /src/dataset/raw_data/qc/.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | 3 | ## BEGIN: RUNS AS ROOT 4 | 5 | # Create a user 6 | 7 | ARG USERNAME=cis5000 8 | ARG USER_UID=1000 9 | ARG USER_GID=$USER_UID 10 | 11 | RUN apt-get update -y 12 | 13 | RUN groupadd --gid $USER_GID $USERNAME \ 14 | && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME --shell /bin/zsh \ 15 | # 16 | # [Optional] Add sudo support. Omit if you don't need to install software after connecting. 17 | && apt-get install -y sudo \ 18 | && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ 19 | && chmod 0440 /etc/sudoers.d/$USERNAME 20 | 21 | ## Hack needs root permissions 22 | 23 | # See hack.sh 24 | COPY hack.sh /tmp/hack.sh 25 | RUN chmod +x /tmp/hack.sh 26 | RUN /tmp/hack.sh 27 | 28 | RUN apt-get install -y build-essential 29 | RUN apt-get install -y linux-libc-dev 30 | RUN apt-get install -y m4 31 | RUN apt-get install -y opam 32 | RUN apt-get install -y time 33 | RUN apt-get install -y zip 34 | RUN apt-get install -y zsh 35 | RUN apt-get install -y libgmp3-dev 36 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y pkg-config 37 | 38 | ## Set up user environmnent 39 | COPY .zshrc /home/$USERNAME/ 40 | 41 | 42 | ## Run in usermode 43 | 44 | # [Optional] Set the default user. Omit if you want to keep the default as root. 45 | USER $USERNAME 46 | 47 | # Configure opam/ocaml 48 | RUN opam init -y --disable-sandboxing --compiler=4.14.0 49 | RUN opam switch 4.14.0 50 | RUN opam install -y num 51 | RUN opam repo add -y coq-released https://coq.inria.fr/opam/released 52 | RUN opam pin add -y coq 8.19.1 53 | RUN opam install -y coq-simple-io 54 | RUN opam install -y vscoq-language-server 55 | RUN opam update -y 56 | RUN opam upgrade -y 57 | RUN eval `opam config env` 58 | 59 | -------------------------------------------------------------------------------- /src/dataset/raw_data/slf/.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | 3 | ## BEGIN: RUNS AS ROOT 4 | 5 | # Create a user 6 | 7 | ARG USERNAME=cis5000 8 | ARG USER_UID=1000 9 | ARG USER_GID=$USER_UID 10 | 11 | RUN apt-get update -y 12 | 13 | RUN groupadd --gid $USER_GID $USERNAME \ 14 | && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME --shell /bin/zsh \ 15 | # 16 | # [Optional] Add sudo support. Omit if you don't need to install software after connecting. 17 | && apt-get install -y sudo \ 18 | && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ 19 | && chmod 0440 /etc/sudoers.d/$USERNAME 20 | 21 | ## Hack needs root permissions 22 | 23 | # See hack.sh 24 | COPY hack.sh /tmp/hack.sh 25 | RUN chmod +x /tmp/hack.sh 26 | RUN /tmp/hack.sh 27 | 28 | RUN apt-get install -y build-essential 29 | RUN apt-get install -y linux-libc-dev 30 | RUN apt-get install -y m4 31 | RUN apt-get install -y opam 32 | RUN apt-get install -y time 33 | RUN apt-get install -y zip 34 | RUN apt-get install -y zsh 35 | RUN apt-get install -y libgmp3-dev 36 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y pkg-config 37 | 38 | ## Set up user environmnent 39 | COPY .zshrc /home/$USERNAME/ 40 | 41 | 42 | ## Run in usermode 43 | 44 | # [Optional] Set the default user. Omit if you want to keep the default as root. 45 | USER $USERNAME 46 | 47 | # Configure opam/ocaml 48 | RUN opam init -y --disable-sandboxing --compiler=4.14.0 49 | RUN opam switch 4.14.0 50 | RUN opam install -y num 51 | RUN opam repo add -y coq-released https://coq.inria.fr/opam/released 52 | RUN opam pin add -y coq 8.19.1 53 | RUN opam install -y coq-simple-io 54 | RUN opam install -y vscoq-language-server 55 | RUN opam update -y 56 | RUN opam upgrade -y 57 | RUN eval `opam config env` 58 | 59 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vfa/.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | 3 | ## BEGIN: RUNS AS ROOT 4 | 5 | # Create a user 6 | 7 | ARG USERNAME=cis5000 8 | ARG USER_UID=1000 9 | ARG USER_GID=$USER_UID 10 | 11 | RUN apt-get update -y 12 | 13 | RUN groupadd --gid $USER_GID $USERNAME \ 14 | && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME --shell /bin/zsh \ 15 | # 16 | # [Optional] Add sudo support. Omit if you don't need to install software after connecting. 17 | && apt-get install -y sudo \ 18 | && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ 19 | && chmod 0440 /etc/sudoers.d/$USERNAME 20 | 21 | ## Hack needs root permissions 22 | 23 | # See hack.sh 24 | COPY hack.sh /tmp/hack.sh 25 | RUN chmod +x /tmp/hack.sh 26 | RUN /tmp/hack.sh 27 | 28 | RUN apt-get install -y build-essential 29 | RUN apt-get install -y linux-libc-dev 30 | RUN apt-get install -y m4 31 | RUN apt-get install -y opam 32 | RUN apt-get install -y time 33 | RUN apt-get install -y zip 34 | RUN apt-get install -y zsh 35 | RUN apt-get install -y libgmp3-dev 36 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y pkg-config 37 | 38 | ## Set up user environmnent 39 | COPY .zshrc /home/$USERNAME/ 40 | 41 | 42 | ## Run in usermode 43 | 44 | # [Optional] Set the default user. Omit if you want to keep the default as root. 45 | USER $USERNAME 46 | 47 | # Configure opam/ocaml 48 | RUN opam init -y --disable-sandboxing --compiler=4.14.0 49 | RUN opam switch 4.14.0 50 | RUN opam install -y num 51 | RUN opam repo add -y coq-released https://coq.inria.fr/opam/released 52 | RUN opam pin add -y coq 8.19.1 53 | RUN opam install -y coq-simple-io 54 | RUN opam install -y vscoq-language-server 55 | RUN opam update -y 56 | RUN opam upgrade -y 57 | RUN eval `opam config env` 58 | 59 | -------------------------------------------------------------------------------- /src/solvers/agent.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from enum import StrEnum 3 | 4 | from inspect_ai.model import ( 5 | CachePolicy, 6 | ChatMessageSystem, 7 | ChatMessageUser, 8 | call_tools, 9 | get_model, 10 | ) 11 | from inspect_ai.solver import Generate, Solver, TaskState, chain, solver, system_message 12 | from inspect_ai.tool import Tool 13 | 14 | from solvers.workflows import Workflow 15 | 16 | 17 | @solver 18 | def multiphase_agent( 19 | workflow: Workflow, 20 | cache: bool | CachePolicy = False, 21 | ) -> Solver: 22 | async def solve(state: TaskState, generate: Generate) -> TaskState: 23 | model = get_model() 24 | 25 | for phase in workflow: 26 | # clear the messages at the start of each phase 27 | state.messages = [ 28 | ChatMessageSystem(content=workflow.system_prompt), 29 | ChatMessageUser(content=state.input_text), 30 | ChatMessageUser(content=phase.prompt), 31 | ] 32 | while True: 33 | generation_output = await model.generate( 34 | [ 35 | *state.messages, 36 | ], 37 | tools=workflow.common_tools + phase.tools, 38 | cache=cache, 39 | ) 40 | state.messages.append(generation_output.message) 41 | 42 | if not generation_output.message.tool_calls: 43 | break 44 | 45 | tool_results = await call_tools( 46 | generation_output.message, workflow.common_tools + phase.tools 47 | ) 48 | state.messages.extend(tool_results) 49 | 50 | if state.completed: 51 | break 52 | 53 | return state 54 | 55 | return solve 56 | -------------------------------------------------------------------------------- /src/dataset/raw_data/slf/LibUnit.v: -------------------------------------------------------------------------------- 1 | (* This file is extracted from the TLC library. 2 | http://github.com/charguer/tlc 3 | DO NOT EDIT. *) 4 | 5 | (************************************************************************** 6 | * Product of Data Structures * 7 | **************************************************************************) 8 | 9 | Set Implicit Arguments. 10 | From SLF Require Import LibTactics LibLogic LibReflect. 11 | 12 | (* ********************************************************************** *) 13 | (* ################################################################# *) 14 | (** * Unit type *) 15 | 16 | (* ---------------------------------------------------------------------- *) 17 | (* ================================================================= *) 18 | (** ** Definition *) 19 | 20 | (** From the Prelude. 21 | 22 | Inductive unit : Type := 23 | | tt : unit. 24 | 25 | Add Printing If bool. 26 | Delimit Scope bool_scope with bool. 27 | 28 | *) 29 | 30 | (* ---------------------------------------------------------------------- *) 31 | (* ================================================================= *) 32 | (** ** Inhabited *) 33 | 34 | #[global] 35 | Instance Inhab_unit : Inhab unit. 36 | Proof using. intros. apply (Inhab_of_val tt). Qed. 37 | 38 | (* ********************************************************************** *) 39 | (* ################################################################# *) 40 | (** * Properties *) 41 | 42 | (* ---------------------------------------------------------------------- *) 43 | (* ================================================================= *) 44 | (** ** Uniqueness *) 45 | 46 | Lemma unit_eq : forall (tt1 tt2 : unit), 47 | tt1 = tt2. 48 | Proof using. intros. destruct tt1. destruct~ tt2. Qed. 49 | 50 | 51 | 52 | (* 2024-12-26 10:22 *) 53 | -------------------------------------------------------------------------------- /src/dataset/raw_data/qc/Postscript.v: -------------------------------------------------------------------------------- 1 | (** * Postscript *) 2 | 3 | (* ################################################################# *) 4 | (** * Future Directions *) 5 | 6 | (** We have lots of plans for future directions: 7 | - Automatic derivation of generators and shrinkers for data 8 | satisfying Inductive relations 9 | - Vellum2 testing 10 | - DeepSpec Web Server 11 | - Testing-only variant of _Software Foundations_? 12 | *) 13 | 14 | (* ################################################################# *) 15 | (** * Recommended Reading 16 | 17 | The material presented in this short course serves as an 18 | introduction to property based random testing using 19 | QuickChick. For the interested reader, we provide a few more 20 | references for additional reading: 21 | 22 | - The original QuickCheck paper by Koen Claessen and John Hughes 23 | from ICFP 2000. 24 | {https://www.cs.tufts.edu/~nr/cs257/archive/john-hughes/quick.pdf} 25 | 26 | - The original QuickChick paper that focuses on a framework for 27 | proving the correctness of QuickChick generators. 28 | {https://hal.inria.fr/hal-01162898/document} 29 | 30 | - A case study that uses QuickCheck to test non-interference for 31 | information-flow-control abstract machines. 32 | {https://arxiv.org/abs/1409.0393v2} 33 | 34 | - Code for that case study exists under the QuickChick 35 | organization of github ({https://github.com/QuickChick}) for 36 | both Haskell ("Testing Noninterference") and Coq ("IFC"). 37 | 38 | - A paper on deriving QuickChick generators for a large class of 39 | inductive relations. 40 | {https://lemonidas.github.io/pdf/GeneratingGoodGenerators.pdf} 41 | 42 | - Leo's PhD dissertation. 43 | {https://lemonidas.github.io/pdf/Leo-PhD-Thesis.pdf} 44 | *) 45 | 46 | (* 2024-12-27 10:32 *) 47 | -------------------------------------------------------------------------------- /src/dataset/raw_data/qc/Preface.v: -------------------------------------------------------------------------------- 1 | (** * Preface *) 2 | 3 | (** This volume of _Software Foundations_ introduces QuickChick, a 4 | property-based random testing tool for Coq. *) 5 | 6 | (* ################################################################# *) 7 | (** * Setup *) 8 | 9 | (** For working with this material, you will need to install 10 | QuickChick. For this version, we are going to be using a 11 | QuickChick-2.0, which can be installed by simply running: 12 | 13 | [ opam install coq-quickchick ] 14 | 15 | The [QuickChickInterface] chapter serves as a reference 16 | manual for QuickChick. The rest of the book explains its features 17 | more gently. *) 18 | 19 | (* ################################################################# *) 20 | (** * Practicalities *) 21 | (* ================================================================= *) 22 | (** ** Recommended Citation Format *) 23 | 24 | (** If you want to refer to this volume in your own writing, please 25 | do so as follows: 26 | 27 | @book {Lampropoulos:SF4, 28 | author = {Leonidas Lampropoulos and Benjamin C. Pierce}, 29 | editor = {Benjamin C. Pierce}, 30 | title = "QuickChick: Property-Based Testing in Coq", 31 | series = "Software Foundations", 32 | volume = "4", 33 | year = "2024", 34 | publisher = "Electronic textbook", 35 | note = {Version 1.3.3, \URL{http://softwarefoundations.cis.upenn.edu} }, 36 | } 37 | *) 38 | 39 | (* ################################################################# *) 40 | (** * Thanks *) 41 | 42 | (** Development of the _Software Foundations_ series has been 43 | supported, in part, by the National Science Foundation under the 44 | NSF Expeditions grant 1521523, _The Science of Deep 45 | Specification_. Work on this volume was also supported by NSF 46 | grant 1421243, _Random Testing for Language Design_. *) 47 | 48 | (* 2024-12-27 10:32 *) 49 | -------------------------------------------------------------------------------- /src/dataset/pre_processed_data/BibTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | 3 | From Coq Require Export String. 4 | 5 | From LF Require Import Bib. 6 | 7 | Parameter MISSING: Type. 8 | 9 | Module Check. 10 | 11 | Ltac check_type A B := 12 | match type of A with 13 | | context[MISSING] => idtac "Missing:" A 14 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 15 | end. 16 | 17 | Ltac print_manual_grade A := 18 | match eval compute in A with 19 | | Some (_ ?S ?C) => 20 | idtac "Score:" S; 21 | match eval compute in C with 22 | | ""%string => idtac "Comment: None" 23 | | _ => idtac "Comment:" C 24 | end 25 | | None => 26 | idtac "Score: Ungraded"; 27 | idtac "Comment: None" 28 | end. 29 | 30 | End Check. 31 | 32 | From LF Require Import Bib. 33 | 34 | Import Check. 35 | 36 | Goal True. 37 | 38 | idtac " ". 39 | 40 | idtac "Max points - standard: 0". 41 | idtac "Max points - advanced: 0". 42 | idtac "". 43 | idtac "Allowed Axioms:". 44 | idtac "functional_extensionality". 45 | idtac "FunctionalExtensionality.functional_extensionality_dep". 46 | idtac "plus_le". 47 | idtac "le_trans". 48 | idtac "le_plus_l". 49 | idtac "add_le_cases". 50 | idtac "Sn_le_Sm__n_le_m". 51 | idtac "O_le_n". 52 | idtac "". 53 | idtac "". 54 | idtac "********** Summary **********". 55 | idtac "". 56 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 57 | idtac "". 58 | idtac "The output for each exercise can be any of the following:". 59 | idtac " - 'Closed under the global context', if it is complete". 60 | idtac " - 'MANUAL', if it is manually graded". 61 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 62 | idtac " the exercise is considered complete, if the axioms are all allowed.". 63 | idtac "". 64 | idtac "********** Standard **********". 65 | idtac "". 66 | idtac "********** Advanced **********". 67 | Abort. 68 | -------------------------------------------------------------------------------- /src/dataset/pre_processed_data/RelTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | 3 | From Coq Require Export String. 4 | 5 | From LF Require Import Rel. 6 | 7 | Parameter MISSING: Type. 8 | 9 | Module Check. 10 | 11 | Ltac check_type A B := 12 | match type of A with 13 | | context[MISSING] => idtac "Missing:" A 14 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 15 | end. 16 | 17 | Ltac print_manual_grade A := 18 | match eval compute in A with 19 | | Some (_ ?S ?C) => 20 | idtac "Score:" S; 21 | match eval compute in C with 22 | | ""%string => idtac "Comment: None" 23 | | _ => idtac "Comment:" C 24 | end 25 | | None => 26 | idtac "Score: Ungraded"; 27 | idtac "Comment: None" 28 | end. 29 | 30 | End Check. 31 | 32 | From LF Require Import Rel. 33 | 34 | Import Check. 35 | 36 | Goal True. 37 | 38 | idtac " ". 39 | 40 | idtac "Max points - standard: 0". 41 | idtac "Max points - advanced: 0". 42 | idtac "". 43 | idtac "Allowed Axioms:". 44 | idtac "functional_extensionality". 45 | idtac "FunctionalExtensionality.functional_extensionality_dep". 46 | idtac "plus_le". 47 | idtac "le_trans". 48 | idtac "le_plus_l". 49 | idtac "add_le_cases". 50 | idtac "Sn_le_Sm__n_le_m". 51 | idtac "O_le_n". 52 | idtac "". 53 | idtac "". 54 | idtac "********** Summary **********". 55 | idtac "". 56 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 57 | idtac "". 58 | idtac "The output for each exercise can be any of the following:". 59 | idtac " - 'Closed under the global context', if it is complete". 60 | idtac " - 'MANUAL', if it is manually graded". 61 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 62 | idtac " the exercise is considered complete, if the axioms are all allowed.". 63 | idtac "". 64 | idtac "********** Standard **********". 65 | idtac "". 66 | idtac "********** Advanced **********". 67 | Abort. 68 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vc/README: -------------------------------------------------------------------------------- 1 | ######################################################################### 2 | SOFTWARE FOUNDATIONS 3 | ######################################################################### 4 | 5 | This directory contains both Coq scripts (.v files) and more readable 6 | HTML files for Verifiable C, by Andrew W. Appel et al., 7 | volume [VC] of the Software Foundations series. 8 | 9 | - Preface.v or Preface.html 10 | The place to start reading, including details on how to install 11 | required software 12 | 13 | - index.html 14 | The book's cover page and navigation starting point 15 | 16 | - deps.html 17 | Overview of the ordering of chapters 18 | 19 | - LICENSE 20 | Explanation of how these files may be redistributed 21 | 22 | NOTE ABOUT VST VERSION: 23 | 24 | Preface.v checks that you are using a version of VST that is well matched 25 | to this textbook. If you have installed VST by the standard Coq Platform 26 | or by opam, then it will be found automatically in coq/lib/coq/user-contrib. 27 | If that's the right version (as checked by Preface.v) then everything is easy. 28 | 29 | TO USE THIS VOLUME BASED ON A CUSTOM-INSTALLED VST VERSION: 30 | Otherwise, you may want to download a specific version from 31 | https://github.com/PrincetonUniversity/VST and build from sources. 32 | In that case, your VST will not be found in user-contrib, and you should 33 | follow these steps: 34 | 35 | 1. In this directory, "make clean" and remove Makefile.coq 36 | 37 | 2. Edit the first line of the Makefile to read, 38 | 39 | COQMFFLAGS= -Q . VC -Q path/to/VST VST 40 | 41 | where "path/to/VST" is whatever directory you've compiled VST in. 42 | 43 | 3. Edit the _CoqProject file to have the same -Q options. 44 | 45 | 4. If your compiled VST uses the special configuration COMPCERT=bundled, 46 | then instead you should add one more -Q option to Makefile and _CoqProject: 47 | 48 | COQMFFLAGS= -Q . VC -Q path/to/VST VST -Q path/to/VST/compcert compcert 49 | -------------------------------------------------------------------------------- /src/dataset/pre_processed_data/AutoTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | 3 | From Coq Require Export String. 4 | 5 | From LF Require Import Auto. 6 | 7 | Parameter MISSING: Type. 8 | 9 | Module Check. 10 | 11 | Ltac check_type A B := 12 | match type of A with 13 | | context[MISSING] => idtac "Missing:" A 14 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 15 | end. 16 | 17 | Ltac print_manual_grade A := 18 | match eval compute in A with 19 | | Some (_ ?S ?C) => 20 | idtac "Score:" S; 21 | match eval compute in C with 22 | | ""%string => idtac "Comment: None" 23 | | _ => idtac "Comment:" C 24 | end 25 | | None => 26 | idtac "Score: Ungraded"; 27 | idtac "Comment: None" 28 | end. 29 | 30 | End Check. 31 | 32 | From LF Require Import Auto. 33 | 34 | Import Check. 35 | 36 | Goal True. 37 | 38 | idtac " ". 39 | 40 | idtac "Max points - standard: 0". 41 | idtac "Max points - advanced: 0". 42 | idtac "". 43 | idtac "Allowed Axioms:". 44 | idtac "functional_extensionality". 45 | idtac "FunctionalExtensionality.functional_extensionality_dep". 46 | idtac "plus_le". 47 | idtac "le_trans". 48 | idtac "le_plus_l". 49 | idtac "add_le_cases". 50 | idtac "Sn_le_Sm__n_le_m". 51 | idtac "O_le_n". 52 | idtac "". 53 | idtac "". 54 | idtac "********** Summary **********". 55 | idtac "". 56 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 57 | idtac "". 58 | idtac "The output for each exercise can be any of the following:". 59 | idtac " - 'Closed under the global context', if it is complete". 60 | idtac " - 'MANUAL', if it is manually graded". 61 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 62 | idtac " the exercise is considered complete, if the axioms are all allowed.". 63 | idtac "". 64 | idtac "********** Standard **********". 65 | idtac "". 66 | idtac "********** Advanced **********". 67 | Abort. 68 | -------------------------------------------------------------------------------- /src/dataset/reconstructed_files/BibTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | 3 | From Coq Require Export String. 4 | 5 | From LF Require Import Bib. 6 | 7 | Parameter MISSING: Type. 8 | 9 | Module Check. 10 | 11 | Ltac check_type A B := 12 | match type of A with 13 | | context[MISSING] => idtac "Missing:" A 14 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 15 | end. 16 | 17 | Ltac print_manual_grade A := 18 | match eval compute in A with 19 | | Some (_ ?S ?C) => 20 | idtac "Score:" S; 21 | match eval compute in C with 22 | | ""%string => idtac "Comment: None" 23 | | _ => idtac "Comment:" C 24 | end 25 | | None => 26 | idtac "Score: Ungraded"; 27 | idtac "Comment: None" 28 | end. 29 | 30 | End Check. 31 | 32 | From LF Require Import Bib. 33 | 34 | Import Check. 35 | 36 | Goal True. 37 | 38 | idtac " ". 39 | 40 | idtac "Max points - standard: 0". 41 | idtac "Max points - advanced: 0". 42 | idtac "". 43 | idtac "Allowed Axioms:". 44 | idtac "functional_extensionality". 45 | idtac "FunctionalExtensionality.functional_extensionality_dep". 46 | idtac "plus_le". 47 | idtac "le_trans". 48 | idtac "le_plus_l". 49 | idtac "add_le_cases". 50 | idtac "Sn_le_Sm__n_le_m". 51 | idtac "O_le_n". 52 | idtac "". 53 | idtac "". 54 | idtac "********** Summary **********". 55 | idtac "". 56 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 57 | idtac "". 58 | idtac "The output for each exercise can be any of the following:". 59 | idtac " - 'Closed under the global context', if it is complete". 60 | idtac " - 'MANUAL', if it is manually graded". 61 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 62 | idtac " the exercise is considered complete, if the axioms are all allowed.". 63 | idtac "". 64 | idtac "********** Standard **********". 65 | idtac "". 66 | idtac "********** Advanced **********". 67 | Abort. 68 | 69 | -------------------------------------------------------------------------------- /src/dataset/reconstructed_files/RelTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | 3 | From Coq Require Export String. 4 | 5 | From LF Require Import Rel. 6 | 7 | Parameter MISSING: Type. 8 | 9 | Module Check. 10 | 11 | Ltac check_type A B := 12 | match type of A with 13 | | context[MISSING] => idtac "Missing:" A 14 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 15 | end. 16 | 17 | Ltac print_manual_grade A := 18 | match eval compute in A with 19 | | Some (_ ?S ?C) => 20 | idtac "Score:" S; 21 | match eval compute in C with 22 | | ""%string => idtac "Comment: None" 23 | | _ => idtac "Comment:" C 24 | end 25 | | None => 26 | idtac "Score: Ungraded"; 27 | idtac "Comment: None" 28 | end. 29 | 30 | End Check. 31 | 32 | From LF Require Import Rel. 33 | 34 | Import Check. 35 | 36 | Goal True. 37 | 38 | idtac " ". 39 | 40 | idtac "Max points - standard: 0". 41 | idtac "Max points - advanced: 0". 42 | idtac "". 43 | idtac "Allowed Axioms:". 44 | idtac "functional_extensionality". 45 | idtac "FunctionalExtensionality.functional_extensionality_dep". 46 | idtac "plus_le". 47 | idtac "le_trans". 48 | idtac "le_plus_l". 49 | idtac "add_le_cases". 50 | idtac "Sn_le_Sm__n_le_m". 51 | idtac "O_le_n". 52 | idtac "". 53 | idtac "". 54 | idtac "********** Summary **********". 55 | idtac "". 56 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 57 | idtac "". 58 | idtac "The output for each exercise can be any of the following:". 59 | idtac " - 'Closed under the global context', if it is complete". 60 | idtac " - 'MANUAL', if it is manually graded". 61 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 62 | idtac " the exercise is considered complete, if the axioms are all allowed.". 63 | idtac "". 64 | idtac "********** Standard **********". 65 | idtac "". 66 | idtac "********** Advanced **********". 67 | Abort. 68 | 69 | -------------------------------------------------------------------------------- /src/dataset/pre_processed_data/PrefaceTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | 3 | From Coq Require Export String. 4 | 5 | From LF Require Import Preface. 6 | 7 | Parameter MISSING: Type. 8 | 9 | Module Check. 10 | 11 | Ltac check_type A B := 12 | match type of A with 13 | | context[MISSING] => idtac "Missing:" A 14 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 15 | end. 16 | 17 | Ltac print_manual_grade A := 18 | match eval compute in A with 19 | | Some (_ ?S ?C) => 20 | idtac "Score:" S; 21 | match eval compute in C with 22 | | ""%string => idtac "Comment: None" 23 | | _ => idtac "Comment:" C 24 | end 25 | | None => 26 | idtac "Score: Ungraded"; 27 | idtac "Comment: None" 28 | end. 29 | 30 | End Check. 31 | 32 | From LF Require Import Preface. 33 | 34 | Import Check. 35 | 36 | Goal True. 37 | 38 | idtac " ". 39 | 40 | idtac "Max points - standard: 0". 41 | idtac "Max points - advanced: 0". 42 | idtac "". 43 | idtac "Allowed Axioms:". 44 | idtac "functional_extensionality". 45 | idtac "FunctionalExtensionality.functional_extensionality_dep". 46 | idtac "plus_le". 47 | idtac "le_trans". 48 | idtac "le_plus_l". 49 | idtac "add_le_cases". 50 | idtac "Sn_le_Sm__n_le_m". 51 | idtac "O_le_n". 52 | idtac "". 53 | idtac "". 54 | idtac "********** Summary **********". 55 | idtac "". 56 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 57 | idtac "". 58 | idtac "The output for each exercise can be any of the following:". 59 | idtac " - 'Closed under the global context', if it is complete". 60 | idtac " - 'MANUAL', if it is manually graded". 61 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 62 | idtac " the exercise is considered complete, if the axioms are all allowed.". 63 | idtac "". 64 | idtac "********** Standard **********". 65 | idtac "". 66 | idtac "********** Advanced **********". 67 | Abort. 68 | -------------------------------------------------------------------------------- /src/dataset/raw_data/plf/BibTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | From Coq Require Export String. 3 | From PLF Require Import Bib. 4 | 5 | Parameter MISSING: Type. 6 | 7 | Module Check. 8 | 9 | Ltac check_type A B := 10 | match type of A with 11 | | context[MISSING] => idtac "Missing:" A 12 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 13 | end. 14 | 15 | Ltac print_manual_grade A := 16 | match eval compute in A with 17 | | Some (_ ?S ?C) => 18 | idtac "Score:" S; 19 | match eval compute in C with 20 | | ""%string => idtac "Comment: None" 21 | | _ => idtac "Comment:" C 22 | end 23 | | None => 24 | idtac "Score: Ungraded"; 25 | idtac "Comment: None" 26 | end. 27 | 28 | End Check. 29 | 30 | From PLF Require Import Bib. 31 | Import Check. 32 | 33 | Goal True. 34 | 35 | idtac " ". 36 | 37 | idtac "Max points - standard: 0". 38 | idtac "Max points - advanced: 0". 39 | idtac "". 40 | idtac "Allowed Axioms:". 41 | idtac "functional_extensionality". 42 | idtac "FunctionalExtensionality.functional_extensionality_dep". 43 | idtac "CSeq_congruence". 44 | idtac "fold_constants_bexp_sound". 45 | idtac "succ_hastype_nat__hastype_nat". 46 | idtac "". 47 | idtac "". 48 | idtac "********** Summary **********". 49 | idtac "". 50 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 51 | idtac "". 52 | idtac "The output for each exercise can be any of the following:". 53 | idtac " - 'Closed under the global context', if it is complete". 54 | idtac " - 'MANUAL', if it is manually graded". 55 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 56 | idtac " the exercise is considered complete, if the axioms are all allowed.". 57 | idtac "". 58 | idtac "********** Standard **********". 59 | idtac "". 60 | idtac "********** Advanced **********". 61 | Abort. 62 | 63 | (* 2025-01-06 19:49 *) 64 | 65 | (* 2025-01-06 19:49 *) 66 | -------------------------------------------------------------------------------- /src/dataset/raw_data/plf/PETest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | From Coq Require Export String. 3 | From PLF Require Import PE. 4 | 5 | Parameter MISSING: Type. 6 | 7 | Module Check. 8 | 9 | Ltac check_type A B := 10 | match type of A with 11 | | context[MISSING] => idtac "Missing:" A 12 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 13 | end. 14 | 15 | Ltac print_manual_grade A := 16 | match eval compute in A with 17 | | Some (_ ?S ?C) => 18 | idtac "Score:" S; 19 | match eval compute in C with 20 | | ""%string => idtac "Comment: None" 21 | | _ => idtac "Comment:" C 22 | end 23 | | None => 24 | idtac "Score: Ungraded"; 25 | idtac "Comment: None" 26 | end. 27 | 28 | End Check. 29 | 30 | From PLF Require Import PE. 31 | Import Check. 32 | 33 | Goal True. 34 | 35 | idtac " ". 36 | 37 | idtac "Max points - standard: 0". 38 | idtac "Max points - advanced: 0". 39 | idtac "". 40 | idtac "Allowed Axioms:". 41 | idtac "functional_extensionality". 42 | idtac "FunctionalExtensionality.functional_extensionality_dep". 43 | idtac "CSeq_congruence". 44 | idtac "fold_constants_bexp_sound". 45 | idtac "succ_hastype_nat__hastype_nat". 46 | idtac "". 47 | idtac "". 48 | idtac "********** Summary **********". 49 | idtac "". 50 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 51 | idtac "". 52 | idtac "The output for each exercise can be any of the following:". 53 | idtac " - 'Closed under the global context', if it is complete". 54 | idtac " - 'MANUAL', if it is manually graded". 55 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 56 | idtac " the exercise is considered complete, if the axioms are all allowed.". 57 | idtac "". 58 | idtac "********** Standard **********". 59 | idtac "". 60 | idtac "********** Advanced **********". 61 | Abort. 62 | 63 | (* 2025-01-06 19:49 *) 64 | 65 | (* 2025-01-06 19:49 *) 66 | -------------------------------------------------------------------------------- /src/dataset/reconstructed_files/AutoTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | 3 | From Coq Require Export String. 4 | 5 | From LF Require Import Auto. 6 | 7 | Parameter MISSING: Type. 8 | 9 | Module Check. 10 | 11 | Ltac check_type A B := 12 | match type of A with 13 | | context[MISSING] => idtac "Missing:" A 14 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 15 | end. 16 | 17 | Ltac print_manual_grade A := 18 | match eval compute in A with 19 | | Some (_ ?S ?C) => 20 | idtac "Score:" S; 21 | match eval compute in C with 22 | | ""%string => idtac "Comment: None" 23 | | _ => idtac "Comment:" C 24 | end 25 | | None => 26 | idtac "Score: Ungraded"; 27 | idtac "Comment: None" 28 | end. 29 | 30 | End Check. 31 | 32 | From LF Require Import Auto. 33 | 34 | Import Check. 35 | 36 | Goal True. 37 | 38 | idtac " ". 39 | 40 | idtac "Max points - standard: 0". 41 | idtac "Max points - advanced: 0". 42 | idtac "". 43 | idtac "Allowed Axioms:". 44 | idtac "functional_extensionality". 45 | idtac "FunctionalExtensionality.functional_extensionality_dep". 46 | idtac "plus_le". 47 | idtac "le_trans". 48 | idtac "le_plus_l". 49 | idtac "add_le_cases". 50 | idtac "Sn_le_Sm__n_le_m". 51 | idtac "O_le_n". 52 | idtac "". 53 | idtac "". 54 | idtac "********** Summary **********". 55 | idtac "". 56 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 57 | idtac "". 58 | idtac "The output for each exercise can be any of the following:". 59 | idtac " - 'Closed under the global context', if it is complete". 60 | idtac " - 'MANUAL', if it is manually graded". 61 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 62 | idtac " the exercise is considered complete, if the axioms are all allowed.". 63 | idtac "". 64 | idtac "********** Standard **********". 65 | idtac "". 66 | idtac "********** Advanced **********". 67 | Abort. 68 | 69 | -------------------------------------------------------------------------------- /src/dataset/pre_processed_data/ExtractionTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | 3 | From Coq Require Export String. 4 | 5 | From LF Require Import Extraction. 6 | 7 | Parameter MISSING: Type. 8 | 9 | Module Check. 10 | 11 | Ltac check_type A B := 12 | match type of A with 13 | | context[MISSING] => idtac "Missing:" A 14 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 15 | end. 16 | 17 | Ltac print_manual_grade A := 18 | match eval compute in A with 19 | | Some (_ ?S ?C) => 20 | idtac "Score:" S; 21 | match eval compute in C with 22 | | ""%string => idtac "Comment: None" 23 | | _ => idtac "Comment:" C 24 | end 25 | | None => 26 | idtac "Score: Ungraded"; 27 | idtac "Comment: None" 28 | end. 29 | 30 | End Check. 31 | 32 | From LF Require Import Extraction. 33 | 34 | Import Check. 35 | 36 | Goal True. 37 | 38 | idtac " ". 39 | 40 | idtac "Max points - standard: 0". 41 | idtac "Max points - advanced: 0". 42 | idtac "". 43 | idtac "Allowed Axioms:". 44 | idtac "functional_extensionality". 45 | idtac "FunctionalExtensionality.functional_extensionality_dep". 46 | idtac "plus_le". 47 | idtac "le_trans". 48 | idtac "le_plus_l". 49 | idtac "add_le_cases". 50 | idtac "Sn_le_Sm__n_le_m". 51 | idtac "O_le_n". 52 | idtac "". 53 | idtac "". 54 | idtac "********** Summary **********". 55 | idtac "". 56 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 57 | idtac "". 58 | idtac "The output for each exercise can be any of the following:". 59 | idtac " - 'Closed under the global context', if it is complete". 60 | idtac " - 'MANUAL', if it is manually graded". 61 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 62 | idtac " the exercise is considered complete, if the axioms are all allowed.". 63 | idtac "". 64 | idtac "********** Standard **********". 65 | idtac "". 66 | idtac "********** Advanced **********". 67 | Abort. 68 | -------------------------------------------------------------------------------- /src/dataset/pre_processed_data/ImpParserTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | 3 | From Coq Require Export String. 4 | 5 | From LF Require Import ImpParser. 6 | 7 | Parameter MISSING: Type. 8 | 9 | Module Check. 10 | 11 | Ltac check_type A B := 12 | match type of A with 13 | | context[MISSING] => idtac "Missing:" A 14 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 15 | end. 16 | 17 | Ltac print_manual_grade A := 18 | match eval compute in A with 19 | | Some (_ ?S ?C) => 20 | idtac "Score:" S; 21 | match eval compute in C with 22 | | ""%string => idtac "Comment: None" 23 | | _ => idtac "Comment:" C 24 | end 25 | | None => 26 | idtac "Score: Ungraded"; 27 | idtac "Comment: None" 28 | end. 29 | 30 | End Check. 31 | 32 | From LF Require Import ImpParser. 33 | 34 | Import Check. 35 | 36 | Goal True. 37 | 38 | idtac " ". 39 | 40 | idtac "Max points - standard: 0". 41 | idtac "Max points - advanced: 0". 42 | idtac "". 43 | idtac "Allowed Axioms:". 44 | idtac "functional_extensionality". 45 | idtac "FunctionalExtensionality.functional_extensionality_dep". 46 | idtac "plus_le". 47 | idtac "le_trans". 48 | idtac "le_plus_l". 49 | idtac "add_le_cases". 50 | idtac "Sn_le_Sm__n_le_m". 51 | idtac "O_le_n". 52 | idtac "". 53 | idtac "". 54 | idtac "********** Summary **********". 55 | idtac "". 56 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 57 | idtac "". 58 | idtac "The output for each exercise can be any of the following:". 59 | idtac " - 'Closed under the global context', if it is complete". 60 | idtac " - 'MANUAL', if it is manually graded". 61 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 62 | idtac " the exercise is considered complete, if the axioms are all allowed.". 63 | idtac "". 64 | idtac "********** Standard **********". 65 | idtac "". 66 | idtac "********** Advanced **********". 67 | Abort. 68 | -------------------------------------------------------------------------------- /src/dataset/pre_processed_data/PostscriptTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | 3 | From Coq Require Export String. 4 | 5 | From LF Require Import Postscript. 6 | 7 | Parameter MISSING: Type. 8 | 9 | Module Check. 10 | 11 | Ltac check_type A B := 12 | match type of A with 13 | | context[MISSING] => idtac "Missing:" A 14 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 15 | end. 16 | 17 | Ltac print_manual_grade A := 18 | match eval compute in A with 19 | | Some (_ ?S ?C) => 20 | idtac "Score:" S; 21 | match eval compute in C with 22 | | ""%string => idtac "Comment: None" 23 | | _ => idtac "Comment:" C 24 | end 25 | | None => 26 | idtac "Score: Ungraded"; 27 | idtac "Comment: None" 28 | end. 29 | 30 | End Check. 31 | 32 | From LF Require Import Postscript. 33 | 34 | Import Check. 35 | 36 | Goal True. 37 | 38 | idtac " ". 39 | 40 | idtac "Max points - standard: 0". 41 | idtac "Max points - advanced: 0". 42 | idtac "". 43 | idtac "Allowed Axioms:". 44 | idtac "functional_extensionality". 45 | idtac "FunctionalExtensionality.functional_extensionality_dep". 46 | idtac "plus_le". 47 | idtac "le_trans". 48 | idtac "le_plus_l". 49 | idtac "add_le_cases". 50 | idtac "Sn_le_Sm__n_le_m". 51 | idtac "O_le_n". 52 | idtac "". 53 | idtac "". 54 | idtac "********** Summary **********". 55 | idtac "". 56 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 57 | idtac "". 58 | idtac "The output for each exercise can be any of the following:". 59 | idtac " - 'Closed under the global context', if it is complete". 60 | idtac " - 'MANUAL', if it is manually graded". 61 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 62 | idtac " the exercise is considered complete, if the axioms are all allowed.". 63 | idtac "". 64 | idtac "********** Standard **********". 65 | idtac "". 66 | idtac "********** Advanced **********". 67 | Abort. 68 | -------------------------------------------------------------------------------- /src/dataset/reconstructed_files/PrefaceTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | 3 | From Coq Require Export String. 4 | 5 | From LF Require Import Preface. 6 | 7 | Parameter MISSING: Type. 8 | 9 | Module Check. 10 | 11 | Ltac check_type A B := 12 | match type of A with 13 | | context[MISSING] => idtac "Missing:" A 14 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 15 | end. 16 | 17 | Ltac print_manual_grade A := 18 | match eval compute in A with 19 | | Some (_ ?S ?C) => 20 | idtac "Score:" S; 21 | match eval compute in C with 22 | | ""%string => idtac "Comment: None" 23 | | _ => idtac "Comment:" C 24 | end 25 | | None => 26 | idtac "Score: Ungraded"; 27 | idtac "Comment: None" 28 | end. 29 | 30 | End Check. 31 | 32 | From LF Require Import Preface. 33 | 34 | Import Check. 35 | 36 | Goal True. 37 | 38 | idtac " ". 39 | 40 | idtac "Max points - standard: 0". 41 | idtac "Max points - advanced: 0". 42 | idtac "". 43 | idtac "Allowed Axioms:". 44 | idtac "functional_extensionality". 45 | idtac "FunctionalExtensionality.functional_extensionality_dep". 46 | idtac "plus_le". 47 | idtac "le_trans". 48 | idtac "le_plus_l". 49 | idtac "add_le_cases". 50 | idtac "Sn_le_Sm__n_le_m". 51 | idtac "O_le_n". 52 | idtac "". 53 | idtac "". 54 | idtac "********** Summary **********". 55 | idtac "". 56 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 57 | idtac "". 58 | idtac "The output for each exercise can be any of the following:". 59 | idtac " - 'Closed under the global context', if it is complete". 60 | idtac " - 'MANUAL', if it is manually graded". 61 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 62 | idtac " the exercise is considered complete, if the axioms are all allowed.". 63 | idtac "". 64 | idtac "********** Standard **********". 65 | idtac "". 66 | idtac "********** Advanced **********". 67 | Abort. 68 | 69 | -------------------------------------------------------------------------------- /src/dataset/raw_data/plf/PrefaceTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | From Coq Require Export String. 3 | From PLF Require Import Preface. 4 | 5 | Parameter MISSING: Type. 6 | 7 | Module Check. 8 | 9 | Ltac check_type A B := 10 | match type of A with 11 | | context[MISSING] => idtac "Missing:" A 12 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 13 | end. 14 | 15 | Ltac print_manual_grade A := 16 | match eval compute in A with 17 | | Some (_ ?S ?C) => 18 | idtac "Score:" S; 19 | match eval compute in C with 20 | | ""%string => idtac "Comment: None" 21 | | _ => idtac "Comment:" C 22 | end 23 | | None => 24 | idtac "Score: Ungraded"; 25 | idtac "Comment: None" 26 | end. 27 | 28 | End Check. 29 | 30 | From PLF Require Import Preface. 31 | Import Check. 32 | 33 | Goal True. 34 | 35 | idtac " ". 36 | 37 | idtac "Max points - standard: 0". 38 | idtac "Max points - advanced: 0". 39 | idtac "". 40 | idtac "Allowed Axioms:". 41 | idtac "functional_extensionality". 42 | idtac "FunctionalExtensionality.functional_extensionality_dep". 43 | idtac "CSeq_congruence". 44 | idtac "fold_constants_bexp_sound". 45 | idtac "succ_hastype_nat__hastype_nat". 46 | idtac "". 47 | idtac "". 48 | idtac "********** Summary **********". 49 | idtac "". 50 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 51 | idtac "". 52 | idtac "The output for each exercise can be any of the following:". 53 | idtac " - 'Closed under the global context', if it is complete". 54 | idtac " - 'MANUAL', if it is manually graded". 55 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 56 | idtac " the exercise is considered complete, if the axioms are all allowed.". 57 | idtac "". 58 | idtac "********** Standard **********". 59 | idtac "". 60 | idtac "********** Advanced **********". 61 | Abort. 62 | 63 | (* 2025-01-06 19:48 *) 64 | 65 | (* 2025-01-06 19:48 *) 66 | -------------------------------------------------------------------------------- /src/dataset/raw_data/plf/UseAutoTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | From Coq Require Export String. 3 | From PLF Require Import UseAuto. 4 | 5 | Parameter MISSING: Type. 6 | 7 | Module Check. 8 | 9 | Ltac check_type A B := 10 | match type of A with 11 | | context[MISSING] => idtac "Missing:" A 12 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 13 | end. 14 | 15 | Ltac print_manual_grade A := 16 | match eval compute in A with 17 | | Some (_ ?S ?C) => 18 | idtac "Score:" S; 19 | match eval compute in C with 20 | | ""%string => idtac "Comment: None" 21 | | _ => idtac "Comment:" C 22 | end 23 | | None => 24 | idtac "Score: Ungraded"; 25 | idtac "Comment: None" 26 | end. 27 | 28 | End Check. 29 | 30 | From PLF Require Import UseAuto. 31 | Import Check. 32 | 33 | Goal True. 34 | 35 | idtac " ". 36 | 37 | idtac "Max points - standard: 0". 38 | idtac "Max points - advanced: 0". 39 | idtac "". 40 | idtac "Allowed Axioms:". 41 | idtac "functional_extensionality". 42 | idtac "FunctionalExtensionality.functional_extensionality_dep". 43 | idtac "CSeq_congruence". 44 | idtac "fold_constants_bexp_sound". 45 | idtac "succ_hastype_nat__hastype_nat". 46 | idtac "". 47 | idtac "". 48 | idtac "********** Summary **********". 49 | idtac "". 50 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 51 | idtac "". 52 | idtac "The output for each exercise can be any of the following:". 53 | idtac " - 'Closed under the global context', if it is complete". 54 | idtac " - 'MANUAL', if it is manually graded". 55 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 56 | idtac " the exercise is considered complete, if the axioms are all allowed.". 57 | idtac "". 58 | idtac "********** Standard **********". 59 | idtac "". 60 | idtac "********** Advanced **********". 61 | Abort. 62 | 63 | (* 2025-01-06 19:49 *) 64 | 65 | (* 2025-01-06 19:49 *) 66 | -------------------------------------------------------------------------------- /src/dataset/reconstructed_files/ImpParserTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | 3 | From Coq Require Export String. 4 | 5 | From LF Require Import ImpParser. 6 | 7 | Parameter MISSING: Type. 8 | 9 | Module Check. 10 | 11 | Ltac check_type A B := 12 | match type of A with 13 | | context[MISSING] => idtac "Missing:" A 14 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 15 | end. 16 | 17 | Ltac print_manual_grade A := 18 | match eval compute in A with 19 | | Some (_ ?S ?C) => 20 | idtac "Score:" S; 21 | match eval compute in C with 22 | | ""%string => idtac "Comment: None" 23 | | _ => idtac "Comment:" C 24 | end 25 | | None => 26 | idtac "Score: Ungraded"; 27 | idtac "Comment: None" 28 | end. 29 | 30 | End Check. 31 | 32 | From LF Require Import ImpParser. 33 | 34 | Import Check. 35 | 36 | Goal True. 37 | 38 | idtac " ". 39 | 40 | idtac "Max points - standard: 0". 41 | idtac "Max points - advanced: 0". 42 | idtac "". 43 | idtac "Allowed Axioms:". 44 | idtac "functional_extensionality". 45 | idtac "FunctionalExtensionality.functional_extensionality_dep". 46 | idtac "plus_le". 47 | idtac "le_trans". 48 | idtac "le_plus_l". 49 | idtac "add_le_cases". 50 | idtac "Sn_le_Sm__n_le_m". 51 | idtac "O_le_n". 52 | idtac "". 53 | idtac "". 54 | idtac "********** Summary **********". 55 | idtac "". 56 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 57 | idtac "". 58 | idtac "The output for each exercise can be any of the following:". 59 | idtac " - 'Closed under the global context', if it is complete". 60 | idtac " - 'MANUAL', if it is manually graded". 61 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 62 | idtac " the exercise is considered complete, if the axioms are all allowed.". 63 | idtac "". 64 | idtac "********** Standard **********". 65 | idtac "". 66 | idtac "********** Advanced **********". 67 | Abort. 68 | 69 | -------------------------------------------------------------------------------- /src/dataset/reconstructed_files/ExtractionTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | 3 | From Coq Require Export String. 4 | 5 | From LF Require Import Extraction. 6 | 7 | Parameter MISSING: Type. 8 | 9 | Module Check. 10 | 11 | Ltac check_type A B := 12 | match type of A with 13 | | context[MISSING] => idtac "Missing:" A 14 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 15 | end. 16 | 17 | Ltac print_manual_grade A := 18 | match eval compute in A with 19 | | Some (_ ?S ?C) => 20 | idtac "Score:" S; 21 | match eval compute in C with 22 | | ""%string => idtac "Comment: None" 23 | | _ => idtac "Comment:" C 24 | end 25 | | None => 26 | idtac "Score: Ungraded"; 27 | idtac "Comment: None" 28 | end. 29 | 30 | End Check. 31 | 32 | From LF Require Import Extraction. 33 | 34 | Import Check. 35 | 36 | Goal True. 37 | 38 | idtac " ". 39 | 40 | idtac "Max points - standard: 0". 41 | idtac "Max points - advanced: 0". 42 | idtac "". 43 | idtac "Allowed Axioms:". 44 | idtac "functional_extensionality". 45 | idtac "FunctionalExtensionality.functional_extensionality_dep". 46 | idtac "plus_le". 47 | idtac "le_trans". 48 | idtac "le_plus_l". 49 | idtac "add_le_cases". 50 | idtac "Sn_le_Sm__n_le_m". 51 | idtac "O_le_n". 52 | idtac "". 53 | idtac "". 54 | idtac "********** Summary **********". 55 | idtac "". 56 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 57 | idtac "". 58 | idtac "The output for each exercise can be any of the following:". 59 | idtac " - 'Closed under the global context', if it is complete". 60 | idtac " - 'MANUAL', if it is manually graded". 61 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 62 | idtac " the exercise is considered complete, if the axioms are all allowed.". 63 | idtac "". 64 | idtac "********** Standard **********". 65 | idtac "". 66 | idtac "********** Advanced **********". 67 | Abort. 68 | 69 | -------------------------------------------------------------------------------- /src/dataset/reconstructed_files/PostscriptTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | 3 | From Coq Require Export String. 4 | 5 | From LF Require Import Postscript. 6 | 7 | Parameter MISSING: Type. 8 | 9 | Module Check. 10 | 11 | Ltac check_type A B := 12 | match type of A with 13 | | context[MISSING] => idtac "Missing:" A 14 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 15 | end. 16 | 17 | Ltac print_manual_grade A := 18 | match eval compute in A with 19 | | Some (_ ?S ?C) => 20 | idtac "Score:" S; 21 | match eval compute in C with 22 | | ""%string => idtac "Comment: None" 23 | | _ => idtac "Comment:" C 24 | end 25 | | None => 26 | idtac "Score: Ungraded"; 27 | idtac "Comment: None" 28 | end. 29 | 30 | End Check. 31 | 32 | From LF Require Import Postscript. 33 | 34 | Import Check. 35 | 36 | Goal True. 37 | 38 | idtac " ". 39 | 40 | idtac "Max points - standard: 0". 41 | idtac "Max points - advanced: 0". 42 | idtac "". 43 | idtac "Allowed Axioms:". 44 | idtac "functional_extensionality". 45 | idtac "FunctionalExtensionality.functional_extensionality_dep". 46 | idtac "plus_le". 47 | idtac "le_trans". 48 | idtac "le_plus_l". 49 | idtac "add_le_cases". 50 | idtac "Sn_le_Sm__n_le_m". 51 | idtac "O_le_n". 52 | idtac "". 53 | idtac "". 54 | idtac "********** Summary **********". 55 | idtac "". 56 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 57 | idtac "". 58 | idtac "The output for each exercise can be any of the following:". 59 | idtac " - 'Closed under the global context', if it is complete". 60 | idtac " - 'MANUAL', if it is manually graded". 61 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 62 | idtac " the exercise is considered complete, if the axioms are all allowed.". 63 | idtac "". 64 | idtac "********** Standard **********". 65 | idtac "". 66 | idtac "********** Advanced **********". 67 | Abort. 68 | 69 | -------------------------------------------------------------------------------- /src/dataset/raw_data/plf/LibTacticsTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | From Coq Require Export String. 3 | From PLF Require Import LibTactics. 4 | 5 | Parameter MISSING: Type. 6 | 7 | Module Check. 8 | 9 | Ltac check_type A B := 10 | match type of A with 11 | | context[MISSING] => idtac "Missing:" A 12 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 13 | end. 14 | 15 | Ltac print_manual_grade A := 16 | match eval compute in A with 17 | | Some (_ ?S ?C) => 18 | idtac "Score:" S; 19 | match eval compute in C with 20 | | ""%string => idtac "Comment: None" 21 | | _ => idtac "Comment:" C 22 | end 23 | | None => 24 | idtac "Score: Ungraded"; 25 | idtac "Comment: None" 26 | end. 27 | 28 | End Check. 29 | 30 | From PLF Require Import LibTactics. 31 | Import Check. 32 | 33 | Goal True. 34 | 35 | idtac " ". 36 | 37 | idtac "Max points - standard: 0". 38 | idtac "Max points - advanced: 0". 39 | idtac "". 40 | idtac "Allowed Axioms:". 41 | idtac "functional_extensionality". 42 | idtac "FunctionalExtensionality.functional_extensionality_dep". 43 | idtac "CSeq_congruence". 44 | idtac "fold_constants_bexp_sound". 45 | idtac "succ_hastype_nat__hastype_nat". 46 | idtac "". 47 | idtac "". 48 | idtac "********** Summary **********". 49 | idtac "". 50 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 51 | idtac "". 52 | idtac "The output for each exercise can be any of the following:". 53 | idtac " - 'Closed under the global context', if it is complete". 54 | idtac " - 'MANUAL', if it is manually graded". 55 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 56 | idtac " the exercise is considered complete, if the axioms are all allowed.". 57 | idtac "". 58 | idtac "********** Standard **********". 59 | idtac "". 60 | idtac "********** Advanced **********". 61 | Abort. 62 | 63 | (* 2025-01-06 19:49 *) 64 | 65 | (* 2025-01-06 19:49 *) 66 | -------------------------------------------------------------------------------- /src/dataset/raw_data/plf/PostscriptTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | From Coq Require Export String. 3 | From PLF Require Import Postscript. 4 | 5 | Parameter MISSING: Type. 6 | 7 | Module Check. 8 | 9 | Ltac check_type A B := 10 | match type of A with 11 | | context[MISSING] => idtac "Missing:" A 12 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 13 | end. 14 | 15 | Ltac print_manual_grade A := 16 | match eval compute in A with 17 | | Some (_ ?S ?C) => 18 | idtac "Score:" S; 19 | match eval compute in C with 20 | | ""%string => idtac "Comment: None" 21 | | _ => idtac "Comment:" C 22 | end 23 | | None => 24 | idtac "Score: Ungraded"; 25 | idtac "Comment: None" 26 | end. 27 | 28 | End Check. 29 | 30 | From PLF Require Import Postscript. 31 | Import Check. 32 | 33 | Goal True. 34 | 35 | idtac " ". 36 | 37 | idtac "Max points - standard: 0". 38 | idtac "Max points - advanced: 0". 39 | idtac "". 40 | idtac "Allowed Axioms:". 41 | idtac "functional_extensionality". 42 | idtac "FunctionalExtensionality.functional_extensionality_dep". 43 | idtac "CSeq_congruence". 44 | idtac "fold_constants_bexp_sound". 45 | idtac "succ_hastype_nat__hastype_nat". 46 | idtac "". 47 | idtac "". 48 | idtac "********** Summary **********". 49 | idtac "". 50 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 51 | idtac "". 52 | idtac "The output for each exercise can be any of the following:". 53 | idtac " - 'Closed under the global context', if it is complete". 54 | idtac " - 'MANUAL', if it is manually graded". 55 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 56 | idtac " the exercise is considered complete, if the axioms are all allowed.". 57 | idtac "". 58 | idtac "********** Standard **********". 59 | idtac "". 60 | idtac "********** Advanced **********". 61 | Abort. 62 | 63 | (* 2025-01-06 19:49 *) 64 | 65 | (* 2025-01-06 19:49 *) 66 | -------------------------------------------------------------------------------- /src/dataset/raw_data/plf/UseTacticsTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | From Coq Require Export String. 3 | From PLF Require Import UseTactics. 4 | 5 | Parameter MISSING: Type. 6 | 7 | Module Check. 8 | 9 | Ltac check_type A B := 10 | match type of A with 11 | | context[MISSING] => idtac "Missing:" A 12 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 13 | end. 14 | 15 | Ltac print_manual_grade A := 16 | match eval compute in A with 17 | | Some (_ ?S ?C) => 18 | idtac "Score:" S; 19 | match eval compute in C with 20 | | ""%string => idtac "Comment: None" 21 | | _ => idtac "Comment:" C 22 | end 23 | | None => 24 | idtac "Score: Ungraded"; 25 | idtac "Comment: None" 26 | end. 27 | 28 | End Check. 29 | 30 | From PLF Require Import UseTactics. 31 | Import Check. 32 | 33 | Goal True. 34 | 35 | idtac " ". 36 | 37 | idtac "Max points - standard: 0". 38 | idtac "Max points - advanced: 0". 39 | idtac "". 40 | idtac "Allowed Axioms:". 41 | idtac "functional_extensionality". 42 | idtac "FunctionalExtensionality.functional_extensionality_dep". 43 | idtac "CSeq_congruence". 44 | idtac "fold_constants_bexp_sound". 45 | idtac "succ_hastype_nat__hastype_nat". 46 | idtac "". 47 | idtac "". 48 | idtac "********** Summary **********". 49 | idtac "". 50 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 51 | idtac "". 52 | idtac "The output for each exercise can be any of the following:". 53 | idtac " - 'Closed under the global context', if it is complete". 54 | idtac " - 'MANUAL', if it is manually graded". 55 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 56 | idtac " the exercise is considered complete, if the axioms are all allowed.". 57 | idtac "". 58 | idtac "********** Standard **********". 59 | idtac "". 60 | idtac "********** Advanced **********". 61 | Abort. 62 | 63 | (* 2025-01-06 19:49 *) 64 | 65 | (* 2025-01-06 19:49 *) 66 | -------------------------------------------------------------------------------- /src/dataset/raw_data/lf/AutoTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | From Coq Require Export String. 3 | From LF Require Import Auto. 4 | 5 | Parameter MISSING: Type. 6 | 7 | Module Check. 8 | 9 | Ltac check_type A B := 10 | match type of A with 11 | | context[MISSING] => idtac "Missing:" A 12 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 13 | end. 14 | 15 | Ltac print_manual_grade A := 16 | match eval compute in A with 17 | | Some (_ ?S ?C) => 18 | idtac "Score:" S; 19 | match eval compute in C with 20 | | ""%string => idtac "Comment: None" 21 | | _ => idtac "Comment:" C 22 | end 23 | | None => 24 | idtac "Score: Ungraded"; 25 | idtac "Comment: None" 26 | end. 27 | 28 | End Check. 29 | 30 | From LF Require Import Auto. 31 | Import Check. 32 | 33 | Goal True. 34 | 35 | idtac " ". 36 | 37 | idtac "Max points - standard: 0". 38 | idtac "Max points - advanced: 0". 39 | idtac "". 40 | idtac "Allowed Axioms:". 41 | idtac "functional_extensionality". 42 | idtac "FunctionalExtensionality.functional_extensionality_dep". 43 | idtac "plus_le". 44 | idtac "le_trans". 45 | idtac "le_plus_l". 46 | idtac "add_le_cases". 47 | idtac "Sn_le_Sm__n_le_m". 48 | idtac "O_le_n". 49 | idtac "". 50 | idtac "". 51 | idtac "********** Summary **********". 52 | idtac "". 53 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 54 | idtac "". 55 | idtac "The output for each exercise can be any of the following:". 56 | idtac " - 'Closed under the global context', if it is complete". 57 | idtac " - 'MANUAL', if it is manually graded". 58 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 59 | idtac " the exercise is considered complete, if the axioms are all allowed.". 60 | idtac "". 61 | idtac "********** Standard **********". 62 | idtac "". 63 | idtac "********** Advanced **********". 64 | Abort. 65 | 66 | (* 2025-01-13 16:00 *) 67 | 68 | (* 2025-01-13 16:00 *) 69 | -------------------------------------------------------------------------------- /src/dataset/raw_data/lf/BibTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | From Coq Require Export String. 3 | From LF Require Import Bib. 4 | 5 | Parameter MISSING: Type. 6 | 7 | Module Check. 8 | 9 | Ltac check_type A B := 10 | match type of A with 11 | | context[MISSING] => idtac "Missing:" A 12 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 13 | end. 14 | 15 | Ltac print_manual_grade A := 16 | match eval compute in A with 17 | | Some (_ ?S ?C) => 18 | idtac "Score:" S; 19 | match eval compute in C with 20 | | ""%string => idtac "Comment: None" 21 | | _ => idtac "Comment:" C 22 | end 23 | | None => 24 | idtac "Score: Ungraded"; 25 | idtac "Comment: None" 26 | end. 27 | 28 | End Check. 29 | 30 | From LF Require Import Bib. 31 | Import Check. 32 | 33 | Goal True. 34 | 35 | idtac " ". 36 | 37 | idtac "Max points - standard: 0". 38 | idtac "Max points - advanced: 0". 39 | idtac "". 40 | idtac "Allowed Axioms:". 41 | idtac "functional_extensionality". 42 | idtac "FunctionalExtensionality.functional_extensionality_dep". 43 | idtac "plus_le". 44 | idtac "le_trans". 45 | idtac "le_plus_l". 46 | idtac "add_le_cases". 47 | idtac "Sn_le_Sm__n_le_m". 48 | idtac "O_le_n". 49 | idtac "". 50 | idtac "". 51 | idtac "********** Summary **********". 52 | idtac "". 53 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 54 | idtac "". 55 | idtac "The output for each exercise can be any of the following:". 56 | idtac " - 'Closed under the global context', if it is complete". 57 | idtac " - 'MANUAL', if it is manually graded". 58 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 59 | idtac " the exercise is considered complete, if the axioms are all allowed.". 60 | idtac "". 61 | idtac "********** Standard **********". 62 | idtac "". 63 | idtac "********** Advanced **********". 64 | Abort. 65 | 66 | (* 2025-01-13 16:00 *) 67 | 68 | (* 2025-01-13 16:00 *) 69 | -------------------------------------------------------------------------------- /src/dataset/raw_data/lf/RelTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | From Coq Require Export String. 3 | From LF Require Import Rel. 4 | 5 | Parameter MISSING: Type. 6 | 7 | Module Check. 8 | 9 | Ltac check_type A B := 10 | match type of A with 11 | | context[MISSING] => idtac "Missing:" A 12 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 13 | end. 14 | 15 | Ltac print_manual_grade A := 16 | match eval compute in A with 17 | | Some (_ ?S ?C) => 18 | idtac "Score:" S; 19 | match eval compute in C with 20 | | ""%string => idtac "Comment: None" 21 | | _ => idtac "Comment:" C 22 | end 23 | | None => 24 | idtac "Score: Ungraded"; 25 | idtac "Comment: None" 26 | end. 27 | 28 | End Check. 29 | 30 | From LF Require Import Rel. 31 | Import Check. 32 | 33 | Goal True. 34 | 35 | idtac " ". 36 | 37 | idtac "Max points - standard: 0". 38 | idtac "Max points - advanced: 0". 39 | idtac "". 40 | idtac "Allowed Axioms:". 41 | idtac "functional_extensionality". 42 | idtac "FunctionalExtensionality.functional_extensionality_dep". 43 | idtac "plus_le". 44 | idtac "le_trans". 45 | idtac "le_plus_l". 46 | idtac "add_le_cases". 47 | idtac "Sn_le_Sm__n_le_m". 48 | idtac "O_le_n". 49 | idtac "". 50 | idtac "". 51 | idtac "********** Summary **********". 52 | idtac "". 53 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 54 | idtac "". 55 | idtac "The output for each exercise can be any of the following:". 56 | idtac " - 'Closed under the global context', if it is complete". 57 | idtac " - 'MANUAL', if it is manually graded". 58 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 59 | idtac " the exercise is considered complete, if the axioms are all allowed.". 60 | idtac "". 61 | idtac "********** Standard **********". 62 | idtac "". 63 | idtac "********** Advanced **********". 64 | Abort. 65 | 66 | (* 2025-01-13 16:19 *) 67 | 68 | (* 2025-01-13 16:19 *) 69 | -------------------------------------------------------------------------------- /src/dataset/raw_data/lf/PrefaceTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | From Coq Require Export String. 3 | From LF Require Import Preface. 4 | 5 | Parameter MISSING: Type. 6 | 7 | Module Check. 8 | 9 | Ltac check_type A B := 10 | match type of A with 11 | | context[MISSING] => idtac "Missing:" A 12 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 13 | end. 14 | 15 | Ltac print_manual_grade A := 16 | match eval compute in A with 17 | | Some (_ ?S ?C) => 18 | idtac "Score:" S; 19 | match eval compute in C with 20 | | ""%string => idtac "Comment: None" 21 | | _ => idtac "Comment:" C 22 | end 23 | | None => 24 | idtac "Score: Ungraded"; 25 | idtac "Comment: None" 26 | end. 27 | 28 | End Check. 29 | 30 | From LF Require Import Preface. 31 | Import Check. 32 | 33 | Goal True. 34 | 35 | idtac " ". 36 | 37 | idtac "Max points - standard: 0". 38 | idtac "Max points - advanced: 0". 39 | idtac "". 40 | idtac "Allowed Axioms:". 41 | idtac "functional_extensionality". 42 | idtac "FunctionalExtensionality.functional_extensionality_dep". 43 | idtac "plus_le". 44 | idtac "le_trans". 45 | idtac "le_plus_l". 46 | idtac "add_le_cases". 47 | idtac "Sn_le_Sm__n_le_m". 48 | idtac "O_le_n". 49 | idtac "". 50 | idtac "". 51 | idtac "********** Summary **********". 52 | idtac "". 53 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 54 | idtac "". 55 | idtac "The output for each exercise can be any of the following:". 56 | idtac " - 'Closed under the global context', if it is complete". 57 | idtac " - 'MANUAL', if it is manually graded". 58 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 59 | idtac " the exercise is considered complete, if the axioms are all allowed.". 60 | idtac "". 61 | idtac "********** Standard **********". 62 | idtac "". 63 | idtac "********** Advanced **********". 64 | Abort. 65 | 66 | (* 2025-01-13 16:00 *) 67 | 68 | (* 2025-01-13 16:00 *) 69 | -------------------------------------------------------------------------------- /src/dataset/raw_data/lf/ImpParserTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | From Coq Require Export String. 3 | From LF Require Import ImpParser. 4 | 5 | Parameter MISSING: Type. 6 | 7 | Module Check. 8 | 9 | Ltac check_type A B := 10 | match type of A with 11 | | context[MISSING] => idtac "Missing:" A 12 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 13 | end. 14 | 15 | Ltac print_manual_grade A := 16 | match eval compute in A with 17 | | Some (_ ?S ?C) => 18 | idtac "Score:" S; 19 | match eval compute in C with 20 | | ""%string => idtac "Comment: None" 21 | | _ => idtac "Comment:" C 22 | end 23 | | None => 24 | idtac "Score: Ungraded"; 25 | idtac "Comment: None" 26 | end. 27 | 28 | End Check. 29 | 30 | From LF Require Import ImpParser. 31 | Import Check. 32 | 33 | Goal True. 34 | 35 | idtac " ". 36 | 37 | idtac "Max points - standard: 0". 38 | idtac "Max points - advanced: 0". 39 | idtac "". 40 | idtac "Allowed Axioms:". 41 | idtac "functional_extensionality". 42 | idtac "FunctionalExtensionality.functional_extensionality_dep". 43 | idtac "plus_le". 44 | idtac "le_trans". 45 | idtac "le_plus_l". 46 | idtac "add_le_cases". 47 | idtac "Sn_le_Sm__n_le_m". 48 | idtac "O_le_n". 49 | idtac "". 50 | idtac "". 51 | idtac "********** Summary **********". 52 | idtac "". 53 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 54 | idtac "". 55 | idtac "The output for each exercise can be any of the following:". 56 | idtac " - 'Closed under the global context', if it is complete". 57 | idtac " - 'MANUAL', if it is manually graded". 58 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 59 | idtac " the exercise is considered complete, if the axioms are all allowed.". 60 | idtac "". 61 | idtac "********** Standard **********". 62 | idtac "". 63 | idtac "********** Advanced **********". 64 | Abort. 65 | 66 | (* 2025-01-13 16:00 *) 67 | 68 | (* 2025-01-13 16:00 *) 69 | -------------------------------------------------------------------------------- /src/dataset/raw_data/lf/ExtractionTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | From Coq Require Export String. 3 | From LF Require Import Extraction. 4 | 5 | Parameter MISSING: Type. 6 | 7 | Module Check. 8 | 9 | Ltac check_type A B := 10 | match type of A with 11 | | context[MISSING] => idtac "Missing:" A 12 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 13 | end. 14 | 15 | Ltac print_manual_grade A := 16 | match eval compute in A with 17 | | Some (_ ?S ?C) => 18 | idtac "Score:" S; 19 | match eval compute in C with 20 | | ""%string => idtac "Comment: None" 21 | | _ => idtac "Comment:" C 22 | end 23 | | None => 24 | idtac "Score: Ungraded"; 25 | idtac "Comment: None" 26 | end. 27 | 28 | End Check. 29 | 30 | From LF Require Import Extraction. 31 | Import Check. 32 | 33 | Goal True. 34 | 35 | idtac " ". 36 | 37 | idtac "Max points - standard: 0". 38 | idtac "Max points - advanced: 0". 39 | idtac "". 40 | idtac "Allowed Axioms:". 41 | idtac "functional_extensionality". 42 | idtac "FunctionalExtensionality.functional_extensionality_dep". 43 | idtac "plus_le". 44 | idtac "le_trans". 45 | idtac "le_plus_l". 46 | idtac "add_le_cases". 47 | idtac "Sn_le_Sm__n_le_m". 48 | idtac "O_le_n". 49 | idtac "". 50 | idtac "". 51 | idtac "********** Summary **********". 52 | idtac "". 53 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 54 | idtac "". 55 | idtac "The output for each exercise can be any of the following:". 56 | idtac " - 'Closed under the global context', if it is complete". 57 | idtac " - 'MANUAL', if it is manually graded". 58 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 59 | idtac " the exercise is considered complete, if the axioms are all allowed.". 60 | idtac "". 61 | idtac "********** Standard **********". 62 | idtac "". 63 | idtac "********** Advanced **********". 64 | Abort. 65 | 66 | (* 2025-01-13 16:00 *) 67 | 68 | (* 2025-01-13 16:00 *) 69 | -------------------------------------------------------------------------------- /src/dataset/raw_data/lf/PostscriptTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | From Coq Require Export String. 3 | From LF Require Import Postscript. 4 | 5 | Parameter MISSING: Type. 6 | 7 | Module Check. 8 | 9 | Ltac check_type A B := 10 | match type of A with 11 | | context[MISSING] => idtac "Missing:" A 12 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 13 | end. 14 | 15 | Ltac print_manual_grade A := 16 | match eval compute in A with 17 | | Some (_ ?S ?C) => 18 | idtac "Score:" S; 19 | match eval compute in C with 20 | | ""%string => idtac "Comment: None" 21 | | _ => idtac "Comment:" C 22 | end 23 | | None => 24 | idtac "Score: Ungraded"; 25 | idtac "Comment: None" 26 | end. 27 | 28 | End Check. 29 | 30 | From LF Require Import Postscript. 31 | Import Check. 32 | 33 | Goal True. 34 | 35 | idtac " ". 36 | 37 | idtac "Max points - standard: 0". 38 | idtac "Max points - advanced: 0". 39 | idtac "". 40 | idtac "Allowed Axioms:". 41 | idtac "functional_extensionality". 42 | idtac "FunctionalExtensionality.functional_extensionality_dep". 43 | idtac "plus_le". 44 | idtac "le_trans". 45 | idtac "le_plus_l". 46 | idtac "add_le_cases". 47 | idtac "Sn_le_Sm__n_le_m". 48 | idtac "O_le_n". 49 | idtac "". 50 | idtac "". 51 | idtac "********** Summary **********". 52 | idtac "". 53 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 54 | idtac "". 55 | idtac "The output for each exercise can be any of the following:". 56 | idtac " - 'Closed under the global context', if it is complete". 57 | idtac " - 'MANUAL', if it is manually graded". 58 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 59 | idtac " the exercise is considered complete, if the axioms are all allowed.". 60 | idtac "". 61 | idtac "********** Standard **********". 62 | idtac "". 63 | idtac "********** Advanced **********". 64 | Abort. 65 | 66 | (* 2025-01-13 16:00 *) 67 | 68 | (* 2025-01-13 16:00 *) 69 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vfa/PrefaceTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | From Coq Require Export String. 3 | From VFA Require Import Preface. 4 | 5 | Parameter MISSING: Type. 6 | 7 | Module Check. 8 | 9 | Ltac check_type A B := 10 | match type of A with 11 | | context[MISSING] => idtac "Missing:" A 12 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 13 | end. 14 | 15 | Ltac print_manual_grade A := 16 | match eval compute in A with 17 | | Some (_ ?S ?C) => 18 | idtac "Score:" S; 19 | match eval compute in C with 20 | | ""%string => idtac "Comment: None" 21 | | _ => idtac "Comment:" C 22 | end 23 | | None => 24 | idtac "Score: Ungraded"; 25 | idtac "Comment: None" 26 | end. 27 | 28 | End Check. 29 | 30 | From VFA Require Import Preface. 31 | Import Check. 32 | 33 | Goal True. 34 | 35 | idtac " ". 36 | 37 | idtac "Max points - standard: 0". 38 | idtac "Max points - advanced: 0". 39 | idtac "". 40 | idtac "Allowed Axioms:". 41 | idtac "functional_extensionality". 42 | idtac "functional_extensionality_dep". 43 | idtac "FunctionalExtensionality.functional_extensionality_dep". 44 | idtac "int". 45 | idtac "Abs". 46 | idtac "Abs_inj". 47 | idtac "ltb". 48 | idtac "ltb_lt". 49 | idtac "leb". 50 | idtac "leb_le". 51 | idtac "Extract.int". 52 | idtac "Extract.Abs". 53 | idtac "Extract.Abs_inj". 54 | idtac "Extract.ltb". 55 | idtac "Extract.ltb_lt". 56 | idtac "Extract.leb". 57 | idtac "Extract.leb_le". 58 | idtac "". 59 | idtac "". 60 | idtac "********** Summary **********". 61 | idtac "". 62 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 63 | idtac "". 64 | idtac "The output for each exercise can be any of the following:". 65 | idtac " - 'Closed under the global context', if it is complete". 66 | idtac " - 'MANUAL', if it is manually graded". 67 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 68 | idtac " the exercise is considered complete, if the axioms are all allowed.". 69 | idtac "". 70 | idtac "********** Standard **********". 71 | idtac "". 72 | idtac "********** Advanced **********". 73 | Abort. 74 | 75 | (* 2025-01-06 19:52 *) 76 | 77 | (* 2025-01-06 19:52 *) 78 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vc/hints.v: -------------------------------------------------------------------------------- 1 | Require Import VST.floyd.proofauto. 2 | Require Import VST.floyd.library. 3 | 4 | Ltac verif_stack_free_hint1 := 5 | match goal with 6 | |- semax ?D (PROPx _ (LOCALx ?Q (SEPx ?R))) 7 | (Ssequence 8 | (Scall _ (Evar ?free (Tfunction (Tcons (tptr tvoid) Tnil) tvoid cc_default)) 9 | (Etempvar ?i _ :: _)) _) _ => 10 | match Q with context [temp i ?q] => 11 | match R with context [data_at _ ?t _ q] => 12 | unify (Maps.PTree.get free (glob_specs D)) (Some library.free_spec'); 13 | idtac "When doing forward_call through this call to" free 14 | "you need to supply a WITH-witness of type (type*val*globals) and you need to supply a proof that" 15 | q "<>nullval. Look in your SEP clauses for 'data_at _" t "_" q"', which will be useful for both." 16 | "Regarding the proof, assert_PROP(...) will make use of the fact that data_at cannot be a nullval." 17 | "Regarding the witness, you should look at the funspec declared for" free 18 | "to see what will be needed; look in Verif_stack.v at free_spec_example." 19 | "But in particular, for the type, you can use the second argument of the data_at, that is," t 20 | "."; 21 | match goal with a : globals |- _ => 22 | idtac "Regarding the 'globals', you have" a ": globals above the line." 23 | end 24 | end end 25 | end. 26 | 27 | Ltac verif_stack_malloc_hint1_aux D R c := 28 | match c with 29 | | Ssequence ?c1 _ => verif_stack_malloc_hint1_aux D R c1 30 | | Scall _ (Evar ?malloc 31 | (Tfunction (Tcons tuint Tnil) (tptr tvoid) cc_default)) 32 | (cons (Esizeof ?t _) nil) => 33 | match R with context [mem_mgr ?gv] => 34 | idtac "try 'forward_call (" t "," gv ")'" 35 | end 36 | end. 37 | 38 | Ltac verif_stack_malloc_hint1 := 39 | match goal with |- semax ?D (PROPx _ (LOCALx _ (SEPx ?R))) ?c _ => 40 | verif_stack_malloc_hint1_aux D R c 41 | end. 42 | 43 | Ltac vc_special_hint := 44 | first 45 | [ verif_stack_free_hint1 46 | | verif_stack_malloc_hint1 47 | ]; 48 | idtac "THAT WAS NOT A STANDARD VST HINT, IT IS SPECIAL FOR THE VC VOLUME OF SOFTWARE FOUNDATIONS." 49 | "STANDARD VST HINTS WOULD BE AS FOLLOWS: 50 | ". 51 | 52 | Ltac hint_special ::= try vc_special_hint. 53 | 54 | (* 2023-03-25 11:30 *) 55 | -------------------------------------------------------------------------------- /src/tasks/coq_complete_from_json.py: -------------------------------------------------------------------------------- 1 | import json 2 | from pathlib import Path 3 | 4 | from inspect_ai import Task, eval, task 5 | from inspect_ai.dataset import MemoryDataset, Sample 6 | from inspect_ai.solver import generate, system_message, use_tools 7 | 8 | from models import AnthropicModel, OpenAIModel 9 | from prompts.completion import ALTERNATE_SYSTEM_MESSAGE 10 | from scorers.completion import coq_proven_scorer 11 | from tools.itp import coq_run_tool 12 | from tools.submission import coq_submit_tool 13 | 14 | 15 | def load_theorems(json_path: str): 16 | """Load theorems from JSON file""" 17 | with open(json_path) as f: 18 | return json.load(f) 19 | 20 | 21 | json_path = Path("src/dataset/processed_data/parsed_theorems.json") 22 | theorems = load_theorems(str(json_path)) 23 | 24 | 25 | @task 26 | def coq_completion_from_json(): 27 | """Create a Coq completion task from JSON theorem data""" 28 | json_path = Path("src/dataset/processed_data/parsed_theorems.json") 29 | theorems = load_theorems(str(json_path)) 30 | 31 | # Create a dataset with all theorems 32 | dataset_samples = [] 33 | for theorem in theorems: 34 | input_msg = ( 35 | "\n".join(dep["content"] for dep in theorem["dependencies"]) 36 | + "\n\n" 37 | + theorem["statement"] 38 | ) 39 | interface_file_contents = f"""Module Type Interface. 40 | {input_msg} 41 | Proof. Admitted. 42 | End Interface. 43 | """ 44 | definitions = theorem["name"] 45 | dataset_samples.append(Sample(input=f"```coq\n{input_msg}\n```", sandbox=True)) 46 | 47 | dataset = MemoryDataset(dataset_samples) 48 | 49 | # Return task with same configuration as coq_complete.py 50 | return Task( 51 | dataset=dataset, 52 | solver=[ 53 | system_message(ALTERNATE_SYSTEM_MESSAGE), 54 | use_tools( 55 | coq_run_tool(coq_flags=["-Q", ".", "LF"]), 56 | coq_submit_tool( 57 | project_name="LF", 58 | interface_file_contents=interface_file_contents, 59 | definitions=definitions, 60 | ), 61 | ), 62 | generate(), 63 | ], 64 | scorer=coq_proven_scorer(), 65 | ) 66 | 67 | 68 | if __name__ == "__main__": 69 | print("Starting evaluation...") 70 | eval(coq_completion_from_json(), model=OpenAIModel.DEBUG, message_limit=20) 71 | -------------------------------------------------------------------------------- /src/dataset/raw_data/slf/LibAxioms.v: -------------------------------------------------------------------------------- 1 | (* This file is extracted from the TLC library. 2 | http://github.com/charguer/tlc 3 | DO NOT EDIT. *) 4 | 5 | (************************************************************************** 6 | * TLC: A library for Coq * 7 | * Axioms * 8 | **************************************************************************) 9 | 10 | Set Implicit Arguments. 11 | 12 | (** This file is used to extend Coq with standard axioms from classical, 13 | non-constructive higher-order logic. (Such axioms are provided by 14 | default in other theorem provers like Isabelle/HOL or HOL4.) *) 15 | 16 | (** Three axioms taken are: functional extensionality, and propositional 17 | extensionality and indefinite description. 18 | 19 | All other comomn axioms are derivable, including: the excluded middle, 20 | the strong excluded middle, propositional degenerency, proof irrelevance, 21 | injectivity of equality on dependent pairs, predicate extensionality, 22 | definite description, and all the versions of the axiom of choice. *) 23 | 24 | (* ********************************************************************** *) 25 | (* ################################################################# *) 26 | (** * Functional extensionality *) 27 | 28 | (** Two functions that yield equal results on equal arguments are equal. *) 29 | 30 | Axiom fun_ext_dep : forall (A : Type) (B : A->Type) (f g : forall x, B x), 31 | (forall x, f x = g x) -> 32 | f = g. 33 | 34 | (* ********************************************************************** *) 35 | (* ################################################################# *) 36 | (** * Propositional extensionality *) 37 | 38 | (** Two propositions that are equivalent can be considered to be equal. *) 39 | 40 | Axiom prop_ext : forall (P Q : Prop), 41 | (P <-> Q) -> 42 | P = Q. 43 | 44 | (* ********************************************************************** *) 45 | (* ################################################################# *) 46 | (** * Indefinite description *) 47 | 48 | (** Proofs of existence can be reified from [Prop] to [Type]. The lemma 49 | below is a concise statement for [(exists x, P x) -> { x : A | P x }]. *) 50 | 51 | Axiom indefinite_description : forall (A : Type) (P : A->Prop), 52 | ex P -> 53 | sig P. 54 | 55 | (* 2024-12-26 10:21 *) 56 | -------------------------------------------------------------------------------- /src/dataset/raw_data/plf/NormTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | From Coq Require Export String. 3 | From PLF Require Import Norm. 4 | 5 | Parameter MISSING: Type. 6 | 7 | Module Check. 8 | 9 | Ltac check_type A B := 10 | match type of A with 11 | | context[MISSING] => idtac "Missing:" A 12 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 13 | end. 14 | 15 | Ltac print_manual_grade A := 16 | match eval compute in A with 17 | | Some (_ ?S ?C) => 18 | idtac "Score:" S; 19 | match eval compute in C with 20 | | ""%string => idtac "Comment: None" 21 | | _ => idtac "Comment:" C 22 | end 23 | | None => 24 | idtac "Score: Ungraded"; 25 | idtac "Comment: None" 26 | end. 27 | 28 | End Check. 29 | 30 | From PLF Require Import Norm. 31 | Import Check. 32 | 33 | Goal True. 34 | 35 | idtac "------------------- norm_fail --------------------". 36 | idtac " ". 37 | 38 | idtac "#> Manually graded: norm_fail". 39 | idtac "Possible points: 2". 40 | print_manual_grade manual_grade_for_norm_fail. 41 | idtac " ". 42 | 43 | idtac "------------------- norm --------------------". 44 | idtac " ". 45 | 46 | idtac "#> Manually graded: norm". 47 | idtac "Possible points: 10". 48 | print_manual_grade manual_grade_for_norm. 49 | idtac " ". 50 | 51 | idtac " ". 52 | 53 | idtac "Max points - standard: 12". 54 | idtac "Max points - advanced: 12". 55 | idtac "". 56 | idtac "Allowed Axioms:". 57 | idtac "functional_extensionality". 58 | idtac "FunctionalExtensionality.functional_extensionality_dep". 59 | idtac "CSeq_congruence". 60 | idtac "fold_constants_bexp_sound". 61 | idtac "succ_hastype_nat__hastype_nat". 62 | idtac "". 63 | idtac "". 64 | idtac "********** Summary **********". 65 | idtac "". 66 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 67 | idtac "". 68 | idtac "The output for each exercise can be any of the following:". 69 | idtac " - 'Closed under the global context', if it is complete". 70 | idtac " - 'MANUAL', if it is manually graded". 71 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 72 | idtac " the exercise is considered complete, if the axioms are all allowed.". 73 | idtac "". 74 | idtac "********** Standard **********". 75 | idtac "---------- norm_fail ---------". 76 | idtac "MANUAL". 77 | idtac "---------- norm ---------". 78 | idtac "MANUAL". 79 | idtac "". 80 | idtac "********** Advanced **********". 81 | Abort. 82 | 83 | (* 2025-01-06 19:49 *) 84 | 85 | (* 2025-01-06 19:49 *) 86 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vc/hash.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern void * malloc (size_t n); 4 | extern void exit(int n); 5 | extern size_t strlen(const char *str); 6 | extern char *strcpy(char *dest, const char *src); 7 | extern int strcmp(const char *str1, const char *str2); 8 | 9 | unsigned int hash (char *s) { 10 | unsigned int n=0; 11 | size_t i=0; 12 | int c=s[i]; 13 | while (c) { 14 | n = n*65599u+(unsigned)c; 15 | i++; 16 | c=s[i]; 17 | } 18 | return n; 19 | } 20 | 21 | struct cell { 22 | char *key; 23 | unsigned int count; 24 | struct cell *next; 25 | }; 26 | 27 | enum {N = 109}; 28 | 29 | struct hashtable { 30 | struct cell *buckets[N]; 31 | }; 32 | 33 | char *copy_string (char *s) { 34 | size_t n = strlen(s)+1; 35 | char *p = malloc(n); 36 | if (!p) exit(1); 37 | strcpy(p,s); 38 | return p; 39 | } 40 | 41 | struct hashtable *new_table (void) { 42 | int i; 43 | struct hashtable *p = (struct hashtable *)malloc(sizeof(struct hashtable)); 44 | if (!p) exit(1); 45 | for (i=0; ibuckets[i]=NULL; 46 | return p; 47 | } 48 | 49 | struct cell *new_cell (char *key, int count, struct cell *next) { 50 | struct cell *p = (struct cell *)malloc(sizeof(struct cell)); 51 | if (!p) exit(1); 52 | p->key = copy_string(key); 53 | p->count = count; 54 | p->next = next; 55 | return p; 56 | } 57 | 58 | unsigned int get (struct hashtable *table, char *s) { 59 | unsigned int h = hash(s); 60 | unsigned int b = h % N; 61 | struct cell *p = table->buckets[b]; 62 | while (p) { 63 | if (strcmp(p->key, s)==0) 64 | return p->count; 65 | p=p->next; 66 | } 67 | return 0; 68 | } 69 | 70 | void incr_list (struct cell **r0, char *s) { 71 | struct cell *p, **r; 72 | for(r=r0; ; r=&p->next) { 73 | p = *r; 74 | if (!p) { 75 | *r = new_cell(s,1,NULL); 76 | return; 77 | } 78 | if (strcmp(p->key, s)==0) { 79 | p->count++; 80 | return; 81 | } 82 | } 83 | } 84 | 85 | void incr (struct hashtable *table, char *s) { 86 | unsigned int h = hash(s); 87 | unsigned int b = h % N; 88 | incr_list (& table->buckets[b], s); 89 | } 90 | 91 | void incrx (struct hashtable *table, char *s) { 92 | unsigned int h = hash(s); 93 | unsigned int b = h % N; 94 | struct cell *p = table->buckets[b]; 95 | while (p) { 96 | if (strcmp(p->key, s)==0) { 97 | p->count++; 98 | return; 99 | } 100 | p=p->next; 101 | } 102 | table->buckets[b]=new_cell(s, 1, table->buckets[b]); 103 | } 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /src/tools/itp.py: -------------------------------------------------------------------------------- 1 | import shutil 2 | import subprocess 3 | import tempfile 4 | from pathlib import Path 5 | 6 | from inspect_ai.tool import tool 7 | 8 | from project_util import CoqProject, File, LeanProject 9 | from run_itp import run_coq_str_in_project, run_lean_str_in_project 10 | 11 | 12 | @tool 13 | def coq_run_tool( 14 | project_root: str = "", 15 | extra_files: dict[str, bytes] = {}, 16 | setup_cmds: list = [], 17 | coq_flags: list[str] = [], 18 | ): 19 | coq_project = CoqProject.read(project_root) if project_root else CoqProject() 20 | for extra_filename, content in extra_files.items(): 21 | try: 22 | content = content.decode("utf-8") 23 | except UnicodeDecodeError: 24 | pass 25 | coq_project[extra_filename] = File(content) 26 | for cmd in setup_cmds: 27 | _, coq_project = coq_project.run_cmd(cmd, shell=True, check=True) 28 | 29 | async def run(coq_code: str): 30 | """ 31 | Runs the given Coq code in the project environment. It then returns a dictionary containing the status, stdout and stderr given from the execution of the code. 32 | 33 | Args: 34 | coq_code (str): Coq code to be run 35 | 36 | Returns: 37 | Dict: Compilation status (0 if it worked, 1 if there was an error), stdout (str), and stderr (str) 38 | """ 39 | result = run_coq_str_in_project(coq_code, coq_project, coq_flags) 40 | return result 41 | 42 | return run 43 | 44 | 45 | @tool 46 | def lean_run_tool( 47 | project_root: str = "", 48 | extra_files: dict[str, bytes] = {}, 49 | setup_cmds: list = [], 50 | lean_flags: list[str] = [], 51 | ): 52 | lean_project = LeanProject.read(project_root) if project_root else LeanProject() 53 | 54 | for extra_filename, content in extra_files.items(): 55 | try: 56 | content = content.decode("utf-8") 57 | except UnicodeDecodeError: 58 | pass 59 | lean_project[extra_filename] = File(content) 60 | 61 | for cmd in setup_cmds: 62 | _, lean_project = lean_project.run_cmd(cmd, shell=True, check=True) 63 | 64 | async def run(lean_code: str): 65 | """ 66 | Runs the given Lean code in the project environment. It then returns a dictionary containing the status, stdout and stderr given from the execution of the code. 67 | 68 | Args: 69 | lean_code (str): Lean code to be run 70 | 71 | Returns: 72 | Dict: Compilation status (0 if it worked, 1 if there was an error), stdout (str), and stderr (str) 73 | """ 74 | result = run_lean_str_in_project(lean_code, lean_project, lean_flags) 75 | return result 76 | 77 | return run 78 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Develop Python in Docker 2 | 3 | *Note: These instructions generally assume you're working in a Unix shell (bash, zsh etc.)* 4 | 5 | This setup is broadly inspired by [https://github.com/astral-sh/uv-docker-example](https://github.com/astral-sh/uv-docker-example). 6 | 7 | ### Why 8 | 9 | - Consistent environment across machines - i.e. no worrying about installing dependencies, stuff running my machine and not on yours/in the cloud. 10 | 11 | ### Prerequisites 12 | 13 | 1. Install Docker, probably through [docker desktop](https://docs.docker.com/desktop/setup/install/linux/ubuntu/) or [docker engine](https://docs.docker.com/engine/install/ubuntu/). 14 | - Verify it's installed by running `docker --version` 15 | 16 | 1. If you haven't installed Docker Desktop, install the [Docker Compose plugin](https://docs.docker.com/compose/install/linux/#install-using-the-repository) 17 | - Verify it's installed by running `docker compose version` 18 | 19 | 1. If using VSCode or Cursor, install the following extensions: 20 | - [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) 21 | - [Docker](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker) 22 | 23 | ### Steps 24 | 25 | 1. Clone the repo and `cd` into it. 26 | 1. Run `docker compose up -d` 27 | - Note: If you change anything in the `Dockerfile`, you may need to run `docker-compose up -d --build` to see the changes reflected in the container. 28 | 1. Open the Docker extension in your toolbar, you should see a running container called `autoformalization-autoformalization` running. 29 | 1. Right click it and select 'Attach Visual Studio Code'. This should open up a new VSCode Window inside the container. 30 | 1. Any changes you make to files within the `/autoformalization` directory within the container should be reflected in the `autoformalization` directory on your machine. 31 | 32 | To stop the container, you can run `docker compose down`. 33 | 34 | ### Adding Python dependencies 35 | 36 | 1. Run `uv add ` 37 | 1. Make sure you commit the changed `uv.lock` and `pyproject.toml` files to Git. 38 | 39 | ## Running Pre-Commit 40 | 41 | This will lint and format your code. 42 | 43 | 1. To manually run pre-commit, simply run `pre-commit`. 44 | 1. To avoid having to manually run, you can set it to automatically run every time you run `git commit` by running `pre-commit install`. 45 | 46 | ### About UV 47 | 48 | UV is a super fast Python dependency manager. It manages Python dependencies, build dependencies, Python versions and probably more. It's probably best described as a better version of poetry. It's nice because it's: 49 | 50 | 1. Really fast. 51 | 1. Maintains a lock file. 52 | 53 | Read more about it [here](https://docs.astral.sh/uv/). -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Use a Python image with uv pre-installed 2 | FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim 3 | 4 | # Install linux packages 5 | RUN apt-get update && apt-get install -y \ 6 | git \ 7 | make \ 8 | curl \ 9 | gcc \ 10 | bubblewrap \ 11 | libgmp-dev \ 12 | unzip \ 13 | time \ 14 | pkg-config \ 15 | build-essential \ 16 | libgmp-dev \ 17 | linux-libc-dev \ 18 | rsync \ 19 | vim \ 20 | autoconf \ 21 | && rm -rf /var/lib/apt/lists/* 22 | # N.B. rsync is required for opam pin to a directory 23 | 24 | RUN printf '\nsource /usr/share/bash-completion/completions/git\n' >> $HOME/.bashrc 25 | 26 | # Install Coq and Lean as early as possible to minimize rebuild frequency 27 | # Install OCaml separately from Coq to allow changing the version of Coq without reinstalling OCaml 28 | # Install the coq-lean-importer late to allow rebuilding it without rebuilding everything else 29 | RUN mkdir -p /root/autoformalization 30 | RUN mkdir -p /root/install 31 | COPY install/coq_01_opam_install.sh /root/install/coq_01_opam_install.sh 32 | RUN chmod +x /root/install/coq_01_opam_install.sh \ 33 | && /root/install/coq_01_opam_install.sh 34 | COPY install/coq_02_coq_install.sh /root/install/coq_02_coq_install.sh 35 | RUN chmod +x /root/install/coq_02_coq_install.sh \ 36 | && /root/install/coq_02_coq_install.sh 37 | COPY install/lean_install.sh /root/install/lean_install.sh 38 | RUN chmod +x /root/install/lean_install.sh \ 39 | && /root/install/lean_install.sh 40 | COPY install/coq_03_lean_import_install.sh /root/install/coq_03_lean_import_install.sh 41 | RUN chmod +x /root/install/coq_03_lean_import_install.sh \ 42 | && /root/install/coq_03_lean_import_install.sh 43 | 44 | # Keep the venv separate from the project directory to stop overwriting the venv when 45 | # the project directory is mounted as a volume 46 | WORKDIR /uv 47 | RUN git config --global --add safe.directory /root/autoformalization 48 | 49 | # Copy from the cache instead of linking since it's a mounted volume 50 | ENV UV_LINK_MODE=copy 51 | 52 | # Install the project's dependencies using the lockfile and settings 53 | RUN --mount=type=cache,target=/root/.cache/uv \ 54 | --mount=type=bind,source=uv.lock,target=uv.lock \ 55 | --mount=type=bind,source=pyproject.toml,target=pyproject.toml \ 56 | uv sync --frozen --no-install-project 57 | 58 | # Place executables in the environment at the front of the path 59 | ENV PATH="/uv/.venv/bin:$PATH" 60 | 61 | # Tell uv where the environment is 62 | ENV VIRTUAL_ENV=/uv/.venv 63 | ENV UV_PROJECT_ENVIRONMENT=/uv/.venv 64 | ENV PYTHONPATH=$PYTHONPATH:/root/autoformalization:/root/autoformalization/src 65 | 66 | WORKDIR /root/autoformalization 67 | 68 | # Infinite loop to keep the container running 69 | ENTRYPOINT ["tail", "-f", "/dev/null"] 70 | -------------------------------------------------------------------------------- /src/dataset/pre_processed_data/ImpCEvalFunTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | 3 | From Coq Require Export String. 4 | 5 | From LF Require Import ImpCEvalFun. 6 | 7 | Parameter MISSING: Type. 8 | 9 | Module Check. 10 | 11 | Ltac check_type A B := 12 | match type of A with 13 | | context[MISSING] => idtac "Missing:" A 14 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 15 | end. 16 | 17 | Ltac print_manual_grade A := 18 | match eval compute in A with 19 | | Some (_ ?S ?C) => 20 | idtac "Score:" S; 21 | match eval compute in C with 22 | | ""%string => idtac "Comment: None" 23 | | _ => idtac "Comment:" C 24 | end 25 | | None => 26 | idtac "Score: Ungraded"; 27 | idtac "Comment: None" 28 | end. 29 | 30 | End Check. 31 | 32 | From LF Require Import ImpCEvalFun. 33 | 34 | Import Check. 35 | 36 | Goal True. 37 | 38 | idtac "------------------- ceval_step__ceval_inf --------------------". 39 | idtac " ". 40 | 41 | idtac "#> Manually graded: ceval_step__ceval_inf". 42 | idtac "Advanced". 43 | idtac "Possible points: 6". 44 | print_manual_grade manual_grade_for_ceval_step__ceval_inf. 45 | idtac " ". 46 | 47 | idtac "------------------- ceval__ceval_step --------------------". 48 | idtac " ". 49 | 50 | idtac "#> ceval__ceval_step". 51 | idtac "Possible points: 3". 52 | check_type @ceval__ceval_step ( 53 | (forall (c : Imp.com) (st st' : Imp.state), 54 | Imp.ceval c st st' -> 55 | exists i : nat, ceval_step st c i = @Some Imp.state st')). 56 | idtac "Assumptions:". 57 | Abort. 58 | Print Assumptions ceval__ceval_step. 59 | 60 | Goal True. 61 | idtac " ". 62 | 63 | idtac " ". 64 | 65 | idtac "Max points - standard: 3". 66 | idtac "Max points - advanced: 9". 67 | idtac "". 68 | idtac "Allowed Axioms:". 69 | idtac "functional_extensionality". 70 | idtac "FunctionalExtensionality.functional_extensionality_dep". 71 | idtac "plus_le". 72 | idtac "le_trans". 73 | idtac "le_plus_l". 74 | idtac "add_le_cases". 75 | idtac "Sn_le_Sm__n_le_m". 76 | idtac "O_le_n". 77 | idtac "". 78 | idtac "". 79 | idtac "********** Summary **********". 80 | idtac "". 81 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 82 | idtac "". 83 | idtac "The output for each exercise can be any of the following:". 84 | idtac " - 'Closed under the global context', if it is complete". 85 | idtac " - 'MANUAL', if it is manually graded". 86 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 87 | idtac " the exercise is considered complete, if the axioms are all allowed.". 88 | idtac "". 89 | idtac "********** Standard **********". 90 | idtac "---------- ceval__ceval_step ---------". 91 | Print Assumptions ceval__ceval_step. 92 | idtac "". 93 | idtac "********** Advanced **********". 94 | idtac "---------- ceval_step__ceval_inf ---------". 95 | idtac "MANUAL". 96 | Abort. 97 | -------------------------------------------------------------------------------- /src/dataset/reconstructed_files/ImpCEvalFunTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | 3 | From Coq Require Export String. 4 | 5 | From LF Require Import ImpCEvalFun. 6 | 7 | Parameter MISSING: Type. 8 | 9 | Module Check. 10 | 11 | Ltac check_type A B := 12 | match type of A with 13 | | context[MISSING] => idtac "Missing:" A 14 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 15 | end. 16 | 17 | Ltac print_manual_grade A := 18 | match eval compute in A with 19 | | Some (_ ?S ?C) => 20 | idtac "Score:" S; 21 | match eval compute in C with 22 | | ""%string => idtac "Comment: None" 23 | | _ => idtac "Comment:" C 24 | end 25 | | None => 26 | idtac "Score: Ungraded"; 27 | idtac "Comment: None" 28 | end. 29 | 30 | End Check. 31 | 32 | From LF Require Import ImpCEvalFun. 33 | 34 | Import Check. 35 | 36 | Goal True. 37 | 38 | idtac "------------------- ceval_step__ceval_inf --------------------". 39 | idtac " ". 40 | 41 | idtac "#> Manually graded: ceval_step__ceval_inf". 42 | idtac "Advanced". 43 | idtac "Possible points: 6". 44 | print_manual_grade manual_grade_for_ceval_step__ceval_inf. 45 | idtac " ". 46 | 47 | idtac "------------------- ceval__ceval_step --------------------". 48 | idtac " ". 49 | 50 | idtac "#> ceval__ceval_step". 51 | idtac "Possible points: 3". 52 | check_type @ceval__ceval_step ( 53 | (forall (c : Imp.com) (st st' : Imp.state), 54 | Imp.ceval c st st' -> 55 | exists i : nat, ceval_step st c i = @Some Imp.state st')). 56 | idtac "Assumptions:". 57 | Abort. 58 | Print Assumptions ceval__ceval_step. 59 | 60 | Goal True. 61 | idtac " ". 62 | 63 | idtac " ". 64 | 65 | idtac "Max points - standard: 3". 66 | idtac "Max points - advanced: 9". 67 | idtac "". 68 | idtac "Allowed Axioms:". 69 | idtac "functional_extensionality". 70 | idtac "FunctionalExtensionality.functional_extensionality_dep". 71 | idtac "plus_le". 72 | idtac "le_trans". 73 | idtac "le_plus_l". 74 | idtac "add_le_cases". 75 | idtac "Sn_le_Sm__n_le_m". 76 | idtac "O_le_n". 77 | idtac "". 78 | idtac "". 79 | idtac "********** Summary **********". 80 | idtac "". 81 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 82 | idtac "". 83 | idtac "The output for each exercise can be any of the following:". 84 | idtac " - 'Closed under the global context', if it is complete". 85 | idtac " - 'MANUAL', if it is manually graded". 86 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 87 | idtac " the exercise is considered complete, if the axioms are all allowed.". 88 | idtac "". 89 | idtac "********** Standard **********". 90 | idtac "---------- ceval__ceval_step ---------". 91 | Print Assumptions ceval__ceval_step. 92 | idtac "". 93 | idtac "********** Advanced **********". 94 | idtac "---------- ceval_step__ceval_inf ---------". 95 | idtac "MANUAL". 96 | Abort. 97 | 98 | -------------------------------------------------------------------------------- /src/dataset/raw_data/lf/ImpCEvalFunTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | From Coq Require Export String. 3 | From LF Require Import ImpCEvalFun. 4 | 5 | Parameter MISSING: Type. 6 | 7 | Module Check. 8 | 9 | Ltac check_type A B := 10 | match type of A with 11 | | context[MISSING] => idtac "Missing:" A 12 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 13 | end. 14 | 15 | Ltac print_manual_grade A := 16 | match eval compute in A with 17 | | Some (_ ?S ?C) => 18 | idtac "Score:" S; 19 | match eval compute in C with 20 | | ""%string => idtac "Comment: None" 21 | | _ => idtac "Comment:" C 22 | end 23 | | None => 24 | idtac "Score: Ungraded"; 25 | idtac "Comment: None" 26 | end. 27 | 28 | End Check. 29 | 30 | From LF Require Import ImpCEvalFun. 31 | Import Check. 32 | 33 | Goal True. 34 | 35 | idtac "------------------- ceval_step__ceval_inf --------------------". 36 | idtac " ". 37 | 38 | idtac "#> Manually graded: ceval_step__ceval_inf". 39 | idtac "Advanced". 40 | idtac "Possible points: 6". 41 | print_manual_grade manual_grade_for_ceval_step__ceval_inf. 42 | idtac " ". 43 | 44 | idtac "------------------- ceval__ceval_step --------------------". 45 | idtac " ". 46 | 47 | idtac "#> ceval__ceval_step". 48 | idtac "Possible points: 3". 49 | check_type @ceval__ceval_step ( 50 | (forall (c : Imp.com) (st st' : Imp.state), 51 | Imp.ceval c st st' -> 52 | exists i : nat, ceval_step st c i = @Some Imp.state st')). 53 | idtac "Assumptions:". 54 | Abort. 55 | Print Assumptions ceval__ceval_step. 56 | Goal True. 57 | idtac " ". 58 | 59 | idtac " ". 60 | 61 | idtac "Max points - standard: 3". 62 | idtac "Max points - advanced: 9". 63 | idtac "". 64 | idtac "Allowed Axioms:". 65 | idtac "functional_extensionality". 66 | idtac "FunctionalExtensionality.functional_extensionality_dep". 67 | idtac "plus_le". 68 | idtac "le_trans". 69 | idtac "le_plus_l". 70 | idtac "add_le_cases". 71 | idtac "Sn_le_Sm__n_le_m". 72 | idtac "O_le_n". 73 | idtac "". 74 | idtac "". 75 | idtac "********** Summary **********". 76 | idtac "". 77 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 78 | idtac "". 79 | idtac "The output for each exercise can be any of the following:". 80 | idtac " - 'Closed under the global context', if it is complete". 81 | idtac " - 'MANUAL', if it is manually graded". 82 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 83 | idtac " the exercise is considered complete, if the axioms are all allowed.". 84 | idtac "". 85 | idtac "********** Standard **********". 86 | idtac "---------- ceval__ceval_step ---------". 87 | Print Assumptions ceval__ceval_step. 88 | idtac "". 89 | idtac "********** Advanced **********". 90 | idtac "---------- ceval_step__ceval_inf ---------". 91 | idtac "MANUAL". 92 | Abort. 93 | 94 | (* 2025-01-13 16:00 *) 95 | 96 | (* 2025-01-13 16:00 *) 97 | -------------------------------------------------------------------------------- /src/solvers/workflows.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass, field 2 | from typing import Iterator, Self 3 | 4 | from inspect_ai.tool import Tool 5 | 6 | from prompts.transpilation import ( 7 | MULTIPHASE_ANALYZE_MESSAGE, 8 | MULTIPHASE_FORMAT_OUTPUT_MESSAGE, 9 | MULTIPHASE_MAP_IDENTIFIERS_MESSAGE, 10 | MULTIPHASE_SYSTEM_MESSAGE, 11 | MULTIPHASE_TRANSLATE_MESSAGE, 12 | ) 13 | from tools.transpilation import ( 14 | pop_statement_from_queue_tool, 15 | pop_translation_from_queue_tool, 16 | push_statement_to_queue_tool, 17 | push_translation_to_queue_tool, 18 | swap_statements_in_queue_tool, 19 | update_identifier_mappings_tool, 20 | view_identifier_mappings_tool, 21 | view_statement_queue_tool, 22 | ) 23 | 24 | 25 | @dataclass 26 | class Phase: 27 | name: str 28 | prompt: str 29 | tools: list[Tool] 30 | number: int | None = None 31 | 32 | 33 | @dataclass 34 | class Workflow: 35 | system_prompt: str 36 | phases: list[Phase] 37 | common_tools: list[Tool] = field(default_factory=list) 38 | 39 | def __post_init__(self): 40 | for i, phase in enumerate(self.phases): 41 | phase.number = i + 1 42 | phase.prompt = phase.prompt.format( 43 | phase_number=phase.number, total_phases=len(self) 44 | ) 45 | 46 | def with_tools(self, tools: list[Tool]) -> Self: 47 | self.common_tools.extend(tools) 48 | return self 49 | 50 | def __iter__(self) -> Iterator[Phase]: 51 | return iter(self.phases) 52 | 53 | def __len__(self) -> int: 54 | return len(self.phases) 55 | 56 | 57 | # NOTE: This is basically just a config - probably better placed in a yaml/json file 58 | # TODO: Refactor to translate chunks and prove isomorphisms for each chunk as we go 59 | SIMPLE_WORKFLOW = Workflow( 60 | system_prompt=MULTIPHASE_SYSTEM_MESSAGE, 61 | phases=[ 62 | Phase( 63 | name="ANALYZE", 64 | prompt=MULTIPHASE_ANALYZE_MESSAGE, 65 | tools=[ 66 | push_statement_to_queue_tool(), 67 | pop_statement_from_queue_tool(), 68 | view_statement_queue_tool(), 69 | swap_statements_in_queue_tool(), 70 | ], 71 | ), 72 | Phase( 73 | name="TRANSLATE", 74 | prompt=MULTIPHASE_TRANSLATE_MESSAGE, 75 | tools=[ 76 | push_translation_to_queue_tool(), 77 | pop_translation_from_queue_tool(), 78 | pop_statement_from_queue_tool(), 79 | view_statement_queue_tool(), 80 | ], 81 | ), 82 | Phase( 83 | name="MAP_IDENTIFIERS", 84 | prompt=MULTIPHASE_MAP_IDENTIFIERS_MESSAGE, 85 | tools=[ 86 | update_identifier_mappings_tool(), 87 | view_identifier_mappings_tool(), 88 | ], 89 | ), 90 | Phase(name="FORMAT_OUTPUT", prompt=MULTIPHASE_FORMAT_OUTPUT_MESSAGE, tools=[]), 91 | ], 92 | ) 93 | -------------------------------------------------------------------------------- /src/dataset/pre_processed_data/MapsTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | 3 | From Coq Require Export String. 4 | 5 | From LF Require Import Maps. 6 | 7 | Parameter MISSING: Type. 8 | 9 | Module Check. 10 | 11 | Ltac check_type A B := 12 | match type of A with 13 | | context[MISSING] => idtac "Missing:" A 14 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 15 | end. 16 | 17 | Ltac print_manual_grade A := 18 | match eval compute in A with 19 | | Some (_ ?S ?C) => 20 | idtac "Score:" S; 21 | match eval compute in C with 22 | | ""%string => idtac "Comment: None" 23 | | _ => idtac "Comment:" C 24 | end 25 | | None => 26 | idtac "Score: Ungraded"; 27 | idtac "Comment: None" 28 | end. 29 | 30 | End Check. 31 | 32 | From LF Require Import Maps. 33 | 34 | Import Check. 35 | 36 | Goal True. 37 | 38 | idtac "------------------- t_update_same --------------------". 39 | idtac " ". 40 | 41 | idtac "#> t_update_same". 42 | idtac "Possible points: 2". 43 | check_type @t_update_same ( 44 | (forall (A : Type) (m : total_map A) (x : string), (x !-> m x; m) = m)). 45 | idtac "Assumptions:". 46 | Abort. 47 | Print Assumptions t_update_same. 48 | 49 | Goal True. 50 | idtac " ". 51 | 52 | idtac "------------------- t_update_permute --------------------". 53 | idtac " ". 54 | 55 | idtac "#> t_update_permute". 56 | idtac "Possible points: 3". 57 | check_type @t_update_permute ( 58 | (forall (A : Type) (m : total_map A) (v1 v2 : A) (x1 x2 : string), 59 | x2 <> x1 -> (x1 !-> v1; x2 !-> v2; m) = (x2 !-> v2; x1 !-> v1; m))). 60 | idtac "Assumptions:". 61 | Abort. 62 | Print Assumptions t_update_permute. 63 | 64 | Goal True. 65 | idtac " ". 66 | 67 | idtac " ". 68 | 69 | idtac "Max points - standard: 5". 70 | idtac "Max points - advanced: 5". 71 | idtac "". 72 | idtac "Allowed Axioms:". 73 | idtac "functional_extensionality". 74 | idtac "FunctionalExtensionality.functional_extensionality_dep". 75 | idtac "plus_le". 76 | idtac "le_trans". 77 | idtac "le_plus_l". 78 | idtac "add_le_cases". 79 | idtac "Sn_le_Sm__n_le_m". 80 | idtac "O_le_n". 81 | idtac "". 82 | idtac "". 83 | idtac "********** Summary **********". 84 | idtac "". 85 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 86 | idtac "". 87 | idtac "The output for each exercise can be any of the following:". 88 | idtac " - 'Closed under the global context', if it is complete". 89 | idtac " - 'MANUAL', if it is manually graded". 90 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 91 | idtac " the exercise is considered complete, if the axioms are all allowed.". 92 | idtac "". 93 | idtac "********** Standard **********". 94 | idtac "---------- t_update_same ---------". 95 | Print Assumptions t_update_same. 96 | idtac "---------- t_update_permute ---------". 97 | Print Assumptions t_update_permute. 98 | idtac "". 99 | idtac "********** Advanced **********". 100 | Abort. 101 | -------------------------------------------------------------------------------- /src/simple-tests/StackMachine-statements.v: -------------------------------------------------------------------------------- 1 | From Coq Require Import Bool Arith List. 2 | (* Set Implicit Arguments. 3 | Set Asymmetric Patterns. *) 4 | 5 | (*Define the source language first*) 6 | Inductive binop : Set := Plus | Times. 7 | 8 | Inductive exp : Set := 9 | Const : nat -> exp 10 | | Binop : binop -> exp -> exp -> exp. (* Binop is a function which takes exp and exp and gives exp. This is just currying*) 11 | 12 | Definition binopDenote (b : binop) : nat -> nat -> nat := 13 | match b with 14 | | Plus => plus 15 | | Times => mult 16 | end. 17 | 18 | Fixpoint expDenote (e: exp) : nat := 19 | match e with 20 | | Const n => n 21 | | Binop b e1 e2 => (binopDenote b) (expDenote e1) (expDenote e2) 22 | end. 23 | 24 | (*Define the target language*) 25 | 26 | Inductive instr: Set := 27 | | iConst : nat -> instr 28 | | iBinop : binop -> instr. (*Instructions can be either constants or binary operation*) 29 | 30 | Definition prog := list instr. (*Program is a list of instructions*) 31 | Definition stack := list nat. (*Instruction either pushes a constant to the stack or applies binop on two elements on the stack*) 32 | 33 | Definition instrDenote (i : instr) (s: stack): option stack := 34 | match i with 35 | | iConst n => Some (n :: s) 36 | | iBinop b => 37 | match s with 38 | | arg1 :: arg2 :: s' => Some ((binopDenote b) arg1 arg2 :: s') 39 | | _ => None 40 | end 41 | end. 42 | 43 | Fixpoint progDenote (p : prog) (s: stack) : option stack := 44 | match p with 45 | | nil => Some s 46 | | i::p' => 47 | match instrDenote i s with 48 | | None => None 49 | | Some s' => progDenote p' s' 50 | end 51 | end. (*Run instructions one by one*) 52 | 53 | (*Translation for the language i.e. Compiler*) 54 | Fixpoint compile (e : exp): prog := 55 | match e with 56 | | Const n => iConst n::nil 57 | | Binop b e1 e2 => compile e2 ++ compile e1 ++ iBinop b :: nil 58 | end. 59 | 60 | (*Check the correctness of the compiler itself*) 61 | Definition compile_one_instr_statement:= forall e p s, progDenote (compile e ++ p) s = progDenote p (expDenote e :: s). 62 | 63 | Definition compile_correct_statement:= forall e, progDenote (compile e) nil = Some (expDenote e::nil). 64 | 65 | Definition bin_op_comm_statement:= forall b e1 e2, expDenote (Binop b e1 e2) = expDenote (Binop b e2 e1). 66 | 67 | Definition reverse_merge_statement:= forall e1 e2 b, compile e2 ++ compile e1 ++ iBinop b::nil = compile (Binop b e1 e2). 68 | 69 | Definition compile_op_comm_statement:= forall b e1 e2, progDenote (compile e2 ++ compile e1 ++ iBinop b::nil) nil = progDenote (compile e1 ++ compile e2 ++ iBinop b::nil) nil. 70 | 71 | Definition const_eq_statement:= forall n n', Const n = Const n' -> n = n'. 72 | 73 | Definition const_ins_eq_statement:= forall n n', iConst n = iConst n' -> n = n'. 74 | 75 | Definition const_only_const_statement:= forall e n, Const n = e -> e = Const n. 76 | 77 | Definition list_eq_statement:= forall a1 a2 : Type, a1::nil = a2::nil -> a1 = a2. 78 | 79 | Definition const_cmpl_statement:= forall n b e1 e2, compile e2 ++ compile e1 ++ iBinop b :: nil <> iConst n :: nil. 80 | -------------------------------------------------------------------------------- /src/dataset/reconstructed_files/MapsTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | 3 | From Coq Require Export String. 4 | 5 | From LF Require Import Maps. 6 | 7 | Parameter MISSING: Type. 8 | 9 | Module Check. 10 | 11 | Ltac check_type A B := 12 | match type of A with 13 | | context[MISSING] => idtac "Missing:" A 14 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 15 | end. 16 | 17 | Ltac print_manual_grade A := 18 | match eval compute in A with 19 | | Some (_ ?S ?C) => 20 | idtac "Score:" S; 21 | match eval compute in C with 22 | | ""%string => idtac "Comment: None" 23 | | _ => idtac "Comment:" C 24 | end 25 | | None => 26 | idtac "Score: Ungraded"; 27 | idtac "Comment: None" 28 | end. 29 | 30 | End Check. 31 | 32 | From LF Require Import Maps. 33 | 34 | Import Check. 35 | 36 | Goal True. 37 | 38 | idtac "------------------- t_update_same --------------------". 39 | idtac " ". 40 | 41 | idtac "#> t_update_same". 42 | idtac "Possible points: 2". 43 | check_type @t_update_same ( 44 | (forall (A : Type) (m : total_map A) (x : string), (x !-> m x; m) = m)). 45 | idtac "Assumptions:". 46 | Abort. 47 | Print Assumptions t_update_same. 48 | 49 | Goal True. 50 | idtac " ". 51 | 52 | idtac "------------------- t_update_permute --------------------". 53 | idtac " ". 54 | 55 | idtac "#> t_update_permute". 56 | idtac "Possible points: 3". 57 | check_type @t_update_permute ( 58 | (forall (A : Type) (m : total_map A) (v1 v2 : A) (x1 x2 : string), 59 | x2 <> x1 -> (x1 !-> v1; x2 !-> v2; m) = (x2 !-> v2; x1 !-> v1; m))). 60 | idtac "Assumptions:". 61 | Abort. 62 | Print Assumptions t_update_permute. 63 | 64 | Goal True. 65 | idtac " ". 66 | 67 | idtac " ". 68 | 69 | idtac "Max points - standard: 5". 70 | idtac "Max points - advanced: 5". 71 | idtac "". 72 | idtac "Allowed Axioms:". 73 | idtac "functional_extensionality". 74 | idtac "FunctionalExtensionality.functional_extensionality_dep". 75 | idtac "plus_le". 76 | idtac "le_trans". 77 | idtac "le_plus_l". 78 | idtac "add_le_cases". 79 | idtac "Sn_le_Sm__n_le_m". 80 | idtac "O_le_n". 81 | idtac "". 82 | idtac "". 83 | idtac "********** Summary **********". 84 | idtac "". 85 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 86 | idtac "". 87 | idtac "The output for each exercise can be any of the following:". 88 | idtac " - 'Closed under the global context', if it is complete". 89 | idtac " - 'MANUAL', if it is manually graded". 90 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 91 | idtac " the exercise is considered complete, if the axioms are all allowed.". 92 | idtac "". 93 | idtac "********** Standard **********". 94 | idtac "---------- t_update_same ---------". 95 | Print Assumptions t_update_same. 96 | idtac "---------- t_update_permute ---------". 97 | Print Assumptions t_update_permute. 98 | idtac "". 99 | idtac "********** Advanced **********". 100 | Abort. 101 | 102 | -------------------------------------------------------------------------------- /src/dataset/raw_data/lf/MapsTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | From Coq Require Export String. 3 | From LF Require Import Maps. 4 | 5 | Parameter MISSING: Type. 6 | 7 | Module Check. 8 | 9 | Ltac check_type A B := 10 | match type of A with 11 | | context[MISSING] => idtac "Missing:" A 12 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 13 | end. 14 | 15 | Ltac print_manual_grade A := 16 | match eval compute in A with 17 | | Some (_ ?S ?C) => 18 | idtac "Score:" S; 19 | match eval compute in C with 20 | | ""%string => idtac "Comment: None" 21 | | _ => idtac "Comment:" C 22 | end 23 | | None => 24 | idtac "Score: Ungraded"; 25 | idtac "Comment: None" 26 | end. 27 | 28 | End Check. 29 | 30 | From LF Require Import Maps. 31 | Import Check. 32 | 33 | Goal True. 34 | 35 | idtac "------------------- t_update_same --------------------". 36 | idtac " ". 37 | 38 | idtac "#> t_update_same". 39 | idtac "Possible points: 2". 40 | check_type @t_update_same ( 41 | (forall (A : Type) (m : total_map A) (x : string), (x !-> m x; m) = m)). 42 | idtac "Assumptions:". 43 | Abort. 44 | Print Assumptions t_update_same. 45 | Goal True. 46 | idtac " ". 47 | 48 | idtac "------------------- t_update_permute --------------------". 49 | idtac " ". 50 | 51 | idtac "#> t_update_permute". 52 | idtac "Possible points: 3". 53 | check_type @t_update_permute ( 54 | (forall (A : Type) (m : total_map A) (v1 v2 : A) (x1 x2 : string), 55 | x2 <> x1 -> (x1 !-> v1; x2 !-> v2; m) = (x2 !-> v2; x1 !-> v1; m))). 56 | idtac "Assumptions:". 57 | Abort. 58 | Print Assumptions t_update_permute. 59 | Goal True. 60 | idtac " ". 61 | 62 | idtac " ". 63 | 64 | idtac "Max points - standard: 5". 65 | idtac "Max points - advanced: 5". 66 | idtac "". 67 | idtac "Allowed Axioms:". 68 | idtac "functional_extensionality". 69 | idtac "FunctionalExtensionality.functional_extensionality_dep". 70 | idtac "plus_le". 71 | idtac "le_trans". 72 | idtac "le_plus_l". 73 | idtac "add_le_cases". 74 | idtac "Sn_le_Sm__n_le_m". 75 | idtac "O_le_n". 76 | idtac "". 77 | idtac "". 78 | idtac "********** Summary **********". 79 | idtac "". 80 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 81 | idtac "". 82 | idtac "The output for each exercise can be any of the following:". 83 | idtac " - 'Closed under the global context', if it is complete". 84 | idtac " - 'MANUAL', if it is manually graded". 85 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 86 | idtac " the exercise is considered complete, if the axioms are all allowed.". 87 | idtac "". 88 | idtac "********** Standard **********". 89 | idtac "---------- t_update_same ---------". 90 | Print Assumptions t_update_same. 91 | idtac "---------- t_update_permute ---------". 92 | Print Assumptions t_update_permute. 93 | idtac "". 94 | idtac "********** Advanced **********". 95 | Abort. 96 | 97 | (* 2025-01-13 16:00 *) 98 | 99 | (* 2025-01-13 16:00 *) 100 | -------------------------------------------------------------------------------- /src/dataset/raw_data/plf/MapsTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | From Coq Require Export String. 3 | From PLF Require Import Maps. 4 | 5 | Parameter MISSING: Type. 6 | 7 | Module Check. 8 | 9 | Ltac check_type A B := 10 | match type of A with 11 | | context[MISSING] => idtac "Missing:" A 12 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 13 | end. 14 | 15 | Ltac print_manual_grade A := 16 | match eval compute in A with 17 | | Some (_ ?S ?C) => 18 | idtac "Score:" S; 19 | match eval compute in C with 20 | | ""%string => idtac "Comment: None" 21 | | _ => idtac "Comment:" C 22 | end 23 | | None => 24 | idtac "Score: Ungraded"; 25 | idtac "Comment: None" 26 | end. 27 | 28 | End Check. 29 | 30 | From PLF Require Import Maps. 31 | Import Check. 32 | 33 | Goal True. 34 | 35 | idtac "------------------- t_update_same --------------------". 36 | idtac " ". 37 | 38 | idtac "#> t_update_same". 39 | idtac "Possible points: 2". 40 | check_type @t_update_same ( 41 | (forall (A : Type) (m : total_map A) (x : string), 42 | @eq (forall _ : string, A) (@t_update A m x (m x)) m)). 43 | idtac "Assumptions:". 44 | Abort. 45 | Print Assumptions t_update_same. 46 | Goal True. 47 | idtac " ". 48 | 49 | idtac "------------------- t_update_permute --------------------". 50 | idtac " ". 51 | 52 | idtac "#> t_update_permute". 53 | idtac "Possible points: 3". 54 | check_type @t_update_permute ( 55 | (forall (A : Type) (m : total_map A) (v1 v2 : A) (x1 x2 : string) 56 | (_ : not (@eq string x2 x1)), 57 | @eq (forall _ : string, A) (@t_update A (@t_update A m x2 v2) x1 v1) 58 | (@t_update A (@t_update A m x1 v1) x2 v2))). 59 | idtac "Assumptions:". 60 | Abort. 61 | Print Assumptions t_update_permute. 62 | Goal True. 63 | idtac " ". 64 | 65 | idtac " ". 66 | 67 | idtac "Max points - standard: 5". 68 | idtac "Max points - advanced: 5". 69 | idtac "". 70 | idtac "Allowed Axioms:". 71 | idtac "functional_extensionality". 72 | idtac "FunctionalExtensionality.functional_extensionality_dep". 73 | idtac "CSeq_congruence". 74 | idtac "fold_constants_bexp_sound". 75 | idtac "succ_hastype_nat__hastype_nat". 76 | idtac "". 77 | idtac "". 78 | idtac "********** Summary **********". 79 | idtac "". 80 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 81 | idtac "". 82 | idtac "The output for each exercise can be any of the following:". 83 | idtac " - 'Closed under the global context', if it is complete". 84 | idtac " - 'MANUAL', if it is manually graded". 85 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 86 | idtac " the exercise is considered complete, if the axioms are all allowed.". 87 | idtac "". 88 | idtac "********** Standard **********". 89 | idtac "---------- t_update_same ---------". 90 | Print Assumptions t_update_same. 91 | idtac "---------- t_update_permute ---------". 92 | Print Assumptions t_update_permute. 93 | idtac "". 94 | idtac "********** Advanced **********". 95 | Abort. 96 | 97 | (* 2025-01-06 19:48 *) 98 | 99 | (* 2025-01-06 19:48 *) 100 | -------------------------------------------------------------------------------- /src/prompts/completion.py: -------------------------------------------------------------------------------- 1 | SYSTEM_MESSAGE = """ 2 | You are an expert in proving mathematical theorems using Coq. Your task is to complete the admitted proofs of given Coq statements. You are allowed to use a tool to run Coq code and get back any error messages from it. 3 | 4 | Before proving, get the theorem statements from the Coq script and state them. Then move through them one by one, adding proofs and testing at each stage. If you encounter any errors, analyze them and correct the proofs accordingly. Ensure that while using the tool you give complete Coq code that can be run. 5 | 6 | Rules: 7 | 8 | - Respond only with the required analysis and code. 9 | - Provide your analysis and code in the exact format specified below so that it can be immediately parsed into a json file. 10 | 11 | Return Schema: 12 | 13 | Analysis of Proving Progress: 14 | percentage_translated: (Int, 0–100) Percentage of Coq proofs completed. 15 | foreseeable_issues: (List of Strings) Potential challenges or issues in completing proofs. 16 | 17 | Code Translation: 18 | completed_code: (String) Coq code with the completed proofs. 19 | 20 | Example Output: 21 | 22 | ```json 23 | {{ 24 | "percentage_translated": 75, 25 | "foreseeable_issues": [ 26 | "Assumptions not satisfied in proof steps", 27 | "Missing case in induction proof", 28 | "Unproven subgoals remaining", 29 | "Circular reasoning", 30 | "Improper use of automation tactics" 31 | ], 32 | "completed_code": "" 33 | }} 34 | ``` 35 | 36 | Important: Remember to return your response in the exact JSON format specified above so I can parse it with a JSON reader. 37 | 38 | I will now provide you with the Coq script with admitted proofs to complete. 39 | """ 40 | 41 | ALTERNATE_SYSTEM_MESSAGE = """ 42 | You are an expert in proving mathematical theorems using Coq. Your task is to complete the admitted proofs of given Coq statements. You are allowed to use a tool to run Coq code and get back any error messages from it. When you are confident that your proofs are correct, you can use the submission tool to submit them for evaluation. Note that only code submitted using the submission tool will be considered for evaluation. 43 | 44 | Before proving, get the theorem statements from the Coq script and state them. Then move through them one by one, adding proofs and testing at each stage. If you encounter any errors, analyze them and correct the proofs accordingly. Ensure that while using the tool you give complete Coq code that can be run. 45 | 46 | After you are done with the proofs you are required to use the submission tool to submit your code for evaluation. The tool will ensure that all definitions from the input file have been written in the submission and there are no assumptions in the given code. IT IS MANDATORY TO USE THE SUBMISSION TOOL TO SUBMIT YOUR CODE, OTHERWISE IT WILL BE CONSIDERED THAT YOU HAVE FAILED THE TASK. 47 | 48 | Example Input for the tools: 49 | 50 | ```coq 51 | Theorem example_theorem: forall a b c : nat, a + (b + c) = (a + b) + c. 52 | Proof. 53 | intros. 54 | rewrite plus_assoc. 55 | reflexivity. 56 | Qed. 57 | ``` 58 | 59 | I will now provide you with the Coq script with admitted proofs to complete. 60 | """ 61 | 62 | COQ_STATEMENTS = """ 63 | Coq Script: 64 | ```coq 65 | {coq_script} 66 | ``` 67 | """ 68 | -------------------------------------------------------------------------------- /src/dataset/raw_data/vfa/DecideTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | From Coq Require Export String. 3 | From VFA Require Import Decide. 4 | 5 | Parameter MISSING: Type. 6 | 7 | Module Check. 8 | 9 | Ltac check_type A B := 10 | match type of A with 11 | | context[MISSING] => idtac "Missing:" A 12 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 13 | end. 14 | 15 | Ltac print_manual_grade A := 16 | match eval compute in A with 17 | | Some (_ ?S ?C) => 18 | idtac "Score:" S; 19 | match eval compute in C with 20 | | ""%string => idtac "Comment: None" 21 | | _ => idtac "Comment:" C 22 | end 23 | | None => 24 | idtac "Score: Ungraded"; 25 | idtac "Comment: None" 26 | end. 27 | 28 | End Check. 29 | 30 | From VFA Require Import Decide. 31 | Import Check. 32 | 33 | Goal True. 34 | 35 | idtac "------------------- insert_sorted_le_dec --------------------". 36 | idtac " ". 37 | 38 | idtac "#> ScratchPad2.insert_sorted". 39 | idtac "Possible points: 2". 40 | check_type @ScratchPad2.insert_sorted ( 41 | (forall (a : nat) (l : list nat) (_ : ScratchPad2.sorted l), 42 | ScratchPad2.sorted (ScratchPad2.insert a l))). 43 | idtac "Assumptions:". 44 | Abort. 45 | Print Assumptions ScratchPad2.insert_sorted. 46 | Goal True. 47 | idtac " ". 48 | 49 | idtac "------------------- list_nat_in --------------------". 50 | idtac " ". 51 | 52 | idtac "#> list_nat_in". 53 | idtac "Possible points: 2". 54 | check_type @list_nat_in ( 55 | (forall (i : nat) (al : list nat), 56 | sumbool (@List.In nat i al) (not (@List.In nat i al)))). 57 | idtac "Assumptions:". 58 | Abort. 59 | Print Assumptions list_nat_in. 60 | Goal True. 61 | idtac " ". 62 | 63 | idtac " ". 64 | 65 | idtac "Max points - standard: 4". 66 | idtac "Max points - advanced: 4". 67 | idtac "". 68 | idtac "Allowed Axioms:". 69 | idtac "functional_extensionality". 70 | idtac "functional_extensionality_dep". 71 | idtac "FunctionalExtensionality.functional_extensionality_dep". 72 | idtac "int". 73 | idtac "Abs". 74 | idtac "Abs_inj". 75 | idtac "ltb". 76 | idtac "ltb_lt". 77 | idtac "leb". 78 | idtac "leb_le". 79 | idtac "Extract.int". 80 | idtac "Extract.Abs". 81 | idtac "Extract.Abs_inj". 82 | idtac "Extract.ltb". 83 | idtac "Extract.ltb_lt". 84 | idtac "Extract.leb". 85 | idtac "Extract.leb_le". 86 | idtac "". 87 | idtac "". 88 | idtac "********** Summary **********". 89 | idtac "". 90 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 91 | idtac "". 92 | idtac "The output for each exercise can be any of the following:". 93 | idtac " - 'Closed under the global context', if it is complete". 94 | idtac " - 'MANUAL', if it is manually graded". 95 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 96 | idtac " the exercise is considered complete, if the axioms are all allowed.". 97 | idtac "". 98 | idtac "********** Standard **********". 99 | idtac "---------- ScratchPad2.insert_sorted ---------". 100 | Print Assumptions ScratchPad2.insert_sorted. 101 | idtac "---------- list_nat_in ---------". 102 | Print Assumptions list_nat_in. 103 | idtac "". 104 | idtac "********** Advanced **********". 105 | Abort. 106 | 107 | (* 2025-01-06 19:53 *) 108 | 109 | (* 2025-01-06 19:53 *) 110 | -------------------------------------------------------------------------------- /src/dataset/pre_processed_data/IndPrinciplesTest.v: -------------------------------------------------------------------------------- 1 | Set Warnings "-notation-overridden,-parsing". 2 | 3 | From Coq Require Export String. 4 | 5 | From LF Require Import IndPrinciples. 6 | 7 | Parameter MISSING: Type. 8 | 9 | Module Check. 10 | 11 | Ltac check_type A B := 12 | match type of A with 13 | | context[MISSING] => idtac "Missing:" A 14 | | ?T => first [unify T B; idtac "Type: ok" | idtac "Type: wrong - should be (" B ")"] 15 | end. 16 | 17 | Ltac print_manual_grade A := 18 | match eval compute in A with 19 | | Some (_ ?S ?C) => 20 | idtac "Score:" S; 21 | match eval compute in C with 22 | | ""%string => idtac "Comment: None" 23 | | _ => idtac "Comment:" C 24 | end 25 | | None => 26 | idtac "Score: Ungraded"; 27 | idtac "Comment: None" 28 | end. 29 | 30 | End Check. 31 | 32 | From LF Require Import IndPrinciples. 33 | 34 | Import Check. 35 | 36 | Goal True. 37 | 38 | idtac "------------------- plus_one_r' --------------------". 39 | idtac " ". 40 | 41 | idtac "#> plus_one_r'". 42 | idtac "Possible points: 2". 43 | check_type @plus_one_r' ((forall n : nat, n + 1 = S n)). 44 | idtac "Assumptions:". 45 | Abort. 46 | Print Assumptions plus_one_r'. 47 | 48 | Goal True. 49 | idtac " ". 50 | 51 | idtac "------------------- booltree_ind --------------------". 52 | idtac " ". 53 | 54 | idtac "#> booltree_ind_type_correct". 55 | idtac "Possible points: 2". 56 | check_type @booltree_ind_type_correct (booltree_ind_type). 57 | idtac "Assumptions:". 58 | Abort. 59 | Print Assumptions booltree_ind_type_correct. 60 | 61 | Goal True. 62 | idtac " ". 63 | 64 | idtac "------------------- toy_ind --------------------". 65 | idtac " ". 66 | 67 | idtac "#> Toy_correct". 68 | idtac "Possible points: 2". 69 | check_type @Toy_correct ( 70 | (exists (f : bool -> Toy) (g : nat -> Toy -> Toy), 71 | forall P : Toy -> Prop, 72 | (forall b : bool, P (f b)) -> 73 | (forall (n : nat) (t : Toy), P t -> P (g n t)) -> forall t : Toy, P t)). 74 | idtac "Assumptions:". 75 | Abort. 76 | Print Assumptions Toy_correct. 77 | 78 | Goal True. 79 | idtac " ". 80 | 81 | idtac " ". 82 | 83 | idtac "Max points - standard: 6". 84 | idtac "Max points - advanced: 6". 85 | idtac "". 86 | idtac "Allowed Axioms:". 87 | idtac "functional_extensionality". 88 | idtac "FunctionalExtensionality.functional_extensionality_dep". 89 | idtac "plus_le". 90 | idtac "le_trans". 91 | idtac "le_plus_l". 92 | idtac "add_le_cases". 93 | idtac "Sn_le_Sm__n_le_m". 94 | idtac "O_le_n". 95 | idtac "". 96 | idtac "". 97 | idtac "********** Summary **********". 98 | idtac "". 99 | idtac "Below is a summary of the automatically graded exercises that are incomplete.". 100 | idtac "". 101 | idtac "The output for each exercise can be any of the following:". 102 | idtac " - 'Closed under the global context', if it is complete". 103 | idtac " - 'MANUAL', if it is manually graded". 104 | idtac " - A list of pending axioms, containing unproven assumptions. In this case". 105 | idtac " the exercise is considered complete, if the axioms are all allowed.". 106 | idtac "". 107 | idtac "********** Standard **********". 108 | idtac "---------- plus_one_r' ---------". 109 | Print Assumptions plus_one_r'. 110 | idtac "---------- booltree_ind_type_correct ---------". 111 | Print Assumptions booltree_ind_type_correct. 112 | idtac "---------- Toy_correct ---------". 113 | Print Assumptions Toy_correct. 114 | idtac "". 115 | idtac "********** Advanced **********". 116 | Abort. 117 | --------------------------------------------------------------------------------