├── library ├── leanpkg.path └── smt │ └── default.lean ├── tests ├── lean │ ├── 388.lean.expected.out │ ├── .gitignore │ ├── 671.lean │ ├── bad_end.lean │ ├── param.lean.expected.out │ ├── shadow.lean.expected.out │ ├── simp_ite.lean.expected.out │ ├── 1860.lean.expected.out │ ├── bad_error2.lean.expected.out │ ├── bad_open.lean │ ├── defeq_match.lean.expected.out │ ├── exit_comment.lean │ ├── fail │ │ ├── parser_error.lean │ │ ├── run_command.lean │ │ ├── failed_lemma.lean │ │ ├── example.lean │ │ └── non_meta_rec_fn.lean │ ├── lift_coe_off.lean.expected.out │ ├── rw_symm_mvar.lean.expected.out │ ├── vm_eval_crash.lean │ ├── 172.lean.expected.out │ ├── bad_inaccessible.lean.expected.out │ ├── bad_inaccessible2.lean.expected.out │ ├── extra │ │ ├── print_info.12.30.expected.out │ │ ├── 616a.hlean │ │ ├── eqn_macro2.lean │ │ ├── print_info.21.0.expected.out │ │ ├── print_info.21.1.expected.out │ │ ├── 597a.hlean │ │ ├── print_info.21.3.expected.out │ │ ├── print_info.8.19.expected.out │ │ ├── show_goal.18.21.expected.out │ │ ├── show_goal.24.3.expected.out │ │ ├── show_goal.9.12.expected.out │ │ ├── 597b.hlean │ │ ├── print_tests.lean │ │ ├── print_info.17.0.expected.out │ │ ├── print_info.17.2.expected.out │ │ ├── goal_hole.lean │ │ ├── print_info.12.19.expected.out │ │ ├── print_info.12.20.expected.out │ │ ├── print_info.7.18.expected.out │ │ ├── rec2.lean │ │ ├── print_info.4.16.expected.out │ │ ├── show_goal.6.0.expected.out │ │ ├── show_goal.8.4.expected.out │ │ ├── show_goal.8.5.expected.out │ │ ├── show_goal.9.4.expected.out │ │ ├── 755.expected.out │ │ ├── show_goal.6.14.expected.out │ │ ├── dir_option.lean │ │ ├── eqn_macro1.lean │ │ ├── show_goal.18.6.expected.out │ │ ├── show_goal.14.6.expected.out │ │ └── show_goal.15.6.expected.out │ ├── ppbug.lean │ ├── set_replacement.lean.expected.out │ ├── 1745.lean │ ├── alias2.lean.expected.out │ ├── destructive_let_issue.lean.expected.out │ ├── io_bug2.lean.expected.out │ ├── nat_pp.lean.expected.out │ ├── native_run │ │ ├── .gitignore │ │ ├── hello_world.lean.expected.out │ │ ├── hello_world.lean │ │ └── config.lean │ ├── print_meta.lean │ ├── run │ │ ├── doc_string7a.lean │ │ ├── 600a.lean │ │ ├── 600b.lean │ │ ├── booltst.lean │ │ ├── max_memory.lean │ │ ├── variables_typestar.lean │ │ ├── letters.lean │ │ ├── 1631.lean │ │ ├── if_dollar_prec.lean │ │ ├── lambda_cons.lean │ │ ├── injection.lean │ │ ├── e2.lean │ │ ├── inductive_unfold.lean │ │ ├── sub_bug.lean │ │ ├── 362c.lean │ │ ├── meta3.lean │ │ ├── struct_bug2.lean │ │ ├── def11.lean │ │ ├── num.lean │ │ ├── print_inductive.lean │ │ ├── record8.lean │ │ ├── 444.lean │ │ ├── help_cmd.lean │ │ ├── reflected_coercion_with_mvars.lean │ │ ├── sub.lean │ │ ├── trace_call_stack_segfault.lean │ │ ├── trace_tst.lean │ │ ├── dep_parents.lean │ │ ├── do_const_pat.lean │ │ ├── import_open_locale2.lean │ │ ├── pp_unit.lean │ │ ├── sleep.lean │ │ ├── t7.lean │ │ ├── using_new_ref_interactive.lean │ │ ├── K_new_elab.lean │ │ ├── bor_lazy.lean │ │ ├── check_monad_mk.lean │ │ ├── ex.lean │ │ ├── inductive_type_whnf.lean │ │ ├── inj_eq_hygiene.lean │ │ ├── 1010.lean │ │ ├── 1585.lean │ │ ├── bug5.lean │ │ ├── find.lean │ │ ├── sorry.lean │ │ ├── super.lean │ │ ├── atomic2.lean │ │ ├── default_field_universe.lean │ │ ├── new_elab2.lean │ │ ├── period_after_eqns.lean │ │ ├── ptst.lean │ │ ├── structure_doc_string.lean │ │ ├── 1218.lean │ │ ├── def9.lean │ │ ├── docstring_after_variables.lean │ │ ├── mem_nil.lean │ │ ├── rw_instantiate_mvars.lean │ │ ├── elab3.lean │ │ ├── emptyc_issue.lean │ │ ├── eval_expr_partial.lean │ │ ├── include_bug.lean │ │ ├── inliner_bug.lean │ │ ├── is_class_timeout.lean │ │ ├── univ_delay_thm_bug.lean │ │ ├── univ_elab_issue.lean │ │ ├── 1493.lean │ │ ├── axiom_code.lean │ │ ├── cases_bug2.lean │ │ ├── cases_bug3.lean │ │ ├── ind_tac1.lean │ │ ├── let_vm_bug.lean │ │ ├── overload_issue.lean │ │ ├── singleton_pair.lean │ │ ├── structure_instance_delayed_abstr.lean │ │ ├── 1688.lean │ │ ├── 751.lean │ │ ├── def2.lean │ │ ├── meta1.lean │ │ ├── sec_bug.lean │ │ ├── default_field_pi.lean │ │ ├── mixed_tmp_non_tmp_universe_bug.lean │ │ ├── nasty_sizeof.lean │ │ ├── quote_wo_eval.lean │ │ ├── struct_extend_univ.lean │ │ ├── subst_vars.lean │ │ ├── 1590.lean │ │ ├── atomic_notation.lean │ │ ├── ind0.lean │ │ ├── local_attr_doc.lean │ │ ├── noncomputable_bug.lean │ │ ├── struct_bug3.lean │ │ ├── 437c.lean │ │ ├── 445.lean │ │ ├── nary_existsi.lean │ │ ├── noncomputable_meta.lean │ │ ├── simp_if_true_false.lean │ │ ├── bug_refl_lemma.lean │ │ ├── declare_axiom.lean │ │ ├── def4.lean │ │ ├── full.lean │ │ ├── new_proj_notation.lean │ │ ├── ns1.lean │ │ ├── t10.lean │ │ ├── 490.lean │ │ ├── cases_bug.lean │ │ ├── class1.lean │ │ ├── class2.lean │ │ ├── contradiction_issue.lean │ │ ├── fact_pi.lean │ │ ├── funext_issue.lean │ │ ├── opt_param_cnsts.lean │ │ ├── section3.lean │ │ ├── 1208.lean │ │ ├── 1943.lean │ │ ├── auto_propext.lean │ │ ├── calc_imp.lean │ │ ├── dunfold4.lean │ │ ├── fn_default.lean │ │ ├── rec_and_tac_issue.lean │ │ ├── repeat_tac.lean │ │ ├── 1790.lean │ │ ├── 411c.lean │ │ ├── elab_bool.lean │ │ ├── imp2.lean │ │ ├── partial_explicit1.lean │ │ ├── prod_notation.lean │ │ ├── protected.lean │ │ ├── unicode.lean │ │ ├── 1655.lean │ │ ├── def5.lean │ │ ├── ind_ns.lean │ │ ├── record9.lean │ │ ├── 1739.lean │ │ ├── do_notation_tmp_var_issue.lean │ │ ├── empty_match.lean │ │ ├── yury_coe_sort_bug.lean │ │ ├── 600c.lean │ │ ├── anonymous_param.lean │ │ ├── disable_instance.lean │ │ ├── elab4.lean │ │ ├── eval_expr_bug.lean │ │ ├── is_true.lean │ │ ├── level_bug2.lean │ │ ├── mrw.lean │ │ ├── simp_arrow.lean │ │ ├── simp_at_bug.lean │ │ ├── vars_anywhere.lean │ │ ├── 1171.lean │ │ ├── 1609.lean │ │ ├── 1797.lean │ │ ├── const_choice.lean │ │ ├── elab6.lean │ │ ├── int_eq_num.lean │ │ ├── no_field_access.lean │ │ ├── suffices.lean │ │ ├── vm_check_bug.lean │ │ ├── 1302.lean │ │ ├── 1649a.lean │ │ ├── alg_info1.lean │ │ ├── bin_oct_hex.lean │ │ ├── consume.lean │ │ ├── 774.lean │ │ ├── apply1.lean │ │ ├── def_alias.lean │ │ ├── reflected.lean │ │ ├── subobject_from_source.lean │ │ ├── 1093.lean │ │ ├── 1318.lean │ │ ├── 1623.lean │ │ ├── hole1.lean │ │ ├── import_open_locale1.lean │ │ ├── record7.lean │ │ ├── 1525.lean │ │ ├── 372c.lean │ │ ├── begin_end1.lean │ │ ├── generalize_inst.lean │ │ ├── induction_with_drec.lean │ │ ├── parent_struct_inst.lean │ │ ├── quote_patterns.lean │ │ ├── 1258.lean │ │ ├── 1414.lean │ │ ├── 967.lean │ │ ├── async_map.lean │ │ ├── eq25.lean │ │ ├── export.lean │ │ ├── ind1.lean │ │ ├── induction_generalizing_bug.lean │ │ ├── let1.lean │ │ ├── 1951.lean │ │ ├── eq_mpr_def_issue.lean │ │ ├── namespace_local.lean │ │ ├── noequations.lean │ │ ├── simp_auto_param.lean │ │ ├── smt_facts_as_hinst_lemmas.lean │ │ ├── subst_heq.lean │ │ ├── tuple_head_issue.lean │ │ ├── uni_issue1.lean │ │ ├── abstract_ns1.lean │ │ ├── abstract_ns2.lean │ │ ├── apply2.lean │ │ ├── eqn_compiler_variable_or_inaccessible.lean │ │ ├── local_notation.lean │ │ ├── class11.lean │ │ ├── div2.lean │ │ ├── id.lean │ │ ├── io_process_env.lean │ │ ├── is_def_eq_perf_bug.lean │ │ ├── kernel_fin_rfl.lean │ │ ├── set1.lean │ │ ├── 1495.lean │ │ ├── add_decl_namespace.lean │ │ ├── dependent_seq.lean │ │ ├── over3.lean │ │ ├── print_poly.lean │ │ ├── whenIO.lean │ │ ├── 1724.lean │ │ ├── comment.lean │ │ ├── decidable.lean │ │ ├── kha_inst_bug.lean │ │ ├── level_bug1.lean │ │ ├── 1942.lean │ │ ├── abstract_ns.lean │ │ ├── eq2.lean │ │ ├── export2.lean │ │ ├── have1.lean │ │ ├── have2.lean │ │ ├── implicit.lean │ │ ├── ind5.lean │ │ ├── lambda_simp.lean │ │ ├── record4.lean │ │ ├── 1703.lean │ │ ├── eqn_issue.lean │ │ ├── ho.lean │ │ ├── ind_issue.lean │ │ ├── indbug2.lean │ │ ├── reserve.lean │ │ └── 1608.lean │ ├── structure_instance_bug.lean.expected.out │ ├── synth_instances_order.lean.expected.out │ ├── uni_bug1.lean.expected.out │ ├── vm_eval_crash.lean.expected.out │ ├── vm_noncomputable_real.lean.expected.out │ ├── well_founded_tactics.lean.expected.out │ ├── check2.lean │ ├── defeq1.lean.expected.out │ ├── elab5.lean.expected.out │ ├── leanpkg │ │ ├── build_error │ │ │ ├── src │ │ │ │ └── err.lean │ │ │ ├── leanpkg.path │ │ │ └── leanpkg.toml │ │ ├── build_error.sh │ │ ├── new.sh │ │ ├── build_error.sh.expected.out │ │ └── new.sh.expected.out │ ├── namespace_bug.lean.expected.out │ ├── noncomputable_bytecode_issue.lean.expected.out │ ├── parser_run.lean.expected.out │ ├── subpp.lean.expected.out │ ├── vmo1.lean.expected.out │ ├── vmo2.lean.expected.out │ ├── coe3.lean.expected.out │ ├── heuristic_name_field_anonymous.lean.expected.out │ ├── hex_char.lean.expected.out │ ├── io_process_echo.lean.expected.out │ ├── noncomputable_constructor_param.lean.expected.out │ ├── pp_param_bug.lean.expected.out │ ├── print_ax1.lean │ ├── subpp.lean │ ├── t2.lean.expected.out │ ├── trust0 │ │ └── t1.lean │ ├── 1898.lean │ ├── 1956.lean │ ├── const.lean.expected.out │ ├── def3.lean.expected.out │ ├── get_free_var_range.lean.expected.out │ ├── inline_bug.lean.expected.out │ ├── inst.lean.expected.out │ ├── nat_add_assoc_no_axioms.lean.expected.out │ ├── open_namespaces.lean.expected.out │ ├── reflect.lean │ ├── t2.lean │ ├── try_for_time.lean.expected.out │ ├── user_cmd_go_to_def.lean.expected.out │ ├── 858.lean │ ├── def_ite_value.lean.expected.out │ ├── dsimp_whnf.lean.expected.out │ ├── html_cmd.lean.expected.out │ ├── let3.lean.expected.out │ ├── list_lt.lean.expected.out │ ├── nat_add_assoc_no_axioms.lean │ ├── noncomp_error.lean │ ├── pp_beta.lean.expected.out │ ├── sort.lean │ ├── trace1.lean.expected.out │ ├── trace2.lean.expected.out │ ├── utf8.lean.expected.out │ ├── whnf_cache_bug.lean.expected.out │ ├── get_weight.lean.expected.out │ ├── hex_char.lean │ ├── infix_paren_improved.lean.expected.out │ ├── let_elim_issue.lean.expected.out │ ├── noncomp_thm.lean │ ├── reflect.lean.expected.out │ ├── right_assoc_dollar.lean.expected.out │ ├── 268c.lean.expected.out │ ├── coe6.lean.expected.out │ ├── ctxopt.lean.expected.out │ ├── format_to_buffer.lean.expected.out │ ├── get_unused_name.lean.expected.out │ ├── hex_numeral.lean.expected.out │ ├── no_eqn_lemma_for_meta_default.lean.expected.out │ ├── pp_all2.lean.expected.out │ ├── pp_zero_bug.lean │ ├── sec_ns.lean.expected.out │ ├── 1860.lean │ ├── 1922.lean.expected.out │ ├── 1930.lean │ ├── bad_pattern2.lean │ ├── bad_set_option.lean │ ├── check2.lean.expected.out │ ├── eval_tactic.lean.expected.out │ ├── generalize1.lean.expected.out │ ├── import_invalid_tk.lean │ ├── list_monad1.lean.expected.out │ ├── parsing_only.lean.expected.out │ ├── pp_nodot.lean.expected.out │ ├── tuple.lean.expected.out │ ├── vm_string_lt_bug.lean.expected.out │ ├── whnf.lean.expected.out │ ├── 1723.lean.expected.out │ ├── 641.lean │ ├── 695.lean.expected.out │ ├── elab5.lean │ ├── json.lean.expected.out │ ├── missing_import.lean │ ├── qexpr3.lean.expected.out │ ├── structure_with_index_error.lean │ ├── unfold_crash.lean.expected.out │ ├── unicode_lit.lean │ ├── vm_let_expr.lean.expected.out │ ├── eval_tactic.lean │ ├── field_proj_pos.lean │ ├── ftree.lean.expected.out │ ├── noncomputable_reason.lean.expected.out │ ├── pp_notation_rbp_bug.lean │ ├── restrict_bug.lean.expected.out │ ├── widget │ │ ├── widget4.lean │ │ ├── widget5.lean │ │ └── widget4.input │ ├── bad_error5.lean.expected.out │ ├── bad_id.lean │ ├── frozen_local_instances.lean.expected.out │ ├── import_middle.lean │ ├── inst_error.lean │ ├── key_eqv1.lean.expected.out │ ├── macro_args.lean │ ├── match_bug.lean │ ├── notation6.lean.expected.out │ ├── notation8.lean.expected.out │ ├── print_reducible.lean.expected.out │ ├── t13.lean.expected.out │ ├── var2.lean.expected.out │ ├── 1862.lean.expected.out │ ├── 671.lean.expected.out │ ├── attributes.lean.expected.out │ ├── case_let.lean.expected.out │ ├── check.lean │ ├── dunfold_constant.lean │ ├── elab14.lean.expected.out │ ├── eta_bug.lean.expected.out │ ├── exit_comment.lean.expected.out │ ├── ff_byte.lean │ ├── inline_issue.lean.expected.out │ ├── nat_pp.lean │ ├── protected.lean.expected.out │ ├── sec_param_pp.lean.expected.out │ ├── structure_instance_info.lean.expected.out │ ├── unicode_lit.lean.expected.out │ ├── 1327.lean │ ├── 1598.lean │ ├── empty_french_quote.lean │ ├── macro_args.lean.expected.out │ ├── pp_notation_rbp_bug.lean.expected.out │ ├── pp_opt_param.lean.expected.out │ ├── run_cmd_type.lean │ ├── showenv.l │ ├── slow_error.lean │ ├── t11.lean.expected.out │ ├── whnf_core1.lean.expected.out │ ├── 1487.lean │ ├── bad_end.lean.expected.out │ ├── elab3.lean │ ├── invalid_ematch_attr.lean.expected.out │ ├── lambda_lift_after_erase_trivial.lean.expected.out │ ├── namespace_bug.lean │ ├── prodtst.lean.expected.out │ ├── record_rec_protected.lean.expected.out │ ├── rev_tac1.lean.expected.out │ ├── 1669.lean │ ├── 634.lean.expected.out │ ├── elab14.lean │ ├── empty_french_quote.lean.expected.out │ ├── interactive │ │ ├── hole2.lean │ │ ├── hole4.lean │ │ ├── hole1.lean │ │ ├── 85c.input.expected.out │ │ ├── complete_scanner_error.lean │ │ ├── complete_trailing_period.lean │ │ ├── info_import.input.expected.out │ │ ├── trace.lean │ │ ├── info_id_pre_elab.lean │ │ ├── sync.input.expected.out │ │ ├── 85c.input │ │ ├── info1.lean │ │ ├── hole3.lean │ │ ├── lib │ │ │ └── open_locale.lean │ │ ├── info1.lean.expected.out │ │ ├── complete_namespace.lean │ │ ├── symbols.input │ │ ├── complete_tactic.lean │ │ └── info_import.input │ ├── no_eqn_lemma_for_meta_default.lean │ ├── quot_ind_bug.lean.expected.out │ ├── right_assoc_dollar.lean │ ├── tactic_failure.lean │ ├── var.lean.expected.out │ ├── 858.lean.expected.out │ ├── bad_error4.lean │ ├── def2.lean.expected.out │ ├── div_eqn.lean.expected.out │ ├── empty.lean.expected.out │ ├── import_widget_violation.lean.expected.out │ ├── infix_paren_improved.lean │ ├── mk_constructor_fresh_names.lean.expected.out │ ├── notation7.lean.expected.out │ ├── pp_no_proofs.lean.expected.out │ ├── quot_bug.lean.expected.out │ ├── sec.lean.expected.out │ ├── t5.lean.expected.out │ ├── hole_in_fn.lean │ ├── meta_equation_pos.lean │ ├── noncomp.lean.expected.out │ ├── t6.lean.expected.out │ ├── 1327.lean.expected.out │ ├── 1487.lean.expected.out │ ├── 1745.lean.expected.out │ ├── bad_end_error_pos.lean.expected.out │ ├── cls_err.lean.expected.out │ ├── defeq_simp2.lean.expected.out │ ├── inline_bug.lean │ ├── pp_beta.lean │ ├── simp_subsingleton.lean.expected.out │ ├── 1334a.lean.expected.out │ ├── eqn_compiler_loop.lean │ ├── issue136.lean.expected.out │ ├── open_namespaces.lean │ ├── print_escape_name.lean.expected.out │ ├── structure_with_index_error.lean.expected.out │ ├── 1786.lean │ ├── bad_print.lean │ ├── ctxopt.lean │ ├── dsimp_whnf_post.lean.expected.out │ ├── example_false.lean.expected.out │ ├── hex_numeral.lean │ ├── hole_in_fn.lean.expected.out │ ├── level_instantiate.lean.expected.out │ ├── noncomp_error.lean.expected.out │ ├── noncomp_thm.lean.expected.out │ ├── pp_zero_bug.lean.expected.out │ ├── qexpr1.lean.expected.out │ ├── structure_elab_segfault.lean │ ├── structure_result_type_may_be_zero.lean │ ├── type_error_at_eval_expr.lean │ ├── calc1.lean.expected.out │ ├── defeq_simp3.lean.expected.out │ ├── dunfold_constant.lean.expected.out │ ├── eqn_hole.lean │ ├── hinst_lemmas1.lean.expected.out │ ├── notation3.lean.expected.out │ ├── offset_is_def_eq_trick.lean.expected.out │ ├── set_attr1.lean.expected.out │ ├── subst_bug.lean │ ├── tactic_failure.lean.expected.out │ ├── 1956.lean.expected.out │ ├── bad_error3.lean │ ├── change2.lean.expected.out │ ├── errors2.lean.expected.out │ ├── get_weight.lean │ ├── import_middle.lean.expected.out │ ├── irreducible_instance.lean.expected.out │ ├── pp_param_bug.lean │ ├── prodtst.lean │ ├── sec3.lean │ ├── subst_bug.lean.expected.out │ ├── vmo2.lean │ ├── wrong_arity.lean │ ├── wrong_arity.lean.expected.out │ ├── 1292.lean │ ├── alias.lean.expected.out │ ├── bad_error1.lean │ ├── notation8.lean │ ├── pp_opt_param.lean │ ├── ppbug.lean.expected.out │ ├── qexpr2.lean.expected.out │ ├── sort.lean.expected.out │ ├── utf8.lean │ ├── 1598.lean.expected.out │ ├── 1760.lean │ ├── dsimp_whnf.lean │ ├── eqn_compiler_loop.lean.expected.out │ ├── internal_names.lean │ ├── no_coe.lean │ ├── print_escape_name.lean │ ├── simp_symm.lean.expected.out │ ├── smart_unfolding.lean │ ├── 1922.lean │ ├── auto_quote_error.lean │ ├── bad_notation.lean │ ├── invalid_ematch_attr.lean │ ├── noncomputable_bytecode_issue.lean │ ├── notation4.lean.expected.out │ ├── pp_binder_types.lean │ ├── sec_ns.lean │ ├── t12.lean.expected.out │ ├── vmo1.lean │ ├── 1870.lean │ ├── bad_open.lean.expected.out │ ├── def3.lean │ ├── eqn_compiler_error_msg.lean │ ├── eta_bug.lean │ ├── example_false.lean │ ├── instance_cache_bug1.lean.expected.out │ ├── meta_ind_univ.lean.expected.out │ ├── no_confusion_type.lean.expected.out │ ├── pp_all2.lean │ ├── refine_error.lean │ ├── 1786.lean.expected.out │ ├── 1817.lean.expected.out │ ├── assumption_tac_notation.lean │ ├── cases_unsupported_equality.lean │ ├── change1.lean.expected.out │ ├── key_eqv1.lean │ ├── notation6.lean │ ├── trace_kabstract.lean.expected.out │ ├── ctx.lean │ ├── def1.lean │ ├── def2.lean │ ├── defeq_simp5.lean.expected.out │ ├── eqn_compiler_ctor.lean.expected.out │ ├── expr_quote.lean │ ├── import_invalid_tk.lean.expected.out │ ├── notation5.lean │ ├── protected.lean │ ├── qexpr3.lean │ ├── quot_abuse1.lean │ ├── revert_err.lean │ ├── simp_trace.lean.expected.out │ ├── var.lean │ ├── 584b.lean.expected.out │ ├── 641.lean.expected.out │ ├── format_thunk1.lean │ ├── format_thunk1.lean.expected.out │ ├── match_convoy_infer_type_failure.lean │ ├── noncomp.lean │ ├── record_rec_protected.lean │ ├── revert_frozen_dep.lean │ ├── rewrite.lean.expected.out │ ├── sec_param_pp2.lean.expected.out │ ├── implicit_after_auto_param_bug.lean.expected.out │ ├── inductive_cmd_leftover_placeholder_universe.lean │ ├── lambda_lift_after_erase_trivial.lean │ ├── nested_errors.lean.expected.out │ ├── restrict_bug.lean │ ├── sec.lean │ ├── 123-1.lean.expected.out │ ├── 1258.lean │ ├── 1930.lean.expected.out │ ├── errors2.lean │ ├── let_elim_issue.lean │ ├── meta_equation_pos.lean.expected.out │ ├── notation_pp_priority.lean.expected.out │ ├── refine_error.lean.expected.out │ ├── reserve_bugs.lean.expected.out │ ├── sec3.lean.expected.out │ ├── 1760.lean.expected.out │ ├── dep_cases_clear_hyp.lean.expected.out │ ├── io_bug2.lean │ ├── irreducible_instance.lean │ ├── local_notation_bug2.lean │ ├── string_imp.lean.expected.out │ ├── tuple.lean │ ├── whnf.lean │ ├── 1513.lean │ ├── 1766.lean.expected.out │ ├── bad_index.lean │ ├── bad_quoted_symbol.lean │ ├── dsimp_whnf_post.lean │ ├── no_meta_rec_inst.lean.expected.out │ ├── pp_all.lean │ ├── 652.lean.expected.out │ ├── extract.lean.expected.out │ ├── ff_byte.lean.expected.out │ ├── field_proj_pos.lean.expected.out │ ├── instance_cache_bug1.lean │ ├── list_monad1.lean │ ├── pp_binder_types.lean.expected.out │ ├── slow_error.lean.expected.out │ ├── trace_kabstract.lean │ ├── type_error_at_eval_expr.lean.expected.out │ ├── 1279.lean.expected.out │ ├── 1723.lean │ ├── crash.lean │ ├── meta_wf_error.lean.expected.out │ ├── no_coe.lean.expected.out │ ├── quot_abuse2.lean │ ├── set_of.lean.expected.out │ ├── 1669.lean.expected.out │ ├── bad_error3.lean.expected.out │ ├── check.lean.expected.out │ ├── elab_meta2.lean.expected.out │ ├── empty.lean │ ├── eqn_compiler_ctor.lean │ ├── let3.lean │ ├── univ_vars.lean.expected.out │ ├── begin_end_bug.lean │ ├── case_let.lean │ ├── char_lits.lean.expected.out │ ├── ctx.lean.expected.out │ ├── html_cmd.lean │ ├── inductive_cmd_leftover_placeholder_universe.lean.expected.out │ ├── io_process_echo.lean │ ├── issue136.lean │ ├── 1898.lean.expected.out │ ├── concrete_instance.lean.expected.out │ ├── defeq_match.lean │ ├── elab7.lean │ ├── list_lt.lean │ ├── meta_ind_univ.lean │ ├── print_ax1.lean.expected.out │ ├── run_cmd_type.lean.expected.out │ ├── structure_elab_segfault.lean.expected.out │ ├── univ.lean.expected.out │ ├── error_full_names.lean │ ├── io_bug1.lean.expected.out │ ├── module_info.lean.expected.out │ ├── noncomputable_lemma.lean │ ├── pp_bug.lean.expected.out │ ├── reflect_type_defeq.lean.expected.out │ ├── set_opt_tac.lean.expected.out │ ├── uni_bug1.lean │ ├── bad_error5.lean │ ├── bad_id.lean.expected.out │ ├── bad_set_option.lean.expected.out │ ├── by_contradiction.lean.expected.out │ ├── def_inaccessible_issue.lean.expected.out │ ├── elab3.lean.expected.out │ ├── shadow.lean │ ├── 1814.lean │ ├── 197c.lean.expected.out │ ├── alias2.lean │ ├── begin_end_bug.lean.expected.out │ ├── cyclic_default_fields.lean │ ├── explicit_delimiters.lean │ ├── guard_names.lean.expected.out │ ├── quot_abuse2.lean.expected.out │ ├── sorry_hash.lean │ ├── synth_inferred_mismatch.lean.expected.out │ ├── assumption_tac_notation.lean.expected.out │ ├── local_notation_bug2.lean.expected.out │ ├── no_meta_rec_inst.lean │ ├── pp_bug.lean │ ├── quot_abuse1.lean.expected.out │ ├── quot_ind_bug.lean │ └── rev_tac1.lean └── .gitignore ├── bin └── .gitignore ├── doc └── .gitignore ├── script ├── doxygen.sh ├── ccache-g++ ├── ccache-clang++ ├── run_tests.sh └── ubuntu-aarch64-toolchain.cmake ├── .gitattributes ├── leanpkg ├── .gitignore ├── leanpkg.path └── leanpkg.toml ├── src ├── tests │ └── shell │ │ └── .gitignore ├── init │ └── CMakeLists.txt ├── library │ ├── predict │ │ ├── CMakeLists.txt │ │ └── README.md │ └── tactic │ │ ├── backward │ │ └── CMakeLists.txt │ │ └── vm_type_context.h ├── kernel │ ├── inductive │ │ └── CMakeLists.txt │ └── quotient │ │ └── CMakeLists.txt ├── githash.h.in ├── shell │ └── test_standard.sh ├── util │ ├── numerics │ │ └── CMakeLists.txt │ └── sexpr │ │ └── CMakeLists.txt └── cmake │ ├── Modules │ └── CleanOlean.cmake │ └── check_failure.sh ├── .clang-format ├── .vscode └── settings.json ├── images └── lean.png ├── .codecov.yml └── README.md /library/leanpkg.path: -------------------------------------------------------------------------------- 1 | path . 2 | -------------------------------------------------------------------------------- /tests/lean/388.lean.expected.out: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bin/.gitignore: -------------------------------------------------------------------------------- 1 | lean 2 | lean.exe 3 | -------------------------------------------------------------------------------- /tests/lean/.gitignore: -------------------------------------------------------------------------------- 1 | io_fs.txt 2 | -------------------------------------------------------------------------------- /tests/lean/671.lean: -------------------------------------------------------------------------------- 1 | #print nat.add 2 | -------------------------------------------------------------------------------- /tests/lean/bad_end.lean: -------------------------------------------------------------------------------- 1 | end foo 2 | -------------------------------------------------------------------------------- /tests/lean/param.lean.expected.out: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/lean/shadow.lean.expected.out: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/lean/simp_ite.lean.expected.out: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc/.gitignore: -------------------------------------------------------------------------------- 1 | html 2 | *.org.*.lean 3 | -------------------------------------------------------------------------------- /script/doxygen.sh: -------------------------------------------------------------------------------- 1 | doxygen src/Doxyfile 2 | -------------------------------------------------------------------------------- /tests/lean/1860.lean.expected.out: -------------------------------------------------------------------------------- 1 | id 2 2 | -------------------------------------------------------------------------------- /tests/lean/bad_error2.lean.expected.out: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/lean/bad_open.lean: -------------------------------------------------------------------------------- 1 | open "nat" 2 | -------------------------------------------------------------------------------- /tests/lean/defeq_match.lean.expected.out: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/lean/exit_comment.lean: -------------------------------------------------------------------------------- 1 | #exit 2 | /- -------------------------------------------------------------------------------- /tests/lean/fail/parser_error.lean: -------------------------------------------------------------------------------- 1 | lemma 2 | -------------------------------------------------------------------------------- /tests/lean/lift_coe_off.lean.expected.out: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/lean/rw_symm_mvar.lean.expected.out: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/lean/vm_eval_crash.lean: -------------------------------------------------------------------------------- 1 | #eval 10 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | doc/changes.md merge=union 2 | -------------------------------------------------------------------------------- /leanpkg/.gitignore: -------------------------------------------------------------------------------- 1 | /leanpkg/config_vars.lean 2 | -------------------------------------------------------------------------------- /src/tests/shell/.gitignore: -------------------------------------------------------------------------------- 1 | *.produced.out 2 | -------------------------------------------------------------------------------- /tests/lean/172.lean.expected.out: -------------------------------------------------------------------------------- 1 | (some 4) 2 | -------------------------------------------------------------------------------- /tests/lean/bad_inaccessible.lean.expected.out: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/lean/bad_inaccessible2.lean.expected.out: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/lean/extra/print_info.12.30.expected.out: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/lean/ppbug.lean: -------------------------------------------------------------------------------- 1 | #check list.rec_on 2 | -------------------------------------------------------------------------------- /tests/lean/set_replacement.lean.expected.out: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /leanpkg/leanpkg.path: -------------------------------------------------------------------------------- 1 | builtin_path 2 | path ./. 3 | -------------------------------------------------------------------------------- /tests/lean/1745.lean: -------------------------------------------------------------------------------- 1 | def foo: list nat := [ 1,2, ] -------------------------------------------------------------------------------- /tests/lean/alias2.lean.expected.out: -------------------------------------------------------------------------------- 1 | foo.t : Prop 2 | -------------------------------------------------------------------------------- /tests/lean/destructive_let_issue.lean.expected.out: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/lean/io_bug2.lean.expected.out: -------------------------------------------------------------------------------- 1 | t1 2 | t2 3 | -------------------------------------------------------------------------------- /tests/lean/nat_pp.lean.expected.out: -------------------------------------------------------------------------------- 1 | 9 2 | 9 3 | 9 4 | -------------------------------------------------------------------------------- /tests/lean/native_run/.gitignore: -------------------------------------------------------------------------------- 1 | *.dSYM 2 | *.cpp 3 | -------------------------------------------------------------------------------- /tests/lean/print_meta.lean: -------------------------------------------------------------------------------- 1 | #print tactic.intro 2 | -------------------------------------------------------------------------------- /tests/lean/run/doc_string7a.lean: -------------------------------------------------------------------------------- 1 | /-!a-/ 2 | /-!b-/ -------------------------------------------------------------------------------- /tests/lean/structure_instance_bug.lean.expected.out: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/lean/synth_instances_order.lean.expected.out: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/lean/uni_bug1.lean.expected.out: -------------------------------------------------------------------------------- 1 | f 1 0 _ : ℕ 2 | -------------------------------------------------------------------------------- /tests/lean/vm_eval_crash.lean.expected.out: -------------------------------------------------------------------------------- 1 | 10 2 | -------------------------------------------------------------------------------- /tests/lean/vm_noncomputable_real.lean.expected.out: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/lean/well_founded_tactics.lean.expected.out: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/lean/check2.lean: -------------------------------------------------------------------------------- 1 | -- 2 | 3 | #check eq.rec_on 4 | -------------------------------------------------------------------------------- /tests/lean/defeq1.lean.expected.out: -------------------------------------------------------------------------------- 1 | n + 1 + 1 = m + 1 2 | -------------------------------------------------------------------------------- /tests/lean/elab5.lean.expected.out: -------------------------------------------------------------------------------- 1 | eq.refl s : s = s 2 | -------------------------------------------------------------------------------- /tests/lean/leanpkg/build_error/src/err.lean: -------------------------------------------------------------------------------- 1 | unknown 2 | -------------------------------------------------------------------------------- /tests/lean/namespace_bug.lean.expected.out: -------------------------------------------------------------------------------- 1 | 2 + 3 : ℕ 2 | -------------------------------------------------------------------------------- /tests/lean/noncomputable_bytecode_issue.lean.expected.out: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/lean/parser_run.lean.expected.out: -------------------------------------------------------------------------------- 1 | tt 2 | hello 3 | -------------------------------------------------------------------------------- /tests/lean/run/600a.lean: -------------------------------------------------------------------------------- 1 | /- - -/ 2 | 3 | #print "ok" 4 | -------------------------------------------------------------------------------- /tests/lean/run/600b.lean: -------------------------------------------------------------------------------- 1 | /- --/ 2 | 3 | #print "ok" 4 | -------------------------------------------------------------------------------- /tests/lean/subpp.lean.expected.out: -------------------------------------------------------------------------------- 1 | {x // x > 0} : Type 2 | -------------------------------------------------------------------------------- /tests/lean/vmo1.lean.expected.out: -------------------------------------------------------------------------------- 1 | "edam" 2 | "comte" 3 | -------------------------------------------------------------------------------- /tests/lean/vmo2.lean.expected.out: -------------------------------------------------------------------------------- 1 | "comte" 2 | "comte" 3 | -------------------------------------------------------------------------------- /script/ccache-g++: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ccache $CMAKE_CXX_COMPILER "$@" -------------------------------------------------------------------------------- /src/init/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(init OBJECT init.cpp) 2 | -------------------------------------------------------------------------------- /tests/lean/coe3.lean.expected.out: -------------------------------------------------------------------------------- 1 | f ↑a : C 2 | g ↑a : D 3 | -------------------------------------------------------------------------------- /tests/lean/heuristic_name_field_anonymous.lean.expected.out: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/lean/hex_char.lean.expected.out: -------------------------------------------------------------------------------- 1 | 'A' 2 | 'B' 3 | 'C' 4 | -------------------------------------------------------------------------------- /tests/lean/io_process_echo.lean.expected.out: -------------------------------------------------------------------------------- 1 | Hello World! 2 | -------------------------------------------------------------------------------- /tests/lean/noncomputable_constructor_param.lean.expected.out: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/lean/pp_param_bug.lean.expected.out: -------------------------------------------------------------------------------- 1 | foo3 : A → B → A 2 | -------------------------------------------------------------------------------- /tests/lean/print_ax1.lean: -------------------------------------------------------------------------------- 1 | open subtype 2 | #print axioms 3 | -------------------------------------------------------------------------------- /tests/lean/run/booltst.lean: -------------------------------------------------------------------------------- 1 | open bool 2 | 3 | #check ff 4 | -------------------------------------------------------------------------------- /tests/lean/run/max_memory.lean: -------------------------------------------------------------------------------- 1 | set_option max_memory 40 2 | -------------------------------------------------------------------------------- /tests/lean/run/variables_typestar.lean: -------------------------------------------------------------------------------- 1 | variables (A B : Type*) -------------------------------------------------------------------------------- /tests/lean/subpp.lean: -------------------------------------------------------------------------------- 1 | -- 2 | #check {x : nat // x > 0 } 3 | -------------------------------------------------------------------------------- /tests/lean/t2.lean.expected.out: -------------------------------------------------------------------------------- 1 | hello world 2 | testing 3 | -------------------------------------------------------------------------------- /tests/lean/trust0/t1.lean: -------------------------------------------------------------------------------- 1 | import system.io 2 | #print trust 3 | -------------------------------------------------------------------------------- /tests/lean/1898.lean: -------------------------------------------------------------------------------- 1 | def X (R : Type) [H : has_zero R] := H.0 2 | -------------------------------------------------------------------------------- /tests/lean/1956.lean: -------------------------------------------------------------------------------- 1 | example : 1000 * 1000 = 123456 := 2 | rfl 3 | -------------------------------------------------------------------------------- /tests/lean/const.lean.expected.out: -------------------------------------------------------------------------------- 1 | B : @bla A S 2 | @foo A S : A 3 | -------------------------------------------------------------------------------- /tests/lean/def3.lean.expected.out: -------------------------------------------------------------------------------- 1 | f : Π (A : Type u_1), A → A 2 | -------------------------------------------------------------------------------- /tests/lean/extra/616a.hlean: -------------------------------------------------------------------------------- 1 | attribute quotient.rec [recursor] 2 | -------------------------------------------------------------------------------- /tests/lean/fail/run_command.lean: -------------------------------------------------------------------------------- 1 | run_cmd tactic.fail "Error" 2 | -------------------------------------------------------------------------------- /tests/lean/get_free_var_range.lean.expected.out: -------------------------------------------------------------------------------- 1 | 0 2 | 2 3 | 3 4 | -------------------------------------------------------------------------------- /tests/lean/inline_bug.lean.expected.out: -------------------------------------------------------------------------------- 1 | [compiler.inline] 2 | 1 3 | -------------------------------------------------------------------------------- /tests/lean/inst.lean.expected.out: -------------------------------------------------------------------------------- 1 | C.mk (wizard (prod Prop Prop)) 2 | -------------------------------------------------------------------------------- /tests/lean/nat_add_assoc_no_axioms.lean.expected.out: -------------------------------------------------------------------------------- 1 | no axioms 2 | -------------------------------------------------------------------------------- /tests/lean/native_run/hello_world.lean.expected.out: -------------------------------------------------------------------------------- 1 | Hello Lean! 2 | -------------------------------------------------------------------------------- /tests/lean/open_namespaces.lean.expected.out: -------------------------------------------------------------------------------- 1 | [foo, nat, int] 2 | -------------------------------------------------------------------------------- /tests/lean/reflect.lean: -------------------------------------------------------------------------------- 1 | #eval to_string $ (reflect 0).to_expr 2 | -------------------------------------------------------------------------------- /tests/lean/run/letters.lean: -------------------------------------------------------------------------------- 1 | variables 𝓞 : Prop 2 | #check 𝓞 3 | -------------------------------------------------------------------------------- /tests/lean/t2.lean: -------------------------------------------------------------------------------- 1 | #print "hello world" 2 | #print "testing" 3 | -------------------------------------------------------------------------------- /tests/lean/try_for_time.lean.expected.out: -------------------------------------------------------------------------------- 1 | OKAY 2 | OKAY 3 | OKAY 4 | -------------------------------------------------------------------------------- /tests/lean/user_cmd_go_to_def.lean.expected.out: -------------------------------------------------------------------------------- 1 | (some ⟨10, 1⟩) 2 | -------------------------------------------------------------------------------- /tests/.gitignore: -------------------------------------------------------------------------------- 1 | *.produced.out 2 | *.test_suite.out 3 | *.status 4 | -------------------------------------------------------------------------------- /tests/lean/858.lean: -------------------------------------------------------------------------------- 1 | section 2 | parameter (n : Πa, nat) 3 | end 4 | -------------------------------------------------------------------------------- /tests/lean/def_ite_value.lean.expected.out: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 2 4 | 3 5 | 3 6 | -------------------------------------------------------------------------------- /tests/lean/dsimp_whnf.lean.expected.out: -------------------------------------------------------------------------------- 1 | a b : ℕ 2 | ⊢ a + 1 = a + 1 3 | -------------------------------------------------------------------------------- /tests/lean/html_cmd.lean.expected.out: -------------------------------------------------------------------------------- 1 | successfully rendered widget 2 | -------------------------------------------------------------------------------- /tests/lean/leanpkg/build_error.sh: -------------------------------------------------------------------------------- 1 | cd build_error 2 | leanpkg build 3 | -------------------------------------------------------------------------------- /tests/lean/let3.lean.expected.out: -------------------------------------------------------------------------------- 1 | let a : ℕ := 10 in f a 10 : ℕ → ℕ 2 | -------------------------------------------------------------------------------- /tests/lean/list_lt.lean.expected.out: -------------------------------------------------------------------------------- 1 | tt 2 | ff 3 | tt 4 | ff 5 | ff 6 | -------------------------------------------------------------------------------- /tests/lean/nat_add_assoc_no_axioms.lean: -------------------------------------------------------------------------------- 1 | #print axioms nat.add_assoc 2 | -------------------------------------------------------------------------------- /tests/lean/noncomp_error.lean: -------------------------------------------------------------------------------- 1 | noncomputable definition a :nat := 2 2 | -------------------------------------------------------------------------------- /tests/lean/pp_beta.lean.expected.out: -------------------------------------------------------------------------------- 1 | (λ (x : ℕ), x) 1 : ℕ 2 | 1 : ℕ 3 | -------------------------------------------------------------------------------- /tests/lean/run/1631.lean: -------------------------------------------------------------------------------- 1 | constant c : ℕ 2 | meta def t : expr := `(c) 3 | -------------------------------------------------------------------------------- /tests/lean/run/if_dollar_prec.lean: -------------------------------------------------------------------------------- 1 | #check if tt then tt else id $ ff 2 | -------------------------------------------------------------------------------- /tests/lean/run/lambda_cons.lean: -------------------------------------------------------------------------------- 1 | #eval list.foldr (::) [] [1, 2, 3] 2 | -------------------------------------------------------------------------------- /tests/lean/sort.lean: -------------------------------------------------------------------------------- 1 | #check Sort 2 | #check Sort 0 3 | #check Prop 4 | -------------------------------------------------------------------------------- /tests/lean/trace1.lean.expected.out: -------------------------------------------------------------------------------- 1 | ------------ 2 | hello 3 | world 4 | -------------------------------------------------------------------------------- /tests/lean/trace2.lean.expected.out: -------------------------------------------------------------------------------- 1 | ------------ 2 | hello 3 | world 4 | -------------------------------------------------------------------------------- /tests/lean/utf8.lean.expected.out: -------------------------------------------------------------------------------- 1 | 2 2 | 7 3 | 24 4 | ------------ 5 | -------------------------------------------------------------------------------- /tests/lean/whnf_cache_bug.lean.expected.out: -------------------------------------------------------------------------------- 1 | ?m_1 2 | (1.add 0).succ 3 | -------------------------------------------------------------------------------- /leanpkg/leanpkg.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "leanpkg" 3 | version = "0.1" 4 | -------------------------------------------------------------------------------- /src/library/predict/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(predict OBJECT predict.cpp) 2 | -------------------------------------------------------------------------------- /tests/lean/fail/failed_lemma.lean: -------------------------------------------------------------------------------- 1 | lemma wrong : false := by tactic.failed 2 | -------------------------------------------------------------------------------- /tests/lean/get_weight.lean.expected.out: -------------------------------------------------------------------------------- 1 | (ℕ, (1, 1)) 2 | (1 + 0, (17, 5)) 3 | -------------------------------------------------------------------------------- /tests/lean/hex_char.lean: -------------------------------------------------------------------------------- 1 | #eval '\x41' 2 | #eval '\x42' 3 | #eval '\x43' 4 | -------------------------------------------------------------------------------- /tests/lean/infix_paren_improved.lean.expected.out: -------------------------------------------------------------------------------- 1 | f : ?M_1 → ?M_1 → ?M_1 2 | -------------------------------------------------------------------------------- /tests/lean/leanpkg/build_error/leanpkg.path: -------------------------------------------------------------------------------- 1 | builtin_path 2 | path ./src 3 | -------------------------------------------------------------------------------- /tests/lean/let_elim_issue.lean.expected.out: -------------------------------------------------------------------------------- 1 | hello 2 | world 3 | from Lean 4 | -------------------------------------------------------------------------------- /tests/lean/noncomp_thm.lean: -------------------------------------------------------------------------------- 1 | noncomputable theorem foo : true := trivial 2 | -------------------------------------------------------------------------------- /tests/lean/reflect.lean.expected.out: -------------------------------------------------------------------------------- 1 | "has_zero.zero.{0} nat nat.has_zero" 2 | -------------------------------------------------------------------------------- /tests/lean/right_assoc_dollar.lean.expected.out: -------------------------------------------------------------------------------- 1 | f (10 + 20).succ : ℕ → ℕ 2 | -------------------------------------------------------------------------------- /tests/lean/run/injection.lean: -------------------------------------------------------------------------------- 1 | inductive term 2 | | abs : tt → term → term 3 | -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | BreakBeforeBraces: 'Attach' 4 | 5 | IndentWidth: 4 6 | -------------------------------------------------------------------------------- /src/kernel/inductive/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(inductive OBJECT inductive.cpp) 2 | -------------------------------------------------------------------------------- /src/kernel/quotient/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(quotient OBJECT quotient.cpp) 2 | -------------------------------------------------------------------------------- /tests/lean/268c.lean.expected.out: -------------------------------------------------------------------------------- 1 | nat.case a b c : ℕ 2 | nat.case b c a : ℕ 3 | -------------------------------------------------------------------------------- /tests/lean/coe6.lean.expected.out: -------------------------------------------------------------------------------- 1 | λ (a b : ↥g), g.mul a b : ↥g → ↥g → g.carrier 2 | -------------------------------------------------------------------------------- /tests/lean/ctxopt.lean.expected.out: -------------------------------------------------------------------------------- 1 | @id Prop true : Prop 2 | id true : Prop 3 | -------------------------------------------------------------------------------- /tests/lean/format_to_buffer.lean.expected.out: -------------------------------------------------------------------------------- 1 | ['f', 'o', 'o', 'b', 'a', 'r'] 2 | -------------------------------------------------------------------------------- /tests/lean/get_unused_name.lean.expected.out: -------------------------------------------------------------------------------- 1 | a_1 2 | b_1 3 | c_1 4 | d 5 | a_2 6 | -------------------------------------------------------------------------------- /tests/lean/hex_numeral.lean.expected.out: -------------------------------------------------------------------------------- 1 | 255 2 | 65535 3 | 170 4 | 16 5 | 65536 6 | -------------------------------------------------------------------------------- /tests/lean/no_eqn_lemma_for_meta_default.lean.expected.out: -------------------------------------------------------------------------------- 1 | foo.x._default : ℕ 2 | -------------------------------------------------------------------------------- /tests/lean/pp_all2.lean.expected.out: -------------------------------------------------------------------------------- 1 | @has_add.add nat nat.has_add 10 3 : nat 2 | -------------------------------------------------------------------------------- /tests/lean/pp_zero_bug.lean: -------------------------------------------------------------------------------- 1 | #check @has_zero.zero 2 | #check @has_zero.zero nat 3 | -------------------------------------------------------------------------------- /tests/lean/run/e2.lean: -------------------------------------------------------------------------------- 1 | prelude 2 | definition Prop := Type.{0} 3 | #check Prop 4 | -------------------------------------------------------------------------------- /tests/lean/run/inductive_unfold.lean: -------------------------------------------------------------------------------- 1 | inductive T : Prop 2 | | mk : id T → T 3 | -------------------------------------------------------------------------------- /tests/lean/run/sub_bug.lean: -------------------------------------------------------------------------------- 1 | open nat subtype 2 | #check { x : nat // x > 0} 3 | -------------------------------------------------------------------------------- /tests/lean/sec_ns.lean.expected.out: -------------------------------------------------------------------------------- 1 | def bar.baz : ℕ → ℕ := 2 | λ (x : ℕ), x 3 | -------------------------------------------------------------------------------- /tests/lean/1860.lean: -------------------------------------------------------------------------------- 1 | run_cmd tactic.trace $ let let_val := (2 : ℕ) in `(id let_val) 2 | -------------------------------------------------------------------------------- /tests/lean/1922.lean.expected.out: -------------------------------------------------------------------------------- 1 | def P : C → list ℕ := 2 | λ (c : C), @C.d c ℕ [0] 3 | -------------------------------------------------------------------------------- /tests/lean/1930.lean: -------------------------------------------------------------------------------- 1 | structure S := (f : ℕ) 2 | 3 | def F : S := { f := prod.1 } 4 | -------------------------------------------------------------------------------- /tests/lean/bad_pattern2.lean: -------------------------------------------------------------------------------- 1 | definition foo : nat → nat 2 | | bla.boo := bla.boo 3 | -------------------------------------------------------------------------------- /tests/lean/bad_set_option.lean: -------------------------------------------------------------------------------- 1 | set_option boo true 2 | 3 | set_option pp.unicode a 4 | -------------------------------------------------------------------------------- /tests/lean/check2.lean.expected.out: -------------------------------------------------------------------------------- 1 | eq.rec_on : ?M_2 = ?M_4 → ?M_3 ?M_2 → ?M_3 ?M_4 2 | -------------------------------------------------------------------------------- /tests/lean/eval_tactic.lean.expected.out: -------------------------------------------------------------------------------- 1 | 42 2 | eval_tactic.lean:2:0: error: nope 3 | -------------------------------------------------------------------------------- /tests/lean/generalize1.lean.expected.out: -------------------------------------------------------------------------------- 1 | a b c : ℕ 2 | ⊢ ∀ (y x : ℕ), x = y → y = x 3 | -------------------------------------------------------------------------------- /tests/lean/import_invalid_tk.lean: -------------------------------------------------------------------------------- 1 | import data.buffer 0b311 2 | 3 | #print buffer 4 | -------------------------------------------------------------------------------- /tests/lean/list_monad1.lean.expected.out: -------------------------------------------------------------------------------- 1 | [(2, 4), (3, 4), (3, 5), (4, 4), (4, 5)] 2 | -------------------------------------------------------------------------------- /tests/lean/parsing_only.lean.expected.out: -------------------------------------------------------------------------------- 1 | 10+++ : ℕ 2 | g 10 : ℕ 3 | Type 8 : Type 9 4 | -------------------------------------------------------------------------------- /tests/lean/pp_nodot.lean.expected.out: -------------------------------------------------------------------------------- 1 | y.x : foo 2 | foo.x y : foo 3 | foo.x y : foo 4 | -------------------------------------------------------------------------------- /tests/lean/run/362c.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | #eval success_if_fail $ unify `(1 : ℕ) `(1 : ℤ) -------------------------------------------------------------------------------- /tests/lean/run/meta3.lean: -------------------------------------------------------------------------------- 1 | #check `foo.bla 2 | 3 | #eval mk_num_name (`foo.bla) 10 4 | -------------------------------------------------------------------------------- /tests/lean/run/struct_bug2.lean: -------------------------------------------------------------------------------- 1 | structure foo := 2 | (a : ℕ := 42) 3 | (b : a = a) 4 | -------------------------------------------------------------------------------- /tests/lean/tuple.lean.expected.out: -------------------------------------------------------------------------------- 1 | tuple.{u_1} : Type (u_1+1) → ℕ → Type (u_1+1) 2 | -------------------------------------------------------------------------------- /tests/lean/vm_string_lt_bug.lean.expected.out: -------------------------------------------------------------------------------- 1 | tt 2 | ff 3 | (some 10) 4 | (some 10) 5 | -------------------------------------------------------------------------------- /tests/lean/whnf.lean.expected.out: -------------------------------------------------------------------------------- 1 | (2.add 0).succ 2 | 3 3 | (a.add 0).succ 4 | a.succ 5 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cmake.sourceDirectory": "${workspaceFolder}/src", 3 | } 4 | -------------------------------------------------------------------------------- /images/lean.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leanprover-community/lean/HEAD/images/lean.png -------------------------------------------------------------------------------- /tests/lean/1723.lean.expected.out: -------------------------------------------------------------------------------- 1 | -[1+ 0] 2 | -1 3 | -[1+ 0] 4 | -1 5 | -[1+ 1] 6 | -2 7 | -------------------------------------------------------------------------------- /tests/lean/641.lean: -------------------------------------------------------------------------------- 1 | example : true := by do tactic.set_goals [`(true)] >> tactic.triv 2 | -------------------------------------------------------------------------------- /tests/lean/695.lean.expected.out: -------------------------------------------------------------------------------- 1 | 695.lean:7:4: error: not an inductive type: with_zero ℕ 2 | -------------------------------------------------------------------------------- /tests/lean/elab5.lean: -------------------------------------------------------------------------------- 1 | constant s : sum nat bool 2 | 3 | #check @eq.refl (sum nat bool) s 4 | -------------------------------------------------------------------------------- /tests/lean/extra/eqn_macro2.lean: -------------------------------------------------------------------------------- 1 | import eqn_macro1 2 | open nat 3 | 4 | eval foo (2, 3) 5 | -------------------------------------------------------------------------------- /tests/lean/json.lean.expected.out: -------------------------------------------------------------------------------- 1 | "(some [0.699999988079071])" 2 | "(some {})" 3 | "{}" 4 | -------------------------------------------------------------------------------- /tests/lean/leanpkg/new.sh: -------------------------------------------------------------------------------- 1 | rm -rf new 2 | leanpkg new new 3 | ls -a new 4 | rm -rf new 5 | -------------------------------------------------------------------------------- /tests/lean/missing_import.lean: -------------------------------------------------------------------------------- 1 | import does.not.exist data.buffer 2 | 3 | #print buffer 4 | -------------------------------------------------------------------------------- /tests/lean/qexpr3.lean.expected.out: -------------------------------------------------------------------------------- 1 | a b c : ℕ, 2 | H1 : a = b, 3 | H2 : b = c 4 | ⊢ b = c 5 | -------------------------------------------------------------------------------- /tests/lean/run/def11.lean: -------------------------------------------------------------------------------- 1 | 2 | definition ex1 (a : nat) : nat.succ a = 0 → false 3 | . 4 | -------------------------------------------------------------------------------- /tests/lean/run/num.lean: -------------------------------------------------------------------------------- 1 | #check 14 2 | #check 0 3 | #check 3 4 | #check 2 5 | #check 4 6 | -------------------------------------------------------------------------------- /tests/lean/run/print_inductive.lean: -------------------------------------------------------------------------------- 1 | #print inductive nat 2 | 3 | #print inductive list 4 | -------------------------------------------------------------------------------- /tests/lean/run/record8.lean: -------------------------------------------------------------------------------- 1 | structure point := 2 | (x y : nat) 3 | 4 | #check point.x 5 | -------------------------------------------------------------------------------- /tests/lean/structure_with_index_error.lean: -------------------------------------------------------------------------------- 1 | structure foo : true → Type := (bar : true) 2 | -------------------------------------------------------------------------------- /tests/lean/unfold_crash.lean.expected.out: -------------------------------------------------------------------------------- 1 | a b : ℕ, 2 | H : a = b.succ 3 | ⊢ a = b.succ 4 | -------------------------------------------------------------------------------- /tests/lean/unicode_lit.lean: -------------------------------------------------------------------------------- 1 | #eval "≠∀Π∃⁻ʰℵ⬝" 2 | #eval "≠∀Π∃⁻ʰℵ⬝".to_list.map char.to_nat 3 | -------------------------------------------------------------------------------- /tests/lean/vm_let_expr.lean.expected.out: -------------------------------------------------------------------------------- 1 | 90 2 | mk_value 3 | 50 4 | mk_value 5 | mk_value 6 | -------------------------------------------------------------------------------- /tests/lean/eval_tactic.lean: -------------------------------------------------------------------------------- 1 | #eval tactic.trace 42 2 | #eval (tactic.fail "nope" : tactic nat) 3 | -------------------------------------------------------------------------------- /tests/lean/field_proj_pos.lean: -------------------------------------------------------------------------------- 1 | example (h : true ∨ true) : true := 2 | by exact (h).elim _ _ 3 | -------------------------------------------------------------------------------- /tests/lean/ftree.lean.expected.out: -------------------------------------------------------------------------------- 1 | ftree : Type → Type → Type 2 | ftree : Type → Type → Type 3 | -------------------------------------------------------------------------------- /tests/lean/noncomputable_reason.lean.expected.out: -------------------------------------------------------------------------------- 1 | none 2 | (some foo) 3 | (some bar') 4 | none 5 | -------------------------------------------------------------------------------- /tests/lean/pp_notation_rbp_bug.lean: -------------------------------------------------------------------------------- 1 | def foo := (λ a : ℕ, a) = (λ a, a) ↔ true 2 | #print foo 3 | -------------------------------------------------------------------------------- /tests/lean/restrict_bug.lean.expected.out: -------------------------------------------------------------------------------- 1 | ∀ (a : A) (l : list.{0} A), @all A l (R a) : Prop 2 | -------------------------------------------------------------------------------- /tests/lean/run/444.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | #check succ 1 3 | notation 1 := unit 4 | #check succ 1 5 | -------------------------------------------------------------------------------- /tests/lean/run/help_cmd.lean: -------------------------------------------------------------------------------- 1 | #help options 2 | 3 | #help commands 4 | 5 | #print options 6 | -------------------------------------------------------------------------------- /tests/lean/run/reflected_coercion_with_mvars.lean: -------------------------------------------------------------------------------- 1 | meta example : expr := 2 | `(1 + 1 : nat) 3 | -------------------------------------------------------------------------------- /tests/lean/run/sub.lean: -------------------------------------------------------------------------------- 1 | #check { x : nat // x > 0 } 2 | #check { x : nat → nat // true } 3 | -------------------------------------------------------------------------------- /tests/lean/run/trace_call_stack_segfault.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | run_cmd trace_call_stack 4 | -------------------------------------------------------------------------------- /tests/lean/run/trace_tst.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | 3 | #eval trace "step1" (trace "hello" (succ 3)) 4 | -------------------------------------------------------------------------------- /tests/lean/widget/widget4.lean: -------------------------------------------------------------------------------- 1 | open tactic widget 2 | 3 | #eval trace_widget term_goal_widget 4 | -------------------------------------------------------------------------------- /src/githash.h.in: -------------------------------------------------------------------------------- 1 | // Automatically generated file, DO NOT EDIT 2 | #define LEAN_GITHASH "@GIT_SHA1@" 3 | -------------------------------------------------------------------------------- /tests/lean/bad_error5.lean.expected.out: -------------------------------------------------------------------------------- 1 | bad_error5.lean:9:0: warning: declaration 'V' uses sorry 2 | -------------------------------------------------------------------------------- /tests/lean/bad_id.lean: -------------------------------------------------------------------------------- 1 | -- 2 | 3 | definition x.y : nat := 10 4 | 5 | definition x.1 :nat := 10 6 | -------------------------------------------------------------------------------- /tests/lean/frozen_local_instances.lean.expected.out: -------------------------------------------------------------------------------- 1 | (some [_inst_3, _inst_2, _inst_1]) 2 | none 3 | -------------------------------------------------------------------------------- /tests/lean/import_middle.lean: -------------------------------------------------------------------------------- 1 | import data.buffer 2 | 3 | #print "hello" 4 | 5 | import data.dlist 6 | -------------------------------------------------------------------------------- /tests/lean/inst_error.lean: -------------------------------------------------------------------------------- 1 | #check λ (A : Type) (a : A) (b c : _), if a = b ∧ a = c then tt else ff 2 | -------------------------------------------------------------------------------- /tests/lean/key_eqv1.lean.expected.out: -------------------------------------------------------------------------------- 1 | [has_mul.mul, nat.mul] 2 | [has_add.add, nat.succ, nat.add] 3 | -------------------------------------------------------------------------------- /tests/lean/macro_args.lean: -------------------------------------------------------------------------------- 1 | #eval to_string $ ``({pos . line := has_zero.zero, col := 1}).to_raw_fmt 2 | -------------------------------------------------------------------------------- /tests/lean/match_bug.lean: -------------------------------------------------------------------------------- 1 | definition foo : nat -> nat := fun x, 2 | match x with 3 | | bar -> bar 4 | -------------------------------------------------------------------------------- /tests/lean/notation6.lean.expected.out: -------------------------------------------------------------------------------- 1 | 11 : ℕ 2 | 10 + 1 : ℕ 3 | f 10 + 10 + 10 : ℕ 4 | 10 5 | 14 6 | -------------------------------------------------------------------------------- /tests/lean/notation8.lean.expected.out: -------------------------------------------------------------------------------- 1 | f (1 + g 1) (g 2 + 2) : ℕ 2 | f (g 1) (f (1 + 1) (g 2)) : ℕ 3 | -------------------------------------------------------------------------------- /tests/lean/print_reducible.lean.expected.out: -------------------------------------------------------------------------------- 1 | id₁ 2 | id₂ 3 | pr 4 | ----------- 5 | id₅ 6 | id₆ 7 | -------------------------------------------------------------------------------- /tests/lean/run/dep_parents.lean: -------------------------------------------------------------------------------- 1 | class A := mk 2 | class B [A] := mk 3 | class C extends A, B := mk 4 | -------------------------------------------------------------------------------- /tests/lean/run/do_const_pat.lean: -------------------------------------------------------------------------------- 1 | run_cmd do 2 | tt ← pure ff | tactic.skip, 3 | tactic.failed 4 | -------------------------------------------------------------------------------- /tests/lean/run/import_open_locale2.lean: -------------------------------------------------------------------------------- 1 | import .import_open_locale1 2 | 3 | open_locale classical 4 | -------------------------------------------------------------------------------- /tests/lean/run/pp_unit.lean: -------------------------------------------------------------------------------- 1 | #check unit.star 2 | #check () 3 | set_option pp.all true 4 | #check () 5 | -------------------------------------------------------------------------------- /tests/lean/run/sleep.lean: -------------------------------------------------------------------------------- 1 | import system.io 2 | 3 | run_cmd (tactic.unsafe_run_io $ io.proc.sleep 2) -------------------------------------------------------------------------------- /tests/lean/run/t7.lean: -------------------------------------------------------------------------------- 1 | constant A : Type.{1} 2 | constant f : A → A → A 3 | #print raw f _ (f _ _) 4 | -------------------------------------------------------------------------------- /tests/lean/run/using_new_ref_interactive.lean: -------------------------------------------------------------------------------- 1 | run_cmd tactic.using_new_ref (0 : ℕ) $ λ _, `[skip] 2 | -------------------------------------------------------------------------------- /tests/lean/t13.lean.expected.out: -------------------------------------------------------------------------------- 1 | [choice g f] a b 2 | λ (h : A → A → A), h a b : (A → A → A) → A 3 | -------------------------------------------------------------------------------- /tests/lean/var2.lean.expected.out: -------------------------------------------------------------------------------- 1 | foo : Π (B : Type u_1), B → Π (A : Type u_1), A → A = B → Prop 2 | -------------------------------------------------------------------------------- /script/ccache-clang++: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ccache $CMAKE_CXX_COMPILER -Qunused-arguments -fcolor-diagnostics "$@" -------------------------------------------------------------------------------- /tests/lean/1862.lean.expected.out: -------------------------------------------------------------------------------- 1 | R : Type, 2 | _inst_1 : test_neg_neg R 3 | ⊢ - -1 = 1 4 | - -1 : R 5 | -------------------------------------------------------------------------------- /tests/lean/671.lean.expected.out: -------------------------------------------------------------------------------- 1 | @[pattern] 2 | protected def nat.add : ℕ → ℕ → ℕ := 3 | nat.add._main 4 | -------------------------------------------------------------------------------- /tests/lean/attributes.lean.expected.out: -------------------------------------------------------------------------------- 1 | attributes.lean:5:0: error: cannot remove attribute [reducible] 2 | -------------------------------------------------------------------------------- /tests/lean/case_let.lean.expected.out: -------------------------------------------------------------------------------- 1 | case_let.lean:2:0: warning: declaration '[anonymous]' uses sorry 2 | -------------------------------------------------------------------------------- /tests/lean/check.lean: -------------------------------------------------------------------------------- 1 | -- 2 | 3 | #check and.intro 4 | #check or.elim 5 | #check eq 6 | #check eq.rec 7 | -------------------------------------------------------------------------------- /tests/lean/dunfold_constant.lean: -------------------------------------------------------------------------------- 1 | def foo : list ℕ := [2] 2 | lemma bar : foo = foo := by dunfold foo 3 | -------------------------------------------------------------------------------- /tests/lean/elab14.lean.expected.out: -------------------------------------------------------------------------------- 1 | λ (A B : Type u) (a : A) (b : B), a : Π (A B : Type u), A → B → A 2 | -------------------------------------------------------------------------------- /tests/lean/eta_bug.lean.expected.out: -------------------------------------------------------------------------------- 1 | λ (A : Type u_1) (x y : A) (H₁ : x = y) (H₂ : y = x), eq.rec H₁ H₂ 2 | -------------------------------------------------------------------------------- /tests/lean/exit_comment.lean.expected.out: -------------------------------------------------------------------------------- 1 | exit_comment.lean:1:0: warning: using 'exit' to interrupt Lean 2 | -------------------------------------------------------------------------------- /tests/lean/ff_byte.lean: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leanprover-community/lean/HEAD/tests/lean/ff_byte.lean -------------------------------------------------------------------------------- /tests/lean/inline_issue.lean.expected.out: -------------------------------------------------------------------------------- 1 | world 2 | hello 3 | ------------ 4 | _interaction 5 | g 6 | f 7 | -------------------------------------------------------------------------------- /tests/lean/nat_pp.lean: -------------------------------------------------------------------------------- 1 | #reduce nat.add 3 6 2 | open nat 3 | #reduce nat.add 3 6 4 | #reduce (3:nat) + 6 5 | -------------------------------------------------------------------------------- /tests/lean/protected.lean.expected.out: -------------------------------------------------------------------------------- 1 | protected.lean:9:7: error: unknown identifier 'C' 2 | D : Prop 3 | -------------------------------------------------------------------------------- /tests/lean/run/K_new_elab.lean: -------------------------------------------------------------------------------- 1 | 2 | theorem ex2 {A : Type} (H : A = A) (a : A) : cast H a = a := 3 | rfl 4 | -------------------------------------------------------------------------------- /tests/lean/run/bor_lazy.lean: -------------------------------------------------------------------------------- 1 | open bool 2 | 3 | #eval (timeit "branch1:" tt) || (timeit "branch2:" tt) 4 | -------------------------------------------------------------------------------- /tests/lean/run/check_monad_mk.lean: -------------------------------------------------------------------------------- 1 | #check @monad.mk 2 | #check @functor.mk 3 | #check @applicative.mk 4 | -------------------------------------------------------------------------------- /tests/lean/run/ex.lean: -------------------------------------------------------------------------------- 1 | set_option pp.implicit true 2 | #check ∃x, x = (0:nat) 3 | #check ∃x:nat, x = 0 4 | -------------------------------------------------------------------------------- /tests/lean/run/inductive_type_whnf.lean: -------------------------------------------------------------------------------- 1 | def pred (α : Type) := α → Prop 2 | 3 | inductive foo : pred ℕ 4 | -------------------------------------------------------------------------------- /tests/lean/run/inj_eq_hygiene.lean: -------------------------------------------------------------------------------- 1 | namespace foo 2 | def iff.intro := 5 3 | inductive foo | bar 4 | end foo -------------------------------------------------------------------------------- /tests/lean/sec_param_pp.lean.expected.out: -------------------------------------------------------------------------------- 1 | id2 : A 2 | pr f id2 : A 3 | pr f id2 : A 4 | pr2.{0} ℕ 10 : A 5 | -------------------------------------------------------------------------------- /tests/lean/structure_instance_info.lean.expected.out: -------------------------------------------------------------------------------- 1 | (1, 2) 2 | ((1, 2).fst, 1) 3 | (some prod) 4 | none 5 | -------------------------------------------------------------------------------- /tests/lean/unicode_lit.lean.expected.out: -------------------------------------------------------------------------------- 1 | "≠∀Π∃⁻ʰℵ⬝" 2 | [8800, 8704, 928, 8707, 8315, 688, 8501, 11037] 3 | -------------------------------------------------------------------------------- /script/run_tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ctest -D ExperimentalBuild 3 | yes "C" | ctest -VV 4 | exit 0 5 | -------------------------------------------------------------------------------- /tests/lean/1327.lean: -------------------------------------------------------------------------------- 1 | example (n) : nat.pred n = n := 2 | begin 3 | dsimp {fail_if_unchanged := ff} 4 | end 5 | -------------------------------------------------------------------------------- /tests/lean/1598.lean: -------------------------------------------------------------------------------- 1 | lemma notc : exists b, b = false := 2 | begin 3 | existsi 0, -- ERROR here 4 | end 5 | -------------------------------------------------------------------------------- /tests/lean/empty_french_quote.lean: -------------------------------------------------------------------------------- 1 | def «» := not 2 | theorem thm : «» false := id 3 | #print «» 4 | #print thm -------------------------------------------------------------------------------- /tests/lean/extra/print_info.21.0.expected.out: -------------------------------------------------------------------------------- 1 | LEAN_INFORMATION 2 | parameter a₁ : ℕ 3 | END_LEAN_INFORMATION 4 | -------------------------------------------------------------------------------- /tests/lean/extra/print_info.21.1.expected.out: -------------------------------------------------------------------------------- 1 | LEAN_INFORMATION 2 | parameter a₁ : ℕ 3 | END_LEAN_INFORMATION 4 | -------------------------------------------------------------------------------- /tests/lean/fail/example.lean: -------------------------------------------------------------------------------- 1 | open tactic expr 2 | example : false := by do exact $ const `does_not_exist [] 3 | -------------------------------------------------------------------------------- /tests/lean/macro_args.lean.expected.out: -------------------------------------------------------------------------------- 1 | "[macro structure instance (const has_zero.zero []) [macro prenum]]" 2 | -------------------------------------------------------------------------------- /tests/lean/pp_notation_rbp_bug.lean.expected.out: -------------------------------------------------------------------------------- 1 | def foo : Prop := 2 | ((λ (a : ℕ), a) = λ (a : ℕ), a) ↔ true 3 | -------------------------------------------------------------------------------- /tests/lean/pp_opt_param.lean.expected.out: -------------------------------------------------------------------------------- 1 | expr : Type 2 | expr ff : Type 3 | f 3 4 : ℕ 4 | expr tt : Type 5 | -------------------------------------------------------------------------------- /tests/lean/run/1010.lean: -------------------------------------------------------------------------------- 1 | import system.io 2 | 3 | #eval io.env.get_cwd >>= io.print 4 | 5 | section end 6 | -------------------------------------------------------------------------------- /tests/lean/run/1585.lean: -------------------------------------------------------------------------------- 1 | structure foo (α : Type) extends has_le α 2 | structure bar (α : Type) extends foo α 3 | -------------------------------------------------------------------------------- /tests/lean/run/bug5.lean: -------------------------------------------------------------------------------- 1 | theorem symm2 {A : Type} {a b : A} (H : a = b) : b = a 2 | := eq.subst H (eq.refl a) 3 | -------------------------------------------------------------------------------- /tests/lean/run/find.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | 3 | lemma aux : ∃ x : nat, x > 10 := 4 | exists.intro 15 dec_trivial 5 | -------------------------------------------------------------------------------- /tests/lean/run/sorry.lean: -------------------------------------------------------------------------------- 1 | definition b : Prop := 2 | sorry 3 | 4 | theorem tst : true = false := 5 | sorry 6 | -------------------------------------------------------------------------------- /tests/lean/run/super.lean: -------------------------------------------------------------------------------- 1 | constant f : nat → nat 2 | notation a `²` := f a 3 | variable a : nat 4 | #check a² 5 | -------------------------------------------------------------------------------- /tests/lean/run_cmd_type.lean: -------------------------------------------------------------------------------- 1 | meta def foo: lean.parser unit := 2 | do 3 | return () 4 | 5 | run_cmd foo 6 | -------------------------------------------------------------------------------- /tests/lean/showenv.l: -------------------------------------------------------------------------------- 1 | set_option pp::colors false 2 | print "===BEGIN ENVIRONMENT===" 3 | print environment 4 | -------------------------------------------------------------------------------- /tests/lean/slow_error.lean: -------------------------------------------------------------------------------- 1 | variable a : user_attribute string 2 | variable b : string 3 | 4 | #check a = b 5 | -------------------------------------------------------------------------------- /tests/lean/t11.lean.expected.out: -------------------------------------------------------------------------------- 1 | ∃ (x : A), p x : bool 2 | ∃ (x y : A), q x y : bool 3 | λ (x : A), x : A → A 4 | -------------------------------------------------------------------------------- /tests/lean/whnf_core1.lean.expected.out: -------------------------------------------------------------------------------- 1 | (a.add (1.add 0)).succ 2 | (a.add (1.add 0)).succ 3 | f a 4 | a + 2 5 | -------------------------------------------------------------------------------- /tests/lean/1487.lean: -------------------------------------------------------------------------------- 1 | def ex (α : Sort _) (a b : α) : a = b := 2 | begin [smt] 3 | close -- Should fail 4 | end 5 | -------------------------------------------------------------------------------- /tests/lean/bad_end.lean.expected.out: -------------------------------------------------------------------------------- 1 | bad_end.lean:1:0: error: invalid 'end', there is no open namespace/section 2 | -------------------------------------------------------------------------------- /tests/lean/elab3.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | set_option pp.all true 4 | 5 | 6 | #check trace_state >> trace_state 7 | -------------------------------------------------------------------------------- /tests/lean/extra/597a.hlean: -------------------------------------------------------------------------------- 1 | open equiv 2 | constants (A B : Type₀) (f : A ≃ B) 3 | definition foo : A → B := f 4 | -------------------------------------------------------------------------------- /tests/lean/invalid_ematch_attr.lean.expected.out: -------------------------------------------------------------------------------- 1 | invalid_ematch_attr.lean:4:0: error: invalid ematch lemma 'foo' 2 | -------------------------------------------------------------------------------- /tests/lean/lambda_lift_after_erase_trivial.lean.expected.out: -------------------------------------------------------------------------------- 1 | [compiler.lambda_lifting] 2 | >> f1 3 | λ (a : ℕ), a 4 | -------------------------------------------------------------------------------- /tests/lean/namespace_bug.lean: -------------------------------------------------------------------------------- 1 | namespace playground 2 | namespace nat 3 | #check 2+3 4 | end nat 5 | end playground 6 | -------------------------------------------------------------------------------- /tests/lean/prodtst.lean.expected.out: -------------------------------------------------------------------------------- 1 | prod2.{u_1 u_2} : Type (u_1+1) → Type (u_2+1) → Type (max (u_1+1) (u_2+1)) 2 | -------------------------------------------------------------------------------- /tests/lean/record_rec_protected.lean.expected.out: -------------------------------------------------------------------------------- 1 | record_rec_protected.lean:8:7: error: unknown identifier 'rec' 2 | -------------------------------------------------------------------------------- /tests/lean/rev_tac1.lean.expected.out: -------------------------------------------------------------------------------- 1 | 3 2 | b : ℕ, 3 | H : b > 0 4 | ⊢ ∀ (a : ℕ), a > 0 → a > b → a = b → true 5 | -------------------------------------------------------------------------------- /tests/lean/run/atomic2.lean: -------------------------------------------------------------------------------- 1 | notation `foo` := Type.{1} 2 | constant f : Type* → Type* 3 | #check foo → f foo → foo 4 | -------------------------------------------------------------------------------- /tests/lean/run/default_field_universe.lean: -------------------------------------------------------------------------------- 1 | structure {u} foo (α : Type u) : Type (u+1) := 2 | (bar : Type u := α) 3 | -------------------------------------------------------------------------------- /tests/lean/run/new_elab2.lean: -------------------------------------------------------------------------------- 1 | 2 | theorem ex {a : Prop} (H : ¬a) : a ↔ false := 3 | iff.intro H (false.rec a) 4 | -------------------------------------------------------------------------------- /tests/lean/run/period_after_eqns.lean: -------------------------------------------------------------------------------- 1 | def f : nat → nat 2 | | 0 := 1 3 | | (a+1) := 1 4 | . 5 | 6 | #check 10 7 | -------------------------------------------------------------------------------- /tests/lean/run/ptst.lean: -------------------------------------------------------------------------------- 1 | open prod nat 2 | 3 | -- Test tuple notation 4 | #check ((3:nat), false, (1:int), true) 5 | -------------------------------------------------------------------------------- /tests/lean/run/structure_doc_string.lean: -------------------------------------------------------------------------------- 1 | structure foo := 2 | (x : nat) 3 | 4 | /-- doc string -/ 5 | def x := 10 6 | -------------------------------------------------------------------------------- /tests/lean/1669.lean: -------------------------------------------------------------------------------- 1 | def f : ℕ → ℕ 2 | | a := f a 3 | using_well_founded ⟨{0}, well_founded_tactics.default_dec_tac⟩ 4 | -------------------------------------------------------------------------------- /tests/lean/634.lean.expected.out: -------------------------------------------------------------------------------- 1 | @A n : Type 2 | @foo.A n : Type 3 | @foo.A n : Type 4 | @A n : Type 5 | @A n : Type 6 | -------------------------------------------------------------------------------- /tests/lean/elab14.lean: -------------------------------------------------------------------------------- 1 | set_option pp.all true 2 | universe variables u 3 | #check λ (A B : Type u) (a : A) (b : B), a 4 | -------------------------------------------------------------------------------- /tests/lean/empty_french_quote.lean.expected.out: -------------------------------------------------------------------------------- 1 | def «» : Prop → Prop := 2 | not 3 | theorem thm : «» false := 4 | id 5 | -------------------------------------------------------------------------------- /tests/lean/extra/print_info.21.3.expected.out: -------------------------------------------------------------------------------- 1 | LEAN_INFORMATION 2 | _ `+`:65 _:65 := add #1 #0 3 | END_LEAN_INFORMATION 4 | -------------------------------------------------------------------------------- /tests/lean/extra/print_info.8.19.expected.out: -------------------------------------------------------------------------------- 1 | LEAN_INFORMATION 2 | _ `+`:65 _:65 := add #1 #0 3 | END_LEAN_INFORMATION 4 | -------------------------------------------------------------------------------- /tests/lean/extra/show_goal.18.21.expected.out: -------------------------------------------------------------------------------- 1 | LEAN_INFORMATION 2 | position 19:4 3 | no goals 4 | END_LEAN_INFORMATION 5 | -------------------------------------------------------------------------------- /tests/lean/extra/show_goal.24.3.expected.out: -------------------------------------------------------------------------------- 1 | LEAN_INFORMATION 2 | position 25:0 3 | no goals 4 | END_LEAN_INFORMATION 5 | -------------------------------------------------------------------------------- /tests/lean/extra/show_goal.9.12.expected.out: -------------------------------------------------------------------------------- 1 | LEAN_INFORMATION 2 | position 10:2 3 | no goals 4 | END_LEAN_INFORMATION 5 | -------------------------------------------------------------------------------- /tests/lean/interactive/hole2.lean: -------------------------------------------------------------------------------- 1 | def x : nat → nat := 2 | λ a, {! a + a !} 3 | --^ "command": "hole_commands" 4 | -------------------------------------------------------------------------------- /tests/lean/interactive/hole4.lean: -------------------------------------------------------------------------------- 1 | def x : nat → nat := 2 | {! λ a, _ !} 3 | --^ "command": "hole", "action": "Use" 4 | -------------------------------------------------------------------------------- /tests/lean/no_eqn_lemma_for_meta_default.lean: -------------------------------------------------------------------------------- 1 | meta structure foo := 2 | (x := 10) 3 | 4 | #print prefix foo.x._default 5 | -------------------------------------------------------------------------------- /tests/lean/quot_ind_bug.lean.expected.out: -------------------------------------------------------------------------------- 1 | quotient.ind c ⟦a⟧ : (λ (_x : quotient s), B _x) ⟦a⟧ 2 | c a : B ⟦a⟧ 3 | c a 4 | -------------------------------------------------------------------------------- /tests/lean/right_assoc_dollar.lean: -------------------------------------------------------------------------------- 1 | constant f : nat → nat → nat 2 | 3 | open nat 4 | 5 | #check f $ succ $ 10 + 20 6 | -------------------------------------------------------------------------------- /tests/lean/run/1218.lean: -------------------------------------------------------------------------------- 1 | example (h : false) : "hello" = "goodbye" := 2 | begin try {reflexivity}, contradiction end 3 | -------------------------------------------------------------------------------- /tests/lean/run/def9.lean: -------------------------------------------------------------------------------- 1 | lemma ex4 (A : Type) : ∀ (a b : A) (H : a = b), b = a 2 | | .(z) z (eq.refl .(z)) := eq.refl z 3 | -------------------------------------------------------------------------------- /tests/lean/run/docstring_after_variables.lean: -------------------------------------------------------------------------------- 1 | variables {a b : nat} 2 | 3 | /-- A docstring. -/ 4 | def foo := a + b 5 | -------------------------------------------------------------------------------- /tests/lean/run/mem_nil.lean: -------------------------------------------------------------------------------- 1 | universe variables u 2 | 3 | example {α : Type u} (a : α) : a ∉ ([] : list α) := 4 | sorry 5 | -------------------------------------------------------------------------------- /tests/lean/run/rw_instantiate_mvars.lean: -------------------------------------------------------------------------------- 1 | example (n : ℕ) (h : n + n ≠ 0) : n ≠ 0 := 2 | by refine mt (λ hz, _) h; rw hz 3 | -------------------------------------------------------------------------------- /tests/lean/tactic_failure.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | example (A B : Type) : B → A := 4 | by do intro `Hb, assumption 5 | -------------------------------------------------------------------------------- /tests/lean/var.lean.expected.out: -------------------------------------------------------------------------------- 1 | var.lean:6:12: error: invalid parameter declaration 'a', it depends on variable 'A' 2 | -------------------------------------------------------------------------------- /src/shell/test_standard.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | LEAN=$1 3 | FILE=$2 4 | export LEAN_PATH=.:../../library/standard 5 | $LEAN $2 6 | -------------------------------------------------------------------------------- /tests/lean/858.lean.expected.out: -------------------------------------------------------------------------------- 1 | 858.lean:2:18: error: don't know how to synthesize placeholder 2 | context: 3 | ⊢ Sort ? 4 | -------------------------------------------------------------------------------- /tests/lean/bad_error4.lean: -------------------------------------------------------------------------------- 1 | structure foo := 2 | (f: unit -> unit) 3 | 4 | definition bar : foo := 5 | { f := λ a b, _ } 6 | -------------------------------------------------------------------------------- /tests/lean/def2.lean.expected.out: -------------------------------------------------------------------------------- 1 | def2.lean:3:11: error: missing 'noncomputable' modifier, definition 'foo' depends on 'val' 2 | -------------------------------------------------------------------------------- /tests/lean/div_eqn.lean.expected.out: -------------------------------------------------------------------------------- 1 | Div.equations._eqn_1 : ∀ (x y : ℕ), Div x y = ite (0 < y ∧ y ≤ x) (Div (x - y) y + 1) 0 2 | -------------------------------------------------------------------------------- /tests/lean/empty.lean.expected.out: -------------------------------------------------------------------------------- 1 | empty.lean:6:39: error: failed to synthesize type class instance for 2 | ⊢ nonempty Empty 3 | -------------------------------------------------------------------------------- /tests/lean/import_widget_violation.lean.expected.out: -------------------------------------------------------------------------------- 1 | tactic.save_info_with_widgets : pos → tactic unit 2 | hello 3 | hello 4 | -------------------------------------------------------------------------------- /tests/lean/infix_paren_improved.lean: -------------------------------------------------------------------------------- 1 | constant f : Π {α : Type}, α → α → α 2 | 3 | infix `**`:60 := f 4 | 5 | #check (**) 6 | -------------------------------------------------------------------------------- /tests/lean/interactive/hole1.lean: -------------------------------------------------------------------------------- 1 | def x : nat → nat := 2 | λ a, {! a + a !} 3 | --^ "command": "hole", "action": "Use" 4 | -------------------------------------------------------------------------------- /tests/lean/mk_constructor_fresh_names.lean.expected.out: -------------------------------------------------------------------------------- 1 | [[fst_2, snd]] 2 | [[x, h_1]] 3 | [[a_1, b, c], [d_2, e_1], [f, g]] 4 | -------------------------------------------------------------------------------- /tests/lean/notation7.lean.expected.out: -------------------------------------------------------------------------------- 1 | g 0:+1:+1 (1:+1 + 2:+1):+1 : ℕ 2 | g (f (f 0)) (f (has_add.add (f 1) (f 2))) : nat 3 | -------------------------------------------------------------------------------- /tests/lean/pp_no_proofs.lean.expected.out: -------------------------------------------------------------------------------- 1 | f _ 2 | f _ 3 | @f 6 _ 4 | @f 6 (@Ps 5 (@Ps 4 (@Ps 3 (@Ps 2 (@Ps 1 (@Ps 0 P0)))))) 5 | -------------------------------------------------------------------------------- /tests/lean/quot_bug.lean.expected.out: -------------------------------------------------------------------------------- 1 | λ (x : A), f x 2 | quot_bug.lean:10:0: warning: declaration '[anonymous]' uses sorry 3 | -------------------------------------------------------------------------------- /tests/lean/run/elab3.lean: -------------------------------------------------------------------------------- 1 | set_option pp.binder_types true 2 | axiom Sorry {A : Sort*} : A 3 | #check (Sorry : ∀ a, a > 0) 4 | -------------------------------------------------------------------------------- /tests/lean/run/emptyc_issue.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | meta def issue (hs : hinst_lemmas) : tactic unit := 4 | rsimp {} hs 5 | -------------------------------------------------------------------------------- /tests/lean/run/eval_expr_partial.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | run_cmd to_expr ``(bit0 1) >>= eval_expr nat >>= tactic.trace 4 | -------------------------------------------------------------------------------- /tests/lean/run/include_bug.lean: -------------------------------------------------------------------------------- 1 | variables x y : nat 2 | variable xy : x = y 3 | 4 | include xy 5 | lemma xyeq : x = y := xy 6 | -------------------------------------------------------------------------------- /tests/lean/run/inliner_bug.lean: -------------------------------------------------------------------------------- 1 | @[inline] def g (n : nat) : nat := 2 | nat.rec_on n 0 (λ m r, r + 2) 3 | 4 | #eval g 10 5 | -------------------------------------------------------------------------------- /tests/lean/run/is_class_timeout.lean: -------------------------------------------------------------------------------- 1 | def c : ℕ := if 999999999 < 9999999999 then 0 else 1 2 | 3 | #eval tactic.is_class `(c) -------------------------------------------------------------------------------- /tests/lean/run/univ_delay_thm_bug.lean: -------------------------------------------------------------------------------- 1 | lemma foo : ∀B A : Type _, ∀a:A, a=a := 2 | let x : ∀A, ∀a:A, a=a := @rfl in λB, x 3 | -------------------------------------------------------------------------------- /tests/lean/run/univ_elab_issue.lean: -------------------------------------------------------------------------------- 1 | meta def foo (ex_lst : list name) (e : expr) : list name := 2 | e^.fold [] (λ c _ l, l) 3 | -------------------------------------------------------------------------------- /tests/lean/sec.lean.expected.out: -------------------------------------------------------------------------------- 1 | sec.lean:7:11: error: invalid parameter/variable declaration, 'A' has already been declared 2 | -------------------------------------------------------------------------------- /tests/lean/t5.lean.expected.out: -------------------------------------------------------------------------------- 1 | g : N → N 2 | h : N 3 | q : N 4 | foo.h : N 5 | t5.lean:13:7: error: unknown identifier 'q' 6 | -------------------------------------------------------------------------------- /tests/lean/extra/597b.hlean: -------------------------------------------------------------------------------- 1 | -- open equiv 2 | constants (A B : Type₀) (f : A ≃ B) 3 | definition foo : A → B := f -- should fail 4 | -------------------------------------------------------------------------------- /tests/lean/hole_in_fn.lean: -------------------------------------------------------------------------------- 1 | 2 | inductive foo 3 | | mk : (nat → nat) → foo 4 | 5 | definition f : foo := 6 | foo.mk (λ n, _) 7 | -------------------------------------------------------------------------------- /tests/lean/meta_equation_pos.lean: -------------------------------------------------------------------------------- 1 | meta def f (x : nat) : nat := 2 | tt -- type error should be reported here 3 | 4 | #check nat 5 | -------------------------------------------------------------------------------- /tests/lean/native_run/hello_world.lean: -------------------------------------------------------------------------------- 1 | import system.IO 2 | 3 | definition main : IO unit := 4 | put_str "Hello Lean!\n" 5 | -------------------------------------------------------------------------------- /tests/lean/noncomp.lean.expected.out: -------------------------------------------------------------------------------- 1 | noncomp.lean:5:11: error: missing 'noncomputable' modifier, definition 'f' depends on 'n' 2 | -------------------------------------------------------------------------------- /tests/lean/run/1493.lean: -------------------------------------------------------------------------------- 1 | open tactic.interactive 2 | 3 | meta def bug : tactic unit := do 4 | _ ← solve1 refl, 5 | return () 6 | -------------------------------------------------------------------------------- /tests/lean/run/axiom_code.lean: -------------------------------------------------------------------------------- 1 | constant ax : nat 2 | noncomputable def test : nat → nat 3 | | 0 := ax 4 | | (n+1) := test n 5 | -------------------------------------------------------------------------------- /tests/lean/run/cases_bug2.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | example (a : nat) : 0 = nat.succ a → false 4 | := by do h ← intro1, cases h 5 | -------------------------------------------------------------------------------- /tests/lean/run/cases_bug3.lean: -------------------------------------------------------------------------------- 1 | theorem ex {A : Type} : ∀ {a a' : A}, a == a' → a = a' 2 | | a .(a) (heq.refl .(a)) := eq.refl a 3 | -------------------------------------------------------------------------------- /tests/lean/run/ind_tac1.lean: -------------------------------------------------------------------------------- 1 | #check @heq.rec_on 2 | 3 | attribute [recursor 6] heq.rec_on 4 | 5 | #print [recursor] heq.rec_on 6 | -------------------------------------------------------------------------------- /tests/lean/run/let_vm_bug.lean: -------------------------------------------------------------------------------- 1 | def f : nat → nat := 2 | let A := nat in 3 | λ (a : A), a 4 | 5 | example : f 0 = 0 := 6 | rfl 7 | -------------------------------------------------------------------------------- /tests/lean/run/overload_issue.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | example : true := 4 | by do 5 | trace $ "hello", 6 | constructor 7 | -------------------------------------------------------------------------------- /tests/lean/run/singleton_pair.lean: -------------------------------------------------------------------------------- 1 | example : {(0,1)} = (singleton (0, 1) : set (ℕ × ℕ)) := rfl 2 | example : {(0,1)} = [(0,1)] := rfl -------------------------------------------------------------------------------- /tests/lean/run/structure_instance_delayed_abstr.lean: -------------------------------------------------------------------------------- 1 | example : ℕ × ℕ := 2 | {fst := have ℕ, from 0, by exact this, snd := 0} 3 | -------------------------------------------------------------------------------- /tests/lean/t6.lean.expected.out: -------------------------------------------------------------------------------- 1 | id : ?M_1 → ?M_1 2 | refl : (?M_1 → ?M_1 → Prop) → Prop 3 | symm : (?M_1 → ?M_1 → Prop) → Prop 4 | -------------------------------------------------------------------------------- /tests/lean/1327.lean.expected.out: -------------------------------------------------------------------------------- 1 | 1327.lean:4:0: error: tactic failed, there are unsolved goals 2 | state: 3 | n : ℕ 4 | ⊢ n.pred = n 5 | -------------------------------------------------------------------------------- /tests/lean/1487.lean.expected.out: -------------------------------------------------------------------------------- 1 | 1487.lean:3:2: error: smt_tactic.close failed 2 | state: 3 | α : Sort ?, 4 | a b : α 5 | ⊢ a = b 6 | -------------------------------------------------------------------------------- /tests/lean/1745.lean.expected.out: -------------------------------------------------------------------------------- 1 | 1745.lean:1:28: error: invalid expression 2 | 1745.lean:1:0: warning: declaration 'foo' uses sorry 3 | -------------------------------------------------------------------------------- /tests/lean/bad_end_error_pos.lean.expected.out: -------------------------------------------------------------------------------- 1 | bad_end_error_pos.lean:7:0: error: invalid 'end', there is no open namespace/section 2 | -------------------------------------------------------------------------------- /tests/lean/cls_err.lean.expected.out: -------------------------------------------------------------------------------- 1 | cls_err.lean:13:2: error: failed to synthesize type class instance for 2 | A : Type u 3 | ⊢ H A 4 | -------------------------------------------------------------------------------- /tests/lean/defeq_simp2.lean.expected.out: -------------------------------------------------------------------------------- 1 | f a _ = f a _ 2 | f a _ = f a _ 3 | f a _ = f a _ 4 | (λ (x : ℕ), f x _) = λ (x : ℕ), f x _ 5 | -------------------------------------------------------------------------------- /tests/lean/extra/print_tests.lean: -------------------------------------------------------------------------------- 1 | #print notation 2 | 3 | #print notation ∧ ∨ 4 | 5 | #print notation if 6 | 7 | #print notation % 8 | -------------------------------------------------------------------------------- /tests/lean/inline_bug.lean: -------------------------------------------------------------------------------- 1 | @[inline] def o (n : ℕ) := prod.mk n n 2 | set_option trace.compiler.inline true 3 | def f := (o 1).fst 4 | -------------------------------------------------------------------------------- /tests/lean/pp_beta.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | 3 | #check (λ x : nat, x) 1 4 | 5 | set_option pp.beta true 6 | 7 | #check (λ x : nat, x) 1 8 | -------------------------------------------------------------------------------- /tests/lean/run/1688.lean: -------------------------------------------------------------------------------- 1 | example : (1 + 1 : ℤ) = 2 := 2 | begin 3 | change (1 + 1 : ℤ) with 2, -- goal : 2 = 2 4 | refl 5 | end 6 | -------------------------------------------------------------------------------- /tests/lean/run/751.lean: -------------------------------------------------------------------------------- 1 | #exit 2 | inductive foo (A : Type) := 3 | | intro : foo A → foo A 4 | with bar : Type := 5 | | intro : bar A 6 | -------------------------------------------------------------------------------- /tests/lean/run/def2.lean: -------------------------------------------------------------------------------- 1 | 2 | definition plus (a b : nat) : nat := 3 | nat.rec_on a b (λ a' ih, nat.succ ih) 4 | 5 | #eval plus 3 5 6 | -------------------------------------------------------------------------------- /tests/lean/run/meta1.lean: -------------------------------------------------------------------------------- 1 | definition bla (a : nat) := a 2 | 3 | meta definition foo (a : nat) := bla a 4 | 5 | meta constant A : nat 6 | -------------------------------------------------------------------------------- /tests/lean/run/sec_bug.lean: -------------------------------------------------------------------------------- 1 | namespace foo 2 | section bla 3 | definition tst := true 4 | end bla 5 | end foo 6 | 7 | #check foo.tst 8 | -------------------------------------------------------------------------------- /tests/lean/simp_subsingleton.lean.expected.out: -------------------------------------------------------------------------------- 1 | [fixed_no_param, eq, eq] 2 | [eq, subsingleton_inst] 3 | [fixed_no_param, eq, eq, cast] 4 | -------------------------------------------------------------------------------- /tests/lean/1334a.lean.expected.out: -------------------------------------------------------------------------------- 1 | fn.equations._eqn_1 : fn atom = atom 2 | fn.equations._eqn_2 : ∀ (l : list nlist), fn (mk l) = mk nil 3 | -------------------------------------------------------------------------------- /tests/lean/eqn_compiler_loop.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | 3 | theorem succ_ne_self : ∀ (n : ℕ), succ n ≠ n 4 | | 0 h := absurd h (nat.succ_ne_zero 0) 5 | -------------------------------------------------------------------------------- /tests/lean/extra/print_info.17.0.expected.out: -------------------------------------------------------------------------------- 1 | LEAN_INFORMATION 2 | definition rfl : ∀ {A : Type} {a : A}, a = a 3 | END_LEAN_INFORMATION 4 | -------------------------------------------------------------------------------- /tests/lean/extra/print_info.17.2.expected.out: -------------------------------------------------------------------------------- 1 | LEAN_INFORMATION 2 | definition rfl : ∀ {A : Type} {a : A}, a = a 3 | END_LEAN_INFORMATION 4 | -------------------------------------------------------------------------------- /tests/lean/interactive/85c.input.expected.out: -------------------------------------------------------------------------------- 1 | {"message":"file invalidated","response":"ok","seq_num":1} 2 | {"response":"ok","seq_num":2} 3 | -------------------------------------------------------------------------------- /tests/lean/interactive/complete_scanner_error.lean: -------------------------------------------------------------------------------- 1 | import 2 | --^ "command": "complete", "skip_completions": true 3 | 4 | def f := ₜ 5 | -------------------------------------------------------------------------------- /tests/lean/issue136.lean.expected.out: -------------------------------------------------------------------------------- 1 | issue136.lean:6:29: error: oh no 2 | issue136.lean:6:0: warning: declaration '[anonymous]' uses sorry 3 | -------------------------------------------------------------------------------- /tests/lean/open_namespaces.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | namespace foo 3 | open int 4 | run_cmd tactic.open_namespaces >>= tactic.trace 5 | end foo 6 | -------------------------------------------------------------------------------- /tests/lean/print_escape_name.lean.expected.out: -------------------------------------------------------------------------------- 1 | constant «x.y» : false 2 | theorem «a.b» : false := 3 | «x.y» 4 | «a.b» : false 5 | «x.y» 6 | -------------------------------------------------------------------------------- /tests/lean/run/default_field_pi.lean: -------------------------------------------------------------------------------- 1 | structure foo := 2 | (bar : Π n : ℕ, ℕ := id) 3 | (baz : Π {n : ℕ}, ℕ := id) 4 | 5 | #check {foo.} 6 | -------------------------------------------------------------------------------- /tests/lean/run/mixed_tmp_non_tmp_universe_bug.lean: -------------------------------------------------------------------------------- 1 | #reduce (default : bool × unit × nat) 2 | #reduce (default : bool × bool × bool × bool) 3 | -------------------------------------------------------------------------------- /tests/lean/run/nasty_sizeof.lean: -------------------------------------------------------------------------------- 1 | def nasty_sizeof : list nat → nat 2 | | [] := 100000000 3 | | (a::as) := nasty_sizeof as + 100000000 4 | -------------------------------------------------------------------------------- /tests/lean/run/quote_wo_eval.lean: -------------------------------------------------------------------------------- 1 | meta def loop : nat → nat 2 | | n := loop n 3 | 4 | meta def tst : expr := `(loop 1) 5 | 6 | #eval tst 7 | -------------------------------------------------------------------------------- /tests/lean/run/struct_extend_univ.lean: -------------------------------------------------------------------------------- 1 | universe u 2 | class foo (α : Sort u) := (a : α) 3 | class bar (α : Type u) extends foo α := (b : α) 4 | -------------------------------------------------------------------------------- /tests/lean/run/subst_vars.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | example (a b c d : nat) : a = b → b = c → d = c → a = d := 4 | by intros; subst_vars 5 | -------------------------------------------------------------------------------- /tests/lean/structure_with_index_error.lean.expected.out: -------------------------------------------------------------------------------- 1 | structure_with_index_error.lean:1:14: error: invalid 'structure', 'Type' expected 2 | -------------------------------------------------------------------------------- /tests/lean/widget/widget5.lean: -------------------------------------------------------------------------------- 1 | open tactic widget 2 | 3 | #html (component.pure $ λ _, [h "p" [attr.style [("color", "blue")]] ["hi"]]) 4 | -------------------------------------------------------------------------------- /src/util/numerics/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(numerics OBJECT mpz.cpp mpq.cpp) 2 | if(EMSCRIPTEN) 3 | add_dependencies(numerics gmp) 4 | endif() 5 | -------------------------------------------------------------------------------- /tests/lean/1786.lean: -------------------------------------------------------------------------------- 1 | theorem nil_subset : (true ∧ true) = true := by simp 2 | open list 3 | 4 | example (x : ℕ) : x = x := by simp [nil_subset] 5 | -------------------------------------------------------------------------------- /tests/lean/bad_print.lean: -------------------------------------------------------------------------------- 1 | constant boo : nat 2 | 3 | #print definition boo 4 | 5 | #print 2 6 | 7 | #print fields nat 8 | 9 | #print nat.addd -------------------------------------------------------------------------------- /tests/lean/ctxopt.lean: -------------------------------------------------------------------------------- 1 | -- 2 | 3 | 4 | section 5 | set_option pp.implicit true 6 | #check id true 7 | end 8 | 9 | #check id true 10 | -------------------------------------------------------------------------------- /tests/lean/dsimp_whnf_post.lean.expected.out: -------------------------------------------------------------------------------- 1 | dsimp_whnf_post.lean:6:36: error: tactic failed, there are unsolved goals 2 | state: 3 | ⊢ () = () 4 | -------------------------------------------------------------------------------- /tests/lean/example_false.lean.expected.out: -------------------------------------------------------------------------------- 1 | example_false.lean:3:0: error: failed to add declaration to environment, it contains local constants 2 | -------------------------------------------------------------------------------- /tests/lean/extra/goal_hole.lean: -------------------------------------------------------------------------------- 1 | example (a b c : nat) : a = b → b = c → a = c := 2 | begin 3 | intro h₁ h₂, 4 | exact eq.trans _ h₂ 5 | end 6 | -------------------------------------------------------------------------------- /tests/lean/hex_numeral.lean: -------------------------------------------------------------------------------- 1 | #eval (0xff : nat) 2 | #eval (0xffff : nat) 3 | #eval (0xaa : nat) 4 | #eval (0x10 : nat) 5 | #eval (0x10000 : nat) 6 | -------------------------------------------------------------------------------- /tests/lean/hole_in_fn.lean.expected.out: -------------------------------------------------------------------------------- 1 | hole_in_fn.lean:6:13: error: don't know how to synthesize placeholder 2 | context: 3 | n : ℕ 4 | ⊢ ℕ 5 | -------------------------------------------------------------------------------- /tests/lean/level_instantiate.lean.expected.out: -------------------------------------------------------------------------------- 1 | level.instantiate : level → list (name × level) → level 2 | "y" 3 | "y" 4 | "y" 5 | "max y z" 6 | -------------------------------------------------------------------------------- /tests/lean/noncomp_error.lean.expected.out: -------------------------------------------------------------------------------- 1 | noncomp_error.lean:1:25: warning: unexpected 'noncomputable' modifier, definition 'a' is computable 2 | -------------------------------------------------------------------------------- /tests/lean/noncomp_thm.lean.expected.out: -------------------------------------------------------------------------------- 1 | noncomp_thm.lean:1:22: warning: unexpected 'noncomputable' modifier, definition 'foo' is computable 2 | -------------------------------------------------------------------------------- /tests/lean/pp_zero_bug.lean.expected.out: -------------------------------------------------------------------------------- 1 | has_zero.zero : Π {α : Type u_1} [self : has_zero α], α 2 | has_zero.zero : Π [self : has_zero ℕ], ℕ 3 | -------------------------------------------------------------------------------- /tests/lean/qexpr1.lean.expected.out: -------------------------------------------------------------------------------- 1 | @has_add.add.{0} nat nat.has_add a b 2 | nat 3 | @has_add.add.{0} nat nat.has_add (nat.succ a) b 4 | nat 5 | -------------------------------------------------------------------------------- /tests/lean/run/1590.lean: -------------------------------------------------------------------------------- 1 | #check `(true.intro) 2 | #check (`(true.intro) : expr) 3 | 4 | variables (h : true) [reflected _ h] 5 | #check `(id h) 6 | -------------------------------------------------------------------------------- /tests/lean/run/atomic_notation.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | constant f : nat → nat 3 | notation `o`:1 := (10:nat) 4 | #check o + 1 5 | #check f o + o + o 6 | -------------------------------------------------------------------------------- /tests/lean/run/ind0.lean: -------------------------------------------------------------------------------- 1 | prelude 2 | inductive nat : Type 3 | | zero : nat 4 | | succ : nat → nat 5 | 6 | #check nat 7 | #check nat.rec.{1} 8 | -------------------------------------------------------------------------------- /tests/lean/run/local_attr_doc.lean: -------------------------------------------------------------------------------- 1 | /-- `foo` is awesome -/ 2 | local attribute [simp] -- command does not accept doc string 3 | def foo := false 4 | -------------------------------------------------------------------------------- /tests/lean/run/noncomputable_bug.lean: -------------------------------------------------------------------------------- 1 | constant f : Π A : Type, A → Type 2 | 3 | def ex5b (α : Type) (a : α) : Π A : Type, A → Type := 4 | f 5 | -------------------------------------------------------------------------------- /tests/lean/run/struct_bug3.lean: -------------------------------------------------------------------------------- 1 | structure foo := 2 | (f : Π {α : Type}, α) 3 | (g : Π {α : Type}, α := @f) 4 | 5 | structure bar extends foo 6 | -------------------------------------------------------------------------------- /tests/lean/structure_elab_segfault.lean: -------------------------------------------------------------------------------- 1 | structure foo {A} (R) (x : list A) : Prop := (bar : R x) 2 | structure test : Type := (f : ∀ x y, true) 3 | -------------------------------------------------------------------------------- /tests/lean/structure_result_type_may_be_zero.lean: -------------------------------------------------------------------------------- 1 | structure {uA uB} Fun (A : Sort uA) (B : Sort uB) : Sort (imax uA uB) := (item : Π(a : A), B) 2 | -------------------------------------------------------------------------------- /tests/lean/type_error_at_eval_expr.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | run_cmd do 4 | e ← to_expr ``([5] : list ℕ), 5 | eval_expr ℕ e, 6 | return () 7 | -------------------------------------------------------------------------------- /tests/lean/calc1.lean.expected.out: -------------------------------------------------------------------------------- 1 | le_eq_trans a d e (le_trans a c d (eq_le_trans a b c H1 H2) H3) H4 : a ≤ e 2 | le_lt_trans b c d H2 H5 : b < d 3 | -------------------------------------------------------------------------------- /tests/lean/defeq_simp3.lean.expected.out: -------------------------------------------------------------------------------- 1 | @eq.{1} (nat → nat) (@has_add.add.{0} nat nat.has_add a) (λ (x : nat), @has_add.add.{0} nat nat.has_add a b) 2 | -------------------------------------------------------------------------------- /tests/lean/dunfold_constant.lean.expected.out: -------------------------------------------------------------------------------- 1 | dunfold_constant.lean:2:28: error: tactic failed, there are unsolved goals 2 | state: 3 | ⊢ [2] = [2] 4 | -------------------------------------------------------------------------------- /tests/lean/eqn_hole.lean: -------------------------------------------------------------------------------- 1 | 2 | definition f : nat → nat 3 | | 0 := _ 4 | 5 | 6 | definition g : nat → nat 7 | | 0 := 0 8 | | (n+1) := g _ + 1 9 | -------------------------------------------------------------------------------- /tests/lean/extra/print_info.12.19.expected.out: -------------------------------------------------------------------------------- 1 | LEAN_INFORMATION 2 | definition mul : Π {A : Type} [s : has_mul A], A → A → A 3 | END_LEAN_INFORMATION 4 | -------------------------------------------------------------------------------- /tests/lean/extra/print_info.12.20.expected.out: -------------------------------------------------------------------------------- 1 | LEAN_INFORMATION 2 | definition mul : Π {A : Type} [s : has_mul A], A → A → A 3 | END_LEAN_INFORMATION 4 | -------------------------------------------------------------------------------- /tests/lean/extra/print_info.7.18.expected.out: -------------------------------------------------------------------------------- 1 | LEAN_INFORMATION 2 | definition add : Π {A : Type} [s : has_add A], A → A → A 3 | END_LEAN_INFORMATION 4 | -------------------------------------------------------------------------------- /tests/lean/fail/non_meta_rec_fn.lean: -------------------------------------------------------------------------------- 1 | lemma main : false := 2 | begin 3 | have helper : true → false := λ ⟨⟩, _fun_match _x, 4 | exact helper ⟨⟩ 5 | end -------------------------------------------------------------------------------- /tests/lean/hinst_lemmas1.lean.expected.out: -------------------------------------------------------------------------------- 1 | {[foo2, patterns: {{?x_1 > ?x_0, ?x_1 < ?x_2}}], [foo3, patterns: {{?x_1 > ?x_0, ?x_1 < ?x_2 + ?x_2}}]} 2 | -------------------------------------------------------------------------------- /tests/lean/interactive/complete_trailing_period.lean: -------------------------------------------------------------------------------- 1 | prelude 2 | 3 | inductive foo 4 | 5 | def f := foo. 6 | --^ "command": "complete" 7 | -------------------------------------------------------------------------------- /tests/lean/interactive/info_import.input.expected.out: -------------------------------------------------------------------------------- 1 | {"message":"file invalidated","response":"ok","seq_num":0} 2 | {"response":"ok","seq_num":3} 3 | -------------------------------------------------------------------------------- /tests/lean/notation3.lean.expected.out: -------------------------------------------------------------------------------- 1 | [a, b, b] : List ℕ 2 | (a, true, a = b, b) : ℕ × Prop × Prop × ℕ 3 | (a, b) : ℕ × ℕ 4 | [1, 2 + 2, 3] : List ℕ 5 | -------------------------------------------------------------------------------- /tests/lean/offset_is_def_eq_trick.lean.expected.out: -------------------------------------------------------------------------------- 1 | head.equations._eqn_1 : ∀ {α : Type u_1} (n : ℕ) (h : α) (t : Vec α n), head (Vec.cons h t) = h 2 | -------------------------------------------------------------------------------- /tests/lean/run/437c.lean: -------------------------------------------------------------------------------- 1 | example (a : ℕ) : true := 2 | begin 3 | have : ∀ n, n ≥ 0 → a ≤ a, 4 | { exact λ _ _, le_refl a }, 5 | trivial 6 | end 7 | -------------------------------------------------------------------------------- /tests/lean/run/445.lean: -------------------------------------------------------------------------------- 1 | constants (A : Type) (a : A) 2 | constants (B : Type) (b₁ b₂ : B) (H : b₁ = b₂) 3 | 4 | #check a 5 | #check b₁ 6 | #check H 7 | -------------------------------------------------------------------------------- /tests/lean/run/nary_existsi.lean: -------------------------------------------------------------------------------- 1 | example : ∃ a b c : nat, a = b + c := 2 | begin 3 | existsi [_, _, _], 4 | refl, 5 | repeat {exact 0} 6 | end 7 | -------------------------------------------------------------------------------- /tests/lean/run/noncomputable_meta.lean: -------------------------------------------------------------------------------- 1 | constants (X : Type) (x y : X) 2 | 3 | noncomputable meta def foo : bool -> X 4 | | tt := x 5 | | ff := y 6 | -------------------------------------------------------------------------------- /tests/lean/run/simp_if_true_false.lean: -------------------------------------------------------------------------------- 1 | example (m n p : ℕ) : ite (m = m) n p = n := by simp 2 | example (m n p : ℕ) : ite (m ≠ m) n p = p := by simp 3 | -------------------------------------------------------------------------------- /tests/lean/set_attr1.lean.expected.out: -------------------------------------------------------------------------------- 1 | set_attr1.lean:14:3: error: tactic failed, there are unsolved goals 2 | state: 3 | n : ℕ 4 | ⊢ f n = n + 1 5 | -------------------------------------------------------------------------------- /tests/lean/subst_bug.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | example (b1 b2 : bool) (h : b1 = ff) : b1 && b2 = ff := 4 | by do h ← get_local `h, 5 | subst h 6 | -------------------------------------------------------------------------------- /tests/lean/tactic_failure.lean.expected.out: -------------------------------------------------------------------------------- 1 | tactic_failure.lean:4:3: error: assumption tactic failed 2 | state: 3 | A B : Type, 4 | Hb : B 5 | ⊢ A 6 | -------------------------------------------------------------------------------- /tests/lean/1956.lean.expected.out: -------------------------------------------------------------------------------- 1 | 1956.lean:1:0: error: deep recursion was detected at 'replace' (potential solution: increase stack space in your system) 2 | -------------------------------------------------------------------------------- /tests/lean/bad_error3.lean: -------------------------------------------------------------------------------- 1 | example (p : nat → nat → Prop) : p 0 := 2 | begin 3 | end 4 | 5 | def ex (p : nat → nat → Prop) : p 0 := 6 | begin 7 | end 8 | -------------------------------------------------------------------------------- /tests/lean/change2.lean.expected.out: -------------------------------------------------------------------------------- 1 | b : ℕ 2 | ⊢ b.succ.succ = (b + 1).succ 3 | ---- after dsimp ---- 4 | b : ℕ 5 | ⊢ b + 0 + 1 + 0 + 1 = b + 1 + 0 + 1 6 | -------------------------------------------------------------------------------- /tests/lean/errors2.lean.expected.out: -------------------------------------------------------------------------------- 1 | errors2.lean:8:11: error: unknown identifier 'foo' 2 | errors2.lean:5:0: warning: declaration 'foo.tst1' uses sorry 3 | -------------------------------------------------------------------------------- /tests/lean/get_weight.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | #eval 4 | ([`(ℕ), `(1 + 0)] : list expr).mmap' $ λ e : expr, do 5 | trace (e, e.get_weight, e.get_depth) 6 | -------------------------------------------------------------------------------- /tests/lean/import_middle.lean.expected.out: -------------------------------------------------------------------------------- 1 | hello 2 | import_middle.lean:5:0: error: invalid 'import' command, it must be used in the beginning of the file 3 | -------------------------------------------------------------------------------- /tests/lean/irreducible_instance.lean.expected.out: -------------------------------------------------------------------------------- 1 | irreducible_instance.lean:6:0: error: tactic.mk_instance failed to generate instance for 2 | foo "" 3 | -------------------------------------------------------------------------------- /tests/lean/native_run/config.lean: -------------------------------------------------------------------------------- 1 | -- set_option default configuration for tests 2 | prelude 3 | set_option pp.colors false 4 | set_option pp.unicode true 5 | -------------------------------------------------------------------------------- /tests/lean/pp_param_bug.lean: -------------------------------------------------------------------------------- 1 | section 2 | parameters (A : Type) {B : Type} 3 | 4 | definition foo3 (a : A) (b : B) := a 5 | 6 | #check foo3 7 | end 8 | -------------------------------------------------------------------------------- /tests/lean/prodtst.lean: -------------------------------------------------------------------------------- 1 | -- 2 | 3 | inductive prod2 (A B : Type.{_+1}) 4 | | mk : A → B → prod2 5 | 6 | set_option pp.universes true 7 | #check @prod2 8 | -------------------------------------------------------------------------------- /tests/lean/run/bug_refl_lemma.lean: -------------------------------------------------------------------------------- 1 | def f := @id 2 | @[simp] lemma foo {α : Type} [inhabited α] : f = @id α := rfl 3 | 4 | example : f = @id ℕ := by simp 5 | -------------------------------------------------------------------------------- /tests/lean/run/declare_axiom.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | run_cmd (do 4 | e ← to_expr ``(false), 5 | add_decl $ declaration.ax `useful_assumption [] e) 6 | -------------------------------------------------------------------------------- /tests/lean/run/def4.lean: -------------------------------------------------------------------------------- 1 | 2 | section 3 | variable (A : Type) 4 | 5 | definition f : A → A := 6 | λ x, x 7 | 8 | end 9 | 10 | #check f 11 | -------------------------------------------------------------------------------- /tests/lean/run/full.lean: -------------------------------------------------------------------------------- 1 | namespace foo 2 | constant x : nat 3 | #check x 4 | #check x 5 | set_option pp.full_names true 6 | #check x 7 | end foo 8 | -------------------------------------------------------------------------------- /tests/lean/run/new_proj_notation.lean: -------------------------------------------------------------------------------- 1 | variable x : list nat 2 | 3 | #check x^.map (+1) 4 | 5 | #check x^.foldl (+) 0 6 | 7 | #eval [1, 2, 3]^.map (+3) 8 | -------------------------------------------------------------------------------- /tests/lean/run/ns1.lean: -------------------------------------------------------------------------------- 1 | namespace foo 2 | namespace boo 3 | theorem tst : true := trivial 4 | end boo 5 | end foo 6 | 7 | open foo 8 | #check boo.tst 9 | -------------------------------------------------------------------------------- /tests/lean/run/t10.lean: -------------------------------------------------------------------------------- 1 | set_option pp.colors true 2 | set_option pp.unicode false 3 | #print options 4 | set_option pp.unicode true 5 | #print options 6 | -------------------------------------------------------------------------------- /tests/lean/sec3.lean: -------------------------------------------------------------------------------- 1 | section 2 | parameter A : Type 3 | definition tst (a : A) := a 4 | set_option pp.universes true 5 | #check tst.{1} 6 | end 7 | -------------------------------------------------------------------------------- /tests/lean/subst_bug.lean.expected.out: -------------------------------------------------------------------------------- 1 | subst_bug.lean:4:3: error: tactic failed, there are unsolved goals 2 | state: 3 | b2 : bool 4 | ⊢ ff && b2 = ff 5 | -------------------------------------------------------------------------------- /tests/lean/vmo2.lean: -------------------------------------------------------------------------------- 1 | import .vmo1 2 | 3 | #eval cheese -- should be comte 4 | attribute [vm_override fromage] cheese 5 | #eval cheese -- should be comte 6 | -------------------------------------------------------------------------------- /tests/lean/wrong_arity.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | 3 | theorem succ_ne_self : ∀ (n : ℕ), succ n ≠ n 4 | | 0 h := absurd h (nat.succ_ne_zero 0) 5 | | n := sorry 6 | -------------------------------------------------------------------------------- /tests/lean/wrong_arity.lean.expected.out: -------------------------------------------------------------------------------- 1 | wrong_arity.lean:5:6: error: invalid match/equations expression, each case must have the same number of patterns 2 | -------------------------------------------------------------------------------- /tests/lean/1292.lean: -------------------------------------------------------------------------------- 1 | def fn (n : nat) : nat := 2 | match n with 3 | 4 | #exit 5 | 6 | theorem thm : true := begin end 7 | 8 | example : has_add nat := sorry 9 | -------------------------------------------------------------------------------- /tests/lean/alias.lean.expected.out: -------------------------------------------------------------------------------- 1 | [choice foo foo] a b 2 | [choice foo foo] a b 3 | [choice foo foo] a b 4 | [choice foo foo] a b 5 | [choice foo foo] a b 6 | -------------------------------------------------------------------------------- /tests/lean/bad_error1.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | 3 | protected lemma bit0_ne_bit1 : ∀ (n m : ℕ), bit0 n ≠ bit1 m := 4 | λ n m : nat, ne.symm (nat.bit1_ne_bit0 n m) 5 | -------------------------------------------------------------------------------- /tests/lean/notation8.lean: -------------------------------------------------------------------------------- 1 | constant f : nat → nat → nat 2 | constant g : nat → nat 3 | 4 | #check f (1 + g 1) $ g 2 + 2 5 | #check f (g 1) $ f (1 + 1) $ g 2 6 | -------------------------------------------------------------------------------- /tests/lean/pp_opt_param.lean: -------------------------------------------------------------------------------- 1 | #check expr 2 | #check expr ff 3 | def f (x := 3) (y : nat) := y 4 | #check f 3 4 5 | set_option pp.implicit true 6 | #check expr 7 | -------------------------------------------------------------------------------- /tests/lean/ppbug.lean.expected.out: -------------------------------------------------------------------------------- 1 | list.rec_on : 2 | Π (n : list ?M_1), ?M_2 list.nil → (Π (hd : ?M_1) (tl : list ?M_1), ?M_2 tl → ?M_2 (hd :: tl)) → ?M_2 n 3 | -------------------------------------------------------------------------------- /tests/lean/qexpr2.lean.expected.out: -------------------------------------------------------------------------------- 1 | @has_add.add.{0} nat nat.has_add ?m_1 b 2 | nat 3 | ------ after instantiate_mvars 4 | @has_add.add.{0} nat nat.has_add c b 5 | -------------------------------------------------------------------------------- /tests/lean/run/490.lean: -------------------------------------------------------------------------------- 1 | structure {u} foo : Type (u+2) := 2 | (elim : Type u → Type u) 3 | 4 | set_option pp.universes true 5 | #check foo.elim 6 | #check foo 7 | -------------------------------------------------------------------------------- /tests/lean/run/cases_bug.lean: -------------------------------------------------------------------------------- 1 | theorem cast_heq₂ : ∀ {A B : Type} (H : A = B) (a : A), cast H a == a 2 | | A .(A) (eq.refl .(A)) a := heq_of_eq $ cast_eq _ _ 3 | -------------------------------------------------------------------------------- /tests/lean/run/class1.lean: -------------------------------------------------------------------------------- 1 | open prod inhabited 2 | 3 | definition H : inhabited (Prop × nat × (nat → nat)) := 4 | by tactic.apply_instance 5 | 6 | #print H 7 | -------------------------------------------------------------------------------- /tests/lean/run/class2.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | def H {A B : Type} (H1 : inhabited A) : inhabited (Prop × A × (B → nat)) 3 | := by apply_instance 4 | 5 | #print H 6 | -------------------------------------------------------------------------------- /tests/lean/run/contradiction_issue.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | def hd {α} : {l : list α // l ≠ []} → α 4 | | ⟨[], h⟩ := by contradiction 5 | | ⟨a::l, h⟩ := a 6 | -------------------------------------------------------------------------------- /tests/lean/run/fact_pi.lean: -------------------------------------------------------------------------------- 1 | @[class] 2 | def fact (p : Prop) := p 3 | 4 | example {P Q R : Prop} [fact (P → Q → R)] : fact (P → Q → R) := 5 | by apply_instance -------------------------------------------------------------------------------- /tests/lean/run/funext_issue.lean: -------------------------------------------------------------------------------- 1 | universes u 2 | 3 | example (α : Type u) (p : Prop) (a b : α) (h : p → a = b) : (λ x : p, a) = (λ x : p, b) := 4 | funext h 5 | -------------------------------------------------------------------------------- /tests/lean/run/opt_param_cnsts.lean: -------------------------------------------------------------------------------- 1 | constant foo (a : nat) (b : bool := tt) : nat 2 | axiom fooAx : foo 0 = 0 3 | 4 | example : foo 0 = foo 0 tt := 5 | rfl 6 | -------------------------------------------------------------------------------- /tests/lean/run/section3.lean: -------------------------------------------------------------------------------- 1 | section 2 | parameter (A : Type) 3 | definition foo := A 4 | definition bar {X : Type} {A : X} : foo := 5 | sorry 6 | end 7 | -------------------------------------------------------------------------------- /tests/lean/sort.lean.expected.out: -------------------------------------------------------------------------------- 1 | sort.lean:1:7: error: invalid universe `Sort`, use `Sort 0` or `Prop` instead 2 | Prop : Type 3 | Prop : Type 4 | Prop : Type 5 | -------------------------------------------------------------------------------- /tests/lean/utf8.lean: -------------------------------------------------------------------------------- 1 | --open list 2 | 3 | #eval "α₁".length 4 | #eval "α₁ → β₁".length 5 | #eval "∀ α : nat → nat, α 0 ≥ 0".length 6 | #print "------------" 7 | -------------------------------------------------------------------------------- /tests/lean/1598.lean.expected.out: -------------------------------------------------------------------------------- 1 | 1598.lean:3:3: error: existsi tactic failed, type mismatch between given term witness and expected type 2 | state: 3 | ⊢ 0 = false 4 | -------------------------------------------------------------------------------- /tests/lean/1760.lean: -------------------------------------------------------------------------------- 1 | section 2 | parameter big_type : Type 1 3 | parameter x : big_type 4 | parameter f {A : Type} : A → bool 5 | 6 | def foo : bool := f x 7 | end 8 | -------------------------------------------------------------------------------- /tests/lean/dsimp_whnf.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | example (a b : nat) : ((a + 1, b).1) = a + 1 := 4 | by do 5 | dsimp_target, 6 | trace_state, 7 | reflexivity 8 | -------------------------------------------------------------------------------- /tests/lean/eqn_compiler_loop.lean.expected.out: -------------------------------------------------------------------------------- 1 | eqn_compiler_loop.lean:3:8: error: non-exhaustive match, the following cases are missing: 2 | succ_ne_self (succ _) _ 3 | -------------------------------------------------------------------------------- /tests/lean/extra/rec2.lean: -------------------------------------------------------------------------------- 1 | set_option pp.implicit true 2 | set_option pp.notation false 3 | definition ideq : Π {A : Type} {a b : A}, a = b → a = b, 4 | ideq H := H 5 | -------------------------------------------------------------------------------- /tests/lean/interactive/trace.lean: -------------------------------------------------------------------------------- 1 | example (p q : Prop) : p → q → p := 2 | begin 3 | trace "foo", 4 | intros, 5 | trace "hello world", 6 | assumption 7 | end 8 | -------------------------------------------------------------------------------- /tests/lean/internal_names.lean: -------------------------------------------------------------------------------- 1 | definition _foo : nat := 0 -- error 2 | 3 | structure _bla := (a b : nat) 4 | 5 | inductive _empty : Type. 6 | 7 | namespace _no 8 | -------------------------------------------------------------------------------- /tests/lean/no_coe.lean: -------------------------------------------------------------------------------- 1 | #check if tt then 1 else 0 2 | 3 | set_option elaborator.coercions false 4 | 5 | #check if tt then 1 else 0 -- Error coercions are disabled 6 | -------------------------------------------------------------------------------- /tests/lean/print_escape_name.lean: -------------------------------------------------------------------------------- 1 | constant «x.y» : false 2 | lemma «a.b» : false := «x.y» 3 | 4 | #print «x.y» 5 | #print «a.b» 6 | #check «a.b» 7 | #print axioms «a.b» -------------------------------------------------------------------------------- /tests/lean/run/1208.lean: -------------------------------------------------------------------------------- 1 | lemma foo {α : Type*} {f : α → α} (a : α) : f a = f a := rfl 2 | example {X : Type} (h : X → X) (x₀ : X) : h x₀ = h x₀ := by apply (foo x₀) 3 | -------------------------------------------------------------------------------- /tests/lean/run/1943.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | meta def c := abstract `[assumption] 3 | 4 | structure B (U : Type) := 5 | (f : U → U) 6 | (w : ∀ u : U, f u = u . c) 7 | -------------------------------------------------------------------------------- /tests/lean/run/auto_propext.lean: -------------------------------------------------------------------------------- 1 | example (p q : Prop) (h : p) : q ∨ p := 2 | by simp [h] 3 | 4 | example (p q : Prop) : p → q ∨ p := 5 | by simp {contextual := tt} 6 | -------------------------------------------------------------------------------- /tests/lean/run/calc_imp.lean: -------------------------------------------------------------------------------- 1 | example (A B C D : Prop) (h1 : A → B) (h2 : B → C) (h3 : C → D) : A → D := 2 | calc A → B : h1 3 | ... → C : h2 4 | ... → D : h3 5 | -------------------------------------------------------------------------------- /tests/lean/run/dunfold4.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | namespace list 4 | example : length ([] : list unit) = 0 := 5 | begin dunfold length, reflexivity end 6 | end list 7 | -------------------------------------------------------------------------------- /tests/lean/run/fn_default.lean: -------------------------------------------------------------------------------- 1 | structure foo := 2 | (bar : Π n : ℕ, ℕ := id) 3 | (baz : Π {n : ℕ}, ℕ := id) 4 | (bat : Π n : ℕ, ℕ := λ n, n) 5 | 6 | #check {foo.} 7 | -------------------------------------------------------------------------------- /tests/lean/run/rec_and_tac_issue.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | 3 | def f : ℕ → ℕ → ℕ 4 | | 0 b := 0 5 | | (succ n) b := begin cases b with b', exact 0, exact f n b' end 6 | -------------------------------------------------------------------------------- /tests/lean/run/repeat_tac.lean: -------------------------------------------------------------------------------- 1 | example (p q r s : Prop) : p → q → r → s → (p ∧ q) ∧ (r ∧ s ∧ p) ∧ (p ∧ r ∧ q) := 2 | by intros; repeat { constructor }; assumption 3 | -------------------------------------------------------------------------------- /tests/lean/simp_symm.lean.expected.out: -------------------------------------------------------------------------------- 1 | simp_symm.lean:32:0: warning: declaration 'op' uses sorry 2 | simp_symm.lean:33:8: warning: declaration 'op_assoc' uses sorry 3 | -------------------------------------------------------------------------------- /tests/lean/smart_unfolding.lean: -------------------------------------------------------------------------------- 1 | constant n : nat 2 | #reduce n + (nat.succ n) 3 | 4 | set_option type_context.smart_unfolding false 5 | #reduce n + (nat.succ n) 6 | -------------------------------------------------------------------------------- /tests/lean/1922.lean: -------------------------------------------------------------------------------- 1 | set_option pp.implicit true 2 | 3 | structure C := 4 | ( d : Π { X : Type }, list X → list X ) 5 | 6 | def P(c : C):= c.d [0] 7 | 8 | #print P 9 | -------------------------------------------------------------------------------- /tests/lean/auto_quote_error.lean: -------------------------------------------------------------------------------- 1 | example (a b c : nat) : a = b → b = c → c = a := 2 | begin 3 | intro h1, 4 | intro h2, 5 | exact eq.symm (eq.trans h1 _), 6 | end 7 | -------------------------------------------------------------------------------- /tests/lean/bad_notation.lean: -------------------------------------------------------------------------------- 1 | -- 2 | open nat 3 | 4 | section 5 | variable a : nat 6 | notation `a1`:max := a + 1 7 | end 8 | 9 | definition foo := a1 10 | -------------------------------------------------------------------------------- /tests/lean/extra/print_info.4.16.expected.out: -------------------------------------------------------------------------------- 1 | LEAN_INFORMATION 2 | inductive nat : Type₁ 3 | constructors: 4 | nat.zero : ℕ 5 | nat.succ : ℕ → ℕ 6 | END_LEAN_INFORMATION 7 | -------------------------------------------------------------------------------- /tests/lean/extra/show_goal.6.0.expected.out: -------------------------------------------------------------------------------- 1 | show_goal.lean:2:0: warning: imported file uses 'sorry' 2 | show_goal.lean:5:0: error: begin-end-exprs have been disabled 3 | -------------------------------------------------------------------------------- /tests/lean/extra/show_goal.8.4.expected.out: -------------------------------------------------------------------------------- 1 | LEAN_INFORMATION 2 | position 8:4 3 | a b c d : ℕ, 4 | h₁ : a + b = 0, 5 | h₂ : b = 0 6 | ⊢ a = 0 7 | END_LEAN_INFORMATION 8 | -------------------------------------------------------------------------------- /tests/lean/extra/show_goal.8.5.expected.out: -------------------------------------------------------------------------------- 1 | LEAN_INFORMATION 2 | position 9:4 3 | a b c d : ℕ, 4 | h₁ : a + 0 = 0, 5 | h₂ : b = 0 6 | ⊢ a = 0 7 | END_LEAN_INFORMATION 8 | -------------------------------------------------------------------------------- /tests/lean/extra/show_goal.9.4.expected.out: -------------------------------------------------------------------------------- 1 | LEAN_INFORMATION 2 | position 9:4 3 | a b c d : ℕ, 4 | h₁ : a + 0 = 0, 5 | h₂ : b = 0 6 | ⊢ a = 0 7 | END_LEAN_INFORMATION 8 | -------------------------------------------------------------------------------- /tests/lean/interactive/info_id_pre_elab.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | #check (trace 4 | --^ "command": "info" 5 | 6 | #check (abstract 7 | --^ "command": "info" 8 | -------------------------------------------------------------------------------- /tests/lean/interactive/sync.input.expected.out: -------------------------------------------------------------------------------- 1 | {"message":"file invalidated","response":"ok","seq_num":0} 2 | {"message":"file invalidated","response":"ok","seq_num":2} 3 | -------------------------------------------------------------------------------- /tests/lean/invalid_ematch_attr.lean: -------------------------------------------------------------------------------- 1 | constant f : ℕ → ℕ 2 | axiom foo {m n : ℕ} : f m = m 3 | 4 | attribute [ematch] foo 5 | 6 | example : true := begin[smt] eblast end 7 | -------------------------------------------------------------------------------- /tests/lean/leanpkg/build_error/leanpkg.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "build_error" 3 | path = "src" 4 | version = "0.1" 5 | lean_version = "master" 6 | 7 | [dependencies] 8 | -------------------------------------------------------------------------------- /tests/lean/noncomputable_bytecode_issue.lean: -------------------------------------------------------------------------------- 1 | constant a : nat 2 | 3 | meta def ex : tactic expr := 4 | return `(a) 5 | 6 | open tactic 7 | 8 | run_cmd ex >> return () 9 | -------------------------------------------------------------------------------- /tests/lean/notation4.lean.expected.out: -------------------------------------------------------------------------------- 1 | ∃ (A : Type) (x y : A), x = y : Prop 2 | ∃ (x : ℕ), x = 0 : Prop 3 | Σ' (x : ℕ), x = 10 : Type 4 | Σ (A : Type), List A : Type 1 5 | -------------------------------------------------------------------------------- /tests/lean/pp_binder_types.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | 3 | definition f (n : nat) (H : n = n) := λm, id (n + m) 4 | #print f 5 | 6 | set_option pp.binder_types true 7 | #print f 8 | -------------------------------------------------------------------------------- /tests/lean/run/1790.lean: -------------------------------------------------------------------------------- 1 | universes u 2 | 3 | def foo (α : Type u) : unit → unit 4 | | unit.star := unit.star 5 | 6 | def foo2 (α : Type u) : unit → unit 7 | | s := s 8 | -------------------------------------------------------------------------------- /tests/lean/run/411c.lean: -------------------------------------------------------------------------------- 1 | def decidable_ball_le (n : ℕ) (P : Π k ≤ n, Prop) 2 | [H : ∀ n h, decidable (P n h)] : decidable (P 0 (nat.zero_le _)) := 3 | by apply_instance -------------------------------------------------------------------------------- /tests/lean/run/elab_bool.lean: -------------------------------------------------------------------------------- 1 | variable b : bool 2 | 3 | #check if b then tt else ff 4 | 5 | #check if b && b then tt else ff 6 | 7 | #check if b ∧ b then tt else ff 8 | -------------------------------------------------------------------------------- /tests/lean/run/imp2.lean: -------------------------------------------------------------------------------- 1 | #check (λ {A : Type} (a : A), a) (10:nat) 2 | set_option trace.app_builder true 3 | #check (λ {A} (a : A), a) 10 4 | #check (λ a, a) (10:nat) 5 | -------------------------------------------------------------------------------- /tests/lean/run/partial_explicit1.lean: -------------------------------------------------------------------------------- 1 | def eq_rect (A : Type) (x : A) (P : A → Type) (f : P x) (y : A) (e : x = y) : P y := 2 | @eq.rec_on _ _ (λ (y : A), P y) _ e f 3 | -------------------------------------------------------------------------------- /tests/lean/run/prod_notation.lean: -------------------------------------------------------------------------------- 1 | open prod 2 | 3 | definition tst1 : nat × Prop × nat × Prop := (1, true, 2, false) 4 | definition tst2 : nat × nat × nat := (1, 2, 3) 5 | -------------------------------------------------------------------------------- /tests/lean/run/protected.lean: -------------------------------------------------------------------------------- 1 | namespace foo 2 | protected definition C := true 3 | definition D := true 4 | end foo 5 | 6 | open foo 7 | #check foo.C 8 | #check D 9 | -------------------------------------------------------------------------------- /tests/lean/run/unicode.lean: -------------------------------------------------------------------------------- 1 | constant N : Type 2 | constant α : N 3 | constant β₁ : N 4 | #check β₁ 5 | constant δ : N 6 | #check δ 7 | constant δ₁₁ : N 8 | #check δ₁₁ 9 | -------------------------------------------------------------------------------- /tests/lean/sec_ns.lean: -------------------------------------------------------------------------------- 1 | section foo 2 | variables (x : ℕ) 3 | 4 | namespace bar 5 | 6 | def baz := x 7 | 8 | end bar 9 | 10 | end foo 11 | 12 | #print bar.baz -------------------------------------------------------------------------------- /tests/lean/t12.lean.expected.out: -------------------------------------------------------------------------------- 1 | λ (f g : N → N → N) (x y : N), f x (g x y) : (N → N → N) → (N → N → N) → N → N → N 2 | a : N 3 | t12.lean:7:8: error: command expected 4 | -------------------------------------------------------------------------------- /tests/lean/vmo1.lean: -------------------------------------------------------------------------------- 1 | meta def cheese : string := "edam" 2 | meta def fromage : string := "comte" 3 | #eval cheese 4 | attribute [vm_override fromage] cheese 5 | #eval cheese -------------------------------------------------------------------------------- /src/cmake/Modules/CleanOlean.cmake: -------------------------------------------------------------------------------- 1 | FILE(GLOB_RECURSE OLEAN_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.olean) 2 | 3 | IF(OLEAN_FILES) 4 | FILE(REMOVE ${OLEAN_FILES}) 5 | ENDIF() 6 | -------------------------------------------------------------------------------- /tests/lean/1870.lean: -------------------------------------------------------------------------------- 1 | structure T := (x y : nat) 2 | example : T := by refine { x := 1, y := _} 3 | example : T := by refine { x := 1, ..} 4 | example : T := { x := 1, ..} 5 | -------------------------------------------------------------------------------- /tests/lean/bad_open.lean.expected.out: -------------------------------------------------------------------------------- 1 | bad_open.lean:1:5: error: invalid 'open/export' command, identifier expected 2 | bad_open.lean:1:5: error: invalid namespace name '_' 3 | -------------------------------------------------------------------------------- /tests/lean/def3.lean: -------------------------------------------------------------------------------- 1 | universe variable u 2 | section 3 | variable (A : Type u) 4 | 5 | definition f : A → A := 6 | λ x, x 7 | 8 | #check f 9 | 10 | end 11 | -------------------------------------------------------------------------------- /tests/lean/eqn_compiler_error_msg.lean: -------------------------------------------------------------------------------- 1 | inductive R : ℕ → Prop 2 | | pos : ∀p n, R (p + n) 3 | 4 | lemma R_id : ∀n, R n → R n 5 | | (.(p) + .(n)) (R.pos p n) := R.pos p n 6 | -------------------------------------------------------------------------------- /tests/lean/eta_bug.lean: -------------------------------------------------------------------------------- 1 | -- 2 | #reduce λ (A : Type*) (x y : A) (H₁ : x = y) (H₂ : y = x), eq.trans H₁ H₂ 3 | -- Should not reduce to 4 | -- λ (A : Type*) (x y : A), eq.trans 5 | -------------------------------------------------------------------------------- /tests/lean/example_false.lean: -------------------------------------------------------------------------------- 1 | open expr tactic 2 | 3 | example : false := by do 4 | n ← mk_fresh_name, 5 | apply (local_const n n binder_info.default (const ``false [])) 6 | -------------------------------------------------------------------------------- /tests/lean/instance_cache_bug1.lean.expected.out: -------------------------------------------------------------------------------- 1 | instance_cache_bug1.lean:5:9: error: failed to synthesize type class instance for 2 | ⊢ has_add A 3 | a + a : A 4 | a + a : A 5 | -------------------------------------------------------------------------------- /tests/lean/meta_ind_univ.lean.expected.out: -------------------------------------------------------------------------------- 1 | meta_ind_univ.lean:2:0: error: universe level of type_of(arg #1) of 'foo.mk' is too big for the corresponding inductive datatype 2 | -------------------------------------------------------------------------------- /tests/lean/no_confusion_type.lean.expected.out: -------------------------------------------------------------------------------- 1 | vector.no_confusion_type : Sort u_1 → vector ?M_1 ?M_2 → vector ?M_1 ?M_2 → Sort u_1 2 | (2 = 2 → a1 = a2 → v1 == v2 → P) → P 3 | -------------------------------------------------------------------------------- /tests/lean/pp_all2.lean: -------------------------------------------------------------------------------- 1 | -- 2 | 3 | set_option pp.all true 4 | set_option pp.numerals true 5 | set_option pp.universes false 6 | 7 | #check (10 : nat) + (3 : nat) 8 | -------------------------------------------------------------------------------- /tests/lean/refine_error.lean: -------------------------------------------------------------------------------- 1 | constant p {α : Type} [has_zero α] : α → Prop 2 | constant pax {α : Type} [has_zero α] : p (0:α) 3 | 4 | lemma ex : p (0:nat) := 5 | @pax int _ 6 | -------------------------------------------------------------------------------- /tests/lean/run/1655.lean: -------------------------------------------------------------------------------- 1 | inductive test0 : Type → Type 2 | | intro : (λ t, t → test0 t) nat 3 | 4 | inductive test1 : Type → Type 5 | | intro : let t := nat in t → test1 t 6 | -------------------------------------------------------------------------------- /tests/lean/run/def5.lean: -------------------------------------------------------------------------------- 1 | 2 | section 3 | parameter (A : Type) 4 | 5 | definition f : A → A := 6 | λ x, x 7 | 8 | #check f 9 | end 10 | 11 | #check f 12 | -------------------------------------------------------------------------------- /tests/lean/run/ind_ns.lean: -------------------------------------------------------------------------------- 1 | inductive day 2 | | monday | tuesday | wednesday | thursday | friday | saturday | sunday 3 | 4 | #check day.monday 5 | open day 6 | #check monday 7 | -------------------------------------------------------------------------------- /tests/lean/run/record9.lean: -------------------------------------------------------------------------------- 1 | constant {u} fibrant : Type u → Prop 2 | 3 | structure {u} Fib : Type (u+1) := 4 | {type : Type u} (pred : fibrant type) 5 | 6 | #check Fib.mk 7 | -------------------------------------------------------------------------------- /tests/lean/1786.lean.expected.out: -------------------------------------------------------------------------------- 1 | 1786.lean:4:30: error: ambiguous overload, possible interpretations 2 | nil_subset 3 | list.nil_subset 4 | state: 5 | x : ℕ 6 | ⊢ x = x 7 | -------------------------------------------------------------------------------- /tests/lean/1817.lean.expected.out: -------------------------------------------------------------------------------- 1 | (-1).add 1 : ℤ 2 | -1 : ℤ 3 | 2 + -1 : ℤ 4 | 2 + -1 : ℤ 5 | f (-1) : ℤ 6 | 2 * -1 : ℤ 7 | 2 * -1 : ℤ 8 | f 1 < -2 : Prop 9 | - -2 : ℤ 10 | -------------------------------------------------------------------------------- /tests/lean/assumption_tac_notation.lean: -------------------------------------------------------------------------------- 1 | example (A : Type) (a : A) : A := ‹A› 2 | example (A : Type) (a : A) := ‹A› 3 | example (A : Type) : A := ‹A› 4 | example (A : Type) := ‹A› 5 | -------------------------------------------------------------------------------- /tests/lean/cases_unsupported_equality.lean: -------------------------------------------------------------------------------- 1 | inductive foo : ℕ → Type 2 | | a : foo 0 3 | | b : ∀ n, foo (n+1) 4 | 5 | example (n) (f : ℕ → ℕ) (h : foo (f n)) : true := 6 | by cases h -------------------------------------------------------------------------------- /tests/lean/change1.lean.expected.out: -------------------------------------------------------------------------------- 1 | a b : ℕ, 2 | Heq : a = b 3 | ⊢ a.succ.succ = (b + 1).succ 4 | ---- after change ---- 5 | a b : ℕ, 6 | Heq : a = b 7 | ⊢ a + 1 + 1 = b + 1 + 1 8 | -------------------------------------------------------------------------------- /tests/lean/interactive/85c.input: -------------------------------------------------------------------------------- 1 | {"seq_num":1,"command":"sync","file_name":"a.lean","content":".\n"} 2 | {"seq_num":2,"command":"info","file_name":"a.lean","line":2,"column":0} 3 | -------------------------------------------------------------------------------- /tests/lean/key_eqv1.lean: -------------------------------------------------------------------------------- 1 | add_key_equivalence has_add.add nat.add 2 | add_key_equivalence nat.add nat.succ 3 | add_key_equivalence has_mul.mul nat.mul 4 | #print key_equivalences 5 | -------------------------------------------------------------------------------- /tests/lean/notation6.lean: -------------------------------------------------------------------------------- 1 | -- 2 | notation `o` := (10:nat) 3 | #check 11 4 | constant f : nat → nat 5 | #check o + 1 6 | #check f o + o + o 7 | #reduce 9 + (1:nat) 8 | #reduce o+4 9 | -------------------------------------------------------------------------------- /tests/lean/run/1739.lean: -------------------------------------------------------------------------------- 1 | inductive type 2 | | bool : type 3 | | fn : list type → type → type 4 | 5 | def f : type → nat 6 | | (type.bool) := 0 7 | | (type.fn args rt) := 1 8 | -------------------------------------------------------------------------------- /tests/lean/run/do_notation_tmp_var_issue.lean: -------------------------------------------------------------------------------- 1 | meta def mk_local_pis : expr → tactic (list expr × expr) 2 | | p := do 3 | (ps, r) ← mk_local_pis p, 4 | return ((p :: ps), r) 5 | -------------------------------------------------------------------------------- /tests/lean/run/empty_match.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | 3 | definition not_lt_zero (a : nat) : ¬ a < 0 := 4 | assume H : a < 0, 5 | match H with 6 | end 7 | 8 | #check _root_.not_lt_zero 9 | -------------------------------------------------------------------------------- /tests/lean/run/yury_coe_sort_bug.lean: -------------------------------------------------------------------------------- 1 | universe u 2 | 3 | instance {α : Type u} : has_coe_to_sort (set α) (Type u) := ⟨λ s, {x // x ∈ s}⟩ 4 | 5 | example : ↥({0} : set ℕ) := ⟨0, rfl⟩ -------------------------------------------------------------------------------- /tests/lean/trace_kabstract.lean.expected.out: -------------------------------------------------------------------------------- 1 | [rewrite] before kabstract 2 | [kabstract] found target: 3 | f a 4 | [rewrite] before kabstract 5 | [kabstract] found target: 6 | f a 7 | -------------------------------------------------------------------------------- /tests/lean/ctx.lean: -------------------------------------------------------------------------------- 1 | open prod universe variables u 2 | definition foo {A B : Type u} (a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 : nat) (b1 b2 b3 : bool) (h : A = B) (p1 p2 : A × B) : nat := 3 | _ 4 | -------------------------------------------------------------------------------- /tests/lean/def1.lean: -------------------------------------------------------------------------------- 1 | universe variable u 2 | variable {A : Type u} 3 | 4 | lemma foo (f : A → A → A) (a b c : A) (H₁ : a = b) (H₂ : c = b) : f a = f c := 5 | H₂ ▸ eq.symm H₁ ▸ rfl 6 | -------------------------------------------------------------------------------- /tests/lean/def2.lean: -------------------------------------------------------------------------------- 1 | axiom val : nat 2 | 3 | definition foo : nat := 4 | val 5 | 6 | noncomputable definition foo2 : nat := 7 | val 8 | 9 | definition bla : nat := 10 | 2 11 | -------------------------------------------------------------------------------- /tests/lean/defeq_simp5.lean.expected.out: -------------------------------------------------------------------------------- 1 | @eq.{1} (nat → nat → nat) (λ (x y : nat), @has_add.add.{0} nat nat.has_add a b) 2 | (λ (x y : nat), @has_add.add.{0} nat nat.has_add a x) 3 | -------------------------------------------------------------------------------- /tests/lean/eqn_compiler_ctor.lean.expected.out: -------------------------------------------------------------------------------- 1 | eqn_compiler_ctor.lean:8:4: error: equation compiler failed (use 'set_option trace.eqn_compiler.elim_match true' for additional details) 2 | -------------------------------------------------------------------------------- /tests/lean/expr_quote.lean: -------------------------------------------------------------------------------- 1 | meta def f (α a : expr) := `(@id %%α %%a) 2 | 3 | meta def g (α a : expr) := `(@id (%%α : Type 2) %%a) 4 | 5 | set_option pp.universes true 6 | #print g 7 | -------------------------------------------------------------------------------- /tests/lean/import_invalid_tk.lean.expected.out: -------------------------------------------------------------------------------- 1 | import_invalid_tk.lean:1:21: error: invalid binary digit 2 | def buffer : Type u → Type u := 3 | λ (α : Type u), Σ (n : ℕ), array n α 4 | -------------------------------------------------------------------------------- /tests/lean/notation5.lean: -------------------------------------------------------------------------------- 1 | -- 2 | 3 | notation `((` := 1 4 | 5 | precedence `(` : 30 6 | 7 | notation `))` := 1 8 | 9 | notation `,,` := 1 10 | 11 | precedence `,` : 10 12 | -------------------------------------------------------------------------------- /tests/lean/protected.lean: -------------------------------------------------------------------------------- 1 | -- 2 | 3 | namespace foo 4 | protected definition C := true 5 | definition D := true 6 | end foo 7 | 8 | open foo 9 | #check C 10 | #check D 11 | -------------------------------------------------------------------------------- /tests/lean/qexpr3.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | example (a b c : nat) (H1 : a = b) (H2 : b = c) : a = c := 4 | by do 5 | refine ```(eq.trans H1 _), 6 | trace_state, 7 | assumption 8 | -------------------------------------------------------------------------------- /tests/lean/quot_abuse1.lean: -------------------------------------------------------------------------------- 1 | prelude 2 | 3 | init_quotient 4 | 5 | /- definit eq as the empty type -/ 6 | inductive {u} eq {α : Sort u} (a : α) : α → Sort 0 7 | 8 | init_quotient 9 | -------------------------------------------------------------------------------- /tests/lean/revert_err.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | example (a b : Prop) : true := 4 | by do to_expr ```(a ∧ b) >>= revert 5 | 6 | example {α : Type} {a : α} : true := 7 | by revert a a 8 | -------------------------------------------------------------------------------- /tests/lean/run/600c.lean: -------------------------------------------------------------------------------- 1 | /- /- -/ -/ 2 | /- - /--/-/ 3 | /-/-/--/-/-/ 4 | /- -/ 5 | /- -----------/ 6 | /- --/ 7 | /- ---/ 8 | /- 9 | -/ 10 | 11 | ----/ 12 | #print "ok" 13 | -------------------------------------------------------------------------------- /tests/lean/run/anonymous_param.lean: -------------------------------------------------------------------------------- 1 | #check λ _, nat 2 | #check λ (_ _ : nat), nat 3 | #check λ _ _ : nat, nat 4 | #check (λ _, 0 : nat → nat) 5 | 6 | def f (_ : nat) : nat := 7 | 0 8 | -------------------------------------------------------------------------------- /tests/lean/run/disable_instance.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | #eval mk_instance `(inhabited ℕ) 3 | local attribute [-instance] nat.inhabited 4 | #eval success_if_fail $ mk_instance `(inhabited ℕ) -------------------------------------------------------------------------------- /tests/lean/run/elab4.lean: -------------------------------------------------------------------------------- 1 | #check λ (A : Type) (a b c d : A) (H1 : a = b) (H2 : c = b) (H3 : d = c), 2 | calc a = b : H1 3 | ... = c : eq.symm H2 4 | ... = d : eq.symm H3 5 | -------------------------------------------------------------------------------- /tests/lean/run/eval_expr_bug.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | meta def a : nat := 10 4 | 5 | run_cmd eval_expr nat (expr.const `a []) 6 | run_cmd eval_expr nat (expr.const `a []) >>= trace 7 | -------------------------------------------------------------------------------- /tests/lean/run/is_true.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | 3 | example : as_true (2 = (2:nat)) := trivial 4 | example : as_false (3 = (2:nat)) := trivial 5 | example : as_true (2 < (3:nat)) := trivial 6 | -------------------------------------------------------------------------------- /tests/lean/run/level_bug2.lean: -------------------------------------------------------------------------------- 1 | definition f (a : Type) := Π r : Type, (a → r) → r 2 | 3 | definition blah2 {a : Type} {r : Type} (sa : f a) (k : a → r) : sa r k = sa r k := 4 | rfl 5 | -------------------------------------------------------------------------------- /tests/lean/run/mrw.lean: -------------------------------------------------------------------------------- 1 | example (n : nat) : ∃ x, x + n = n + 1 := 2 | begin 3 | constructor, 4 | fail_if_success {rw [nat.zero_add] {unify := ff}}, 5 | rw [nat.add_comm] 6 | end 7 | -------------------------------------------------------------------------------- /tests/lean/run/simp_arrow.lean: -------------------------------------------------------------------------------- 1 | example (p q : Prop) (h₀ : q) : ∀ (h : p ∧ true), q := 2 | begin 3 | simp, intros, 4 | trace_state, 5 | guard_hyp h : p, 6 | exact h₀ 7 | end 8 | -------------------------------------------------------------------------------- /tests/lean/run/simp_at_bug.lean: -------------------------------------------------------------------------------- 1 | def f (x : nat) := x 2 | 3 | example (a b : nat) (h₁ : a = b) (h₂ : a = 0) : b = f 0 := 4 | begin 5 | simp [h₁] at a h₂, 6 | simp [h₂, f] 7 | end 8 | -------------------------------------------------------------------------------- /tests/lean/run/vars_anywhere.lean: -------------------------------------------------------------------------------- 1 | variable {A : Type} 2 | 3 | #check @id 4 | 5 | inductive List 6 | | nil : List 7 | | cons : A → List → List 8 | 9 | #check @List.cons 10 | -------------------------------------------------------------------------------- /tests/lean/simp_trace.lean.expected.out: -------------------------------------------------------------------------------- 1 | 0. [simplify.rewrite] [eq_self_iff_true]: true = true ==> true 2 | 0. [simplify.rewrite] [eq_self_iff_true]: @eq.{1} Prop true true ==> true 3 | -------------------------------------------------------------------------------- /tests/lean/var.lean: -------------------------------------------------------------------------------- 1 | -- 2 | 3 | 4 | section 5 | variable A : Type 6 | parameter a : A 7 | end 8 | 9 | section 10 | variable A : Type 11 | variable a : A 12 | end 13 | -------------------------------------------------------------------------------- /tests/lean/584b.lean.expected.out: -------------------------------------------------------------------------------- 1 | tst₁ : Π (A : Type u_1), A → A 2 | tst₂ : Π {A : Type u_1}, A → A 3 | symm₂ : ∀ {A : Type u_1} (a b : A), a = b → b = a 4 | tst₃ : Π (A : Type u_1), A → A 5 | -------------------------------------------------------------------------------- /tests/lean/641.lean.expected.out: -------------------------------------------------------------------------------- 1 | 641.lean:1:21: error: invalid set_goals tactic, expressions must be meta-variables that have been declared in the current tactic_state 2 | state: 3 | ⊢ true 4 | -------------------------------------------------------------------------------- /tests/lean/format_thunk1.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | example : true := 4 | by do 5 | str ← to_expr ``(string), 6 | one ← to_expr ``(1), 7 | definev `H str one, 8 | constructor 9 | -------------------------------------------------------------------------------- /tests/lean/format_thunk1.lean.expected.out: -------------------------------------------------------------------------------- 1 | format_thunk1.lean:4:3: error: invalid definev tactic, value has type 2 | ℕ 3 | but is expected to have type 4 | string 5 | state: 6 | ⊢ true 7 | -------------------------------------------------------------------------------- /tests/lean/leanpkg/build_error.sh.expected.out: -------------------------------------------------------------------------------- 1 | configuring build_error 0.1 2 | > lean --make src 3 | err.lean:1:0: error: command expected 4 | external command exited with status 1 5 | 1 6 | -------------------------------------------------------------------------------- /tests/lean/leanpkg/new.sh.expected.out: -------------------------------------------------------------------------------- 1 | > cd new 2 | > git init -q 3 | configuring new 0.1 4 | . 5 | .. 6 | .git 7 | .gitignore 8 | leanpkg.path 9 | leanpkg.toml 10 | src 11 | 0 12 | -------------------------------------------------------------------------------- /tests/lean/match_convoy_infer_type_failure.lean: -------------------------------------------------------------------------------- 1 | constant p : nat → Type 2 | constant q : p 1 → Prop 3 | 4 | lemma ex : ∀ a : p 1, q a := 5 | match q, p with 6 | | q, p := sorry 7 | end 8 | -------------------------------------------------------------------------------- /tests/lean/noncomp.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | 3 | axiom n : nat 4 | 5 | definition f (x : nat) := -- Error this is not computable 6 | x + n 7 | 8 | noncomputable definition g (x : nat) := x + n 9 | -------------------------------------------------------------------------------- /tests/lean/record_rec_protected.lean: -------------------------------------------------------------------------------- 1 | -- 2 | 3 | structure point (A : Type) (B : Type) := 4 | mk :: (x : A) (y : B) 5 | 6 | open point 7 | 8 | #check rec -- error, rec is protected 9 | -------------------------------------------------------------------------------- /tests/lean/revert_frozen_dep.lean: -------------------------------------------------------------------------------- 1 | lemma ex {α : id Type} [has_add α] : true := 2 | begin 3 | dsimp at α -- should fail because the frozen instance `[has_add α]` depends on `α` 4 | end 5 | -------------------------------------------------------------------------------- /tests/lean/rewrite.lean.expected.out: -------------------------------------------------------------------------------- 1 | rewrite.lean:8:3: error: invalid rewrite tactic, failed to synthesize type class instance for 2 | is_one_class ?m_1 3 | state: 4 | n : ℕ 5 | ⊢ n = 1 6 | -------------------------------------------------------------------------------- /tests/lean/run/1171.lean: -------------------------------------------------------------------------------- 1 | inductive foo : nat → Type 2 | | f1 : foo 1 3 | | fn : Pi (n : nat), foo n 4 | 5 | def rig : Pi (n : nat), foo n → bool 6 | | 1 foo.f1 := tt 7 | | _ _ := ff 8 | -------------------------------------------------------------------------------- /tests/lean/run/1609.lean: -------------------------------------------------------------------------------- 1 | universe variable u 2 | 3 | inductive pred : ∀ (X : Type u), list X → Type (u+1) 4 | | foo X (l1 : list X) (l2 : list (option X)) : pred (option X) l2 → pred X l1 5 | -------------------------------------------------------------------------------- /tests/lean/run/1797.lean: -------------------------------------------------------------------------------- 1 | example (n : nat) : true := 2 | begin 3 | cases h : n with m, 4 | { guard_hyp h : n = nat.zero, admit }, 5 | { guard_hyp h : n = nat.succ m, admit} 6 | end 7 | -------------------------------------------------------------------------------- /tests/lean/run/const_choice.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | 3 | definition mypred (a : nat) : nat := 4 | nat.cases_on a 5 | 0 6 | (fun a₁, a₁) 7 | 8 | example : mypred 1 = 0 := 9 | rfl 10 | -------------------------------------------------------------------------------- /tests/lean/run/elab6.lean: -------------------------------------------------------------------------------- 1 | constants a b : nat 2 | constant p : nat → Prop 3 | constant H1 : p (a + a + a) 4 | constant H2 : a = b 5 | #check (eq.subst H2 H1 : p (a + b + a)) 6 | -------------------------------------------------------------------------------- /tests/lean/run/int_eq_num.lean: -------------------------------------------------------------------------------- 1 | def f : int → nat 2 | | -100 := 0 3 | | 0 := 1 4 | | 3 := 2 5 | | _ := 4 6 | 7 | #eval f (-100) 8 | #eval f 0 9 | #eval f 3 10 | #eval f 5 11 | -------------------------------------------------------------------------------- /tests/lean/run/no_field_access.lean: -------------------------------------------------------------------------------- 1 | namespace foo 2 | constant bar : ℕ → ℕ 3 | end foo 4 | 5 | noncomputable def foo : ℕ → ℕ 6 | | x := @foo.bar x -- should not use field notation with '@' 7 | -------------------------------------------------------------------------------- /tests/lean/run/suffices.lean: -------------------------------------------------------------------------------- 1 | variables {a b c : Prop} 2 | 3 | theorem foo (Ha : a) (Hab : a → b) (Hbc : b → c) : c := 4 | suffices b, from Hbc this, 5 | suffices a, from Hab this, 6 | Ha 7 | -------------------------------------------------------------------------------- /tests/lean/run/vm_check_bug.lean: -------------------------------------------------------------------------------- 1 | def f : nat → nat → nat 2 | | (x+1) (y+1) := f (x+100000000) y 3 | | (x+1) 0 := x 4 | | 0 (y+1) := 1 5 | | 0 0 := 1 6 | 7 | #eval f 1 1000 8 | -------------------------------------------------------------------------------- /tests/lean/sec_param_pp2.lean.expected.out: -------------------------------------------------------------------------------- 1 | id2 : (A → B → A) → A 2 | id2 : (A → B → A) → A 3 | id2 : ?M_1 → (A → ?M_1 → A) → A 4 | id2 : ?M_1 → Π {B : Type}, B → (?M_1 → B → ?M_1) → ?M_1 5 | -------------------------------------------------------------------------------- /src/library/tactic/backward/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(backward OBJECT init_module.cpp backward_lemmas.cpp backward_chaining.cpp) 2 | if(EMSCRIPTEN) 3 | add_dependencies(backward gmp) 4 | endif() -------------------------------------------------------------------------------- /tests/lean/implicit_after_auto_param_bug.lean.expected.out: -------------------------------------------------------------------------------- 1 | f ℕ has_lt.lt : Type 2 | id (f ℕ has_lt.lt) : Type 3 | mk 1 has_lt.lt : f ℕ has_lt.lt 4 | (mk 1 has_lt.lt).to_val : ℕ 5 | 1 6 | 1 7 | 1 8 | -------------------------------------------------------------------------------- /tests/lean/inductive_cmd_leftover_placeholder_universe.lean: -------------------------------------------------------------------------------- 1 | inductive ValueEffect (V : Type) (R : Type → Type) : Type 2 | | Value : V → ValueEffect 3 | | Effect : R (ValueEffect) → ValueEffect 4 | -------------------------------------------------------------------------------- /tests/lean/interactive/info1.lean: -------------------------------------------------------------------------------- 1 | def foo.f : nat → nat := λ x, x 2 | def bla.f : string → string := λ x, x 3 | open foo bla 4 | example : nat := f 0 5 | --^ "command": "info" 6 | -------------------------------------------------------------------------------- /tests/lean/lambda_lift_after_erase_trivial.lean: -------------------------------------------------------------------------------- 1 | structure box (α : Type) := 2 | (val : α) 3 | 4 | set_option trace.compiler.lambda_lifting true 5 | 6 | def f1 : box (ℕ → ℕ) := 7 | box.mk id 8 | -------------------------------------------------------------------------------- /tests/lean/nested_errors.lean.expected.out: -------------------------------------------------------------------------------- 1 | nested_errors.lean:7:13: error: intro tactic failed, Pi/let expression expected 2 | state: 3 | a b c : ℕ, 4 | ᾰ : a = b, 5 | ᾰ_1 : c = b 6 | ⊢ a = c 7 | -------------------------------------------------------------------------------- /tests/lean/restrict_bug.lean: -------------------------------------------------------------------------------- 1 | axiom all {A : Type}: list A → (A → Prop) → Prop 2 | variable {A : Type} 3 | variable {R : A → A → Prop} 4 | set_option pp.all true 5 | #check ∀ a l, all l (R a) 6 | -------------------------------------------------------------------------------- /tests/lean/run/1302.lean: -------------------------------------------------------------------------------- 1 | open list fin 2 | 3 | #eval map (λ i, true) [1] 4 | #eval map (λ i, true) [1, 2, 3] 5 | #eval map (λ (i : fin 2), true) [fin.mk 0 dec_trivial, fin.mk 1 dec_trivial] 6 | -------------------------------------------------------------------------------- /tests/lean/run/1649a.lean: -------------------------------------------------------------------------------- 1 | section 2 | def {u} typer (α : Type u) := α 3 | parameter n : ℕ 4 | 5 | meta def blah (n : typer ℕ) : ℕ := n 6 | 7 | #check blah 8 | end 9 | #check blah 10 | -------------------------------------------------------------------------------- /tests/lean/run/alg_info1.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | example : true := 4 | by do 5 | let op : expr := `((+) : nat → nat → nat), 6 | trace op, 7 | trace_algebra_info op, 8 | constructor 9 | -------------------------------------------------------------------------------- /tests/lean/run/bin_oct_hex.lean: -------------------------------------------------------------------------------- 1 | example : 0xf = 15 := 2 | rfl 3 | 4 | example : 3 = 0b11 := 5 | rfl 6 | 7 | example : 5 = 0b101 := 8 | rfl 9 | 10 | example : 8 = 0o10 := 11 | rfl 12 | -------------------------------------------------------------------------------- /tests/lean/run/consume.lean: -------------------------------------------------------------------------------- 1 | definition pr2 {A : Type} (a b : A) := a 2 | 3 | #check pr2 4 | #check pr2 5 | #check pr2 6 | #check @pr2 7 | #check @pr2 8 | #check @@pr2 9 | #check pr2 10 | -------------------------------------------------------------------------------- /tests/lean/sec.lean: -------------------------------------------------------------------------------- 1 | -- 2 | open prod 3 | 4 | section 5 | variable A : Type 6 | variable a : A 7 | variable A : Type 8 | variable b : A 9 | 10 | definition foo := a 11 | end 12 | -------------------------------------------------------------------------------- /src/cmake/check_failure.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Auxiliary script that succeeds iff if the execution of input 3 | # arguments fail. 4 | if $*; then 5 | echo "unexpected success" 6 | exit 1 7 | fi 8 | -------------------------------------------------------------------------------- /tests/lean/123-1.lean.expected.out: -------------------------------------------------------------------------------- 1 | 123-1.lean:31:18: error: don't know how to synthesize placeholder 2 | context: 3 | G : Type, 4 | _inst_1 : has_mul G, 5 | V : Type, 6 | g : G, 7 | v : V 8 | ⊢ Ring 9 | -------------------------------------------------------------------------------- /tests/lean/1258.lean: -------------------------------------------------------------------------------- 1 | constant P : list ℕ → list ℕ → Prop 2 | lemma foo (xs : list ℕ) : Π (ns : list ℕ), P xs ns 3 | | [] := sorry 4 | | (n::ns) := begin cases xs, exact sorry, exact sorry end 5 | -------------------------------------------------------------------------------- /tests/lean/1930.lean.expected.out: -------------------------------------------------------------------------------- 1 | 1930.lean:3:24: error: invalid field notation, type is not of the form (C ...) where C is a constant 2 | prod 3 | has type 4 | Type ? → Type ? → Type (max ? ?) 5 | -------------------------------------------------------------------------------- /tests/lean/errors2.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | 3 | namespace foo 4 | 5 | definition tst1 (a b : nat) : nat := 6 | match a with 7 | | 0 := 1 8 | | (n+1) := foo 9 | end 10 | 11 | 12 | end foo 13 | -------------------------------------------------------------------------------- /tests/lean/extra/755.expected.out: -------------------------------------------------------------------------------- 1 | LEAN_INFORMATION 2 | position 55:52 3 | A : Type, 4 | B : Type, 5 | f : one_step_tr A → B 6 | ⊢ Π (x y : A), 7 | f (tr x) = f (tr y) 8 | END_LEAN_INFORMATION 9 | -------------------------------------------------------------------------------- /tests/lean/extra/show_goal.6.14.expected.out: -------------------------------------------------------------------------------- 1 | LEAN_INFORMATION 2 | position 7:2 3 | a b c d : ℕ, 4 | h₁ : a + b = 0, 5 | h₂ : b = 0 6 | ⊢ c + 1 + a = 1 → d = c - 1 → d = 0 7 | END_LEAN_INFORMATION 8 | -------------------------------------------------------------------------------- /tests/lean/let_elim_issue.lean: -------------------------------------------------------------------------------- 1 | import system.io 2 | 3 | open io 4 | def tst : io unit := 5 | put_str "hello\n" 6 | >> put_str "world\n" 7 | >> put_str "from Lean\n" 8 | 9 | #eval tst 10 | -------------------------------------------------------------------------------- /tests/lean/meta_equation_pos.lean.expected.out: -------------------------------------------------------------------------------- 1 | meta_equation_pos.lean:2:0: error: equation type mismatch, term 2 | tt 3 | has type 4 | bool 5 | but is expected to have type 6 | ℕ 7 | ℕ : Type 8 | -------------------------------------------------------------------------------- /tests/lean/notation_pp_priority.lean.expected.out: -------------------------------------------------------------------------------- 1 | noncomputable def test_high_before_low : some_type := 2 | high_before_low 3 | noncomputable def test_high_after_low : some_type := 4 | high_after_low 5 | -------------------------------------------------------------------------------- /tests/lean/refine_error.lean.expected.out: -------------------------------------------------------------------------------- 1 | refine_error.lean:5:1: error: type mismatch, term 2 | pax 3 | has type 4 | @p ℤ int.has_zero 0 5 | but is expected to have type 6 | @p ℕ nat.has_zero 0 7 | -------------------------------------------------------------------------------- /tests/lean/reserve_bugs.lean.expected.out: -------------------------------------------------------------------------------- 1 | g (f 1) 2 : nat 2 | h 1 (h 2 (h 3 4)) : nat 3 | h (h (h 1 2) 3) 4 : nat 4 | h 1 (h 2 (h 3 4)) : nat 5 | h (h (h 1 2) 3) 4 : nat 6 | h 1 (h (g 2 3) 4) : nat 7 | -------------------------------------------------------------------------------- /tests/lean/run/774.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | example : ℕ → ℕ → Prop 3 | | 0 0 := true 4 | | (succ n) 0 := false 5 | | 0 (succ m) := false 6 | | (succ n) (succ m) := _example n m 7 | -------------------------------------------------------------------------------- /tests/lean/run/apply1.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | example (p q : Prop) : p → q → p ∧ q := 4 | by do 5 | intros, 6 | apply (expr.const `and.intro []), 7 | trace_state, 8 | all_goals assumption 9 | -------------------------------------------------------------------------------- /tests/lean/run/def_alias.lean: -------------------------------------------------------------------------------- 1 | 2 | attribute [reducible] 3 | definition N := nat 4 | 5 | definition f : N → nat 6 | | 0 := 1 7 | | (n+1) := n 8 | 9 | example : f 0 = 1 := 10 | rfl 11 | -------------------------------------------------------------------------------- /tests/lean/run/reflected.lean: -------------------------------------------------------------------------------- 1 | meta def eval_list (α : Type) [reflected _ α] (e : expr) : tactic (list α) := 2 | tactic.eval_expr (list α) e 3 | 4 | run_cmd eval_list ℕ ↑`([1, 2]) >>= tactic.trace 5 | -------------------------------------------------------------------------------- /tests/lean/run/subobject_from_source.lean: -------------------------------------------------------------------------------- 1 | structure foo := 2 | (a b : ℕ := 2) 3 | 4 | structure bar extends foo := 5 | (c : ℕ) 6 | 7 | example (b : bar) : b.to_foo = {c := 2, ..b}.to_foo := rfl 8 | -------------------------------------------------------------------------------- /tests/lean/sec3.lean.expected.out: -------------------------------------------------------------------------------- 1 | sec3.lean:5:9: error: invalid use of explicit universe parameter, identifier is a variable, parameter or a constant bound to parameters in a section 2 | tst : A → A 3 | -------------------------------------------------------------------------------- /tests/lean/widget/widget4.input: -------------------------------------------------------------------------------- 1 | {"seq_num": 0, "command": "sync", "file_name": "widget4.lean"} 2 | {"seq_num": 1, "command": "get_widget", "file_name": "widget4.lean", "column":0,"id":3,"line":3} 3 | -------------------------------------------------------------------------------- /tests/lean/1760.lean.expected.out: -------------------------------------------------------------------------------- 1 | 1760.lean:6:18: error: type mismatch at application 2 | f x 3 | term 4 | x 5 | has type 6 | big_type : Type 1 7 | but is expected to have type 8 | ?m_1 : Type 9 | -------------------------------------------------------------------------------- /tests/lean/dep_cases_clear_hyp.lean.expected.out: -------------------------------------------------------------------------------- 1 | α : Type u, 2 | l r : tree α, 3 | lo v hi : α, 4 | lt : α → α → Prop, 5 | h_hs₁ : is_searchable lt l lo v, 6 | h_hs₂ : is_searchable lt r v hi 7 | ⊢ true 8 | -------------------------------------------------------------------------------- /tests/lean/extra/dir_option.lean: -------------------------------------------------------------------------------- 1 | -- Test for --dir option, to be able to execute this file, we must provide --dir= in the command line 2 | import .div 3 | open nat 4 | 5 | check nat.div 6 | -------------------------------------------------------------------------------- /tests/lean/interactive/hole3.lean: -------------------------------------------------------------------------------- 1 | def x : nat → nat := 2 | λ a, {! 3 | 4 | 0 = a 5 | --^ "command": "hole", "action": "Infer" 6 | 7 | !} 8 | --^ "command": "hole", "action": "Infer" 9 | -------------------------------------------------------------------------------- /tests/lean/interactive/lib/open_locale.lean: -------------------------------------------------------------------------------- 1 | open lean lean.parser interactive tactic native 2 | 3 | @[user_command] meta def open_locale_cmd (_ : parse $ tk "open_locale") : parser unit := 4 | pure () 5 | -------------------------------------------------------------------------------- /tests/lean/io_bug2.lean: -------------------------------------------------------------------------------- 1 | import system.io 2 | open io 3 | 4 | def main : io unit := do 5 | print_ln "t1", 6 | (x, y) ← return ((1 : nat), (2 : ℕ)), 7 | print_ln "t2" 8 | 9 | #eval main 10 | -------------------------------------------------------------------------------- /tests/lean/irreducible_instance.lean: -------------------------------------------------------------------------------- 1 | @[irreducible] instance : has_zero string := ⟨""⟩ 2 | 3 | class foo (s : string) : Prop 4 | instance string.foo : foo 0 := ⟨⟩ 5 | 6 | #eval tactic.mk_instance `(foo "") -------------------------------------------------------------------------------- /tests/lean/local_notation_bug2.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | section 3 | parameters (b : ℕ) 4 | definition add_b (n : ℕ) := n + b 5 | local postfix `%%`:max := add_b 6 | end 7 | #reduce 5%% -- Error, unexpected token 8 | -------------------------------------------------------------------------------- /tests/lean/run/1093.lean: -------------------------------------------------------------------------------- 1 | open tactic nat 2 | 3 | constant zadd (a : nat) : 0 + a = a 4 | constant le.refl (a : nat) : a ≤ a 5 | attribute [simp] zadd 6 | 7 | example (a : nat) : 0 + a ≤ a := 8 | by simp 9 | -------------------------------------------------------------------------------- /tests/lean/run/1318.lean: -------------------------------------------------------------------------------- 1 | def tester : Π (n : ℕ) (e : fin n), true -- fails : "infer type failed, unknown variable m" 2 | | 0 e := trivial 3 | | (m+1) ⟨0, lt⟩ := trivial 4 | | (m+1) ⟨k+1, lt⟩ := trivial 5 | -------------------------------------------------------------------------------- /tests/lean/run/1623.lean: -------------------------------------------------------------------------------- 1 | section 2 | parameters {A : Type} (R : list A → Prop) 3 | structure foo (x : list A) : Prop := (bar : R x) 4 | structure bar (x : Type) 5 | structure baz extends bar A 6 | end 7 | -------------------------------------------------------------------------------- /tests/lean/run/hole1.lean: -------------------------------------------------------------------------------- 1 | example : ∀ a b : nat, a + b = b + a := 2 | λ a b, {! _+_ !} 3 | 4 | example : ∀ a b : nat, a + b = b + a := 5 | begin 6 | intros h, 7 | exact λ x, {! _+_, "lt" !} 8 | end 9 | -------------------------------------------------------------------------------- /tests/lean/run/import_open_locale1.lean: -------------------------------------------------------------------------------- 1 | open lean lean.parser interactive tactic 2 | 3 | @[user_command] 4 | meta def open_locale_cmd (_ : parse $ tk "open_locale") : parser unit := 5 | ident *> pure () 6 | -------------------------------------------------------------------------------- /tests/lean/run/record7.lean: -------------------------------------------------------------------------------- 1 | structure point (A : Type) (B : Type) := 2 | mk :: (x : A) (y : B) 3 | 4 | structure point2 (A : Type) (B : Type) extends point A B := 5 | make 6 | 7 | #print prefix point2 8 | -------------------------------------------------------------------------------- /tests/lean/string_imp.lean.expected.out: -------------------------------------------------------------------------------- 1 | 6 2 | "ab" 3 | "" 4 | "abc" 5 | "cd" 6 | "ab" 7 | "" 8 | "abcd" 9 | "foo" 10 | ".lean" 11 | "αβ" 12 | 2 13 | "α_foo_βcc" 14 | "αβ_foo_cc" 15 | "α_foo_βcc" 16 | -------------------------------------------------------------------------------- /tests/lean/tuple.lean: -------------------------------------------------------------------------------- 1 | open nat prod 2 | 3 | set_option pp.universes true 4 | 5 | definition {u} tuple (A : Type (u+1)) (n : nat) : Type (u+1) := 6 | nat.rec_on n A (λ n r, r × A) 7 | 8 | #check @tuple 9 | -------------------------------------------------------------------------------- /tests/lean/whnf.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | 3 | #reduce [whnf] (fun x, x + 1) (2:nat) 4 | #reduce (fun x, x + 1) (2:nat) 5 | 6 | variable a : nat 7 | #reduce [whnf] a + succ nat.zero 8 | #reduce a + succ nat.zero 9 | -------------------------------------------------------------------------------- /script/ubuntu-aarch64-toolchain.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR aarch64) 3 | 4 | set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++) 5 | set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc) 6 | -------------------------------------------------------------------------------- /tests/lean/1513.lean: -------------------------------------------------------------------------------- 1 | example (n : ℕ) (h : n = 0) : n = 0 := 2 | by rename n m 3 | 4 | example (n : ℕ) : let x := 10 in n > 0 → x > 5 → n ≠ x → x + 1 = 1 + x := 5 | begin 6 | intros, 7 | rename x y 8 | end 9 | -------------------------------------------------------------------------------- /tests/lean/1766.lean.expected.out: -------------------------------------------------------------------------------- 1 | 1766.lean:8:4: error: destruct tactic failed, recursor 'is_some.cases_on' can only eliminate into Prop 2 | state: 3 | x : option ℕ, 4 | H : is_some x, 5 | a : x = none 6 | ⊢ ℕ 7 | -------------------------------------------------------------------------------- /tests/lean/bad_index.lean: -------------------------------------------------------------------------------- 1 | inductive foo1 : Type -> Type 2 | | mk : foo1 (list (foo1 punit)) -> foo1 (list (foo1 punit)) 3 | 4 | inductive foo2 : Type -> Type 5 | | mk : foo2 (foo2 punit) -> foo2 (foo2 punit) 6 | -------------------------------------------------------------------------------- /tests/lean/bad_quoted_symbol.lean: -------------------------------------------------------------------------------- 1 | notation (name := or2) a ` \/ ` b := a ∨ b 2 | notation a `1\/` b := a ∨ b 3 | notation a ` 1\/` b := a ∨ b 4 | notation a ` \ / ` b := a ∨ b 5 | notation a ` ` b := a ∨ b 6 | -------------------------------------------------------------------------------- /tests/lean/dsimp_whnf_post.lean: -------------------------------------------------------------------------------- 1 | structure Foo := (foo : unit) 2 | 3 | def my_foo : Foo := Foo.mk () 4 | @[simp] lemma my_foo.def : my_foo = Foo.mk () := rfl 5 | 6 | example : Foo.foo my_foo = () := by dsimp 7 | -------------------------------------------------------------------------------- /tests/lean/extra/eqn_macro1.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | 3 | notation `foo` a := 4 | match a with 5 | (c, d) := c + (d:nat) 6 | end 7 | 8 | eval foo (2, 3) 9 | 10 | notation `bla` a `with` H := a ↓ H 11 | -------------------------------------------------------------------------------- /tests/lean/interactive/info1.lean.expected.out: -------------------------------------------------------------------------------- 1 | {"message":"file invalidated","response":"ok","seq_num":0} 2 | {"record":{"full-id":"foo.f","source":,"state":"⊢ ℕ","type":"ℕ → ℕ"},"response":"ok","seq_num":5} 3 | -------------------------------------------------------------------------------- /tests/lean/no_meta_rec_inst.lean.expected.out: -------------------------------------------------------------------------------- 1 | no_meta_rec_inst.lean:5:3: error: tactic.mk_instance failed to generate instance for 2 | has_false ℕ 3 | state: 4 | n_has_false : has_false ℕ 5 | ⊢ has_false ℕ 6 | -------------------------------------------------------------------------------- /tests/lean/pp_all.lean: -------------------------------------------------------------------------------- 1 | -- 2 | open nat 3 | 4 | variables {a : nat} 5 | 6 | definition b : nat := 2 7 | 8 | #check (λ x, x) a + b = 10 9 | set_option pp.all true 10 | #check (λ x, x) a + b = 10 11 | -------------------------------------------------------------------------------- /tests/lean/run/1525.lean: -------------------------------------------------------------------------------- 1 | section t 2 | 3 | parameter t : Type 4 | 5 | inductive eqt : t -> t -> Prop 6 | | refl : forall x : t, eqt x x 7 | 8 | #check eqt 9 | 10 | end t 11 | 12 | #check eqt 13 | -------------------------------------------------------------------------------- /tests/lean/run/372c.lean: -------------------------------------------------------------------------------- 1 | def foo (n : ℕ) := Type 2 | def beta (n : ℕ) : foo n := 3 | by unfold foo; exact ℕ → ℕ 4 | noncomputable lemma baz (n : ℕ) : beta n := id 5 | example : ℕ := by apply baz <|> exact 0 6 | -------------------------------------------------------------------------------- /tests/lean/run/begin_end1.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | example (p q : Prop) : p → q → q ∧ p := 4 | begin 5 | intros, 6 | constructor, 7 | trace_state, 8 | assumption, 9 | assumption 10 | end 11 | -------------------------------------------------------------------------------- /tests/lean/run/generalize_inst.lean: -------------------------------------------------------------------------------- 1 | example : ∃(b : nat), b = 1 ∧ 0 ≤ b := 2 | begin 3 | apply exists.intro, 4 | apply and.intro, 5 | apply rfl, 6 | generalize : 1 = z, 7 | apply nat.zero_le 8 | end 9 | -------------------------------------------------------------------------------- /tests/lean/run/induction_with_drec.lean: -------------------------------------------------------------------------------- 1 | universe u 2 | 3 | example {α β : Type u} (a : α) (b : β) (h : α = β) : (eq.rec_on h a : β) = b → a = eq.rec_on (h^.symm) b := 4 | by induction h; intros; assumption 5 | -------------------------------------------------------------------------------- /tests/lean/run/parent_struct_inst.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | 3 | class A := (n : ℕ) 4 | 5 | definition f [A] := A.n 6 | 7 | structure B extends A := 8 | (Hf : f = 0) 9 | 10 | example : B := ⟨⟨0⟩, rfl⟩ 11 | -------------------------------------------------------------------------------- /tests/lean/run/quote_patterns.lean: -------------------------------------------------------------------------------- 1 | meta def f : expr → option (expr × expr × expr) 2 | | `(%%x = %%c*%%y) := some (x, c, y) 3 | | _ := none 4 | 5 | meta def g : expr → nat 6 | | `(%%x = 0) := 2 7 | | _ := 0 8 | -------------------------------------------------------------------------------- /src/util/sexpr/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(sexpr OBJECT sexpr.cpp sexpr_fn.cpp format.cpp options.cpp 2 | option_declarations.cpp init_module.cpp) 3 | if(EMSCRIPTEN) 4 | add_dependencies(sexpr gmp) 5 | endif() 6 | -------------------------------------------------------------------------------- /tests/lean/652.lean.expected.out: -------------------------------------------------------------------------------- 1 | R : Π {b c : bool}, Prop 2 | R2 : bool → bool → Prop 3 | R3 : bool → bool → Prop 4 | R4 : bool → Π {c : bool}, Prop 5 | R5 : Π {b c : bool}, Prop 6 | R6 : Π {b : bool}, bool → Prop 7 | -------------------------------------------------------------------------------- /tests/lean/extract.lean.expected.out: -------------------------------------------------------------------------------- 1 | "abc" 2 | (some "a") 3 | (some "") 4 | none 5 | (some "abc") 6 | (some "bcde") 7 | (some "abcde") 8 | (some "ab") 9 | none 10 | none 11 | (some "a") 12 | (some "a") 13 | -------------------------------------------------------------------------------- /tests/lean/ff_byte.lean.expected.out: -------------------------------------------------------------------------------- 1 | ff_byte.lean:1:0: error: unexpected token 2 | ff_byte.lean:5:19: error: type mismatch, term 3 | trivial 4 | has type 5 | true 6 | but is expected to have type 7 | false 8 | -------------------------------------------------------------------------------- /tests/lean/field_proj_pos.lean.expected.out: -------------------------------------------------------------------------------- 1 | field_proj_pos.lean:2:18: error: don't know how to synthesize placeholder 2 | context: 3 | h : true ∨ true 4 | ⊢ true → true 5 | state: 6 | h : true ∨ true 7 | ⊢ true 8 | -------------------------------------------------------------------------------- /tests/lean/instance_cache_bug1.lean: -------------------------------------------------------------------------------- 1 | constant A : Type 2 | constant a : A 3 | constant A_has_add : has_add A 4 | 5 | #check a + a -- ERROR 6 | 7 | attribute [instance] A_has_add 8 | 9 | #check a + a 10 | -------------------------------------------------------------------------------- /tests/lean/list_monad1.lean: -------------------------------------------------------------------------------- 1 | #eval 2 | (do { 3 | a : nat ← [1, 2, 3, 4], 4 | b : nat ← [4, 5, 6], 5 | (guard $ 2 * a ≥ b : list unit), 6 | (guard $ b < 6 : list unit), 7 | return (a, b) } : list (nat × nat) ) 8 | -------------------------------------------------------------------------------- /tests/lean/pp_binder_types.lean.expected.out: -------------------------------------------------------------------------------- 1 | def f : Π (n : ℕ), n = n → ℕ → ℕ := 2 | λ (n : ℕ) (H : n = n) (m : ℕ), id (n + m) 3 | def f : Π (n : ℕ), n = n → ℕ → ℕ := 4 | λ (n : ℕ) (H : n = n) (m : ℕ), id (n + m) 5 | -------------------------------------------------------------------------------- /tests/lean/run/1258.lean: -------------------------------------------------------------------------------- 1 | constant P : list ℕ → list ℕ → Prop 2 | lemma foo (xs : list ℕ) : Π (ns : list ℕ), P xs ns 3 | | [] := sorry 4 | | (n::ns) := begin clear foo, cases xs, exact sorry, exact sorry end 5 | -------------------------------------------------------------------------------- /tests/lean/run/1414.lean: -------------------------------------------------------------------------------- 1 | def Union {α : Prop} {β : Type} (s : α → set β) (x : β) : Prop := 2 | ∃ i, x ∈ s i 3 | 4 | example (y : ℕ) (t : set ℕ) : Union (λH : (∃x, x ∈ t), t) y → true 5 | | ⟨⟨z, z_ex⟩, y_in⟩ := ⟨⟩ 6 | -------------------------------------------------------------------------------- /tests/lean/run/967.lean: -------------------------------------------------------------------------------- 1 | variables (A : Type) 2 | 3 | definition f (A : Type) (a : A) := a 4 | 5 | inductive bla (A : Type) 6 | | mk : A → bla 7 | 8 | structure foo (A : Type) (f : A → A) := 9 | (a : A) 10 | -------------------------------------------------------------------------------- /tests/lean/run/async_map.lean: -------------------------------------------------------------------------------- 1 | meta def list.async_map {α β} (f : α → β) (xs : list α) : list β := 2 | (xs.map (λ x, task.delay $ λ _, f x)).map task.get 3 | 4 | #eval ((list.range 1000000).async_map (+1)).foldl (+) 0 -------------------------------------------------------------------------------- /tests/lean/run/eq25.lean: -------------------------------------------------------------------------------- 1 | inductive N 2 | | O : N 3 | | S : N → N 4 | 5 | definition Nat := N 6 | 7 | open N 8 | 9 | definition add1 : Nat → Nat → Nat 10 | | O b := b 11 | | (S a) b := S (add1 a b) 12 | -------------------------------------------------------------------------------- /tests/lean/run/export.lean: -------------------------------------------------------------------------------- 1 | constants a b : nat 2 | 3 | namespace boo 4 | export nat (rec add) 5 | #check a + b 6 | #check nat.add 7 | end boo 8 | 9 | open boo 10 | #check a + b 11 | #check nat.rec 12 | -------------------------------------------------------------------------------- /tests/lean/run/ind1.lean: -------------------------------------------------------------------------------- 1 | inductive List (A : Sort*) : Sort* 2 | | nil : List 3 | | cons : A → List → List 4 | namespace List end List open List 5 | #check List.{1} 6 | #check cons.{1} 7 | #check List.rec.{1 1} 8 | -------------------------------------------------------------------------------- /tests/lean/run/induction_generalizing_bug.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | 3 | example (n : nat) (h : n > 0) : succ n > 0 ∧ n = n := 4 | begin 5 | split, 6 | induction n generalizing h, 7 | all_goals { admit }, 8 | end 9 | -------------------------------------------------------------------------------- /tests/lean/run/let1.lean: -------------------------------------------------------------------------------- 1 | #check 2 | let f x y := x ∧ y, 3 | g x := f x x, 4 | a := g true 5 | in λ (x : a), 6 | let h x y := f x (g y), 7 | b := h 8 | in b 9 | -------------------------------------------------------------------------------- /tests/lean/slow_error.lean.expected.out: -------------------------------------------------------------------------------- 1 | slow_error.lean:4:9: error: type mismatch at application 2 | a = b 3 | term 4 | b 5 | has type 6 | string 7 | but is expected to have type 8 | (user_attribute string) 9 | -------------------------------------------------------------------------------- /tests/lean/trace_kabstract.lean: -------------------------------------------------------------------------------- 1 | set_option trace.rewrite true 2 | set_option trace.kabstract true 3 | 4 | example (f : nat → nat) (a b : nat) (h : f a = a) : f (f a) = a := 5 | begin 6 | rw h, 7 | rw h 8 | end 9 | -------------------------------------------------------------------------------- /tests/lean/type_error_at_eval_expr.lean.expected.out: -------------------------------------------------------------------------------- 1 | type_error_at_eval_expr.lean:3:0: error: type error at eval_expr, argument has type 2 | list ℕ 3 | but is expected to have type 4 | ℕ 5 | state: 6 | ⊢ true 7 | -------------------------------------------------------------------------------- /.codecov.yml: -------------------------------------------------------------------------------- 1 | comment: off 2 | 3 | coverage: 4 | status: 5 | project: 6 | default: 7 | threshold: 10% 8 | patch: 9 | default: 10 | target: 0% 11 | threshold: 10% 12 | -------------------------------------------------------------------------------- /src/library/predict/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the [predictor library](https://github.com/lukaszcz/coqhammer/tree/coq8.10/src/predict) of the [CoqHammer](http://cl-informatik.uibk.ac.at/cek/coqhammer/) project. 2 | -------------------------------------------------------------------------------- /tests/lean/1279.lean.expected.out: -------------------------------------------------------------------------------- 1 | 1279.lean:12:33: error: type mismatch at application 2 | source.compose g f 3 | term 4 | f 5 | has type 6 | source.Hom A B 7 | but is expected to have type 8 | source.Hom C ?m_1 9 | -------------------------------------------------------------------------------- /tests/lean/1723.lean: -------------------------------------------------------------------------------- 1 | #reduce int.shiftl (-1) (-1) 2 | #eval int.shiftl (-1) (-1) 3 | 4 | #reduce int.shiftl (-4) (-2) 5 | #eval int.shiftl (-4) (-2) 6 | 7 | #reduce int.shiftl (-5) (-2) 8 | #eval int.shiftl (-5) (-2) 9 | -------------------------------------------------------------------------------- /tests/lean/crash.lean: -------------------------------------------------------------------------------- 1 | -- 2 | 3 | section 4 | parameter P : Prop. 5 | 6 | definition crash 7 | := assume H : P, 8 | have H' : ¬ P, 9 | from H, 10 | _. 11 | end 12 | -------------------------------------------------------------------------------- /tests/lean/meta_wf_error.lean.expected.out: -------------------------------------------------------------------------------- 1 | meta_wf_error.lean:1:9: error: invalid use of 'using_well_founded', we do not need to use well founded recursion for meta definitions, since they can use unbounded recursion 2 | -------------------------------------------------------------------------------- /tests/lean/no_coe.lean.expected.out: -------------------------------------------------------------------------------- 1 | ite ↥tt 1 0 : ℕ 2 | no_coe.lean:5:7: error: type mismatch at application 3 | ite tt 4 | term 5 | tt 6 | has type 7 | bool 8 | but is expected to have type 9 | Prop 10 | -------------------------------------------------------------------------------- /tests/lean/quot_abuse2.lean: -------------------------------------------------------------------------------- 1 | prelude 2 | 3 | init_quotient 4 | 5 | /- definit eq as the empty type -/ 6 | inductive {u} eq {α : Sort u} (a : α) : α → Sort 0 7 | | refl : ∀ (b : α), eq b 8 | 9 | init_quotient 10 | -------------------------------------------------------------------------------- /tests/lean/run/1951.lean: -------------------------------------------------------------------------------- 1 | instance my_pow : has_pow ℕ ℕ := 2 | ⟨λ x n, nat.rec_on n 1 (λ _ ih, ih * x)⟩ 3 | 4 | #eval 2 ^ (3 ^ 2) 5 | #eval 2 ^ 3 ^ 2 6 | 7 | example (a b c : nat) : a ^ (b ^ c) = a ^ b ^ c := 8 | rfl 9 | -------------------------------------------------------------------------------- /tests/lean/run/eq_mpr_def_issue.lean: -------------------------------------------------------------------------------- 1 | open function 2 | 3 | instance decidable_uncurry_pred{α} (p : α → α → Prop) [decidable_rel p] : decidable_pred (uncurry p) := 4 | λ a, by { cases a; simp [uncurry]; apply_instance } 5 | -------------------------------------------------------------------------------- /tests/lean/run/namespace_local.lean: -------------------------------------------------------------------------------- 1 | namespace foo 2 | variable A : Type 3 | end foo 4 | 5 | namespace bla 6 | variable A : Type 7 | end bla 8 | 9 | namespace foo 10 | variable A : Type 11 | end foo 12 | -------------------------------------------------------------------------------- /tests/lean/run/noequations.lean: -------------------------------------------------------------------------------- 1 | example : empty → false. 2 | 3 | def f := empty → false 4 | example : f. 5 | 6 | def g := ∀ (a : nat) (h : a = a), @eq.rec nat a (λ x, Prop) (empty → false) a h 7 | 8 | example : g. 9 | -------------------------------------------------------------------------------- /tests/lean/run/simp_auto_param.lean: -------------------------------------------------------------------------------- 1 | constant f : nat → nat 2 | axiom fax (x : nat) (h : x > 0 . tactic.assumption) : f x = x 3 | 4 | example (a : nat) (h : a > 0) : f (f a) = a := 5 | begin 6 | simp [fax] 7 | end 8 | -------------------------------------------------------------------------------- /tests/lean/run/smt_facts_as_hinst_lemmas.lean: -------------------------------------------------------------------------------- 1 | lemma aux : nat.succ 0 = 1 := 2 | rfl 3 | 4 | attribute [ematch] aux 5 | 6 | lemma ex (a : nat) : a = 1 → nat.succ 0 = a := 7 | begin [smt] 8 | close 9 | end 10 | -------------------------------------------------------------------------------- /tests/lean/run/subst_heq.lean: -------------------------------------------------------------------------------- 1 | example (a b : nat) (h : a == b) : a + 1 = b + 1 := 2 | begin 3 | subst h 4 | end 5 | 6 | example (a b : nat) (h : a == b) : a + 1 = b + 1 := 7 | begin 8 | subst_vars 9 | end 10 | -------------------------------------------------------------------------------- /tests/lean/run/tuple_head_issue.lean: -------------------------------------------------------------------------------- 1 | import data.vector open nat 2 | universe variables u 3 | variable {α : Type u} 4 | 5 | def head (n) : vector α (succ n) → α 6 | | ⟨[], H⟩ := by contradiction 7 | | ⟨a::b, H⟩ := a 8 | -------------------------------------------------------------------------------- /tests/lean/run/uni_issue1.lean: -------------------------------------------------------------------------------- 1 | namespace experiment 2 | inductive nat : Type 3 | | zero : nat 4 | | succ : nat → nat 5 | 6 | definition is_zero (n : nat) : Prop 7 | := nat.rec true (λ n r, false) n 8 | end experiment 9 | -------------------------------------------------------------------------------- /tests/lean/set_of.lean.expected.out: -------------------------------------------------------------------------------- 1 | {x : ℕ | x > 0} : set ℕ 2 | {x : ℕ | x > 0} : set ℕ 3 | {p : ℕ × ℕ | p.fst > p.snd} : set (ℕ × ℕ) 4 | {x | x > 0} : set ℕ 5 | {x | x > 0} : set ℕ 6 | {p | p.fst > p.snd} : set (ℕ × ℕ) 7 | -------------------------------------------------------------------------------- /tests/lean/1669.lean.expected.out: -------------------------------------------------------------------------------- 1 | 1669.lean:3:20: error: failed to synthesize type class instance for 2 | ⊢ has_singleton ?m_1 (expr → list expr → tactic unit) 3 | 1669.lean:1:4: error: failed to create auxiliary definition 4 | -------------------------------------------------------------------------------- /tests/lean/bad_error3.lean.expected.out: -------------------------------------------------------------------------------- 1 | bad_error3.lean:1:33: error: type expected at 2 | p 0 3 | term has type 4 | ℕ → Prop 5 | bad_error3.lean:5:32: error: type expected at 6 | p 0 7 | term has type 8 | ℕ → Prop 9 | -------------------------------------------------------------------------------- /tests/lean/check.lean.expected.out: -------------------------------------------------------------------------------- 1 | and.intro : ?M_1 → ?M_2 → ?M_1 ∧ ?M_2 2 | or.elim : ?M_1 ∨ ?M_2 → (?M_1 → ?M_3) → (?M_2 → ?M_3) → ?M_3 3 | eq : ?M_1 → ?M_1 → Prop 4 | eq.rec : ?M_3 ?M_2 → Π {ᾰ : ?M_1}, ?M_2 = ᾰ → ?M_3 ᾰ 5 | -------------------------------------------------------------------------------- /tests/lean/elab_meta2.lean.expected.out: -------------------------------------------------------------------------------- 1 | parametric meta definition 2 | "OK" 3 | parametric meta definition inside namespace 4 | "OK" 5 | meta definition inside parametric scope 6 | "OK" 7 | private meta definition 8 | "OK" 9 | -------------------------------------------------------------------------------- /tests/lean/empty.lean: -------------------------------------------------------------------------------- 1 | -- 2 | open inhabited nonempty classical 3 | 4 | noncomputable lemma v1 : Prop := epsilon (λ x : Prop, true) 5 | inductive Empty : Type 6 | noncomputable definition v2 : Empty := epsilon (λ x, true) 7 | -------------------------------------------------------------------------------- /tests/lean/eqn_compiler_ctor.lean: -------------------------------------------------------------------------------- 1 | inductive term 2 | | var : ℕ → term 3 | | app : term → term → term 4 | | abs : term → term 5 | 6 | open term 7 | 8 | def subst : ∀ σ : ℕ → term, term → term 9 | | var := sorry 10 | -------------------------------------------------------------------------------- /tests/lean/let3.lean: -------------------------------------------------------------------------------- 1 | -- 2 | 3 | constant f : nat → nat → nat → nat 4 | 5 | #check 6 | let a : nat := 10 7 | in f a 10 8 | 9 | /- 10 | #check 11 | let a := 10, 12 | b := 10 13 | in f a b 10 14 | -/ 15 | -------------------------------------------------------------------------------- /tests/lean/run/abstract_ns1.lean: -------------------------------------------------------------------------------- 1 | -- Companion file for the abstract_ns test. 2 | 3 | namespace ns1 4 | 5 | def foo : fin 7 := ⟨3, dec_trivial⟩ 6 | def foo' : fin 7 := ⟨3, by abstract {exact dec_trivial}⟩ 7 | 8 | end ns1 9 | -------------------------------------------------------------------------------- /tests/lean/run/abstract_ns2.lean: -------------------------------------------------------------------------------- 1 | -- Companion file for the abstract_ns test. 2 | 3 | namespace ns2 4 | 5 | def foo : fin 7 := ⟨3, dec_trivial⟩ 6 | def foo' : fin 7 := ⟨3, by abstract {exact dec_trivial}⟩ 7 | 8 | end ns2 9 | -------------------------------------------------------------------------------- /tests/lean/run/apply2.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | example (p q : Prop) : p → q → p ∧ q ∧ p := 4 | by do 5 | intros, 6 | c₁ ← return (expr.const `and.intro []), 7 | iterate_at_most 10 (apply c₁ >> skip <|> assumption) 8 | -------------------------------------------------------------------------------- /tests/lean/run/eqn_compiler_variable_or_inaccessible.lean: -------------------------------------------------------------------------------- 1 | example {α : Type} {p q : α → Prop} {x : α} (h : ∀ y, p y → q y) (hx : q x) : 2 | ∀ y, x = y ∨ p y → q y 3 | | x (or.inr p) := h x p 4 | | ._ (or.inl rfl) := hx 5 | -------------------------------------------------------------------------------- /tests/lean/run/local_notation.lean: -------------------------------------------------------------------------------- 1 | section 2 | variables {A : Type} 3 | variables f : A → A → A 4 | local infixl `+++`:10 := f 5 | 6 | variables a b c : A 7 | #check f a b 8 | #check a +++ b 9 | end 10 | -------------------------------------------------------------------------------- /tests/lean/univ_vars.lean.expected.out: -------------------------------------------------------------------------------- 1 | id1.{u_1} : Π (A : Type u_1), A → A 2 | id2 : Π (B : Type), B → B 3 | id3.{u_1} : Π (C : Type u_1), C → C 4 | foo.{u_1} : Π (A₁ A₂ : Type u_1), A₁ → A₂ → Prop 5 | Type m : Type (m+1) 6 | -------------------------------------------------------------------------------- /src/library/tactic/vm_type_context.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 E.W.Ayers */ 2 | #pragma once 3 | #include "library/vm/vm.h" 4 | namespace lean { 5 | void initialize_vm_type_context(); 6 | void finalize_vm_type_context(); 7 | } 8 | -------------------------------------------------------------------------------- /tests/lean/begin_end_bug.lean: -------------------------------------------------------------------------------- 1 | example (a b c : nat) : a = b → a = c → b = c := 2 | assume hab hac, 3 | have b = a, begin trace a, symmetry, assumption end, 4 | begin 5 | transitivity, 6 | exact this, 7 | exact hac 8 | end 9 | -------------------------------------------------------------------------------- /tests/lean/case_let.lean: -------------------------------------------------------------------------------- 1 | 2 | example (n m : ℕ) : n + m = m + n := 3 | begin 4 | let s := n + m, 5 | induction n, 6 | case nat.zero : {sorry}, -- error: could not find open goal of given case 7 | case nat.succ : {sorry} 8 | end 9 | -------------------------------------------------------------------------------- /tests/lean/char_lits.lean.expected.out: -------------------------------------------------------------------------------- 1 | 'a' : char 2 | '\\' : char 3 | 'α' : char 4 | 'a' 5 | '\n' 6 | '\\' 7 | aaa\ 8 | '\n' 9 | 10 | aaa' 11 | ['\x7f', '\x00', '\x11'] : list char 12 | 'α' 13 | 'β' 14 | 'α' 15 | 'β' 16 | -------------------------------------------------------------------------------- /tests/lean/ctx.lean.expected.out: -------------------------------------------------------------------------------- 1 | ctx.lean:3:0: error: don't know how to synthesize placeholder 2 | context: 3 | A B : Type u, 4 | a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 : ℕ, 5 | b1 b2 b3 : bool, 6 | h : A = B, 7 | p1 p2 : A × B 8 | ⊢ ℕ 9 | -------------------------------------------------------------------------------- /tests/lean/html_cmd.lean: -------------------------------------------------------------------------------- 1 | open widget 2 | 3 | variables {α:Type} 4 | 5 | meta def Hello : component string α := component.pure (λ s, ["hello, ", s, ", good day!"]) 6 | 7 | #html (Hello "lean") -- renders "hello, lean, good day!" -------------------------------------------------------------------------------- /tests/lean/inductive_cmd_leftover_placeholder_universe.lean.expected.out: -------------------------------------------------------------------------------- 1 | inductive_cmd_leftover_placeholder_universe.lean:1:0: error: inductive type being declared can only be nested inside the parameters of other inductive types 2 | -------------------------------------------------------------------------------- /tests/lean/interactive/complete_namespace.lean: -------------------------------------------------------------------------------- 1 | prelude 2 | 3 | inductive foo.bar 4 | 5 | open foo 6 | --^ "command": "complete" 7 | 8 | namespace foo 9 | open bar 10 | --^ "command": "complete" 11 | end foo 12 | -------------------------------------------------------------------------------- /tests/lean/interactive/symbols.input: -------------------------------------------------------------------------------- 1 | {"seq_num": 0, "command": "sync", "file_name": "symbols.lean", "content": "def foo : nat := 1\n\ndef foo.bar : nat := 2"} 2 | {"seq_num": 3, "command": "symbols", "file_name": "symbols.lean"} 3 | -------------------------------------------------------------------------------- /tests/lean/io_process_echo.lean: -------------------------------------------------------------------------------- 1 | import system.io 2 | 3 | 4 | 5 | def main : io unit := do 6 | handle ← io.cmd {cmd := "echo", args := ["Hello World!"]}, 7 | io.put_str handle, 8 | return () 9 | 10 | #eval main 11 | -------------------------------------------------------------------------------- /tests/lean/issue136.lean: -------------------------------------------------------------------------------- 1 | 2 | meta def tactic.interactive.test (a : interactive.parse 3 | (lean.parser.of_tactic (@tactic.fail ℕ _ _ "oh no"))) := 4 | tactic.skip 5 | 6 | example : true := begin test end -- should be "oh no" 7 | -------------------------------------------------------------------------------- /tests/lean/run/class11.lean: -------------------------------------------------------------------------------- 1 | class inductive C {A : Type} : A → Prop 2 | 3 | constant f {A : Type} (a : A) [H : C a] : Prop 4 | 5 | noncomputable definition g {A : Type} (a b : A) {H1 : C a} {H2 : C b} : Prop := 6 | f a ∧ f b 7 | -------------------------------------------------------------------------------- /tests/lean/run/div2.lean: -------------------------------------------------------------------------------- 1 | def Div : nat → nat → nat 2 | | x y := 3 | if h : 0 < y ∧ y ≤ x then 4 | have x - y < x, from nat.sub_lt (nat.lt_of_lt_of_le h.left h.right) h.left, 5 | Div (x - y) y + 1 6 | else 7 | 0 8 | -------------------------------------------------------------------------------- /tests/lean/run/id.lean: -------------------------------------------------------------------------------- 1 | #check id id 2 | set_option pp.universes true 3 | #check id id 4 | #check id Prop 5 | #check id nat 6 | #check @id.{0} 7 | #check @id.{1} 8 | #check id nat.zero 9 | #check @eq 10 | #check eq eq 11 | -------------------------------------------------------------------------------- /tests/lean/run/io_process_env.lean: -------------------------------------------------------------------------------- 1 | import system.io 2 | 3 | 4 | #eval do 5 | res ← io.cmd {cmd := "printenv", args := ["foo"], env := [("foo", "bar")]}, 6 | when (res ≠ "bar\n") $ io.fail $ "unexpected value for foo: " ++ res 7 | -------------------------------------------------------------------------------- /tests/lean/run/is_def_eq_perf_bug.lean: -------------------------------------------------------------------------------- 1 | definition f (n : nat) : nat := 2 | if n = 100000 then 1 else 0 3 | 4 | open tactic 5 | 6 | example (n : nat) : f 100000 = (if (100000 : nat) = 100000 then 1 else 0) := 7 | by reflexivity 8 | -------------------------------------------------------------------------------- /tests/lean/run/kernel_fin_rfl.lean: -------------------------------------------------------------------------------- 1 | example : (1 : fin 2) = (3 : fin 2) := rfl 2 | example : (3/2 : fin 2) = (0 : fin 2) := rfl 3 | example : (1 + 1 + 1 * 1 : fin 2) = (1 : fin 2) := rfl 4 | example : fin.succ 0 = (1 : fin 2) := rfl -------------------------------------------------------------------------------- /tests/lean/run/set1.lean: -------------------------------------------------------------------------------- 1 | variables A : Type 2 | 3 | instance : has_subset (set A) := ⟨λ s t, ∀ ⦃x⦄, x ∈ s → x ∈ t⟩ 4 | 5 | example (s₁ s₂ s₃ : set A) : s₁ ⊆ s₂ → s₂ ⊆ s₃ → s₁ ⊆ s₃ := 6 | assume h₁ h₂ a ains₁, 7 | h₂ (h₁ ains₁) 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > [!WARNING] 2 | > Lean 3 is no longer actively maintained. 3 | > It is strongly recommended that you use [Lean 4](https://lean-lang.org/) instead. 4 | 5 | (If you need to read the old `README.md`, please see `OLD_README.md`.) -------------------------------------------------------------------------------- /tests/lean/1898.lean.expected.out: -------------------------------------------------------------------------------- 1 | 1898.lean:1:38: error: invalid projection, index must be greater than 0 2 | 1898.lean:1:4: error: don't know how to synthesize placeholder 3 | context: 4 | R : Type, 5 | H : has_zero R 6 | ⊢ Sort ? 7 | -------------------------------------------------------------------------------- /tests/lean/concrete_instance.lean.expected.out: -------------------------------------------------------------------------------- 1 | @has_mul.mul.{0} nat nat.has_mul a b : nat 2 | @has_add.add.{0} nat nat.has_add a b : nat 3 | @has_mul.mul.{0} nat nat.has_mul a b : nat 4 | @has_add.add.{0} nat nat.has_add a b : nat 5 | -------------------------------------------------------------------------------- /tests/lean/defeq_match.lean: -------------------------------------------------------------------------------- 1 | constants (p : (nat → nat → nat) → Prop) (p_add : p nat.add) 2 | 3 | -- The failure case we want to avoid is unfolding `nat.add` and not `λ a b, nat.add a b` 4 | example : p (λ a b, nat.add a b) := p_add 5 | -------------------------------------------------------------------------------- /tests/lean/elab7.lean: -------------------------------------------------------------------------------- 1 | set_option pp.all true 2 | set_option pp.purify_metavars false 3 | 4 | #check λ x : nat, x + 1 5 | 6 | #check λ x y : nat, x + y 7 | 8 | #check λ x y, x + y + 1 9 | 10 | #check λ x, (x + 1) :: [] 11 | -------------------------------------------------------------------------------- /tests/lean/interactive/complete_tactic.lean: -------------------------------------------------------------------------------- 1 | example := by assumption 2 | --^ "command": "complete", "skip_completions": true 3 | 4 | example := begin 5 | --^ "command": "complete", "skip_completions": true 6 | -------------------------------------------------------------------------------- /tests/lean/list_lt.lean: -------------------------------------------------------------------------------- 1 | #eval to_bool ([1, 2] < [2, 1]) 2 | #eval to_bool ([2, 1] < [1, 2]) 3 | #eval to_bool ("ab" < "ba") 4 | #eval to_bool ("ba" < "ab") 5 | #reduce to_bool ("ba" < "ab") 6 | example : ¬ ("ba" < "ab") := dec_trivial 7 | -------------------------------------------------------------------------------- /tests/lean/meta_ind_univ.lean: -------------------------------------------------------------------------------- 1 | -- should fail 2 | inductive foo : Type → Type 3 | | mk : Π (α β : Type), (β → α) → foo α 4 | 5 | -- should be fine 6 | meta inductive foom : Type → Type 7 | | mk : Π (α β : Type), (β → α) → foom α 8 | 9 | -------------------------------------------------------------------------------- /tests/lean/print_ax1.lean.expected.out: -------------------------------------------------------------------------------- 1 | quot.sound : ∀ {α : Sort u} {r : α → α → Prop} {a b : α}, r a b → quot.mk r a = quot.mk r b 2 | classical.choice : Π {α : Sort u}, nonempty α → α 3 | propext : ∀ {a b : Prop}, (a ↔ b) → a = b 4 | -------------------------------------------------------------------------------- /tests/lean/run/1495.lean: -------------------------------------------------------------------------------- 1 | section 2 | variables (r : ℕ → ℕ → Prop) 3 | local infix `≼` : 50 := r 4 | 5 | example {a b : ℕ} : a ≼ b → true := 6 | begin 7 | show a ≼ b → true, 8 | {intro x, tactic.triv} 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /tests/lean/run/add_decl_namespace.lean: -------------------------------------------------------------------------------- 1 | 2 | namespace A 3 | 4 | def x := 1 5 | 6 | def _root_.B.x := 1 7 | 8 | end A 9 | 10 | def C.x := 1 11 | 12 | run_cmd tactic.add_aux_decl `D.x `(ℕ) `(1) ff 13 | 14 | open A B C D 15 | -------------------------------------------------------------------------------- /tests/lean/run/dependent_seq.lean: -------------------------------------------------------------------------------- 1 | 2 | theorem test (n : nat) (h : n = n) : true := trivial 3 | 4 | example (h : 3 = 3) : true := 5 | by apply test; assumption 6 | 7 | example (h : 3 = 3) : true := 8 | by apply test; [assumption] 9 | -------------------------------------------------------------------------------- /tests/lean/run/over3.lean: -------------------------------------------------------------------------------- 1 | constant foo.f {A B : Type} : (A → B) → (B → A) 2 | constant bla.f {A : Type} : (A → nat) → (A → nat) 3 | 4 | open foo bla 5 | 6 | noncomputable example : nat → bool := 7 | f (λ b, bool.cases_on b 0 1) 8 | -------------------------------------------------------------------------------- /tests/lean/run/print_poly.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | 3 | #print pp.max_depth 4 | #print + 5 | #print - 6 | 7 | #print nat 8 | #print nat.zero 9 | #print nat.add 10 | #print nat.rec 11 | #print classical.em 12 | #print quot.lift 13 | -------------------------------------------------------------------------------- /tests/lean/run/whenIO.lean: -------------------------------------------------------------------------------- 1 | import system.io 2 | open io 3 | 4 | def iowhen (b : bool) (a : io unit) : io unit := 5 | if b = tt then a else return () 6 | 7 | #eval iowhen tt (put_str "hello\n") 8 | #eval iowhen ff (put_str "error\n") 9 | -------------------------------------------------------------------------------- /tests/lean/run_cmd_type.lean.expected.out: -------------------------------------------------------------------------------- 1 | run_cmd_type.lean:5:8: error: type mismatch at application 2 | has_bind.and_then foo 3 | term 4 | foo 5 | has type 6 | lean.parser unit 7 | but is expected to have type 8 | tactic unit 9 | -------------------------------------------------------------------------------- /tests/lean/structure_elab_segfault.lean.expected.out: -------------------------------------------------------------------------------- 1 | structure_elab_segfault.lean:1:0: error: infer type failed, sort expected 2 | ?m_1[A] 3 | structure_elab_segfault.lean:2:0: error: infer type failed, sort expected 4 | ?m_1[x] 5 | -------------------------------------------------------------------------------- /tests/lean/univ.lean.expected.out: -------------------------------------------------------------------------------- 1 | id2 Type ℕ : Type 2 | id2 Type ℕ : Type 3 | id2 Type ℕ : Type 4 | id2 Type ℕ : Type 5 | id2 Type ℕ : Type 6 | id2 Type ℕ : Type 7 | id2 (Type 2) (Type 1) : Type 2 8 | id2 (Type 2) (Type 1) : Type 2 9 | -------------------------------------------------------------------------------- /tests/lean/error_full_names.lean: -------------------------------------------------------------------------------- 1 | namespace foo 2 | open nat 3 | inductive nat : Type | zero, foosucc : nat → nat 4 | #check 0 + nat.zero --error 5 | end foo 6 | 7 | namespace foo 8 | #check nat.succ nat.zero --error 9 | end foo 10 | -------------------------------------------------------------------------------- /tests/lean/extra/show_goal.18.6.expected.out: -------------------------------------------------------------------------------- 1 | LEAN_INFORMATION 2 | position 18:6 3 | a b c d : ℕ, 4 | h₁ : a + b = 0, 5 | h₂ : b = 0, 6 | aeq0 : a = 0, 7 | h₃ : succ c = 1, 8 | h₄ : d = c - 1 9 | ⊢ c = 0 10 | END_LEAN_INFORMATION 11 | -------------------------------------------------------------------------------- /tests/lean/io_bug1.lean.expected.out: -------------------------------------------------------------------------------- 1 | onetwothree 2 | --------- 3 | in 4 | in 5 | in 6 | at zero 7 | out 8 | out 9 | out 10 | --------- 11 | in 12 | in 13 | in 14 | at zero 15 | out 16 | out2 17 | out 18 | out2 19 | out 20 | out2 21 | -------------------------------------------------------------------------------- /tests/lean/module_info.lean.expected.out: -------------------------------------------------------------------------------- 1 | "dlist.lean" 2 | tt 3 | tt 4 | ff 5 | "imported" 6 | Π {α : Type u}, dlist α → list α 7 | module_info.lean:26:0: error: invalid object declaration, environment already has an object named 'dlist' 8 | -------------------------------------------------------------------------------- /tests/lean/noncomputable_lemma.lean: -------------------------------------------------------------------------------- 1 | noncomputable lemma a : ℕ := 37 2 | lemma b : ℕ := 37 3 | -- do not report missing noncomputable: 4 | lemma sorry_type : sorry := sorry 5 | -- do not report missing noncomputable: 6 | lemma incomplete : 7 | -------------------------------------------------------------------------------- /tests/lean/pp_bug.lean.expected.out: -------------------------------------------------------------------------------- 1 | ¬(p → q) : Prop 2 | ¬p → q : Prop 3 | ¬p → q : Prop 4 | ¬(p → q) : Prop 5 | p ↔ q : Prop 6 | ¬(p ↔ q) : Prop 7 | ¬p ↔ q : Prop 8 | ¬p ↔ q : Prop 9 | p → q ↔ q : Prop 10 | p → (q ↔ q) : Prop 11 | -------------------------------------------------------------------------------- /tests/lean/reflect_type_defeq.lean.expected.out: -------------------------------------------------------------------------------- 1 | reflect_type_defeq.lean:2:0: error: equation type mismatch, term 2 | x 3 | has type 4 | reflected ℕ 3 5 | but is expected to have type 6 | reflected (list ℕ) [10] 7 | synonym.of 1 8 | 1 9 | -------------------------------------------------------------------------------- /tests/lean/run/1724.lean: -------------------------------------------------------------------------------- 1 | example (h : ¬ true) : false := 2 | by simp * at * 3 | 4 | example (h : true) (h' : true → false) : false := 5 | by simp * at * 6 | 7 | example (p : Prop) (h : p) (h' : p → false) : false := 8 | by simp * at * 9 | -------------------------------------------------------------------------------- /tests/lean/run/comment.lean: -------------------------------------------------------------------------------- 1 | /- tests -/ 2 | /- /- /- nested comment blocks -/ -/ -/ 3 | /-- /- /- nested comment blocks in a docstring -/ -/ -/ 4 | example : true := trivial 5 | /-! /- /- nested comment blocks in a module block-/ -/ -/ 6 | -------------------------------------------------------------------------------- /tests/lean/run/decidable.lean: -------------------------------------------------------------------------------- 1 | open bool unit decidable 2 | 3 | constants a b c : bool 4 | constants u v : unit 5 | set_option pp.implicit true 6 | #check if ((a = b) ∧ (b = c) → ¬ (u = v) ∨ (a = c) → (a = c) ↔ a = tt ↔ true) then a else b 7 | -------------------------------------------------------------------------------- /tests/lean/run/kha_inst_bug.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | 3 | example (a b : ℕ) : a - b = a - min a b := 4 | if h : a ≥ b then by rw [min_eq_right h] 5 | else by rw [nat.sub_eq_zero_of_le (le_of_not_ge h), min_eq_left (le_of_not_ge h), nat.sub_self] 6 | -------------------------------------------------------------------------------- /tests/lean/run/level_bug1.lean: -------------------------------------------------------------------------------- 1 | definition f (a : Type) := Π r : Type, (a → r) → r 2 | 3 | definition blah2 : Π {a : Type} {r : Type} (sa : f a) (k : a → r), sa r k = sa r k := 4 | λ (a : Type) (r : Type) (sa : f a) (k : a → r), rfl 5 | -------------------------------------------------------------------------------- /tests/lean/set_opt_tac.lean.expected.out: -------------------------------------------------------------------------------- 1 | a + b = 0 2 | after pp.all true 3 | @eq.{1} nat (@has_add.add.{0} nat nat.has_add a b) (@has_zero.zero.{0} nat nat.has_zero) 4 | set_bool_option tactic does not affect other commands 5 | 0 + 1 : ℕ 6 | -------------------------------------------------------------------------------- /tests/lean/uni_bug1.lean: -------------------------------------------------------------------------------- 1 | -- 2 | open nat prod 3 | 4 | constant R : nat → nat → Prop 5 | constant f (a b : nat) (H : R a b) : nat 6 | axiom Rtrue (a b : nat) : R a b 7 | 8 | 9 | #check f 1 0 (Rtrue (fst (prod.mk 1 (0:nat))) 0) 10 | -------------------------------------------------------------------------------- /library/smt/default.lean: -------------------------------------------------------------------------------- 1 | /- 2 | Copyright (c) 2016 Microsoft Corporation. All rights reserved. 3 | Released under Apache 2.0 license as described in the file LICENSE. 4 | Authors: Daniel Selsam 5 | -/ 6 | import smt.arith smt.array smt.prove 7 | -------------------------------------------------------------------------------- /tests/lean/bad_error5.lean: -------------------------------------------------------------------------------- 1 | structure S := 2 | (α : Type) 3 | (β : unit) 4 | 5 | structure T (c : S) 6 | 7 | structure U (c: S) (A : c^.α) 8 | 9 | definition V (c : S) : S := 10 | { 11 | α := T c, 12 | β := by sorry 13 | } 14 | -------------------------------------------------------------------------------- /tests/lean/bad_id.lean.expected.out: -------------------------------------------------------------------------------- 1 | bad_id.lean:5:12: error: invalid definition, '|' or ':=' expected 2 | bad_id.lean:5:11: error: don't know how to synthesize placeholder 3 | context: 4 | ⊢ Sort ? 5 | bad_id.lean:5:12: error: command expected 6 | -------------------------------------------------------------------------------- /tests/lean/bad_set_option.lean.expected.out: -------------------------------------------------------------------------------- 1 | bad_set_option.lean:1:11: error: unknown option 'boo', type 'help options.' for list of available options 2 | bad_set_option.lean:3:22: error: invalid Boolean option value, 'true' or 'false' expected 3 | -------------------------------------------------------------------------------- /tests/lean/by_contradiction.lean.expected.out: -------------------------------------------------------------------------------- 1 | a b : ℕ, 2 | ᾰ : a ≠ b, 3 | H : a = b 4 | ⊢ false 5 | ------- 6 | a b : ℕ, 7 | ᾰ : ¬¬a = b, 8 | H : ¬a = b 9 | ⊢ false 10 | ------- 11 | p q : Prop, 12 | ᾰ : ¬¬p, 13 | H : ¬p 14 | ⊢ false 15 | -------------------------------------------------------------------------------- /tests/lean/def_inaccessible_issue.lean.expected.out: -------------------------------------------------------------------------------- 1 | map2.equations._eqn_2 : 2 | ∀ (f : bool → bool → bool) (n : ℕ) (b1 : bool) (v1 : bv n) (b2 : bool) (v2 : bv n), 3 | map2 f (cons n b1 v1) (cons n b2 v2) = cons n (f b1 b2) (map2 f v1 v2) 4 | -------------------------------------------------------------------------------- /tests/lean/elab3.lean.expected.out: -------------------------------------------------------------------------------- 1 | @has_bind.and_then.{0 0} unit unit tactic.{0} 2 | (@monad.to_has_bind.{0 0} tactic.{0} (@interaction_monad.monad.{0} tactic_state)) 3 | tactic.trace_state 4 | tactic.trace_state : 5 | tactic.{0} unit 6 | -------------------------------------------------------------------------------- /tests/lean/extra/show_goal.14.6.expected.out: -------------------------------------------------------------------------------- 1 | LEAN_INFORMATION 2 | position 14:6 3 | a b c d : ℕ, 4 | h₁ : a + b = 0, 5 | h₂ : b = 0, 6 | aeq0 : a = 0, 7 | h₃ : c + 1 + a = 1, 8 | h₄ : d = c - 1 9 | ⊢ c = 0 10 | END_LEAN_INFORMATION 11 | -------------------------------------------------------------------------------- /tests/lean/extra/show_goal.15.6.expected.out: -------------------------------------------------------------------------------- 1 | LEAN_INFORMATION 2 | position 15:6 3 | a b c d : ℕ, 4 | h₁ : a + b = 0, 5 | h₂ : b = 0, 6 | aeq0 : a = 0, 7 | h₃ : c + 1 + 0 = 1, 8 | h₄ : d = c - 1 9 | ⊢ c = 0 10 | END_LEAN_INFORMATION 11 | -------------------------------------------------------------------------------- /tests/lean/run/1942.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | meta def c : tactic unit := 4 | do l ← local_context, 5 | try_lst (l.map (λ h, cases h >> skip)) 6 | 7 | structure X (U : Type) := 8 | (f : U → U) 9 | (w : ∀ u : U, f u = u . c) 10 | -------------------------------------------------------------------------------- /tests/lean/run/abstract_ns.lean: -------------------------------------------------------------------------------- 1 | -- Each abstract_ns[i] module contains a definition ns[i].foo with an abstracted nested proof. 2 | -- This test makes sure that the abstracted proofs get different names. 3 | import .abstract_ns1 .abstract_ns2 4 | -------------------------------------------------------------------------------- /tests/lean/run/eq2.lean: -------------------------------------------------------------------------------- 1 | namespace test 2 | definition symm {A : Type} : Π {a b : A}, a = b → b = a 3 | | a .(a) rfl := rfl 4 | 5 | definition trans {A : Type} : Π {a b c : A}, a = b → b = c → a = c 6 | | a .(a) .(a) rfl rfl := rfl 7 | end test 8 | -------------------------------------------------------------------------------- /tests/lean/run/export2.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | 3 | definition foo : nat := 30 4 | 5 | namespace foo 6 | definition x : nat := 10 7 | definition y : nat := 20 8 | end foo 9 | 10 | export foo 11 | 12 | example : x + y = foo := rfl 13 | -------------------------------------------------------------------------------- /tests/lean/run/have1.lean: -------------------------------------------------------------------------------- 1 | prelude 2 | definition Prop : Type.{1} := Type.{0} 3 | constants a b c : Prop 4 | axiom Ha : a 5 | axiom Hb : b 6 | axiom Hc : c 7 | #check have H1 : a, from Ha, 8 | have H2 : a, from H1, 9 | H2 10 | -------------------------------------------------------------------------------- /tests/lean/run/have2.lean: -------------------------------------------------------------------------------- 1 | prelude 2 | definition Prop : Type.{1} := Type.{0} 3 | constants a b c : Prop 4 | axiom Ha : a 5 | axiom Hb : b 6 | axiom Hc : c 7 | #check have H1 : a, from Ha, 8 | have H2 : a, from H1, 9 | H2 10 | -------------------------------------------------------------------------------- /tests/lean/run/implicit.lean: -------------------------------------------------------------------------------- 1 | definition f {A : Type} {B : Type} (f : A → B → Prop) ⦃C : Type⦄ {R : C → C → Prop} {c : C} (H : R c c) : R c c 2 | := H 3 | 4 | constant g : Prop → Prop → Prop 5 | constant H : true ∧ true 6 | 7 | #check f g H 8 | -------------------------------------------------------------------------------- /tests/lean/run/ind5.lean: -------------------------------------------------------------------------------- 1 | prelude 2 | definition Prop : Type.{1} := Type.{0} 3 | 4 | inductive or (A B : Prop) : Prop 5 | | intro_left : A → or 6 | | intro_right : B → or 7 | 8 | #check or 9 | #check or.intro_left 10 | #check or.rec 11 | -------------------------------------------------------------------------------- /tests/lean/run/lambda_simp.lean: -------------------------------------------------------------------------------- 1 | #print [simp] default 2 | 3 | constant addz (a : nat) : 0 + a = a 4 | attribute [simp] addz 5 | 6 | open tactic 7 | 8 | def ex : (λ a b : nat, 0 + a) = (λ a b, a) := 9 | by simp 10 | 11 | #print ex 12 | -------------------------------------------------------------------------------- /tests/lean/run/record4.lean: -------------------------------------------------------------------------------- 1 | structure point (A : Type) (B : Type) := 2 | mk :: (x : A) (y : B) 3 | 4 | inductive color 5 | | red | green | blue 6 | 7 | structure color_point (A : Type) (B : Type) extends point A B := 8 | mk :: (c : color) 9 | -------------------------------------------------------------------------------- /tests/lean/shadow.lean: -------------------------------------------------------------------------------- 1 | open nat 2 | 3 | variable a : nat 4 | 5 | -- The variable 'a' in the following definition is not the variable 'a' above 6 | definition tadd : nat → nat → nat 7 | | 0 b := b 8 | | (succ a) b := succ (tadd a b) 9 | -------------------------------------------------------------------------------- /tests/lean/1814.lean: -------------------------------------------------------------------------------- 1 | example : ∀ (p q : Prop), p → q → p := 2 | begin 3 | intros p p h1 h2, 4 | exact h2, 5 | end 6 | 7 | example : ∀ (p q : Prop), p → q → p := 8 | begin 9 | intros p p h1 h2, 10 | dedup, 11 | exact h2, 12 | end 13 | -------------------------------------------------------------------------------- /tests/lean/197c.lean.expected.out: -------------------------------------------------------------------------------- 1 | ⊢ ∀ (x : ℕ), x ∈ {carrier := ∅, a1 := _}.carrier → true 2 | 197c.lean:8:0: warning: declaration 'example_1' uses sorry 3 | ⊢ ∀ (x : ℕ), x ∈ ∅ → true 4 | 197c.lean:18:0: warning: declaration 'example_2' uses sorry 5 | -------------------------------------------------------------------------------- /tests/lean/alias2.lean: -------------------------------------------------------------------------------- 1 | -- 2 | 3 | namespace foo 4 | definition t := true 5 | end foo 6 | open foo 7 | 8 | namespace bla 9 | definition t := false 10 | #check foo.t -- <<< must print foo.t : Prop instead of t : Prop 11 | end bla 12 | -------------------------------------------------------------------------------- /tests/lean/begin_end_bug.lean.expected.out: -------------------------------------------------------------------------------- 1 | begin_end_bug.lean:3:24: error: unknown identifier 'a' 2 | begin_end_bug.lean:3:18: error: don't know how to synthesize placeholder 3 | context: 4 | a b c : ℕ, 5 | hab : a = b, 6 | hac : a = c 7 | ⊢ Type 8 | -------------------------------------------------------------------------------- /tests/lean/cyclic_default_fields.lean: -------------------------------------------------------------------------------- 1 | class Eq (α : Type) := 2 | (eq : α → α → Prop) 3 | (ne : α → α → Prop := λ a b, ¬eq a b) 4 | (eq := λ a b, ¬ne a b) 5 | 6 | #check ({} : Eq ℕ) 7 | #check ({eq := (=)} : Eq ℕ) 8 | #check ({ne := (≠)} : Eq ℕ) 9 | -------------------------------------------------------------------------------- /tests/lean/explicit_delimiters.lean: -------------------------------------------------------------------------------- 1 | example p : false := trivial -- Error 2 | 3 | def main proof : false := trivial -- Error 4 | 5 | example (p : false) := trivial 6 | 7 | def main' (proof : false) := trivial 8 | 9 | example := trivial 10 | -------------------------------------------------------------------------------- /tests/lean/guard_names.lean.expected.out: -------------------------------------------------------------------------------- 1 | α : Type, 2 | b l : tree α, 3 | v : α, 4 | r : tree α, 5 | ih_l : foo l = l, 6 | ih_r : foo r = r 7 | ⊢ foo (l.node v r) = l.node v r 8 | guard_names.lean:7:0: warning: declaration '[anonymous]' uses sorry 9 | -------------------------------------------------------------------------------- /tests/lean/quot_abuse2.lean.expected.out: -------------------------------------------------------------------------------- 1 | quot_abuse2.lean:3:0: error: failed to initialize quot module, environment does not have 'eq' type 2 | quot_abuse2.lean:9:0: error: failed to initialize quot module, unexpected type for 'eq' type constructor 3 | -------------------------------------------------------------------------------- /tests/lean/run/1703.lean: -------------------------------------------------------------------------------- 1 | namespace ns 2 | 3 | structure struct := 4 | (index : ℕ) 5 | 6 | end ns 7 | 8 | open ns 9 | 10 | def foo : struct := 11 | { ns.struct . index := 1 } 12 | 13 | def foo2 : struct := 14 | { struct . index := 1 } 15 | -------------------------------------------------------------------------------- /tests/lean/run/eqn_issue.lean: -------------------------------------------------------------------------------- 1 | universe variable u 2 | variable {α : Type u} 3 | 4 | def split : list α → list α × list α 5 | | [] := ([], []) 6 | | [a] := ([a], []) 7 | | (a :: b :: l) := (a :: (split l).1, b :: (split l).2) 8 | -------------------------------------------------------------------------------- /tests/lean/run/ho.lean: -------------------------------------------------------------------------------- 1 | inductive star : Type 2 | | z : star 3 | | s : (nat → star) → star 4 | 5 | #check @star.rec 6 | #check @star.cases_on 7 | 8 | example (f : nat → star) : ¬ star.z = star.s f := 9 | assume H, star.no_confusion H 10 | -------------------------------------------------------------------------------- /tests/lean/run/ind_issue.lean: -------------------------------------------------------------------------------- 1 | def stack := list nat 2 | instance : has_append stack := 3 | by unfold stack; apply_instance 4 | 5 | example (s : stack) : s ++ [] = s := 6 | begin 7 | induction s, 8 | refl, apply list.append_nil 9 | end 10 | -------------------------------------------------------------------------------- /tests/lean/run/indbug2.lean: -------------------------------------------------------------------------------- 1 | set_option pp.implicit true 2 | set_option pp.universes true 3 | section 4 | parameter {A : Type*} 5 | definition foo : A → A → Type* := (λ x y, Type*) 6 | inductive bar {a b : A} (f : foo a b) 7 | | bar2 : bar 8 | end 9 | -------------------------------------------------------------------------------- /tests/lean/run/reserve.lean: -------------------------------------------------------------------------------- 1 | reserve infix `=?=`:50 2 | reserve infixr `&&&`:25 3 | 4 | notation (name := eq) a `=?=` b := eq a b 5 | notation a `&&&` b := and a b 6 | 7 | set_option pp.notation false 8 | #check λ a b : nat, a =?= b &&& b =?= a 9 | -------------------------------------------------------------------------------- /tests/lean/sorry_hash.lean: -------------------------------------------------------------------------------- 1 | example : true := 2 | begin 3 | sorry #, -- broken 4 | end 5 | 6 | example : true := by { sorry # } -- broken 7 | 8 | example : true := begin { sorry # } end -- broken 9 | 10 | example : true := by trivial 11 | #che -------------------------------------------------------------------------------- /tests/lean/synth_inferred_mismatch.lean.expected.out: -------------------------------------------------------------------------------- 1 | synth_inferred_mismatch.lean:7:1: error: synthesized type class instance is not definitionally equal to expression inferred by typing rules, synthesized 2 | _inst_1 3 | inferred 4 | is_true h 5 | -------------------------------------------------------------------------------- /tests/lean/assumption_tac_notation.lean.expected.out: -------------------------------------------------------------------------------- 1 | assumption_tac_notation.lean:3:26: error: assumption tactic failed 2 | state: 3 | A : Type 4 | ⊢ A 5 | assumption_tac_notation.lean:4:22: error: assumption tactic failed 6 | state: 7 | A : Type 8 | ⊢ A 9 | -------------------------------------------------------------------------------- /tests/lean/interactive/info_import.input: -------------------------------------------------------------------------------- 1 | {"seq_num": 0, "command": "sync", "file_name": "info_import.lean", "content": "import .lib.open_locale\nopen_locale"} 2 | {"seq_num": 3, "command": "info", "file_name": "info_import.lean", "line": 2, "column": 0} 3 | -------------------------------------------------------------------------------- /tests/lean/local_notation_bug2.lean.expected.out: -------------------------------------------------------------------------------- 1 | local_notation_bug2.lean:7:9: error: invalid antiquotation, occurs outside of quoted expressions 2 | local_notation_bug2.lean:7:8: error: function expected at 3 | 5 4 | term has type 5 | ?m_1 6 | ⁇ 7 | -------------------------------------------------------------------------------- /tests/lean/no_meta_rec_inst.lean: -------------------------------------------------------------------------------- 1 | class has_false (α : Type) := 2 | (f : false) 3 | 4 | meta def n_has_false : has_false ℕ := 5 | by apply_instance -- Error, the "recursive" instance (n_has_false : has_false ℕ) should not be used in type class resolution 6 | -------------------------------------------------------------------------------- /tests/lean/pp_bug.lean: -------------------------------------------------------------------------------- 1 | variables p q : Prop 2 | #check ¬(p → q) 3 | #check ¬p → q 4 | #check (¬p) → q 5 | #check ¬(p → q) 6 | #check p ↔ q 7 | #check ¬(p ↔ q) 8 | #check ¬p ↔ q 9 | #check (¬p) ↔ q 10 | #check (p → q) ↔ q 11 | #check p → (q ↔ q) 12 | -------------------------------------------------------------------------------- /tests/lean/quot_abuse1.lean.expected.out: -------------------------------------------------------------------------------- 1 | quot_abuse1.lean:3:0: error: failed to initialize quot module, environment does not have 'eq' type 2 | quot_abuse1.lean:8:0: error: failed to initialize quot module, unexpected number of constructors for 'eq' type 3 | -------------------------------------------------------------------------------- /tests/lean/quot_ind_bug.lean: -------------------------------------------------------------------------------- 1 | open quotient 2 | 3 | variables {A : Type} [s : setoid A] {B : quotient s → Prop} (c : ∀ (a : A), B (quotient.mk a)) (a : A) 4 | #check (quotient.ind c ⟦a⟧ : B ⟦a⟧) 5 | #check c a 6 | #reduce (quotient.ind c ⟦a⟧ : B ⟦a⟧) 7 | -------------------------------------------------------------------------------- /tests/lean/rev_tac1.lean: -------------------------------------------------------------------------------- 1 | open tactic 2 | 3 | example (a b : nat) (H : a > 0) (H : a > b) (H : b > 0) : a = b → true := 4 | by do 5 | a ← get_local `a, 6 | n ← revert a, 7 | trace n, 8 | trace_state, 9 | intros, 10 | constructor 11 | -------------------------------------------------------------------------------- /tests/lean/run/1608.lean: -------------------------------------------------------------------------------- 1 | example {α : Type} {a b : α} (h : ¬ (a = b)) : b ≠ a := 2 | by cc 3 | 4 | example {α : Type} {a b : α} (h : ¬ (a = b)) : ¬ (b = a) := 5 | by cc 6 | 7 | example {α : Type} {a b : α} (h : ¬ (a = b)) : b ≠ a := 8 | begin [smt] end 9 | --------------------------------------------------------------------------------