public static Keyword forkSpecialist(ControlFrame frame, Keyword lastmove) {
    { boolean recordjustificationsP = ((Boolean)(Logic.$RECORD_JUSTIFICATIONSp$.get())).booleanValue();
      ForkProofAdjunct adjunct = ((ForkProofAdjunct)(((ProofAdjunct)(KeyValueList.dynamicSlotValue(frame.dynamicSlots, Logic.SYM_LOGIC_PROOF_ADJUNCT, null)))));

      if (lastmove == Logic.KWD_DOWN) {
        if (recordjustificationsP) {
          if (adjunct == null) {
            adjunct = ForkProofAdjunct.newForkProofAdjunct();
            KeyValueList.setDynamicSlotValue(frame.dynamicSlots, Logic.SYM_LOGIC_PROOF_ADJUNCT, adjunct, null);
          }
          frame.down = adjunct.downFrame;
        }
        return (Logic.KWD_MOVE_DOWN);
      }
      else if (lastmove == Logic.KWD_UP_TRUE) {
        if (frame.argumentCursor > 0) {
          if (recordjustificationsP) {
            adjunct.downFrame = frame.down;
            ControlFrame.propagateFrameTruthValue(frame.result, frame);
            { Justification self001 = Justification.newJustification();

              self001.inferenceRule = ((adjunct.conditionJustification.inferenceRule == Logic.KWD_FAIL_INTRODUCTION) ? Logic.KWD_FORK_ELSE : Logic.KWD_FORK_THEN);
              self001.antecedents = Cons.cons(adjunct.conditionJustification, Cons.cons(((Justification)(KeyValueList.dynamicSlotValue(frame.result.dynamicSlots, Logic.SYM_LOGIC_JUSTIFICATION, null))), Stella.NIL));
              ControlFrame.recordGoalJustification(frame, self001);
            }
          }
          if (frame.down != null) {
            if (recordjustificationsP) {
              frame.down = null;
            }
            return (Logic.KWD_CONTINUING_SUCCESS);
          }
          else {
            return (Logic.KWD_FINAL_SUCCESS);
          }
        }
        if (recordjustificationsP) {
          adjunct.conditionJustification = ((Justification)(KeyValueList.dynamicSlotValue(frame.result.dynamicSlots, Logic.SYM_LOGIC_JUSTIFICATION, null)));
        }
        frame.down = null;
        frame.argumentCursor = 1;
        return (Logic.KWD_MOVE_DOWN);
      }
      else if (lastmove == Logic.KWD_UP_FAIL) {
        if (frame.argumentCursor > 0) {
          return (Logic.KWD_FAILURE);
        }
        if (recordjustificationsP) {
          ControlFrame.recordFailJustification(frame.result, Logic.KWD_UP_FAIL);
          adjunct.conditionJustification = ((Justification)(KeyValueList.dynamicSlotValue(frame.result.dynamicSlots, Logic.SYM_LOGIC_JUSTIFICATION, null)));
        }
        frame.down = null;
        frame.argumentCursor = 2;
        return (Logic.KWD_MOVE_DOWN);
      }
      else {
        { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

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