public static Cons inheritAsTopLevelProposition(Proposition proposition, KeyValueMap mapping) {
    { Cons resultlist = Stella.NIL;

      if (mapping == null) {
        mapping = KeyValueMap.newKeyValueMap();
      }
      { Keyword testValue000 = proposition.kind;

        if (testValue000 == Logic.KWD_AND) {
          { Stella_Object arg = null;
            Vector vector000 = proposition.arguments;
            int index000 = 0;
            int length000 = vector000.length();

            for (;index000 < length000; index000 = index000 + 1) {
              arg = (vector000.theArray)[index000];
              resultlist = Cons.cons(Proposition.inheritProposition(((Proposition)(arg)), mapping), resultlist);
            }
          }
        }
        else if (testValue000 == Logic.KWD_EXISTS) {
          { PatternVariable vbl = null;
            Vector vector001 = ((Vector)(KeyValueList.dynamicSlotValue(proposition.dynamicSlots, Logic.SYM_LOGIC_IO_VARIABLES, null)));
            int index001 = 0;
            int length001 = vector001.length();

            for (;index001 < length001; index001 = index001 + 1) {
              vbl = ((PatternVariable)((vector001.theArray)[index001]));
              PatternVariable.createSkolemForUnmappedVariable(vbl, mapping);
            }
          }
          resultlist = Cons.cons(Proposition.inheritProposition(((Proposition)((proposition.arguments.theArray)[0])), mapping), resultlist);
        }
        else {
          resultlist = Cons.cons(Proposition.inheritProposition(proposition, mapping), resultlist);
        }
      }
      { Stella_Object p = null;
        Cons iter000 = resultlist;

        for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
          p = iter000.value;
          Proposition.normalizeTopLevelProposition(((Proposition)(p)));
        }
      }
      return (resultlist.reverse());
    }
  }