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 Th45:
  for R being stable ManySortedRelation of A for s being
SortSymbol of S for a,b being Element of A,s st a,b are_convertible_wrt R.s for
  h being Endomorphism of A holds h.s.a, h.s.b are_convertible_wrt R.s
proof
  let R be stable ManySortedRelation of A;
  let s be SortSymbol of S;
  let a,b be Element of A,s;
  assume (R.s) \/ (R.s)~ reduces a,b;
  then consider p being RedSequence of (R.s) \/ (R.s)~ such that
A1: p.1 = a and
A2: p.len p = b;
  let h be Endomorphism of A;
  defpred P[Nat] means $1 in dom p implies h.s.a, h.s.(p.$1)
  are_convertible_wrt R.s;
A3: for i be Nat st P[i] holds P[i+1]
  proof
    let i be Nat such that
A4: i in dom p implies h.s.a, h.s.(p.i) are_convertible_wrt R.s and
A5: i+1 in dom p;
A6: i <= i+1 by NAT_1:11;
    i+1 <= len p by A5,FINSEQ_3:25;
    then
A7: i <= len p by A6,XXREAL_0:2;
    per cases;
    suppose
      i = 0;
      hence thesis by A1,REWRITE1:26;
    end;
    suppose
      i > 0;
      then
A8:   i >= 0+1 by NAT_1:13;
      then i in dom p by A7,FINSEQ_3:25;
      then
A9:   [p.i, p.(i+1)] in (R.s) \/ (R.s)~ by A5,REWRITE1:def 2;
      then reconsider ppi = p.i, pj = p.(i+1) as Element of A,s by ZFMISC_1:87;
      [p.i, p.(i+1)] in R.s or [p.i, p.(i+1)] in (R.s)~ by A9,XBOOLE_0:def 3;
      then [p.i, p.(i+1)] in R.s or [p.(i+1), p.i] in R.s by RELAT_1:def 7;
      then [h.s.ppi, h.s.pj] in R.s or [h.s.pj, h.s.ppi] in R.s by Def9;
      then h.s.ppi, h.s.pj are_convertible_wrt R.s or h.s.pj, h.s.ppi
      are_convertible_wrt R.s by REWRITE1:29;
      then h.s.ppi, h.s.pj are_convertible_wrt R.s by REWRITE1:31;
      hence thesis by A4,A7,A8,FINSEQ_3:25,REWRITE1:30;
    end;
  end;
A10: len p in dom p by FINSEQ_5:6;
A11: P[ 0 ] by FINSEQ_3:25;
  for i being Nat holds P[i] from NAT_1:sch 2(A11,A3);
  hence thesis by A2,A10;
end;
