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,136 @@
1
+ #!/usr/bin/env python3
2
+
3
+ import sys
4
+ root_dir = f"{__file__.split('itp_interface')[0]}"
5
+ if root_dir not in sys.path:
6
+ sys.path.append(root_dir)
7
+ import typing
8
+ import uuid
9
+ from itp_interface.tools.lean_cmd_executor import Lean3Executor
10
+ from itp_interface.tools.lean_context_helper import Lean3ContextHelper
11
+ from itp_interface.tools.coq_training_data_generator import GenericTrainingDataGenerationTransform, TrainingDataGenerationType
12
+ from itp_interface.tools.training_data_format import Goal, MergableCollection, TrainingDataMetadataFormat, TrainingDataCollection, TrainingDataFormat
13
+ from itp_interface.tools.training_data import TrainingData
14
+
15
+ class LocalDataGenerationTransform(GenericTrainingDataGenerationTransform):
16
+ def __init__(self,
17
+ depth = None,
18
+ max_search_results = None,
19
+ buffer_size : int = 10000,
20
+ logger = None,
21
+ max_parallelism : int = 4):
22
+ super().__init__(TrainingDataGenerationType.LOCAL, buffer_size, logger)
23
+ self.depth = depth
24
+ self.max_search_results = max_search_results
25
+ self.max_parallelism = max_parallelism
26
+
27
+ def get_meta_object(self) -> MergableCollection:
28
+ return TrainingDataMetadataFormat(training_data_buffer_size=self.buffer_size)
29
+
30
+ def get_data_collection_object(self) -> MergableCollection:
31
+ return TrainingDataCollection()
32
+
33
+ def load_meta_from_file(self, file_path) -> MergableCollection:
34
+ return TrainingDataMetadataFormat.load_from_file(file_path)
35
+
36
+ def load_data_from_file(self, file_path) -> MergableCollection:
37
+ return TrainingDataCollection.load_from_file(file_path, self.logger)
38
+
39
+ def __call__(self, training_data: TrainingData, project_id : str, lean_executor: Lean3Executor, print_coq_executor_callback: typing.Callable[[], Lean3Executor], theorems: typing.List[str] = None, other_args: dict = {}) -> TrainingData:
40
+ print_lean_executor = print_coq_executor_callback()
41
+ lean_context_helper = Lean3ContextHelper(print_lean_executor, self.depth, self.logger)
42
+ lean_context_helper.__enter__()
43
+ file_namespace = lean_executor.main_file.replace('/', '.')
44
+ self.logger.info(f"=========================Processing {file_namespace}=========================")
45
+ proof_running = False
46
+ cmd_ran = lean_executor.run_next()
47
+ cmd_exec = lean_executor.current_stmt
48
+ prev_goal : typing.List[Goal] = lean_context_helper.get_focussed_goals(lean_executor) if lean_executor.is_in_proof_mode() else []
49
+ line_number = lean_executor.line_num
50
+ lemma_name = lean_executor.get_lemma_name_if_running()
51
+ if lemma_name is None:
52
+ lemma_name = "__NONE__"
53
+ theorem_id = str(uuid.uuid4())
54
+ proof_id = theorem_id # self.get_proof_id(theorem_id, file_namespace, line_number, lemma_name)
55
+ local_lemma_refs_cnt = 0
56
+ external_lemma_refs_cnt = 0
57
+ theorems = set(theorems) if theorems is not None else None
58
+ while cmd_ran:
59
+ if lean_executor.is_in_proof_mode() and lemma_name != "__NONE__" and (theorems is None or lemma_name in theorems):
60
+ proof_running = True
61
+ prev_goal : typing.List[Goal] = [Goal(goal.hypotheses, goal.goal) for goal in prev_goal]
62
+ next_goal : typing.List[Goal] = lean_context_helper.get_focussed_goals(lean_executor)
63
+ if len(prev_goal) > 0:
64
+ training_data_format = TrainingDataFormat(
65
+ proof_id=proof_id,
66
+ all_useful_defns_theorems=[],
67
+ start_goals=prev_goal,
68
+ end_goals=next_goal,
69
+ proof_steps=[cmd_exec],
70
+ simplified_goals=[],
71
+ addition_state_info={},
72
+ file_path=lean_executor.main_file,
73
+ theorem_name=lemma_name,
74
+ project_id=project_id)
75
+ assert len(training_data_format.proof_steps) > 0, f"Proof steps cannot be empty for {proof_id}"
76
+ for goal in training_data_format.start_goals:
77
+ lemma_cnt = len(training_data_format.all_useful_defns_theorems)
78
+ assert all([0 <= lemma_ref.lemma_idx < lemma_cnt for lemma_ref in goal.used_theorems_local]), f"Invalid lemma idx in {proof_id}"
79
+ assert all([0 <= lemma_ref.lemma_idx < lemma_cnt for lemma_ref in goal.used_theorems_external]), f"Invalid lemma idx in {proof_id}"
80
+ assert all([0 <= lemma_ref.lemma_idx < lemma_cnt for lemma_ref in goal.possible_useful_theorems_external]), f"Invalid lemma idx in {proof_id}"
81
+ assert all([0 <= lemma_ref.lemma_idx < lemma_cnt for lemma_ref in goal.possible_useful_theorems_local]), f"Invalid lemma idx in {proof_id}"
82
+ training_data.merge(training_data_format)
83
+ local_lemma_refs_cnt += sum([len(goal.used_theorems_local) for goal in training_data_format.start_goals])
84
+ external_lemma_refs_cnt += sum([len(goal.used_theorems_external) for goal in training_data_format.start_goals])
85
+ prev_goal = next_goal
86
+ else:
87
+ prev_goal = []
88
+ cmd_ran = lean_executor.run_next()
89
+ cmd_exec = lean_executor.current_stmt
90
+ line_number = lean_executor.line_num
91
+ if proof_running and not lean_executor.is_in_proof_mode():
92
+ proof_running = False
93
+ self.logger.info(f"Finished processing lemma [{theorem_id}] {lemma_name}")
94
+ theorem_id = str(uuid.uuid4())
95
+ lemma_name = lean_executor.get_lemma_name_if_running()
96
+ if lemma_name is None:
97
+ lemma_name = "__NONE__"
98
+ proof_id = theorem_id # self.get_proof_id(theorem_id, file_namespace, line_number, lemma_name)
99
+
100
+ self.logger.info(f"===============Finished processing {file_namespace}=====================")
101
+ try:
102
+ lean_context_helper.__exit__(None, None, None)
103
+ except:
104
+ pass
105
+
106
+
107
+ if __name__ == "__main__":
108
+ import os
109
+ import logging
110
+ import time
111
+ os.chdir(root_dir)
112
+ project_dir = "data/test/lean_proj"
113
+ file_name = "data/test/lean_proj/src/simple_solved.lean"
114
+ project_id = project_dir.replace('/', '.')
115
+ time_str = time.strftime("%Y%m%d-%H%M%S")
116
+ output_path = f".log/local_data_generation_transform/data/{time_str}"
117
+ log_path = f".log/local_data_generation_transform/log/{time_str}"
118
+ log_file = f"{log_path}/local_data_generation_transform-{time_str}.log"
119
+ os.makedirs(output_path, exist_ok=True)
120
+ os.makedirs(log_path, exist_ok=True)
121
+ logging.basicConfig(filename=log_file, level=logging.INFO, format='%(asctime)s %(levelname)s %(message)s')
122
+ logger = logging.getLogger(__name__)
123
+ def _print_lean_executor_callback():
124
+ search_lean_exec = Lean3Executor(project_root=project_dir, main_file=file_name, use_human_readable_proof_context=True, suppress_error_log=True)
125
+ search_lean_exec.__enter__()
126
+ return search_lean_exec
127
+ transform = LocalDataGenerationTransform(0, buffer_size=1000)
128
+ training_data = TrainingData(
129
+ output_path,
130
+ "training_metadata.json",
131
+ training_meta=transform.get_meta_object(),
132
+ logger=logger)
133
+ with Lean3Executor(project_root=project_dir, main_file=file_name, use_human_readable_proof_context=True, suppress_error_log=True) as coq_exec:
134
+ transform(training_data, project_id, coq_exec, _print_lean_executor_callback)
135
+ save_info = training_data.save()
136
+ logger.info(f"Saved training data to {save_info}")
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env python3
2
+
3
+ import sys
4
+
5
+
6
+ root_dir = f"{__file__.split('itp_interface')[0]}"
7
+ if root_dir not in sys.path:
8
+ sys.path.append(root_dir)
9
+ import typing
10
+ from itp_interface.lean_server.lean_utils import Lean3Utils
11
+
12
+ class LeanLineByLineReader(object):
13
+ def __init__(self, file_name: str = None, file_content: str = None, remove_comments: bool = False, no_strip: bool = False):
14
+ assert file_name is not None or file_content is not None, "Either file_name or file_content must be provided"
15
+ assert file_name is None or file_content is None, "Only one of file_name or file_content must be provided"
16
+ self.file_name : str = file_name
17
+ self.file_content : str = file_content
18
+ self.no_strip = no_strip
19
+ if self.file_name is not None:
20
+ with open(file_name, 'r') as fd:
21
+ self.file_content : str = fd.read()
22
+ if remove_comments:
23
+ self.file_content = Lean3Utils.remove_comments(self.file_content)
24
+
25
+ def instruction_step_generator(self) -> typing.Iterator[str]:
26
+ lines = self.file_content.split('\n')
27
+ for line in lines:
28
+ if not self.no_strip:
29
+ line = line.strip()
30
+ else:
31
+ line = line
32
+ yield line
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env python3
2
+
3
+ import sys
4
+
5
+ root_dir = f"{__file__.split('itp_interface')[0]}"
6
+ if root_dir not in sys.path:
7
+ sys.path.append(root_dir)
8
+ import logging
9
+
10
+ def setup_logger(name, log_file, level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'):
11
+ """To setup as many loggers as you want"""
12
+
13
+ handler = logging.FileHandler(log_file)
14
+ formatter = logging.Formatter(format)
15
+ handler.setFormatter(formatter)
16
+
17
+ logger = logging.getLogger(name)
18
+ logger.setLevel(level)
19
+ logger.addHandler(handler)
20
+ return logger
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env python3
2
+
3
+ import sys
4
+
5
+ root_dir = f"{__file__.split('itp_interface')[0]}"
6
+ if root_dir not in sys.path:
7
+ sys.path.append(root_dir)
8
+ import logging
9
+ import typing
10
+ from itp_interface.rl.proof_action import ProofAction
11
+ from itp_interface.tools.coq_context_helper import CoqContextHelper
12
+ from itp_interface.tools.lean_context_helper import Lean3ContextHelper
13
+ from itp_interface.tools.lean4_context_helper import Lean4ContextHelper
14
+ from itp_interface.tools.isabelle_context_helper import IsabelleContextHelper
15
+ from itp_interface.tools.coq_executor import CoqExecutor
16
+ from itp_interface.tools.lean_cmd_executor import Lean3Executor
17
+ from itp_interface.tools.lean4_sync_executor import Lean4SyncExecutor
18
+ from itp_interface.tools.isabelle_executor import IsabelleExecutor
19
+ from itp_interface.tools.dynamic_coq_proof_exec import DynamicProofExecutor as DynamicCoqProofExecutor
20
+ from itp_interface.tools.dynamic_lean_proof_exec import DynamicProofExecutor as DynamicLeanProofExecutor
21
+ from itp_interface.tools.dynamic_lean4_proof_exec import DynamicProofExecutor as DynamicLean4ProofExecutor
22
+ from itp_interface.tools.dynamic_isabelle_proof_exec import DynamicProofExecutor as DynamicIsabelleProofExecutor
23
+
24
+ class ProofExecutorCallback(object):
25
+ def __init__(self,
26
+ project_folder: str,
27
+ file_path: str,
28
+ language: ProofAction.Language = ProofAction.Language.COQ,
29
+ prefix: str = None,
30
+ use_hammer: bool = False,
31
+ timeout_in_secs: int = 60,
32
+ use_human_readable_proof_context: bool = True,
33
+ suppress_error_log: bool = True,
34
+ search_depth: int = 0,
35
+ logger: logging.Logger = None,
36
+ always_use_retrieval: bool = False,
37
+ keep_local_context: bool = False,
38
+ setup_cmds: typing.List[str] = [],
39
+ port: typing.Optional[int] = None,
40
+ enable_search: bool = True):
41
+ self.project_folder = project_folder
42
+ self.file_path = file_path
43
+ self.language = language
44
+ self.use_hammer = use_hammer
45
+ self.timeout_in_secs = timeout_in_secs
46
+ self.use_human_readable_proof_context = use_human_readable_proof_context
47
+ self.suppress_error_log = suppress_error_log
48
+ self.search_depth = search_depth
49
+ self.logger = logger
50
+ self.prefix = prefix
51
+ self.always_use_retrieval = always_use_retrieval
52
+ self.keep_local_context = keep_local_context
53
+ self.setup_cmds = setup_cmds
54
+ self.port = port
55
+ self.enable_search = enable_search
56
+ pass
57
+
58
+ def get_proof_executor(self) -> typing.Union[DynamicCoqProofExecutor, DynamicLeanProofExecutor, DynamicLean4ProofExecutor, DynamicIsabelleProofExecutor]:
59
+ if self.language == ProofAction.Language.COQ:
60
+ search_exec = CoqExecutor(self.project_folder, self.file_path, use_hammer=self.use_hammer, timeout_in_sec=self.timeout_in_secs, suppress_error_log=self.suppress_error_log, use_human_readable_proof_context=self.use_human_readable_proof_context, setup_cmds=self.setup_cmds)
61
+ coq_context_helper = CoqContextHelper(search_exec, self.search_depth, logger=self.logger, enable_search=self.enable_search)
62
+ return DynamicCoqProofExecutor(coq_context_helper, self.project_folder, self.file_path, context_type=DynamicCoqProofExecutor.ContextType.BestContext, use_hammer=self.use_hammer, timeout_in_seconds=self.timeout_in_secs, suppress_error_log=self.suppress_error_log, use_human_readable_proof_context=self.use_human_readable_proof_context, setup_cmds=self.setup_cmds)
63
+ elif self.language == ProofAction.Language.LEAN:
64
+ search_exec = Lean3Executor(self.project_folder, self.prefix, self.file_path, use_hammer=self.use_hammer, timeout_in_sec=self.timeout_in_secs, suppress_error_log=self.suppress_error_log, use_human_readable_proof_context=self.use_human_readable_proof_context, enable_search=self.always_use_retrieval, keep_local_context=self.keep_local_context)
65
+ lean_context_helper = Lean3ContextHelper(search_exec, self.search_depth, logger=self.logger)
66
+ return DynamicLeanProofExecutor(lean_context_helper, self.project_folder, self.file_path, context_type=DynamicLeanProofExecutor.ContextType.NoContext, use_hammer=self.use_hammer, timeout_in_seconds=self.timeout_in_secs, suppress_error_log=self.suppress_error_log, use_human_readable_proof_context=self.use_human_readable_proof_context, keep_local_context=self.keep_local_context)
67
+ elif self.language == ProofAction.Language.LEAN4:
68
+ search_exec = Lean4SyncExecutor(self.project_folder, self.prefix, self.file_path, use_hammer=self.use_hammer, timeout_in_sec=self.timeout_in_secs, suppress_error_log=self.suppress_error_log, use_human_readable_proof_context=self.use_human_readable_proof_context, enable_search=self.always_use_retrieval, keep_local_context=self.keep_local_context)
69
+ lean4_context_helper = Lean4ContextHelper(search_exec, self.search_depth, logger=self.logger)
70
+ return DynamicLean4ProofExecutor(lean4_context_helper, self.project_folder, self.file_path, context_type=DynamicLeanProofExecutor.ContextType.NoContext, use_hammer=self.use_hammer, timeout_in_seconds=self.timeout_in_secs, suppress_error_log=self.suppress_error_log, use_human_readable_proof_context=self.use_human_readable_proof_context, keep_local_context=self.keep_local_context)
71
+ elif self.language == ProofAction.Language.ISABELLE:
72
+ search_exec = IsabelleExecutor(self.project_folder, self.file_path, use_hammer=self.use_hammer, timeout_in_sec=self.timeout_in_secs, suppress_error_log=self.suppress_error_log, use_human_readable_proof_context=self.use_human_readable_proof_context, port=self.port)
73
+ isabelle_context_helper = IsabelleContextHelper(search_exec, self.search_depth, logger=self.logger)
74
+ return DynamicIsabelleProofExecutor(isabelle_context_helper, self.project_folder, self.file_path, context_type=DynamicIsabelleProofExecutor.ContextType.BestContext, use_hammer=self.use_hammer, timeout_in_seconds=self.timeout_in_secs, suppress_error_log=self.suppress_error_log, use_human_readable_proof_context=self.use_human_readable_proof_context, port=self.port)
75
+ else:
76
+ raise Exception(f"Unknown context type: {self.context_type}")
@@ -0,0 +1,265 @@
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 asyncio
8
+ import time
9
+ import ray
10
+ import typing
11
+ import psutil
12
+ import logging
13
+ import gc
14
+
15
+ class RayUtils(object):
16
+
17
+ @staticmethod
18
+ def init_ray(num_of_cpus: int = 10, object_store_memory_in_gb: float = 25, memory_in_gb: float = 0.5, runtime_env: typing.Dict[str, str] = None):
19
+ gb = 2**30
20
+ object_store_memory = int(object_store_memory_in_gb * gb)
21
+ memory = int(memory_in_gb * gb)
22
+ return ray.init(num_cpus=num_of_cpus, object_store_memory=object_store_memory, _memory=memory, ignore_reinit_error=True, runtime_env=runtime_env)
23
+
24
+ @staticmethod
25
+ def ray_run_within_parallel_limits(
26
+ max_parallel: int,
27
+ num_objects: int,
28
+ transform_outputs: typing.Callable[[typing.List[typing.Any]], None],
29
+ prepare_next: typing.Callable[[int], typing.List[typing.Any]],
30
+ create_remotes: typing.Callable[[typing.List[typing.Any]], typing.List[typing.Any]],
31
+ logger: logging.Logger = None,
32
+ turn_off_logging: bool = False
33
+ ):
34
+ logger = logger or logging.getLogger(__name__)
35
+ idx = 0
36
+ next_batch = prepare_next(max_parallel)
37
+ if not turn_off_logging:
38
+ logger.info(f"Loading next_batch: {len(next_batch)}, max_parallel: {max_parallel}")
39
+ assert len(next_batch) <= max_parallel, f"next_batch: {len(next_batch)}, max_parallel: {max_parallel}"
40
+ process = psutil.Process()
41
+ if not turn_off_logging:
42
+ logger.info(f"[Process Id = {process.pid}] [After Next Batch] Memory used: {process.memory_info().rss/2**30} GiB")
43
+ remotes = create_remotes(next_batch)
44
+ process = psutil.Process()
45
+ if not turn_off_logging:
46
+ logger.info(f"[Process Id = {process.pid}] [After Create] Memory used: {process.memory_info().rss/2**30} GiB")
47
+ logger.info(f"Created remotes: {len(remotes)}")
48
+ diff_remotes = len(remotes)
49
+ while idx < num_objects or len(remotes) > 0:
50
+ idx += diff_remotes
51
+ idx = min(idx, num_objects)
52
+ if not turn_off_logging:
53
+ logger.info(f"Waiting for idx: {idx}, num_objects: {num_objects}, len(remotes): {len(remotes)}")
54
+ ready, remotes = ray.wait(remotes)
55
+ if len(ready) > 0:
56
+ if not turn_off_logging:
57
+ logger.info(f"Got ready: {len(ready)}")
58
+ process = psutil.Process()
59
+ if not turn_off_logging:
60
+ logger.info(f"[Process Id = {process.pid}] [After Ready] Memory used: {process.memory_info().rss/2**30} GiB")
61
+ results = ray.get(ready)
62
+ transform_outputs(results)
63
+ process = psutil.Process()
64
+ if not turn_off_logging:
65
+ logger.info(f"[Process Id = {process.pid}] [After Transform] Memory used: {process.memory_info().rss/2**30} GiB")
66
+ next_batch = prepare_next(len(results))
67
+ process = psutil.Process()
68
+ if not turn_off_logging:
69
+ logger.info(f"[Process Id = {process.pid}] [After Next Batch] Memory used: {process.memory_info().rss/2**30} GiB")
70
+ assert len(next_batch) <= len(results), f"next_batch: {len(next_batch)}, ready: {len(results)}"
71
+ new_remotes = create_remotes(next_batch)
72
+ process = psutil.Process()
73
+ if not turn_off_logging:
74
+ logger.info(f"[Process Id = {process.pid}] [After Create] Memory used: {process.memory_info().rss/2**30} GiB")
75
+ remotes.extend(new_remotes)
76
+ diff_remotes = len(new_remotes)
77
+ # Delete results to free up memory
78
+ del results
79
+ process = psutil.Process()
80
+ if not turn_off_logging:
81
+ logger.info(f"[Process Id = {process.pid}] [After Delete] Memory used: {process.memory_info().rss/2**30} GiB")
82
+ logger.info(f"Running GC collect")
83
+ gc.collect()
84
+ process = psutil.Process()
85
+ if not turn_off_logging:
86
+ logger.info(f"[Process Id = {process.pid}] [After GC] Memory used: {process.memory_info().rss/2**30} GiB")
87
+ else:
88
+ diff_remotes = 0
89
+
90
+ @ray.remote(num_cpus=1)
91
+ class RayResourcePoolActor(object):
92
+ def __init__(self, resources: list):
93
+ self.resources = resources
94
+ self.available = list(resources)
95
+ self.lock_event = asyncio.Lock()
96
+ self.acquired = []
97
+
98
+ async def acquire(self, num: int):
99
+ async with self.lock_event:
100
+ if len(self.available) < num:
101
+ return None
102
+ acquired = self.available[:num]
103
+ self.available = self.available[num:]
104
+ self.acquired.extend(acquired)
105
+ return acquired
106
+
107
+ async def release(self, resources: list):
108
+ async with self.lock_event:
109
+ for resource in resources:
110
+ try:
111
+ self.acquired.remove(resource)
112
+ self.available.append(resource)
113
+ except ValueError:
114
+ pass
115
+ return True
116
+
117
+ def get_acquired(self):
118
+ return list(self.acquired)
119
+
120
+ def get_available(self):
121
+ return list(self.available)
122
+
123
+ async def wait_and_acquire(self, num: int, timeout: typing.Optional[float] = None):
124
+ polling_time = 0.1
125
+ start_time = time.time()
126
+ while True:
127
+ acquired = await self.acquire(num)
128
+ if acquired is not None:
129
+ return acquired
130
+ if timeout is not None and time.time() - start_time > timeout:
131
+ return None
132
+ await asyncio.sleep(polling_time)
133
+
134
+
135
+ class RayTimedException(Exception):
136
+ pass
137
+
138
+ @ray.remote
139
+ class TimedRayExec(object):
140
+ def __init__(self, func, args=None, kwargs=None):
141
+ # Check that func is a remote function
142
+ assert hasattr(func, "remote"), f"func: {func} is not a remote function"
143
+ self.func = func
144
+ self.args = args if args else []
145
+ self.kwargs = kwargs if kwargs else {}
146
+ self._is_cancelled = False
147
+
148
+ def execute_with_timeout(self, timeout: float = 60):
149
+ ray_id = self.func.remote(*self.args, **self.kwargs)
150
+ finished, unfinished = ray.wait([ray_id], timeout=timeout)
151
+ is_cancelled = False
152
+ if len(unfinished) > 0:
153
+ ray.cancel(ray_id, force=True)
154
+ is_cancelled = True
155
+ self._is_cancelled = is_cancelled
156
+ if not is_cancelled:
157
+ assert len(finished) == 1, f"len(finished): {len(finished)}"
158
+ return_typ = ray.get(finished[0])
159
+ return return_typ
160
+ else:
161
+ return None
162
+
163
+ def is_cancelled(self):
164
+ return self._is_cancelled
165
+
166
+ if __name__ == "__main__":
167
+ import os
168
+ import time
169
+ import random
170
+ import unittest
171
+ class TestRayResourcePoolActor(unittest.TestCase):
172
+ @classmethod
173
+ def setUpClass(cls):
174
+ ray.init(ignore_reinit_error=True)
175
+
176
+ @classmethod
177
+ def tearDownClass(cls):
178
+ ray.shutdown()
179
+
180
+ def setUp(self):
181
+ resources = ["res1", "res2", "res3", "res4"]
182
+ self.pool = RayResourcePoolActor.remote(resources)
183
+
184
+ def test_acquire(self):
185
+ result = ray.get(self.pool.acquire.remote(2))
186
+ self.assertEqual(result, ["res1", "res2"])
187
+ self.assertEqual(ray.get(self.pool.get_available.remote()), ["res3", "res4"])
188
+ self.assertEqual(ray.get(self.pool.get_acquired.remote()), ["res1", "res2"])
189
+
190
+ def test_acquire_more_than_available(self):
191
+ result = ray.get(self.pool.acquire.remote(5))
192
+ self.assertIsNone(result)
193
+
194
+ def test_release(self):
195
+ ray.get(self.pool.acquire.remote(2))
196
+ ray.get(self.pool.release.remote(["res1"]))
197
+ self.assertEqual(ray.get(self.pool.get_available.remote()), ["res3", "res4", "res1"])
198
+ self.assertEqual(ray.get(self.pool.get_acquired.remote()), ["res2"])
199
+
200
+ def test_release_non_acquired_resource(self):
201
+ ray.get(self.pool.acquire.remote(2))
202
+ result = ray.get(self.pool.release.remote(["res5"]))
203
+ self.assertTrue(result)
204
+ self.assertEqual(ray.get(self.pool.get_available.remote()), ["res3", "res4"])
205
+ self.assertEqual(ray.get(self.pool.get_acquired.remote()), ["res1", "res2"])
206
+
207
+ def test_wait_and_acquire_success(self):
208
+ print("Available: " + str(ray.get(self.pool.get_available.remote())))
209
+ print("Acquired: " + str(ray.get(self.pool.get_acquired.remote())))
210
+ result = ray.get(self.pool.wait_and_acquire.remote(2))
211
+ self.assertEqual(result, ["res1", "res2"])
212
+
213
+ def test_wait_and_acquire_timeout(self):
214
+ result = ray.get(self.pool.wait_and_acquire.remote(5, timeout=1))
215
+ self.assertIsNone(result)
216
+
217
+ unittest.main()
218
+
219
+
220
+ log_folder = f".log/ray_utils"
221
+ os.makedirs(log_folder, exist_ok=True)
222
+ log_file = f"{log_folder}/ray_utils-{time.strftime('%Y-%m-%d-%H-%M-%S')}.log"
223
+ logging.basicConfig(filename=log_file, filemode='w', level=logging.INFO)
224
+ logger = logging.getLogger(__name__)
225
+ size = 1000
226
+ example_cnt = 100000
227
+ last_job_idx = 0
228
+ total_sum = 0
229
+ total_sum_serial = 0
230
+ job_spec = [[random.random() for _ in range(example_cnt)] for _ in range(size)]
231
+
232
+ @ray.remote
233
+ def _do_job(job):
234
+ idx, arr = job
235
+ for i in range(size*10):
236
+ # This is just to stress the CPUs
237
+ sum_val = sum(arr)
238
+ return sum_val, arr
239
+
240
+ def _prepare_remotes(num: int):
241
+ global last_job_idx
242
+ job_list = job_spec[last_job_idx:last_job_idx+num]
243
+ job_list = [(last_job_idx + idx, job) for idx, job in enumerate(job_list)]
244
+ last_job_idx += len(job_list)
245
+ return job_list
246
+
247
+ def _create_remotes(job_list: typing.List[typing.Tuple[int, typing.List[float]]]):
248
+ remotes = []
249
+ for job in job_list:
250
+ logger.info(f"Queuing job {job[0]}")
251
+ job_ref = ray.put(job)
252
+ remotes.append(_do_job.remote(job_ref))
253
+ return remotes
254
+
255
+ def _transform_output(results):
256
+ global total_sum, total_sum_serial
257
+ for sum_val, arr in results:
258
+ total_sum += sum_val
259
+ total_sum_serial += sum(arr)
260
+ del results # This is important to free up memory
261
+ parallel = 30
262
+ RayUtils.init_ray(num_of_cpus=parallel)
263
+ RayUtils.ray_run_within_parallel_limits(parallel, size, _transform_output, _prepare_remotes, _create_remotes, logger=logger)
264
+ assert total_sum == total_sum_serial, f"total_sum: {total_sum}, total_sum_serial: {total_sum_serial}"
265
+ logger.info(f"total_sum: {total_sum}, total_sum_serial: {total_sum_serial}")
@@ -0,0 +1 @@
1
+ gitdir: ../../../../.git/modules/src/itp_interface/tools/repl
@@ -0,0 +1,24 @@
1
+ name: Run Tests
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-latest
8
+
9
+ steps:
10
+ - name: Checkout code
11
+ uses: actions/checkout@v2
12
+
13
+ - name: install elan
14
+ run: |
15
+ set -o pipefail
16
+ curl -sSfL https://github.com/leanprover/elan/releases/download/v3.0.0/elan-x86_64-unknown-linux-gnu.tar.gz | tar xz
17
+ ./elan-init -y --default-toolchain none
18
+ echo "$HOME/.elan/bin" >> $GITHUB_PATH
19
+
20
+ - name: build
21
+ run: lake build
22
+
23
+ - name: Run tests
24
+ run: ./test.sh
@@ -0,0 +1,7 @@
1
+ /build
2
+ /lake-packages/*
3
+ /lakefile.olean
4
+ /.lake
5
+ /test/Mathlib/.lake
6
+ /test/*.olean
7
+ /test/*.olean.tmp
@@ -0,0 +1,13 @@
1
+ {
2
+ "Copyright header for mathlib": {
3
+ "scope": "lean4",
4
+ "prefix": "copyright",
5
+ "body": [
6
+ "/-",
7
+ "Copyright (c) ${CURRENT_YEAR} $1. All rights reserved.",
8
+ "Released under Apache 2.0 license as described in the file LICENSE.",
9
+ "Authors: $1",
10
+ "-/"
11
+ ]
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
3
+ // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
4
+
5
+ // List of extensions which should be recommended for users of this workspace.
6
+ "recommendations": [
7
+ "leanprover.lean4"
8
+ ],
9
+ // List of extensions recommended by VS Code that should not be recommended for users of this workspace.
10
+ "unwantedRecommendations": [
11
+ "ms-vscode-remote.remote-containers"
12
+ ]
13
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "Module docstring for mathlib": {
3
+ "scope": "lean4",
4
+ "prefix": "module docstring",
5
+ "body": [
6
+ "/-!",
7
+ "# ${TM_FILENAME_BASE/([^_]*)(_?)/${1:/capitalize}${2:+ }/g}",
8
+ "",
9
+ "## Main definitions",
10
+ "",
11
+ "* `FooBar`",
12
+ "",
13
+ "## Main statements",
14
+ "",
15
+ "* `fooBar_unique`",
16
+ "",
17
+ "## Notation",
18
+ "",
19
+ "",
20
+ "",
21
+ "## Implementation details",
22
+ "",
23
+ "",
24
+ "",
25
+ "## References",
26
+ "",
27
+ "* [F. Bar, *Quuxes*][bibkey]",
28
+ "",
29
+ "## Tags",
30
+ "",
31
+ "Foobars, barfoos",
32
+ "-/",
33
+ "",
34
+ ]},
35
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "editor.insertSpaces": true,
3
+ "editor.tabSize": 2,
4
+ "editor.rulers" : [100],
5
+ "files.encoding": "utf8",
6
+ "files.eol": "\n",
7
+ "files.insertFinalNewline": true,
8
+ // We don't use this: it messes up our test files!
9
+ // "files.trimFinalNewlines": true,
10
+ "files.trimTrailingWhitespace": true,
11
+ }