itp-interface 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- itp_interface/__init__.py +0 -0
- itp_interface/agent/__init__.py +0 -0
- itp_interface/agent/simple_proof_agent.py +100 -0
- itp_interface/coq_ser_api/__init__.py +165 -0
- itp_interface/coq_ser_api/contexts.py +283 -0
- itp_interface/coq_ser_api/coq_agent.py +459 -0
- itp_interface/coq_ser_api/coq_backend.py +135 -0
- itp_interface/coq_ser_api/coq_util.py +839 -0
- itp_interface/coq_ser_api/example.py +67 -0
- itp_interface/coq_ser_api/lsp_backend.py +375 -0
- itp_interface/coq_ser_api/py.typed +0 -0
- itp_interface/coq_ser_api/serapi_backend.py +841 -0
- itp_interface/coq_ser_api/util.py +145 -0
- itp_interface/coq_ser_api_old/__init__.py +2583 -0
- itp_interface/coq_ser_api_old/contexts.py +172 -0
- itp_interface/coq_ser_api_old/util.py +146 -0
- itp_interface/lean_server/__init__.py +0 -0
- itp_interface/lean_server/commands.py +484 -0
- itp_interface/lean_server/lean3_search_tool.py +358 -0
- itp_interface/lean_server/lean4_repl_interface.py +151 -0
- itp_interface/lean_server/lean4_utils.py +255 -0
- itp_interface/lean_server/lean_cmd_server.py +111 -0
- itp_interface/lean_server/lean_context.py +60 -0
- itp_interface/lean_server/lean_sync_server.py +174 -0
- itp_interface/lean_server/lean_utils.py +199 -0
- itp_interface/lean_server/py.typed +1 -0
- itp_interface/main/__init__.py +0 -0
- itp_interface/main/config/afp_data_gen.yaml +14 -0
- itp_interface/main/config/benchmark/CompCert.yaml +366 -0
- itp_interface/main/config/benchmark/GeoCoq.yaml +930 -0
- itp_interface/main/config/benchmark/UniMath.yaml +2690 -0
- itp_interface/main/config/benchmark/afp_isabelle.yaml +29200 -0
- itp_interface/main/config/benchmark/agent_proverbot_hard.yaml +247 -0
- itp_interface/main/config/benchmark/category-theory.yaml +470 -0
- itp_interface/main/config/benchmark/compcert_118_subset.yaml +148 -0
- itp_interface/main/config/benchmark/compcert_benchmark.yaml +36 -0
- itp_interface/main/config/benchmark/compcert_benchmark_hard.yaml +498 -0
- itp_interface/main/config/benchmark/compcert_benchmark_hard_1.yaml +55 -0
- itp_interface/main/config/benchmark/compcert_benchmark_hard_2.yaml +24 -0
- itp_interface/main/config/benchmark/compcert_benchmark_hard_3.yaml +95 -0
- itp_interface/main/config/benchmark/compcert_benchmark_hard_7_per_cent.yaml +78 -0
- itp_interface/main/config/benchmark/compcert_benchmark_test.yaml +38 -0
- itp_interface/main/config/benchmark/compcert_benchmark_train.yaml +340 -0
- itp_interface/main/config/benchmark/leandojo_novel_premises_test.yaml +2908 -0
- itp_interface/main/config/benchmark/leandojo_novel_premises_train.yaml +98645 -0
- itp_interface/main/config/benchmark/leandojo_novel_premises_val.yaml +2912 -0
- itp_interface/main/config/benchmark/leandojo_random.yaml +2889 -0
- itp_interface/main/config/benchmark/leandojo_random_test.yaml +2421 -0
- itp_interface/main/config/benchmark/leandojo_random_train.yaml +62729 -0
- itp_interface/main/config/benchmark/leandojo_random_val.yaml +2504 -0
- itp_interface/main/config/benchmark/math-comp.yaml +200 -0
- itp_interface/main/config/benchmark/miniF2F_test.yaml +12 -0
- itp_interface/main/config/benchmark/miniF2F_test_aime.yaml +27 -0
- itp_interface/main/config/benchmark/miniF2F_test_algebra.yaml +30 -0
- itp_interface/main/config/benchmark/miniF2F_test_amc12.yaml +57 -0
- itp_interface/main/config/benchmark/miniF2F_test_few_shot_hard.yaml +231 -0
- itp_interface/main/config/benchmark/miniF2F_test_imo.yaml +32 -0
- itp_interface/main/config/benchmark/miniF2F_test_induction.yaml +20 -0
- itp_interface/main/config/benchmark/miniF2F_test_mathd_algebra.yaml +82 -0
- itp_interface/main/config/benchmark/miniF2F_test_mathd_algebra_hard.yaml +72 -0
- itp_interface/main/config/benchmark/miniF2F_test_mathd_numbertheory.yaml +72 -0
- itp_interface/main/config/benchmark/miniF2F_test_numbertheory.yaml +20 -0
- itp_interface/main/config/benchmark/minicompcert_benchmark_1.yaml +14 -0
- itp_interface/main/config/benchmark/proverbot_hard.yaml +104 -0
- itp_interface/main/config/benchmark/re_prover.yaml +66 -0
- itp_interface/main/config/benchmark/re_prover_hard.yaml +41 -0
- itp_interface/main/config/benchmark/re_prover_very_hard.yaml +22 -0
- itp_interface/main/config/benchmark/reprover_with_retrieval.yaml +73 -0
- itp_interface/main/config/benchmark/reprover_with_retrieval_hard.yaml +30 -0
- itp_interface/main/config/benchmark/reprover_with_retrieval_neg.yaml +195 -0
- itp_interface/main/config/benchmark/simple_benchmark_1.yaml +24 -0
- itp_interface/main/config/benchmark/simple_benchmark_8.yaml +50 -0
- itp_interface/main/config/benchmark/simple_benchmark_9.yaml +65 -0
- itp_interface/main/config/benchmark/simple_benchmark_isabelle.yaml +18 -0
- itp_interface/main/config/benchmark/simple_benchmark_lean.yaml +12 -0
- itp_interface/main/config/benchmark/simple_benchmark_lean_training_data.yaml +12 -0
- itp_interface/main/config/benchmark/simple_rl_benchmark_lean.yaml +14 -0
- itp_interface/main/config/benchmark/stack_machine.yaml +13 -0
- itp_interface/main/config/benchmark/stack_machine_hard.yaml +15 -0
- itp_interface/main/config/category_theory_data_gen.yaml +14 -0
- itp_interface/main/config/category_theory_data_gen_random.yaml +16 -0
- itp_interface/main/config/compcert_data_gen_test.yaml +10 -0
- itp_interface/main/config/compcert_data_gen_train.yaml +7 -0
- itp_interface/main/config/env_settings/bm25_retrieval.yaml +2 -0
- itp_interface/main/config/env_settings/bm25_retrieval_no_dfns.yaml +2 -0
- itp_interface/main/config/env_settings/bm25_retrieval_only_local_no_dfns.yaml +2 -0
- itp_interface/main/config/env_settings/bm25_retrieval_with_print.yaml +2 -0
- itp_interface/main/config/env_settings/bm25_retrieval_with_print_only_local.yaml +2 -0
- itp_interface/main/config/env_settings/bm25_retrieval_with_print_only_local_no_dfns.yaml +2 -0
- itp_interface/main/config/env_settings/no_retrieval.yaml +2 -0
- itp_interface/main/config/experiments.yaml +12 -0
- itp_interface/main/config/geo_coq_data_gen.yaml +14 -0
- itp_interface/main/config/geo_coq_data_gen_random.yaml +16 -0
- itp_interface/main/config/leandojo_random_data_gen.yaml +16 -0
- itp_interface/main/config/math_comp_data_gen.yaml +14 -0
- itp_interface/main/config/math_comp_data_gen_random.yaml +16 -0
- itp_interface/main/config/mathlib_data_gen.yaml +14 -0
- itp_interface/main/config/repo/coq_repos.yaml +191 -0
- itp_interface/main/config/run_settings/default_coq_data_generation_transforms.yaml +24 -0
- itp_interface/main/config/run_settings/default_isabelle_data_generation_transforms.yaml +24 -0
- itp_interface/main/config/run_settings/default_lean4_data_generation_transforms.yaml +24 -0
- itp_interface/main/config/run_settings/default_lean_data_generation_transforms.yaml +24 -0
- itp_interface/main/config/simple_coq_data_gen.yaml +12 -0
- itp_interface/main/config/simple_coq_data_gen_random.yaml +17 -0
- itp_interface/main/config/simple_lean_data_gen.yaml +12 -0
- itp_interface/main/config/simple_rl_lean_data_gen.yaml +12 -0
- itp_interface/main/config/uni_math_data_gen.yaml +14 -0
- itp_interface/main/config.py +192 -0
- itp_interface/main/extract_benchmark_dataset.py +106 -0
- itp_interface/main/filter_dataset.py +107 -0
- itp_interface/main/install.py +92 -0
- itp_interface/main/merge_dataset.py +96 -0
- itp_interface/main/run_tool.py +444 -0
- itp_interface/pisa/.git +1 -0
- itp_interface/pisa/.gitignore +125 -0
- itp_interface/pisa/.idea/.gitignore +8 -0
- itp_interface/pisa/.idea/ClojureProjectResolveSettings.xml +6 -0
- itp_interface/pisa/.idea/codeStyles/Project.xml +7 -0
- itp_interface/pisa/.idea/codeStyles/codeStyleConfig.xml +5 -0
- itp_interface/pisa/.idea/inspectionProfiles/Project_Default.xml +16 -0
- itp_interface/pisa/.idea/libraries/sbt__com_google_android_annotations_4_1_1_4_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_google_api_grpc_proto_google_common_protos_1_17_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_google_code_findbugs_jsr305_3_0_2_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_google_code_gson_gson_2_8_6_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_google_errorprone_error_prone_annotations_2_3_4_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_google_guava_failureaccess_1_0_1_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_google_guava_guava_30_0_jre_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_google_guava_listenablefuture_9999_0_empty_to_avoid_conflict_with_guava_jar.xml +9 -0
- itp_interface/pisa/.idea/libraries/sbt__com_google_j2objc_j2objc_annotations_1_3_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_google_protobuf_protobuf_java_3_12_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_google_protobuf_protobuf_java_util_3_12_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_lihaoyi_fastparse_2_13_2_3_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_lihaoyi_geny_2_13_0_6_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_lihaoyi_sourcecode_2_13_0_2_1_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_thesamet_scalapb_lenses_2_13_0_10_9_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_thesamet_scalapb_scalapb_runtime_2_13_0_10_9_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_thesamet_scalapb_scalapb_runtime_grpc_2_13_0_10_9_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_thesamet_scalapb_zio_grpc_zio_grpc_core_2_13_0_4_2_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_thoughtworks_paranamer_paranamer_2_8_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__commons_io_commons_io_2_8_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__de_unruh_java_patterns_0_1_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__de_unruh_scala_isabelle_2_13_master_SNAPSHOT_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__dev_zio_izumi_reflect_2_13_1_0_0_M9_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__dev_zio_izumi_reflect_thirdparty_boopickle_shaded_2_13_1_0_0_M9_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__dev_zio_zio_2_13_1_0_3_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__dev_zio_zio_stacktracer_2_13_1_0_3_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__dev_zio_zio_streams_2_13_1_0_3_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_grpc_grpc_api_1_34_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_grpc_grpc_context_1_34_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_grpc_grpc_core_1_34_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_grpc_grpc_netty_1_34_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_grpc_grpc_protobuf_1_34_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_grpc_grpc_protobuf_lite_1_34_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_grpc_grpc_services_1_34_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_grpc_grpc_stub_1_34_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_buffer_4_1_51_Final_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_codec_4_1_51_Final_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_codec_http2_4_1_51_Final_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_codec_http_4_1_51_Final_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_codec_socks_4_1_51_Final_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_common_4_1_51_Final_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_handler_4_1_51_Final_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_handler_proxy_4_1_51_Final_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_resolver_4_1_51_Final_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_transport_4_1_51_Final_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_perfmark_perfmark_api_0_19_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__net_java_dev_jna_jna_5_3_1_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__net_liftweb_lift_json_2_13_3_4_3_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_apache_commons_commons_lang3_3_11_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_apache_commons_commons_text_1_9_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_checkerframework_checker_qual_3_5_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_codehaus_mojo_animal_sniffer_annotations_1_18_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_jetbrains_annotations_20_1_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_jline_jline_3_16_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_log4s_log4s_2_13_1_9_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_scala_lang_modules_scala_collection_compat_2_13_2_1_6_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_scala_lang_modules_scala_xml_2_13_1_3_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_scala_lang_scala_compiler_2_13_4_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_scala_lang_scala_library_2_13_4_jar.xml +23 -0
- itp_interface/pisa/.idea/libraries/sbt__org_scala_lang_scala_reflect_2_13_4_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_scala_lang_scalap_2_13_4_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_scalaz_scalaz_core_2_13_7_3_2_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_slf4j_slf4j_api_1_7_30_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_slf4j_slf4j_simple_1_7_30_jar.xml +13 -0
- itp_interface/pisa/.idea/misc.xml +7 -0
- itp_interface/pisa/.idea/modules/PISA-build.iml +127 -0
- itp_interface/pisa/.idea/modules/PISA.iml +94 -0
- itp_interface/pisa/.idea/modules.xml +9 -0
- itp_interface/pisa/.idea/other.xml +6 -0
- itp_interface/pisa/.idea/sbt.xml +20 -0
- itp_interface/pisa/.idea/scala_compiler.xml +6 -0
- itp_interface/pisa/.idea/uiDesigner.xml +124 -0
- itp_interface/pisa/.idea/vcs.xml +6 -0
- itp_interface/pisa/.scalafmt.conf +2 -0
- itp_interface/pisa/LICENSE +29 -0
- itp_interface/pisa/README.md +262 -0
- itp_interface/pisa/build.sbt +49 -0
- itp_interface/pisa/build.sh +26 -0
- itp_interface/pisa/command_generation/close_gaps.py +44 -0
- itp_interface/pisa/command_generation/conjecture_normal_order.py +62 -0
- itp_interface/pisa/command_generation/conjecturer_command_generator.py +36 -0
- itp_interface/pisa/command_generation/create_dirs.py +11 -0
- itp_interface/pisa/command_generation/find_std.py +67 -0
- itp_interface/pisa/command_generation/generate_build_commands_afp.py +15 -0
- itp_interface/pisa/command_generation/generate_build_commands_std.py +15 -0
- itp_interface/pisa/command_generation/generate_commands_afp.py +103 -0
- itp_interface/pisa/command_generation/generate_commands_mini.py +73 -0
- itp_interface/pisa/command_generation/generate_commands_std.py +69 -0
- itp_interface/pisa/command_generation/generate_hammer_extraction_text.py +5 -0
- itp_interface/pisa/command_generation/hammer_command_generator.py +40 -0
- itp_interface/pisa/command_generation/hp_search_command_generator.py +63 -0
- itp_interface/pisa/command_generation/oracle_command_generator.py +56 -0
- itp_interface/pisa/command_generation/search_command_generator.py +69 -0
- itp_interface/pisa/command_generation/summarise_problem_names.py +45 -0
- itp_interface/pisa/command_generation/tpu_hp_search.py +75 -0
- itp_interface/pisa/docker/Dockerfile +34 -0
- itp_interface/pisa/docker/docker_tutorial.md +64 -0
- itp_interface/pisa/eval_setup/copy_isabelle.py +42 -0
- itp_interface/pisa/eval_setup/copy_pisa_jars.py +18 -0
- itp_interface/pisa/mesh_transformer_utils/tokenization.py +86 -0
- itp_interface/pisa/project/build.properties +1 -0
- itp_interface/pisa/project/plugins.sbt +5 -0
- itp_interface/pisa/requirements.txt +4 -0
- itp_interface/pisa/scripts/extract_last_k_steps.py +28 -0
- itp_interface/pisa/scripts/extract_proof_corpus.py +26 -0
- itp_interface/pisa/scripts/gather_hammer_results.py +27 -0
- itp_interface/pisa/scripts/length_in_char_stats.py +20 -0
- itp_interface/pisa/scripts/mix.py +127 -0
- itp_interface/pisa/scripts/results_stat.py +52 -0
- itp_interface/pisa/scripts/test_array_job.sh +34 -0
- itp_interface/pisa/setup.sh +25 -0
- itp_interface/pisa/src/main/protobuf/server.proto +60 -0
- itp_interface/pisa/src/main/python/.idea/.gitignore +8 -0
- itp_interface/pisa/src/main/python/.idea/inspectionProfiles/Project_Default.xml +18 -0
- itp_interface/pisa/src/main/python/.idea/inspectionProfiles/profiles_settings.xml +6 -0
- itp_interface/pisa/src/main/python/.idea/misc.xml +4 -0
- itp_interface/pisa/src/main/python/.idea/modules.xml +8 -0
- itp_interface/pisa/src/main/python/.idea/python.iml +12 -0
- itp_interface/pisa/src/main/python/.idea/vcs.xml +6 -0
- itp_interface/pisa/src/main/python/conjecturing_parsing/conjecturer_postprocessing.py +59 -0
- itp_interface/pisa/src/main/python/data_extraction/extract_data.py +184 -0
- itp_interface/pisa/src/main/python/data_extraction/find_premises.py +221 -0
- itp_interface/pisa/src/main/python/data_extraction/process_data.py +129 -0
- itp_interface/pisa/src/main/python/legacy/PisaFlexibleClient.py +167 -0
- itp_interface/pisa/src/main/python/legacy/autof_test.py +74 -0
- itp_interface/pisa/src/main/python/legacy/cmd_client.py +23 -0
- itp_interface/pisa/src/main/python/legacy/convert_scala_dump_to_test_name_jsons.py +14 -0
- itp_interface/pisa/src/main/python/legacy/create_data_txt.py +72 -0
- itp_interface/pisa/src/main/python/legacy/create_finetune_tfrecords.py +311 -0
- itp_interface/pisa/src/main/python/legacy/demo.py +49 -0
- itp_interface/pisa/src/main/python/legacy/evaluate.py +108 -0
- itp_interface/pisa/src/main/python/legacy/extract_first_step.py +25 -0
- itp_interface/pisa/src/main/python/legacy/get_global_facts.py +35 -0
- itp_interface/pisa/src/main/python/legacy/mix_data.py +19 -0
- itp_interface/pisa/src/main/python/legacy/one_stage_extraction.py +111 -0
- itp_interface/pisa/src/main/python/legacy/prepare_episodic_transitions.py +137 -0
- itp_interface/pisa/src/main/python/legacy/prepare_translation_pairs.py +277 -0
- itp_interface/pisa/src/main/python/pisa_client.py +322 -0
- itp_interface/pisa/src/main/python/server_pb2.py +394 -0
- itp_interface/pisa/src/main/python/server_pb2_grpc.py +230 -0
- itp_interface/pisa/src/main/python/test_client.py +17 -0
- itp_interface/pisa/src/main/python/test_client2.py +79 -0
- itp_interface/pisa/src/main/python/utils/filters.py +59 -0
- itp_interface/pisa/src/main/python/utils/pisa_server_control.py +29 -0
- itp_interface/pisa/src/main/scala/pisa/agent/CheckSyntax.scala +257 -0
- itp_interface/pisa/src/main/scala/pisa/agent/DepThms.scala +29 -0
- itp_interface/pisa/src/main/scala/pisa/agent/PisaStat.scala +46 -0
- itp_interface/pisa/src/main/scala/pisa/agent/RefactorTest.scala +40 -0
- itp_interface/pisa/src/main/scala/pisa/agent/RepHammer.scala +95 -0
- itp_interface/pisa/src/main/scala/pisa/server/HammFacts.scala +63 -0
- itp_interface/pisa/src/main/scala/pisa/server/PisaOS.scala +881 -0
- itp_interface/pisa/src/main/scala/pisa/server/PisaOneStage.scala +540 -0
- itp_interface/pisa/src/main/scala/pisa/server/PisaOneStageServers.scala +1048 -0
- itp_interface/pisa/src/main/scala/pisa/utils/TheoryManager.scala +95 -0
- itp_interface/pisa/src/test/python/analyse_debug.py +33 -0
- itp_interface/pisa/src/test/python/extract_test_seq2seq.py +53 -0
- itp_interface/pisa/src/test/python/extract_test_theorem_ground_truth_indices.py +31 -0
- itp_interface/pisa/src/test/python/proof_originality.py +24 -0
- itp_interface/pisa/src/test/python/test_command_generator.py +25 -0
- itp_interface/pisa/src/test/python/test_model_sequence_accuracy.py +70 -0
- itp_interface/pisa/src/test/scala/pisa/Easy.scala +26 -0
- itp_interface/pisa/src/test/scala/pisa/TestCurl.scala +82 -0
- itp_interface/pisa/src/test/scala/pisa/TestIsa.scala +27 -0
- itp_interface/pisa/test.sh +19 -0
- itp_interface/pisa/universal_test_theorems.tar.gz +0 -0
- itp_interface/repo/build.py +78 -0
- itp_interface/repo/clone.py +79 -0
- itp_interface/repo/dataset_discovery.py +99 -0
- itp_interface/retrieval/__init__.py +0 -0
- itp_interface/retrieval/abstraction.py +35 -0
- itp_interface/retrieval/coq_bm25_reranker.py +153 -0
- itp_interface/retrieval/isabelle_bm25_reranker.py +86 -0
- itp_interface/retrieval/lean3_bm25_reranker.py +86 -0
- itp_interface/rl/__init__.py +0 -0
- itp_interface/rl/abstraction.py +168 -0
- itp_interface/rl/proof_action.py +172 -0
- itp_interface/rl/proof_state.py +149 -0
- itp_interface/rl/proof_tree.py +109 -0
- itp_interface/rl/simpl_proof_env_pool.py +16 -0
- itp_interface/rl/simple_proof_env.py +713 -0
- itp_interface/rl/simple_proof_env_pool.py +591 -0
- itp_interface/scripts/setup.sh +228 -0
- itp_interface/tools/__init__.py +0 -0
- itp_interface/tools/basic_utils.py +172 -0
- itp_interface/tools/bin_packing.py +61 -0
- itp_interface/tools/cache.py +93 -0
- itp_interface/tools/coq_build_spec.py +31 -0
- itp_interface/tools/coq_build_tool.py +319 -0
- itp_interface/tools/coq_context_helper.py +354 -0
- itp_interface/tools/coq_executor.py +508 -0
- itp_interface/tools/coq_local_data_generation_transform.py +158 -0
- itp_interface/tools/coq_parse_utils.py +154 -0
- itp_interface/tools/coq_raw_proofs.py +193 -0
- itp_interface/tools/coq_theorem_proof_pair_generation_transform.py +146 -0
- itp_interface/tools/coq_training_data_generator.py +76 -0
- itp_interface/tools/dynamic_coq_proof_exec.py +220 -0
- itp_interface/tools/dynamic_isabelle_proof_exec.py +229 -0
- itp_interface/tools/dynamic_lean4_proof_exec.py +236 -0
- itp_interface/tools/dynamic_lean_proof_exec.py +228 -0
- itp_interface/tools/isabelle_context_helper.py +66 -0
- itp_interface/tools/isabelle_executor.py +862 -0
- itp_interface/tools/isabelle_local_data_generation_transform.py +149 -0
- itp_interface/tools/isabelle_parse_utils.py +131 -0
- itp_interface/tools/isabelle_server.py +106 -0
- itp_interface/tools/lean4_context_helper.py +72 -0
- itp_interface/tools/lean4_local_data_generation_transform.py +122 -0
- itp_interface/tools/lean4_sync_executor.py +1193 -0
- itp_interface/tools/lean_cmd_executor.py +804 -0
- itp_interface/tools/lean_context_helper.py +327 -0
- itp_interface/tools/lean_dojo_data_generation_transform.py +206 -0
- itp_interface/tools/lean_executor.py +687 -0
- itp_interface/tools/lean_local_data_generation_transform.py +136 -0
- itp_interface/tools/lean_parse_utils.py +32 -0
- itp_interface/tools/log_utils.py +20 -0
- itp_interface/tools/proof_exec_callback.py +76 -0
- itp_interface/tools/ray_utils.py +265 -0
- itp_interface/tools/repl/.git +1 -0
- itp_interface/tools/repl/.github/workflows/ci.yml +24 -0
- itp_interface/tools/repl/.gitignore +7 -0
- itp_interface/tools/repl/.vscode/copyright.code-snippets +13 -0
- itp_interface/tools/repl/.vscode/extensions.json +13 -0
- itp_interface/tools/repl/.vscode/module-docstring.code-snippets +35 -0
- itp_interface/tools/repl/.vscode/settings.json +11 -0
- itp_interface/tools/repl/README.md +174 -0
- itp_interface/tools/repl/REPL/Frontend.lean +47 -0
- itp_interface/tools/repl/REPL/JSON.lean +186 -0
- itp_interface/tools/repl/REPL/Lean/ContextInfo.lean +9 -0
- itp_interface/tools/repl/REPL/Lean/Environment.lean +31 -0
- itp_interface/tools/repl/REPL/Lean/InfoTree/ToJson.lean +114 -0
- itp_interface/tools/repl/REPL/Lean/InfoTree.lean +272 -0
- itp_interface/tools/repl/REPL/Main.lean +323 -0
- itp_interface/tools/repl/REPL/Snapshots.lean +306 -0
- itp_interface/tools/repl/REPL/Util/Path.lean +36 -0
- itp_interface/tools/repl/REPL/Util/Pickle.lean +44 -0
- itp_interface/tools/repl/REPL.lean +4 -0
- itp_interface/tools/repl/lake-manifest.json +5 -0
- itp_interface/tools/repl/lakefile.lean +15 -0
- itp_interface/tools/repl/lean-toolchain +1 -0
- itp_interface/tools/repl/test/Mathlib/.gitignore +5 -0
- itp_interface/tools/repl/test/Mathlib/H20231110.sh +2 -0
- itp_interface/tools/repl/test/Mathlib/ReplMathlibTests.lean +1 -0
- itp_interface/tools/repl/test/Mathlib/lake-manifest.json +68 -0
- itp_interface/tools/repl/test/Mathlib/lakefile.lean +11 -0
- itp_interface/tools/repl/test/Mathlib/lean-toolchain +1 -0
- itp_interface/tools/repl/test/Mathlib/test/20240209.expected.out +20 -0
- itp_interface/tools/repl/test/Mathlib/test/20240209.in +3 -0
- itp_interface/tools/repl/test/Mathlib/test/20240209.lean +4 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231020.expected.out +8 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231020.in +8 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231020.lean +22 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231110.expected.out +4 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231110.in +4 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231115.expected.out +19 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231115.in +5 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231115_2.expected.out +18 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231115_2.in +4 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231115_3.expected.out +10 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231115_3.in +4 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231214.in +9 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231214.lean +30 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231215.expected.out +4 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231215.in +4 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231215_2.expected.out +14 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231215_2.in +3 -0
- itp_interface/tools/repl/test/Mathlib/test/exact.expected.out +37 -0
- itp_interface/tools/repl/test/Mathlib/test/exact.in +10 -0
- itp_interface/tools/repl/test/Mathlib/test/import_Mathlib.lean +1 -0
- itp_interface/tools/repl/test/Mathlib/test/induction.expected.out +29 -0
- itp_interface/tools/repl/test/Mathlib/test/induction.in +10 -0
- itp_interface/tools/repl/test/Mathlib/test/induction.lean +6 -0
- itp_interface/tools/repl/test/Mathlib/test/on_goal.expected.out +22 -0
- itp_interface/tools/repl/test/Mathlib/test/on_goal.in +5 -0
- itp_interface/tools/repl/test/Mathlib/test/pickle.expected.out +16 -0
- itp_interface/tools/repl/test/Mathlib/test/pickle.in +6 -0
- itp_interface/tools/repl/test/Mathlib/test/pickle_2.expected.out +4 -0
- itp_interface/tools/repl/test/Mathlib/test/pickle_2.in +4 -0
- itp_interface/tools/repl/test/Mathlib/test.sh +41 -0
- itp_interface/tools/repl/test/all_tactics.expected.out +13 -0
- itp_interface/tools/repl/test/all_tactics.in +1 -0
- itp_interface/tools/repl/test/by_cases.expected.out +25 -0
- itp_interface/tools/repl/test/by_cases.in +8 -0
- itp_interface/tools/repl/test/by_cases.lean +4 -0
- itp_interface/tools/repl/test/calc.expected.out +32 -0
- itp_interface/tools/repl/test/calc.in +1 -0
- itp_interface/tools/repl/test/def_eval.expected.out +9 -0
- itp_interface/tools/repl/test/def_eval.in +3 -0
- itp_interface/tools/repl/test/enableInitializersExecution.expected.out +2 -0
- itp_interface/tools/repl/test/enableInitializersExecution.in +1 -0
- itp_interface/tools/repl/test/file.expected.out +8 -0
- itp_interface/tools/repl/test/file.in +1 -0
- itp_interface/tools/repl/test/file.lean +5 -0
- itp_interface/tools/repl/test/have_by_sorry.expected.out +28 -0
- itp_interface/tools/repl/test/have_by_sorry.in +6 -0
- itp_interface/tools/repl/test/import_lean.in +1 -0
- itp_interface/tools/repl/test/incomplete.expected.out +18 -0
- itp_interface/tools/repl/test/incomplete.in +3 -0
- itp_interface/tools/repl/test/incomplete.lean +0 -0
- itp_interface/tools/repl/test/infotree.expected.out +20 -0
- itp_interface/tools/repl/test/infotree.in +2 -0
- itp_interface/tools/repl/test/invalid_tactic.expected.out +20 -0
- itp_interface/tools/repl/test/invalid_tactic.in +3 -0
- itp_interface/tools/repl/test/name_generator.expected.out +53 -0
- itp_interface/tools/repl/test/name_generator.in +18 -0
- itp_interface/tools/repl/test/no_goal_sorry.expected.out +11 -0
- itp_interface/tools/repl/test/no_goal_sorry.in +1 -0
- itp_interface/tools/repl/test/no_goal_sorry_2.expected.out +12 -0
- itp_interface/tools/repl/test/no_goal_sorry_2.in +1 -0
- itp_interface/tools/repl/test/options.expected.out +17 -0
- itp_interface/tools/repl/test/options.in +6 -0
- itp_interface/tools/repl/test/pickle_environment.expected.out +8 -0
- itp_interface/tools/repl/test/pickle_environment.in +7 -0
- itp_interface/tools/repl/test/pickle_environment_with_imports.expected.out +10 -0
- itp_interface/tools/repl/test/pickle_environment_with_imports.in +9 -0
- itp_interface/tools/repl/test/pickle_open.expected.out +8 -0
- itp_interface/tools/repl/test/pickle_open.in +7 -0
- itp_interface/tools/repl/test/pickle_open_2.expected.out +4 -0
- itp_interface/tools/repl/test/pickle_open_2.in +3 -0
- itp_interface/tools/repl/test/pickle_open_scoped.expected.out +18 -0
- itp_interface/tools/repl/test/pickle_open_scoped.in +8 -0
- itp_interface/tools/repl/test/pickle_open_scoped_2.expected.out +14 -0
- itp_interface/tools/repl/test/pickle_open_scoped_2.in +3 -0
- itp_interface/tools/repl/test/pickle_proof_state_1.expected.out +26 -0
- itp_interface/tools/repl/test/pickle_proof_state_1.in +15 -0
- itp_interface/tools/repl/test/pickle_proof_state_2.expected.out +4 -0
- itp_interface/tools/repl/test/pickle_proof_state_2.in +3 -0
- itp_interface/tools/repl/test/pickle_proof_state_env.expected.out +26 -0
- itp_interface/tools/repl/test/pickle_proof_state_env.in +15 -0
- itp_interface/tools/repl/test/pickle_scoped_notation.in +16 -0
- itp_interface/tools/repl/test/pickle_scoped_notation_2.in +3 -0
- itp_interface/tools/repl/test/proof_step.expected.out +18 -0
- itp_interface/tools/repl/test/proof_step.in +7 -0
- itp_interface/tools/repl/test/readme.expected.out +16 -0
- itp_interface/tools/repl/test/readme.in +5 -0
- itp_interface/tools/repl/test/sorry_hypotheses.expected.out +16 -0
- itp_interface/tools/repl/test/sorry_hypotheses.in +4 -0
- itp_interface/tools/repl/test/synthesize_placeholder.expected.out +7 -0
- itp_interface/tools/repl/test/synthesize_placeholder.in +1 -0
- itp_interface/tools/repl/test/tactic_mode_sorry.expected.out +14 -0
- itp_interface/tools/repl/test/tactic_mode_sorry.in +3 -0
- itp_interface/tools/repl/test/tactic_sorry.expected.out +12 -0
- itp_interface/tools/repl/test/tactic_sorry.in +1 -0
- itp_interface/tools/repl/test/term_sorry.expected.out +12 -0
- itp_interface/tools/repl/test/term_sorry.in +1 -0
- itp_interface/tools/repl/test/trace_simp.expected.out +41 -0
- itp_interface/tools/repl/test/trace_simp.in +15 -0
- itp_interface/tools/repl/test/unfinished_tactic_block.expected.out +11 -0
- itp_interface/tools/repl/test/unfinished_tactic_block.in +1 -0
- itp_interface/tools/repl/test/unknown_environment.expected.out +2 -0
- itp_interface/tools/repl/test/unknown_environment.in +1 -0
- itp_interface/tools/repl/test/unknown_proof_state.expected.out +14 -0
- itp_interface/tools/repl/test/unknown_proof_state.in +3 -0
- itp_interface/tools/repl/test/unknown_tactic.expected.out +14 -0
- itp_interface/tools/repl/test/unknown_tactic.in +3 -0
- itp_interface/tools/repl/test/variables.expected.out +26 -0
- itp_interface/tools/repl/test/variables.in +5 -0
- itp_interface/tools/repl/test.sh +43 -0
- itp_interface/tools/run_data_generation_transforms.py +350 -0
- itp_interface/tools/theorem_details.py +25 -0
- itp_interface/tools/training_data.py +358 -0
- itp_interface/tools/training_data_format.py +599 -0
- itp_interface-1.0.0.dist-info/METADATA +78 -0
- itp_interface-1.0.0.dist-info/RECORD +485 -0
- itp_interface-1.0.0.dist-info/WHEEL +4 -0
- itp_interface-1.0.0.dist-info/entry_points.txt +3 -0
- itp_interface-1.0.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- UniMath:
|
|
3
|
+
url: https://github.com/UniMath/UniMath
|
|
4
|
+
commit: 7432feea2113a460eb5a69fbbba5fda02e2bf234
|
|
5
|
+
branch: master
|
|
6
|
+
build_cmds: # Verified on 2024-05-04
|
|
7
|
+
- opam switch create UniMath 4.14.1
|
|
8
|
+
- eval $(opam env --switch=UniMath --set-switch)
|
|
9
|
+
- opam pin add -y coq 8.18.0
|
|
10
|
+
- eval $(opam env)
|
|
11
|
+
- opam install coq-lsp --yes # 0.1.8+8.18 version
|
|
12
|
+
- make -j `nproc`
|
|
13
|
+
setup_cmds:
|
|
14
|
+
- opam env --switch=UniMath --set-switch
|
|
15
|
+
- math-comp:
|
|
16
|
+
url: https://github.com/math-comp/math-comp
|
|
17
|
+
commit: 936a3fd89c621caec7bae631147234f2e4d389f7
|
|
18
|
+
branch: master
|
|
19
|
+
build_cmds: # Verified on 2024-05-04
|
|
20
|
+
- cd mathcomp
|
|
21
|
+
- opam switch create MathComp 4.14.1
|
|
22
|
+
- opam repo add coq-released https://coq.inria.fr/opam/released
|
|
23
|
+
- eval $(opam env --switch=MathComp --set-switch)
|
|
24
|
+
- opam pin add -y coq 8.18.0
|
|
25
|
+
- opam pin add -y coq-lsp 0.1.8+8.18
|
|
26
|
+
- opam pin add -n -y -k path coq-mathcomp-ssreflect .
|
|
27
|
+
- opam install -y coq-mathcomp-ssreflect --deps-only
|
|
28
|
+
- make -j `nproc`
|
|
29
|
+
setup_cmds:
|
|
30
|
+
- opam env --switch=MathComp --set-switch
|
|
31
|
+
- GeoCoq:
|
|
32
|
+
url: https://github.com/GeoCoq/GeoCoq
|
|
33
|
+
commit: 2f038905da84b8e63f07e2bf5b1b1bf348e1e0a1
|
|
34
|
+
branch: master
|
|
35
|
+
build_cmds: # Verified on 2024-05-04
|
|
36
|
+
- opam switch create GeoCoq 4.14.1
|
|
37
|
+
- eval $(opam env --switch=GeoCoq --set-switch)
|
|
38
|
+
- opam repo add coq-released https://coq.inria.fr/opam/released
|
|
39
|
+
- opam pin add -y coq 8.18.0
|
|
40
|
+
- opam pin add -y coq-lsp 0.1.8+8.18
|
|
41
|
+
- opam pin -n . --yes
|
|
42
|
+
- opam install coq-geocoq-coinc --yes
|
|
43
|
+
- opam install coq-geocoq-axioms --yes
|
|
44
|
+
- opam install coq-geocoq-elements --yes
|
|
45
|
+
- opam install coq-geocoq-main --yes
|
|
46
|
+
- opam install coq-geocoq-algebraic --yes
|
|
47
|
+
- opam install ./coq-geocoq.opam --deps-only --yes
|
|
48
|
+
- ./configure.sh
|
|
49
|
+
- make -j `nproc`
|
|
50
|
+
setup_cmds:
|
|
51
|
+
- opam env --switch=GeoCoq --set-switch
|
|
52
|
+
- category-theory:
|
|
53
|
+
url: https://github.com/jwiegley/category-theory
|
|
54
|
+
commit: f8295f0d77ab0dd9f989e8e45d43670a69f424df
|
|
55
|
+
branch: master
|
|
56
|
+
build_cmds: # Verified on 2024-05-05
|
|
57
|
+
- pushd ..
|
|
58
|
+
- opam switch create category-theory 4.14.1
|
|
59
|
+
- eval $(opam env --switch=category-theory --set-switch)
|
|
60
|
+
- opam pin add -y coq 8.18.0
|
|
61
|
+
- opam pin add -y coq-lsp 0.1.8+8.18
|
|
62
|
+
- opam repo add coq-released https://coq.inria.fr/opam/released
|
|
63
|
+
- opam install ./category-theory/coq-category-theory.opam --deps-only --yes
|
|
64
|
+
- make -C category-theory -j `nproc`
|
|
65
|
+
- popd
|
|
66
|
+
setup_cmds:
|
|
67
|
+
- opam env --switch=category-theory --set-switch
|
|
68
|
+
- CompCert:
|
|
69
|
+
url: https://github.com/AbsInt/CompCert
|
|
70
|
+
commit: 76a4ff8f5b37429a614a2a97f628d9d862c93f46
|
|
71
|
+
build_cmds: # Verified on 2024-05-04
|
|
72
|
+
- pushd ..
|
|
73
|
+
- pwd
|
|
74
|
+
- opam switch create CompCert 4.07.1
|
|
75
|
+
- eval $(opam env --switch=CompCert --set-switch)
|
|
76
|
+
- eval `opam config env`
|
|
77
|
+
- opam pin -yn add coq 8.10.2
|
|
78
|
+
- opam pin -yn add menhir 20190626
|
|
79
|
+
- opam install -y coq-serapi coq menhir
|
|
80
|
+
- if [[ ! -f "CompCert/Makefile.config" ]]; then
|
|
81
|
+
- (cd CompCert && ./configure x86_64-linux)
|
|
82
|
+
- fi
|
|
83
|
+
- make -C CompCert -j `nproc`
|
|
84
|
+
- popd
|
|
85
|
+
setup_cmds:
|
|
86
|
+
- opam env --switch=CompCert --set-switch
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
# Will do these in future
|
|
91
|
+
# - Coq-HoTT:
|
|
92
|
+
# url: https://github.com/HoTT/Coq-HoTT
|
|
93
|
+
# commit: 72ced09bc29602791755a025838bb4d48805ae86
|
|
94
|
+
# branch: master
|
|
95
|
+
# build_cmds:
|
|
96
|
+
# - opam switch create Coq-HoTT 4.09.0
|
|
97
|
+
# - eval $(opam env --switch=Coq-HoTT --set-switch)
|
|
98
|
+
# - opam pin add -y coq 8.10.2
|
|
99
|
+
# - make -j `nproc`
|
|
100
|
+
# setup_cmds:
|
|
101
|
+
# - opam env --switch=Coq-HoTT --set-switch
|
|
102
|
+
# - verdi:
|
|
103
|
+
# url: https://github.com/uwplse/verdi
|
|
104
|
+
# commit: 8f7fe47ae25c9ba0faeb1e9f62417ba238ef15bf
|
|
105
|
+
# branch: master
|
|
106
|
+
# build_cmds:
|
|
107
|
+
# - opam switch create verdi 4.09.0
|
|
108
|
+
# - eval $(opam env --switch=verdi --set-switch)
|
|
109
|
+
# - opam pin add -y coq 8.10.2
|
|
110
|
+
# - make -j `nproc`
|
|
111
|
+
# setup_cmds:
|
|
112
|
+
# - opam env --switch=verdi --set-switch
|
|
113
|
+
# - fourcolor:
|
|
114
|
+
# url: https://github.com/coq-community/fourcolor
|
|
115
|
+
# commit: 91ff6b8b846c8ad683260a5e6ce400e186f43c6e
|
|
116
|
+
# branch: master
|
|
117
|
+
# build_cmds:
|
|
118
|
+
# - opam switch create fourcolor 4.
|
|
119
|
+
# - eval $(opam env --switch=fourcolor --set-switch)
|
|
120
|
+
# - opam pin add -y coq 8.10.2
|
|
121
|
+
# - make -j `nproc`
|
|
122
|
+
# setup_cmds:
|
|
123
|
+
# - opam env --switch=fourcolor --set-switch
|
|
124
|
+
# - coq-tricks:
|
|
125
|
+
# url: https://github.com/tchajed/coq-tricks
|
|
126
|
+
# commit: 8636f839bebd101286aaa9f41350de40f1f911c1
|
|
127
|
+
# branch: master
|
|
128
|
+
# build_cmds:
|
|
129
|
+
# - opam switch create coq-tricks 4.09.0
|
|
130
|
+
# - eval $(opam env --switch=coq-tricks --set-switch)
|
|
131
|
+
# - opam pin add -y coq 8.10.2
|
|
132
|
+
# - make -j `nproc`
|
|
133
|
+
# setup_cmds:
|
|
134
|
+
# - opam env --switch=coq-tricks --set-switch
|
|
135
|
+
# - VST:
|
|
136
|
+
# url: https://github.com/PrincetonUniversity/VST
|
|
137
|
+
# commit: 56e6886288918f1b78ad53dd3dcdb1a58a9916cb
|
|
138
|
+
# branch: master
|
|
139
|
+
# build_cmds:
|
|
140
|
+
# - opam switch create VST 4.09.0
|
|
141
|
+
# - eval $(opam env --switch=VST --set-switch)
|
|
142
|
+
# - opam pin add -y coq 8.10.2
|
|
143
|
+
# - make -j `nproc`
|
|
144
|
+
# setup_cmds:
|
|
145
|
+
# - opam env --switch=VST --set-switch
|
|
146
|
+
# - Set-Theory:
|
|
147
|
+
# url: https://github.com/choukh/Set-Theory
|
|
148
|
+
# commit: 5677d0d9cc3814adfb9bc1286a826f9d620fcc2e
|
|
149
|
+
# branch: master
|
|
150
|
+
# build_cmds:
|
|
151
|
+
# - opam switch create Set-Theory 4
|
|
152
|
+
# - eval $(opam env --switch=Set-Theory --set-switch)
|
|
153
|
+
# - opam pin add -y coq 8.10.2
|
|
154
|
+
# - make -j `nproc`
|
|
155
|
+
# setup_cmds:
|
|
156
|
+
# - opam env --switch=Set-Theory --set-switch
|
|
157
|
+
# - math-classes:
|
|
158
|
+
# url: https://github.com/coq-community/math-classes
|
|
159
|
+
# commit: 2a8e12360cceee510f39e3ef4d0a7472d70fa684
|
|
160
|
+
# branch: master
|
|
161
|
+
# build_cmds:
|
|
162
|
+
# - opam switch create math-classes
|
|
163
|
+
# - eval $(opam env --switch=math-classes --set-switch)
|
|
164
|
+
# - opam pin add -y coq 8.10.2
|
|
165
|
+
# - make -j `nproc`
|
|
166
|
+
# setup_cmds:
|
|
167
|
+
# - opam env --switch=math-classes --set-switch
|
|
168
|
+
# - coq-100-theorems:
|
|
169
|
+
# url: https://github.com/coq-community/coq-100-theorems
|
|
170
|
+
# commit: 36ba6d3abae801fb92bd74a26cd27ebf5de0c234
|
|
171
|
+
# branch: master
|
|
172
|
+
# build_cmds:
|
|
173
|
+
# - opam switch create coq-100-theore
|
|
174
|
+
# - eval $(opam env --switch=coq-100-the --set-switch)
|
|
175
|
+
# - opam pin add -y coq 8.10.2
|
|
176
|
+
# - make -j `nproc`
|
|
177
|
+
# setup_cmds:
|
|
178
|
+
# - opam env --switch=coq-100-the --set-switch
|
|
179
|
+
# - coq:
|
|
180
|
+
# url: https://github.com/coq/coq
|
|
181
|
+
# commit: 6fdccaf0346754dda384c6847f1f2aded2b88c41
|
|
182
|
+
# build_cmds: # Verified on 2024-05-04
|
|
183
|
+
# - opam switch create coq --packages="ocaml-variants.4.14.1+options,ocaml-option-flambda"
|
|
184
|
+
# - eval $(opam env --switch=coq --set-switch)
|
|
185
|
+
# - opam pin add -y coq 8.18.0
|
|
186
|
+
# - opam install dune ocamlfind zarith lablgtk3-sourceview3 --yes
|
|
187
|
+
# - ./configure
|
|
188
|
+
# - make dunestrap
|
|
189
|
+
# - dune build -p coq-core,coq-stdlib,coq,coqide-server
|
|
190
|
+
# setup_cmds:
|
|
191
|
+
# - opam env --switch=coq --set-switch
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: default_coq_data_generation_transforms
|
|
2
|
+
use_human_readable: True
|
|
3
|
+
save_intermidiate_transforms: True
|
|
4
|
+
buffer_size: 10000
|
|
5
|
+
pool_size: 20
|
|
6
|
+
transform_type: LOCAL
|
|
7
|
+
dep_depth: 0
|
|
8
|
+
max_search_results:
|
|
9
|
+
output_dir: .log/run_data_generation_transforms/data/train/coq
|
|
10
|
+
setting_type: Agent
|
|
11
|
+
timeout_in_secs: 60 # coq tactic execution timeout
|
|
12
|
+
proof_retries: 1
|
|
13
|
+
max_theorems_in_prompt: 7
|
|
14
|
+
max_number_of_episodes: 1
|
|
15
|
+
max_steps_per_episode: 60
|
|
16
|
+
render: False
|
|
17
|
+
checkpoint_dir: .log/checkpoints
|
|
18
|
+
should_checkpoint: False
|
|
19
|
+
random_seed: 42
|
|
20
|
+
random_split: False
|
|
21
|
+
train_eval_test_split:
|
|
22
|
+
- 1.0
|
|
23
|
+
- 0.0
|
|
24
|
+
- 0.0
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: default_isabelle_data_generation_transforms
|
|
2
|
+
use_human_readable: True
|
|
3
|
+
save_intermidiate_transforms: True
|
|
4
|
+
buffer_size: 10000
|
|
5
|
+
pool_size: 7
|
|
6
|
+
transform_type: LOCAL
|
|
7
|
+
dep_depth: 0
|
|
8
|
+
max_search_results:
|
|
9
|
+
output_dir: .log/run_data_generation_transforms/data/train/isabelle
|
|
10
|
+
setting_type: Agent
|
|
11
|
+
timeout_in_secs: 60 # tactic execution timeout
|
|
12
|
+
proof_retries: 1
|
|
13
|
+
max_theorems_in_prompt: 7
|
|
14
|
+
max_number_of_episodes: 1
|
|
15
|
+
max_steps_per_episode: 60
|
|
16
|
+
render: False
|
|
17
|
+
checkpoint_dir: .log/checkpoints
|
|
18
|
+
should_checkpoint: False
|
|
19
|
+
random_seed: 42
|
|
20
|
+
random_split: False
|
|
21
|
+
train_eval_test_split:
|
|
22
|
+
- 1.0
|
|
23
|
+
- 0.0
|
|
24
|
+
- 0.0
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: default_lean4_data_generation_transforms
|
|
2
|
+
use_human_readable: True
|
|
3
|
+
save_intermidiate_transforms: True
|
|
4
|
+
buffer_size: 10000
|
|
5
|
+
pool_size: 8
|
|
6
|
+
transform_type: LOCAL
|
|
7
|
+
dep_depth: 0
|
|
8
|
+
max_search_results:
|
|
9
|
+
output_dir: .log/run_data_generation_transforms/data/train/lean4
|
|
10
|
+
setting_type: Agent
|
|
11
|
+
timeout_in_secs: 200 # coq tactic execution timeout
|
|
12
|
+
proof_retries: 1
|
|
13
|
+
max_theorems_in_prompt: 7
|
|
14
|
+
max_number_of_episodes: 1
|
|
15
|
+
max_steps_per_episode: 60
|
|
16
|
+
render: False
|
|
17
|
+
checkpoint_dir: .log/checkpoints
|
|
18
|
+
should_checkpoint: False
|
|
19
|
+
random_seed: 42
|
|
20
|
+
random_split: False
|
|
21
|
+
train_eval_test_split:
|
|
22
|
+
- 1.0
|
|
23
|
+
- 0.0
|
|
24
|
+
- 0.0
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: default_lean_data_generation_transforms
|
|
2
|
+
use_human_readable: True
|
|
3
|
+
save_intermidiate_transforms: True
|
|
4
|
+
buffer_size: 10000
|
|
5
|
+
pool_size: 20
|
|
6
|
+
transform_type: LOCAL
|
|
7
|
+
dep_depth: 0
|
|
8
|
+
max_search_results:
|
|
9
|
+
output_dir: .log/run_data_generation_transforms/data/train/lean
|
|
10
|
+
setting_type: Agent
|
|
11
|
+
timeout_in_secs: 60 # coq tactic execution timeout
|
|
12
|
+
proof_retries: 1
|
|
13
|
+
max_theorems_in_prompt: 7
|
|
14
|
+
max_number_of_episodes: 1
|
|
15
|
+
max_steps_per_episode: 60
|
|
16
|
+
render: False
|
|
17
|
+
checkpoint_dir: .log/checkpoints
|
|
18
|
+
should_checkpoint: False
|
|
19
|
+
random_seed: 42
|
|
20
|
+
random_split: False
|
|
21
|
+
train_eval_test_split:
|
|
22
|
+
- 1.0
|
|
23
|
+
- 0.0
|
|
24
|
+
- 0.0
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
defaults:
|
|
2
|
+
# - benchmark: simple_benchmark_lean_training_data
|
|
3
|
+
# - run_settings: default_lean_data_generation_transforms
|
|
4
|
+
# - benchmark: simple_benchmark_1
|
|
5
|
+
# - run_settings: default_lean4_data_generation_transforms
|
|
6
|
+
- benchmark: simple_benchmark_1
|
|
7
|
+
- run_settings: default_coq_data_generation_transforms
|
|
8
|
+
- env_settings: no_retrieval
|
|
9
|
+
- override hydra/job_logging: 'disabled'
|
|
10
|
+
|
|
11
|
+
run_settings:
|
|
12
|
+
output_dir: .log/data_generation/benchmark/simple_benchmark_1
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
defaults:
|
|
2
|
+
# - benchmark: simple_benchmark_lean_training_data
|
|
3
|
+
# - run_settings: default_lean_data_generation_transforms
|
|
4
|
+
# - benchmark: simple_benchmark_1
|
|
5
|
+
# - run_settings: default_lean4_data_generation_transforms
|
|
6
|
+
- benchmark: simple_benchmark_1
|
|
7
|
+
- run_settings: default_coq_data_generation_transforms
|
|
8
|
+
- env_settings: no_retrieval
|
|
9
|
+
- override hydra/job_logging: 'disabled'
|
|
10
|
+
|
|
11
|
+
run_settings:
|
|
12
|
+
output_dir: .log/data_generation/benchmark/simple_benchmark_1
|
|
13
|
+
random_split: True
|
|
14
|
+
train_eval_test_split:
|
|
15
|
+
- 0.6
|
|
16
|
+
- 0.2
|
|
17
|
+
- 0.2
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
defaults:
|
|
2
|
+
# - benchmark: simple_benchmark_lean_training_data
|
|
3
|
+
# - run_settings: default_lean_data_generation_transforms
|
|
4
|
+
# - benchmark: simple_benchmark_1
|
|
5
|
+
# - run_settings: default_lean4_data_generation_transforms
|
|
6
|
+
- benchmark: simple_benchmark_lean
|
|
7
|
+
- run_settings: default_lean4_data_generation_transforms
|
|
8
|
+
- env_settings: no_retrieval
|
|
9
|
+
- override hydra/job_logging: 'disabled'
|
|
10
|
+
|
|
11
|
+
run_settings:
|
|
12
|
+
output_dir: .log/data_generation/benchmark/simple_benchmark_lean
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
defaults:
|
|
2
|
+
# - benchmark: simple_benchmark_lean_training_data
|
|
3
|
+
# - run_settings: default_lean_data_generation_transforms
|
|
4
|
+
# - benchmark: simple_benchmark_1
|
|
5
|
+
# - run_settings: default_lean4_data_generation_transforms
|
|
6
|
+
- benchmark: simple_rl_benchmark_lean
|
|
7
|
+
- run_settings: default_lean4_data_generation_transforms
|
|
8
|
+
- env_settings: no_retrieval
|
|
9
|
+
- override hydra/job_logging: 'disabled'
|
|
10
|
+
|
|
11
|
+
run_settings:
|
|
12
|
+
output_dir: .log/data_generation/benchmark/simple_rl_benchmark_lean
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
defaults:
|
|
2
|
+
# - benchmark: simple_benchmark_lean_training_data
|
|
3
|
+
# - run_settings: default_lean_data_generation_transforms
|
|
4
|
+
- benchmark: UniMath
|
|
5
|
+
- run_settings: default_coq_data_generation_transforms
|
|
6
|
+
- env_settings: no_retrieval
|
|
7
|
+
- override hydra/job_logging: 'disabled'
|
|
8
|
+
|
|
9
|
+
run_settings:
|
|
10
|
+
output_dir: <root>/data/proofsteps/UniMath
|
|
11
|
+
train_eval_test_split:
|
|
12
|
+
- 0.925
|
|
13
|
+
- 0.0375
|
|
14
|
+
- 0.0375
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
root_dir = f"{__file__.split('itp_interface')[0]}"
|
|
6
|
+
if root_dir not in sys.path:
|
|
7
|
+
sys.path.append(root_dir)
|
|
8
|
+
import typing
|
|
9
|
+
from dataclasses import dataclass, field
|
|
10
|
+
from dataclasses_json import dataclass_json
|
|
11
|
+
from enum import Enum
|
|
12
|
+
from itp_interface.rl.proof_tree import ProofSearchResult
|
|
13
|
+
from itp_interface.rl.proof_action import ProofAction
|
|
14
|
+
from itp_interface.rl.simple_proof_env import ProofEnvReRankStrategy
|
|
15
|
+
|
|
16
|
+
class SettingType(Enum):
|
|
17
|
+
Agent = "Agent"
|
|
18
|
+
GptF = "GptF"
|
|
19
|
+
|
|
20
|
+
def __str__(self):
|
|
21
|
+
return self.value
|
|
22
|
+
|
|
23
|
+
class PolicyName(Enum):
|
|
24
|
+
# WARN: Don't make enums dataclasses because deserialization has some weird bug which matches the deserialized enum to all the enum values
|
|
25
|
+
Dfs = "Dfs"
|
|
26
|
+
FewShot = "FewShot"
|
|
27
|
+
|
|
28
|
+
def __str__(self):
|
|
29
|
+
return self.value
|
|
30
|
+
|
|
31
|
+
class TransformType(Enum):
|
|
32
|
+
LOCAL = "LOCAL"
|
|
33
|
+
GLOBAL = "GLOBAL"
|
|
34
|
+
FULL = "FULL"
|
|
35
|
+
|
|
36
|
+
def __str__(self):
|
|
37
|
+
return self.value
|
|
38
|
+
|
|
39
|
+
@dataclass_json
|
|
40
|
+
@dataclass
|
|
41
|
+
class EnvSettings(object):
|
|
42
|
+
name: str
|
|
43
|
+
retrieval_strategy: ProofEnvReRankStrategy
|
|
44
|
+
|
|
45
|
+
@dataclass_json
|
|
46
|
+
@dataclass
|
|
47
|
+
class RunSettings(object):
|
|
48
|
+
name: str
|
|
49
|
+
use_human_readable: bool
|
|
50
|
+
save_intermidiate_transforms: bool
|
|
51
|
+
buffer_size: int
|
|
52
|
+
pool_size: int
|
|
53
|
+
transform_type: TransformType
|
|
54
|
+
dep_depth: int
|
|
55
|
+
output_dir: str
|
|
56
|
+
setting_type: SettingType
|
|
57
|
+
timeout_in_secs: int # coq tactic execution timeout
|
|
58
|
+
proof_retries: int
|
|
59
|
+
max_theorems_in_prompt: int
|
|
60
|
+
max_number_of_episodes: int
|
|
61
|
+
max_steps_per_episode: int
|
|
62
|
+
render: bool
|
|
63
|
+
checkpoint_dir: str
|
|
64
|
+
should_checkpoint: bool
|
|
65
|
+
max_search_results: typing.Optional[int] = None
|
|
66
|
+
random_seed: int = 42
|
|
67
|
+
random_split: bool = False
|
|
68
|
+
train_eval_test_split: typing.List[float] = field(default_factory=lambda: [1.0, 0.0, 0.0])
|
|
69
|
+
|
|
70
|
+
@dataclass_json
|
|
71
|
+
@dataclass
|
|
72
|
+
class EvalFile(object):
|
|
73
|
+
path: str
|
|
74
|
+
theorems: typing.Union[str, typing.List[str]]
|
|
75
|
+
|
|
76
|
+
@dataclass_json
|
|
77
|
+
@dataclass
|
|
78
|
+
class EvalDataset(object):
|
|
79
|
+
project: str
|
|
80
|
+
files: typing.List[EvalFile]
|
|
81
|
+
|
|
82
|
+
@dataclass_json
|
|
83
|
+
@dataclass
|
|
84
|
+
class EvalBenchmark(object):
|
|
85
|
+
name: str
|
|
86
|
+
num_files: int
|
|
87
|
+
language: ProofAction.Language
|
|
88
|
+
datasets: typing.List[EvalDataset]
|
|
89
|
+
few_shot_data_path_for_retrieval: str = None
|
|
90
|
+
few_shot_metadata_filename_for_retrieval: str = None
|
|
91
|
+
dfs_data_path_for_retrieval: str = None
|
|
92
|
+
dfs_metadata_filename_for_retrieval: str = None
|
|
93
|
+
setup_cmds: typing.List[str] = field(default_factory=list)
|
|
94
|
+
|
|
95
|
+
@dataclass_json
|
|
96
|
+
@dataclass
|
|
97
|
+
class Experiments(object):
|
|
98
|
+
env_settings: EnvSettings
|
|
99
|
+
run_settings: RunSettings
|
|
100
|
+
benchmark: EvalBenchmark
|
|
101
|
+
|
|
102
|
+
@dataclass_json
|
|
103
|
+
@dataclass
|
|
104
|
+
class EvalRunCheckpointInfo(object):
|
|
105
|
+
checkpoint_file: str
|
|
106
|
+
logging_dirs: typing.List[str]
|
|
107
|
+
proof_dump_dir: str
|
|
108
|
+
theorem_maps: typing.Dict[str, typing.Dict[str, bool]]
|
|
109
|
+
|
|
110
|
+
def add_path_to_maps(self, path: str):
|
|
111
|
+
if path not in self.theorem_maps:
|
|
112
|
+
self.theorem_maps[path] = {}
|
|
113
|
+
|
|
114
|
+
def add_theorem_to_maps(self, path: str, theorem: str, success: bool):
|
|
115
|
+
self.theorem_maps[path][theorem] = success
|
|
116
|
+
with open(self.checkpoint_file, "w") as f:
|
|
117
|
+
f.write(self.to_json(indent=4))
|
|
118
|
+
|
|
119
|
+
@dataclass_json
|
|
120
|
+
@dataclass
|
|
121
|
+
class EvalProofResults(object):
|
|
122
|
+
path: str
|
|
123
|
+
theorem_map: typing.Dict[str, typing.Dict[str, ProofSearchResult]]
|
|
124
|
+
|
|
125
|
+
def add_path_to_maps(self, path: str):
|
|
126
|
+
if path not in self.theorem_map:
|
|
127
|
+
self.theorem_map[path] = {}
|
|
128
|
+
|
|
129
|
+
def add_theorem_to_maps(self, path: str, theorem: str, proof_result: ProofSearchResult):
|
|
130
|
+
self.theorem_map[path][theorem] = proof_result
|
|
131
|
+
with open(self.path, "w") as f:
|
|
132
|
+
f.write(self.to_json(indent=4))
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def parse_config(cfg):
|
|
136
|
+
env_settings_cfg = cfg["env_settings"]
|
|
137
|
+
env_settings = EnvSettings(
|
|
138
|
+
name=env_settings_cfg["name"],
|
|
139
|
+
retrieval_strategy=ProofEnvReRankStrategy(env_settings_cfg["retrieval_strategy"]))
|
|
140
|
+
run_settings_cfg = cfg["run_settings"]
|
|
141
|
+
eval_settings = RunSettings(
|
|
142
|
+
name=run_settings_cfg["name"],
|
|
143
|
+
use_human_readable=run_settings_cfg["use_human_readable"],
|
|
144
|
+
save_intermidiate_transforms=run_settings_cfg["save_intermidiate_transforms"],
|
|
145
|
+
buffer_size=run_settings_cfg["buffer_size"],
|
|
146
|
+
pool_size=run_settings_cfg["pool_size"],
|
|
147
|
+
transform_type=TransformType(run_settings_cfg["transform_type"]),
|
|
148
|
+
dep_depth=run_settings_cfg["dep_depth"],
|
|
149
|
+
output_dir=run_settings_cfg["output_dir"],
|
|
150
|
+
max_search_results=run_settings_cfg["max_search_results"],
|
|
151
|
+
setting_type=SettingType(run_settings_cfg["setting_type"]),
|
|
152
|
+
timeout_in_secs=run_settings_cfg["timeout_in_secs"],
|
|
153
|
+
proof_retries=run_settings_cfg["proof_retries"],
|
|
154
|
+
max_theorems_in_prompt=run_settings_cfg["max_theorems_in_prompt"],
|
|
155
|
+
max_number_of_episodes=run_settings_cfg["max_number_of_episodes"],
|
|
156
|
+
max_steps_per_episode=run_settings_cfg["max_steps_per_episode"],
|
|
157
|
+
render=run_settings_cfg["render"],
|
|
158
|
+
checkpoint_dir=run_settings_cfg["checkpoint_dir"],
|
|
159
|
+
should_checkpoint=run_settings_cfg["should_checkpoint"],
|
|
160
|
+
random_seed=run_settings_cfg["random_seed"],
|
|
161
|
+
random_split=run_settings_cfg["random_split"],
|
|
162
|
+
train_eval_test_split=run_settings_cfg["train_eval_test_split"])
|
|
163
|
+
benchmark_cfg = cfg["benchmark"]
|
|
164
|
+
datasets_cfg = benchmark_cfg["datasets"]
|
|
165
|
+
eval_datasets = []
|
|
166
|
+
for dataset_cfg in datasets_cfg:
|
|
167
|
+
files_cfg = list(dataset_cfg["files"])
|
|
168
|
+
eval_files = []
|
|
169
|
+
for file_cfg in files_cfg:
|
|
170
|
+
theorems = None
|
|
171
|
+
if type(file_cfg["theorems"]) == str:
|
|
172
|
+
theorems = file_cfg["theorems"]
|
|
173
|
+
else:
|
|
174
|
+
theorems = list(file_cfg["theorems"])
|
|
175
|
+
eval_files.append(EvalFile(
|
|
176
|
+
path=file_cfg["path"],
|
|
177
|
+
theorems=theorems))
|
|
178
|
+
eval_datasets.append(EvalDataset(
|
|
179
|
+
project=dataset_cfg["project"],
|
|
180
|
+
files=eval_files))
|
|
181
|
+
language = ProofAction.Language(benchmark_cfg["language"])
|
|
182
|
+
benchmark = EvalBenchmark(
|
|
183
|
+
name=benchmark_cfg["name"],
|
|
184
|
+
num_files=benchmark_cfg["num_files"],
|
|
185
|
+
language=language,
|
|
186
|
+
datasets=eval_datasets,
|
|
187
|
+
few_shot_data_path_for_retrieval=benchmark_cfg["few_shot_data_path_for_retrieval"],
|
|
188
|
+
few_shot_metadata_filename_for_retrieval=benchmark_cfg["few_shot_metadata_filename_for_retrieval"],
|
|
189
|
+
dfs_data_path_for_retrieval=benchmark_cfg["dfs_data_path_for_retrieval"],
|
|
190
|
+
dfs_metadata_filename_for_retrieval=benchmark_cfg["dfs_metadata_filename_for_retrieval"],
|
|
191
|
+
setup_cmds=benchmark_cfg["setup_cmds"] if "setup_cmds" in benchmark_cfg else [])
|
|
192
|
+
return Experiments(env_settings=env_settings, run_settings=eval_settings, benchmark=benchmark)
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
root_dir = f"{__file__.split('itp_interface')[0]}"
|
|
5
|
+
if root_dir not in sys.path:
|
|
6
|
+
sys.path.append(root_dir)
|
|
7
|
+
import argparse
|
|
8
|
+
import logging
|
|
9
|
+
import time
|
|
10
|
+
import os
|
|
11
|
+
import typing
|
|
12
|
+
import copy
|
|
13
|
+
import yaml
|
|
14
|
+
from itp_interface.tools.log_utils import setup_logger
|
|
15
|
+
from itp_interface.tools.training_data import TrainingData
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def create_yaml(project_to_theorems, name, language, output_file):
|
|
19
|
+
data = {
|
|
20
|
+
"name": name,
|
|
21
|
+
"num_files": 0,
|
|
22
|
+
"language": str(language),
|
|
23
|
+
"few_shot_data_path_for_retrieval": None,
|
|
24
|
+
"few_shot_metadata_filename_for_retrieval": None,
|
|
25
|
+
"dfs_data_path_for_retrieval": None,
|
|
26
|
+
"dfs_metadata_filename_for_retrieval": "local.meta.json",
|
|
27
|
+
"theorem_cnt": 0,
|
|
28
|
+
"datasets": []
|
|
29
|
+
}
|
|
30
|
+
for project_root, file_dict in project_to_theorems.items():
|
|
31
|
+
dataset = {"project": project_root, "files": []}
|
|
32
|
+
for file_path, theorems in file_dict.items():
|
|
33
|
+
data["num_files"] += 1
|
|
34
|
+
data["theorem_cnt"] += len(theorems)
|
|
35
|
+
dataset["files"].append({"path": file_path, "theorems": theorems})
|
|
36
|
+
data["datasets"].append(dataset)
|
|
37
|
+
|
|
38
|
+
with open(output_file, 'w') as yaml_file:
|
|
39
|
+
yaml.dump(data, yaml_file, sort_keys=False)
|
|
40
|
+
|
|
41
|
+
def extract_project_to_theorems(training_data : TrainingData, project_to_theorems: typing.Dict[str, typing.Dict[str, typing.List[str]]]):
|
|
42
|
+
for tdf in training_data:
|
|
43
|
+
project_path = tdf.project_id
|
|
44
|
+
file_path = tdf.file_path
|
|
45
|
+
# Check if both project and file_path are the same absolute path
|
|
46
|
+
both_abs_path = os.path.isabs(project_path) and os.path.isabs(file_path)
|
|
47
|
+
if both_abs_path:
|
|
48
|
+
file_path = os.path.relpath(file_path, project_path)
|
|
49
|
+
if project_path not in project_to_theorems:
|
|
50
|
+
project_to_theorems[project_path] = {}
|
|
51
|
+
if file_path not in project_to_theorems[project_path]:
|
|
52
|
+
project_to_theorems[project_path][file_path] = []
|
|
53
|
+
if tdf.theorem_name not in project_to_theorems[project_path][file_path]:
|
|
54
|
+
project_to_theorems[project_path][file_path].append(tdf.theorem_name)
|
|
55
|
+
|
|
56
|
+
def extract_benchmarks_from_datasets(datasets, metafilenames, name, language, output, max_parallelism=8, logger=None):
|
|
57
|
+
"""
|
|
58
|
+
extract datasets
|
|
59
|
+
"""
|
|
60
|
+
assert len(datasets) == len(metafilenames), "Length of datasets and metafilenames must be the same"
|
|
61
|
+
assert max_parallelism > 0, "Max parallelism must be greater than 0"
|
|
62
|
+
logger = logger or logging.getLogger("dataset_merge")
|
|
63
|
+
tds : typing.List[TrainingData] = []
|
|
64
|
+
for dataset, metafilename in zip(datasets, metafilenames):
|
|
65
|
+
training_data = TrainingData(
|
|
66
|
+
folder=dataset,
|
|
67
|
+
training_meta_filename=metafilename,
|
|
68
|
+
max_parallelism=max_parallelism
|
|
69
|
+
)
|
|
70
|
+
training_data.load_meta()
|
|
71
|
+
tds.append(training_data)
|
|
72
|
+
logger.info(f"Inited training data for {dataset}")
|
|
73
|
+
project_to_theorems_map = {}
|
|
74
|
+
for td in tds:
|
|
75
|
+
logger.info(f"Start loading {td.folder} ...")
|
|
76
|
+
td.load()
|
|
77
|
+
logger.info(f"Loaded {td.folder}.")
|
|
78
|
+
logger.info(f"Start extraction from {td.folder} ...")
|
|
79
|
+
extract_project_to_theorems(td, project_to_theorems_map)
|
|
80
|
+
logger.info(f"Finished extraction from {td.folder}.")
|
|
81
|
+
logger.info(f"Saving the extracted theorems to {output} ...")
|
|
82
|
+
create_yaml(project_to_theorems_map, name, language, output)
|
|
83
|
+
logger.info(f"Saved the extracted theorems to {output}.")
|
|
84
|
+
pass
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
if __name__ == "__main__":
|
|
88
|
+
args = argparse.ArgumentParser()
|
|
89
|
+
args.add_argument("--datasets", type=str, nargs="+", help="List of datasets to merge")
|
|
90
|
+
args.add_argument("--output", type=str, help="Output file")
|
|
91
|
+
args.add_argument("--metafilenames", type=str, nargs="+", help="List of metafilenames", default=None)
|
|
92
|
+
args.add_argument("--name", type=str, help="Name of the merged dataset")
|
|
93
|
+
args.add_argument("--language", type=str, help="Language of the merged dataset")
|
|
94
|
+
args.add_argument("--max_parallelism", type=int, help="Max parallelism", default=8)
|
|
95
|
+
args = args.parse_args()
|
|
96
|
+
# Add root dir to python path
|
|
97
|
+
os.environ["PYTHONPATH"] = f"{root_dir}:{os.environ.get('PYTHONPATH', '')}"
|
|
98
|
+
time_str = time.strftime("%Y-%m-%d_%H-%M-%S")
|
|
99
|
+
log_folder = os.path.join(".log", "extract_benchmark", time_str)
|
|
100
|
+
os.makedirs(log_folder, exist_ok=True)
|
|
101
|
+
logger = setup_logger("extract_benchmark", os.path.join(log_folder, "extract.log"))
|
|
102
|
+
if args.metafilenames is None:
|
|
103
|
+
args.metafilenames = ['local.meta.json' for _ in range(len(args.datasets))]
|
|
104
|
+
extract_benchmarks_from_datasets(
|
|
105
|
+
args.datasets, args.metafilenames, args.name, args.language, args.output, args.max_parallelism, logger
|
|
106
|
+
)
|