Esempio n. 1
0
int main(void) {
        f0();
    f1();
    f2();
    f3();
    f4();
    f5();
    f6();
    f7();
    f8();
    f9();
    f10();
    f11();
    f12();
    f13();
    f14();
    f15();
    f16();
    f17();
    f18();
    f19();
    f20();
    f21();
    f22();
    f23();
    f24();
    f25();
    f26();
    f27();
    f28();
    f29();
    f30();
    f31();
    f32();
    f33();
    f34();
    f35();
    f36();
    f37();
    f38();
    f39();
    f40();
    f41();
    f42();
    f43();
    f44();
    f45();
    f46();
    f47();
    f48();
    f49();
    f50();
    f51();
    f52();
    f53();
    f54();
    f55();
    f56();
    f57();
    f58();
    f59();
    f60();
    f61();
    f62();
    f63();
    f64();
    f65();
    f66();
    f67();
    f68();
    f69();
    f70();
    f71();
    f72();
    f73();
    f74();
    f75();
    f76();
    f77();
    f78();
    f79();
    f80();
    f81();
    f82();
    f83();
    f84();
    f85();
    f86();
    f87();
    f88();
    f89();
    f90();
    f91();
    f92();
    f93();
    f94();
    f95();
    f96();
    f97();
    f98();
    f99();
    f100();
    f101();
    f102();
    f103();
    f104();
    f105();
    f106();
    f107();
    f108();
    f109();
    f110();
    f111();
    f112();
    f113();
    f114();
    f115();
    f116();
    f117();
    f118();
    f119();
    f120();
    f121();
    f122();
    f123();


    return 0;
}
Esempio n. 2
0
int main(void) {
        f0();
    f1();
    f2();
    f3();
    f4();
    f5();
    f6();
    f7();
    f8();
    f9();
    f10();
    f11();
    f12();
    f13();
    f14();
    f15();
    f16();
    f17();
    f18();
    f19();
    f20();
    f21();
    f22();
    f23();
    f24();
    f25();
    f26();
    f27();
    f28();
    f29();
    f30();
    f31();
    f32();
    f33();
    f34();
    f35();
    f36();
    f37();
    f38();
    f39();
    f40();
    f41();
    f42();
    f43();
    f44();
    f45();
    f46();
    f47();
    f48();
    f49();
    f50();
    f51();
    f52();
    f53();
    f54();
    f55();
    f56();
    f57();
    f58();
    f59();
    f60();
    f61();
    f62();
    f63();
    f64();
    f65();
    f66();
    f67();
    f68();
    f69();
    f70();
    f71();
    f72();
    f73();
    f74();
    f75();
    f76();
    f77();
    f78();
    f79();
    f80();
    f81();
    f82();
    f83();
    f84();
    f85();
    f86();
    f87();
    f88();
    f89();
    f90();
    f91();
    f92();
    f93();
    f94();
    f95();
    f96();
    f97();
    f98();
    f99();
    f100();
    f101();
    f102();
    f103();
    f104();
    f105();
    f106();
    f107();
    f108();
    f109();
    f110();
    f111();
    f112();
    f113();
    f114();
    f115();
    f116();
    f117();
    f118();
    f119();
    f120();
    f121();
    f122();
    f123();
    f124();
    f125();
    f126();
    f127();
    f128();
    f129();
    f130();
    f131();
    f132();
    f133();
    f134();
    f135();
    f136();
    f137();
    f138();
    f139();
    f140();
    f141();
    f142();
    f143();
    f144();
    f145();
    f146();
    f147();
    f148();
    f149();
    f150();
    f151();
    f152();
    f153();
    f154();
    f155();
    f156();
    f157();
    f158();
    f159();
    f160();
    f161();
    f162();
    f163();
    f164();
    f165();
    f166();
    f167();
    f168();
    f169();
    f170();
    f171();
    f172();
    f173();
    f174();
    f175();
    f176();
    f177();
    f178();
    f179();
    f180();
    f181();
    f182();
    f183();
    f184();
    f185();
    f186();
    f187();
    f188();
    f189();
    f190();
    f191();
    f192();
    f193();
    f194();
    f195();
    f196();
    f197();
    f198();
    f199();


    return 0;
}
Esempio n. 3
0
    void test_finite_product_relation(smt_params fparams, params_ref& params) {
        ast_manager m;
        register_engine re;
        context ctx(m, re, fparams);
        ctx.updt_params(params);
        dl_decl_util dl_util(m);
        relation_manager & rmgr = ctx.get_rel_context()->get_rmanager();

        relation_plugin & rel_plugin = *rmgr.get_relation_plugin(params.get_sym("default_relation", symbol("sparse")));
        ENSURE(&rel_plugin);
        finite_product_relation_plugin plg(rel_plugin, rmgr);

        sort_ref byte_srt_ref(dl_util.mk_sort(symbol("BYTE"), 256), m);
        relation_sort byte_srt = byte_srt_ref;

        relation_signature sig2;
        sig2.push_back(byte_srt);
        sig2.push_back(byte_srt);
        relation_signature sig3(sig2);
        sig3.push_back(byte_srt);
        relation_signature sig4(sig3);
        sig4.push_back(byte_srt);

        app_ref seven_ref(dl_util.mk_numeral(7, byte_srt), m);
        app_ref nine_ref(dl_util.mk_numeral(9, byte_srt), m);

        relation_element seven = seven_ref;
        relation_element nine = nine_ref;

        relation_fact f7(m);
        f7.push_back(seven);
        relation_fact f9(m);
        f9.push_back(nine);

        relation_fact f77(f7);
        f77.push_back(seven);
        relation_fact f79(f7);
        f79.push_back(nine);
        relation_fact f97(f9);
        f97.push_back(seven);
        relation_fact f99(f9);
        f99.push_back(nine);

        relation_fact f779(f77);
        f779.push_back(nine);
        relation_fact f799(f79);
        f799.push_back(nine);
        relation_fact f977(f97);
        f977.push_back(seven);

        relation_fact f7797(f779);
        f7797.push_back(seven);
        relation_fact f7997(f799);
        f7997.push_back(seven);


        bool table_cols2[] = { true, false };
        bool table_cols3[] = { true, false, false };
        bool table_cols4[] = { true, true, false, false };
        scoped_rel<relation_base> r1 = plg.mk_empty(sig2, table_cols2);
        scoped_rel<relation_base> r2 = r1->clone();
        scoped_rel<relation_base> r3 = r2->clone();

        ENSURE(!r1->contains_fact(f77));
        r1->add_fact(f77);
        ENSURE(r1->contains_fact(f77));

        r2->add_fact(f79);
        r3->add_fact(f99);


        r2->display( std::cout << "r2 0\n");
        scoped_rel<relation_base> r4 = r2->clone();
        r2->display( std::cout << "r2 1\n");

        r4->display( std::cout << "r4 0\n");
        ENSURE(!r4->contains_fact(f77));
        ENSURE(r4->contains_fact(f79));
        r4->add_fact(f77);
        r4->display( std::cout << "r4 1\n");
        ENSURE(r4->contains_fact(f77));
        ENSURE(r4->contains_fact(f79));
        r4->add_fact(f99);
        r4->display( std::cout << "r4 2\n");
        ENSURE(r4->contains_fact(f99));


        std::cout << "------ testing union ------\n";
        r2->display( std::cout << "r2\n");
        scoped_ptr<relation_union_fn> union_op = rmgr.mk_union_fn(*r1, *r2, r3.get());
        ENSURE(union_op);
        (*union_op)(*r1, *r2, r3.get());

        r1->display( std::cout << "r1\n");
        r2->display( std::cout << "r2\n");
        r3->display( std::cout << "r3\n");

        ENSURE(r1->contains_fact(f77));
        ENSURE(r1->contains_fact(f79));
        ENSURE(!r1->contains_fact(f99));

        ENSURE(!r3->contains_fact(f77));
        ENSURE(r3->contains_fact(f79));
        ENSURE(r3->contains_fact(f99));

        std::cout << "------ testing join ------\n";

        r1->reset();
        r1->add_fact(f77);
        r1->add_fact(f79);
        r1->add_fact(f97);
        r2->reset();
        r2->add_fact(f97);
        r2->add_fact(f99);

        unsigned col0[] = { 0 };
        unsigned col1[] = { 1 };
        scoped_ptr<relation_join_fn> join_tt = rmgr.mk_join_fn(*r1, *r2, 1, col0, col0);
        scoped_ptr<relation_join_fn> join_tr = rmgr.mk_join_fn(*r1, *r2, 1, col0, col1);
        scoped_ptr<relation_join_fn> join_rr = rmgr.mk_join_fn(*r1, *r2, 1, col1, col1);

        r1->display( std::cout << "r1\n");
        r2->display( std::cout << "r2\n");

        scoped_rel<relation_base> jr_tt = (*join_tt)(*r1, *r2);
        scoped_rel<relation_base> jr_tr = (*join_tr)(*r1, *r2);
        scoped_rel<relation_base> jr_rr = (*join_rr)(*r1, *r2);

        jr_tt->display( std::cout << "tt\n");
        jr_tr->display( std::cout << "tr\n");
        jr_rr->display( std::cout << "rr\n");


        ENSURE(!jr_tt->contains_fact(f7797));
        ENSURE(jr_tr->contains_fact(f7797));
        ENSURE(jr_rr->contains_fact(f7797));


        std::cout << "------ testing project ------\n";

        scoped_rel<relation_base> r31 = plg.mk_empty(sig3, table_cols3);
        r31->add_fact(f779);
        r31->add_fact(f977);
        r31->add_fact(f799);
        
        unsigned rem_1_rel[] = { 1 };
        unsigned rem_2_rel[] = { 1, 2 };
        unsigned rem_1_table[] = { 0 };

        scoped_ptr<relation_transformer_fn> proj_1r = rmgr.mk_project_fn(*r31, 1, rem_1_rel);
        scoped_ptr<relation_transformer_fn> proj_2r = rmgr.mk_project_fn(*r31, 2, rem_2_rel);
        scoped_ptr<relation_transformer_fn> proj_1t = rmgr.mk_project_fn(*r31, 1, rem_1_table);

        scoped_rel<relation_base> sr_1r = (*proj_1r)(*r31);
        scoped_rel<relation_base> sr_2r = (*proj_2r)(*r31);
        scoped_rel<relation_base> sr_1t = (*proj_1t)(*r31);

        ENSURE(sr_1r->contains_fact(f79));
        ENSURE(sr_1r->contains_fact(f97));
        ENSURE(!sr_1r->contains_fact(f77));

        ENSURE(sr_2r->contains_fact(f7));
        ENSURE(sr_2r->contains_fact(f9));

        ENSURE(sr_1t->contains_fact(f79));
        ENSURE(!sr_1t->contains_fact(f97));
        ENSURE(sr_1t->contains_fact(f77));
        ENSURE(sr_1t->contains_fact(f99));

        std::cout << "------ testing filter_interpreted ------\n";

        scoped_rel<relation_base> r41 = plg.mk_empty(sig4, table_cols4);

        r41->add_fact(f7797);
        r41->add_fact(f7997);

        app_ref cond(m.mk_and(
                m.mk_not(m.mk_eq(m.mk_var(1,byte_srt), m.mk_var(2,byte_srt))), //#1!=#2
                m.mk_not(m.mk_eq(m.mk_var(3,byte_srt), m.mk_var(2,byte_srt)))  //#3!=#2
            ), m);
        scoped_ptr<relation_mutator_fn> i_filter = rmgr.mk_filter_interpreted_fn(*r41, cond);
        (*i_filter)(*r41);

        ENSURE(r41->contains_fact(f7797));
        ENSURE(!r41->contains_fact(f7997));

        std::cout << "------ testing filter_by_negation ------\n";

        r31->reset();
        r31->add_fact(f779);
        r31->add_fact(f977);
        r31->add_fact(f799);

        r1->reset();
        r1->add_fact(f77);
        r1->add_fact(f79);

        unsigned nf_r31_cols[] = {1, 0, 1};
        unsigned nf_r1_cols[] = {0, 0, 1};
        scoped_ptr<relation_intersection_filter_fn> neg_filter = rmgr.mk_filter_by_negation_fn(*r31, *r1, 3,
            nf_r31_cols, nf_r1_cols);
        (*neg_filter)(*r31, *r1);

        ENSURE(!r31->contains_fact(f779));
        ENSURE(r31->contains_fact(f977));
        ENSURE(r31->contains_fact(f799));


    }