public static Keyword holdsSpecialist(ControlFrame frame, Keyword lastmove) {
    { Proposition holdsproposition = frame.proposition;
      Vector holdsarguments = holdsproposition.arguments;
      int holdsarity = holdsarguments.length() - 1;
      Stella_Object description = Logic.argumentBoundTo((holdsarguments.theArray)[0]);

      if (description != null) {
        if (lastmove == Logic.KWD_UP_TRUE) {
          return (((frame.down != null) ? Logic.KWD_CONTINUING_SUCCESS : Logic.KWD_FINAL_SUCCESS));
        }
        else if (lastmove == Logic.KWD_UP_FAIL) {
          return (Logic.KWD_FAILURE);
        }
        else if (lastmove == Logic.KWD_DOWN) {
        }
        else {
          { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

            stream000.nativeStream.print("`" + lastmove + "' is not a valid case option");
            throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
          }
        }
        { Surrogate testValue000 = Stella_Object.safePrimaryType(description);

          if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_NAMED_DESCRIPTION)) {
            { NamedDescription description000 = ((NamedDescription)(description));

              { int argcountminus1 = holdsarguments.length() - 1;
                Symbol kind = Logic.SYM_STELLA_PREDICATE;
                Proposition relationproposition = null;
                Surrogate relationref = description000.surrogateValueInverse;

                if (NamedDescription.classDescriptionP(description000)) {
                  kind = Logic.SYM_STELLA_ISA;
                }
                else if (NamedDescription.functionDescriptionP(description000)) {
                  kind = Logic.SYM_STELLA_FUNCTION;
                }
                relationproposition = Logic.createProposition(kind, argcountminus1);
                relationproposition.operator = relationref;
                { int i = Stella.NULL_INTEGER;
                  int iter000 = 0;
                  int upperBound000 = argcountminus1 - 1;

                  for (;iter000 <= upperBound000; iter000 = iter000 + 1) {
                    i = iter000;
                    (relationproposition.arguments.theArray)[i] = ((holdsarguments.theArray)[(i + 1)]);
                  }
                }
                ControlFrame.createSubgoalFrame(frame, relationproposition, null);
                return (Logic.KWD_MOVE_DOWN);
              }
            }
          }
          else if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_DESCRIPTION)) {
            { Description description000 = ((Description)(description));

              { int argcountminus1 = holdsarguments.length() - 1;
                Proposition dummyproposition = Logic.createProposition(Logic.SYM_STELLA_DUMMY, argcountminus1);
                ControlFrame subgoalframe = ControlFrame.createSubgoalFrame(frame, dummyproposition, Logic.KWD_FULL_SUBQUERY);

                { int i = Stella.NULL_INTEGER;
                  int iter001 = 0;
                  int upperBound001 = argcountminus1 - 1;

                  for (;iter001 <= upperBound001; iter001 = iter001 + 1) {
                    i = iter001;
                    (dummyproposition.arguments.theArray)[i] = ((holdsarguments.theArray)[(i + 1)]);
                  }
                }
                KeyValueList.setDynamicSlotValue(subgoalframe.dynamicSlots, Logic.SYM_LOGIC_DESCRIPTION, description000, null);
                return (Logic.KWD_MOVE_DOWN);
              }
            }
          }
          else {
          }
        }
      }
      else {
        { Iterator iterator = ((Iterator)(KeyValueList.dynamicSlotValue(frame.dynamicSlots, Logic.SYM_STELLA_ITERATOR, null)));
          Stella_Object backlinkedarg = null;
          int backlinkedargposition = -1;
          boolean nomatchesP = false;

          nomatchesP = nomatchesP;
          if (iterator == null) {
            { Object [] caller_MV_returnarray = new Object[1];

              backlinkedarg = Proposition.selectArgumentWithBacklinks(holdsproposition, caller_MV_returnarray);
              nomatchesP = ((boolean)(((BooleanWrapper)(caller_MV_returnarray[0])).wrapperValue));
            }
            if (backlinkedarg != null) {
              { int value000 = Stella.NULL_INTEGER;

                { int i = Stella.NULL_INTEGER;
                  IntegerIntervalIterator iter002 = Stella.interval(-1, Stella.NULL_INTEGER);
                  Stella_Object arg = null;
                  Vector vector000 = holdsarguments;
                  int index000 = 0;
                  int length000 = vector000.length();

                  loop002 : for (;iter002.nextP() &&
                            (index000 < length000); index000 = index000 + 1) {
                    i = iter002.value;
                    arg = (vector000.theArray)[index000];
                    if ((i >= 0) &&
                        Stella_Object.eqlP(backlinkedarg, Logic.argumentBoundTo(arg))) {
                      value000 = i;
                      break loop002;
                    }
                  }
                }
                backlinkedargposition = value000;
              }
              { Cons value001 = Stella.NIL;

                { Proposition prop = null;
                  Iterator iter003 = Logic.unfilteredDependentPropositions(backlinkedarg, null).allocateIterator();
                  Cons collect000 = null;

                  while (iter003.nextP()) {
                    prop = ((Proposition)(iter003.value));
                    if (((prop.kind == Logic.KWD_FUNCTION) ||
                        ((prop.kind == Logic.KWD_PREDICATE) ||
                         (prop.kind == Logic.KWD_ISA))) &&
                        ((prop.arguments.length() == holdsarity) &&
                         (((!prop.deletedP()) &&
                        ((((Boolean)(Logic.$REVERSEPOLARITYp$.get())).booleanValue() ? Proposition.falseP(prop) : (Proposition.trueP(prop) ||
                        Proposition.functionWithDefinedValueP(prop))))) &&
                          (prop.arguments.position(backlinkedarg, 0) == backlinkedargposition)))) {
                      if (collect000 == null) {
                        {
                          collect000 = Cons.cons(prop, Stella.NIL);
                          if (value001 == Stella.NIL) {
                            value001 = collect000;
                          }
                          else {
                            Cons.addConsToEndOfConsList(value001, collect000);
                          }
                        }
                      }
                      else {
                        {
                          collect000.rest = Cons.cons(prop, Stella.NIL);
                          collect000 = collect000.rest;
                        }
                      }
                    }
                  }
                }
                iterator = value001.allocateIterator();
              }
            }
            KeyValueList.setDynamicSlotValue(frame.dynamicSlots, Logic.SYM_STELLA_ITERATOR, iterator, null);
          }
          if (iterator != null) {
            { PatternRecord patternrecord = ((QueryIterator)(Logic.$QUERYITERATOR$.get())).currentPatternRecord;
              int ubstackoffset = patternrecord.topUnbindingStackOffset;

              { Proposition prop = null;
                Iterator iter004 = ((Iterator)(iterator));

                loop004 : while (iter004.nextP()) {
                  prop = ((Proposition)(iter004.value));
                  if (!(PatternVariable.bindVariableToValueP(((PatternVariable)((holdsarguments.theArray)[0])), Logic.getDescription(((Surrogate)(prop.operator))), true))) {
                    continue loop004;
                  }
                  { boolean alwaysP000 = true;

                    { Stella_Object arg = null;
                      Vector vector001 = holdsarguments;
                      int index001 = 0;
                      int length001 = vector001.length();
                      int i = Stella.NULL_INTEGER;
                      int iter005 = -1;

                      loop005 : for (;index001 < length001; index001 = index001 + 1, iter005 = iter005 + 1) {
                        arg = (vector001.theArray)[index001];
                        i = iter005;
                        if (i >= 0) {
                          if (!Logic.bindArgumentToValueP(arg, (prop.arguments.theArray)[i], true)) {
                            alwaysP000 = false;
                            break loop005;
                          }
                        }
                      }
                    }
                    if (alwaysP000) {
                      return (Logic.KWD_CONTINUING_SUCCESS);
                    }
                  }
                  PatternRecord.unbindVariablesBeginningAt(patternrecord, ubstackoffset + 1);
                }
              }
            }
          }
        }
      }
      return (Logic.KWD_FAILURE);
    }
  }