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;
reserve OAlphf for finite non empty set,
  tfsmf for finite non empty Mealy-FSM over IAlph, OAlphf,
  sfsmf for finite non empty Moore-FSM over IAlph, OAlphf;

theorem Th18:
  qa9 = (the Tran of tfsm).[qa, s] implies (qa, <*s*>^w)-response
  = <*(the OFun of tfsm).[qa, s]*>^(qa9, w)-response
proof
  set OF=the OFun of tfsm;
  set asresp = OF.[qa, s];
A1: len (<*s*>^w) = len <*s*> + len w by FINSEQ_1:22
    .= 1+len w by FINSEQ_1:40;
  assume
A2: qa9 = (the Tran of tfsm).[qa, s];
  now
    thus len ((qa, <*s*>^w)-response) = 1 + len w by A1,Def6;
    then
A3: dom (qa, <*s*>^w)-response = Seg (1 + len w) by FINSEQ_1:def 3;
    thus
A4: len (<*asresp*>^(qa9, w)-response) = len <*asresp*> + len ((qa9,
    w)-response) by FINSEQ_1:22
      .= 1 + len ((qa9, w)-response) by FINSEQ_1:40
      .= 1 + len w by Def6;
    let j be Nat;
    assume
A5: j in dom (qa, <*s*>^w)-response;
    then
A6: 1 <= j by A3,FINSEQ_1:1;
A7: j <= 1 + len w by A3,A5,FINSEQ_1:1;
A8: j in dom(<*s*>^w) by A1,A3,A5,FINSEQ_1:def 3;
    per cases by A6,XXREAL_0:1;
    suppose
A9:   j = 1;
      thus (qa, <*s*>^w)-response.j = OF.[(qa, <*s*>^w)-admissible.j, (<*s*>^w
      ).j] by A8,Def6
        .= OF.[qa,(<*s*>^w).j] by A9,Def2
        .= asresp by A9,FINSEQ_1:41
        .= (<*asresp*>^(qa9, w)-response).j by A9,FINSEQ_1:41;
    end;
    suppose
A10:  j > 1;
      then consider i being Element of NAT such that
A11:  i = j - 1 and
A12:  1 <= i by INT_1:51;
      j <= len w + 1 by A3,A5,FINSEQ_1:1;
      then j - 1 <= len w + 1-1 by XREAL_1:9;
      then
A13:  i in Seg len w by A11,A12,FINSEQ_1:1;
      then
A14:  i in Seg (1 + len w) by FINSEQ_2:8;
      i+1 in Seg (1 + len w) by A13,FINSEQ_1:60;
      then
A15:  i+1 in dom(<*s*>^w) by A1,FINSEQ_1:def 3;
A16:  i in dom w by A13,FINSEQ_1:def 3;
      len <*asresp*> = 1 by FINSEQ_1:40;
      then (<*asresp*>^((qa9, w)-response)).j = (qa9, w)-response.i by A4,A7
,A10,A11,FINSEQ_1:24
        .= OF.[(qa9, w)-admissible.i, w.i] by A16,Def6
        .= OF.[(qa9, w)-admissible.i, (<*s*>^w).(i+1)] by A16,FINSEQ_3:103
        .= OF.[(qa, <*s*>^w)-admissible.(i+1), (<*s*>^w).(i+1)]by A2,A14,Th17
        .= ((qa, <*s*>^w)-response).j by A11,A15,Def6;
      hence (qa, <*s*>^w)-response.j = (<*asresp*>^(qa9, w)-response).j;
    end;
  end;
  hence thesis by FINSEQ_2:9;
end;
