reserve S for non empty non void ManySortedSign,
  A for MSAlgebra over S;
reserve A for non-empty MSAlgebra over S;
reserve S for non empty non void ManySortedSign,
  A for non-empty MSAlgebra over S,
  R for ManySortedRelation of the Sorts of A;

theorem Th40:
  for A being set, R being Relation of A for E being
  Equivalence_Relation of A st R c= E for a,b being object st a in A & a,b
  are_convertible_wrt R holds [a,b] in E
proof
  let A be set, R be Relation of A;
  let E be Equivalence_Relation of A such that
A1: R c= E;
  let a,b be object such that
A2: a in A;
  assume R \/ R~ reduces a,b;
  then consider p being RedSequence of R \/ R~ such that
A3: p.1 = a and
A4: p.len p = b;
  defpred Q[Nat] means $1 in dom p implies [a,p.$1] in E;
A5: for k be Nat st Q[k] holds Q[k+1]
  proof
    let i be Nat such that
A6: i in dom p implies [a,p.i] in E and
A7: i+1 in dom p;
A8: i <= i+1 by NAT_1:11;
    i+1 <= len p by A7,FINSEQ_3:25;
    then
A9: i <= len p by A8,XXREAL_0:2;
    per cases;
    suppose
      i = 0;
      hence thesis by A2,A3,EQREL_1:5;
    end;
    suppose
      i > 0;
      then
A10:  i >= 0+1 by NAT_1:13;
      then i in dom p by A9,FINSEQ_3:25;
      then
A11:  [p.i, p.(i+1)] in R \/ R~ by A7,REWRITE1:def 2;
      then reconsider ppi = p.i, pj = p.(i+1) as Element of A by ZFMISC_1:87;
      [p.i, p.(i+1)] in R or [p.i, p.(i+1)] in R~ by A11,XBOOLE_0:def 3;
      then [p.i, p.(i+1)] in R or [p.(i+1), p.i] in R by RELAT_1:def 7;
      then [ppi, pj] in E by A1,EQREL_1:6;
      hence thesis by A6,A9,A10,EQREL_1:7,FINSEQ_3:25;
    end;
  end;
A12: len p in dom p by FINSEQ_5:6;
A13: Q[ 0 ] by FINSEQ_3:25;
  for i being Nat holds Q[i] from NAT_1:sch 2(A13,A5);
  hence thesis by A4,A12;
end;
