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,228 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
if [[ ! -d "src/itp_interface/scripts" ]]; then
|
|
4
|
+
# Raise an error if the scripts directory is not present
|
|
5
|
+
echo "Please run this script from the root of the repository, cannot find src/scripts"
|
|
6
|
+
exit 1
|
|
7
|
+
fi
|
|
8
|
+
# Default Lean version
|
|
9
|
+
lean3_version="3.42.1"
|
|
10
|
+
lean4_version="4.7.0-rc2" # "nightly" # "4.7.0" # "stable"
|
|
11
|
+
lean_type="lean4" # For Lean 3
|
|
12
|
+
lean_repo="leanprover-community/lean" # For Lean 3
|
|
13
|
+
# Check if lean_version is passed as an argument
|
|
14
|
+
if [[ $# -eq 1 ]]; then
|
|
15
|
+
lean_type=$1
|
|
16
|
+
afp_folder=$HOME
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
if [[ $# -eq 2 ]]; then
|
|
20
|
+
lean_type=$1
|
|
21
|
+
afp_folder=$2
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
if [[ $lean_type == "lean" ]]; then
|
|
25
|
+
lean_version=$lean3_version
|
|
26
|
+
lean_repo="leanprover-community/lean"
|
|
27
|
+
elif [[ $lean_type == "lean4" ]]; then
|
|
28
|
+
lean_version=$lean4_version
|
|
29
|
+
lean_repo="leanprover/lean4"
|
|
30
|
+
else
|
|
31
|
+
echo "Invalid Lean version, please choose between lean or lean4"
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
# Don't run without activating conda
|
|
36
|
+
# Check if Conda is activated
|
|
37
|
+
conda_status=$(conda info | grep "active environment" | cut -d ':' -f 2 | tr -d '[:space:]')
|
|
38
|
+
if [[ $conda_status == "None" ]] || [[ $conda_status == "base" ]]; then
|
|
39
|
+
echo "Please activate conda environment before running this script"
|
|
40
|
+
exit 1
|
|
41
|
+
fi
|
|
42
|
+
echo "Setting up ITP Interface ..."
|
|
43
|
+
echo "[NOTE] The installation needs manual intervention on some steps. Please choose the appropriate option when prompted."
|
|
44
|
+
conda install pip
|
|
45
|
+
conda_bin=$(conda info | grep "active env location" | cut -d ':' -f 2 | tr -d '[:space:]')
|
|
46
|
+
pip_exe="$conda_bin/bin/pip"
|
|
47
|
+
ls -l $pip_exe
|
|
48
|
+
echo "Installing dependencies..."
|
|
49
|
+
echo "Installing Elan (Lean version manager) ..."
|
|
50
|
+
# # For Lean:
|
|
51
|
+
# # https://leanprover-community.github.io/install/debian_details.html
|
|
52
|
+
curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh
|
|
53
|
+
echo "Installed Elan (Lean version manager) successfully!"
|
|
54
|
+
source $HOME/.elan/env
|
|
55
|
+
echo "Installing $lean_type ($lean_repo:$lean_version)..."
|
|
56
|
+
elan toolchain install $lean_repo:$lean_version
|
|
57
|
+
elan override set $lean_repo:$lean_version
|
|
58
|
+
echo "Installed $lean_type ($lean_repo:$lean_version) successfully!"
|
|
59
|
+
export PATH=$PATH:$HOME/.elan/bin
|
|
60
|
+
echo "Clone all git submodules..."
|
|
61
|
+
git submodule update --init --recursive
|
|
62
|
+
echo "Cloned all git submodules successfully!"
|
|
63
|
+
echo "Building Coq's CompCert project..."
|
|
64
|
+
pushd ./src/data/benchmarks
|
|
65
|
+
echo "Installing Coq switch..."
|
|
66
|
+
opam switch create CompCert 4.07.1
|
|
67
|
+
eval $(opam env --switch=CompCert --set-switch)
|
|
68
|
+
opam repo add coq-released https://coq.inria.fr/opam/released
|
|
69
|
+
eval `opam config env`
|
|
70
|
+
opam pin -yn add coq 8.10.2
|
|
71
|
+
opam pin -yn add menhir 20190626
|
|
72
|
+
opam install -y coq-serapi coq menhir
|
|
73
|
+
if [[ ! -f "CompCert/Makefile.config" ]]; then
|
|
74
|
+
(cd CompCert && ./configure x86_64-linux)
|
|
75
|
+
fi
|
|
76
|
+
make -C CompCert -j `nproc`
|
|
77
|
+
popd
|
|
78
|
+
echo "Building Coq's Simple Benchmark..."
|
|
79
|
+
pushd ./src/data/test/coq/custom_group_theory
|
|
80
|
+
cd theories
|
|
81
|
+
make
|
|
82
|
+
cd ..
|
|
83
|
+
popd
|
|
84
|
+
echo "Building Coq's Simple Benchmark done!"
|
|
85
|
+
echo "Coq's Setup complete!"
|
|
86
|
+
|
|
87
|
+
# Python dependencies
|
|
88
|
+
echo "Installing Python dependencies..."
|
|
89
|
+
$pip_exe install --user -r requirements.txt
|
|
90
|
+
|
|
91
|
+
# Only build Lean's Simple Benchmark if Lean 3 is selected
|
|
92
|
+
if [[ $lean_type == "lean" ]]; then
|
|
93
|
+
echo "Building Lean's projects ..."
|
|
94
|
+
(
|
|
95
|
+
# Build Lean's projects
|
|
96
|
+
echo "Building miniF2F..."
|
|
97
|
+
echo "This may take a while... (don't underestimate the time taken to build miniF2F, meanwhile you can take a coffee break!)"
|
|
98
|
+
pushd ./src/data/benchmarks
|
|
99
|
+
set -euv
|
|
100
|
+
cd miniF2F
|
|
101
|
+
leanpkg configure
|
|
102
|
+
leanproject get-mathlib-cache # This allows us to use .olean files from mathlib without building them again
|
|
103
|
+
leanproject build
|
|
104
|
+
popd
|
|
105
|
+
echo "miniF2F built successfully!"
|
|
106
|
+
) || exit 1
|
|
107
|
+
echo "Building Lean's Simple Benchmark..."
|
|
108
|
+
pushd ./src/data/test/lean_proj
|
|
109
|
+
leanproject build
|
|
110
|
+
popd
|
|
111
|
+
echo "Building Lean's Simple Benchmark done!"
|
|
112
|
+
echo "Building Lean's projects done!"
|
|
113
|
+
echo "Lean's Setup complete!"
|
|
114
|
+
echo "Downloading ReProver benchmarks..."
|
|
115
|
+
(
|
|
116
|
+
# Download ReProver benchmarks
|
|
117
|
+
echo "Running download.sh from src/data/benchmarks/lean-dojo..."
|
|
118
|
+
./src/data/benchmarks/lean-dojo/download.sh
|
|
119
|
+
echo "Downloaded ReProver benchmarks successfully!"
|
|
120
|
+
) || exit 1
|
|
121
|
+
fi
|
|
122
|
+
if [[ $lean_type == "lean4" ]]; then
|
|
123
|
+
echo "Building Lean 4's projects ..."
|
|
124
|
+
(
|
|
125
|
+
# Build Lean 4's projects
|
|
126
|
+
echo "Building Lean 4's Simple Benchmark..."
|
|
127
|
+
pushd ./src/data/test/lean4_proj
|
|
128
|
+
lake build lean4_proj
|
|
129
|
+
popd
|
|
130
|
+
echo "Building Lean 4's Simple Benchmark done!"
|
|
131
|
+
) || exit 1
|
|
132
|
+
echo "Building Lean 4's interface REPL..."
|
|
133
|
+
(
|
|
134
|
+
# Build Lean 4's interface REPL
|
|
135
|
+
pushd ./imports/repl
|
|
136
|
+
lake build repl
|
|
137
|
+
popd
|
|
138
|
+
echo "Lean 4's interface REPL built successfully!"
|
|
139
|
+
) || exit 1
|
|
140
|
+
echo "Building Lean 4's Mathlib..."
|
|
141
|
+
(
|
|
142
|
+
# Build Lean 4's Mathlib
|
|
143
|
+
echo "Building Lean 4's Mathlib..."
|
|
144
|
+
echo "This may take a while... (don't underestimate the time taken to build Lean 4's Mathlib, meanwhile you can take a coffee break!)"
|
|
145
|
+
pushd src/data/test/Mathlib
|
|
146
|
+
lake exe cache get > /dev/null
|
|
147
|
+
lake build Mathlib
|
|
148
|
+
popd
|
|
149
|
+
echo "Lean 4's Mathlib built successfully!"
|
|
150
|
+
) || exit 1
|
|
151
|
+
echo "Building Lean 4's projects done!"
|
|
152
|
+
fi
|
|
153
|
+
|
|
154
|
+
# Download Isabelle
|
|
155
|
+
# First check if Isabelle is already installed
|
|
156
|
+
# default_isabelle_dir="$HOME/Isabelle2022" # Don't change this, otherwise PISA will not work
|
|
157
|
+
# issabell_installed=false
|
|
158
|
+
# if [[ -d "$default_isabelle_dir" ]]; then
|
|
159
|
+
# echo "Isabelle is already installed at $default_isabelle_dir"
|
|
160
|
+
# echo "If you want to reinstall Isabelle, please delete the directory $default_isabelle_dir and run this script again"
|
|
161
|
+
# issabell_installed=true
|
|
162
|
+
# fi
|
|
163
|
+
# # Else download Isabelle
|
|
164
|
+
# if [[ $issabell_installed == false ]]; then
|
|
165
|
+
# echo "Installing SDKMAN..."
|
|
166
|
+
# curl -s "https://get.sdkman.io" | bash
|
|
167
|
+
# echo "Installed SDKMAN successfully!"
|
|
168
|
+
# echo "Installing Java 11 and SBT..."
|
|
169
|
+
# source $HOME/.sdkman/bin/sdkman-init.sh
|
|
170
|
+
# sdk install java 11.0.11-open
|
|
171
|
+
# echo "Installed Java 11 successfully!"
|
|
172
|
+
# echo "Installing SBT..."
|
|
173
|
+
# sdk install sbt
|
|
174
|
+
# echo "Installed SBT successfully!"
|
|
175
|
+
# echo "Downloading Isabelle..."
|
|
176
|
+
# wget https://isabelle.in.tum.de/website-Isabelle2022/dist/Isabelle2022_linux.tar.gz
|
|
177
|
+
# echo "Downloaded Isabelle successfully!"
|
|
178
|
+
# echo "Extracting Isabelle..."
|
|
179
|
+
# # Extract Isabelle in the $default_isabelle_dir
|
|
180
|
+
# tar -xzf Isabelle2022_linux.tar.gz -C $HOME
|
|
181
|
+
# echo "Installed Isabelle successfully!"
|
|
182
|
+
# echo "Cleaning up..."
|
|
183
|
+
# rm Isabelle2022_linux.tar.gz
|
|
184
|
+
# echo "Cleaned up!"
|
|
185
|
+
# echo "Adding Isabelle to PATH..."
|
|
186
|
+
# export PATH=$PATH:$default_isabelle_dir/bin
|
|
187
|
+
# echo "export PATH=$PATH:$default_isabelle_dir/bin" >> ~/.bashrc
|
|
188
|
+
# isabelle build -b -D $default_isabelle_dir/src/HOL/ -j 20
|
|
189
|
+
# fi
|
|
190
|
+
# pushd src/itp_interface/pisa
|
|
191
|
+
# sbt compile
|
|
192
|
+
# sbt assembly
|
|
193
|
+
# popd
|
|
194
|
+
# echo "Isabelle Setup complete!"
|
|
195
|
+
|
|
196
|
+
# echo "ITP Interface Setup complete!"
|
|
197
|
+
|
|
198
|
+
# echo "Building AFP"
|
|
199
|
+
# afp_installed_built=false
|
|
200
|
+
# if [[ -d "$afp_folder" ]]; then
|
|
201
|
+
# echo "AFP is already installed at $afp_folder"
|
|
202
|
+
# echo "If you want to reinstall AFP, please delete the directory $afp_folder and run this script again"
|
|
203
|
+
# afp_installed_built=true
|
|
204
|
+
# fi
|
|
205
|
+
|
|
206
|
+
# afp_version="2022-12-06"
|
|
207
|
+
# if [[ $afp_installed_built == false ]]; then
|
|
208
|
+
# mkdir -p $afp_folder
|
|
209
|
+
# echo "Downloading AFP..."
|
|
210
|
+
# wget https://www.isa-afp.org/release/afp-$afp_version.tar.gz
|
|
211
|
+
# echo "Downloaded AFP successfully!"
|
|
212
|
+
# echo "Extracting AFP..."
|
|
213
|
+
# # Extract AFP in the $afp_folder
|
|
214
|
+
# tar -xzf afp-$afp_version.tar.gz -C $afp_folder
|
|
215
|
+
# echo "Extracted AFP successfully!"
|
|
216
|
+
# echo "Cleaning up..."
|
|
217
|
+
# afp_name=$(ls $afp_folder)
|
|
218
|
+
# export AFP="$afp_folder/$afp_name/thys"
|
|
219
|
+
# echo "$AFP"
|
|
220
|
+
# rm afp-$afp_version.tar.gz
|
|
221
|
+
# echo "Cleaned up!"
|
|
222
|
+
# echo "Building AFP..."
|
|
223
|
+
# export ISABELLE_BUILD_OPTIONS="timeout=3600"
|
|
224
|
+
# export ML_OPTIONS="--maxheap 10000"
|
|
225
|
+
# isabelle build -b -D $AFP -j 35
|
|
226
|
+
# fi
|
|
227
|
+
|
|
228
|
+
# echo "AFP Setup complete!"
|
|
File without changes
|
|
@@ -0,0 +1,172 @@
|
|
|
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 collections import Counter
|
|
10
|
+
from dataclasses import dataclass, field
|
|
11
|
+
from dataclasses_json import dataclass_json
|
|
12
|
+
|
|
13
|
+
@dataclass_json
|
|
14
|
+
@dataclass
|
|
15
|
+
class Stats(object):
|
|
16
|
+
avg: float = 0.0
|
|
17
|
+
min: float = 0.0
|
|
18
|
+
max: float = 0.0
|
|
19
|
+
std: float = 0.0
|
|
20
|
+
median: float = 0.0
|
|
21
|
+
count: int = 0
|
|
22
|
+
quartiles: typing.Dict[int, float] = field(default_factory=dict)
|
|
23
|
+
percentile_with_sigmas : typing.Dict[int, float] = field(default_factory=dict)
|
|
24
|
+
|
|
25
|
+
def __post_init__(self):
|
|
26
|
+
if len(self.quartiles) == 0:
|
|
27
|
+
self.quartiles[1] = 0.0
|
|
28
|
+
self.quartiles[2] = 0.0
|
|
29
|
+
self.quartiles[3] = 0.0
|
|
30
|
+
if len(self.percentile_with_sigmas) == 0:
|
|
31
|
+
self.percentile_with_sigmas[-3] = 0.0
|
|
32
|
+
self.percentile_with_sigmas[-2] = 0.0
|
|
33
|
+
self.percentile_with_sigmas[-1] = 0.0
|
|
34
|
+
self.percentile_with_sigmas[0] = 0.0
|
|
35
|
+
self.percentile_with_sigmas[1] = 0.0
|
|
36
|
+
self.percentile_with_sigmas[2] = 0.0
|
|
37
|
+
self.percentile_with_sigmas[3] = 0.0
|
|
38
|
+
|
|
39
|
+
class CounterUtils:
|
|
40
|
+
@staticmethod
|
|
41
|
+
def percentile(counter: Counter, p: float) -> float:
|
|
42
|
+
assert isinstance(counter, Counter)
|
|
43
|
+
assert isinstance(p, float)
|
|
44
|
+
assert 0 <= p <= 1
|
|
45
|
+
n = sum(counter.values())
|
|
46
|
+
current = 0
|
|
47
|
+
percentile_value = None
|
|
48
|
+
r = p * (n - 1) + 1
|
|
49
|
+
ri = int(r)
|
|
50
|
+
rf = r - ri
|
|
51
|
+
val_ri = None
|
|
52
|
+
val_ri1 = None
|
|
53
|
+
for k, v in sorted(counter.items()):
|
|
54
|
+
if current + v >= ri and val_ri is None:
|
|
55
|
+
val_ri = k
|
|
56
|
+
if current + v >= ri + 1 and val_ri1 is None:
|
|
57
|
+
val_ri1 = k
|
|
58
|
+
current += v
|
|
59
|
+
if val_ri is not None and val_ri1 is not None:
|
|
60
|
+
percentile_value = val_ri + rf * (val_ri1 - val_ri)
|
|
61
|
+
break
|
|
62
|
+
if val_ri1 is None:
|
|
63
|
+
percentile_value = val_ri
|
|
64
|
+
assert percentile_value is not None
|
|
65
|
+
return percentile_value
|
|
66
|
+
|
|
67
|
+
@staticmethod
|
|
68
|
+
def find_rank(counter: Counter, value: float) -> float:
|
|
69
|
+
assert isinstance(counter, Counter)
|
|
70
|
+
assert isinstance(value, float)
|
|
71
|
+
current = 0
|
|
72
|
+
prev_k = None
|
|
73
|
+
current_k = None
|
|
74
|
+
n = sum(counter.values())
|
|
75
|
+
for k, v in sorted(counter.items()):
|
|
76
|
+
current_k = k
|
|
77
|
+
if k >= value:
|
|
78
|
+
break
|
|
79
|
+
prev_k = k
|
|
80
|
+
current += v
|
|
81
|
+
interpolation_factor = 0
|
|
82
|
+
if prev_k is None:
|
|
83
|
+
prev_k = current_k - 1
|
|
84
|
+
elif current_k == prev_k:
|
|
85
|
+
interpolation_factor = 0
|
|
86
|
+
else:
|
|
87
|
+
interpolation_factor = (value - prev_k) / (current_k - prev_k)
|
|
88
|
+
|
|
89
|
+
rank = current + interpolation_factor
|
|
90
|
+
return rank/n
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
@staticmethod
|
|
94
|
+
def mean(counter: Counter) -> float:
|
|
95
|
+
assert isinstance(counter, Counter)
|
|
96
|
+
current = 0
|
|
97
|
+
n = 0
|
|
98
|
+
for k, v in counter.items():
|
|
99
|
+
current += k * v
|
|
100
|
+
n += v
|
|
101
|
+
mean_value = current / n
|
|
102
|
+
return mean_value
|
|
103
|
+
|
|
104
|
+
@staticmethod
|
|
105
|
+
def median(counter: Counter) -> float:
|
|
106
|
+
return CounterUtils.percentile(counter, 0.5)
|
|
107
|
+
|
|
108
|
+
@staticmethod
|
|
109
|
+
def max(counter: Counter) -> float:
|
|
110
|
+
return max(counter)
|
|
111
|
+
|
|
112
|
+
@staticmethod
|
|
113
|
+
def min(counter: Counter) -> float:
|
|
114
|
+
return min(counter)
|
|
115
|
+
|
|
116
|
+
@staticmethod
|
|
117
|
+
def std(counter: Counter) -> float:
|
|
118
|
+
counter_squared = Counter()
|
|
119
|
+
for k, v in counter.items():
|
|
120
|
+
counter_squared[k*k] = v
|
|
121
|
+
return (CounterUtils.mean(counter_squared) - CounterUtils.mean(counter)**2)**0.5
|
|
122
|
+
|
|
123
|
+
@staticmethod
|
|
124
|
+
def get_stats(counter: Counter) -> Stats:
|
|
125
|
+
stats = Stats()
|
|
126
|
+
stats.avg = CounterUtils.mean(counter)
|
|
127
|
+
stats.min = CounterUtils.min(counter)
|
|
128
|
+
stats.max = CounterUtils.max(counter)
|
|
129
|
+
stats.std = CounterUtils.std(counter)
|
|
130
|
+
stats.median = CounterUtils.median(counter)
|
|
131
|
+
stats.count = sum(counter.values())
|
|
132
|
+
stats.quartiles[1] = CounterUtils.percentile(counter, 0.25)
|
|
133
|
+
stats.quartiles[2] = CounterUtils.percentile(counter, 0.5)
|
|
134
|
+
stats.quartiles[3] = CounterUtils.percentile(counter, 0.75)
|
|
135
|
+
for k in stats.percentile_with_sigmas:
|
|
136
|
+
stats.percentile_with_sigmas[k] = CounterUtils.find_rank(counter, stats.avg + k * stats.std)
|
|
137
|
+
return stats
|
|
138
|
+
|
|
139
|
+
if __name__ == "__main__":
|
|
140
|
+
data = [1, 1, 1, 1, 1, 2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
|
141
|
+
counter = Counter(data)
|
|
142
|
+
print(f"counter: {counter}")
|
|
143
|
+
print(f"percentile (0%): {CounterUtils.percentile(counter, 0.0)}")
|
|
144
|
+
print(f"percentile (25%): {CounterUtils.percentile(counter, 0.25)}")
|
|
145
|
+
print(f"percentile (50%): {CounterUtils.percentile(counter, 0.5)}")
|
|
146
|
+
print(f"percentile (75%): {CounterUtils.percentile(counter, 0.75)}")
|
|
147
|
+
mean = CounterUtils.mean(counter)
|
|
148
|
+
print(f"mean: {mean}")
|
|
149
|
+
print(f"median: {CounterUtils.median(counter)}")
|
|
150
|
+
print(f"max: {CounterUtils.max(counter)}")
|
|
151
|
+
print(f"min: {CounterUtils.min(counter)}")
|
|
152
|
+
std = CounterUtils.std(counter)
|
|
153
|
+
print(f"std: {std}")
|
|
154
|
+
print(f"find_rank (0): {CounterUtils.find_rank(counter, 0.0)}")
|
|
155
|
+
print(f"u + std: {mean + std}")
|
|
156
|
+
print(f"u - std: {mean - std}")
|
|
157
|
+
p_u_plus_std = CounterUtils.find_rank(counter, mean + std)
|
|
158
|
+
p_u_minus_std = CounterUtils.find_rank(counter, mean - std)
|
|
159
|
+
print(f"find_rank (u + std): {p_u_plus_std}")
|
|
160
|
+
print(f"find_rank (u - std): {p_u_minus_std}")
|
|
161
|
+
print(f"percentile (u + std): {CounterUtils.percentile(counter, p_u_plus_std)}")
|
|
162
|
+
print(f"percentile (u - std): {CounterUtils.percentile(counter, p_u_minus_std)}")
|
|
163
|
+
print(f"find_rank (u + 2 * std): {CounterUtils.find_rank(counter, mean + 2 * std)}")
|
|
164
|
+
print(f"find_rank (u - 2 * std): {CounterUtils.find_rank(counter, mean - 2 * std)}")
|
|
165
|
+
print(f"find_rank (u + 3 * std): {CounterUtils.find_rank(counter, mean + 3 * std)}")
|
|
166
|
+
print(f"find_rank (u - 3 * std): {CounterUtils.find_rank(counter, mean - 3 * std)}")
|
|
167
|
+
print(f"find_rank (10): {CounterUtils.find_rank(counter, 10.0)}")
|
|
168
|
+
print(f"find_rank (11): {CounterUtils.find_rank(counter, 11.0)}")
|
|
169
|
+
all_stats = CounterUtils.get_stats(counter)
|
|
170
|
+
print(f"all_stats: {all_stats}")
|
|
171
|
+
print(f"Serialized = \n{all_stats.to_json()}")
|
|
172
|
+
pass
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import random
|
|
2
|
+
import copy
|
|
3
|
+
|
|
4
|
+
def best_fit_packing(bin_sizes, item_sizes):
|
|
5
|
+
"""
|
|
6
|
+
Best fit algorithm for bin packing problem with no empty bins, modified to ensure
|
|
7
|
+
no non-zero capacity bin is left empty if possible. It minimizes the absolute difference
|
|
8
|
+
between the bin capacity and the packed items, without creating new bins.
|
|
9
|
+
:param bin_sizes: list of bin sizes (each bin's maximum capacity)
|
|
10
|
+
:param item_sizes: list of item sizes (sizes of items to be packed)
|
|
11
|
+
:returns: list of lists containing the items packed in each bin
|
|
12
|
+
"""
|
|
13
|
+
sorted_item_sizes_with_index = sorted(enumerate(item_sizes), key=lambda x: x[1], reverse=True)
|
|
14
|
+
bins = [[] for _ in range(len(bin_sizes))]
|
|
15
|
+
bin_remaining_capacity = copy.deepcopy(bin_sizes)
|
|
16
|
+
# Reduce the bin capacity a bit to ensure no empty bins
|
|
17
|
+
for i, size in enumerate(bin_remaining_capacity):
|
|
18
|
+
if size > 0:
|
|
19
|
+
bin_remaining_capacity[i] -= 1
|
|
20
|
+
bin_remaining_capacity = sorted(enumerate(bin_remaining_capacity), key=lambda x: x[1], reverse=True)
|
|
21
|
+
items_packed = set()
|
|
22
|
+
for item_index, item_size in sorted_item_sizes_with_index:
|
|
23
|
+
best_fit_index = -1
|
|
24
|
+
best_fit_remaining_capacity = float('inf')
|
|
25
|
+
sorted_bin_idx = -1
|
|
26
|
+
for _idx, (i, remaining_capacity) in enumerate(bin_remaining_capacity):
|
|
27
|
+
# don't consider bins with zero capacity
|
|
28
|
+
if bin_sizes[i] == 0:
|
|
29
|
+
continue
|
|
30
|
+
if remaining_capacity >= item_size and remaining_capacity - item_size < best_fit_remaining_capacity:
|
|
31
|
+
best_fit_index = i
|
|
32
|
+
sorted_bin_idx = _idx
|
|
33
|
+
best_fit_remaining_capacity = remaining_capacity - item_size
|
|
34
|
+
if best_fit_index != -1:
|
|
35
|
+
bins[best_fit_index].append(item_index)
|
|
36
|
+
bin_remaining_capacity[sorted_bin_idx] = (best_fit_index, best_fit_remaining_capacity)
|
|
37
|
+
items_packed.add(item_index)
|
|
38
|
+
bin_remaining_capacity = sorted(bin_remaining_capacity, key=lambda x: x[1], reverse=True)
|
|
39
|
+
# Randomly pack the remaining items in the bins
|
|
40
|
+
while len(items_packed) < len(item_sizes):
|
|
41
|
+
remaining_items = [i for i in range(len(item_sizes)) if i not in items_packed]
|
|
42
|
+
random.shuffle(remaining_items)
|
|
43
|
+
for idx, item_index in enumerate(remaining_items):
|
|
44
|
+
bin_idx = idx % len(bins)
|
|
45
|
+
if bin_sizes[bin_idx] == 0:
|
|
46
|
+
continue
|
|
47
|
+
bins[idx % len(bins)].append(item_index)
|
|
48
|
+
items_packed.add(item_index)
|
|
49
|
+
return bins
|
|
50
|
+
|
|
51
|
+
if __name__ == '__main__':
|
|
52
|
+
# Example usage
|
|
53
|
+
item_sizes = [0, 0, 0, 0, 0, 2, 5, 1, 0, 3, 2, 0, 1, 2, 23, 0, 0, 0, 25, 1, 0, 0, 0, 4, 0, 0, 10, 0, 1, 6, 4, 1, 3, 0, 0, 17, 0, 8, 0, 17, 0, 0, 0, 7, 0, 0, 4, 0, 0, 4, 0, 0, 0, 3, 1, 0, 0, 9, 0, 0, 15, 7, 9, 2, 1, 0, 10, 15, 2, 4, 0, 0, 0, 1, 0, 0, 9, 19, 3, 0, 0, 0, 0, 0, 20, 0, 6, 23, 0, 5, 11, 0, 0, 0, 13, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 6, 3, 0, 12, 1, 3, 2, 14, 6, 16, 4, 0, 0, 0, 1, 2, 12, 0, 31, 13, 0, 15, 16, 0, 0, 4, 1, 0, 0, 0, 1, 3, 2, 0, 7, 0, 0, 0, 0, 0, 1, 0, 0, 7, 1, 0, 0, 0, 0, 4, 0, 0, 2, 0, 0, 2, 5, 0, 0, 2, 0, 3, 1, 0, 0, 0, 8, 0, 1, 0, 0, 0, 5, 0, 0, 0, 0, 2, 38, 1, 0, 1, 1, 1, 0, 2, 28, 0, 0, 0, 1, 3, 0, 13, 1, 0, 1, 5, 1, 0, 0, 0, 0, 1, 6, 0, 10, 0, 2, 1, 1, 1, 4, 0, 7, 1, 2, 14, 0, 0, 2, 0]
|
|
54
|
+
print(f"Total items: {len(item_sizes)}")
|
|
55
|
+
sum_item_sizes = sum(item_sizes)
|
|
56
|
+
bin_sizes = [int(0.925 * sum_item_sizes), int(0.0375 * sum_item_sizes), int(0.0375 * sum_item_sizes)]
|
|
57
|
+
bins = best_fit_packing(bin_sizes, item_sizes)
|
|
58
|
+
for i, b in enumerate(bins):
|
|
59
|
+
items = [item_sizes[j] for j in b]
|
|
60
|
+
print(f'Bin {i + 1}: {items}, Total size: {sum(items)}, Remaining capacity: {bin_sizes[i] - sum(items)}, Bin size: {bin_sizes[i]}')
|
|
61
|
+
print(f"All items packed: {sum([len(b) for b in bins]) == len(item_sizes)}")
|
|
@@ -0,0 +1,93 @@
|
|
|
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 typing
|
|
8
|
+
from threading import Lock
|
|
9
|
+
|
|
10
|
+
class SimpleLruCache(object):
|
|
11
|
+
KiB = 2**10
|
|
12
|
+
MiB = 2**20
|
|
13
|
+
GiB = 2**30
|
|
14
|
+
def __init__(self, max_size_in_bytes: int = 100*MiB):
|
|
15
|
+
assert max_size_in_bytes is not None, "Max size in MiB cannot be None"
|
|
16
|
+
assert max_size_in_bytes > 0, "Max size in MiB must be greater than 0"
|
|
17
|
+
self.max_size_in_bytes = max_size_in_bytes
|
|
18
|
+
self.cache = {}
|
|
19
|
+
self.cache_order = []
|
|
20
|
+
self.cache_size_in_bytes = 0
|
|
21
|
+
self.mutex = Lock()
|
|
22
|
+
|
|
23
|
+
def add_to_cache(self, key: str, value: typing.Any, size_in_bytes: int) -> typing.List[str]:
|
|
24
|
+
assert key is not None, "File path cannot be None"
|
|
25
|
+
assert value is not None, "File contents cannot be None"
|
|
26
|
+
self.mutex.acquire()
|
|
27
|
+
removed_items = []
|
|
28
|
+
try:
|
|
29
|
+
self._try_remove_from_cache(key)
|
|
30
|
+
self.cache[key] = (value, size_in_bytes)
|
|
31
|
+
self.cache_order.append(key)
|
|
32
|
+
self.cache_size_in_bytes += size_in_bytes
|
|
33
|
+
while self.cache_size_in_bytes > self.max_size_in_bytes:
|
|
34
|
+
last_used_key = self.cache_order[0]
|
|
35
|
+
if self._try_remove_lru_key():
|
|
36
|
+
removed_items.append(last_used_key)
|
|
37
|
+
finally:
|
|
38
|
+
self.mutex.release()
|
|
39
|
+
return removed_items
|
|
40
|
+
|
|
41
|
+
def get_from_cache(self, key: str):
|
|
42
|
+
assert key is not None, "File path cannot be None"
|
|
43
|
+
self.mutex.acquire()
|
|
44
|
+
try:
|
|
45
|
+
if key in self.cache:
|
|
46
|
+
self.cache_order.remove(key)
|
|
47
|
+
self.cache_order.append(key)
|
|
48
|
+
value, _ = self.cache[key]
|
|
49
|
+
return value
|
|
50
|
+
return None
|
|
51
|
+
finally:
|
|
52
|
+
self.mutex.release()
|
|
53
|
+
|
|
54
|
+
def try_remove_from_cache(self, key: str) -> bool:
|
|
55
|
+
self.mutex.acquire()
|
|
56
|
+
try:
|
|
57
|
+
return self._try_remove_from_cache(key)
|
|
58
|
+
finally:
|
|
59
|
+
self.mutex.release()
|
|
60
|
+
|
|
61
|
+
def clear_cache(self):
|
|
62
|
+
self.mutex.acquire()
|
|
63
|
+
try:
|
|
64
|
+
while self._try_remove_lru_key():
|
|
65
|
+
pass
|
|
66
|
+
finally:
|
|
67
|
+
self.mutex.release()
|
|
68
|
+
|
|
69
|
+
# define in operator
|
|
70
|
+
def __contains__(self, key: str):
|
|
71
|
+
self.mutex.acquire()
|
|
72
|
+
try:
|
|
73
|
+
return key in self.cache
|
|
74
|
+
finally:
|
|
75
|
+
self.mutex.release()
|
|
76
|
+
|
|
77
|
+
# unsafe method
|
|
78
|
+
def _try_remove_lru_key(self) -> bool:
|
|
79
|
+
if len(self.cache_order) > 0:
|
|
80
|
+
self._try_remove_from_cache(self.cache_order[0])
|
|
81
|
+
return True
|
|
82
|
+
return False
|
|
83
|
+
|
|
84
|
+
# unsafe method
|
|
85
|
+
def _try_remove_from_cache(self, key: str) -> bool:
|
|
86
|
+
assert key is not None, "File path cannot be None"
|
|
87
|
+
if key in self.cache:
|
|
88
|
+
val, size = self.cache.pop(key)
|
|
89
|
+
self.cache_size_in_bytes -= size
|
|
90
|
+
self.cache_order.remove(key)
|
|
91
|
+
del val
|
|
92
|
+
return True
|
|
93
|
+
return False
|
|
@@ -0,0 +1,31 @@
|
|
|
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 typing
|
|
8
|
+
import argparse
|
|
9
|
+
from dataclasses_json import dataclass_json
|
|
10
|
+
from dataclasses import dataclass, field
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@dataclass_json
|
|
14
|
+
@dataclass
|
|
15
|
+
class CoqBuildSpec:
|
|
16
|
+
project_name: str
|
|
17
|
+
train_files: typing.List[str] = field(default_factory=list)
|
|
18
|
+
test_files: typing.List[str] = field(default_factory=list)
|
|
19
|
+
build_partition: typing.Optional[str] = None
|
|
20
|
+
build_command: typing.Optional[str] = None
|
|
21
|
+
timeout : typing.Optional[int] = None
|
|
22
|
+
switch: typing.Optional[str] = None
|
|
23
|
+
|
|
24
|
+
if __name__ == "__main__":
|
|
25
|
+
# take the project split as argument
|
|
26
|
+
parser = argparse.ArgumentParser()
|
|
27
|
+
parser.add_argument("--project_split", type=str, required=False, default="data/proverbot9001/coqgym_projs_splits.json", help="path to the project split")
|
|
28
|
+
args = parser.parse_args()
|
|
29
|
+
with open(args.project_split, "r") as f:
|
|
30
|
+
project_splits = CoqBuildSpec.schema().loads(f.read(), many=True)
|
|
31
|
+
print(project_splits)
|