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 Th45:
  rtfsm = the_reduction_of tfsm & qr1<>qr2 implies not qr1,qr2 -are_equivalent
proof
  assume that
A1: rtfsm = the_reduction_of tfsm and
A2: qr1 <> qr2;
A3: the carrier of rtfsm = final_states_partition tfsm by A1,Def18;
  then reconsider q19 = qr1 as Subset of tfsm by TARSKI:def 3;
  consider x being Element of tfsm such that
A4: x in q19 by A3,FINSEQ_4:87;
  reconsider q29 = qr2 as Subset of tfsm by A3,TARSKI:def 3;
  consider y being Element of tfsm such that
A5: y in q29 by A3,FINSEQ_4:87;
A6: final_states_partition tfsm is final by Def15;
  not x,y-are_equivalent
  proof
    assume x,y-are_equivalent;
    then consider X being Element of rtfsm such that
A7: x in X & y in X by A3,A6;
A8: q29 misses q19 by A2,A3,EQREL_1:def 4;
    X is Subset of tfsm by A3,TARSKI:def 3;
    then X = q19 or X misses q19 by A3,EQREL_1:def 4;
    hence contradiction by A4,A5,A7,A8,XBOOLE_0:3;
  end;
  then consider w being FinSequence of IAlph such that
A9: (x,w)-response <> (y,w)-response;
  set q1adm = (qr1,w)-admissible, q2adm = (qr2,w)-admissible;
  set xadm = (x,w)-admissible, yadm = (y,w)-admissible;
  set xresp = (x,w)-response, yresp = (y,w)-response;
  len xresp = len w by Def6
    .= len yresp by Def6;
  then consider k be Nat such that
A10: 1 <= k & k <= len xresp and
A11: xresp.k <> yresp.k by A9,FINSEQ_1:14;
  len xresp = len w by Def6;
  then
A12: k in Seg len w by A10,FINSEQ_1:1;
  then k in Seg (len w + 1) by FINSEQ_2:8;
  then
A13: yadm.k in q2adm.k by A1,A5,Th40;
  set q1resp = (qr1,w)-response, q2resp = (qr2,w)-response;
A14: len q1adm = len w + 1 by Def2
    .= len xresp + 1 by Def6;
  k in Seg len xresp by A10,FINSEQ_1:1;
  then
A15: k in Seg len q1adm by A14,FINSEQ_2:8;
  then k in dom q1adm by FINSEQ_1:def 3;
  then
A16: q1adm.k is Element of rtfsm by FINSEQ_2:11;
  len q2adm = len w + 1 by Def2
    .= len q1adm by Def2;
  then k in dom q2adm by A15,FINSEQ_1:def 3;
  then
A17: q2adm.k is Element of rtfsm by FINSEQ_2:11;
  k in dom w by A12,FINSEQ_1:def 3;
  then
A18: w.k is Element of IAlph by FINSEQ_2:11;
A19: len q1adm = len w + 1 by Def2
    .= len xadm by Def2;
  then k in dom xadm by A15,FINSEQ_1:def 3;
  then
A20: xadm.k is Element of tfsm by FINSEQ_2:11;
  len yadm = len w + 1 by Def2
    .= len xadm by Def2;
  then k in dom yadm by A15,A19,FINSEQ_1:def 3;
  then
A21: yadm.k is Element of tfsm by FINSEQ_2:11;
  k in Seg (len w + 1) by A12,FINSEQ_2:8;
  then
A22: xadm.k in q1adm.k by A1,A4,Th40;
  now
    assume
A23: q1resp = q2resp;
    len w = len xresp by Def6;
    then
A24: k in dom w by A10,FINSEQ_3:25;
    then
A25: xresp.k = (the OFun of tfsm).(xadm.k,w.k) by Def6;
A26: q2resp.k = (the OFun of rtfsm).(q2adm.k,w.k) by A24,Def6
      .= (the OFun of tfsm).(yadm.k,w.k) by A1,A18,A17,A13,A21,Def18;
    q1resp.k = (the OFun of rtfsm).(q1adm.k,w.k) by A24,Def6
      .= (the OFun of tfsm).(xadm.k,w.k) by A1,A16,A18,A22,A20,Def18;
    hence contradiction by A11,A23,A24,A26,A25,Def6;
  end;
  hence thesis;
end;
