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;
reserve Rtfsm for reduced finite non empty Mealy-FSM over IAlph, OAlph;

theorem Th46:
  Rtfsm, the_reduction_of Rtfsm-are_isomorphic
proof
  set m = Rtfsm;
  set rm = the_reduction_of m;
  set fpm = final_states_partition m;
  deffunc F(Element of m) = (proj fpm).$1;
  consider Tf being Function of the carrier of m, fpm such that
A1: for q being Element of m holds Tf.q=F(q) from FUNCT_2:sch 4;
A2: now
    assume not Tf is one-to-one;
    then consider q1, q2 being object such that
A3: q1 in the carrier of m & q2 in the carrier of m and
A4: Tf.q1 = Tf.q2 and
A5: q1 <> q2 by FUNCT_2:19;
    reconsider q1, q2 as State of m by A3;
    Tf.q1 = (proj fpm).q1 by A1;
    then
A6: q1 in Tf.q1 by EQREL_1:def 9;
A7: fpm is final by Def15;
    Tf.q2 = (proj fpm).q2 by A1;
    then
A8: q2 in Tf.q2 by EQREL_1:def 9;
    not q1, q2-are_equivalent by A5,Def20;
    hence contradiction by A4,A7,A6,A8;
  end;
  set Im1 = the InitS of m;
A9: fpm c= rng Tf
  proof
    let x be object;
    assume
A10: x in fpm;
    then reconsider pq=x as Subset of m;
    consider q being Element of m such that
A11: q in pq by A10,FINSEQ_4:87;
    pq = (proj fpm).q by A10,A11,EQREL_1:65;
    then Tf.q = pq by A1;
    hence thesis by FUNCT_2:4;
  end;
  rng Tf c= fpm by RELAT_1:def 19;
  then rng Tf = fpm by A9;
  then
A12: Tf is onto by FUNCT_2:def 3;
A13: the carrier of rm = fpm by Def18;
A14: now
    let q be State of m, s be Element of IAlph;
    reconsider Tfq = Tf.q as State of rm by Def18;
A15: (the Tran of rm).[Tfq, s] is State of rm;
    Tf.q = (proj fpm).q by A1;
    then
A16: q in Tf.q by EQREL_1:def 9;
    then (the Tran of m).(q, s) in (the Tran of rm).(Tf.q, s) by A13,Def18;
    then (the Tran of rm).[Tf.q, s] = (proj fpm).((the Tran of m).[q, s]) by
A13,A15,EQREL_1:65;
    hence Tf.((the Tran of m).(q, s)) = (the Tran of rm).(Tf.q, s) by A1;
    thus (the OFun of m).(q,s) = (the OFun of rm).(Tf.q, s) by A13,A16,Def18;
  end;
  the InitS of m in the InitS of rm by Def18;
  then the InitS of rm = (proj fpm).Im1 by A13,EQREL_1:65;
  then Tf.the InitS of m = the InitS of rm by A1;
  hence thesis by A13,A2,A12,A14;
end;
