示例#1
0
  public boolean subtermDefEqNoAnno(Context ctxt, Expr e) {
    // This check is captured below, all arguments always evaluated for a terminating term
    //
    // If it's a TermApp of a constructor, we need to look at all the sub expressions
    // if (head.construct == CONST && ctxt.isTermCtor((Const)head)) {
    //    for (int i = 0; i < X.length; i++)
    //	//if (X[i].defEqNoAnno(ctxt, e))
    //	if (X[i].subtermDefEqNoAnno(ctxt, e))
    //	    return true;
    //    return false;
    // } else {

    // Same as the head?
    // Same as the whole application? ("this")
    if (head.subtermDefEqNoAnno(ctxt, e) || super.subtermDefEqNoAnno(ctxt, e)) return true;
    // In our CBV instantiated function evaluation scheme, all arguments are evaluated, so check
    // equality
    for (int i = 0; i < X.length; i++) if (X[i].subtermDefEqNoAnno(ctxt, e)) return true;
    // Same as any of the spline form TermApp "heads"?
    for (int i = 0; i < X.length; i++) {
      Expr[] newX = new Expr[i + 1];
      for (int j = 0; j <= i; j++) {
        newX[j] = X[j];
      }
      if (e.defEqNoAnno(ctxt, new TermApp(head, newX), true)) return true;
    }
    return false;

    // }
  }