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,599 @@
|
|
|
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 copy
|
|
8
|
+
import os
|
|
9
|
+
import jsonlines
|
|
10
|
+
import typing
|
|
11
|
+
import logging
|
|
12
|
+
from dataclasses import dataclass, field
|
|
13
|
+
from dataclasses_json import dataclass_json
|
|
14
|
+
from collections import OrderedDict
|
|
15
|
+
from typing import List, Optional, Tuple
|
|
16
|
+
|
|
17
|
+
class MergableCollection(object):
|
|
18
|
+
def merge(self, __o: object):
|
|
19
|
+
raise NotImplementedError("merge must be implemented by the child class")
|
|
20
|
+
|
|
21
|
+
def undo_merge(self, size: int = 1, start_idx = 0) -> object:
|
|
22
|
+
raise NotImplementedError("undo_merge must be implemented by the child class")
|
|
23
|
+
|
|
24
|
+
def __len__(self) -> int:
|
|
25
|
+
raise NotImplementedError("__len__ must be implemented by the child class")
|
|
26
|
+
|
|
27
|
+
@dataclass_json
|
|
28
|
+
@dataclass
|
|
29
|
+
class LemmaRefWithScore(object):
|
|
30
|
+
"""Class to store the lemma reference with score."""
|
|
31
|
+
lemma_idx: int
|
|
32
|
+
score: float
|
|
33
|
+
pass
|
|
34
|
+
|
|
35
|
+
@dataclass_json
|
|
36
|
+
@dataclass
|
|
37
|
+
class Goal(object):
|
|
38
|
+
"""Class to store the goal."""
|
|
39
|
+
hypotheses: List[str] = field(default_factory=list) # The list of hypothesis for the goal.
|
|
40
|
+
goal: Optional[str] = None
|
|
41
|
+
relevant_defns: List[LemmaRefWithScore] = field(default_factory=list) # The list of relevant definitions.
|
|
42
|
+
used_theorems_local: List[LemmaRefWithScore] = field(default_factory=list) # The list of useful theorems.
|
|
43
|
+
used_theorems_external: List[LemmaRefWithScore] = field(default_factory=list) # The list of useful theorems.
|
|
44
|
+
possible_useful_theorems_external: List[LemmaRefWithScore] = field(default_factory=list) # The list of possible useful theorems.
|
|
45
|
+
possible_useful_theorems_local: List[LemmaRefWithScore] = field(default_factory=list) # The list of possible useful theorems.
|
|
46
|
+
|
|
47
|
+
def __eq__(self, __o: object) -> bool:
|
|
48
|
+
if not isinstance(__o, Goal):
|
|
49
|
+
return False
|
|
50
|
+
if self.goal != __o.goal:
|
|
51
|
+
return False
|
|
52
|
+
hyp1_set = set(self.hypotheses)
|
|
53
|
+
hyp2_set = set(__o.hypotheses)
|
|
54
|
+
return hyp1_set.difference(hyp2_set) == set() and hyp2_set.difference(hyp1_set) == set() and len(self.hypotheses) == len(__o.hypotheses)
|
|
55
|
+
|
|
56
|
+
def __le__(self, __o: object) -> bool:
|
|
57
|
+
# To goal 'a' is less (hard) than goal 'b' iff all hypotheses of 'b' are also hypotheses of 'a'
|
|
58
|
+
if not isinstance(__o, Goal):
|
|
59
|
+
raise TypeError(f"Cannot compare Goal with {type(__o)}")
|
|
60
|
+
if self.goal != __o.goal:
|
|
61
|
+
raise ValueError(f"Cannot compare goals with different goals: {self.goal} != {__o.goal}")
|
|
62
|
+
set_a = set(self.hypotheses)
|
|
63
|
+
set_b = set(__o.hypotheses)
|
|
64
|
+
b_is_subset_of_a = set_b.issubset(set_a)
|
|
65
|
+
return b_is_subset_of_a
|
|
66
|
+
|
|
67
|
+
def __ge__(self, __o: object) -> bool:
|
|
68
|
+
# To goal 'a' is more (hard) than goal 'b' iff all hypotheses of 'a' are also hypotheses of 'b'
|
|
69
|
+
if not isinstance(__o, Goal):
|
|
70
|
+
raise TypeError(f"Cannot compare Goal with {type(__o)}")
|
|
71
|
+
if self.goal != __o.goal:
|
|
72
|
+
raise ValueError(f"Cannot compare goals with different goals: {self.goal} != {__o.goal}")
|
|
73
|
+
set_a = set(self.hypotheses)
|
|
74
|
+
set_b = set(__o.hypotheses)
|
|
75
|
+
a_is_subset_of_b = set_a.issubset(set_b)
|
|
76
|
+
return a_is_subset_of_b
|
|
77
|
+
|
|
78
|
+
def __lt__(self, __o: object) -> bool:
|
|
79
|
+
return self != __o and self <= __o
|
|
80
|
+
|
|
81
|
+
def __gt__(self, __o: object) -> bool:
|
|
82
|
+
return self != __o and self >= __o
|
|
83
|
+
|
|
84
|
+
@staticmethod
|
|
85
|
+
def load_from_file(file_path: str):
|
|
86
|
+
assert os.path.exists(file_path), "file_path must be a valid path to a file"
|
|
87
|
+
json_text = None
|
|
88
|
+
with open(file_path, "r") as f:
|
|
89
|
+
json_text = f.read()
|
|
90
|
+
return Goal.load_from_string(json_text)
|
|
91
|
+
|
|
92
|
+
@staticmethod
|
|
93
|
+
def load_from_string(json_text: str):
|
|
94
|
+
assert json_text is not None, "json_text cannot be None"
|
|
95
|
+
return Goal.schema().loads(json_text)
|
|
96
|
+
|
|
97
|
+
@dataclass_json
|
|
98
|
+
@dataclass
|
|
99
|
+
class LemmaReferences(object):
|
|
100
|
+
"""Class to store the lemma references."""
|
|
101
|
+
lemma_idx: int
|
|
102
|
+
lemma_name: str
|
|
103
|
+
lemma_defn: str
|
|
104
|
+
ref_count: int = 0
|
|
105
|
+
|
|
106
|
+
def __eq__(self, __o: object) -> bool:
|
|
107
|
+
if not isinstance(__o, LemmaReferences):
|
|
108
|
+
return False
|
|
109
|
+
return self.lemma_name == __o.lemma_name and self.lemma_defn == __o.lemma_defn
|
|
110
|
+
|
|
111
|
+
def __hash__(self) -> int:
|
|
112
|
+
return hash((self.lemma_name, self.lemma_defn))
|
|
113
|
+
|
|
114
|
+
def __str__(self) -> str:
|
|
115
|
+
return f"{self.lemma_name} : {self.lemma_defn}"
|
|
116
|
+
# return f"{self.lemma_defn} : {self.lemma_name}"
|
|
117
|
+
|
|
118
|
+
def clone(self, idx : typing.Optional[int] = None):
|
|
119
|
+
new_copy = copy.deepcopy(self)
|
|
120
|
+
if idx is not None:
|
|
121
|
+
new_copy.lemma_idx = idx
|
|
122
|
+
return new_copy
|
|
123
|
+
|
|
124
|
+
@dataclass_json
|
|
125
|
+
@dataclass
|
|
126
|
+
class LemmaReferencesCollection(MergableCollection):
|
|
127
|
+
"""Class to store the lemma references."""
|
|
128
|
+
lemma_references: typing.List[LemmaReferences] = field(default_factory=list)
|
|
129
|
+
|
|
130
|
+
def __post_init__(self):
|
|
131
|
+
self._lemma_ref_to_idx = {lemma_ref: idx for idx, lemma_ref in enumerate(self.lemma_references)}
|
|
132
|
+
|
|
133
|
+
def merge(self, __o: object):
|
|
134
|
+
"""
|
|
135
|
+
Merge the lemma references with another lemma references collection.
|
|
136
|
+
Returns the merged lemma references collection index map.
|
|
137
|
+
"""
|
|
138
|
+
if not isinstance(__o, LemmaReferencesCollection) and not isinstance(__o, LemmaReferences) and not isinstance(__o, list):
|
|
139
|
+
raise TypeError(f"Cannot merge LemmaReferenceCollection with {type(__o)}")
|
|
140
|
+
if isinstance(__o, list) and not all(isinstance(x, LemmaReferences) for x in __o):
|
|
141
|
+
raise TypeError(f"Cannot merge LemmaReferenceCollection with list of {type(__o)}")
|
|
142
|
+
if isinstance(__o, LemmaReferences):
|
|
143
|
+
__o = [__o]
|
|
144
|
+
elif isinstance(__o, LemmaReferencesCollection):
|
|
145
|
+
__o = __o.lemma_references
|
|
146
|
+
to_take_cnt = len(__o)
|
|
147
|
+
new_idx_map = [-1] * to_take_cnt
|
|
148
|
+
for idx in range(to_take_cnt):
|
|
149
|
+
lemma_ref = __o[idx]
|
|
150
|
+
assert 0 <= lemma_ref.lemma_idx < len(__o), f"lemma_idx must be in range [0, {len(__o)}"
|
|
151
|
+
if lemma_ref not in self._lemma_ref_to_idx:
|
|
152
|
+
self._lemma_ref_to_idx[lemma_ref] = len(self.lemma_references)
|
|
153
|
+
lemma_ref_copy = copy.deepcopy(lemma_ref)
|
|
154
|
+
lemma_ref_copy.lemma_idx = len(self.lemma_references)
|
|
155
|
+
self.lemma_references.append(lemma_ref_copy)
|
|
156
|
+
new_idx_map[idx] = lemma_ref_copy.lemma_idx
|
|
157
|
+
else:
|
|
158
|
+
lemma_idx = self._lemma_ref_to_idx[lemma_ref]
|
|
159
|
+
new_idx_map[idx] = lemma_idx
|
|
160
|
+
self.lemma_references[lemma_idx].ref_count += lemma_ref.ref_count
|
|
161
|
+
assert all(idx != -1 for idx in new_idx_map), "new_idx_map must not contain any -1 values"
|
|
162
|
+
return new_idx_map
|
|
163
|
+
|
|
164
|
+
def __len__(self) -> int:
|
|
165
|
+
return len(self.lemma_references)
|
|
166
|
+
|
|
167
|
+
def __iter__(self):
|
|
168
|
+
return iter(self.lemma_references)
|
|
169
|
+
|
|
170
|
+
def __getitem__(self, idx: int) -> LemmaReferences:
|
|
171
|
+
return self.lemma_references[idx]
|
|
172
|
+
|
|
173
|
+
@staticmethod
|
|
174
|
+
def load_from_file(file_path: str, logger: logging.Logger = None):
|
|
175
|
+
assert os.path.exists(file_path), f"file_path:{file_path} must be a valid path to a file"
|
|
176
|
+
json_text = None
|
|
177
|
+
if logger is not None:
|
|
178
|
+
logger.info(f"Loading json data from {file_path}")
|
|
179
|
+
with open(file_path, "r") as f:
|
|
180
|
+
json_text = f.read()
|
|
181
|
+
if logger is not None:
|
|
182
|
+
logger.info(f"Loaded json data from {file_path}")
|
|
183
|
+
return LemmaReferencesCollection.load_from_string(json_text, logger)
|
|
184
|
+
|
|
185
|
+
@staticmethod
|
|
186
|
+
def load_from_string(json_text: str, logger: logging.Logger = None):
|
|
187
|
+
assert json_text is not None, "json_text cannot be None"
|
|
188
|
+
if logger is not None:
|
|
189
|
+
logger.info(f"Deseiralizing json data from string of length {len(json_text)} characters")
|
|
190
|
+
deserialized = LemmaReferencesCollection.schema().loads(json_text)
|
|
191
|
+
if logger is not None:
|
|
192
|
+
logger.info(f"Deseiralized json data from string of length {len(json_text)} characters")
|
|
193
|
+
return deserialized
|
|
194
|
+
|
|
195
|
+
@dataclass_json
|
|
196
|
+
@dataclass
|
|
197
|
+
class TrainingDataFormat(object):
|
|
198
|
+
"""Class to format the training data for coq based automatic theorem provers.
|
|
199
|
+
This class is responsible for formatting the training data for coq based automatic theorem provers.
|
|
200
|
+
"""
|
|
201
|
+
proof_id : Optional[str] = None # The id of the proof which helps locating the proof in the original file.
|
|
202
|
+
all_useful_defns_theorems : List[LemmaReferences] = field(default_factory=list) # The list of all useful definitions.
|
|
203
|
+
goal_description: Optional[str] = None # The description of the goal.
|
|
204
|
+
start_goals: List[Goal] = field(default_factory=list) # The goal to start with.
|
|
205
|
+
end_goals: List[Goal] = field(default_factory=list) # The goal to end with.
|
|
206
|
+
proof_steps: List[str] = field(default_factory=list) # The list of proof steps to get from the start goal to the end goal.
|
|
207
|
+
simplified_goals: List[Goal] = field(default_factory=list) # A possible list of simplified theorem or lemma to prove.
|
|
208
|
+
addition_state_info: dict = field(default_factory=dict) # Custom key-value pairs for additional information.
|
|
209
|
+
file_path: Optional[str] = None # The path of the file which contains the proof.
|
|
210
|
+
project_id: Optional[str] = None # The url of the repository which contains the proof.
|
|
211
|
+
theorem_name: Optional[str] = None # The name of the theorem.
|
|
212
|
+
|
|
213
|
+
def __eq__(self, __o: object) -> bool:
|
|
214
|
+
if not isinstance(__o, TrainingDataFormat):
|
|
215
|
+
return False
|
|
216
|
+
goal_set_a = set([goal.goal for goal in self.start_goals])
|
|
217
|
+
goal_set_b = set([goal.goal for goal in __o.start_goals])
|
|
218
|
+
if goal_set_a.difference(goal_set_b) != set() or goal_set_b.difference(goal_set_a) != set():
|
|
219
|
+
return False
|
|
220
|
+
goals_a = OrderedDict()
|
|
221
|
+
goals_b = OrderedDict()
|
|
222
|
+
for goal in self.start_goals:
|
|
223
|
+
if goal.goal not in goals_a:
|
|
224
|
+
goals_a[goal.goal] = [goal]
|
|
225
|
+
else:
|
|
226
|
+
goals_a[goal.goal].append(goal)
|
|
227
|
+
goals_b[goal.goal] = []
|
|
228
|
+
|
|
229
|
+
for goal in __o.start_goals:
|
|
230
|
+
if goal.goal in goals_b:
|
|
231
|
+
goals_b[goal.goal].append(goal)
|
|
232
|
+
|
|
233
|
+
# Assert that goal_a keys are exactly the same as goal_b keys
|
|
234
|
+
assert set(goals_a.keys()) == set(goals_b.keys()), "keys of goals_a and goals_b must be exactly the same"
|
|
235
|
+
|
|
236
|
+
for key in goals_a:
|
|
237
|
+
if len(goals_a[key]) != len(goals_b[key]):
|
|
238
|
+
return False
|
|
239
|
+
for g_a in goals_a[key]:
|
|
240
|
+
if g_a not in goals_b[key]:
|
|
241
|
+
return False
|
|
242
|
+
for g_b in goals_b[key]:
|
|
243
|
+
if g_b not in goals_a[key]:
|
|
244
|
+
return False
|
|
245
|
+
return True
|
|
246
|
+
|
|
247
|
+
# # Create new goals with combined hypotheses
|
|
248
|
+
# goals_a = [Goal(list([h for goal in value for h in goal.hypotheses]), key) for key, value in goals_a.items()]
|
|
249
|
+
# goals_b = [Goal(list([h for goal in value for h in goal.hypotheses]), key) for key, value in goals_b.items()]
|
|
250
|
+
# return all([goal_a == goal_b for goal_a, goal_b in zip(goals_a, goals_b)])
|
|
251
|
+
|
|
252
|
+
def __le__(self, __o: object) -> bool:
|
|
253
|
+
# TrainingDataFormat 'a' is less (hard) than TrainingDataFormat 'b' iff all goals in 'a' are subset of goals in 'b'
|
|
254
|
+
if not isinstance(__o, TrainingDataFormat):
|
|
255
|
+
raise TypeError(f"Cannot compare TrainingDataFormat with {type(__o)}")
|
|
256
|
+
goal_set_a = set([goal.goal for goal in self.start_goals])
|
|
257
|
+
goal_set_b = set([goal.goal for goal in __o.start_goals])
|
|
258
|
+
a_is_subset_of_b = goal_set_a <= goal_set_b
|
|
259
|
+
if not a_is_subset_of_b:
|
|
260
|
+
return False
|
|
261
|
+
else:
|
|
262
|
+
# Go over all subset goals
|
|
263
|
+
# Check if each goal is as hard as the goal in __o
|
|
264
|
+
# Combine all hypotheses for same goal
|
|
265
|
+
goals_a = OrderedDict()
|
|
266
|
+
goals_b = OrderedDict()
|
|
267
|
+
for goal in self.start_goals:
|
|
268
|
+
if goal.goal not in goals_a:
|
|
269
|
+
goals_a[goal.goal] = [goal]
|
|
270
|
+
else:
|
|
271
|
+
goals_a[goal.goal].append(goal)
|
|
272
|
+
goals_b[goal.goal] = []
|
|
273
|
+
|
|
274
|
+
for goal in __o.start_goals:
|
|
275
|
+
if goal.goal in goals_b:
|
|
276
|
+
goals_b[goal.goal].append(goal)
|
|
277
|
+
|
|
278
|
+
for key in goals_a:
|
|
279
|
+
# Clearly goals in a are present in goals in b
|
|
280
|
+
if len(goals_a[key]) > len(goals_b[key]):
|
|
281
|
+
return False
|
|
282
|
+
# For all the goals in a which are matching b goals
|
|
283
|
+
# The number of such goals in a is always less than that of b
|
|
284
|
+
# So b is harder as we have more goals to prove
|
|
285
|
+
for key in goals_a:
|
|
286
|
+
for g_a in goals_a[key]:
|
|
287
|
+
for g_b in goals_b[key]:
|
|
288
|
+
a_is_strictly_harder_than_b = g_a > g_b and g_b < g_a # g_a > g_b is not same as g_b < g_a as because it is not a total order and the goals can be incomparable
|
|
289
|
+
a_is_not_comparable_to_b = (not g_a > g_b) and (not g_b < g_a)
|
|
290
|
+
if a_is_not_comparable_to_b or a_is_strictly_harder_than_b:
|
|
291
|
+
return False
|
|
292
|
+
return True
|
|
293
|
+
# for key in goals_a:
|
|
294
|
+
# for g_a in goals_a[key]:
|
|
295
|
+
# if g_a not in goals_b[key]:
|
|
296
|
+
# return False
|
|
297
|
+
# for g_b in goals_b[key]:
|
|
298
|
+
# if g_b not in goals_a[key]:
|
|
299
|
+
# return False
|
|
300
|
+
|
|
301
|
+
# # Create new goals with combined hypotheses
|
|
302
|
+
# goals_a = [Goal(list([h for goal in value for h in goal.hypotheses]), key) for key, value in goals_a.items()]
|
|
303
|
+
# goals_b = [Goal(list([h for goal in value for h in goal.hypotheses]), key) for key, value in goals_b.items()]
|
|
304
|
+
|
|
305
|
+
# a_less_harder_than_b = all([g_a <= g_b for g_a, g_b in zip(goals_a, goals_b)])
|
|
306
|
+
# return a_less_harder_than_b
|
|
307
|
+
|
|
308
|
+
def __ge__(self, __o: object) -> bool:
|
|
309
|
+
# TrainingDataFormat 'a' is more (hard) than TrainingDataFormat 'b' iff all goals in 'b' are subset of goals in 'a'
|
|
310
|
+
if not isinstance(__o, TrainingDataFormat):
|
|
311
|
+
raise TypeError(f"Cannot compare TrainingDataFormat with {type(__o)}")
|
|
312
|
+
goal_set_a = set([goal.goal for goal in self.start_goals])
|
|
313
|
+
goal_set_b = set([goal.goal for goal in __o.start_goals])
|
|
314
|
+
b_is_subset_of_a = goal_set_b <= goal_set_a
|
|
315
|
+
if not b_is_subset_of_a:
|
|
316
|
+
return False
|
|
317
|
+
else:
|
|
318
|
+
# Go over all subset goals
|
|
319
|
+
# Check if each goal is as hard as the goal in __o
|
|
320
|
+
goals_a = OrderedDict()
|
|
321
|
+
goals_b = OrderedDict()
|
|
322
|
+
for goal in self.start_goals:
|
|
323
|
+
if goal.goal not in goals_a:
|
|
324
|
+
goals_a[goal.goal] = [goal]
|
|
325
|
+
else:
|
|
326
|
+
goals_a[goal.goal].append(goal)
|
|
327
|
+
goals_b[goal.goal] = []
|
|
328
|
+
|
|
329
|
+
for goal in __o.start_goals:
|
|
330
|
+
if goal.goal in goals_b:
|
|
331
|
+
goals_b[goal.goal].append(goal)
|
|
332
|
+
|
|
333
|
+
for key in goals_b:
|
|
334
|
+
# Clearly goals in a are present in goals in b
|
|
335
|
+
if len(goals_a[key]) < len(goals_b[key]):
|
|
336
|
+
return False
|
|
337
|
+
# For all the goals in a which are matching b goals
|
|
338
|
+
# The number of such goals in a is always less than that of b
|
|
339
|
+
# So b is harder as we have more goals to prove
|
|
340
|
+
for key in goals_b:
|
|
341
|
+
for g_b in goals_b[key]:
|
|
342
|
+
for g_a in goals_a[key]:
|
|
343
|
+
b_is_strictly_harder_than_a = g_a < g_b and g_b > g_a # g_a < g_b is not same as g_b > g_a as because it is not a total order and the goals can be incomparable
|
|
344
|
+
b_is_not_comparable_to_a = (not g_a < g_b) and (not g_b > g_a)
|
|
345
|
+
if b_is_not_comparable_to_a or b_is_strictly_harder_than_a:
|
|
346
|
+
return False
|
|
347
|
+
return True
|
|
348
|
+
|
|
349
|
+
# goals_a = [Goal(list([h for goal in value for h in goal.hypotheses]), key) for key, value in goals_a.items()]
|
|
350
|
+
# goals_b = [Goal(list([h for goal in value for h in goal.hypotheses]), key) for key, value in goals_b.items()]
|
|
351
|
+
|
|
352
|
+
# b_less_harder_than_a = all([g_a >= g_b for g_a, g_b in zip(goals_a, goals_b)])
|
|
353
|
+
# return b_less_harder_than_a
|
|
354
|
+
|
|
355
|
+
def __lt__(self, __o: object) -> bool:
|
|
356
|
+
return self != __o and self <= __o
|
|
357
|
+
|
|
358
|
+
def __gt__(self, __o: object) -> bool:
|
|
359
|
+
return self != __o and self >= __o
|
|
360
|
+
|
|
361
|
+
def __hash__(self) -> int:
|
|
362
|
+
goal_set = list(set([goal.goal for goal in self.start_goals]))
|
|
363
|
+
goal_set.sort()
|
|
364
|
+
return hash(tuple(goal_set))
|
|
365
|
+
|
|
366
|
+
def have_same_proof_steps(self, __o: object) -> bool:
|
|
367
|
+
if not isinstance(__o, TrainingDataFormat):
|
|
368
|
+
raise TypeError(f"Cannot compare TrainingDataFormat with {type(__o)}")
|
|
369
|
+
return len(self.proof_steps) == len(__o.proof_steps) and all([p_a == p_b for p_a, p_b in zip(self.proof_steps, __o.proof_steps)])
|
|
370
|
+
|
|
371
|
+
def get_human_readable_serialized_goal(self, idx: int, skip_special_tokens: bool = False):
|
|
372
|
+
assert idx >= 0 and idx < len(self.start_goals), f"idx must be in range [0, {len(self.start_goals)})"
|
|
373
|
+
hyps = "\n".join(self.start_goals[idx].hypotheses)
|
|
374
|
+
return f"""{f"Goal {idx + 1}:" if not skip_special_tokens else ""}
|
|
375
|
+
{self.start_goals[idx].goal}
|
|
376
|
+
{f"Hyps {idx + 1}:" if not skip_special_tokens else ""}
|
|
377
|
+
{hyps}
|
|
378
|
+
"""
|
|
379
|
+
|
|
380
|
+
@staticmethod
|
|
381
|
+
def load_from_file(file_path: str):
|
|
382
|
+
assert os.path.exists(file_path), "file_path must be a valid path to a file"
|
|
383
|
+
json_text = None
|
|
384
|
+
with open(file_path, "r") as f:
|
|
385
|
+
json_text = f.read()
|
|
386
|
+
return TrainingDataFormat.load_from_string(json_text)
|
|
387
|
+
|
|
388
|
+
@staticmethod
|
|
389
|
+
def load_from_string(json_text: str):
|
|
390
|
+
assert json_text is not None, "json_text cannot be None"
|
|
391
|
+
return TrainingDataFormat.schema().loads(json_text)
|
|
392
|
+
|
|
393
|
+
@dataclass_json
|
|
394
|
+
@dataclass
|
|
395
|
+
class TrainingDataCollection(MergableCollection):
|
|
396
|
+
training_data: List[TrainingDataFormat] = field(default_factory=list) # The list of training data.
|
|
397
|
+
|
|
398
|
+
@staticmethod
|
|
399
|
+
def load_from_file(file_path: str, logger: logging.Logger = None):
|
|
400
|
+
assert os.path.exists(file_path), f"file_path: {file_path} must be a valid path to a file"
|
|
401
|
+
json_text = None
|
|
402
|
+
if logger is not None:
|
|
403
|
+
logger.info(f"Loading json data from {file_path}")
|
|
404
|
+
with open(file_path, "r") as f:
|
|
405
|
+
json_text = f.read()
|
|
406
|
+
if logger is not None:
|
|
407
|
+
logger.info(f"Loaded json data from {file_path}")
|
|
408
|
+
return TrainingDataCollection.load_from_string(json_text, logger)
|
|
409
|
+
|
|
410
|
+
@staticmethod
|
|
411
|
+
def load_from_string(json_text: str, logger: logging.Logger = None):
|
|
412
|
+
assert json_text is not None, "json_text cannot be None"
|
|
413
|
+
if logger is not None:
|
|
414
|
+
logger.info(f"Deseiralizing json data from string of length {len(json_text)} characters")
|
|
415
|
+
deserialized = TrainingDataCollection.schema().loads(json_text)
|
|
416
|
+
if logger is not None:
|
|
417
|
+
logger.info(f"Deseiralized json data from string of length {len(json_text)} characters")
|
|
418
|
+
return deserialized
|
|
419
|
+
|
|
420
|
+
def __len__(self) -> int:
|
|
421
|
+
return len(self.training_data)
|
|
422
|
+
|
|
423
|
+
@dataclass_json
|
|
424
|
+
@dataclass
|
|
425
|
+
class TrainingDataMetadataFormat(MergableCollection):
|
|
426
|
+
"""Class to store the training data metadata.
|
|
427
|
+
|
|
428
|
+
This class is responsible for storing the training data metadata.
|
|
429
|
+
"""
|
|
430
|
+
training_data_buffer_size: int = 10000
|
|
431
|
+
last_training_data: int = 0
|
|
432
|
+
last_proof_id: Optional[str] = None
|
|
433
|
+
external_theorems_used_cnt: int = 0
|
|
434
|
+
local_theorems_used_cnt: int = 0
|
|
435
|
+
total_proof_step_cnt: int = 0
|
|
436
|
+
data_filename_prefix: str = "full_data"
|
|
437
|
+
data_filename_suffix: str = ".json"
|
|
438
|
+
lemma_ref_filename_prefix: str = "full_data_lemma_ref"
|
|
439
|
+
lemma_ref_filename_suffix: str = ".json"
|
|
440
|
+
num_theorems: int = 0
|
|
441
|
+
|
|
442
|
+
def merge(self, __o: object):
|
|
443
|
+
if not isinstance(__o, TrainingDataMetadataFormat):
|
|
444
|
+
raise TypeError(f"Cannot merge TrainingDataMetadata with {type(__o)}")
|
|
445
|
+
self.training_data_buffer_size = max(__o.training_data_buffer_size, self.training_data_buffer_size)
|
|
446
|
+
self.last_training_data = __o.last_training_data
|
|
447
|
+
self.last_proof_id = __o.last_proof_id
|
|
448
|
+
self.total_proof_step_cnt += __o.total_proof_step_cnt
|
|
449
|
+
self.external_theorems_used_cnt += __o.external_theorems_used_cnt
|
|
450
|
+
self.local_theorems_used_cnt += __o.local_theorems_used_cnt
|
|
451
|
+
self.num_theorems += __o.num_theorems
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
def __len__(self) -> int:
|
|
455
|
+
return 0
|
|
456
|
+
|
|
457
|
+
@staticmethod
|
|
458
|
+
def load_from_file(file_path: str):
|
|
459
|
+
assert os.path.exists(file_path), "file_path must be a valid path to a file"
|
|
460
|
+
json_text = None
|
|
461
|
+
with open(file_path, "r") as f:
|
|
462
|
+
json_text = f.read()
|
|
463
|
+
return TrainingDataMetadataFormat.load_from_string(json_text)
|
|
464
|
+
|
|
465
|
+
@staticmethod
|
|
466
|
+
def load_from_string(json_text: str):
|
|
467
|
+
assert json_text is not None, "json_text cannot be None"
|
|
468
|
+
return TrainingDataMetadataFormat.schema().loads(json_text)
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
class TrainingDataFormatLayout(object):
|
|
472
|
+
def __init__(self, with_labels: bool = False):
|
|
473
|
+
self.with_labels = with_labels
|
|
474
|
+
pass
|
|
475
|
+
|
|
476
|
+
def get_layout_format_name(self) -> str:
|
|
477
|
+
raise NotImplementedError("get_layout_format_name must be implemented in derived classes")
|
|
478
|
+
|
|
479
|
+
def layout_training_data(self, training_data_format: TrainingDataFormat) -> typing.Union[str, typing.Tuple[str, str]]:
|
|
480
|
+
raise NotImplementedError("get_formatted_training_data must be implemented in derived classes")
|
|
481
|
+
|
|
482
|
+
def get_training_data_from_layout(self, formatted_training_data: str) -> TrainingDataFormat:
|
|
483
|
+
raise NotImplementedError("get_training_data_format must be implemented in derived classes")
|
|
484
|
+
|
|
485
|
+
if __name__ == "__main__":
|
|
486
|
+
# Test the training data collection
|
|
487
|
+
training_data_format1 = TrainingDataFormat(
|
|
488
|
+
proof_id="proof_id",
|
|
489
|
+
start_goals=[
|
|
490
|
+
Goal(hypotheses=[], goal="forall e : expr, size (constant_fold e) <= size e"),
|
|
491
|
+
Goal(hypotheses=['e : expr'], goal="size (constant_fold e) <= size e"),
|
|
492
|
+
Goal(hypotheses=['v : var'], goal="1 <= 1"),
|
|
493
|
+
Goal(hypotheses=['n : nat'], goal="1 <= 1"),
|
|
494
|
+
Goal(hypotheses=['m : var_map', 'IHe2 : forall m : var_map, eval_expr e2 m = eval_expr (constant_fold e2) m', 'IHe1 : forall m : var_map, eval_expr e1 m = eval_expr (constant_fold e1) m', 'e1,e2 : expr'], goal='eval_expr e1 m + eval_expr e2 m =\neval_expr\n match constant_fold e1 with\n | Const (0 as n1) =>\n match constant_fold e2 with\n | Const n2 => Const (n1 + n2)\n | _ => constant_fold e2\n end\n | Const (S _ as n1) =>\n match constant_fold e2 with\n | Const n2 => Const (n1 + n2)\n | _ => Plus (constant_fold e1) (constant_fold e2)\n end\n | _ =>\n match constant_fold e2 with\n | Const 0 => constant_fold e1\n | _ => Plus (constant_fold e1) (constant_fold e2)\n end\n end m'),
|
|
495
|
+
Goal(hypotheses=['m : var_map', 'IHe2 : forall m : var_map, eval_expr e2 m = eval_expr (constant_fold e2) m', 'IHe1 : forall m : var_map, eval_expr e1 m = eval_expr (constant_fold e1) m', 'e1,e2 : expr'], goal='eval_expr e1 m + eval_expr e2 m =\neval_expr\n match constant_fold e1 with\n | Const (0 as n1) =>\n match constant_fold e2 with\n | Const n2 => Const (n1 + n2)\n | _ => constant_fold e2\n end\n | Const (S _ as n1) =>\n match constant_fold e2 with\n | Const n2 => Const (n1 + n2)\n | _ => Plus (constant_fold e1) (constant_fold e2)\n end\n | _ =>\n match constant_fold e2 with\n | Const 0 => constant_fold e1\n | _ => Plus (constant_fold e1) (constant_fold e2)\n end\n end m')
|
|
496
|
+
],
|
|
497
|
+
end_goals=[],
|
|
498
|
+
proof_steps=[],
|
|
499
|
+
simplified_goals=[],
|
|
500
|
+
addition_state_info={}
|
|
501
|
+
)
|
|
502
|
+
|
|
503
|
+
training_data_format2 = TrainingDataFormat(
|
|
504
|
+
proof_id="proof_id",
|
|
505
|
+
start_goals=[
|
|
506
|
+
Goal(hypotheses=[], goal="forall e : expr, size (constant_fold e) <= size e"),
|
|
507
|
+
Goal(hypotheses=['e : expr'], goal="size (constant_fold e) <= size e"),
|
|
508
|
+
Goal(hypotheses=['v : var'], goal="1 <= 1"),
|
|
509
|
+
Goal(hypotheses=['n : nat'], goal="1 <= 1"),
|
|
510
|
+
Goal(hypotheses=['m : var_map', 'IHe2 : forall m : var_map, eval_expr e2 m = eval_expr (constant_fold e2) m', 'IHe1 : forall m : var_map, eval_expr e1 m = eval_expr (constant_fold e1) m', 'e1,e2 : expr'], goal='eval_expr e1 m + eval_expr e2 m =\neval_expr\n match constant_fold e1 with\n | Const (0 as n1) =>\n match constant_fold e2 with\n | Const n2 => Const (n1 + n2)\n | _ => constant_fold e2\n end\n | Const (S _ as n1) =>\n match constant_fold e2 with\n | Const n2 => Const (n1 + n2)\n | _ => Plus (constant_fold e1) (constant_fold e2)\n end\n | _ =>\n match constant_fold e2 with\n | Const 0 => constant_fold e1\n | _ => Plus (constant_fold e1) (constant_fold e2)\n end\n end m'),
|
|
511
|
+
Goal(hypotheses=['m : var_map', 'IHe2 : forall m : var_map, eval_expr e2 m = eval_expr (constant_fold e2) m', 'IHe1 : forall m : var_map, eval_expr e1 m = eval_expr (constant_fold e1) m', 'e1,e2 : expr'], goal='eval_expr e1 m + eval_expr e2 m =\neval_expr\n match constant_fold e1 with\n | Const (0 as n1) =>\n match constant_fold e2 with\n | Const n2 => Const (n1 + n2)\n | _ => constant_fold e2\n end\n | Const (S _ as n1) =>\n match constant_fold e2 with\n | Const n2 => Const (n1 + n2)\n | _ => Plus (constant_fold e1) (constant_fold e2)\n end\n | _ =>\n match constant_fold e2 with\n | Const 0 => constant_fold e1\n | _ => Plus (constant_fold e1) (constant_fold e2)\n end\n end m')
|
|
512
|
+
],
|
|
513
|
+
end_goals=[],
|
|
514
|
+
proof_steps=[],
|
|
515
|
+
simplified_goals=[],
|
|
516
|
+
addition_state_info={}
|
|
517
|
+
)
|
|
518
|
+
|
|
519
|
+
training_data_format3 = TrainingDataFormat(
|
|
520
|
+
proof_id="proof_id",
|
|
521
|
+
start_goals=[
|
|
522
|
+
Goal(hypotheses=[], goal="forall e : expr, size (constant_fold e) <= size e"),
|
|
523
|
+
Goal(hypotheses=['e : expr'], goal="size (constant_fold e) <= size e"),
|
|
524
|
+
Goal(hypotheses=['v : var'], goal="1 <= 1"),
|
|
525
|
+
Goal(hypotheses=['m : var_map', 'IHe2 : forall m : var_map, eval_expr e2 m = eval_expr (constant_fold e2) m', 'IHe1 : forall m : var_map, eval_expr e1 m = eval_expr (constant_fold e1) m', 'e1,e2 : expr'], goal='eval_expr e1 m + eval_expr e2 m =\neval_expr\n match constant_fold e1 with\n | Const (0 as n1) =>\n match constant_fold e2 with\n | Const n2 => Const (n1 + n2)\n | _ => constant_fold e2\n end\n | Const (S _ as n1) =>\n match constant_fold e2 with\n | Const n2 => Const (n1 + n2)\n | _ => Plus (constant_fold e1) (constant_fold e2)\n end\n | _ =>\n match constant_fold e2 with\n | Const 0 => constant_fold e1\n | _ => Plus (constant_fold e1) (constant_fold e2)\n end\n end m'),
|
|
526
|
+
Goal(hypotheses=['m : var_map', 'IHe2 : forall m : var_map, eval_expr e2 m = eval_expr (constant_fold e2) m', 'IHe1 : forall m : var_map, eval_expr e1 m = eval_expr (constant_fold e1) m', 'e1,e2 : expr'], goal='eval_expr e1 m + eval_expr e2 m =\neval_expr\n match constant_fold e1 with\n | Const (0 as n1) =>\n match constant_fold e2 with\n | Const n2 => Const (n1 + n2)\n | _ => constant_fold e2\n end\n | Const (S _ as n1) =>\n match constant_fold e2 with\n | Const n2 => Const (n1 + n2)\n | _ => Plus (constant_fold e1) (constant_fold e2)\n end\n | _ =>\n match constant_fold e2 with\n | Const 0 => constant_fold e1\n | _ => Plus (constant_fold e1) (constant_fold e2)\n end\n end m')
|
|
527
|
+
],
|
|
528
|
+
end_goals=[],
|
|
529
|
+
proof_steps=[],
|
|
530
|
+
simplified_goals=[],
|
|
531
|
+
addition_state_info={}
|
|
532
|
+
)
|
|
533
|
+
|
|
534
|
+
training_data_format4 = TrainingDataFormat(
|
|
535
|
+
proof_id="proof_id",
|
|
536
|
+
start_goals=[
|
|
537
|
+
Goal(hypotheses=[], goal="forall e : expr, size (constant_fold e) <= size e"),
|
|
538
|
+
Goal(hypotheses=['e : expr'], goal="size (constant_fold e) <= size e"),
|
|
539
|
+
Goal(hypotheses=['v : var'], goal="1 <= 1"),
|
|
540
|
+
Goal(hypotheses=['n : nat'], goal="1 <= 1"),
|
|
541
|
+
Goal(hypotheses=['m : var_map', 'IHe2 : forall m : var_map, eval_expr e2 m = eval_expr (constant_fold e2) m', 'IHe1 : forall m : var_map, eval_expr e1 m = eval_expr (constant_fold e1) m', 'e1,e2 : expr'], goal='eval_expr e1 m + eval_expr e2 m =\neval_expr\n match constant_fold e1 with\n | Const (0 as n1) =>\n match constant_fold e2 with\n | Const n2 => Const (n1 + n2)\n | _ => constant_fold e2\n end\n | Const (S _ as n1) =>\n match constant_fold e2 with\n | Const n2 => Const (n1 + n2)\n | _ => Plus (constant_fold e1) (constant_fold e2)\n end\n | _ =>\n match constant_fold e2 with\n | Const 0 => constant_fold e1\n | _ => Plus (constant_fold e1) (constant_fold e2)\n end\n end m')
|
|
542
|
+
],
|
|
543
|
+
end_goals=[],
|
|
544
|
+
proof_steps=[],
|
|
545
|
+
simplified_goals=[],
|
|
546
|
+
addition_state_info={}
|
|
547
|
+
)
|
|
548
|
+
|
|
549
|
+
training_data_format5 = TrainingDataFormat(
|
|
550
|
+
proof_id="proof_id",
|
|
551
|
+
start_goals=[
|
|
552
|
+
Goal(hypotheses=[], goal="forall e : expr, size (constant_fold e) <= size e"),
|
|
553
|
+
Goal(hypotheses=['e : expr'], goal="size (constant_fold e) <= size e"),
|
|
554
|
+
Goal(hypotheses=['v : var'], goal="1 <= 1"),
|
|
555
|
+
Goal(hypotheses=['m : var_map', 'IHe2 : forall m : var_map, eval_expr e2 m = eval_expr (constant_fold e2) m', 'IHe1 : forall m : var_map, eval_expr e1 m = eval_expr (constant_fold e1) m', 'e1,e2 : expr'], goal='eval_expr e1 m + eval_expr e2 m =\neval_expr\n match constant_fold e1 with\n | Const (0 as n1) =>\n match constant_fold e2 with\n | Const n2 => Const (n1 + n2)\n | _ => constant_fold e2\n end\n | Const (S _ as n1) =>\n match constant_fold e2 with\n | Const n2 => Const (n1 + n2)\n | _ => Plus (constant_fold e1) (constant_fold e2)\n end\n | _ =>\n match constant_fold e2 with\n | Const 0 => constant_fold e1\n | _ => Plus (constant_fold e1) (constant_fold e2)\n end\n end m')
|
|
556
|
+
],
|
|
557
|
+
end_goals=[],
|
|
558
|
+
proof_steps=[],
|
|
559
|
+
simplified_goals=[],
|
|
560
|
+
addition_state_info={}
|
|
561
|
+
)
|
|
562
|
+
|
|
563
|
+
training_data_format6 = TrainingDataFormat(
|
|
564
|
+
proof_id="proof_id",
|
|
565
|
+
start_goals=[
|
|
566
|
+
Goal(hypotheses=[], goal="forall e : expr, size (constant_fold e) <= size e"),
|
|
567
|
+
Goal(hypotheses=['v : var'], goal="1 <= 1"),
|
|
568
|
+
Goal(hypotheses=['m : var_map', 'IHe2 : forall m : var_map, eval_expr e2 m = eval_expr (constant_fold e2) m', 'IHe1 : forall m : var_map, eval_expr e1 m = eval_expr (constant_fold e1) m', 'e1,e2 : expr'], goal='eval_expr e1 m + eval_expr e2 m =\neval_expr\n match constant_fold e1 with\n | Const (0 as n1) =>\n match constant_fold e2 with\n | Const n2 => Const (n1 + n2)\n | _ => constant_fold e2\n end\n | Const (S _ as n1) =>\n match constant_fold e2 with\n | Const n2 => Const (n1 + n2)\n | _ => Plus (constant_fold e1) (constant_fold e2)\n end\n | _ =>\n match constant_fold e2 with\n | Const 0 => constant_fold e1\n | _ => Plus (constant_fold e1) (constant_fold e2)\n end\n end m')
|
|
569
|
+
],
|
|
570
|
+
end_goals=[],
|
|
571
|
+
proof_steps=[],
|
|
572
|
+
simplified_goals=[],
|
|
573
|
+
addition_state_info={}
|
|
574
|
+
)
|
|
575
|
+
|
|
576
|
+
training_data_format7 = TrainingDataFormat(
|
|
577
|
+
proof_id="proof_id",
|
|
578
|
+
start_goals=[
|
|
579
|
+
Goal(hypotheses=[], goal="forall e : expr, size (constant_fold e) <= size e"),
|
|
580
|
+
Goal(hypotheses=['v : var'], goal="1 <= 1"),
|
|
581
|
+
Goal(hypotheses=['IHe2 : forall m : var_map, eval_expr e2 m = eval_expr (constant_fold e2) m', 'IHe1 : forall m : var_map, eval_expr e1 m = eval_expr (constant_fold e1) m', 'e1,e2 : expr'], goal='eval_expr e1 m + eval_expr e3 m =\neval_expr\n match constant_fold e1 with\n | Const (0 as n1) =>\n '),
|
|
582
|
+
Goal(hypotheses=['m : var_map', 'IHe2 : forall m : var_map, eval_expr e2 m = eval_expr (constant_fold e2) m', 'IHe1 : forall m : var_map, eval_expr e1 m = eval_expr (constant_fold e1) m', 'e1,e2 : expr'], goal='eval_expr e1 m + eval_expr e2 m =\neval_expr\n match constant_fold e1 with\n | Const (0 as n1) =>\n match constant_fold e2 with\n | Const n2 => Const (n1 + n2)\n | _ => constant_fold e2\n end\n | Const (S _ as n1) =>\n match constant_fold e2 with\n | Const n2 => Const (n1 + n2)\n | _ => Plus (constant_fold e1) (constant_fold e2)\n end\n | _ =>\n match constant_fold e2 with\n | Const 0 => constant_fold e1\n | _ => Plus (constant_fold e1) (constant_fold e2)\n end\n end m')
|
|
583
|
+
],
|
|
584
|
+
end_goals=[],
|
|
585
|
+
proof_steps=[],
|
|
586
|
+
simplified_goals=[],
|
|
587
|
+
addition_state_info={}
|
|
588
|
+
)
|
|
589
|
+
assert Goal(hypotheses=[], goal="forall e : expr, size (constant_fold e) <= size e") >= Goal(hypotheses=['e: expr'], goal="forall e : expr, size (constant_fold e) <= size e")
|
|
590
|
+
assert training_data_format1 <= training_data_format2 and training_data_format1 >= training_data_format2, "Training data format comparison failed"
|
|
591
|
+
assert training_data_format2 <= training_data_format3
|
|
592
|
+
assert training_data_format3 >= training_data_format2
|
|
593
|
+
assert not (training_data_format1 >= training_data_format3)
|
|
594
|
+
assert not (training_data_format3 <= training_data_format1)
|
|
595
|
+
assert not (training_data_format3 <= training_data_format4)
|
|
596
|
+
assert not (training_data_format4 >= training_data_format3)
|
|
597
|
+
assert training_data_format5 >= training_data_format4 and training_data_format5 <= training_data_format3
|
|
598
|
+
assert training_data_format6 <= training_data_format5 <= training_data_format3
|
|
599
|
+
assert not (training_data_format7 <= training_data_format3) and not (training_data_format7 >= training_data_format3)
|