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;
reserve tfsm, rtfsm for finite non empty Mealy-FSM over IAlph, OAlph,
  q for State of tfsm;
reserve qr1, qr2 for State of rtfsm,
  Tf for Function of the carrier of tfsm1, the carrier of tfsm2;

theorem Th44:
  ( for q being State of tfsm1, s holds Tf.((the Tran of tfsm1).(q
  , s)) = (the Tran of tfsm2).(Tf.q, s) & (the OFun of tfsm1).(q,s) = (the OFun
  of tfsm2).(Tf.q, s)) implies (q11,q12-are_equivalent iff Tf.q11, Tf.q12
  -are_equivalent)
proof
  set Stfsm1 = the carrier of tfsm1;
  set Stfsm2 = the carrier of tfsm2;
  set OF1 = the OFun of tfsm1, OF2 = the OFun of tfsm2;
  assume
A1: for q being Element of Stfsm1, s holds Tf.((the Tran of tfsm1).(q, s
  )) = (the Tran of tfsm2).(Tf.q, s) & (the OFun of tfsm1).(q,s) = (the OFun of
  tfsm2).(Tf.q, s);
  hereby
    reconsider Tq2 = Tf.q12 as Element of Stfsm2;
    reconsider Tq1 = Tf.q11 as Element of Stfsm2;
    assume
A2: q11,q12-are_equivalent;
    now
      let w be FinSequence of IAlph;
A3:   now
        let k be Nat;
        assume that
A4:     1 <= k and
A5:     k <= len (Tq1,w)-response;
        len (Tq1,w)-response = len w by Def6;
        then
A6:     k in Seg len w by A4,A5,FINSEQ_1:1;
        then
A7:     k in Seg (len w + 1) by FINSEQ_2:8;
        then
A8:     k <= len w + 1 by FINSEQ_1:1;
        len (q11,w)-admissible = len w + 1 by Def2;
        then k in dom (q11,w)-admissible by A7,FINSEQ_1:def 3;
        then reconsider q1a = (q11,w)-admissible.k as Element of Stfsm1 by
FINSEQ_2:11;
        len (q12,w)-admissible = len w + 1 by Def2;
        then k in dom (q12,w)-admissible by A7,FINSEQ_1:def 3;
        then reconsider q2a = (q12,w)-admissible.k as Element of Stfsm1 by
FINSEQ_2:11;
A9:    k in dom w by A6,FINSEQ_1:def 3;
        then reconsider wk = w.k as Element of IAlph by FINSEQ_2:11;
        thus (Tq1,w)-response.k=OF2.[(Tq1,w)-admissible.k, w.k] by A9,Def6
          .= OF2.(Tf.q1a, wk) by A1,A4,A8,Th43
          .= OF1.(q1a, wk) by A1
          .= (q11,w)-response.k by A9,Def6
          .= (q12,w)-response.k by A2
          .= OF1.(q2a, wk) by A9,Def6
          .= OF2.(Tf.q2a, wk) by A1
          .= OF2.[(Tq2,w)-admissible.k, w.k] by A1,A4,A8,Th43
          .= (Tq2,w)-response.k by A9,Def6;
      end;
      len(Tq1,w)-response=len w by Def6
        .=len (Tq2,w)-response by Def6;
      hence (Tq1,w)-response = (Tq2,w)-response by A3,FINSEQ_1:14;
    end;
    hence Tf.q11, Tf.q12-are_equivalent;
  end;
  assume
A10: Tf.q11, Tf.q12-are_equivalent;
  now
    let w be FinSequence of IAlph;
A11: now
      let k be Nat;
      assume that
A12:  1 <= k and
A13:  k <= len (q11,w)-response;
      len (q11,w)-response = len w by Def6;
      then
A14:  k in Seg len w by A12,A13,FINSEQ_1:1;
      then
A15:  k in Seg (len w + 1) by FINSEQ_2:8;
      then
A16:  k in NAT & k <= len w + 1 by FINSEQ_1:1;
      len (q12,w)-admissible = len w + 1 by Def2;
      then k in dom (q12,w)-admissible by A15,FINSEQ_1:def 3;
      then reconsider q2a = (q12,w)-admissible.k as Element of Stfsm1 by
FINSEQ_2:11;
      len (q11,w)-admissible = len w + 1 by Def2;
      then k in dom (q11,w)-admissible by A15,FINSEQ_1:def 3;
      then reconsider q1a = (q11,w)-admissible.k as Element of Stfsm1 by
FINSEQ_2:11;
A17:  k in dom w by A14,FINSEQ_1:def 3;
      then reconsider wk = w.k as Element of IAlph by FINSEQ_2:11;
      thus (q11,w)-response.k = OF1.((q11,w)-admissible.k, w.k) by A17,Def6
        .= OF2.(Tf.q1a, wk) by A1
        .= OF2.[(Tf.q11,w)-admissible.k,wk] by A1,A12,A16,Th43
        .= (Tf.q11,w)-response.k by A17,Def6
        .= (Tf.q12,w)-response.k by A10
        .= OF2.[(Tf.q12,w)-admissible.k, w.k] by A17,Def6
        .= OF2.(Tf.q2a, wk) by A1,A12,A16,Th43
        .= OF1.(q2a, w.k) by A1
        .= (q12,w)-response.k by A17,Def6;
    end;
    len (q11,w)-response = len w by Def6
      .= len (q12,w)-response by Def6;
    hence (q11,w)-response = (q12,w)-response by A11,FINSEQ_1:14;
  end;
  hence thesis;
end;
