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;
reserve Ctfsm, Ctfsm1, Ctfsm2 for connected finite non empty Mealy-FSM over
  IAlph, OAlph;
reserve Rtfsm1, Rtfsm2 for reduced non empty Mealy-FSM over IAlph, OAlph;
reserve CRtfsm1, CRtfsm2 for connected reduced non empty Mealy-FSM over IAlph
  , OAlph,
  q1u, q2u for State of tfsm;
reserve CRtfsm1, CRtfsm2 for connected reduced finite non empty Mealy-FSM
  over IAlph, OAlph;

theorem Th62:
  for tfsm1, tfsm2 being finite non empty Mealy-FSM over IAlph,
  OAlph ex fsm1, fsm2 being finite non empty Mealy-FSM over IAlph, OAlph st the
carrier of fsm1 misses the carrier of fsm2 & fsm1, tfsm1-are_isomorphic & fsm2,
  tfsm2-are_isomorphic
proof
  deffunc F(object) = $1`2;
  set z = 0, zz = 1, A = {z}, B = {zz};
  let tfsm1, tfsm2 be finite non empty Mealy-FSM over IAlph, OAlph;
  set Stfsm1 = the carrier of tfsm1, Tr1 = the Tran of tfsm1;
  set Of1 = the OFun of tfsm1, Stfsm2 = the carrier of tfsm2;
  set Tr2 = the Tran of tfsm2, Of2 = the OFun of tfsm2;
  set Sfsm1 = [:{0}, Stfsm1:], Sfsm2 = [:{1}, Stfsm2:];
  deffunc F(Element of Sfsm1, Element of IAlph) = [ $1`1, Tr1.[$1`2,$2] ];
  consider T1 be Function of [: Sfsm1, IAlph :], Sfsm1 such that
A1: for q being Element of Sfsm1, s being Element of IAlph holds T1.(q,s
  ) = F(q,s) from BINOP_1:sch 4;
  reconsider I2 = [ 1, the InitS of tfsm2 ] as Element of Sfsm2 by ZFMISC_1:105
;
  reconsider sSfsm2 = [: B, Stfsm2 :] as finite non empty set;
  reconsider I1 = [ 0, the InitS of tfsm1 ] as Element of Sfsm1 by ZFMISC_1:105
;
  set sSfsm1 = [: A, Stfsm1 :];
  deffunc F(Element of Sfsm1, Element of IAlph) = Of1.[$1`2, $2];
  consider O1 be Function of [: Sfsm1, IAlph :], OAlph such that
A2: for q being Element of Sfsm1, s being Element of IAlph holds O1.(q,s
  ) = F(q,s) from BINOP_1:sch 4;
  reconsider sI2 = I2 as Element of sSfsm2;
  set sI1 = I1;
  reconsider sO1 = O1 as Function of [: sSfsm1, IAlph :], OAlph;
  reconsider sT1 = T1 as Function of [: sSfsm1, IAlph :], sSfsm1;
  deffunc F(Element of Sfsm2, Element of IAlph) = [ $1`1, Tr2.[$1`2,$2] ];
  consider T2 be Function of [: Sfsm2, IAlph :], Sfsm2 such that
A3: for q being Element of Sfsm2, s being Element of IAlph holds T2.(q,s
  ) = F(q,s) from BINOP_1:sch 4;
  reconsider sT2 = T2 as Function of [: sSfsm2, IAlph :], sSfsm2;
  take fsm1 = Mealy-FSM (# sSfsm1, sT1, sO1, sI1 #);
  deffunc F(Element of Sfsm2, Element of IAlph) = Of2.[$1`2,$2];
  consider O2 be Function of [: Sfsm2, IAlph :], OAlph such that
A4: for q being Element of Sfsm2, s being Element of IAlph holds O2.(q,s
  ) = F(q,s) from BINOP_1:sch 4;
A5: A misses B by ZFMISC_1:11;
  reconsider sO2 = O2 as Function of [: sSfsm2, IAlph :], OAlph;
  take fsm2 = Mealy-FSM (# sSfsm2, sT2, sO2, sI2 #);
  Sfsm1 /\ Sfsm2 = [: A /\ B, Stfsm1 /\ Stfsm2 :] by ZFMISC_1:100
    .= [: {}, Stfsm1 /\ Stfsm2 :] by A5
    .= {} by ZFMISC_1:90;
  hence (the carrier of fsm1) /\ (the carrier of fsm2) = {};
  thus fsm1, tfsm1-are_isomorphic
  proof
    deffunc F(object) = $1`2;
    consider Tf1 being Function such that
A6: dom Tf1 = the carrier of fsm1 & for q being object st q in the
    carrier of fsm1 holds Tf1.q = F(q) from FUNCT_1:sch 3;
A7: rng Tf1 = Stfsm1
    proof
      assume
A8:   not rng Tf1 = Stfsm1;
      per cases by A8;
      suppose
        not rng Tf1 c= Stfsm1;
        then consider q being object such that
A9:     q in rng Tf1 and
A10:    not q in Stfsm1;
        consider x be object such that
A11:    x in dom Tf1 and
A12:    q = Tf1.x by A9,FUNCT_1:def 3;
        reconsider x2 = x`2 as Element of Stfsm1 by A6,A11,MCART_1:10;
        x2 in Stfsm1;
        hence contradiction by A6,A10,A11,A12;
      end;
      suppose
        not Stfsm1 c= rng Tf1;
        then consider x being object such that
A13:    x in Stfsm1 and
A14:    not x in rng Tf1;
        0 in {0} by TARSKI:def 1;
        then [0,x] in sSfsm1 by A13,ZFMISC_1:87;
        then Tf1.[0,x] in rng Tf1 & Tf1.[0,x]=[0,x]`2 by A6,FUNCT_1:def 3;
        hence contradiction by A14;
      end;
    end;
    then reconsider
    Tf1s = Tf1 as Function of the carrier of fsm1, the carrier of
    tfsm1 by A6,FUNCT_2:1;
    take Tf1s;
    now
      let x1, x2 be object;
      assume that
A15:  x1 in dom Tf1 and
A16:  x2 in dom Tf1 and
A17:  Tf1.x1 = Tf1.x2;
A18:  Tf1.x1 = x1`2 & Tf1.x2 = x2`2 by A6,A15,A16;
      x1`1 in A by A6,A15,MCART_1:10;
      then
A19:  x1`1 = 0 by TARSKI:def 1;
A20:  x2`1 in A by A6,A16,MCART_1:10;
      x1 = [x1`1, x1`2] & x2 = [x2`1,x2`2] by A6,A15,A16,MCART_1:21;
      hence x1 = x2 by A17,A18,A20,A19,TARSKI:def 1;
    end;
    then Tf1s is one-to-one onto by A7,FUNCT_1:def 4,FUNCT_2:def 3;
    hence Tf1s is bijective;
    thus Tf1s.the InitS of fsm1 = sI1`2 by A6
      .= the InitS of tfsm1;
    now
      let q be State of fsm1, s be Element of IAlph;
      reconsider q1 = q`2 as Element of Stfsm1 by MCART_1:10;
      reconsider Tq1 = Tr1.[q1, s] as Element of Stfsm1;
      q`1 in A by MCART_1:10;
      then
A21:  [q`1,Tq1] in [: A, Stfsm1 :] by ZFMISC_1:87;
      thus Tf1s.((the Tran of fsm1).(q, s)) = Tf1s.(q`1, Tr1.(q`2, s)) by A1
        .= [q`1, Tr1.[q`2, s]]`2 by A6,A21
        .= Tr1.[q`2, s]
        .= (the Tran of tfsm1).[Tf1s.q, s] by A6;
      thus (the OFun of fsm1).(q,s) = Of1.(q`2, s) by A2
        .= (the OFun of tfsm1).(Tf1s.q, s) by A6;
    end;
    hence thesis;
  end;
  consider Tf1 being Function such that
A22: dom Tf1 = the carrier of fsm2 & for q being object st q in the carrier
  of fsm2 holds Tf1.q = F(q) from FUNCT_1:sch 3;
A23: rng Tf1 = Stfsm2
  proof
    assume
A24: not rng Tf1 = Stfsm2;
    per cases by A24;
    suppose
      not rng Tf1 c= Stfsm2;
      then consider q being object such that
A25:  q in rng Tf1 and
A26:  not q in Stfsm2;
      consider x be object such that
A27:  x in dom Tf1 and
A28:  q = Tf1.x by A25,FUNCT_1:def 3;
      reconsider x2 = x`2 as Element of Stfsm2 by A22,A27,MCART_1:10;
      x2 in Stfsm2;
      hence contradiction by A22,A26,A27,A28;
    end;
    suppose
      not Stfsm2 c= rng Tf1;
      then consider x being object such that
A29:  x in Stfsm2 and
A30:  not x in rng Tf1;
      1 in {1} by TARSKI:def 1;
      then [1,x] in sSfsm2 by A29,ZFMISC_1:87;
      then Tf1.[1,x] in rng Tf1 & Tf1.[1,x] = [1,x]`2 by A22,FUNCT_1:def 3;
      hence contradiction by A30;
    end;
  end;
  then reconsider
  Tf1s = Tf1 as Function of the carrier of fsm2, the carrier of
  tfsm2 by A22,FUNCT_2:1;
  take Tf1s;
  now
    let x1, x2 be object;
    assume that
A31: x1 in dom Tf1 and
A32: x2 in dom Tf1 and
A33: Tf1.x1 = Tf1.x2;
A34: Tf1.x1 = x1`2 & Tf1.x2 = x2`2 by A22,A31,A32;
    x1`1 in B by A22,A31,MCART_1:10;
    then
A35: x1`1 = 1 by TARSKI:def 1;
A36: x2`1 in B by A22,A32,MCART_1:10;
    x1 = [x1`1, x1`2] & x2 = [x2`1,x2`2] by A22,A31,A32,MCART_1:21;
    hence x1 = x2 by A33,A34,A36,A35,TARSKI:def 1;
  end;
  then Tf1s is one-to-one onto by A23,FUNCT_1:def 4,FUNCT_2:def 3;
  hence Tf1s is bijective;
  thus Tf1s.the InitS of fsm2 = sI2`2 by A22
    .= the InitS of tfsm2;
  now
    let q be State of fsm2, s be Element of IAlph;
    reconsider q1 = q`2 as Element of Stfsm2 by MCART_1:10;
    set Tq1 = Tr2.[q1, s];
    q`1 in B by MCART_1:10;
    then
A37: [q`1,Tq1] in [: B, Stfsm2 :] by ZFMISC_1:87;
    thus Tf1s.((the Tran of fsm2).(q, s)) = Tf1s.(q`1, Tr2.(q`2, s)) by A3
      .= [q`1, Tr2.[q`2, s]]`2 by A22,A37
      .= Tr2.[q`2, s]
      .= (the Tran of tfsm2).[Tf1s.q, s] by A22;
    thus (the OFun of fsm2).(q,s) = Of2.(q`2, s) by A4
      .= (the OFun of tfsm2).[Tf1s.q, s] by A22;
  end;
  hence thesis;
end;
