Ejemplo n.º 1
0
unsigned int reconcile(vec_uint &v1, vec_uint &v2, set_basic &s,
                       const set_basic &s1, const set_basic &s2)
{
    auto i = s1.begin();
    auto j = s2.begin();
    unsigned int pos = 0;

    // Performs a merge of s1 and s2, and builds up v1 and v2 as translators
    // v1[i] and v2[i] is the position of the ith symbol in the new set

    // set union
    s = s1;
    s.insert(s2.begin(), s2.end());

    for (auto &it : s) {
        if (i != s1.end() and eq(*it, **i)) {
            v1.push_back(pos);
            i++;
        }
        if (j != s2.end() and eq(*it, **j)) {
            v2.push_back(pos);
            j++;
        }
        pos++;
    }
    return pos; // return size of the new symbol set
}
Ejemplo n.º 2
0
 void bvisit(const Subs &x) {
     set_basic set_ = free_symbols(*x.get_arg());
     for (const auto &p: x.get_variables()) {
         set_.erase(p);
     }
     s.insert(set_.begin(), set_.end());
     for (const auto &p: x.get_point()) {
         p->accept(*this);
     }
 }
Ejemplo n.º 3
0
 void bvisit(const Symbol &x) {
     s.insert(x.rcp_from_this());
 }