Exemplo n.º 1
0
void initialize_change_tactic() {
    register_tac(get_tactic_change_name(),
                 [](type_checker &, elaborate_fn const & fn, expr const & e, pos_info_provider const *) {
                     check_tactic_expr(app_arg(e), "invalid 'change' tactic, invalid argument");
                     return change_goal_tactic(fn, get_tactic_expr_expr(app_arg(e)));
                 });
}
Exemplo n.º 2
0
void initialize_check_expr_tactic() {
    register_tac(get_tactic_check_expr_name(),
                 [](type_checker &, elaborate_fn const & fn, expr const & e, pos_info_provider const * p) {
                     check_tactic_expr(app_arg(e), "invalid 'check_expr' tactic, invalid argument");
                     expr arg = get_tactic_expr_expr(app_arg(e));
                     if (p) {
                         if (auto it = p->get_pos_info(e))
                             return check_expr_tactic(fn, arg, std::string(p->get_file_name()), *it);
                     }
                     return check_expr_tactic(fn, arg, "<unknown file>", mk_pair(0, 0));
                 });
}
Exemplo n.º 3
0
void initialize_apply_tactic() {
    g_apply_class_instance = new name{"apply", "class_instance"};
    register_bool_option(*g_apply_class_instance, LEAN_DEFAULT_APPLY_CLASS_INSTANCE,
                         "(apply tactic) if true apply tactic uses class-instances "
                         "resolution for instance implicit arguments");

    register_tac(get_tactic_apply_name(),
                 [](type_checker &, elaborate_fn const & fn, expr const & e, pos_info_provider const *) {
                     check_tactic_expr(app_arg(e), "invalid 'apply' tactic, invalid argument");
                     return apply_tactic(fn, get_tactic_expr_expr(app_arg(e)));
                 });

    register_tac(get_tactic_eapply_name(),
                 [](type_checker &, elaborate_fn const & fn, expr const & e, pos_info_provider const *) {
                     check_tactic_expr(app_arg(e), "invalid 'eapply' tactic, invalid argument");
                     return eapply_tactic(fn, get_tactic_expr_expr(app_arg(e)));
                 });

    register_tac(get_tactic_fapply_name(),
                 [](type_checker &, elaborate_fn const & fn, expr const & e, pos_info_provider const *) {
                     check_tactic_expr(app_arg(e), "invalid 'fapply' tactic, invalid argument");
                     return fapply_tactic(fn, get_tactic_expr_expr(app_arg(e)));
                 });
}
Exemplo n.º 4
0
                                    if (num > 0)
                                        throw corrupted_stream_exception();
                                    options info;
                                    d >> info;
                                    return mk_options_expr(info);
                                });

    name with_options_tac_name{"tactic", "with_options_tac"};
    g_with_options_tac = new expr(Const(with_options_tac_name));
    register_tac(with_options_tac_name,
                 [=](type_checker & tc, elaborate_fn const & fn, expr const & e, pos_info_provider const * p) {
                     buffer<expr> args;
                     get_app_args(e, args);
                     if (args.size() != 2)
                         throw expr_to_tactic_exception(e, "invalid 'with_options' tactical, it must have two arguments");
                     check_tactic_expr(args[0], "invalid 'with_options' tactical, invalid argument");
                     expr opts = get_tactic_expr_expr(args[0]);
                     if (!is_options_expr(opts))
                         throw expr_to_tactic_exception(args[0], "invalid 'with_options' tactical, invalid argument");
                     tactic t  = expr_to_tactic(tc, fn, args[1], p);
                     return with_options(get_options_expr_options(opts), t);
                 });
}

void finalize_with_options_tactic() {
    delete g_options_name;
    delete g_options_opcode;
    delete g_with_options_tac;
}
}