public static void collectUnboundGoalVariables(Proposition goal, List unboundvariables) {
    { Stella_Object arg = null;
      Vector vector000 = goal.arguments;
      int index000 = 0;
      int length000 = vector000.length();

      for (;index000 < length000; index000 = index000 + 1) {
        arg = (vector000.theArray)[index000];
        { Surrogate testValue000 = Stella_Object.safePrimaryType(arg);

          if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_PATTERN_VARIABLE)) {
            { PatternVariable arg000 = ((PatternVariable)(arg));

              if (Logic.unboundVariableP(arg000)) {
                unboundvariables.insertNew(arg000);
              }
            }
          }
          else if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_PROPOSITION)) {
            { Proposition arg000 = ((Proposition)(arg));

              Proposition.collectUnboundGoalVariables(arg000, unboundvariables);
              { Keyword testValue001 = arg000.kind;

                if ((testValue001 == Logic.KWD_FORALL) ||
                    (testValue001 == Logic.KWD_EXISTS)) {
                  { PatternVariable var = null;
                    Vector vector001 = ((Vector)(KeyValueList.dynamicSlotValue(arg000.dynamicSlots, Logic.SYM_LOGIC_IO_VARIABLES, null)));
                    int index001 = 0;
                    int length001 = vector001.length();

                    for (;index001 < length001; index001 = index001 + 1) {
                      var = ((PatternVariable)((vector001.theArray)[index001]));
                      unboundvariables.remove(var);
                    }
                  }
                }
                else {
                }
              }
            }
          }
          else {
          }
        }
      }
    }
  }