public static Keyword memberOfSpecialist(ControlFrame frame, Keyword lastmove) {
    { Proposition proposition = frame.proposition;
      Vector arguments = proposition.arguments;
      Stella_Object memberarg = (arguments.theArray)[0];
      Stella_Object member = Logic.argumentBoundTo(memberarg);
      Stella_Object collectionarg = (arguments.theArray)[1];
      Stella_Object collection = Logic.argumentBoundTo(collectionarg);
      Iterator iterator = ((Iterator)(KeyValueList.dynamicSlotValue(frame.dynamicSlots, Logic.SYM_STELLA_ITERATOR, 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 (iterator == null) {
        if (collection == null) {
          if (member == null) {
            return (Logic.KWD_FAILURE);
          }
          iterator = ((ListIterator)(Logic.enumerationsContainingMember(member).allocateIterator()));
        }
        else {
          { Surrogate testValue000 = Stella_Object.safePrimaryType(collection);

            if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_NAMED_DESCRIPTION)) {
              { NamedDescription collection000 = ((NamedDescription)(collection));

                { Proposition isaprop = Logic.createProposition(Logic.SYM_STELLA_ISA, 1);

                  isaprop.operator = collection000.surrogateValueInverse;
                  (isaprop.arguments.theArray)[0] = memberarg;
                  ControlFrame.createDownFrame(frame, isaprop);
                  return (Logic.KWD_MOVE_DOWN);
                }
              }
            }
            else if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_DESCRIPTION)) {
              { Description collection000 = ((Description)(collection));

                { boolean testValue001 = false;

                  testValue001 = collection000.arity() == 1;
                  if (testValue001) {
                    if (((Vector)(KeyValueList.dynamicSlotValue(collection000.dynamicSlots, Logic.SYM_LOGIC_EXTERNAL_VARIABLES, null))) == null) {
                      testValue001 = true;
                    }
                    else {
                      { boolean alwaysP000 = true;

                        { PatternVariable var = null;
                          Vector vector000 = ((Vector)(KeyValueList.dynamicSlotValue(collection000.dynamicSlots, Logic.SYM_LOGIC_EXTERNAL_VARIABLES, null)));
                          int index000 = 0;
                          int length000 = vector000.length();

                          loop000 : for (;index000 < length000; index000 = index000 + 1) {
                            var = ((PatternVariable)((vector000.theArray)[index000]));
                            if (!(Logic.argumentBoundTo(var) != null)) {
                              alwaysP000 = false;
                              break loop000;
                            }
                          }
                        }
                        testValue001 = alwaysP000;
                      }
                    }
                  }
                  if (testValue001) {
                    {
                      if (ControlFrame.overlayWithPatternFrameP(ControlFrame.createDownFrame(frame, null), collection000, Stella.vector(Cons.cons(memberarg, Stella.NIL)))) {
                        return (Logic.KWD_MOVE_DOWN);
                      }
                      else {
                        return (Logic.KWD_FAILURE);
                      }
                    }
                  }
                  else {
                    {
                      return (Logic.KWD_FAILURE);
                    }
                  }
                }
              }
            }
            else if (Surrogate.subtypeOfP(testValue000, Logic.SGT_STELLA_COLLECTION)) {
              { Collection collection000 = ((Collection)(collection));

                if (member == null) {
                  iterator = ((ListIterator)(Logic.assertedCollectionMembers(collection000, false).allocateIterator()));
                }
                else {
                  return (Logic.selectTestResult(Logic.memberOfCollectionP(member, collection000), false, frame));
                }
              }
            }
            else if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_LOGIC_OBJECT)) {
              { LogicObject collection000 = ((LogicObject)(collection));

                if (member == null) {
                  iterator = ((ListIterator)(Logic.assertedCollectionMembers(collection000, false).allocateIterator()));
                }
                else {
                  return (Logic.selectTestResult(Logic.memberOfCollectionP(member, collection000), false, frame));
                }
              }
            }
            else {
              return (Logic.KWD_FAILURE);
            }
          }
        }
        KeyValueList.setDynamicSlotValue(frame.dynamicSlots, Logic.SYM_STELLA_ITERATOR, iterator, null);
      }
      while (iterator.nextP()) {
        if (collection == null) {
          if (PatternVariable.bindVariableToValueP(((PatternVariable)(collectionarg)), Logic.valueOf(iterator.value), true)) {
            return (Logic.KWD_CONTINUING_SUCCESS);
          }
        }
        else {
          if (PatternVariable.bindVariableToValueP(((PatternVariable)(memberarg)), Logic.valueOf(iterator.value), true)) {
            return (Logic.KWD_CONTINUING_SUCCESS);
          }
        }
      }
      return (Logic.KWD_FAILURE);
    }
  }