public static Stella_Object evaluateFunctionTerm(Cons tree) {
    if (!(Stella_Object.isaP(tree.value, Logic.SGT_STELLA_GENERALIZED_SYMBOL))) {
      { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

        { Object old$PrintreadablyP$000 = Stella.$PRINTREADABLYp$.get();

          try {
            Native.setBooleanSpecial(Stella.$PRINTREADABLYp$, true);
            stream000.nativeStream.println("ERROR: Illegal function name in function term: `" + tree + "'.");
            Logic.helpSignalPropositionError(stream000, Logic.KWD_ERROR);

          } finally {
            Stella.$PRINTREADABLYp$.set(old$PrintreadablyP$000);
          }
        }
        throw ((PropositionError)(PropositionError.newPropositionError(stream000.theStringReader()).fillInStackTrace()));
      }
    }
    { GeneralizedSymbol name = ((GeneralizedSymbol)(tree.value));
      Stella_Object firstargument = Logic.evaluateFirstArgument(tree.rest.value, ((Symbol)(name)));
      LogicObject predicatevalue = Logic.evaluatePredicate(name, firstargument);
      Cons inputarguments = LogicObject.evaluateRemainingArguments(predicatevalue, tree.rest.rest);

      if ((predicatevalue != null) &&
          (Stella_Object.isaP(predicatevalue, Logic.SGT_LOGIC_DESCRIPTION) &&
           (!NamedDescription.functionDescriptionP(((NamedDescription)(predicatevalue)))))) {
        { OutputStringStream stream001 = OutputStringStream.newOutputStringStream();

          { Object old$PrintreadablyP$001 = Stella.$PRINTREADABLYp$.get();

            try {
              Native.setBooleanSpecial(Stella.$PRINTREADABLYp$, true);
              stream001.nativeStream.println("ERROR: Relation `" + ((NamedDescription)(predicatevalue)).descriptionName() + "' found in function position..");
              Logic.helpSignalPropositionError(stream001, Logic.KWD_ERROR);

            } finally {
              Stella.$PRINTREADABLYp$.set(old$PrintreadablyP$001);
            }
          }
          throw ((PropositionError)(PropositionError.newPropositionError(stream001.theStringReader()).fillInStackTrace()));
        }
      }
      inputarguments = Cons.cons(firstargument, inputarguments);
      if ((predicatevalue != null) &&
          (Logic.objectSurrogate(predicatevalue) == Logic.SGT_PL_KERNEL_KB_SETOF)) {
        inputarguments = Logic.normalizeSetofArguments(inputarguments);
      }
      { Proposition functionproposition = Logic.findOrCreateFunctionProposition(((predicatevalue != null) ? predicatevalue.surrogateValueInverse : name), inputarguments);

        if (Stella_Object.symbolP(functionproposition.operator) &&
            (!Logic.descriptionModeP())) {
          Proposition.complainAboutUndeclaredReference(functionproposition);
          Proposition.createDummyRelation(functionproposition);
        }
        return ((functionproposition.arguments.theArray)[(functionproposition.arguments.length() - 1)]);
      }
    }
  }