itp-interface 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- itp_interface/__init__.py +0 -0
- itp_interface/agent/__init__.py +0 -0
- itp_interface/agent/simple_proof_agent.py +100 -0
- itp_interface/coq_ser_api/__init__.py +165 -0
- itp_interface/coq_ser_api/contexts.py +283 -0
- itp_interface/coq_ser_api/coq_agent.py +459 -0
- itp_interface/coq_ser_api/coq_backend.py +135 -0
- itp_interface/coq_ser_api/coq_util.py +839 -0
- itp_interface/coq_ser_api/example.py +67 -0
- itp_interface/coq_ser_api/lsp_backend.py +375 -0
- itp_interface/coq_ser_api/py.typed +0 -0
- itp_interface/coq_ser_api/serapi_backend.py +841 -0
- itp_interface/coq_ser_api/util.py +145 -0
- itp_interface/coq_ser_api_old/__init__.py +2583 -0
- itp_interface/coq_ser_api_old/contexts.py +172 -0
- itp_interface/coq_ser_api_old/util.py +146 -0
- itp_interface/lean_server/__init__.py +0 -0
- itp_interface/lean_server/commands.py +484 -0
- itp_interface/lean_server/lean3_search_tool.py +358 -0
- itp_interface/lean_server/lean4_repl_interface.py +151 -0
- itp_interface/lean_server/lean4_utils.py +255 -0
- itp_interface/lean_server/lean_cmd_server.py +111 -0
- itp_interface/lean_server/lean_context.py +60 -0
- itp_interface/lean_server/lean_sync_server.py +174 -0
- itp_interface/lean_server/lean_utils.py +199 -0
- itp_interface/lean_server/py.typed +1 -0
- itp_interface/main/__init__.py +0 -0
- itp_interface/main/config/afp_data_gen.yaml +14 -0
- itp_interface/main/config/benchmark/CompCert.yaml +366 -0
- itp_interface/main/config/benchmark/GeoCoq.yaml +930 -0
- itp_interface/main/config/benchmark/UniMath.yaml +2690 -0
- itp_interface/main/config/benchmark/afp_isabelle.yaml +29200 -0
- itp_interface/main/config/benchmark/agent_proverbot_hard.yaml +247 -0
- itp_interface/main/config/benchmark/category-theory.yaml +470 -0
- itp_interface/main/config/benchmark/compcert_118_subset.yaml +148 -0
- itp_interface/main/config/benchmark/compcert_benchmark.yaml +36 -0
- itp_interface/main/config/benchmark/compcert_benchmark_hard.yaml +498 -0
- itp_interface/main/config/benchmark/compcert_benchmark_hard_1.yaml +55 -0
- itp_interface/main/config/benchmark/compcert_benchmark_hard_2.yaml +24 -0
- itp_interface/main/config/benchmark/compcert_benchmark_hard_3.yaml +95 -0
- itp_interface/main/config/benchmark/compcert_benchmark_hard_7_per_cent.yaml +78 -0
- itp_interface/main/config/benchmark/compcert_benchmark_test.yaml +38 -0
- itp_interface/main/config/benchmark/compcert_benchmark_train.yaml +340 -0
- itp_interface/main/config/benchmark/leandojo_novel_premises_test.yaml +2908 -0
- itp_interface/main/config/benchmark/leandojo_novel_premises_train.yaml +98645 -0
- itp_interface/main/config/benchmark/leandojo_novel_premises_val.yaml +2912 -0
- itp_interface/main/config/benchmark/leandojo_random.yaml +2889 -0
- itp_interface/main/config/benchmark/leandojo_random_test.yaml +2421 -0
- itp_interface/main/config/benchmark/leandojo_random_train.yaml +62729 -0
- itp_interface/main/config/benchmark/leandojo_random_val.yaml +2504 -0
- itp_interface/main/config/benchmark/math-comp.yaml +200 -0
- itp_interface/main/config/benchmark/miniF2F_test.yaml +12 -0
- itp_interface/main/config/benchmark/miniF2F_test_aime.yaml +27 -0
- itp_interface/main/config/benchmark/miniF2F_test_algebra.yaml +30 -0
- itp_interface/main/config/benchmark/miniF2F_test_amc12.yaml +57 -0
- itp_interface/main/config/benchmark/miniF2F_test_few_shot_hard.yaml +231 -0
- itp_interface/main/config/benchmark/miniF2F_test_imo.yaml +32 -0
- itp_interface/main/config/benchmark/miniF2F_test_induction.yaml +20 -0
- itp_interface/main/config/benchmark/miniF2F_test_mathd_algebra.yaml +82 -0
- itp_interface/main/config/benchmark/miniF2F_test_mathd_algebra_hard.yaml +72 -0
- itp_interface/main/config/benchmark/miniF2F_test_mathd_numbertheory.yaml +72 -0
- itp_interface/main/config/benchmark/miniF2F_test_numbertheory.yaml +20 -0
- itp_interface/main/config/benchmark/minicompcert_benchmark_1.yaml +14 -0
- itp_interface/main/config/benchmark/proverbot_hard.yaml +104 -0
- itp_interface/main/config/benchmark/re_prover.yaml +66 -0
- itp_interface/main/config/benchmark/re_prover_hard.yaml +41 -0
- itp_interface/main/config/benchmark/re_prover_very_hard.yaml +22 -0
- itp_interface/main/config/benchmark/reprover_with_retrieval.yaml +73 -0
- itp_interface/main/config/benchmark/reprover_with_retrieval_hard.yaml +30 -0
- itp_interface/main/config/benchmark/reprover_with_retrieval_neg.yaml +195 -0
- itp_interface/main/config/benchmark/simple_benchmark_1.yaml +24 -0
- itp_interface/main/config/benchmark/simple_benchmark_8.yaml +50 -0
- itp_interface/main/config/benchmark/simple_benchmark_9.yaml +65 -0
- itp_interface/main/config/benchmark/simple_benchmark_isabelle.yaml +18 -0
- itp_interface/main/config/benchmark/simple_benchmark_lean.yaml +12 -0
- itp_interface/main/config/benchmark/simple_benchmark_lean_training_data.yaml +12 -0
- itp_interface/main/config/benchmark/simple_rl_benchmark_lean.yaml +14 -0
- itp_interface/main/config/benchmark/stack_machine.yaml +13 -0
- itp_interface/main/config/benchmark/stack_machine_hard.yaml +15 -0
- itp_interface/main/config/category_theory_data_gen.yaml +14 -0
- itp_interface/main/config/category_theory_data_gen_random.yaml +16 -0
- itp_interface/main/config/compcert_data_gen_test.yaml +10 -0
- itp_interface/main/config/compcert_data_gen_train.yaml +7 -0
- itp_interface/main/config/env_settings/bm25_retrieval.yaml +2 -0
- itp_interface/main/config/env_settings/bm25_retrieval_no_dfns.yaml +2 -0
- itp_interface/main/config/env_settings/bm25_retrieval_only_local_no_dfns.yaml +2 -0
- itp_interface/main/config/env_settings/bm25_retrieval_with_print.yaml +2 -0
- itp_interface/main/config/env_settings/bm25_retrieval_with_print_only_local.yaml +2 -0
- itp_interface/main/config/env_settings/bm25_retrieval_with_print_only_local_no_dfns.yaml +2 -0
- itp_interface/main/config/env_settings/no_retrieval.yaml +2 -0
- itp_interface/main/config/experiments.yaml +12 -0
- itp_interface/main/config/geo_coq_data_gen.yaml +14 -0
- itp_interface/main/config/geo_coq_data_gen_random.yaml +16 -0
- itp_interface/main/config/leandojo_random_data_gen.yaml +16 -0
- itp_interface/main/config/math_comp_data_gen.yaml +14 -0
- itp_interface/main/config/math_comp_data_gen_random.yaml +16 -0
- itp_interface/main/config/mathlib_data_gen.yaml +14 -0
- itp_interface/main/config/repo/coq_repos.yaml +191 -0
- itp_interface/main/config/run_settings/default_coq_data_generation_transforms.yaml +24 -0
- itp_interface/main/config/run_settings/default_isabelle_data_generation_transforms.yaml +24 -0
- itp_interface/main/config/run_settings/default_lean4_data_generation_transforms.yaml +24 -0
- itp_interface/main/config/run_settings/default_lean_data_generation_transforms.yaml +24 -0
- itp_interface/main/config/simple_coq_data_gen.yaml +12 -0
- itp_interface/main/config/simple_coq_data_gen_random.yaml +17 -0
- itp_interface/main/config/simple_lean_data_gen.yaml +12 -0
- itp_interface/main/config/simple_rl_lean_data_gen.yaml +12 -0
- itp_interface/main/config/uni_math_data_gen.yaml +14 -0
- itp_interface/main/config.py +192 -0
- itp_interface/main/extract_benchmark_dataset.py +106 -0
- itp_interface/main/filter_dataset.py +107 -0
- itp_interface/main/install.py +92 -0
- itp_interface/main/merge_dataset.py +96 -0
- itp_interface/main/run_tool.py +444 -0
- itp_interface/pisa/.git +1 -0
- itp_interface/pisa/.gitignore +125 -0
- itp_interface/pisa/.idea/.gitignore +8 -0
- itp_interface/pisa/.idea/ClojureProjectResolveSettings.xml +6 -0
- itp_interface/pisa/.idea/codeStyles/Project.xml +7 -0
- itp_interface/pisa/.idea/codeStyles/codeStyleConfig.xml +5 -0
- itp_interface/pisa/.idea/inspectionProfiles/Project_Default.xml +16 -0
- itp_interface/pisa/.idea/libraries/sbt__com_google_android_annotations_4_1_1_4_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_google_api_grpc_proto_google_common_protos_1_17_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_google_code_findbugs_jsr305_3_0_2_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_google_code_gson_gson_2_8_6_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_google_errorprone_error_prone_annotations_2_3_4_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_google_guava_failureaccess_1_0_1_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_google_guava_guava_30_0_jre_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_google_guava_listenablefuture_9999_0_empty_to_avoid_conflict_with_guava_jar.xml +9 -0
- itp_interface/pisa/.idea/libraries/sbt__com_google_j2objc_j2objc_annotations_1_3_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_google_protobuf_protobuf_java_3_12_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_google_protobuf_protobuf_java_util_3_12_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_lihaoyi_fastparse_2_13_2_3_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_lihaoyi_geny_2_13_0_6_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_lihaoyi_sourcecode_2_13_0_2_1_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_thesamet_scalapb_lenses_2_13_0_10_9_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_thesamet_scalapb_scalapb_runtime_2_13_0_10_9_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_thesamet_scalapb_scalapb_runtime_grpc_2_13_0_10_9_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_thesamet_scalapb_zio_grpc_zio_grpc_core_2_13_0_4_2_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__com_thoughtworks_paranamer_paranamer_2_8_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__commons_io_commons_io_2_8_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__de_unruh_java_patterns_0_1_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__de_unruh_scala_isabelle_2_13_master_SNAPSHOT_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__dev_zio_izumi_reflect_2_13_1_0_0_M9_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__dev_zio_izumi_reflect_thirdparty_boopickle_shaded_2_13_1_0_0_M9_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__dev_zio_zio_2_13_1_0_3_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__dev_zio_zio_stacktracer_2_13_1_0_3_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__dev_zio_zio_streams_2_13_1_0_3_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_grpc_grpc_api_1_34_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_grpc_grpc_context_1_34_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_grpc_grpc_core_1_34_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_grpc_grpc_netty_1_34_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_grpc_grpc_protobuf_1_34_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_grpc_grpc_protobuf_lite_1_34_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_grpc_grpc_services_1_34_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_grpc_grpc_stub_1_34_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_buffer_4_1_51_Final_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_codec_4_1_51_Final_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_codec_http2_4_1_51_Final_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_codec_http_4_1_51_Final_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_codec_socks_4_1_51_Final_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_common_4_1_51_Final_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_handler_4_1_51_Final_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_handler_proxy_4_1_51_Final_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_resolver_4_1_51_Final_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_netty_netty_transport_4_1_51_Final_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__io_perfmark_perfmark_api_0_19_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__net_java_dev_jna_jna_5_3_1_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__net_liftweb_lift_json_2_13_3_4_3_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_apache_commons_commons_lang3_3_11_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_apache_commons_commons_text_1_9_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_checkerframework_checker_qual_3_5_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_codehaus_mojo_animal_sniffer_annotations_1_18_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_jetbrains_annotations_20_1_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_jline_jline_3_16_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_log4s_log4s_2_13_1_9_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_scala_lang_modules_scala_collection_compat_2_13_2_1_6_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_scala_lang_modules_scala_xml_2_13_1_3_0_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_scala_lang_scala_compiler_2_13_4_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_scala_lang_scala_library_2_13_4_jar.xml +23 -0
- itp_interface/pisa/.idea/libraries/sbt__org_scala_lang_scala_reflect_2_13_4_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_scala_lang_scalap_2_13_4_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_scalaz_scalaz_core_2_13_7_3_2_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_slf4j_slf4j_api_1_7_30_jar.xml +13 -0
- itp_interface/pisa/.idea/libraries/sbt__org_slf4j_slf4j_simple_1_7_30_jar.xml +13 -0
- itp_interface/pisa/.idea/misc.xml +7 -0
- itp_interface/pisa/.idea/modules/PISA-build.iml +127 -0
- itp_interface/pisa/.idea/modules/PISA.iml +94 -0
- itp_interface/pisa/.idea/modules.xml +9 -0
- itp_interface/pisa/.idea/other.xml +6 -0
- itp_interface/pisa/.idea/sbt.xml +20 -0
- itp_interface/pisa/.idea/scala_compiler.xml +6 -0
- itp_interface/pisa/.idea/uiDesigner.xml +124 -0
- itp_interface/pisa/.idea/vcs.xml +6 -0
- itp_interface/pisa/.scalafmt.conf +2 -0
- itp_interface/pisa/LICENSE +29 -0
- itp_interface/pisa/README.md +262 -0
- itp_interface/pisa/build.sbt +49 -0
- itp_interface/pisa/build.sh +26 -0
- itp_interface/pisa/command_generation/close_gaps.py +44 -0
- itp_interface/pisa/command_generation/conjecture_normal_order.py +62 -0
- itp_interface/pisa/command_generation/conjecturer_command_generator.py +36 -0
- itp_interface/pisa/command_generation/create_dirs.py +11 -0
- itp_interface/pisa/command_generation/find_std.py +67 -0
- itp_interface/pisa/command_generation/generate_build_commands_afp.py +15 -0
- itp_interface/pisa/command_generation/generate_build_commands_std.py +15 -0
- itp_interface/pisa/command_generation/generate_commands_afp.py +103 -0
- itp_interface/pisa/command_generation/generate_commands_mini.py +73 -0
- itp_interface/pisa/command_generation/generate_commands_std.py +69 -0
- itp_interface/pisa/command_generation/generate_hammer_extraction_text.py +5 -0
- itp_interface/pisa/command_generation/hammer_command_generator.py +40 -0
- itp_interface/pisa/command_generation/hp_search_command_generator.py +63 -0
- itp_interface/pisa/command_generation/oracle_command_generator.py +56 -0
- itp_interface/pisa/command_generation/search_command_generator.py +69 -0
- itp_interface/pisa/command_generation/summarise_problem_names.py +45 -0
- itp_interface/pisa/command_generation/tpu_hp_search.py +75 -0
- itp_interface/pisa/docker/Dockerfile +34 -0
- itp_interface/pisa/docker/docker_tutorial.md +64 -0
- itp_interface/pisa/eval_setup/copy_isabelle.py +42 -0
- itp_interface/pisa/eval_setup/copy_pisa_jars.py +18 -0
- itp_interface/pisa/mesh_transformer_utils/tokenization.py +86 -0
- itp_interface/pisa/project/build.properties +1 -0
- itp_interface/pisa/project/plugins.sbt +5 -0
- itp_interface/pisa/requirements.txt +4 -0
- itp_interface/pisa/scripts/extract_last_k_steps.py +28 -0
- itp_interface/pisa/scripts/extract_proof_corpus.py +26 -0
- itp_interface/pisa/scripts/gather_hammer_results.py +27 -0
- itp_interface/pisa/scripts/length_in_char_stats.py +20 -0
- itp_interface/pisa/scripts/mix.py +127 -0
- itp_interface/pisa/scripts/results_stat.py +52 -0
- itp_interface/pisa/scripts/test_array_job.sh +34 -0
- itp_interface/pisa/setup.sh +25 -0
- itp_interface/pisa/src/main/protobuf/server.proto +60 -0
- itp_interface/pisa/src/main/python/.idea/.gitignore +8 -0
- itp_interface/pisa/src/main/python/.idea/inspectionProfiles/Project_Default.xml +18 -0
- itp_interface/pisa/src/main/python/.idea/inspectionProfiles/profiles_settings.xml +6 -0
- itp_interface/pisa/src/main/python/.idea/misc.xml +4 -0
- itp_interface/pisa/src/main/python/.idea/modules.xml +8 -0
- itp_interface/pisa/src/main/python/.idea/python.iml +12 -0
- itp_interface/pisa/src/main/python/.idea/vcs.xml +6 -0
- itp_interface/pisa/src/main/python/conjecturing_parsing/conjecturer_postprocessing.py +59 -0
- itp_interface/pisa/src/main/python/data_extraction/extract_data.py +184 -0
- itp_interface/pisa/src/main/python/data_extraction/find_premises.py +221 -0
- itp_interface/pisa/src/main/python/data_extraction/process_data.py +129 -0
- itp_interface/pisa/src/main/python/legacy/PisaFlexibleClient.py +167 -0
- itp_interface/pisa/src/main/python/legacy/autof_test.py +74 -0
- itp_interface/pisa/src/main/python/legacy/cmd_client.py +23 -0
- itp_interface/pisa/src/main/python/legacy/convert_scala_dump_to_test_name_jsons.py +14 -0
- itp_interface/pisa/src/main/python/legacy/create_data_txt.py +72 -0
- itp_interface/pisa/src/main/python/legacy/create_finetune_tfrecords.py +311 -0
- itp_interface/pisa/src/main/python/legacy/demo.py +49 -0
- itp_interface/pisa/src/main/python/legacy/evaluate.py +108 -0
- itp_interface/pisa/src/main/python/legacy/extract_first_step.py +25 -0
- itp_interface/pisa/src/main/python/legacy/get_global_facts.py +35 -0
- itp_interface/pisa/src/main/python/legacy/mix_data.py +19 -0
- itp_interface/pisa/src/main/python/legacy/one_stage_extraction.py +111 -0
- itp_interface/pisa/src/main/python/legacy/prepare_episodic_transitions.py +137 -0
- itp_interface/pisa/src/main/python/legacy/prepare_translation_pairs.py +277 -0
- itp_interface/pisa/src/main/python/pisa_client.py +322 -0
- itp_interface/pisa/src/main/python/server_pb2.py +394 -0
- itp_interface/pisa/src/main/python/server_pb2_grpc.py +230 -0
- itp_interface/pisa/src/main/python/test_client.py +17 -0
- itp_interface/pisa/src/main/python/test_client2.py +79 -0
- itp_interface/pisa/src/main/python/utils/filters.py +59 -0
- itp_interface/pisa/src/main/python/utils/pisa_server_control.py +29 -0
- itp_interface/pisa/src/main/scala/pisa/agent/CheckSyntax.scala +257 -0
- itp_interface/pisa/src/main/scala/pisa/agent/DepThms.scala +29 -0
- itp_interface/pisa/src/main/scala/pisa/agent/PisaStat.scala +46 -0
- itp_interface/pisa/src/main/scala/pisa/agent/RefactorTest.scala +40 -0
- itp_interface/pisa/src/main/scala/pisa/agent/RepHammer.scala +95 -0
- itp_interface/pisa/src/main/scala/pisa/server/HammFacts.scala +63 -0
- itp_interface/pisa/src/main/scala/pisa/server/PisaOS.scala +881 -0
- itp_interface/pisa/src/main/scala/pisa/server/PisaOneStage.scala +540 -0
- itp_interface/pisa/src/main/scala/pisa/server/PisaOneStageServers.scala +1048 -0
- itp_interface/pisa/src/main/scala/pisa/utils/TheoryManager.scala +95 -0
- itp_interface/pisa/src/test/python/analyse_debug.py +33 -0
- itp_interface/pisa/src/test/python/extract_test_seq2seq.py +53 -0
- itp_interface/pisa/src/test/python/extract_test_theorem_ground_truth_indices.py +31 -0
- itp_interface/pisa/src/test/python/proof_originality.py +24 -0
- itp_interface/pisa/src/test/python/test_command_generator.py +25 -0
- itp_interface/pisa/src/test/python/test_model_sequence_accuracy.py +70 -0
- itp_interface/pisa/src/test/scala/pisa/Easy.scala +26 -0
- itp_interface/pisa/src/test/scala/pisa/TestCurl.scala +82 -0
- itp_interface/pisa/src/test/scala/pisa/TestIsa.scala +27 -0
- itp_interface/pisa/test.sh +19 -0
- itp_interface/pisa/universal_test_theorems.tar.gz +0 -0
- itp_interface/repo/build.py +78 -0
- itp_interface/repo/clone.py +79 -0
- itp_interface/repo/dataset_discovery.py +99 -0
- itp_interface/retrieval/__init__.py +0 -0
- itp_interface/retrieval/abstraction.py +35 -0
- itp_interface/retrieval/coq_bm25_reranker.py +153 -0
- itp_interface/retrieval/isabelle_bm25_reranker.py +86 -0
- itp_interface/retrieval/lean3_bm25_reranker.py +86 -0
- itp_interface/rl/__init__.py +0 -0
- itp_interface/rl/abstraction.py +168 -0
- itp_interface/rl/proof_action.py +172 -0
- itp_interface/rl/proof_state.py +149 -0
- itp_interface/rl/proof_tree.py +109 -0
- itp_interface/rl/simpl_proof_env_pool.py +16 -0
- itp_interface/rl/simple_proof_env.py +713 -0
- itp_interface/rl/simple_proof_env_pool.py +591 -0
- itp_interface/scripts/setup.sh +228 -0
- itp_interface/tools/__init__.py +0 -0
- itp_interface/tools/basic_utils.py +172 -0
- itp_interface/tools/bin_packing.py +61 -0
- itp_interface/tools/cache.py +93 -0
- itp_interface/tools/coq_build_spec.py +31 -0
- itp_interface/tools/coq_build_tool.py +319 -0
- itp_interface/tools/coq_context_helper.py +354 -0
- itp_interface/tools/coq_executor.py +508 -0
- itp_interface/tools/coq_local_data_generation_transform.py +158 -0
- itp_interface/tools/coq_parse_utils.py +154 -0
- itp_interface/tools/coq_raw_proofs.py +193 -0
- itp_interface/tools/coq_theorem_proof_pair_generation_transform.py +146 -0
- itp_interface/tools/coq_training_data_generator.py +76 -0
- itp_interface/tools/dynamic_coq_proof_exec.py +220 -0
- itp_interface/tools/dynamic_isabelle_proof_exec.py +229 -0
- itp_interface/tools/dynamic_lean4_proof_exec.py +236 -0
- itp_interface/tools/dynamic_lean_proof_exec.py +228 -0
- itp_interface/tools/isabelle_context_helper.py +66 -0
- itp_interface/tools/isabelle_executor.py +862 -0
- itp_interface/tools/isabelle_local_data_generation_transform.py +149 -0
- itp_interface/tools/isabelle_parse_utils.py +131 -0
- itp_interface/tools/isabelle_server.py +106 -0
- itp_interface/tools/lean4_context_helper.py +72 -0
- itp_interface/tools/lean4_local_data_generation_transform.py +122 -0
- itp_interface/tools/lean4_sync_executor.py +1193 -0
- itp_interface/tools/lean_cmd_executor.py +804 -0
- itp_interface/tools/lean_context_helper.py +327 -0
- itp_interface/tools/lean_dojo_data_generation_transform.py +206 -0
- itp_interface/tools/lean_executor.py +687 -0
- itp_interface/tools/lean_local_data_generation_transform.py +136 -0
- itp_interface/tools/lean_parse_utils.py +32 -0
- itp_interface/tools/log_utils.py +20 -0
- itp_interface/tools/proof_exec_callback.py +76 -0
- itp_interface/tools/ray_utils.py +265 -0
- itp_interface/tools/repl/.git +1 -0
- itp_interface/tools/repl/.github/workflows/ci.yml +24 -0
- itp_interface/tools/repl/.gitignore +7 -0
- itp_interface/tools/repl/.vscode/copyright.code-snippets +13 -0
- itp_interface/tools/repl/.vscode/extensions.json +13 -0
- itp_interface/tools/repl/.vscode/module-docstring.code-snippets +35 -0
- itp_interface/tools/repl/.vscode/settings.json +11 -0
- itp_interface/tools/repl/README.md +174 -0
- itp_interface/tools/repl/REPL/Frontend.lean +47 -0
- itp_interface/tools/repl/REPL/JSON.lean +186 -0
- itp_interface/tools/repl/REPL/Lean/ContextInfo.lean +9 -0
- itp_interface/tools/repl/REPL/Lean/Environment.lean +31 -0
- itp_interface/tools/repl/REPL/Lean/InfoTree/ToJson.lean +114 -0
- itp_interface/tools/repl/REPL/Lean/InfoTree.lean +272 -0
- itp_interface/tools/repl/REPL/Main.lean +323 -0
- itp_interface/tools/repl/REPL/Snapshots.lean +306 -0
- itp_interface/tools/repl/REPL/Util/Path.lean +36 -0
- itp_interface/tools/repl/REPL/Util/Pickle.lean +44 -0
- itp_interface/tools/repl/REPL.lean +4 -0
- itp_interface/tools/repl/lake-manifest.json +5 -0
- itp_interface/tools/repl/lakefile.lean +15 -0
- itp_interface/tools/repl/lean-toolchain +1 -0
- itp_interface/tools/repl/test/Mathlib/.gitignore +5 -0
- itp_interface/tools/repl/test/Mathlib/H20231110.sh +2 -0
- itp_interface/tools/repl/test/Mathlib/ReplMathlibTests.lean +1 -0
- itp_interface/tools/repl/test/Mathlib/lake-manifest.json +68 -0
- itp_interface/tools/repl/test/Mathlib/lakefile.lean +11 -0
- itp_interface/tools/repl/test/Mathlib/lean-toolchain +1 -0
- itp_interface/tools/repl/test/Mathlib/test/20240209.expected.out +20 -0
- itp_interface/tools/repl/test/Mathlib/test/20240209.in +3 -0
- itp_interface/tools/repl/test/Mathlib/test/20240209.lean +4 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231020.expected.out +8 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231020.in +8 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231020.lean +22 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231110.expected.out +4 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231110.in +4 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231115.expected.out +19 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231115.in +5 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231115_2.expected.out +18 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231115_2.in +4 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231115_3.expected.out +10 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231115_3.in +4 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231214.in +9 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231214.lean +30 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231215.expected.out +4 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231215.in +4 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231215_2.expected.out +14 -0
- itp_interface/tools/repl/test/Mathlib/test/H20231215_2.in +3 -0
- itp_interface/tools/repl/test/Mathlib/test/exact.expected.out +37 -0
- itp_interface/tools/repl/test/Mathlib/test/exact.in +10 -0
- itp_interface/tools/repl/test/Mathlib/test/import_Mathlib.lean +1 -0
- itp_interface/tools/repl/test/Mathlib/test/induction.expected.out +29 -0
- itp_interface/tools/repl/test/Mathlib/test/induction.in +10 -0
- itp_interface/tools/repl/test/Mathlib/test/induction.lean +6 -0
- itp_interface/tools/repl/test/Mathlib/test/on_goal.expected.out +22 -0
- itp_interface/tools/repl/test/Mathlib/test/on_goal.in +5 -0
- itp_interface/tools/repl/test/Mathlib/test/pickle.expected.out +16 -0
- itp_interface/tools/repl/test/Mathlib/test/pickle.in +6 -0
- itp_interface/tools/repl/test/Mathlib/test/pickle_2.expected.out +4 -0
- itp_interface/tools/repl/test/Mathlib/test/pickle_2.in +4 -0
- itp_interface/tools/repl/test/Mathlib/test.sh +41 -0
- itp_interface/tools/repl/test/all_tactics.expected.out +13 -0
- itp_interface/tools/repl/test/all_tactics.in +1 -0
- itp_interface/tools/repl/test/by_cases.expected.out +25 -0
- itp_interface/tools/repl/test/by_cases.in +8 -0
- itp_interface/tools/repl/test/by_cases.lean +4 -0
- itp_interface/tools/repl/test/calc.expected.out +32 -0
- itp_interface/tools/repl/test/calc.in +1 -0
- itp_interface/tools/repl/test/def_eval.expected.out +9 -0
- itp_interface/tools/repl/test/def_eval.in +3 -0
- itp_interface/tools/repl/test/enableInitializersExecution.expected.out +2 -0
- itp_interface/tools/repl/test/enableInitializersExecution.in +1 -0
- itp_interface/tools/repl/test/file.expected.out +8 -0
- itp_interface/tools/repl/test/file.in +1 -0
- itp_interface/tools/repl/test/file.lean +5 -0
- itp_interface/tools/repl/test/have_by_sorry.expected.out +28 -0
- itp_interface/tools/repl/test/have_by_sorry.in +6 -0
- itp_interface/tools/repl/test/import_lean.in +1 -0
- itp_interface/tools/repl/test/incomplete.expected.out +18 -0
- itp_interface/tools/repl/test/incomplete.in +3 -0
- itp_interface/tools/repl/test/incomplete.lean +0 -0
- itp_interface/tools/repl/test/infotree.expected.out +20 -0
- itp_interface/tools/repl/test/infotree.in +2 -0
- itp_interface/tools/repl/test/invalid_tactic.expected.out +20 -0
- itp_interface/tools/repl/test/invalid_tactic.in +3 -0
- itp_interface/tools/repl/test/name_generator.expected.out +53 -0
- itp_interface/tools/repl/test/name_generator.in +18 -0
- itp_interface/tools/repl/test/no_goal_sorry.expected.out +11 -0
- itp_interface/tools/repl/test/no_goal_sorry.in +1 -0
- itp_interface/tools/repl/test/no_goal_sorry_2.expected.out +12 -0
- itp_interface/tools/repl/test/no_goal_sorry_2.in +1 -0
- itp_interface/tools/repl/test/options.expected.out +17 -0
- itp_interface/tools/repl/test/options.in +6 -0
- itp_interface/tools/repl/test/pickle_environment.expected.out +8 -0
- itp_interface/tools/repl/test/pickle_environment.in +7 -0
- itp_interface/tools/repl/test/pickle_environment_with_imports.expected.out +10 -0
- itp_interface/tools/repl/test/pickle_environment_with_imports.in +9 -0
- itp_interface/tools/repl/test/pickle_open.expected.out +8 -0
- itp_interface/tools/repl/test/pickle_open.in +7 -0
- itp_interface/tools/repl/test/pickle_open_2.expected.out +4 -0
- itp_interface/tools/repl/test/pickle_open_2.in +3 -0
- itp_interface/tools/repl/test/pickle_open_scoped.expected.out +18 -0
- itp_interface/tools/repl/test/pickle_open_scoped.in +8 -0
- itp_interface/tools/repl/test/pickle_open_scoped_2.expected.out +14 -0
- itp_interface/tools/repl/test/pickle_open_scoped_2.in +3 -0
- itp_interface/tools/repl/test/pickle_proof_state_1.expected.out +26 -0
- itp_interface/tools/repl/test/pickle_proof_state_1.in +15 -0
- itp_interface/tools/repl/test/pickle_proof_state_2.expected.out +4 -0
- itp_interface/tools/repl/test/pickle_proof_state_2.in +3 -0
- itp_interface/tools/repl/test/pickle_proof_state_env.expected.out +26 -0
- itp_interface/tools/repl/test/pickle_proof_state_env.in +15 -0
- itp_interface/tools/repl/test/pickle_scoped_notation.in +16 -0
- itp_interface/tools/repl/test/pickle_scoped_notation_2.in +3 -0
- itp_interface/tools/repl/test/proof_step.expected.out +18 -0
- itp_interface/tools/repl/test/proof_step.in +7 -0
- itp_interface/tools/repl/test/readme.expected.out +16 -0
- itp_interface/tools/repl/test/readme.in +5 -0
- itp_interface/tools/repl/test/sorry_hypotheses.expected.out +16 -0
- itp_interface/tools/repl/test/sorry_hypotheses.in +4 -0
- itp_interface/tools/repl/test/synthesize_placeholder.expected.out +7 -0
- itp_interface/tools/repl/test/synthesize_placeholder.in +1 -0
- itp_interface/tools/repl/test/tactic_mode_sorry.expected.out +14 -0
- itp_interface/tools/repl/test/tactic_mode_sorry.in +3 -0
- itp_interface/tools/repl/test/tactic_sorry.expected.out +12 -0
- itp_interface/tools/repl/test/tactic_sorry.in +1 -0
- itp_interface/tools/repl/test/term_sorry.expected.out +12 -0
- itp_interface/tools/repl/test/term_sorry.in +1 -0
- itp_interface/tools/repl/test/trace_simp.expected.out +41 -0
- itp_interface/tools/repl/test/trace_simp.in +15 -0
- itp_interface/tools/repl/test/unfinished_tactic_block.expected.out +11 -0
- itp_interface/tools/repl/test/unfinished_tactic_block.in +1 -0
- itp_interface/tools/repl/test/unknown_environment.expected.out +2 -0
- itp_interface/tools/repl/test/unknown_environment.in +1 -0
- itp_interface/tools/repl/test/unknown_proof_state.expected.out +14 -0
- itp_interface/tools/repl/test/unknown_proof_state.in +3 -0
- itp_interface/tools/repl/test/unknown_tactic.expected.out +14 -0
- itp_interface/tools/repl/test/unknown_tactic.in +3 -0
- itp_interface/tools/repl/test/variables.expected.out +26 -0
- itp_interface/tools/repl/test/variables.in +5 -0
- itp_interface/tools/repl/test.sh +43 -0
- itp_interface/tools/run_data_generation_transforms.py +350 -0
- itp_interface/tools/theorem_details.py +25 -0
- itp_interface/tools/training_data.py +358 -0
- itp_interface/tools/training_data_format.py +599 -0
- itp_interface-1.0.0.dist-info/METADATA +78 -0
- itp_interface-1.0.0.dist-info/RECORD +485 -0
- itp_interface-1.0.0.dist-info/WHEEL +4 -0
- itp_interface-1.0.0.dist-info/entry_points.txt +3 -0
- itp_interface-1.0.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/-
|
|
2
|
+
Copyright (c) 2023 Lean FRO, LLC. All rights reserved.
|
|
3
|
+
Released under Apache 2.0 license as described in the file LICENSE.
|
|
4
|
+
Authors: Scott Morrison
|
|
5
|
+
-/
|
|
6
|
+
import Lean.Replay
|
|
7
|
+
import Lean.Elab.Command
|
|
8
|
+
import REPL.Util.Pickle
|
|
9
|
+
|
|
10
|
+
open Lean Elab
|
|
11
|
+
|
|
12
|
+
namespace Lean.Elab.Command
|
|
13
|
+
|
|
14
|
+
@[inline] def CommandElabM.run (x : CommandElabM α) (ctx : Context) (s : State) : EIO Exception (α × State) :=
|
|
15
|
+
(x ctx).run s
|
|
16
|
+
|
|
17
|
+
@[inline] def CommandElabM.run' (x : CommandElabM α) (ctx : Context) (s : State) : EIO Exception α :=
|
|
18
|
+
Prod.fst <$> x.run ctx s
|
|
19
|
+
|
|
20
|
+
@[inline] def CommandElabM.toIO (x : CommandElabM α) (ctx : Context) (s : State) : IO (α × State) := do
|
|
21
|
+
match (← (x.run ctx s).toIO') with
|
|
22
|
+
| Except.error (Exception.error _ msg) => throw <| IO.userError (← msg.toString)
|
|
23
|
+
| Except.error (Exception.internal id _) => throw <| IO.userError <| "internal exception #" ++ toString id.idx
|
|
24
|
+
| Except.ok a => return a
|
|
25
|
+
|
|
26
|
+
end Lean.Elab.Command
|
|
27
|
+
|
|
28
|
+
namespace REPL
|
|
29
|
+
|
|
30
|
+
/--
|
|
31
|
+
Bundled structure for the `State` and `Context` objects
|
|
32
|
+
for the `CommandElabM` monad.
|
|
33
|
+
-/
|
|
34
|
+
structure CommandSnapshot where
|
|
35
|
+
cmdState : Command.State
|
|
36
|
+
cmdContext : Command.Context
|
|
37
|
+
|
|
38
|
+
namespace CommandSnapshot
|
|
39
|
+
|
|
40
|
+
open Lean.Elab.Command
|
|
41
|
+
|
|
42
|
+
/-- A copy of `Command.State` with the `Environment`, caches, and logging omitted. -/
|
|
43
|
+
structure CompactableCommandSnapshot where
|
|
44
|
+
-- env : Environment
|
|
45
|
+
scopes : List Scope := [{ header := "" }]
|
|
46
|
+
nextMacroScope : Nat := firstFrontendMacroScope + 1
|
|
47
|
+
maxRecDepth : Nat
|
|
48
|
+
nextInstIdx : Nat := 1 -- for generating anonymous instance names
|
|
49
|
+
ngen : NameGenerator := {}
|
|
50
|
+
-- infoState : InfoState := {}
|
|
51
|
+
-- traceState : TraceState := {}
|
|
52
|
+
-- messages : MessageLog := {}
|
|
53
|
+
|
|
54
|
+
open System (FilePath)
|
|
55
|
+
|
|
56
|
+
/--
|
|
57
|
+
Run a `CommandElabM` monadic function in the current `ProofSnapshot`,
|
|
58
|
+
updating the `Command.State`.
|
|
59
|
+
-/
|
|
60
|
+
def runCommandElabM (p : CommandSnapshot) (t : CommandElabM α) : IO (α × CommandSnapshot) := do
|
|
61
|
+
let (a, cmdState) ← (CommandElabM.toIO · p.cmdContext p.cmdState) do t
|
|
62
|
+
return (a, { p with cmdState })
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
/--
|
|
66
|
+
Pickle a `CommandSnapshot`, discarding closures and non-essential caches.
|
|
67
|
+
|
|
68
|
+
When pickling the `Environment`, we do so relative to its imports.
|
|
69
|
+
-/
|
|
70
|
+
def pickle (p : CommandSnapshot) (path : FilePath) : IO Unit := do
|
|
71
|
+
let env := p.cmdState.env
|
|
72
|
+
let p' := { p with cmdState := { p.cmdState with env := ← mkEmptyEnvironment }}
|
|
73
|
+
_root_.pickle path
|
|
74
|
+
(env.header.imports,
|
|
75
|
+
env.constants.map₂,
|
|
76
|
+
({ p'.cmdState with } : CompactableCommandSnapshot),
|
|
77
|
+
p'.cmdContext)
|
|
78
|
+
|
|
79
|
+
/--
|
|
80
|
+
Unpickle a `CommandSnapshot`.
|
|
81
|
+
-/
|
|
82
|
+
def unpickle (path : FilePath) : IO (CommandSnapshot × CompactedRegion) := unsafe do
|
|
83
|
+
let ((imports, map₂, cmdState, cmdContext), region) ←
|
|
84
|
+
_root_.unpickle (Array Import × PHashMap Name ConstantInfo × CompactableCommandSnapshot ×
|
|
85
|
+
Command.Context) path
|
|
86
|
+
let env ← (← importModules imports {} 0).replay (HashMap.ofList map₂.toList)
|
|
87
|
+
let p' : CommandSnapshot :=
|
|
88
|
+
{ cmdState := { cmdState with env }
|
|
89
|
+
cmdContext }
|
|
90
|
+
let (_, p'') ← p'.runCommandElabM do
|
|
91
|
+
for o in ← getOpenDecls do
|
|
92
|
+
if let .simple ns _ := o then do
|
|
93
|
+
activateScoped ns
|
|
94
|
+
return (p'', region)
|
|
95
|
+
|
|
96
|
+
end CommandSnapshot
|
|
97
|
+
|
|
98
|
+
/--
|
|
99
|
+
Bundled structure for the `State` and `Context` objects
|
|
100
|
+
for the `CoreM`, `MetaM`, `TermElabM`, and `TacticM` monads.
|
|
101
|
+
-/
|
|
102
|
+
structure ProofSnapshot where
|
|
103
|
+
coreState : Core.State
|
|
104
|
+
coreContext : Core.Context
|
|
105
|
+
metaState : Meta.State
|
|
106
|
+
metaContext : Meta.Context
|
|
107
|
+
termState : Term.State
|
|
108
|
+
termContext : Term.Context
|
|
109
|
+
tacticState : Tactic.State
|
|
110
|
+
tacticContext : Tactic.Context
|
|
111
|
+
|
|
112
|
+
namespace ProofSnapshot
|
|
113
|
+
|
|
114
|
+
open Lean Elab Tactic
|
|
115
|
+
|
|
116
|
+
/-- New messages in a `ProofSnapshot`, relative to an optional previous `ProofSnapshot`. -/
|
|
117
|
+
def newMessages (new : ProofSnapshot) (old? : Option ProofSnapshot := none) : List Lean.Message :=
|
|
118
|
+
match old? with
|
|
119
|
+
| none => new.coreState.messages.msgs.toList
|
|
120
|
+
| some old => new.coreState.messages.msgs.toList.drop (old.coreState.messages.msgs.size)
|
|
121
|
+
|
|
122
|
+
/-- New info trees in a `ProofSnapshot`, relative to an optional previous `ProofSnapshot`. -/
|
|
123
|
+
def newInfoTrees (new : ProofSnapshot) (old? : Option ProofSnapshot := none) : List InfoTree :=
|
|
124
|
+
let infoState := new.coreState.infoState
|
|
125
|
+
let trees := match old? with
|
|
126
|
+
| none => infoState.trees.toList
|
|
127
|
+
| some old => infoState.trees.toList.drop (old.coreState.infoState.trees.size)
|
|
128
|
+
trees.map fun t => t.substitute infoState.assignment
|
|
129
|
+
|
|
130
|
+
/-- Run a `CoreM` monadic function in the current `ProofSnapshot`, updating the `Core.State`. -/
|
|
131
|
+
def runCoreM (p : ProofSnapshot) (t : CoreM α) : IO (α × ProofSnapshot) := do
|
|
132
|
+
let (a, coreState) ← (Lean.Core.CoreM.toIO · p.coreContext p.coreState) do t
|
|
133
|
+
return (a, { p with coreState })
|
|
134
|
+
|
|
135
|
+
/-- Run a `MetaM` monadic function in the current `ProofSnapshot`, updating the `Meta.State`. -/
|
|
136
|
+
def runMetaM (p : ProofSnapshot) (t : MetaM α) : IO (α × ProofSnapshot) := do
|
|
137
|
+
let ((a, metaState), p') ←
|
|
138
|
+
p.runCoreM (Lean.Meta.MetaM.run (ctx := p.metaContext) (s := p.metaState) do t)
|
|
139
|
+
return (a, { p' with metaState })
|
|
140
|
+
|
|
141
|
+
/-- Run a `TermElabM` monadic function in the current `ProofSnapshot`, updating the `Term.State`. -/
|
|
142
|
+
def runTermElabM (p : ProofSnapshot) (t : TermElabM α) : IO (α × ProofSnapshot) := do
|
|
143
|
+
let ((a, termState), p') ← p.runMetaM (Lean.Elab.Term.TermElabM.run (s := p.termState)
|
|
144
|
+
(do let r ← t; Term.synthesizeSyntheticMVarsNoPostponing; pure r))
|
|
145
|
+
return (a, { p' with termState })
|
|
146
|
+
|
|
147
|
+
/-- Run a `TacticM` monadic function in the current `ProofSnapshot`, updating the `Tactic.State`. -/
|
|
148
|
+
def runTacticM (p : ProofSnapshot) (t : TacticM α) : IO (α × ProofSnapshot) := do
|
|
149
|
+
let ((a, tacticState), p') ← p.runTermElabM (t p.tacticContext |>.run p.tacticState)
|
|
150
|
+
return (a, { p' with tacticState })
|
|
151
|
+
|
|
152
|
+
/--
|
|
153
|
+
Run a `TacticM` monadic function in the current `ProofSnapshot`, updating the `Tactic.State`,
|
|
154
|
+
and discarding the return value.
|
|
155
|
+
-/
|
|
156
|
+
def runTacticM' (p : ProofSnapshot) (t : TacticM α) : IO ProofSnapshot :=
|
|
157
|
+
Prod.snd <$> p.runTacticM t
|
|
158
|
+
|
|
159
|
+
/-- New traces in a `ProofSnapshot`, relative to an optional previous `ProofSnapshot`. -/
|
|
160
|
+
def newTraces (new : ProofSnapshot) (old? : Option ProofSnapshot := none) : IO (List String) :=
|
|
161
|
+
match old? with
|
|
162
|
+
| none => (·.1) <$> new.runCoreM (do
|
|
163
|
+
(← getTraces).toList.mapM fun t => do pure (← t.msg.toString).trim)
|
|
164
|
+
| some old => do
|
|
165
|
+
let oldCount ← (·.1) <$> old.runCoreM (return (← getTraces).size)
|
|
166
|
+
(·.1) <$> new.runCoreM (do
|
|
167
|
+
((← getTraces).toList.drop oldCount).mapM fun t => do pure (← t.msg.toString).trim)
|
|
168
|
+
|
|
169
|
+
/--
|
|
170
|
+
Evaluate a `Syntax` into a `TacticM` tactic, and run it in the current `ProofSnapshot`.
|
|
171
|
+
-/
|
|
172
|
+
def runSyntax (p : ProofSnapshot) (t : Syntax) : IO ProofSnapshot :=
|
|
173
|
+
Prod.snd <$> p.runTacticM (evalTactic t)
|
|
174
|
+
|
|
175
|
+
/--
|
|
176
|
+
Parse a string into a `Syntax`, evaluate it as a `TacticM` tactic,
|
|
177
|
+
and run it in the current `ProofSnapshot`.
|
|
178
|
+
-/
|
|
179
|
+
def runString (p : ProofSnapshot) (t : String) : IO ProofSnapshot :=
|
|
180
|
+
match Parser.runParserCategory p.coreState.env `tactic t with
|
|
181
|
+
| .error e => throw (IO.userError e)
|
|
182
|
+
| .ok stx => p.runSyntax stx
|
|
183
|
+
|
|
184
|
+
/-- Pretty print the current goals in the `ProofSnapshot`. -/
|
|
185
|
+
def ppGoals (p : ProofSnapshot) : IO (List Format) :=
|
|
186
|
+
Prod.fst <$> p.runMetaM do p.tacticState.goals.mapM (Meta.ppGoal ·)
|
|
187
|
+
/--
|
|
188
|
+
Construct a `ProofSnapshot` from a `ContextInfo` and optional `LocalContext`, and a list of goals.
|
|
189
|
+
|
|
190
|
+
For convenience, we also allow a list of `Expr`s, and these are appended to the goals
|
|
191
|
+
as fresh metavariables with the given types.
|
|
192
|
+
-/
|
|
193
|
+
def create (ctx : ContextInfo) (lctx? : Option LocalContext) (env? : Option Environment)
|
|
194
|
+
(goals : List MVarId) (types : List Expr := []) : IO ProofSnapshot := do
|
|
195
|
+
ctx.runMetaM (lctx?.getD {}) do
|
|
196
|
+
let goals := goals ++ (← types.mapM fun t => Expr.mvarId! <$> Meta.mkFreshExprMVar (some t))
|
|
197
|
+
goals.head!.withContext do
|
|
198
|
+
let s ← getThe Core.State
|
|
199
|
+
let s := match env? with
|
|
200
|
+
| none => s
|
|
201
|
+
| some env => { s with env }
|
|
202
|
+
pure <|
|
|
203
|
+
{ coreState := s
|
|
204
|
+
coreContext := ← readThe Core.Context
|
|
205
|
+
metaState := ← getThe Meta.State
|
|
206
|
+
metaContext := ← readThe Meta.Context
|
|
207
|
+
termState := {}
|
|
208
|
+
termContext := {}
|
|
209
|
+
tacticState := { goals }
|
|
210
|
+
tacticContext := { elaborator := .anonymous } }
|
|
211
|
+
|
|
212
|
+
open Lean.Core in
|
|
213
|
+
/-- A copy of `Core.State` with the `Environment`, caches, and logging omitted. -/
|
|
214
|
+
structure CompactableCoreState where
|
|
215
|
+
-- env : Environment
|
|
216
|
+
nextMacroScope : MacroScope := firstFrontendMacroScope + 1
|
|
217
|
+
ngen : NameGenerator := {}
|
|
218
|
+
-- traceState : TraceState := {}
|
|
219
|
+
-- cache : Core.Cache := {}
|
|
220
|
+
-- messages : MessageLog := {}
|
|
221
|
+
-- infoState : Elab.InfoState := {}
|
|
222
|
+
|
|
223
|
+
open Lean.Meta in
|
|
224
|
+
/-- A copy of `Meta.Context` with closures omitted. -/
|
|
225
|
+
structure CompactableMetaContext where
|
|
226
|
+
config : Config := {}
|
|
227
|
+
lctx : LocalContext := {}
|
|
228
|
+
localInstances : LocalInstances := #[]
|
|
229
|
+
defEqCtx? : Option DefEqContext := none
|
|
230
|
+
synthPendingDepth : Nat := 0
|
|
231
|
+
-- canUnfold? : Option (Config → ConstantInfo → CoreM Bool) := none
|
|
232
|
+
|
|
233
|
+
/-- A copy of `Term.Context` with closures and a cache omitted. -/
|
|
234
|
+
structure CompactableTermContext where
|
|
235
|
+
declName? : Option Name := none
|
|
236
|
+
auxDeclToFullName : FVarIdMap Name := {}
|
|
237
|
+
macroStack : MacroStack := []
|
|
238
|
+
mayPostpone : Bool := true
|
|
239
|
+
errToSorry : Bool := true
|
|
240
|
+
autoBoundImplicit : Bool := false
|
|
241
|
+
autoBoundImplicits : PArray Expr := {}
|
|
242
|
+
-- autoBoundImplicitForbidden : Name → Bool := fun _ => false
|
|
243
|
+
sectionVars : NameMap Name := {}
|
|
244
|
+
sectionFVars : NameMap Expr := {}
|
|
245
|
+
implicitLambda : Bool := true
|
|
246
|
+
isNoncomputableSection : Bool := false
|
|
247
|
+
ignoreTCFailures : Bool := false
|
|
248
|
+
inPattern : Bool := false
|
|
249
|
+
-- tacticCache? : Option (IO.Ref Tactic.Cache) := none
|
|
250
|
+
saveRecAppSyntax : Bool := true
|
|
251
|
+
holesAsSyntheticOpaque : Bool := false
|
|
252
|
+
|
|
253
|
+
open System (FilePath)
|
|
254
|
+
|
|
255
|
+
/--
|
|
256
|
+
Pickle a `ProofSnapshot`, discarding closures and non-essential caches.
|
|
257
|
+
|
|
258
|
+
When pickling the `Environment`, we do so relative to its imports.
|
|
259
|
+
-/
|
|
260
|
+
def pickle (p : ProofSnapshot) (path : FilePath) : IO Unit := do
|
|
261
|
+
let env := p.coreState.env
|
|
262
|
+
let p' := { p with coreState := { p.coreState with env := ← mkEmptyEnvironment }}
|
|
263
|
+
_root_.pickle path
|
|
264
|
+
(env.header.imports,
|
|
265
|
+
env.constants.map₂,
|
|
266
|
+
({ p'.coreState with } : CompactableCoreState),
|
|
267
|
+
p'.coreContext,
|
|
268
|
+
p'.metaState,
|
|
269
|
+
({ p'.metaContext with } : CompactableMetaContext),
|
|
270
|
+
p'.termState,
|
|
271
|
+
({ p'.termContext with } : CompactableTermContext),
|
|
272
|
+
p'.tacticState,
|
|
273
|
+
p'.tacticContext)
|
|
274
|
+
|
|
275
|
+
/--
|
|
276
|
+
Unpickle a `ProofSnapshot`.
|
|
277
|
+
-/
|
|
278
|
+
def unpickle (path : FilePath) (cmd? : Option CommandSnapshot) :
|
|
279
|
+
IO (ProofSnapshot × CompactedRegion) := unsafe do
|
|
280
|
+
let ((imports, map₂, coreState, coreContext, metaState, metaContext, termState, termContext,
|
|
281
|
+
tacticState, tacticContext), region) ←
|
|
282
|
+
_root_.unpickle (Array Import × PHashMap Name ConstantInfo × CompactableCoreState ×
|
|
283
|
+
Core.Context × Meta.State × CompactableMetaContext × Term.State × CompactableTermContext ×
|
|
284
|
+
Tactic.State × Tactic.Context) path
|
|
285
|
+
let env ← match cmd? with
|
|
286
|
+
| none =>
|
|
287
|
+
enableInitializersExecution
|
|
288
|
+
(← importModules imports {} 0).replay (HashMap.ofList map₂.toList)
|
|
289
|
+
| some cmd =>
|
|
290
|
+
cmd.cmdState.env.replay (HashMap.ofList map₂.toList)
|
|
291
|
+
let p' : ProofSnapshot :=
|
|
292
|
+
{ coreState := { coreState with env }
|
|
293
|
+
coreContext
|
|
294
|
+
metaState
|
|
295
|
+
metaContext := { metaContext with }
|
|
296
|
+
termState
|
|
297
|
+
termContext := { termContext with }
|
|
298
|
+
tacticState
|
|
299
|
+
tacticContext }
|
|
300
|
+
let (_, p'') ← p'.runCoreM do
|
|
301
|
+
for o in ← getOpenDecls do
|
|
302
|
+
if let .simple ns _ := o then
|
|
303
|
+
activateScoped ns
|
|
304
|
+
return (p'', region)
|
|
305
|
+
|
|
306
|
+
end ProofSnapshot
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/-
|
|
2
|
+
Copyright (c) 2022 Gabriel Ebner. All rights reserved.
|
|
3
|
+
Released under Apache 2.0 license as described in the file LICENSE.
|
|
4
|
+
Authors: Gabriel Ebner
|
|
5
|
+
-/
|
|
6
|
+
import Lean
|
|
7
|
+
|
|
8
|
+
-- This has been duplicated from Std4 to avoid a dependency.
|
|
9
|
+
|
|
10
|
+
/-!
|
|
11
|
+
# `compile_time_search_path%` term elaborator.
|
|
12
|
+
|
|
13
|
+
Use this as `searchPathRef.set compile_time_search_path%`.
|
|
14
|
+
-/
|
|
15
|
+
|
|
16
|
+
open Lean System
|
|
17
|
+
|
|
18
|
+
-- Ideally this instance would be constructed simply by `deriving instance ToExpr for FilePath`
|
|
19
|
+
-- but for now we have decided not to upstream the `ToExpr` derive handler from `Mathlib`.
|
|
20
|
+
-- https://leanprover.zulipchat.com/#narrow/stream/348111-std4/topic/ToExpr.20derive.20handler/near/386476438
|
|
21
|
+
instance : ToExpr FilePath where
|
|
22
|
+
toTypeExpr := mkConst ``FilePath
|
|
23
|
+
toExpr path := mkApp (mkConst ``FilePath.mk) (toExpr path.1)
|
|
24
|
+
|
|
25
|
+
/--
|
|
26
|
+
Term elaborator that retrieves the current `SearchPath`.
|
|
27
|
+
|
|
28
|
+
Typical usage is `searchPathRef.set compile_time_search_path%`.
|
|
29
|
+
|
|
30
|
+
This must not be used in files that are potentially compiled on another machine and then
|
|
31
|
+
imported.
|
|
32
|
+
(That is, if used in an imported file it will embed the search path from whichever machine
|
|
33
|
+
compiled the `.olean`.)
|
|
34
|
+
-/
|
|
35
|
+
elab "compile_time_search_path%" : term =>
|
|
36
|
+
return toExpr (← searchPathRef.get)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/-
|
|
2
|
+
Copyright (c) 2023 Mario Carneiro. All rights reserved.
|
|
3
|
+
Released under Apache 2.0 license as described in the file LICENSE.
|
|
4
|
+
Authors: Mario Carneiro
|
|
5
|
+
-/
|
|
6
|
+
import Lean.Environment
|
|
7
|
+
|
|
8
|
+
/-!
|
|
9
|
+
# Pickling and unpickling objects
|
|
10
|
+
|
|
11
|
+
By abusing `saveModuleData` and `readModuleData` we can pickle and unpickle objects to disk.
|
|
12
|
+
-/
|
|
13
|
+
|
|
14
|
+
open Lean System
|
|
15
|
+
|
|
16
|
+
/--
|
|
17
|
+
Save an object to disk.
|
|
18
|
+
If you need to write multiple objects from within a single declaration,
|
|
19
|
+
you will need to provide a unique `key` for each.
|
|
20
|
+
-/
|
|
21
|
+
def pickle {α : Type} (path : FilePath) (x : α) (key : Name := by exact decl_name%) : IO Unit :=
|
|
22
|
+
saveModuleData path key (unsafe unsafeCast x)
|
|
23
|
+
|
|
24
|
+
/--
|
|
25
|
+
Load an object from disk.
|
|
26
|
+
Note: The returned `CompactedRegion` can be used to free the memory behind the value
|
|
27
|
+
of type `α`, using `CompactedRegion.free` (which is only safe once all references to the `α` are
|
|
28
|
+
released). Ignoring the `CompactedRegion` results in the data being leaked.
|
|
29
|
+
Use `withUnpickle` to call `CompactedRegion.free` automatically.
|
|
30
|
+
|
|
31
|
+
This function is unsafe because the data being loaded may not actually have type `α`, and this
|
|
32
|
+
may cause crashes or other bad behavior.
|
|
33
|
+
-/
|
|
34
|
+
unsafe def unpickle (α : Type) (path : FilePath) : IO (α × CompactedRegion) := do
|
|
35
|
+
let (x, region) ← readModuleData path
|
|
36
|
+
pure (unsafeCast x, region)
|
|
37
|
+
|
|
38
|
+
/-- Load an object from disk and run some continuation on it, freeing memory afterwards. -/
|
|
39
|
+
unsafe def withUnpickle [Monad m] [MonadLiftT IO m] {α β : Type}
|
|
40
|
+
(path : FilePath) (f : α → m β) : m β := do
|
|
41
|
+
let (x, region) ← unpickle α path
|
|
42
|
+
let r ← f x
|
|
43
|
+
region.free
|
|
44
|
+
pure r
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Lake
|
|
2
|
+
open Lake DSL
|
|
3
|
+
|
|
4
|
+
package REPL {
|
|
5
|
+
-- add package configuration options here
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
lean_lib REPL {
|
|
9
|
+
-- add library configuration options here
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@[default_target]
|
|
13
|
+
lean_exe repl where
|
|
14
|
+
root := `REPL.Main
|
|
15
|
+
supportInterpreter := true
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
leanprover/lean4:v4.7.0-rc2
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import Mathlib
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{"version": 7,
|
|
2
|
+
"packagesDir": ".lake/packages",
|
|
3
|
+
"packages":
|
|
4
|
+
[{"url": "https://github.com/leanprover/std4",
|
|
5
|
+
"type": "git",
|
|
6
|
+
"subDir": null,
|
|
7
|
+
"rev": "ff9850c4726f6b9fb8d8e96980c3fcb2900be8bd",
|
|
8
|
+
"name": "std",
|
|
9
|
+
"manifestFile": "lake-manifest.json",
|
|
10
|
+
"inputRev": "main",
|
|
11
|
+
"inherited": true,
|
|
12
|
+
"configFile": "lakefile.lean"},
|
|
13
|
+
{"url": "https://github.com/leanprover-community/quote4",
|
|
14
|
+
"type": "git",
|
|
15
|
+
"subDir": null,
|
|
16
|
+
"rev": "fd760831487e6835944e7eeed505522c9dd47563",
|
|
17
|
+
"name": "Qq",
|
|
18
|
+
"manifestFile": "lake-manifest.json",
|
|
19
|
+
"inputRev": "master",
|
|
20
|
+
"inherited": true,
|
|
21
|
+
"configFile": "lakefile.lean"},
|
|
22
|
+
{"url": "https://github.com/leanprover-community/aesop",
|
|
23
|
+
"type": "git",
|
|
24
|
+
"subDir": null,
|
|
25
|
+
"rev": "056ca0fa8f5585539d0b940f532d9750c3a2270f",
|
|
26
|
+
"name": "aesop",
|
|
27
|
+
"manifestFile": "lake-manifest.json",
|
|
28
|
+
"inputRev": "master",
|
|
29
|
+
"inherited": true,
|
|
30
|
+
"configFile": "lakefile.lean"},
|
|
31
|
+
{"url": "https://github.com/leanprover-community/ProofWidgets4",
|
|
32
|
+
"type": "git",
|
|
33
|
+
"subDir": null,
|
|
34
|
+
"rev": "fb65c476595a453a9b8ffc4a1cea2db3a89b9cd8",
|
|
35
|
+
"name": "proofwidgets",
|
|
36
|
+
"manifestFile": "lake-manifest.json",
|
|
37
|
+
"inputRev": "v0.0.30",
|
|
38
|
+
"inherited": true,
|
|
39
|
+
"configFile": "lakefile.lean"},
|
|
40
|
+
{"url": "https://github.com/leanprover/lean4-cli",
|
|
41
|
+
"type": "git",
|
|
42
|
+
"subDir": null,
|
|
43
|
+
"rev": "a751d21d4b68c999accb6fc5d960538af26ad5ec",
|
|
44
|
+
"name": "Cli",
|
|
45
|
+
"manifestFile": "lake-manifest.json",
|
|
46
|
+
"inputRev": "main",
|
|
47
|
+
"inherited": true,
|
|
48
|
+
"configFile": "lakefile.lean"},
|
|
49
|
+
{"url": "https://github.com/leanprover-community/import-graph.git",
|
|
50
|
+
"type": "git",
|
|
51
|
+
"subDir": null,
|
|
52
|
+
"rev": "64d082eeaad1a8e6bbb7c23b7a16b85a1715a02f",
|
|
53
|
+
"name": "importGraph",
|
|
54
|
+
"manifestFile": "lake-manifest.json",
|
|
55
|
+
"inputRev": "main",
|
|
56
|
+
"inherited": true,
|
|
57
|
+
"configFile": "lakefile.lean"},
|
|
58
|
+
{"url": "https://github.com/leanprover-community/mathlib4",
|
|
59
|
+
"type": "git",
|
|
60
|
+
"subDir": null,
|
|
61
|
+
"rev": "59fdb6b04d7d16825a54483d550d9572ff473abf",
|
|
62
|
+
"name": "mathlib",
|
|
63
|
+
"manifestFile": "lake-manifest.json",
|
|
64
|
+
"inputRev": "v4.7.0-rc2",
|
|
65
|
+
"inherited": false,
|
|
66
|
+
"configFile": "lakefile.lean"}],
|
|
67
|
+
"name": "«repl-mathlib-tests»",
|
|
68
|
+
"lakeDir": ".lake"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Lake
|
|
2
|
+
open Lake DSL
|
|
3
|
+
|
|
4
|
+
package «repl-mathlib-tests» where
|
|
5
|
+
-- add package configuration options here
|
|
6
|
+
require mathlib from git "https://github.com/leanprover-community/mathlib4" @ "v4.7.0-rc2"
|
|
7
|
+
|
|
8
|
+
@[default_target]
|
|
9
|
+
lean_lib «ReplMathlibTests» where
|
|
10
|
+
globs := #[.submodules `test]
|
|
11
|
+
-- add library configuration options here
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
leanprover/lean4:v4.7.0-rc2
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{"sorries":
|
|
2
|
+
[{"proofState": 0,
|
|
3
|
+
"pos": {"line": 1, "column": 22},
|
|
4
|
+
"goal": "⊢ False",
|
|
5
|
+
"endPos": {"line": 1, "column": 27}}],
|
|
6
|
+
"messages":
|
|
7
|
+
[{"severity": "warning",
|
|
8
|
+
"pos": {"line": 1, "column": 0},
|
|
9
|
+
"endPos": {"line": 1, "column": 7},
|
|
10
|
+
"data": "declaration uses 'sorry'"}],
|
|
11
|
+
"env": 0}
|
|
12
|
+
|
|
13
|
+
{"proofState": 1,
|
|
14
|
+
"messages":
|
|
15
|
+
[{"severity": "error",
|
|
16
|
+
"pos": {"line": 0, "column": 0},
|
|
17
|
+
"endPos": {"line": 0, "column": 0},
|
|
18
|
+
"data": "unsolved goals\n⊢ False"}],
|
|
19
|
+
"goals": []}
|
|
20
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{"cmd": "import Mathlib.Algebra.BigOperators.Basic\nimport Mathlib.Data.Real.Basic\nimport Mathlib.Data.Complex.Basic\nimport Mathlib.Data.Nat.Log\nimport Mathlib.Data.Complex.Exponential\nimport Mathlib.NumberTheory.Divisors\nimport Mathlib.Data.ZMod.Defs\nimport Mathlib.Data.ZMod.Basic\nimport Mathlib.Topology.Basic\nimport Mathlib.Data.Nat.Digits\nimport Mathlib.Tactic.NormNum.GCD\nopen BigOperators\nopen Real\nopen Nat\nopen Topology"}
|
|
2
|
+
|
|
3
|
+
{"cmd": "theorem mathd_numbertheory_188 : Nat.gcd 180 168 = 12 := by norm_num", "env": 0}
|
|
4
|
+
|
|
5
|
+
{"cmd": "theorem mathd_numbertheory_403 : ∑ k in (Nat.properDivisors 198), k = 270 := by simp (config := {decide := true})", "env": 0}
|
|
6
|
+
|
|
7
|
+
{"cmd": "theorem mathd_numbertheory_109 (v : ℕ → ℕ) (h₀ : ∀ n, v n = 2 * n - 1) : (∑ k in Finset.Icc 1 100, v k) % 7 = 4 := by simp_rw (config := {decide := true}) [h₀]", "env": 0}
|
|
8
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import Mathlib.Algebra.BigOperators.Basic
|
|
2
|
+
import Mathlib.Data.Real.Basic
|
|
3
|
+
import Mathlib.Data.Complex.Basic
|
|
4
|
+
import Mathlib.Data.Nat.Log
|
|
5
|
+
import Mathlib.Data.Complex.Exponential
|
|
6
|
+
import Mathlib.NumberTheory.Divisors
|
|
7
|
+
import Mathlib.Data.ZMod.Defs
|
|
8
|
+
import Mathlib.Data.ZMod.Basic
|
|
9
|
+
import Mathlib.Topology.Basic
|
|
10
|
+
import Mathlib.Data.Nat.Digits
|
|
11
|
+
import Mathlib.Tactic.NormNum.GCD
|
|
12
|
+
|
|
13
|
+
open BigOperators
|
|
14
|
+
open Real
|
|
15
|
+
open Nat
|
|
16
|
+
open Topology
|
|
17
|
+
|
|
18
|
+
theorem mathd_numbertheory_188 : Nat.gcd 180 168 = 12 := by norm_num
|
|
19
|
+
|
|
20
|
+
theorem mathd_numbertheory_403 : ∑ k in (Nat.properDivisors 198), k = 270 := by simp (config := {decide := true})
|
|
21
|
+
|
|
22
|
+
theorem mathd_numbertheory_109 (v : ℕ → ℕ) (h₀ : ∀ n, v n = 2 * n - 1) : (∑ k in Finset.Icc 1 100, v k) % 7 = 4 := by simp_rw (config := {decide := true}) [h₀]
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
{"cmd": "import Mathlib\nopen Real\nlocal macro_rules | `($x ^ $y) => `(HPow.hPow $x $y)"}
|
|
2
|
+
|
|
3
|
+
{"cmd": "example {n} {x a b : ℝ} (m : ℕ) (e₁ : n + 1 = m) (rm : ℝ) (er : ↑m = rm) (h : |x| ≤ 1) (e : |1 - a| ≤ b - |x| / rm * ((rm + 1) / rm)) : |exp x - expNear n x a| ≤ |x| ^ n / n.factorial * b := by apply Real.exp_approx_end' m e₁ rm er h e", "env": 0}
|
|
4
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{"env": 0}
|
|
2
|
+
|
|
3
|
+
{"sorries":
|
|
4
|
+
[{"proofState": 0,
|
|
5
|
+
"pos": {"line": 1, "column": 36},
|
|
6
|
+
"goal": "x : Nat\n⊢ x + 1 > x",
|
|
7
|
+
"endPos": {"line": 1, "column": 41}}],
|
|
8
|
+
"messages":
|
|
9
|
+
[{"severity": "warning",
|
|
10
|
+
"pos": {"line": 1, "column": 0},
|
|
11
|
+
"endPos": {"line": 1, "column": 7},
|
|
12
|
+
"data": "declaration uses 'sorry'"}],
|
|
13
|
+
"env": 1}
|
|
14
|
+
|
|
15
|
+
{"proofState": 1,
|
|
16
|
+
"goals":
|
|
17
|
+
["case zero\n⊢ Nat.zero + 1 > Nat.zero",
|
|
18
|
+
"case succ\nx : Nat\nhx : x + 1 > x\n⊢ Nat.succ x + 1 > Nat.succ x"]}
|
|
19
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{"env": 0}
|
|
2
|
+
|
|
3
|
+
{"sorries":
|
|
4
|
+
[{"proofState": 0,
|
|
5
|
+
"pos": {"line": 3, "column": 12},
|
|
6
|
+
"goal": "case zero\n⊢ Nat.zero + 1 > Nat.zero",
|
|
7
|
+
"endPos": {"line": 3, "column": 17}},
|
|
8
|
+
{"proofState": 1,
|
|
9
|
+
"pos": {"line": 3, "column": 12},
|
|
10
|
+
"goal": "case succ\nx : Nat\nhx : x + 1 > x\n⊢ Nat.succ x + 1 > Nat.succ x",
|
|
11
|
+
"endPos": {"line": 3, "column": 17}}],
|
|
12
|
+
"messages":
|
|
13
|
+
[{"severity": "warning",
|
|
14
|
+
"pos": {"line": 1, "column": 0},
|
|
15
|
+
"endPos": {"line": 1, "column": 7},
|
|
16
|
+
"data": "declaration uses 'sorry'"}],
|
|
17
|
+
"env": 1}
|
|
18
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{"env": 0}
|
|
2
|
+
|
|
3
|
+
{"messages":
|
|
4
|
+
[{"severity": "error",
|
|
5
|
+
"pos": {"line": 1, "column": 33},
|
|
6
|
+
"endPos": {"line": 2, "column": 24},
|
|
7
|
+
"data":
|
|
8
|
+
"unsolved goals\ncase zero\n⊢ Nat.zero + 1 > Nat.zero\n\ncase succ\nx : Nat\nhx : x + 1 > x\n⊢ Nat.succ x + 1 > Nat.succ x"}],
|
|
9
|
+
"env": 1}
|
|
10
|
+
|