public static boolean createGoalCacheP(ControlFrame frame) {
    { Proposition goal = frame.proposition;
      KeyValueList table = Proposition.findGoalCacheTable(goal);

      if (table == null) {
        table = KeyValueList.newKeyValueList();
        { Keyword testValue000 = goal.kind;

          if ((testValue000 == Logic.KWD_ISA) ||
              ((testValue000 == Logic.KWD_PREDICATE) ||
               (testValue000 == Logic.KWD_FUNCTION))) {
            if (goal.operator.primaryType() == Logic.SGT_STELLA_SURROGATE) {
              { NamedDescription goaldescription = Logic.getDescription(((Surrogate)(goal.operator)));

                if (((Boolean)(Logic.$REVERSEPOLARITYp$.get())).booleanValue()) {
                  KeyValueList.setDynamicSlotValue(goaldescription.dynamicSlots, Logic.SYM_LOGIC_NEGATED_GOAL_CACHE_TABLE, table, null);
                }
                else {
                  KeyValueList.setDynamicSlotValue(goaldescription.dynamicSlots, Logic.SYM_LOGIC_GOAL_CACHE_TABLE, table, null);
                }
              }
            }
            else {
              return (false);
            }
          }
          else {
            return (false);
          }
        }
      }
      { GoalCache goalcache = Logic.lookupGoalCache(table);

        if (goalcache == null) {
          Logic.traceGoalCache("CREATING GOAL CACHE: ", frame);
          goalcache = GoalCache.newGoalCache();
          Logic.removeObsoleteGoalCaches(table);
          table.insertAt(((Context)(Stella.$CONTEXT$.get())), goalcache);
          KeyValueList.setDynamicSlotValue(frame.dynamicSlots, Logic.SYM_LOGIC_GOAL_CACHE, goalcache, null);
          goalcache.timestamp = Logic.getNowTimestamp();
          goalcache.proposition = goal;
          goalcache.reversePolarityP = ((Boolean)(Logic.$REVERSEPOLARITYp$.get())).booleanValue();
          goalcache.cacheContext = ((Context)(Stella.$CONTEXT$.get()));
          ((QueryIterator)(Logic.$QUERYITERATOR$.get())).activeGoalCaches.insert(goalcache);
          if (Logic.topLevelQueryContextP(((Context)(Stella.$CONTEXT$.get())))) {
            ((QueryIterator)(Logic.$QUERYITERATOR$.get())).augmentedGoalCacheP = true;
          }
        }
        return (true);
      }
    }
  }