Exemplo n.º 1
0
//
// Exists v: (f1 | ... | fn) = (Exists v: f1) | ... | (Exists v: fn)
//
void F_Exists::rearrange() {
  Formula* child = children().front();
  switch(child->node_type()) {
  case Op_Or:
  case Op_Conjunct:
  case Op_Exists:
    child->push_exists(myLocals);
    parent().remove_child(this);
    parent().add_child(child);
    children().remove_front();
    delete this;
    break;
  default:
    break;
  }

  child->rearrange();
}
Exemplo n.º 2
0
//
// Push nots down the tree until quantifier or conjunct, rearrange kids
//
void F_Not::rearrange() {
  Formula *child = children().front();
  Formula *new_child, *f;

  switch(child->node_type()) {
  case Op_Or:
    parent().remove_child(this);
    new_child = parent().add_and();
    while(!child->children().empty()) {
      f = child->children().remove_front(); 
      F_Not *new_not = new_child->add_not(); 
      new_not->add_child(f); 
    }
    delete this;
    break;
//case Op_And:
//  parent().remove_child(this);
//  new_child = parent().add_or();
//  while(!child->myChildren.empty()) {
//    f = child->myChildren.remove_front(); 
//    F_Not *new_not = new_child->add_not(); 
//    new_not->add_child(f); 
//  }
//  delete this;
//  break;
  case Op_Not:
    parent().remove_child(this);
    f = child->children().remove_front(); 
    parent().add_child(f);
    delete this;
    f->rearrange();
    return;
  default:
    new_child = child;
    break;
  }

  new_child->rearrange();
}