public static Proposition flattenNestedFunctionArguments(Proposition proposition) {
    { Proposition existsproposition = Logic.createProposition(Logic.SYM_STELLA_EXISTS, 1);
      List existsvariables = List.newList();
      List flattenedpropositions = Proposition.yieldFlattenedArguments(proposition, existsvariables);
      Proposition andproposition = Logic.createProposition(Logic.SYM_STELLA_AND, flattenedpropositions.length());

      { Proposition prop = null;
        Cons iter000 = flattenedpropositions.theConsList;
        int i = Stella.NULL_INTEGER;
        int iter001 = 0;

        for (;!(iter000 == Stella.NIL); iter000 = iter000.rest, iter001 = iter001 + 1) {
          prop = ((Proposition)(iter000.value));
          i = iter001;
          (andproposition.arguments.theArray)[i] = prop;
        }
      }
      { PatternVariable vbl = null;
        Cons iter002 = existsvariables.theConsList;

        for (;!(iter002 == Stella.NIL); iter002 = iter002.rest) {
          vbl = ((PatternVariable)(iter002.value));
          vbl.definingProposition = null;
        }
      }
      KeyValueList.setDynamicSlotValue(existsproposition.dynamicSlots, Logic.SYM_LOGIC_IO_VARIABLES, Logic.copyConsListToVariablesVector(existsvariables.theConsList), null);
      existsvariables.free();
      (existsproposition.arguments.theArray)[0] = andproposition;
      return (existsproposition);
    }
  }