
theorem
  for S1,S2,S3 being non void non empty ManySortedSign for X being
  non-empty ManySortedSet of the carrier of S3 for f1 being Function of the
  carrier of S1, the carrier of S2 for g1 being Function st f1,g1
  form_morphism_between S1,S2 for f2 being Function of the carrier of S2, the
carrier of S3 for g2 being Function st f2,g2 form_morphism_between S2,S3 holds
  hom(f2*f1,g2*g1,X,S1,S3) = (hom(f2,g2,X,S2,S3)*f1)**hom(f1,g1,X*f2,S1,S2)
proof
  let S1,S2,S3 be non void non empty ManySortedSign;
  let X be non-empty ManySortedSet of the carrier of S3;
  let f1 be Function of the carrier of S1, the carrier of S2;
  let g1 be Function such that
A1: f1,g1 form_morphism_between S1,S2;
  let f2 be Function of the carrier of S2, the carrier of S3;
  let g2 be Function;
  set f = f2*f1, g = g2*g1;
  assume
A2: f2,g2 form_morphism_between S2,S3;
  then reconsider
  Af = (FreeMSA X)|(S1,f,g), Af1 = (FreeMSA(X*f2))|(S1,f1,g1) as
  non-empty MSAlgebra over S1 by A1,Th22,PUA2MSS1:29;
A3: hom(f2,g2,X,S2,S3) is_homomorphism FreeMSA(X*f2), (FreeMSA X)|(S2,f2,g2)
  by A2,Def5;
A4: the Sorts of FreeMSA(X*f2) is_transformable_to the Sorts of (FreeMSA X)|
  (S2,f2,g2)
  proof
    let i be set;
    assume i in the carrier of S2;
    then reconsider s = i as SortSymbol of S2;
    (the Sorts of (FreeMSA X)|(S2,f2,g2)).s = ((the Sorts of FreeMSA X)*f2
    ).s by A2,Def3;
    hence thesis;
  end;
  (FreeMSA X)|(S1,f,g) = ((FreeMSA X)|(S2,f2,g2))|(S1,f1,g1) by A1,A2,Th27;
  then consider hf1 being ManySortedFunction of Af1, Af such that
A5: hf1 = hom(f2,g2,X,S2,S3)*f1 and
A6: hf1 is_homomorphism Af1, Af by A1,A3,A4,Th34;
  reconsider hh = hom(f1,g1,X*f2,S1,S2) as ManySortedFunction of FreeMSA(X*f),
  Af1 by RELAT_1:36;
  reconsider hf1h = hf1**hh as ManySortedFunction of FreeMSA(X*f), (FreeMSA X)
  |(S1,f,g);
A7: X*f = X*f2*f1 by RELAT_1:36;
A8: now
    let s be SortSymbol of S1, x be Element of (X*f).s;
    reconsider t = root-tree [x,s] as Term of S1, X*f by MSATERM:4;
A9: FreeMSA (X*f) = MSAlgebra(#FreeSort (X*f), FreeOper (X*f)#) by
MSAFREE:def 14;
    the_sort_of t = s & (FreeSort (X*f)).s = FreeSort(X*f,s) by MSAFREE:def 11
,MSATERM:14;
    then
A10: root-tree [x,s] in (the Sorts of FreeMSA(X*f)).s by A9,MSATERM:def 5;
A11: (X*f).s = (X*f2).(f1.s) by A7,FUNCT_2:15;
    hf1h.s.root-tree [x,s] = ((hf1.s)*(hom(f1,g1,X*f2,S1,S2).s)).
    root-tree [x,s] by MSUALG_3:2
      .= (hf1.s).(hom(f1,g1,X*f2,S1,S2).s.root-tree [x,s]) by A7,A10,FUNCT_2:15
      .= (hf1.s).root-tree [x,f1.s] by A1,A7,Def5;
    hence
    hf1h.s.root-tree [x,s] = (hom(f2,g2,X,S2,S3).(f1.s)).root-tree [x,f1.
    s] by A5,FUNCT_2:15
      .= root-tree [x,f2.(f1.s)] by A2,A11,Def5
      .= root-tree [x,f.s] by FUNCT_2:15;
  end;
A12: f, g form_morphism_between S1,S3 by A1,A2,PUA2MSS1:29;
  hom(f1,g1,X*f2,S1,S2) is_homomorphism FreeMSA(X*f2*f1), (FreeMSA (X*f2))
  |(S1,f1,g1) by A1,Def5;
  then hf1**hh is_homomorphism FreeMSA(X*f), Af by A6,A7,MSUALG_3:10;
  hence thesis by A12,A5,A8,Def5;
end;
