public static Cons filterImpliedSkolemPropositions(Cons inheritedprops, Description description, Vector arguments, KeyValueMap mapping) {
    { List createdskolems = ((mapping != null) ? ((List)(mapping.lookup(Logic.KWD_CREATED_SKOLEMS))) : null);
      Cons filteredprops = inheritedprops;
      Cons filteredpropsindices = Stella.NIL;
      QueryIterator query = null;
      Cons cachedqueryrecord = Stella.NIL;

      if (createdskolems != null) {
        { MemoizationTable memoTable000 = null;
          Cons memoizedEntry000 = null;
          Stella_Object memoizedValue000 = null;

          if (Stella.$MEMOIZATION_ENABLEDp$) {
            memoTable000 = ((MemoizationTable)(Logic.SGT_LOGIC_F_FILTER_IMPLIED_SKOLEM_PROPOSITIONS_MEMO_TABLE_000.surrogateValue));
            if (memoTable000 == null) {
              Surrogate.initializeMemoizationTable(Logic.SGT_LOGIC_F_FILTER_IMPLIED_SKOLEM_PROPOSITIONS_MEMO_TABLE_000, "(:MAX-VALUES 500 :TIMESTAMPS (:MODULE-UPDATE))");
              memoTable000 = ((MemoizationTable)(Logic.SGT_LOGIC_F_FILTER_IMPLIED_SKOLEM_PROPOSITIONS_MEMO_TABLE_000.surrogateValue));
            }
            memoizedEntry000 = MruMemoizationTable.lookupMruMemoizedValue(((MruMemoizationTable)(memoTable000)), description, Stella.MEMOIZED_NULL_VALUE, null, null, -1);
            memoizedValue000 = memoizedEntry000.value;
          }
          if (memoizedValue000 != null) {
            if (memoizedValue000 == Stella.MEMOIZED_NULL_VALUE) {
              memoizedValue000 = null;
            }
          }
          else {
            memoizedValue000 = Logic.createSkolemPropositionsQuery(inheritedprops, description, mapping);
            if (Stella.$MEMOIZATION_ENABLEDp$) {
              memoizedEntry000.value = ((memoizedValue000 == null) ? Stella.MEMOIZED_NULL_VALUE : memoizedValue000);
            }
          }
          cachedqueryrecord = ((Cons)(memoizedValue000));
        }
        query = ((QueryIterator)(cachedqueryrecord.value));
        filteredpropsindices = ((Cons)(cachedqueryrecord.rest.value));
        { Stella_Object arg = null;
          Vector vector000 = arguments;
          int index000 = 0;
          int length000 = vector000.length();
          int i = Stella.NULL_INTEGER;
          int iter000 = 0;

          for (;index000 < length000; index000 = index000 + 1, iter000 = iter000 + 1) {
            arg = (vector000.theArray)[index000];
            i = iter000;
            (((Vector)(KeyValueList.dynamicSlotValue(query.dynamicSlots, Logic.SYM_LOGIC_INITIAL_BINDINGS, null))).theArray)[i] = arg;
          }
        }
        { Object old$TypeCheckStrategy$000 = Logic.$TYPE_CHECK_STRATEGY$.get();
          Object old$Queryiterator$000 = Logic.$QUERYITERATOR$.get();
          Object old$ReversepolarityP$000 = Logic.$REVERSEPOLARITYp$.get();
          Object old$Inferencelevel$000 = Logic.$INFERENCELEVEL$.get();
          Object old$GenerateAllProofsP$000 = Logic.$GENERATE_ALL_PROOFSp$.get();

          try {
            Native.setSpecial(Logic.$TYPE_CHECK_STRATEGY$, Logic.KWD_NONE);
            Native.setSpecial(Logic.$QUERYITERATOR$, query);
            Native.setBooleanSpecial(Logic.$REVERSEPOLARITYp$, false);
            Native.setSpecial(Logic.$INFERENCELEVEL$, Logic.SUBSUMPTION_INFERENCE);
            Native.setBooleanSpecial(Logic.$GENERATE_ALL_PROOFSp$, false);
            query.reset();
            if (query.nextP()) {
              filteredprops = Stella.NIL;
              { IntegerWrapper i = null;
                Cons iter001 = filteredpropsindices;
                Cons collect000 = null;

                for (;!(iter001 == Stella.NIL); iter001 = iter001.rest) {
                  i = ((IntegerWrapper)(iter001.value));
                  if (collect000 == null) {
                    {
                      collect000 = Cons.cons(((Proposition)(inheritedprops.nth(i.wrapperValue))), Stella.NIL);
                      if (filteredprops == Stella.NIL) {
                        filteredprops = collect000;
                      }
                      else {
                        Cons.addConsToEndOfConsList(filteredprops, collect000);
                      }
                    }
                  }
                  else {
                    {
                      collect000.rest = Cons.cons(((Proposition)(inheritedprops.nth(i.wrapperValue))), Stella.NIL);
                      collect000 = collect000.rest;
                    }
                  }
                }
              }
            }

          } finally {
            Logic.$GENERATE_ALL_PROOFSp$.set(old$GenerateAllProofsP$000);
            Logic.$INFERENCELEVEL$.set(old$Inferencelevel$000);
            Logic.$REVERSEPOLARITYp$.set(old$ReversepolarityP$000);
            Logic.$QUERYITERATOR$.set(old$Queryiterator$000);
            Logic.$TYPE_CHECK_STRATEGY$.set(old$TypeCheckStrategy$000);
          }
        }
      }
      return (filteredprops);
    }
  }