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.
Files changed (485) hide show
  1. itp_interface/__init__.py +0 -0
  2. itp_interface/agent/__init__.py +0 -0
  3. itp_interface/agent/simple_proof_agent.py +100 -0
  4. itp_interface/coq_ser_api/__init__.py +165 -0
  5. itp_interface/coq_ser_api/contexts.py +283 -0
  6. itp_interface/coq_ser_api/coq_agent.py +459 -0
  7. itp_interface/coq_ser_api/coq_backend.py +135 -0
  8. itp_interface/coq_ser_api/coq_util.py +839 -0
  9. itp_interface/coq_ser_api/example.py +67 -0
  10. itp_interface/coq_ser_api/lsp_backend.py +375 -0
  11. itp_interface/coq_ser_api/py.typed +0 -0
  12. itp_interface/coq_ser_api/serapi_backend.py +841 -0
  13. itp_interface/coq_ser_api/util.py +145 -0
  14. itp_interface/coq_ser_api_old/__init__.py +2583 -0
  15. itp_interface/coq_ser_api_old/contexts.py +172 -0
  16. itp_interface/coq_ser_api_old/util.py +146 -0
  17. itp_interface/lean_server/__init__.py +0 -0
  18. itp_interface/lean_server/commands.py +484 -0
  19. itp_interface/lean_server/lean3_search_tool.py +358 -0
  20. itp_interface/lean_server/lean4_repl_interface.py +151 -0
  21. itp_interface/lean_server/lean4_utils.py +255 -0
  22. itp_interface/lean_server/lean_cmd_server.py +111 -0
  23. itp_interface/lean_server/lean_context.py +60 -0
  24. itp_interface/lean_server/lean_sync_server.py +174 -0
  25. itp_interface/lean_server/lean_utils.py +199 -0
  26. itp_interface/lean_server/py.typed +1 -0
  27. itp_interface/main/__init__.py +0 -0
  28. itp_interface/main/config/afp_data_gen.yaml +14 -0
  29. itp_interface/main/config/benchmark/CompCert.yaml +366 -0
  30. itp_interface/main/config/benchmark/GeoCoq.yaml +930 -0
  31. itp_interface/main/config/benchmark/UniMath.yaml +2690 -0
  32. itp_interface/main/config/benchmark/afp_isabelle.yaml +29200 -0
  33. itp_interface/main/config/benchmark/agent_proverbot_hard.yaml +247 -0
  34. itp_interface/main/config/benchmark/category-theory.yaml +470 -0
  35. itp_interface/main/config/benchmark/compcert_118_subset.yaml +148 -0
  36. itp_interface/main/config/benchmark/compcert_benchmark.yaml +36 -0
  37. itp_interface/main/config/benchmark/compcert_benchmark_hard.yaml +498 -0
  38. itp_interface/main/config/benchmark/compcert_benchmark_hard_1.yaml +55 -0
  39. itp_interface/main/config/benchmark/compcert_benchmark_hard_2.yaml +24 -0
  40. itp_interface/main/config/benchmark/compcert_benchmark_hard_3.yaml +95 -0
  41. itp_interface/main/config/benchmark/compcert_benchmark_hard_7_per_cent.yaml +78 -0
  42. itp_interface/main/config/benchmark/compcert_benchmark_test.yaml +38 -0
  43. itp_interface/main/config/benchmark/compcert_benchmark_train.yaml +340 -0
  44. itp_interface/main/config/benchmark/leandojo_novel_premises_test.yaml +2908 -0
  45. itp_interface/main/config/benchmark/leandojo_novel_premises_train.yaml +98645 -0
  46. itp_interface/main/config/benchmark/leandojo_novel_premises_val.yaml +2912 -0
  47. itp_interface/main/config/benchmark/leandojo_random.yaml +2889 -0
  48. itp_interface/main/config/benchmark/leandojo_random_test.yaml +2421 -0
  49. itp_interface/main/config/benchmark/leandojo_random_train.yaml +62729 -0
  50. itp_interface/main/config/benchmark/leandojo_random_val.yaml +2504 -0
  51. itp_interface/main/config/benchmark/math-comp.yaml +200 -0
  52. itp_interface/main/config/benchmark/miniF2F_test.yaml +12 -0
  53. itp_interface/main/config/benchmark/miniF2F_test_aime.yaml +27 -0
  54. itp_interface/main/config/benchmark/miniF2F_test_algebra.yaml +30 -0
  55. itp_interface/main/config/benchmark/miniF2F_test_amc12.yaml +57 -0
  56. itp_interface/main/config/benchmark/miniF2F_test_few_shot_hard.yaml +231 -0
  57. itp_interface/main/config/benchmark/miniF2F_test_imo.yaml +32 -0
  58. itp_interface/main/config/benchmark/miniF2F_test_induction.yaml +20 -0
  59. itp_interface/main/config/benchmark/miniF2F_test_mathd_algebra.yaml +82 -0
  60. itp_interface/main/config/benchmark/miniF2F_test_mathd_algebra_hard.yaml +72 -0
  61. itp_interface/main/config/benchmark/miniF2F_test_mathd_numbertheory.yaml +72 -0
  62. itp_interface/main/config/benchmark/miniF2F_test_numbertheory.yaml +20 -0
  63. itp_interface/main/config/benchmark/minicompcert_benchmark_1.yaml +14 -0
  64. itp_interface/main/config/benchmark/proverbot_hard.yaml +104 -0
  65. itp_interface/main/config/benchmark/re_prover.yaml +66 -0
  66. itp_interface/main/config/benchmark/re_prover_hard.yaml +41 -0
  67. itp_interface/main/config/benchmark/re_prover_very_hard.yaml +22 -0
  68. itp_interface/main/config/benchmark/reprover_with_retrieval.yaml +73 -0
  69. itp_interface/main/config/benchmark/reprover_with_retrieval_hard.yaml +30 -0
  70. itp_interface/main/config/benchmark/reprover_with_retrieval_neg.yaml +195 -0
  71. itp_interface/main/config/benchmark/simple_benchmark_1.yaml +24 -0
  72. itp_interface/main/config/benchmark/simple_benchmark_8.yaml +50 -0
  73. itp_interface/main/config/benchmark/simple_benchmark_9.yaml +65 -0
  74. itp_interface/main/config/benchmark/simple_benchmark_isabelle.yaml +18 -0
  75. itp_interface/main/config/benchmark/simple_benchmark_lean.yaml +12 -0
  76. itp_interface/main/config/benchmark/simple_benchmark_lean_training_data.yaml +12 -0
  77. itp_interface/main/config/benchmark/simple_rl_benchmark_lean.yaml +14 -0
  78. itp_interface/main/config/benchmark/stack_machine.yaml +13 -0
  79. itp_interface/main/config/benchmark/stack_machine_hard.yaml +15 -0
  80. itp_interface/main/config/category_theory_data_gen.yaml +14 -0
  81. itp_interface/main/config/category_theory_data_gen_random.yaml +16 -0
  82. itp_interface/main/config/compcert_data_gen_test.yaml +10 -0
  83. itp_interface/main/config/compcert_data_gen_train.yaml +7 -0
  84. itp_interface/main/config/env_settings/bm25_retrieval.yaml +2 -0
  85. itp_interface/main/config/env_settings/bm25_retrieval_no_dfns.yaml +2 -0
  86. itp_interface/main/config/env_settings/bm25_retrieval_only_local_no_dfns.yaml +2 -0
  87. itp_interface/main/config/env_settings/bm25_retrieval_with_print.yaml +2 -0
  88. itp_interface/main/config/env_settings/bm25_retrieval_with_print_only_local.yaml +2 -0
  89. itp_interface/main/config/env_settings/bm25_retrieval_with_print_only_local_no_dfns.yaml +2 -0
  90. itp_interface/main/config/env_settings/no_retrieval.yaml +2 -0
  91. itp_interface/main/config/experiments.yaml +12 -0
  92. itp_interface/main/config/geo_coq_data_gen.yaml +14 -0
  93. itp_interface/main/config/geo_coq_data_gen_random.yaml +16 -0
  94. itp_interface/main/config/leandojo_random_data_gen.yaml +16 -0
  95. itp_interface/main/config/math_comp_data_gen.yaml +14 -0
  96. itp_interface/main/config/math_comp_data_gen_random.yaml +16 -0
  97. itp_interface/main/config/mathlib_data_gen.yaml +14 -0
  98. itp_interface/main/config/repo/coq_repos.yaml +191 -0
  99. itp_interface/main/config/run_settings/default_coq_data_generation_transforms.yaml +24 -0
  100. itp_interface/main/config/run_settings/default_isabelle_data_generation_transforms.yaml +24 -0
  101. itp_interface/main/config/run_settings/default_lean4_data_generation_transforms.yaml +24 -0
  102. itp_interface/main/config/run_settings/default_lean_data_generation_transforms.yaml +24 -0
  103. itp_interface/main/config/simple_coq_data_gen.yaml +12 -0
  104. itp_interface/main/config/simple_coq_data_gen_random.yaml +17 -0
  105. itp_interface/main/config/simple_lean_data_gen.yaml +12 -0
  106. itp_interface/main/config/simple_rl_lean_data_gen.yaml +12 -0
  107. itp_interface/main/config/uni_math_data_gen.yaml +14 -0
  108. itp_interface/main/config.py +192 -0
  109. itp_interface/main/extract_benchmark_dataset.py +106 -0
  110. itp_interface/main/filter_dataset.py +107 -0
  111. itp_interface/main/install.py +92 -0
  112. itp_interface/main/merge_dataset.py +96 -0
  113. itp_interface/main/run_tool.py +444 -0
  114. itp_interface/pisa/.git +1 -0
  115. itp_interface/pisa/.gitignore +125 -0
  116. itp_interface/pisa/.idea/.gitignore +8 -0
  117. itp_interface/pisa/.idea/ClojureProjectResolveSettings.xml +6 -0
  118. itp_interface/pisa/.idea/codeStyles/Project.xml +7 -0
  119. itp_interface/pisa/.idea/codeStyles/codeStyleConfig.xml +5 -0
  120. itp_interface/pisa/.idea/inspectionProfiles/Project_Default.xml +16 -0
  121. itp_interface/pisa/.idea/libraries/sbt__com_google_android_annotations_4_1_1_4_jar.xml +13 -0
  122. itp_interface/pisa/.idea/libraries/sbt__com_google_api_grpc_proto_google_common_protos_1_17_0_jar.xml +13 -0
  123. itp_interface/pisa/.idea/libraries/sbt__com_google_code_findbugs_jsr305_3_0_2_jar.xml +13 -0
  124. itp_interface/pisa/.idea/libraries/sbt__com_google_code_gson_gson_2_8_6_jar.xml +13 -0
  125. itp_interface/pisa/.idea/libraries/sbt__com_google_errorprone_error_prone_annotations_2_3_4_jar.xml +13 -0
  126. itp_interface/pisa/.idea/libraries/sbt__com_google_guava_failureaccess_1_0_1_jar.xml +13 -0
  127. itp_interface/pisa/.idea/libraries/sbt__com_google_guava_guava_30_0_jre_jar.xml +13 -0
  128. itp_interface/pisa/.idea/libraries/sbt__com_google_guava_listenablefuture_9999_0_empty_to_avoid_conflict_with_guava_jar.xml +9 -0
  129. itp_interface/pisa/.idea/libraries/sbt__com_google_j2objc_j2objc_annotations_1_3_jar.xml +13 -0
  130. itp_interface/pisa/.idea/libraries/sbt__com_google_protobuf_protobuf_java_3_12_0_jar.xml +13 -0
  131. itp_interface/pisa/.idea/libraries/sbt__com_google_protobuf_protobuf_java_util_3_12_0_jar.xml +13 -0
  132. itp_interface/pisa/.idea/libraries/sbt__com_lihaoyi_fastparse_2_13_2_3_0_jar.xml +13 -0
  133. itp_interface/pisa/.idea/libraries/sbt__com_lihaoyi_geny_2_13_0_6_0_jar.xml +13 -0
  134. itp_interface/pisa/.idea/libraries/sbt__com_lihaoyi_sourcecode_2_13_0_2_1_jar.xml +13 -0
  135. itp_interface/pisa/.idea/libraries/sbt__com_thesamet_scalapb_lenses_2_13_0_10_9_jar.xml +13 -0
  136. itp_interface/pisa/.idea/libraries/sbt__com_thesamet_scalapb_scalapb_runtime_2_13_0_10_9_jar.xml +13 -0
  137. itp_interface/pisa/.idea/libraries/sbt__com_thesamet_scalapb_scalapb_runtime_grpc_2_13_0_10_9_jar.xml +13 -0
  138. itp_interface/pisa/.idea/libraries/sbt__com_thesamet_scalapb_zio_grpc_zio_grpc_core_2_13_0_4_2_jar.xml +13 -0
  139. itp_interface/pisa/.idea/libraries/sbt__com_thoughtworks_paranamer_paranamer_2_8_jar.xml +13 -0
  140. itp_interface/pisa/.idea/libraries/sbt__commons_io_commons_io_2_8_0_jar.xml +13 -0
  141. itp_interface/pisa/.idea/libraries/sbt__de_unruh_java_patterns_0_1_0_jar.xml +13 -0
  142. itp_interface/pisa/.idea/libraries/sbt__de_unruh_scala_isabelle_2_13_master_SNAPSHOT_jar.xml +13 -0
  143. itp_interface/pisa/.idea/libraries/sbt__dev_zio_izumi_reflect_2_13_1_0_0_M9_jar.xml +13 -0
  144. itp_interface/pisa/.idea/libraries/sbt__dev_zio_izumi_reflect_thirdparty_boopickle_shaded_2_13_1_0_0_M9_jar.xml +13 -0
  145. itp_interface/pisa/.idea/libraries/sbt__dev_zio_zio_2_13_1_0_3_jar.xml +13 -0
  146. itp_interface/pisa/.idea/libraries/sbt__dev_zio_zio_stacktracer_2_13_1_0_3_jar.xml +13 -0
  147. itp_interface/pisa/.idea/libraries/sbt__dev_zio_zio_streams_2_13_1_0_3_jar.xml +13 -0
  148. itp_interface/pisa/.idea/libraries/sbt__io_grpc_grpc_api_1_34_0_jar.xml +13 -0
  149. itp_interface/pisa/.idea/libraries/sbt__io_grpc_grpc_context_1_34_0_jar.xml +13 -0
  150. itp_interface/pisa/.idea/libraries/sbt__io_grpc_grpc_core_1_34_0_jar.xml +13 -0
  151. itp_interface/pisa/.idea/libraries/sbt__io_grpc_grpc_netty_1_34_0_jar.xml +13 -0
  152. itp_interface/pisa/.idea/libraries/sbt__io_grpc_grpc_protobuf_1_34_0_jar.xml +13 -0
  153. itp_interface/pisa/.idea/libraries/sbt__io_grpc_grpc_protobuf_lite_1_34_0_jar.xml +13 -0
  154. itp_interface/pisa/.idea/libraries/sbt__io_grpc_grpc_services_1_34_0_jar.xml +13 -0
  155. itp_interface/pisa/.idea/libraries/sbt__io_grpc_grpc_stub_1_34_0_jar.xml +13 -0
  156. itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_buffer_4_1_51_Final_jar.xml +13 -0
  157. itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_codec_4_1_51_Final_jar.xml +13 -0
  158. itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_codec_http2_4_1_51_Final_jar.xml +13 -0
  159. itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_codec_http_4_1_51_Final_jar.xml +13 -0
  160. itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_codec_socks_4_1_51_Final_jar.xml +13 -0
  161. itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_common_4_1_51_Final_jar.xml +13 -0
  162. itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_handler_4_1_51_Final_jar.xml +13 -0
  163. itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_handler_proxy_4_1_51_Final_jar.xml +13 -0
  164. itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_resolver_4_1_51_Final_jar.xml +13 -0
  165. itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_transport_4_1_51_Final_jar.xml +13 -0
  166. itp_interface/pisa/.idea/libraries/sbt__io_perfmark_perfmark_api_0_19_0_jar.xml +13 -0
  167. itp_interface/pisa/.idea/libraries/sbt__net_java_dev_jna_jna_5_3_1_jar.xml +13 -0
  168. itp_interface/pisa/.idea/libraries/sbt__net_liftweb_lift_json_2_13_3_4_3_jar.xml +13 -0
  169. itp_interface/pisa/.idea/libraries/sbt__org_apache_commons_commons_lang3_3_11_jar.xml +13 -0
  170. itp_interface/pisa/.idea/libraries/sbt__org_apache_commons_commons_text_1_9_jar.xml +13 -0
  171. itp_interface/pisa/.idea/libraries/sbt__org_checkerframework_checker_qual_3_5_0_jar.xml +13 -0
  172. itp_interface/pisa/.idea/libraries/sbt__org_codehaus_mojo_animal_sniffer_annotations_1_18_jar.xml +13 -0
  173. itp_interface/pisa/.idea/libraries/sbt__org_jetbrains_annotations_20_1_0_jar.xml +13 -0
  174. itp_interface/pisa/.idea/libraries/sbt__org_jline_jline_3_16_0_jar.xml +13 -0
  175. itp_interface/pisa/.idea/libraries/sbt__org_log4s_log4s_2_13_1_9_0_jar.xml +13 -0
  176. itp_interface/pisa/.idea/libraries/sbt__org_scala_lang_modules_scala_collection_compat_2_13_2_1_6_jar.xml +13 -0
  177. itp_interface/pisa/.idea/libraries/sbt__org_scala_lang_modules_scala_xml_2_13_1_3_0_jar.xml +13 -0
  178. itp_interface/pisa/.idea/libraries/sbt__org_scala_lang_scala_compiler_2_13_4_jar.xml +13 -0
  179. itp_interface/pisa/.idea/libraries/sbt__org_scala_lang_scala_library_2_13_4_jar.xml +23 -0
  180. itp_interface/pisa/.idea/libraries/sbt__org_scala_lang_scala_reflect_2_13_4_jar.xml +13 -0
  181. itp_interface/pisa/.idea/libraries/sbt__org_scala_lang_scalap_2_13_4_jar.xml +13 -0
  182. itp_interface/pisa/.idea/libraries/sbt__org_scalaz_scalaz_core_2_13_7_3_2_jar.xml +13 -0
  183. itp_interface/pisa/.idea/libraries/sbt__org_slf4j_slf4j_api_1_7_30_jar.xml +13 -0
  184. itp_interface/pisa/.idea/libraries/sbt__org_slf4j_slf4j_simple_1_7_30_jar.xml +13 -0
  185. itp_interface/pisa/.idea/misc.xml +7 -0
  186. itp_interface/pisa/.idea/modules/PISA-build.iml +127 -0
  187. itp_interface/pisa/.idea/modules/PISA.iml +94 -0
  188. itp_interface/pisa/.idea/modules.xml +9 -0
  189. itp_interface/pisa/.idea/other.xml +6 -0
  190. itp_interface/pisa/.idea/sbt.xml +20 -0
  191. itp_interface/pisa/.idea/scala_compiler.xml +6 -0
  192. itp_interface/pisa/.idea/uiDesigner.xml +124 -0
  193. itp_interface/pisa/.idea/vcs.xml +6 -0
  194. itp_interface/pisa/.scalafmt.conf +2 -0
  195. itp_interface/pisa/LICENSE +29 -0
  196. itp_interface/pisa/README.md +262 -0
  197. itp_interface/pisa/build.sbt +49 -0
  198. itp_interface/pisa/build.sh +26 -0
  199. itp_interface/pisa/command_generation/close_gaps.py +44 -0
  200. itp_interface/pisa/command_generation/conjecture_normal_order.py +62 -0
  201. itp_interface/pisa/command_generation/conjecturer_command_generator.py +36 -0
  202. itp_interface/pisa/command_generation/create_dirs.py +11 -0
  203. itp_interface/pisa/command_generation/find_std.py +67 -0
  204. itp_interface/pisa/command_generation/generate_build_commands_afp.py +15 -0
  205. itp_interface/pisa/command_generation/generate_build_commands_std.py +15 -0
  206. itp_interface/pisa/command_generation/generate_commands_afp.py +103 -0
  207. itp_interface/pisa/command_generation/generate_commands_mini.py +73 -0
  208. itp_interface/pisa/command_generation/generate_commands_std.py +69 -0
  209. itp_interface/pisa/command_generation/generate_hammer_extraction_text.py +5 -0
  210. itp_interface/pisa/command_generation/hammer_command_generator.py +40 -0
  211. itp_interface/pisa/command_generation/hp_search_command_generator.py +63 -0
  212. itp_interface/pisa/command_generation/oracle_command_generator.py +56 -0
  213. itp_interface/pisa/command_generation/search_command_generator.py +69 -0
  214. itp_interface/pisa/command_generation/summarise_problem_names.py +45 -0
  215. itp_interface/pisa/command_generation/tpu_hp_search.py +75 -0
  216. itp_interface/pisa/docker/Dockerfile +34 -0
  217. itp_interface/pisa/docker/docker_tutorial.md +64 -0
  218. itp_interface/pisa/eval_setup/copy_isabelle.py +42 -0
  219. itp_interface/pisa/eval_setup/copy_pisa_jars.py +18 -0
  220. itp_interface/pisa/mesh_transformer_utils/tokenization.py +86 -0
  221. itp_interface/pisa/project/build.properties +1 -0
  222. itp_interface/pisa/project/plugins.sbt +5 -0
  223. itp_interface/pisa/requirements.txt +4 -0
  224. itp_interface/pisa/scripts/extract_last_k_steps.py +28 -0
  225. itp_interface/pisa/scripts/extract_proof_corpus.py +26 -0
  226. itp_interface/pisa/scripts/gather_hammer_results.py +27 -0
  227. itp_interface/pisa/scripts/length_in_char_stats.py +20 -0
  228. itp_interface/pisa/scripts/mix.py +127 -0
  229. itp_interface/pisa/scripts/results_stat.py +52 -0
  230. itp_interface/pisa/scripts/test_array_job.sh +34 -0
  231. itp_interface/pisa/setup.sh +25 -0
  232. itp_interface/pisa/src/main/protobuf/server.proto +60 -0
  233. itp_interface/pisa/src/main/python/.idea/.gitignore +8 -0
  234. itp_interface/pisa/src/main/python/.idea/inspectionProfiles/Project_Default.xml +18 -0
  235. itp_interface/pisa/src/main/python/.idea/inspectionProfiles/profiles_settings.xml +6 -0
  236. itp_interface/pisa/src/main/python/.idea/misc.xml +4 -0
  237. itp_interface/pisa/src/main/python/.idea/modules.xml +8 -0
  238. itp_interface/pisa/src/main/python/.idea/python.iml +12 -0
  239. itp_interface/pisa/src/main/python/.idea/vcs.xml +6 -0
  240. itp_interface/pisa/src/main/python/conjecturing_parsing/conjecturer_postprocessing.py +59 -0
  241. itp_interface/pisa/src/main/python/data_extraction/extract_data.py +184 -0
  242. itp_interface/pisa/src/main/python/data_extraction/find_premises.py +221 -0
  243. itp_interface/pisa/src/main/python/data_extraction/process_data.py +129 -0
  244. itp_interface/pisa/src/main/python/legacy/PisaFlexibleClient.py +167 -0
  245. itp_interface/pisa/src/main/python/legacy/autof_test.py +74 -0
  246. itp_interface/pisa/src/main/python/legacy/cmd_client.py +23 -0
  247. itp_interface/pisa/src/main/python/legacy/convert_scala_dump_to_test_name_jsons.py +14 -0
  248. itp_interface/pisa/src/main/python/legacy/create_data_txt.py +72 -0
  249. itp_interface/pisa/src/main/python/legacy/create_finetune_tfrecords.py +311 -0
  250. itp_interface/pisa/src/main/python/legacy/demo.py +49 -0
  251. itp_interface/pisa/src/main/python/legacy/evaluate.py +108 -0
  252. itp_interface/pisa/src/main/python/legacy/extract_first_step.py +25 -0
  253. itp_interface/pisa/src/main/python/legacy/get_global_facts.py +35 -0
  254. itp_interface/pisa/src/main/python/legacy/mix_data.py +19 -0
  255. itp_interface/pisa/src/main/python/legacy/one_stage_extraction.py +111 -0
  256. itp_interface/pisa/src/main/python/legacy/prepare_episodic_transitions.py +137 -0
  257. itp_interface/pisa/src/main/python/legacy/prepare_translation_pairs.py +277 -0
  258. itp_interface/pisa/src/main/python/pisa_client.py +322 -0
  259. itp_interface/pisa/src/main/python/server_pb2.py +394 -0
  260. itp_interface/pisa/src/main/python/server_pb2_grpc.py +230 -0
  261. itp_interface/pisa/src/main/python/test_client.py +17 -0
  262. itp_interface/pisa/src/main/python/test_client2.py +79 -0
  263. itp_interface/pisa/src/main/python/utils/filters.py +59 -0
  264. itp_interface/pisa/src/main/python/utils/pisa_server_control.py +29 -0
  265. itp_interface/pisa/src/main/scala/pisa/agent/CheckSyntax.scala +257 -0
  266. itp_interface/pisa/src/main/scala/pisa/agent/DepThms.scala +29 -0
  267. itp_interface/pisa/src/main/scala/pisa/agent/PisaStat.scala +46 -0
  268. itp_interface/pisa/src/main/scala/pisa/agent/RefactorTest.scala +40 -0
  269. itp_interface/pisa/src/main/scala/pisa/agent/RepHammer.scala +95 -0
  270. itp_interface/pisa/src/main/scala/pisa/server/HammFacts.scala +63 -0
  271. itp_interface/pisa/src/main/scala/pisa/server/PisaOS.scala +881 -0
  272. itp_interface/pisa/src/main/scala/pisa/server/PisaOneStage.scala +540 -0
  273. itp_interface/pisa/src/main/scala/pisa/server/PisaOneStageServers.scala +1048 -0
  274. itp_interface/pisa/src/main/scala/pisa/utils/TheoryManager.scala +95 -0
  275. itp_interface/pisa/src/test/python/analyse_debug.py +33 -0
  276. itp_interface/pisa/src/test/python/extract_test_seq2seq.py +53 -0
  277. itp_interface/pisa/src/test/python/extract_test_theorem_ground_truth_indices.py +31 -0
  278. itp_interface/pisa/src/test/python/proof_originality.py +24 -0
  279. itp_interface/pisa/src/test/python/test_command_generator.py +25 -0
  280. itp_interface/pisa/src/test/python/test_model_sequence_accuracy.py +70 -0
  281. itp_interface/pisa/src/test/scala/pisa/Easy.scala +26 -0
  282. itp_interface/pisa/src/test/scala/pisa/TestCurl.scala +82 -0
  283. itp_interface/pisa/src/test/scala/pisa/TestIsa.scala +27 -0
  284. itp_interface/pisa/test.sh +19 -0
  285. itp_interface/pisa/universal_test_theorems.tar.gz +0 -0
  286. itp_interface/repo/build.py +78 -0
  287. itp_interface/repo/clone.py +79 -0
  288. itp_interface/repo/dataset_discovery.py +99 -0
  289. itp_interface/retrieval/__init__.py +0 -0
  290. itp_interface/retrieval/abstraction.py +35 -0
  291. itp_interface/retrieval/coq_bm25_reranker.py +153 -0
  292. itp_interface/retrieval/isabelle_bm25_reranker.py +86 -0
  293. itp_interface/retrieval/lean3_bm25_reranker.py +86 -0
  294. itp_interface/rl/__init__.py +0 -0
  295. itp_interface/rl/abstraction.py +168 -0
  296. itp_interface/rl/proof_action.py +172 -0
  297. itp_interface/rl/proof_state.py +149 -0
  298. itp_interface/rl/proof_tree.py +109 -0
  299. itp_interface/rl/simpl_proof_env_pool.py +16 -0
  300. itp_interface/rl/simple_proof_env.py +713 -0
  301. itp_interface/rl/simple_proof_env_pool.py +591 -0
  302. itp_interface/scripts/setup.sh +228 -0
  303. itp_interface/tools/__init__.py +0 -0
  304. itp_interface/tools/basic_utils.py +172 -0
  305. itp_interface/tools/bin_packing.py +61 -0
  306. itp_interface/tools/cache.py +93 -0
  307. itp_interface/tools/coq_build_spec.py +31 -0
  308. itp_interface/tools/coq_build_tool.py +319 -0
  309. itp_interface/tools/coq_context_helper.py +354 -0
  310. itp_interface/tools/coq_executor.py +508 -0
  311. itp_interface/tools/coq_local_data_generation_transform.py +158 -0
  312. itp_interface/tools/coq_parse_utils.py +154 -0
  313. itp_interface/tools/coq_raw_proofs.py +193 -0
  314. itp_interface/tools/coq_theorem_proof_pair_generation_transform.py +146 -0
  315. itp_interface/tools/coq_training_data_generator.py +76 -0
  316. itp_interface/tools/dynamic_coq_proof_exec.py +220 -0
  317. itp_interface/tools/dynamic_isabelle_proof_exec.py +229 -0
  318. itp_interface/tools/dynamic_lean4_proof_exec.py +236 -0
  319. itp_interface/tools/dynamic_lean_proof_exec.py +228 -0
  320. itp_interface/tools/isabelle_context_helper.py +66 -0
  321. itp_interface/tools/isabelle_executor.py +862 -0
  322. itp_interface/tools/isabelle_local_data_generation_transform.py +149 -0
  323. itp_interface/tools/isabelle_parse_utils.py +131 -0
  324. itp_interface/tools/isabelle_server.py +106 -0
  325. itp_interface/tools/lean4_context_helper.py +72 -0
  326. itp_interface/tools/lean4_local_data_generation_transform.py +122 -0
  327. itp_interface/tools/lean4_sync_executor.py +1193 -0
  328. itp_interface/tools/lean_cmd_executor.py +804 -0
  329. itp_interface/tools/lean_context_helper.py +327 -0
  330. itp_interface/tools/lean_dojo_data_generation_transform.py +206 -0
  331. itp_interface/tools/lean_executor.py +687 -0
  332. itp_interface/tools/lean_local_data_generation_transform.py +136 -0
  333. itp_interface/tools/lean_parse_utils.py +32 -0
  334. itp_interface/tools/log_utils.py +20 -0
  335. itp_interface/tools/proof_exec_callback.py +76 -0
  336. itp_interface/tools/ray_utils.py +265 -0
  337. itp_interface/tools/repl/.git +1 -0
  338. itp_interface/tools/repl/.github/workflows/ci.yml +24 -0
  339. itp_interface/tools/repl/.gitignore +7 -0
  340. itp_interface/tools/repl/.vscode/copyright.code-snippets +13 -0
  341. itp_interface/tools/repl/.vscode/extensions.json +13 -0
  342. itp_interface/tools/repl/.vscode/module-docstring.code-snippets +35 -0
  343. itp_interface/tools/repl/.vscode/settings.json +11 -0
  344. itp_interface/tools/repl/README.md +174 -0
  345. itp_interface/tools/repl/REPL/Frontend.lean +47 -0
  346. itp_interface/tools/repl/REPL/JSON.lean +186 -0
  347. itp_interface/tools/repl/REPL/Lean/ContextInfo.lean +9 -0
  348. itp_interface/tools/repl/REPL/Lean/Environment.lean +31 -0
  349. itp_interface/tools/repl/REPL/Lean/InfoTree/ToJson.lean +114 -0
  350. itp_interface/tools/repl/REPL/Lean/InfoTree.lean +272 -0
  351. itp_interface/tools/repl/REPL/Main.lean +323 -0
  352. itp_interface/tools/repl/REPL/Snapshots.lean +306 -0
  353. itp_interface/tools/repl/REPL/Util/Path.lean +36 -0
  354. itp_interface/tools/repl/REPL/Util/Pickle.lean +44 -0
  355. itp_interface/tools/repl/REPL.lean +4 -0
  356. itp_interface/tools/repl/lake-manifest.json +5 -0
  357. itp_interface/tools/repl/lakefile.lean +15 -0
  358. itp_interface/tools/repl/lean-toolchain +1 -0
  359. itp_interface/tools/repl/test/Mathlib/.gitignore +5 -0
  360. itp_interface/tools/repl/test/Mathlib/H20231110.sh +2 -0
  361. itp_interface/tools/repl/test/Mathlib/ReplMathlibTests.lean +1 -0
  362. itp_interface/tools/repl/test/Mathlib/lake-manifest.json +68 -0
  363. itp_interface/tools/repl/test/Mathlib/lakefile.lean +11 -0
  364. itp_interface/tools/repl/test/Mathlib/lean-toolchain +1 -0
  365. itp_interface/tools/repl/test/Mathlib/test/20240209.expected.out +20 -0
  366. itp_interface/tools/repl/test/Mathlib/test/20240209.in +3 -0
  367. itp_interface/tools/repl/test/Mathlib/test/20240209.lean +4 -0
  368. itp_interface/tools/repl/test/Mathlib/test/H20231020.expected.out +8 -0
  369. itp_interface/tools/repl/test/Mathlib/test/H20231020.in +8 -0
  370. itp_interface/tools/repl/test/Mathlib/test/H20231020.lean +22 -0
  371. itp_interface/tools/repl/test/Mathlib/test/H20231110.expected.out +4 -0
  372. itp_interface/tools/repl/test/Mathlib/test/H20231110.in +4 -0
  373. itp_interface/tools/repl/test/Mathlib/test/H20231115.expected.out +19 -0
  374. itp_interface/tools/repl/test/Mathlib/test/H20231115.in +5 -0
  375. itp_interface/tools/repl/test/Mathlib/test/H20231115_2.expected.out +18 -0
  376. itp_interface/tools/repl/test/Mathlib/test/H20231115_2.in +4 -0
  377. itp_interface/tools/repl/test/Mathlib/test/H20231115_3.expected.out +10 -0
  378. itp_interface/tools/repl/test/Mathlib/test/H20231115_3.in +4 -0
  379. itp_interface/tools/repl/test/Mathlib/test/H20231214.in +9 -0
  380. itp_interface/tools/repl/test/Mathlib/test/H20231214.lean +30 -0
  381. itp_interface/tools/repl/test/Mathlib/test/H20231215.expected.out +4 -0
  382. itp_interface/tools/repl/test/Mathlib/test/H20231215.in +4 -0
  383. itp_interface/tools/repl/test/Mathlib/test/H20231215_2.expected.out +14 -0
  384. itp_interface/tools/repl/test/Mathlib/test/H20231215_2.in +3 -0
  385. itp_interface/tools/repl/test/Mathlib/test/exact.expected.out +37 -0
  386. itp_interface/tools/repl/test/Mathlib/test/exact.in +10 -0
  387. itp_interface/tools/repl/test/Mathlib/test/import_Mathlib.lean +1 -0
  388. itp_interface/tools/repl/test/Mathlib/test/induction.expected.out +29 -0
  389. itp_interface/tools/repl/test/Mathlib/test/induction.in +10 -0
  390. itp_interface/tools/repl/test/Mathlib/test/induction.lean +6 -0
  391. itp_interface/tools/repl/test/Mathlib/test/on_goal.expected.out +22 -0
  392. itp_interface/tools/repl/test/Mathlib/test/on_goal.in +5 -0
  393. itp_interface/tools/repl/test/Mathlib/test/pickle.expected.out +16 -0
  394. itp_interface/tools/repl/test/Mathlib/test/pickle.in +6 -0
  395. itp_interface/tools/repl/test/Mathlib/test/pickle_2.expected.out +4 -0
  396. itp_interface/tools/repl/test/Mathlib/test/pickle_2.in +4 -0
  397. itp_interface/tools/repl/test/Mathlib/test.sh +41 -0
  398. itp_interface/tools/repl/test/all_tactics.expected.out +13 -0
  399. itp_interface/tools/repl/test/all_tactics.in +1 -0
  400. itp_interface/tools/repl/test/by_cases.expected.out +25 -0
  401. itp_interface/tools/repl/test/by_cases.in +8 -0
  402. itp_interface/tools/repl/test/by_cases.lean +4 -0
  403. itp_interface/tools/repl/test/calc.expected.out +32 -0
  404. itp_interface/tools/repl/test/calc.in +1 -0
  405. itp_interface/tools/repl/test/def_eval.expected.out +9 -0
  406. itp_interface/tools/repl/test/def_eval.in +3 -0
  407. itp_interface/tools/repl/test/enableInitializersExecution.expected.out +2 -0
  408. itp_interface/tools/repl/test/enableInitializersExecution.in +1 -0
  409. itp_interface/tools/repl/test/file.expected.out +8 -0
  410. itp_interface/tools/repl/test/file.in +1 -0
  411. itp_interface/tools/repl/test/file.lean +5 -0
  412. itp_interface/tools/repl/test/have_by_sorry.expected.out +28 -0
  413. itp_interface/tools/repl/test/have_by_sorry.in +6 -0
  414. itp_interface/tools/repl/test/import_lean.in +1 -0
  415. itp_interface/tools/repl/test/incomplete.expected.out +18 -0
  416. itp_interface/tools/repl/test/incomplete.in +3 -0
  417. itp_interface/tools/repl/test/incomplete.lean +0 -0
  418. itp_interface/tools/repl/test/infotree.expected.out +20 -0
  419. itp_interface/tools/repl/test/infotree.in +2 -0
  420. itp_interface/tools/repl/test/invalid_tactic.expected.out +20 -0
  421. itp_interface/tools/repl/test/invalid_tactic.in +3 -0
  422. itp_interface/tools/repl/test/name_generator.expected.out +53 -0
  423. itp_interface/tools/repl/test/name_generator.in +18 -0
  424. itp_interface/tools/repl/test/no_goal_sorry.expected.out +11 -0
  425. itp_interface/tools/repl/test/no_goal_sorry.in +1 -0
  426. itp_interface/tools/repl/test/no_goal_sorry_2.expected.out +12 -0
  427. itp_interface/tools/repl/test/no_goal_sorry_2.in +1 -0
  428. itp_interface/tools/repl/test/options.expected.out +17 -0
  429. itp_interface/tools/repl/test/options.in +6 -0
  430. itp_interface/tools/repl/test/pickle_environment.expected.out +8 -0
  431. itp_interface/tools/repl/test/pickle_environment.in +7 -0
  432. itp_interface/tools/repl/test/pickle_environment_with_imports.expected.out +10 -0
  433. itp_interface/tools/repl/test/pickle_environment_with_imports.in +9 -0
  434. itp_interface/tools/repl/test/pickle_open.expected.out +8 -0
  435. itp_interface/tools/repl/test/pickle_open.in +7 -0
  436. itp_interface/tools/repl/test/pickle_open_2.expected.out +4 -0
  437. itp_interface/tools/repl/test/pickle_open_2.in +3 -0
  438. itp_interface/tools/repl/test/pickle_open_scoped.expected.out +18 -0
  439. itp_interface/tools/repl/test/pickle_open_scoped.in +8 -0
  440. itp_interface/tools/repl/test/pickle_open_scoped_2.expected.out +14 -0
  441. itp_interface/tools/repl/test/pickle_open_scoped_2.in +3 -0
  442. itp_interface/tools/repl/test/pickle_proof_state_1.expected.out +26 -0
  443. itp_interface/tools/repl/test/pickle_proof_state_1.in +15 -0
  444. itp_interface/tools/repl/test/pickle_proof_state_2.expected.out +4 -0
  445. itp_interface/tools/repl/test/pickle_proof_state_2.in +3 -0
  446. itp_interface/tools/repl/test/pickle_proof_state_env.expected.out +26 -0
  447. itp_interface/tools/repl/test/pickle_proof_state_env.in +15 -0
  448. itp_interface/tools/repl/test/pickle_scoped_notation.in +16 -0
  449. itp_interface/tools/repl/test/pickle_scoped_notation_2.in +3 -0
  450. itp_interface/tools/repl/test/proof_step.expected.out +18 -0
  451. itp_interface/tools/repl/test/proof_step.in +7 -0
  452. itp_interface/tools/repl/test/readme.expected.out +16 -0
  453. itp_interface/tools/repl/test/readme.in +5 -0
  454. itp_interface/tools/repl/test/sorry_hypotheses.expected.out +16 -0
  455. itp_interface/tools/repl/test/sorry_hypotheses.in +4 -0
  456. itp_interface/tools/repl/test/synthesize_placeholder.expected.out +7 -0
  457. itp_interface/tools/repl/test/synthesize_placeholder.in +1 -0
  458. itp_interface/tools/repl/test/tactic_mode_sorry.expected.out +14 -0
  459. itp_interface/tools/repl/test/tactic_mode_sorry.in +3 -0
  460. itp_interface/tools/repl/test/tactic_sorry.expected.out +12 -0
  461. itp_interface/tools/repl/test/tactic_sorry.in +1 -0
  462. itp_interface/tools/repl/test/term_sorry.expected.out +12 -0
  463. itp_interface/tools/repl/test/term_sorry.in +1 -0
  464. itp_interface/tools/repl/test/trace_simp.expected.out +41 -0
  465. itp_interface/tools/repl/test/trace_simp.in +15 -0
  466. itp_interface/tools/repl/test/unfinished_tactic_block.expected.out +11 -0
  467. itp_interface/tools/repl/test/unfinished_tactic_block.in +1 -0
  468. itp_interface/tools/repl/test/unknown_environment.expected.out +2 -0
  469. itp_interface/tools/repl/test/unknown_environment.in +1 -0
  470. itp_interface/tools/repl/test/unknown_proof_state.expected.out +14 -0
  471. itp_interface/tools/repl/test/unknown_proof_state.in +3 -0
  472. itp_interface/tools/repl/test/unknown_tactic.expected.out +14 -0
  473. itp_interface/tools/repl/test/unknown_tactic.in +3 -0
  474. itp_interface/tools/repl/test/variables.expected.out +26 -0
  475. itp_interface/tools/repl/test/variables.in +5 -0
  476. itp_interface/tools/repl/test.sh +43 -0
  477. itp_interface/tools/run_data_generation_transforms.py +350 -0
  478. itp_interface/tools/theorem_details.py +25 -0
  479. itp_interface/tools/training_data.py +358 -0
  480. itp_interface/tools/training_data_format.py +599 -0
  481. itp_interface-1.0.0.dist-info/METADATA +78 -0
  482. itp_interface-1.0.0.dist-info/RECORD +485 -0
  483. itp_interface-1.0.0.dist-info/WHEEL +4 -0
  484. itp_interface-1.0.0.dist-info/entry_points.txt +3 -0
  485. itp_interface-1.0.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,34 @@
1
+ #!/bin/bash
2
+ #! Name of the job:
3
+ #SBATCH -J cpujob
4
+ #! Which project should be charged:
5
+ #SBATCH -A JAMNIK-SL3-CPU
6
+ #! How many whole nodes should be allocated?
7
+ #SBATCH --nodes=1
8
+ #! How many (MPI) tasks will there be in total? (<= nodes*32)
9
+ #! The skylake/skylake-himem nodes have 32 CPUs (cores) each.
10
+ #SBATCH --ntasks=1
11
+ #! How much wallclock time will be required?
12
+ #SBATCH --time=01:00:00
13
+ #! What types of email messages do you wish to receive?
14
+ #SBATCH --mail-type=NONE
15
+ #! Uncomment this to prevent the job from being requeued (e.g. if
16
+ #! interrupted by node failure or system downtime):
17
+ ##SBATCH --no-requeue
18
+ #SBATCH -p skylake
19
+ #SBATCH --array=0-9%5
20
+
21
+ list=(
22
+ "bash scripts/extract_with_hammer_bashes/script_0.sh"
23
+ "bash scripts/extract_with_hammer_bashes/script_1.sh"
24
+ "bash scripts/extract_with_hammer_bashes/script_2.sh"
25
+ "bash scripts/extract_with_hammer_bashes/script_3.sh"
26
+ "bash scripts/extract_with_hammer_bashes/script_4.sh"
27
+ "bash scripts/extract_with_hammer_bashes/script_5.sh"
28
+ "bash scripts/extract_with_hammer_bashes/script_6.sh"
29
+ "bash scripts/extract_with_hammer_bashes/script_7.sh"
30
+ "bash scripts/extract_with_hammer_bashes/script_8.sh"
31
+ "bash scripts/extract_with_hammer_bashes/script_9.sh"
32
+ )
33
+
34
+ ${list[SLURM_ARRAY_TASK_ID]}
@@ -0,0 +1,25 @@
1
+ # Update and install zip
2
+ sudo apt-get update
3
+ sudo apt-get install zip
4
+ # Set up sdk
5
+ curl -s "https://get.sdkman.io" | bash
6
+ source "/home/qj213/.sdkman/bin/sdkman-init.sh"
7
+ source .bashrc
8
+ source .zshrc
9
+ # Install java and sbt
10
+ sdk install java 11.0.11-open
11
+ sdk install sbt
12
+ # Decompress and compile
13
+ (cd Portal-to-ISAbelle; tar -zxf universal_test_theorems.tar.gz; sbt compile)
14
+ cd ~
15
+ # Install Isabelle
16
+ wget https://isabelle.in.tum.de/website-Isabelle2021/dist/Isabelle2021_linux.tar.gz
17
+ tar -xzf Isabelle2021_linux.tar.gz
18
+ # Get afp
19
+ wget https://www.isa-afp.org/release/afp-2021-10-22.tar.gz
20
+ tar -xzf afp-2021-10-22.tar.gz
21
+ # Get heaps
22
+ wget https://storage.googleapis.com/n2formal-public-data/isabelle_heaps.tar.gz
23
+ tar -xzf isabelle_heaps.tar.gz
24
+ # Clean up
25
+ rm *.tar.gz
@@ -0,0 +1,60 @@
1
+ // Copyright 2015 The gRPC Authors
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ syntax = "proto3";
15
+
16
+ option java_multiple_files = true;
17
+ option java_package = "pisa";
18
+ option java_outer_classname = "ServerProto";
19
+ option objc_class_prefix = "SP";
20
+
21
+ package server;
22
+
23
+ service Server {
24
+ rpc InitialiseIsabelle (IsaPath) returns (IsaMessage) {}
25
+ rpc IsabelleContext (IsaContext) returns (IsaMessage) {}
26
+ rpc IsabelleWorkingDirectory (IsaPath) returns (IsaMessage) {}
27
+ rpc IsabelleCommand (IsaCommand) returns (IsaState) {}
28
+ rpc IsabelleSetSearchWidth (IsaSearchWidth) returns (IsaMessage) {}
29
+ rpc IsabelleSearchIndexCommand (IsaSearchIndexCommand) returns (IsaState) {}
30
+ }
31
+
32
+ message IsaPath {
33
+ string path = 1;
34
+ }
35
+
36
+ message IsaContext {
37
+ string context = 1;
38
+ }
39
+
40
+ message IsaMessage {
41
+ string message = 1;
42
+ }
43
+
44
+ message IsaCommand {
45
+ string command = 1;
46
+ }
47
+
48
+ message IsaState {
49
+ string state = 1;
50
+ }
51
+
52
+ message IsaSearchWidth {
53
+ int32 width = 1;
54
+ }
55
+
56
+ message IsaSearchIndexCommand {
57
+ int32 index = 1;
58
+ string command = 2;
59
+ }
60
+
@@ -0,0 +1,8 @@
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Datasource local storage ignored files
5
+ /dataSources/
6
+ /dataSources.local.xml
7
+ # Editor-based HTTP Client requests
8
+ /httpRequests/
@@ -0,0 +1,18 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
5
+ <Languages>
6
+ <language minSize="1220" name="Python" />
7
+ </Languages>
8
+ </inspection_tool>
9
+ <inspection_tool class="JupyterPackageInspection" enabled="false" level="WARNING" enabled_by_default="false" />
10
+ <inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
11
+ <option name="ignoredErrors">
12
+ <list>
13
+ <option value="N801" />
14
+ </list>
15
+ </option>
16
+ </inspection_tool>
17
+ </profile>
18
+ </component>
@@ -0,0 +1,6 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="Remote Python 3.8.2 (sftp://ajiang@vremote1.vectorinstitute.ai:22/h/ajiang/.conda/envs/smpl/bin/python)" project-jdk-type="Python SDK" />
4
+ </project>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/python.iml" filepath="$PROJECT_DIR$/.idea/python.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="PYTHON_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$" />
5
+ <orderEntry type="inheritedJdk" />
6
+ <orderEntry type="sourceFolder" forTests="false" />
7
+ </component>
8
+ <component name="PyDocumentationSettings">
9
+ <option name="format" value="PLAIN" />
10
+ <option name="myDocStringFormat" value="Plain" />
11
+ </component>
12
+ </module>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,59 @@
1
+ import os
2
+ import json
3
+ import glob
4
+ from tqdm import tqdm
5
+ import random
6
+
7
+ def process_string(input_string):
8
+ return " ".join(input_string.replace("\n", " ").split())
9
+
10
+ problem_names_split = json.load(open("data/fs_with_state/problem_names_split.json"))
11
+
12
+ train_names = problem_names_split['train']
13
+ val_names = problem_names_split['val']
14
+ test_names = problem_names_split['test']
15
+
16
+ train_theorem_names = {process_string(element[1]): element[0] for element in train_names}
17
+ val_theorem_names = {process_string(element[1]): element[0] for element in val_names}
18
+ test_theorem_names = {process_string(element[1]): element[0] for element in test_names}
19
+
20
+ total_theorems = {"train": set(), "val": set(), "test": set()}
21
+ for file_name in tqdm(glob.glob("data/conjecturer_extractions/**/*.src")):
22
+ tgt_file_name = file_name.replace("src", "tgt")
23
+ tgt_lines = open(tgt_file_name).readlines()
24
+
25
+ for i, line in enumerate(open(file_name).readlines()):
26
+ theorem_name = line.split("Proof:")[1].split("State:")[0].split("\\n")[0].strip()
27
+
28
+ if theorem_name in test_theorem_names:
29
+ save_file = os.path.join("data/conjecturer_seq2seq", "test.src")
30
+ total_theorems["test"].add(theorem_name)
31
+ elif theorem_name in val_theorem_names:
32
+ save_file = os.path.join("data/conjecturer_seq2seq", "val.src")
33
+ total_theorems["val"].add(theorem_name)
34
+ elif theorem_name in train_theorem_names:
35
+ save_file = os.path.join("data/conjecturer_seq2seq", "train.src")
36
+ total_theorems["train"].add(theorem_name)
37
+ else:
38
+ save_file = False
39
+ if save_file:
40
+ with open(save_file, "a") as fhand:
41
+ fhand.write(line)
42
+ with open(save_file.replace("src", "tgt"), "a") as f_tgt_hand:
43
+ f_tgt_hand.write(tgt_lines[i])
44
+
45
+ print("Total possible train theorems: {}".format(len(train_theorem_names)))
46
+ print("Conjecturing train theorems: {}".format(len(total_theorems["train"])))
47
+ print("Total possible test theorems: {}".format(len(test_theorem_names)))
48
+ print("Conjecturing test theorems: {}".format(len(total_theorems["test"])))
49
+
50
+ parsed_test_names = list(total_theorems["test"])
51
+ random.shuffle(parsed_test_names)
52
+ for i in range(3000):
53
+ json_to_save = [
54
+ [test_theorem_names[parsed_test_names[i]], parsed_test_names[i]]
55
+ ]
56
+ json.dump(json_to_save, open("universal_test_theorems/test_name_{}.json".format(i), "w"))
57
+
58
+ if i < 300:
59
+ json.dump(json_to_save, open("universal_test_theorems/quick_test_name_{}.json".format(i), "w"))
@@ -0,0 +1,184 @@
1
+ import json
2
+ import multiprocessing as mp
3
+
4
+ from pisa_client import initialise_env
5
+ from utils.pisa_server_control import start_server, close_server
6
+
7
+
8
+ def analyse_file_string(whole_file_string):
9
+ transitions = whole_file_string.split("<\TRANSEP>")
10
+ state_action_proof_level_tuples = list()
11
+ problem_names = list()
12
+ for transition in transitions:
13
+ if not transition:
14
+ continue
15
+ else:
16
+ state, action, proof_level = transition.split("<\STATESEP>")
17
+ hammer_results = "NA"
18
+ state = state.strip()
19
+ action = action.strip()
20
+ proof_level = int(proof_level.strip())
21
+ if (action.startswith("lemma") or action.startswith("theorem")) and not action.startswith("lemmas"):
22
+ problem_names.append(action)
23
+ state_action_proof_level_tuples.append((state, action, proof_level, hammer_results))
24
+ return {
25
+ "problem_names": problem_names,
26
+ "translations": state_action_proof_level_tuples
27
+ }
28
+
29
+
30
+ def extract_a_file_from_params(
31
+ jar_path,
32
+ isabelle_path,
33
+ working_directory,
34
+ theory_file_path,
35
+ saving_path,
36
+ error_path,
37
+ sub_saving_path,
38
+ sub_error_path
39
+ ):
40
+ env = None
41
+
42
+ if os.path.isfile(saving_path):
43
+ return
44
+ try:
45
+ # Figure out the parameters to start the server
46
+ identity = mp.current_process()._identity
47
+ if identity:
48
+ rank = identity[0] % 200
49
+ else:
50
+ rank = 0
51
+ port = 8000 + rank
52
+ server_subprocess_id = start_server(jar_path, port,
53
+ outputfile=sub_saving_path, errorfile=sub_error_path)
54
+ # Getting the environment
55
+ env = initialise_env(
56
+ port=port,
57
+ isa_path=isabelle_path,
58
+ theory_file_path=theory_file_path,
59
+ working_directory=working_directory,
60
+ )
61
+ whole_file_string = env.post("PISA extract data")
62
+ # Parse the string and dump
63
+ analysed_file = analyse_file_string(whole_file_string)
64
+ analysed_file["theory_file_path"] = theory_file_path
65
+ analysed_file["working_directory"] = working_directory
66
+ json.dump(analysed_file, open(saving_path, "w"))
67
+
68
+ except Exception as e:
69
+ print(e)
70
+ json.dump({"error": str(e)}, open(error_path, "w"))
71
+
72
+ # Clean up
73
+ del env
74
+ close_server(server_subprocess_id)
75
+
76
+
77
+ def extract_a_file(params_path):
78
+ """
79
+ Extracts the data from a single file.
80
+
81
+ :param params_path: Path to the JSON file containing the parameters.
82
+ :param rank: Rank of the process in the subprocess pool.
83
+ :return: None
84
+ """
85
+ # Load the parameters
86
+ params = json.load(open(params_path))
87
+ jar_path = params["jar_path"]
88
+ isabelle_path = params["isabelle_path"]
89
+ working_directory = params["working_directory"]
90
+ theory_file_path = params["theory_file_path"]
91
+ saving_path = params["saving_path"]
92
+ error_path = params["error_path"]
93
+ sub_saving_path = params["sub_saving_path"]
94
+ sub_error_path = params["sub_error_path"]
95
+
96
+ extract_a_file_from_params(
97
+ jar_path,
98
+ isabelle_path,
99
+ working_directory,
100
+ theory_file_path,
101
+ saving_path,
102
+ error_path,
103
+ sub_saving_path,
104
+ sub_error_path,
105
+ )
106
+
107
+
108
+ if __name__ == "__main__":
109
+ import glob
110
+ import os
111
+ import argparse
112
+ from tqdm import tqdm
113
+ parser = argparse.ArgumentParser(description='Extracting transition data from theory files.')
114
+ parser.add_argument('--jar-path', '-jp', help='Path to the jar file', default=None)
115
+ parser.add_argument('--isabelle-path', '-ip', help='Path to the Isabelle installation', default=None)
116
+ parser.add_argument('--extraction-file-directory', '-efd', help='Where the parsed json files are')
117
+ parser.add_argument('--saving-directory', '-sd', help='Where to save the translation pairs')
118
+ args = parser.parse_args()
119
+
120
+ jar_path = args.jar_path
121
+ if jar_path is None:
122
+ jar_path = "/home/qj213/Portal-to-ISAbelle/target/scala-2.13/PISA-assembly-0.1.jar"
123
+ isabelle_path = args.isabelle_path
124
+ if isabelle_path is None:
125
+ isabelle_path = "/home/qj213/Isabelle2022"
126
+ extraction_file_directory = args.extraction_file_directory
127
+ saving_directory = args.saving_directory
128
+ if not os.path.isdir(saving_directory):
129
+ os.makedirs(saving_directory)
130
+
131
+ output_data_path = os.path.join(saving_directory, "data")
132
+ output_param_path = os.path.join(saving_directory, "params")
133
+ if not os.path.isdir(output_data_path):
134
+ os.makedirs(output_data_path)
135
+ if not os.path.isdir(output_param_path):
136
+ os.makedirs(output_param_path)
137
+
138
+ # extraction_file_directory = "/home/qj213/afp-2022-12-06/thys"
139
+ # extraction_file_directory = "/home/qj213/Isabelle2022/src/HOL"
140
+ # saving_directory = "/home/qj213/afp_extractions"
141
+ # saving_directory = "/home/qj213/std_extractions"
142
+
143
+ files = glob.glob(extraction_file_directory.rstrip("/") + '/**/*.thy', recursive=True)
144
+ param_paths = list()
145
+
146
+ for file_path in tqdm(files):
147
+ identifier = file_path.replace("/", "_")
148
+
149
+ if "thys" in file_path:
150
+ bits = file_path.split("/")
151
+ thys_index = bits.index("thys")
152
+ working_directory = "/".join(bits[:thys_index + 2])
153
+ elif "src/HOL" in file_path:
154
+ bits = file_path.split("/")
155
+ hol_index = bits.index("HOL")
156
+ bits = bits[:-1]
157
+ bits = bits[:hol_index + 2]
158
+ working_directory = "/".join(bits)
159
+ else:
160
+ raise AssertionError
161
+ saving_path = f"{output_data_path}/{identifier}_output.json"
162
+ error_path = f"{output_data_path}/{identifier}_error.json"
163
+ sub_saving_path = f"{output_data_path}/{identifier}_subout.json"
164
+ sub_error_path = f"{output_data_path}/{identifier}_suberr.json"
165
+ if os.path.exists(saving_path) or os.path.exists(error_path):
166
+ continue
167
+ params = {
168
+ "jar_path": jar_path,
169
+ "isabelle_path": isabelle_path,
170
+ "working_directory": working_directory,
171
+ "theory_file_path": file_path,
172
+ "saving_path": saving_path,
173
+ "error_path": error_path,
174
+ "sub_saving_path": sub_saving_path,
175
+ "sub_error_path": sub_error_path
176
+ }
177
+ param_path = os.path.join(output_param_path, f"{identifier}.json")
178
+ json.dump(params, open(param_path, "w"))
179
+
180
+ param_paths.append(param_path)
181
+
182
+ print(f"Extracting {len(param_paths)} files in total.")
183
+ with mp.Pool(processes=int(mp.cpu_count()/8)) as pool:
184
+ pool.map(extract_a_file, param_paths)
@@ -0,0 +1,221 @@
1
+ import json
2
+ import multiprocessing as mp
3
+
4
+ from utils.pisa_server_control import start_server, close_server
5
+ from pisa_client import initialise_env
6
+
7
+
8
+ def find_actual_name_indices(decorated_name):
9
+ # Give the actual name starting and ending indices of a theorem given its decorated name
10
+ # Example: decorated_name = (in bidirected_digraph) has_dom_arev[simp]
11
+ # actual_name = had_dom_arev
12
+ length = len(decorated_name)
13
+ if length == 0:
14
+ return 0, 0
15
+ si = 0
16
+ all_actual_indices = []
17
+ mode = "normal"
18
+ while si < length:
19
+ if decorated_name[si] == "(":
20
+ mode = "("
21
+ elif decorated_name[si] == ")":
22
+ assert mode == "("
23
+ mode = "normal"
24
+ elif decorated_name[si] == "[":
25
+ mode = "["
26
+ elif decorated_name[si] == "]":
27
+ assert mode == "["
28
+ mode = "normal"
29
+ elif mode == "normal":
30
+ all_actual_indices.append(si)
31
+ else:
32
+ pass
33
+ # print(si, decorated_name[si])
34
+ si += 1
35
+ assert all([index+1 == all_actual_indices[i+1] for i, index in enumerate(all_actual_indices[:-1])]), (all_actual_indices, decorated_name)
36
+ return all_actual_indices[0], all_actual_indices[-1]
37
+
38
+
39
+ def find_premises_from_a_file(path_dict):
40
+ problems_path = path_dict["problems_path"]
41
+ jar_path = path_dict["jar_path"]
42
+ saving_directory = path_dict["saving_directory"]
43
+ server_dump_path = path_dict["server_dump_path"]
44
+
45
+ saving_path = os.path.join(
46
+ saving_directory,
47
+ os.path.basename(problems_path).replace("thy_problems.json", "thy_premises.jsonl")
48
+ )
49
+ error_path = saving_path.replace("thy_premises.jsonl", "thy_errors.txt")
50
+
51
+ if os.path.isfile(saving_path) or os.path.isfile(error_path):
52
+ return
53
+
54
+ if server_dump_path is None:
55
+ server_output_path, server_error_path = None, None
56
+ else:
57
+ server_output_path = os.path.join(
58
+ server_dump_path,
59
+ os.path.basename(problems_path).replace("thy_problems.json", "thy_server_output.txt")
60
+ )
61
+ server_error_path = os.path.join(
62
+ server_dump_path,
63
+ os.path.basename(problems_path).replace("thy_problems.json", "thy_server_error.txt")
64
+ )
65
+
66
+ problems_json = json.load(open(problems_path))
67
+ theory_file_path = problems_json["theory_file_path"]
68
+ working_directory = problems_json["working_directory"]
69
+ problems = problems_json["problems"]
70
+
71
+ env = None
72
+ server_subprocess_id = None
73
+ try:
74
+ # Figure out the parameters to start the server
75
+ identity = mp.current_process()._identity
76
+ if identity:
77
+ rank = identity[0] % 200
78
+ else:
79
+ rank = 0
80
+ port = 8000 + rank
81
+
82
+ server_subprocess_id = start_server(
83
+ jar_path, port, outputfile=server_output_path, errorfile=server_error_path
84
+ )
85
+
86
+ # Getting the environment
87
+ print(f"Port: {port}")
88
+ env = initialise_env(
89
+ port=port,
90
+ isa_path=isabelle_path,
91
+ theory_file_path=theory_file_path,
92
+ working_directory=working_directory,
93
+ )
94
+
95
+ # Find the premises to each problem
96
+ premises = []
97
+ # print(len(problems))
98
+ for problem in problems:
99
+ try:
100
+ # As an example
101
+ # lemma easy [simp]: "1+2=3"
102
+ # by auto
103
+ # problem_name = 'lemma easy [simp]: "1+2=3"'
104
+ # only_name = 'easy'
105
+ # proof_body = '"1+2=3"\n by auto'
106
+ # full_proof_text = 'lemma easy [simp]: "1+2=3"
107
+ # by auto'
108
+ # full_name = 'easy [simp]'
109
+
110
+ problem_name = problem["problem_name"].strip()
111
+ # print(problem_name)
112
+ assert problem_name.startswith("lemma") or problem_name.startswith("theorem"), problem_name
113
+ only_name = problem_name.lstrip("lemma").lstrip("theorem").strip()
114
+
115
+ full_proof_text = problem["full_proof_text"]
116
+ transitions = problem["transitions"]
117
+ if ":" not in only_name:
118
+ proof_body = only_name.strip() + "\n" + "\n".join([element[1].strip() for element in transitions][1:]).strip()
119
+ only_name = ""
120
+ else:
121
+ only_name = only_name.split(":")[0].strip()
122
+ proof_body = ":".join(full_proof_text.strip().split(":")[1:]).strip()
123
+
124
+ # print(proof_body, full_proof_text)
125
+
126
+ actual_name_si, actual_name_ei = find_actual_name_indices(only_name)
127
+ full_name = only_name
128
+ only_name = only_name[actual_name_si:actual_name_ei+1]
129
+
130
+ split = problem["split"]
131
+ # print(f"Problem name: {problem_name}. Only name: {only_name}.")
132
+ # print(0.0, full_proof_text)
133
+ env.accumulative_step_before_theorem_starts(problem_name)
134
+ env.accumulative_step_through_a_theorem()
135
+ premises_and_their_definitions = env.get_premises_and_their_definitions(full_name, only_name, proof_body)
136
+
137
+ # premises_and_their_definitions = env.get_premises_and_their_definitions(
138
+ # problem_name, only_name, full_proof_text
139
+ # )
140
+ # env.proceed_until_end_of_theorem_proof(problem_name)
141
+ # print(premises_and_their_definitions)
142
+ premises.append(
143
+ {
144
+ "theory_file_path": theory_file_path,
145
+ "working_directory": working_directory,
146
+ "problem_name": problem_name,
147
+ "only_name": only_name,
148
+ "premises_and_their_definitions": premises_and_their_definitions,
149
+ "full_proof_text": full_proof_text,
150
+ "split": split,
151
+ }
152
+ )
153
+ except Exception as excp:
154
+ print(excp)
155
+ continue
156
+ # print(saving_path)
157
+ with open(saving_path, "w") as fout:
158
+ for premise in premises:
159
+ fout.write(json.dumps(premise) + "\n")
160
+
161
+ except Exception as e:
162
+ print(e)
163
+ with open(error_path, "w") as fout:
164
+ fout.write(str(e))
165
+
166
+ # Clean up
167
+ del env
168
+ if server_subprocess_id is not None:
169
+ close_server(server_subprocess_id)
170
+
171
+
172
+ if __name__ == "__main__":
173
+ import argparse
174
+ import glob
175
+ import os
176
+ parser = argparse.ArgumentParser(description='Extracting translation pairs.')
177
+ parser.add_argument('--extraction-file-directory', '-efd', help='Where the parsed json files are')
178
+ parser.add_argument('--saving-directory', '-sd', help='Where to save the translation pairs')
179
+ parser.add_argument('--server-dump-path', '-sdp', help="Where to dump the server's output")
180
+ parser.add_argument('--jar-path', '-jp', help='Path to the jar file',
181
+ default="/home/qj213/Portal-to-ISAbelle/target/scala-2.13/PISA-assembly-0.1.jar")
182
+ parser.add_argument('--isabelle-path', '-ip', help='Path to the Isabelle installation',
183
+ default="/home/qj213/Isabelle2022")
184
+ args = parser.parse_args()
185
+
186
+ extraction_file_directory = args.extraction_file_directory
187
+ saving_directory = args.saving_directory
188
+ jar_path = args.jar_path
189
+ isabelle_path = args.isabelle_path
190
+ server_dump_path = args.server_dump_path
191
+
192
+ if not os.path.exists(saving_directory):
193
+ os.makedirs(saving_directory)
194
+
195
+ files = glob.glob(f"{extraction_file_directory}/**/*.thy_problems.json", recursive=True)
196
+ list_of_path_dicts = [
197
+ {
198
+ "problems_path": file,
199
+ "saving_directory": saving_directory,
200
+ "jar_path": jar_path,
201
+ "isabelle_path": isabelle_path,
202
+ "server_dump_path": server_dump_path,
203
+ }
204
+ for file in files
205
+ ]
206
+
207
+ with mp.Pool(processes=int(mp.cpu_count()/8)) as pool:
208
+ # with mp.Pool(processes=1) as pool:
209
+ pool.map(find_premises_from_a_file, list_of_path_dicts)
210
+
211
+ # print(list_of_path_dicts[1])
212
+ # find_premises_from_a_file(list_of_path_dicts[1])
213
+ # find_premises_from_a_file(
214
+ # {
215
+ # "problems_path": "/home/qj213/problems/afp/_home_qj213_afp-2022-12-06_thys_Formal_SSA_Construct_SSA.thy_problems.json",
216
+ # "saving_directory": saving_directory,
217
+ # "jar_path": jar_path,
218
+ # "isabelle_path": isabelle_path,
219
+ # "server_dump_path": server_dump_path,
220
+ # }
221
+ # )