示例#1
0
void initialize_let() {
    g_let_value = new name("letv");
    g_let_value_opcode = new std::string("LetV");
    g_next_let_value_id = new atomic<unsigned>(0);
    register_macro_deserializer(*g_let_value_opcode,
                                [](deserializer &, unsigned num, expr const * args) {
                                    if (num != 1) throw corrupted_stream_exception();
                                    return mk_let_value(args[0]);
                                });
    g_let = new name("let");
    g_let_opcode = new std::string("Let");
    register_macro_deserializer(*g_let_opcode,
                                [](deserializer & d, unsigned num, expr const * args) {
                                    if (num != 2) throw corrupted_stream_exception();
                                    name n;
                                    d >> n;
                                    return mk_let_macro(n, args[0], args[1]);
                                });
示例#2
0
void initialize_nested_declaration() {
    g_nested_decl        = new name("nested_decl");
    g_nested_decl_opcode = new std::string("NDecl");
    register_macro_deserializer(get_nested_decl_opcode(),
                                [](deserializer & d, unsigned num, expr const * args) {
                                    if (num != 1)
                                        throw corrupted_stream_exception();
                                    optional<name> n; decl_attributes attrs;
                                    d >> n; attrs.read(d);
                                    return mk_nested_declaration(n, attrs, args[0]);
                                });
示例#3
0
void initialize_with_options_tactic() {
    g_options_name     = new name("options");
    g_options_opcode   = new std::string("OPTM");
    register_macro_deserializer(*g_options_opcode,
                                [](deserializer & d, unsigned num, expr const *) {
                                    if (num > 0)
                                        throw corrupted_stream_exception();
                                    options info;
                                    d >> info;
                                    return mk_options_expr(info);
                                });
示例#4
0
void initialize_typed_expr() {
    g_typed_expr_name = new name("typed_expr");
    g_typed_expr_opcode = new std::string("TyE");
    g_typed_expr = new macro_definition(new typed_expr_macro_definition_cell());
    register_macro_deserializer(*g_typed_expr_opcode,
                                [](deserializer &, unsigned num, expr const * args) {
                                    if (num != 2)
                                        throw corrupted_stream_exception();
                                    return mk_typed_expr(args[0], args[1]);
                                });
}
void initialize_structure_instance() {
    g_structure_instance_name   = new name("structure instance");
    g_structure_instance_opcode = new std::string("STI");
    register_macro_deserializer(*g_structure_instance_opcode,
                                [](deserializer & d, unsigned num, expr const * args) {
                                    list<name> fs;
                                    fs = read_list<name>(d);
                                    if (num < length(fs) + 1)
                                        throw corrupted_stream_exception();
                                    return mk_structure_instance(fs, num, args);
                                });
}
示例#6
0
void initialize_structure_instance() {
    g_structure_instance_name   = new name("structure instance");
    g_structure_instance_opcode = new std::string("STI");
    register_macro_deserializer(*g_structure_instance_opcode,
                                [](deserializer & d, unsigned num, expr const * args) {
                                    list<name> fns;
                                    name s;
                                    d >> s;
                                    fns = read_list<name>(d);
                                    unsigned len = length(fns);
                                    if (num != len + 1 && num != len)
                                        throw corrupted_stream_exception();
                                    return mk_structure_instance_core(s, fns, num, args);
                                });
示例#7
0
void initialize_def_projection() {
    g_projection_macro_name = new name("projection");
    g_projection_opcode     = new std::string("Proj");
    register_macro_deserializer(*g_projection_opcode,
    [](deserializer & d, unsigned num, expr const * args) {
        if (num != 1)
            throw corrupted_stream_exception();
        name I_name, c_name, proj_name;
        unsigned idx;
        level_param_names ps;
        expr type, val;
        d >> I_name >> c_name >> proj_name >> idx >> ps >> type >> val;
        return mk_projection_macro(I_name, c_name, proj_name, idx,
                                   ps, type, val, args[0]);
    });
示例#8
0
void initialize_resolve_macro() {
    g_resolve_macro_name = new name("resolve");
    g_resolve_opcode = new std::string("Res");
    g_or = new expr(Const(get_or_name()));
    g_not = new expr(Const(get_not_name()));
    g_false = new expr(Const(get_false_name()));
    g_or_elim = new expr(Const(get_or_elim_name()));
    g_or_intro_left = new expr(Const(get_or_intro_left_name()));
    g_or_intro_right = new expr(Const(get_or_intro_right_name()));
    g_absurd_elim = new expr(Const(get_absurd_name()));
    g_var_0 = new expr(mk_var(0));
    g_resolve_macro_definition = new macro_definition(new resolve_macro_definition_cell());
    register_macro_deserializer(*g_resolve_opcode,
                                [](deserializer &, unsigned num, expr const * args) {
                                    if (num != 3)
                                        throw corrupted_stream_exception();
                                    return mk_resolve_macro(args[0], args[1], args[2]);
                                });
}
示例#9
0
文件: string.cpp 项目: sakas--/lean
void initialize_string() {
    g_string_macro    = new name("string_macro");
    g_string_opcode   = new std::string("Str");
    g_nat             = new expr(Const(get_nat_name()));
    g_char            = new expr(Const(get_char_name()));
    g_char_of_nat     = new expr(Const(get_char_of_nat_name()));
    g_string          = new expr(Const(get_string_name()));
    g_empty           = new expr(Const(get_string_empty_name()));
    g_str             = new expr(Const(get_string_str_name()));
    g_fin_mk          = new expr(Const(get_fin_mk_name()));
    g_list_char       = new expr(mk_app(mk_constant(get_list_name(), {mk_level_one()}), *g_char));
    g_list_cons       = new expr(mk_constant(get_list_cons_name(), {mk_level_one()}));
    g_list_nil_char   = new expr(mk_app(mk_constant(get_list_nil_name(), {mk_level_one()}), *g_char));
    register_macro_deserializer(*g_string_opcode,
    [](deserializer & d, unsigned num, expr const *) {
        if (num != 0)
            throw corrupted_stream_exception();
        std::string v = d.read_string();
        return mk_string_macro(v);
    });
}