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 Th19:
  qa, qb-are_equivalent iff for s holds (the OFun of tfsm).[qa, s]
= (the OFun of tfsm).[qb, s] & (the Tran of tfsm).[qa, s], (the Tran of tfsm).[
  qb, s]-are_equivalent
proof
  set OF= the OFun of tfsm;
  hereby
    assume
A1: qa, qb-are_equivalent;
    let s be Element of IAlph;
    set qa9 = (the Tran of tfsm).[qa, s];
    set qb9 = (the Tran of tfsm).[qb, s];
    len <*s*> = 1 by FINSEQ_1:40;
    then
A2: 1 in dom <*s*> by FINSEQ_3:25;
    thus
A3: OF.[qa, s] = OF.[(qa, <*s*>)-admissible.1, s] by Def2
      .= OF.[(qa, <*s*>)-admissible.1, <*s*>.1]
      .= (qa, <*s*>)-response.1 by A2,Def6
      .= (qb, <*s*>)-response.1 by A1
      .= OF.[(qb, <*s*>)-admissible.1, <*s*>.1] by A2,Def6
      .= OF.[(qb,<*s*>)-admissible.1,s]
      .= OF.[qb,s] by Def2;
    now
      let w be FinSequence of IAlph;
A4:   (qa, <*s*>^w)-response = <*OF.[qa,s]*>^(qa9, w)-response & (qb, <*s
      *>^w) -response = <*OF.[qb,s]*>^(qb9, w)-response by Th18;
      (qa, <*s*>^w)-response = (qb, <*s*>^w)-response by A1;
      hence (qa9, w)-response = (qb9, w)-response by A3,A4,FINSEQ_1:33;
    end;
    hence
    (the Tran of tfsm).[qa, s], (the Tran of tfsm).[qb, s]-are_equivalent;
  end;
  assume
A5: for s being Element of IAlph holds (the OFun of tfsm).[qa, s] = (the
OFun of tfsm).[qb, s] & (the Tran of tfsm).[qa, s], (the Tran of tfsm).[qb, s]
  -are_equivalent;
  let w be FinSequence of IAlph;
  per cases;
  suppose
A6: w = <*>IAlph;
    hence (qa, w)-response = <*>OAlph by Th9
      .= (qb, w)-response by A6,Th9;
  end;
  suppose
    w <> {};
    then consider
    s being Element of IAlph, wt being FinSequence of IAlph such that
    s = w.1 and
A7: w = <*s*>^wt by FINSEQ_3:102;
    set bsresp =(the OFun of tfsm).[qb,s];
    set asresp =(the OFun of tfsm).[qa,s];
    set qb9 = (the Tran of tfsm).[qb, s];
    set qa9 = (the Tran of tfsm).[qa, s];
    qa9, qb9-are_equivalent by A5;
    then
A8: (qa9, wt)-response = (qb9, wt)-response;
    thus (qa, w)-response = <*asresp*>^(qa9, wt)-response by A7,Th18
      .= <*bsresp*>^(qb9,wt)-response by A5,A8
      .= (qb,w)-response by A7,Th18;
  end;
end;
