public static Description extractGoalDescription(Proposition goal, Keyword headortail) {
    { Vector arguments = goal.arguments;

      { Keyword testValue000 = goal.kind;

        if ((testValue000 == Logic.KWD_ISA) ||
            ((testValue000 == Logic.KWD_PREDICATE) ||
             ((testValue000 == Logic.KWD_FUNCTION) ||
              (testValue000 == Logic.KWD_IMPLIES)))) {
          if (Stella_Object.isaP(goal.operator, Logic.SGT_STELLA_SURROGATE)) {
            { NamedDescription description = Logic.getDescription(((Surrogate)(goal.operator)));

              if (description == null) {
                { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

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

                    try {
                      Native.setBooleanSpecial(Stella.$PRINTREADABLYp$, true);
                      stream000.nativeStream.println("ERROR: Can't finalize relations because relation `" + ((Surrogate)(goal.operator)).symbolName + "' is undefined..");
                      Logic.helpSignalPropositionError(stream000, Logic.KWD_ERROR);

                    } finally {
                      Stella.$PRINTREADABLYp$.set(old$PrintreadablyP$000);
                    }
                  }
                  throw ((PropositionError)(PropositionError.newPropositionError(stream000.theStringReader()).fillInStackTrace()));
                }
              }
              if (NamedDescription.chainableRelationP(description, headortail)) {
                return (description);
              }
            }
          }
        }
        else if (testValue000 == Logic.KWD_NOT) {
          { Description argumentdescription = Proposition.extractGoalDescription(((Proposition)((arguments.theArray)[0])), headortail);

            if (argumentdescription != null) {
              return (NamedDescription.getComplementOfGoalDescription(((NamedDescription)(argumentdescription))));
            }
          }
        }
        else {
        }
      }
      return (null);
    }
  }