reserve m, n, i, k for Nat;
reserve IAlph, OAlph for non empty set,
  fsm for non empty FSM over IAlph,
  s for Element of IAlph,
  w, w1, w2 for FinSequence of IAlph,
  q, q9, q1, q2 for State of fsm;
reserve tfsm, tfsm1, tfsm2, tfsm3 for non empty Mealy-FSM over IAlph, OAlph,
  sfsm for non empty Moore-FSM over IAlph, OAlph,
  qs for State of sfsm,
  q, q1, q2 , q3, qa, qb, qc, qa9, qt, q1t, q2t for State of tfsm,
  q11, q12 for State of tfsm1,
  q21, q22 for State of tfsm2;

theorem Th11:
  q1t,w1-leads_to q2t implies (q1t,w1^w2)-response = (q1t,w1)
  -response ^ (q2t,w2)-response
proof
  set q1w1 = (q1t,w1)-response, q2w2 = (q2t,w2)-response;
  set q1w1w2 = (q1t, w1^w2)-response;
  set Dq1w1w2a = Del((q1t,w1)-admissible,(len w1 + 1));
  set OF = the OFun of tfsm;
  assume
A1: q1t,w1-leads_to q2t;
A2: now
    dom (q1t,w1)-admissible =Seg (len (q1t,w1)-admissible)by FINSEQ_1:def 3;
    then dom (q1t,w1)-admissible = Seg (len w1 + 1) by Def2;
    then len w1 + 1 in dom (q1t,w1)-admissible by FINSEQ_1:3;
    then consider m being Nat such that
A3: len (q1t,w1)-admissible = m+1 and
A4: len Dq1w1w2a = m by FINSEQ_3:104;
A5: m+1 = len w1 + 1 by A3,Def2;
A6: len q1w1 = len w1 by Def6;
    let k be Nat;
    assume that
A7: 1 <= k and
A8: k <= len q1w1w2;
    per cases by A7,A8,NAT_1:13;
    suppose
A9:  1 <= k & k <= len q1w1;
      then
A10:  k <= len w1 by Def6;
      then
A11:  k in dom w1 by A9,FINSEQ_3:25;
A12:  k in dom Dq1w1w2a by A4,A5,A9,A10,FINSEQ_3:25;
A13:  k < len w1 + 1 by A10,NAT_1:13;
A14:  k in dom q1w1 by A9,FINSEQ_3:25;
      k <= len (w1^w2) by A8,Def6;
      then k in dom (w1^w2) by A7,FINSEQ_3:25;
      hence q1w1w2.k = OF.[(q1t,w1^w2)-admissible.k,(w1^w2).k] by Def6
        .= OF.[(Dq1w1w2a ^ (q2t,w2)-admissible).k,(w1^w2).k] by A1,Th8
        .= OF.[Dq1w1w2a.k,(w1^w2).k] by A12,FINSEQ_1:def 7
        .= OF.[Dq1w1w2a.k,w1.k] by A11,FINSEQ_1:def 7
        .= OF.[(q1t,w1)-admissible.k, w1.k] by A13,FINSEQ_3:110
        .= (q1t,w1)-response.k by A11,Def6
        .= ((q1t,w1)-response ^ (q2t,w2)-response).k by A14,FINSEQ_1:def 7;
    end;
    suppose
A15:  len q1w1 + 1 <= k & k <= len q1w1w2;
      then
A16:  len q1w1 + 1 - len q1w1 <= k - len q1w1 by XREAL_1:9;
      then reconsider p = k - len q1w1 as Element of NAT by INT_1:3;
A17:  len q1w1w2 = len (w1^w2) by Def6
        .= len w1 + len w2 by FINSEQ_1:22;
      then k <= len q1w1 + len w2 by A15,Def6;
      then k - len q1w1 <= len q1w1 + len w2 - len q1w1 by XREAL_1:9;
      then
A18:  p in dom w2 by A16,FINSEQ_3:25;
A19:  len Dq1w1w2a + 1 <= k by A4,A5,A15,Def6;
A20:  len w1 + 1 <= k by A15,Def6;
A21:  len q1w1w2 = len (w1^w2) by Def6
        .= len w1 + len w2 by FINSEQ_1:22
        .= len q1w1 + len w2 by Def6
        .= len q1w1 + len q2w2 by Def6;
      then
A22:  (q1w1^q2w2).k = (q2t,w2)-response.p by A15,FINSEQ_1:23
        .= OF.[(q2t,w2)-admissible.p,w2.p] by A18,Def6
        .= OF.[(q2t,w2)-admissible.(k-len w1),w2.(k-len q1w1)] by Def6
        .= OF.[(q2t,w2)-admissible.(k-len w1),w2.(k-len w1)] by Def6;
      len w2 <= len w2 + 1 by NAT_1:11;
      then
A23:  len Dq1w1w2a + len w2 <= len Dq1w1w2a + (len w2 +1) by XREAL_1:6;
      k <= len Dq1w1w2a + len w2 by A4,A5,A6,A15,A21,Def6;
      then k <= len Dq1w1w2a + (len w2 + 1) by A23,XXREAL_0:2;
      then
A24:  k <= len Dq1w1w2a + len (q2t,w2) -admissible by Def2;
      k <= len (w1^w2) by A8,Def6;
      then k in dom (w1^w2) by A7,FINSEQ_3:25;
      then q1w1w2.k = OF.[(q1t,w1^w2)-admissible.k,(w1^w2).k] by Def6
        .= OF.[( Del((q1t,w1)-admissible,(len w1 + 1)) ^ (q2t,w2)-admissible
      ).k, (w1^w2).k] by A1,Th8
        .= OF.[(q2t,w2)-admissible.(k - len Dq1w1w2a),(w1^w2).k] by A19,A24,
FINSEQ_1:23
        .= OF.[(q2t,w2)-admissible.(k - len w1 ),w2.(k-len w1)] by A4,A5,A15
,A17,A20,FINSEQ_1:23;
      hence q1w1w2.k = (q1w1 ^ q2w2).k by A22;
    end;
  end;
  len q1w1w2 = len (w1^w2) by Def6
    .= len w1 + len w2 by FINSEQ_1:22
    .= len q1w1 + len w2 by Def6
    .= len q1w1 + len q2w2 by Def6
    .= len (q1w1 ^ q2w2) by FINSEQ_1:22;
  hence thesis by A2,FINSEQ_1:14;
end;
