public static LogicObject evaluatePredicate(GeneralizedSymbol name, Stella_Object firstargument) {
    { Surrogate surrogate = null;
      LogicObject predicatevalue = null;

      { Surrogate testValue000 = Stella_Object.safePrimaryType(name);

        if (Surrogate.subtypeOfSymbolP(testValue000)) {
          { Symbol name000 = ((Symbol)(name));

            surrogate = Symbol.symbolToSurrogate(name000);
          }
        }
        else if (Surrogate.subtypeOfSurrogateP(testValue000)) {
          { Surrogate name000 = ((Surrogate)(name));

            surrogate = name000;
          }
        }
        else {
          { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

            stream000.nativeStream.print("`" + testValue000 + "' is not a valid case option");
            throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
          }
        }
      }
      predicatevalue = Logic.getDescription(surrogate);
      if (predicatevalue != null) {
        return (predicatevalue);
      }
      else {
        {
          predicatevalue = ((LogicObject)(surrogate.surrogateValue));
          if ((predicatevalue != null) &&
              (Logic.testIsaP(predicatevalue, Logic.SGT_PL_KERNEL_KB_RELATION) &&
               LogicObject.nonPolymorphicPredicateP(predicatevalue))) {
            return (predicatevalue);
          }
        }
      }
      if (firstargument != null) {
        { Stella_Object firstargvalue = Logic.valueOf(firstargument);
          Symbol symbol = Surrogate.surrogateToSymbol(surrogate);

          if (firstargvalue == null) {
            Logic.signalUndefinedTerm(firstargument);
          }
          surrogate = Logic.lookupSlotrefOnInstance(firstargvalue, symbol);
          if (surrogate != null) {
            return (Logic.getDescription(Logic.mostGeneralEquivalentSlotref(surrogate)));
          }
        }
      }
      return (null);
    }
  }