reserve x, y, X for set;
reserve E for non empty set;
reserve e for Element of E;
reserve u, u1, v, v1, v2, w, w9, w1, w2 for Element of E^omega;
reserve F for Subset of E^omega;
reserve i, k, l for Nat;
reserve TS for non empty transition-system over F;
reserve S, T for Subset of TS;
reserve SA for non empty semiautomaton over F;
reserve A for non empty automaton over F;
reserve p, q for Element of A;
reserve TS for non empty transition-system over Lex(E) \/ {<%>E};

theorem Th22:
  for R being RedSequence of ==>.-relation(TS) st (R.1)`2 = <%e%>^
  u & (R.len R)`2 = <%>E holds (R.2)`2 = <%e%>^u or (R.2)`2 = u
proof
  let R be RedSequence of ==>.-relation(TS) such that
A1: (R.1)`2 = <%e%>^u and
A2: (R.len R)`2 = <%>E;
  (R.1)`2 <> (R.len R)`2 by A1,A2,AFINSQ_1:30;
  then len R >= 1 + 1 by NAT_1:8,25;
  then rng R <> {} & 1 + 1 in dom R by FINSEQ_3:25;
  then
A3: [R.1, R.2] in ==>.-relation(TS) by FINSEQ_3:32,REWRITE1:def 2;
  then consider
  p being Element of TS, v being Element of E^omega, q being Element
  of TS, w such that
A4: R.1 = [p, v] and
A5: R.2 = [q, w] by REWRITE3:31;
  p, v ==>. q, w, TS by A3,A4,A5,REWRITE3:def 4;
  then consider u1 such that
A6: p, u1 -->. q, TS and
A7: v = u1^w by REWRITE3:22;
A8: u1 in Lex(E) \/ {<%>E} by A6,REWRITE3:15;
  per cases by A8,XBOOLE_0:def 3;
  suppose
    u1 in Lex(E);
    then len u1 = 1 by Th9;
    then consider f being Element of E such that
A9: u1 = <%f%> and
    u1.0 = f by Th4;
    (R.1)`2 = <%f%>^w by A4,A7,A9;
    then u = w by A1,Th6;
    hence thesis by A5;
  end;
  suppose
    u1 in {<%>E};
    then
A10: u1 = <%>E by TARSKI:def 1;
    v = (R.1)`2 & w = (R.2)`2 by A4,A5;
    hence thesis by A1,A7,A10;
  end;
end;
