public static Keyword istSpecialist(ControlFrame frame, Keyword lastmove) {
    { Proposition proposition = frame.proposition;
      Stella_Object contextvalue = Logic.argumentBoundTo((proposition.arguments.theArray)[0]);
      SavedContextProofAdjunct adjunct = ((SavedContextProofAdjunct)(((ProofAdjunct)(KeyValueList.dynamicSlotValue(frame.dynamicSlots, Logic.SYM_LOGIC_PROOF_ADJUNCT, null)))));

      if (lastmove == Logic.KWD_DOWN) {
        if (adjunct == null) {
          { Stella_Object propositionvalue = Logic.argumentBoundTo((proposition.arguments.theArray)[1]);

            if ((contextvalue == null) ||
                ((propositionvalue == null) ||
                 (!Stella_Object.isaP(contextvalue, Logic.SGT_STELLA_CONTEXT)))) {
              return (Logic.KWD_TERMINAL_FAILURE);
            }
            { SavedContextProofAdjunct self001 = SavedContextProofAdjunct.newSavedContextProofAdjunct();

              self001.savedContext = ((Context)(Stella.$CONTEXT$.get()));
              self001.downFrame = ControlFrame.createDownFrame(frame, ((Proposition)(propositionvalue)));
              adjunct = self001;
            }
            KeyValueList.setDynamicSlotValue(frame.dynamicSlots, Logic.SYM_LOGIC_PROOF_ADJUNCT, adjunct, null);
          }
        }
        frame.down = adjunct.downFrame;
        Logic.bestInferenceCache(((Context)(contextvalue))).changeContext();
        return (Logic.KWD_MOVE_DOWN);
      }
      else if (lastmove == Logic.KWD_UP_TRUE) {
        ControlFrame.propagateFrameTruthValue(frame.result, frame);
        if ((((QueryIterator)(Logic.$QUERYITERATOR$.get())) != null) &&
            (((QueryIterator)(Logic.$QUERYITERATOR$.get())).partialMatchStrategy != null)) {
          frame.result.partialMatchFrame.propagateFramePartialTruth(frame);
        }
        if (((Boolean)(Logic.$RECORD_JUSTIFICATIONSp$.get())).booleanValue()) {
          { Justification self002 = Justification.newJustification();

            self002.inferenceRule = Logic.KWD_IST_INTRODUCTION;
            self002.antecedents = Cons.cons(((Justification)(KeyValueList.dynamicSlotValue(frame.result.dynamicSlots, Logic.SYM_LOGIC_JUSTIFICATION, null))), Stella.NIL);
            ControlFrame.recordGoalJustification(frame, self002);
          }
        }
        adjunct.savedContext.changeContext();
        if (frame.down != null) {
          adjunct.downFrame = frame.down;
          frame.down = null;
          return (Logic.KWD_CONTINUING_SUCCESS);
        }
        else {
          return (Logic.KWD_FINAL_SUCCESS);
        }
      }
      else if (lastmove == Logic.KWD_UP_FAIL) {
        ControlFrame.propagateFrameTruthValue(frame.result, frame);
        if ((((QueryIterator)(Logic.$QUERYITERATOR$.get())) != null) &&
            (((QueryIterator)(Logic.$QUERYITERATOR$.get())).partialMatchStrategy != null)) {
          frame.result.partialMatchFrame.propagateFramePartialTruth(frame);
        }
        if (((Boolean)(Logic.$RECORD_JUSTIFICATIONSp$.get())).booleanValue()) {
          ControlFrame.recordPrimitiveJustification(frame, Logic.KWD_UP_FAIL);
        }
        adjunct.savedContext.changeContext();
        return (Logic.KWD_FAILURE);
      }
      else {
        { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

          stream000.nativeStream.print("`" + lastmove + "' is not a valid case option");
          throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
        }
      }
    }
  }