当前位置: 首页>>代码示例>>C++>>正文


C++ TNode::isNull方法代码示例

本文整理汇总了C++中TNode::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ TNode::isNull方法的具体用法?C++ TNode::isNull怎么用?C++ TNode::isNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TNode的用法示例。


在下文中一共展示了TNode::isNull方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getNextCandidate

Node CandidateGeneratorQEAll::getNextCandidate() {
  while( !d_eq.isFinished() ){
    TNode n = (*d_eq);
    ++d_eq;
    if( n.getType().isSubtypeOf( d_match_pattern_type ) ){
      TNode nh = d_qe->getTermDatabase()->getEligibleTermInEqc( n );
      if( !nh.isNull() ){
        if( options::instMaxLevel()!=-1 || options::lteRestrictInstClosure() ){
          nh = d_qe->getEqualityQuery()->getInternalRepresentative( nh, d_f, d_index );
          //don't consider this if already the instantiation is ineligible
          if( !d_qe->getTermDatabase()->isTermEligibleForInstantiation( nh, d_f, false ) ){
            nh = Node::null();
          }
        }
        if( !nh.isNull() ){
          d_firstTime = false;
          //an equivalence class with the same type as the pattern, return it
          return nh;
        }
      }
    }
  }
  if( d_firstTime ){
    Assert( d_qe->getTermDatabase()->d_type_map[d_match_pattern_type].empty() );
    //must return something
    d_firstTime = false;
    return d_qe->getTermDatabase()->getModelBasisTerm( d_match_pattern_type );
  }
  return Node::null();
}
开发者ID:kbansal,项目名称:CVC4,代码行数:30,代码来源:candidate_generator.cpp

示例2: getCongruentTerm

TNode EqualityQueryInstProp::getCongruentTerm( Node f, std::vector< TNode >& args ) {
  TNode t = d_qe->getTermDatabase()->getCongruentTerm( f, args );
  if( !t.isNull() ){
    return t;
  }else{
    //TODO?
    return TNode::null();
  }
}
开发者ID:pallekc,项目名称:CVC4,代码行数:9,代码来源:inst_propagator.cpp

示例3: construct_def_entry

void AbsDef::construct_def_entry( FirstOrderModelAbs * m, TNode q, TNode n, int v, unsigned depth ) {
  d_value = v;
  if( depth<n.getNumChildren() ){
    TypeNode tn = q.isNull() ? n[depth].getType() : m->getVariable( q, depth ).getType();
    unsigned dom = m->d_domain[tn] ;
    d_def[dom].construct_def_entry( m, q, n, v, depth+1 );
    d_default = dom;
  }
}
开发者ID:jinala,项目名称:CVC4,代码行数:9,代码来源:ambqi_builder.cpp

示例4: getNextTheoryDecisionRequest

SatLiteral TheoryProxy::getNextTheoryDecisionRequest() {
  TNode n = d_theoryEngine->getNextDecisionRequest();
  return n.isNull() ? undefSatLiteral : d_cnfStream->getLiteral(n);
}
开发者ID:neuroo,项目名称:CVC4,代码行数:4,代码来源:theory_proxy.cpp

示例5: evaluateTermExp

//this is identical to TermDb::evaluateTerm2, but tracks more information
Node EqualityQueryInstProp::evaluateTermExp( Node n, std::vector< Node >& exp, std::map< Node, Node >& visited, bool hasPol, bool pol,
                                             std::map< Node, bool >& watch_list_out, std::vector< Node >& props ) {
  std::map< Node, Node >::iterator itv = visited.find( n );
  if( itv != visited.end() ){
    return itv->second;
  }else{
    visited[n] = n;
    Trace("qip-eval") << "evaluate term : " << n << std::endl;
    std::vector< Node > exp_n;
    Node ret = getRepresentativeExp( n, exp_n );
    if( ret.isNull() ){
      //term is not known to be equal to a representative in equality engine, evaluate it
      Kind k = n.getKind();
      if( k==FORALL ){
        ret = Node::null();
      }else{
        std::map< Node, bool > watch_list_out_curr;
        TNode f = d_qe->getTermDatabase()->getMatchOperator( n );
        std::vector< Node > args;
        bool ret_set = false;
        bool childChanged = false;
        int abort_i = -1;
        //get the child entailed polarity
        Assert( n.getKind()!=IMPLIES );
        bool newHasPol, newPol;
        QuantPhaseReq::getEntailPolarity( n, 0, hasPol, pol, newHasPol, newPol );
        //for each child
        for( unsigned i=0; i<n.getNumChildren(); i++ ){
          Node c = evaluateTermExp( n[i], exp, visited, newHasPol, newPol, watch_list_out_curr, props );
          if( c.isNull() ){
            ret = Node::null();
            ret_set = true;
            break;
          }else if( c==d_true || c==d_false ){
            //short-circuiting
            if( k==kind::AND || k==kind::OR ){
              if( (k==kind::AND)==(c==d_false) ){
                ret = c;
                ret_set = true;
                break;
              }else{
                //redundant
                c = Node::null();
                childChanged = true;
              }
            }else if( k==kind::ITE && i==0 ){
              Assert( watch_list_out_curr.empty() );
              ret = evaluateTermExp( n[ c==d_true ? 1 : 2], exp, visited, hasPol, pol, watch_list_out_curr, props );
              ret_set = true;
              break;
            }else if( k==kind::NOT ){
              ret = c==d_true ? d_false : d_true;
              ret_set = true;
              break;
            }
          }
          if( !c.isNull() ){
            childChanged = childChanged || n[i]!=c;
            if( !f.isNull() && !watch_list_out_curr.empty() ){
              // we are done if this is an UF application and an argument is unevaluated
              args.push_back( c );
              abort_i = i;
              break;
            }else if( ( k==kind::AND || k==kind::OR ) ){
              if( c.getKind()==k ){
                //flatten
                for( unsigned j=0; j<c.getNumChildren(); j++ ){
                  addArgument( args, props, c[j], newHasPol, newPol );
                }
              }else{
                addArgument( args, props, c, newHasPol, newPol );
              }
              //if we are in a branching position
              if( hasPol && !newHasPol && args.size()>=2 ){
                //we are done if at least two args are unevaluated
                abort_i = i;
                break;
              }
            }else if( k==kind::ITE ){
              //we are done if we are ITE and condition is unevaluated
              Assert( i==0 );
              args.push_back( c );
              abort_i = i;
              break;
            }else{
              args.push_back( c );
            }
          }
        }
        //add remaining children if we aborted
        if( abort_i!=-1 ){
          for( int i=(abort_i+1); i<(int)n.getNumChildren(); i++ ){
            args.push_back( n[i] );
          }
        }
        //copy over the watch list
        for( std::map< Node, bool >::iterator itc = watch_list_out_curr.begin(); itc != watch_list_out_curr.end(); ++itc ){
          watch_list_out[itc->first] = itc->second;
        }
//.........这里部分代码省略.........
开发者ID:pallekc,项目名称:CVC4,代码行数:101,代码来源:inst_propagator.cpp

示例6: processUnconstrained

void UnconstrainedSimplifier::processUnconstrained()
{
  TNodeSet::iterator it = d_unconstrained.begin(), iend = d_unconstrained.end();
  vector<TNode> workList;
  for ( ; it != iend; ++it) {
    workList.push_back(*it);
  }
  Node currentSub;
  TNode parent;
  bool swap;
  bool isSigned;
  bool strict;
  vector<TNode> delayQueueLeft;
  vector<Node> delayQueueRight;

  TNode current = workList.back();
  workList.pop_back();
  for (;;) {
    Assert(d_visitedOnce.find(current) != d_visitedOnce.end());
    parent = d_visitedOnce[current];
    if (!parent.isNull()) {
      swap = isSigned = strict = false;
      switch (parent.getKind()) {

        // If-then-else operator - any two unconstrained children makes the parent unconstrained
        case kind::ITE: {
          Assert(parent[0] == current || parent[1] == current || parent[2] == current);
          bool uCond = parent[0] == current || d_unconstrained.find(parent[0]) != d_unconstrained.end();
          bool uThen = parent[1] == current || d_unconstrained.find(parent[1]) != d_unconstrained.end();
          bool uElse = parent[2] == current || d_unconstrained.find(parent[2]) != d_unconstrained.end();
          if ((uCond && uThen) || (uCond && uElse) || (uThen && uElse)) {
            if (d_unconstrained.find(parent) == d_unconstrained.end() &&
                !d_substitutions.hasSubstitution(parent)) {
              ++d_numUnconstrainedElim;
              if (uThen) {
                if (parent[1] != current) {
                  if (parent[1].isVar()) {
                    currentSub = parent[1];
                  }
                  else {
                    Assert(d_substitutions.hasSubstitution(parent[1]));
                    currentSub = d_substitutions.apply(parent[1]);
                  }
                }
                else if (currentSub.isNull()) {
                  currentSub = current;
                }
              }
              else if (parent[2] != current) {
                if (parent[2].isVar()) {
                  currentSub = parent[2];
                }
                else {
                  Assert(d_substitutions.hasSubstitution(parent[2]));
                  currentSub = d_substitutions.apply(parent[2]);
                }
              }
              else if (currentSub.isNull()) {
                currentSub = current;
              }
              current = parent;
            }
            else {
              currentSub = Node();
            }
          }
          else if (uCond) {
            Cardinality card = parent.getType().getCardinality();
            if (card.isFinite() && !card.isLargeFinite() && card.getFiniteCardinality() == 2) {
              // Special case: condition is unconstrained, then and else are different, and total cardinality of the type is 2, then the result
              // is unconstrained
              Node test;
              if (parent.getType().isBoolean()) {
                test = Rewriter::rewrite(parent[1].iffNode(parent[2]));
              }
              else {
                test = Rewriter::rewrite(parent[1].eqNode(parent[2]));
              }
              if (test == NodeManager::currentNM()->mkConst<bool>(false)) {
                ++d_numUnconstrainedElim;
                if (currentSub.isNull()) {
                  currentSub = current;
                }
                currentSub = newUnconstrainedVar(parent.getType(), currentSub);
                current = parent;
              }
            }
          }
          break;
        }

        // Comparisons that return a different type - assuming domains are larger than 1, any
        // unconstrained child makes parent unconstrained as well
        case kind::EQUAL:
          if (parent[0].getType() != parent[1].getType()) {
            TNode other = (parent[0] == current) ? parent[1] : parent[0];
            if (current.getType().isSubtypeOf(other.getType())) {
              break;
            }
          }
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


注:本文中的TNode::isNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。