reserve U1,U2,U3 for Universal_Algebra,
  n,m for Nat,
  o1 for operation of U1,
  o2 for operation of U2,
  o3 for operation of U3,
  x,y for set;
reserve a for FinSequence of U1,
  f for Function of U1,U2;

theorem Th6:
  for h1 be Function of U1,U2, h2 be Function of U2,U3 st h1
is_homomorphism & h2 is_homomorphism holds h2 * h1 is_homomorphism
proof
  let h1 be Function of U1,U2, h2 be Function of U2,U3;
  set s1 = signature U1, s2 = signature U2, s3 = signature U3;
  assume that
A1: h1 is_homomorphism and
A2: h2 is_homomorphism;
  U1,U2 are_similar by A1;
  then
A3: s1 = s2;
  U2,U3 are_similar by A2;
  hence s1 = s3 by A3;
  let n;
  assume
A4: n in dom the charact of(U1);
  let o1,o3;
  assume that
A5: o1=(the charact of U1).n and
A6: o3=(the charact of U3).n;
  let a;
  reconsider b = h1*a as Element of (the carrier of U2)* by FINSEQ_1:def 11;
  assume
A7: a in dom o1;
  then
A8: o1.a in rng o1 by FUNCT_1:def 3;
  dom o1 = (arity o1)-tuples_on (the carrier of U1) by MARGREL1:22;
  then a in {w where w is Element of (the carrier of U1)*: len w = arity o1}
  by A7,FINSEQ_2:def 4;
  then
A9: ex w be Element of (the carrier of U1)* st w = a & len w = arity o1;
A10: len s1 = len the charact of(U1) & dom the charact of(U1) = Seg len the
  charact of(U1) by FINSEQ_1:def 3,UNIALG_1:def 4;
A11: len s2 = len the charact of(U2) & dom the charact of(U2) = Seg len the
  charact of(U2) by FINSEQ_1:def 3,UNIALG_1:def 4;
  then reconsider o2 = (the charact of U2).n as operation of U2 by A3,A10,A4,
FUNCT_1:def 3;
A12: dom s1 = Seg len s1 by FINSEQ_1:def 3;
  then
A13: s2.n = arity o2 by A3,A10,A4,UNIALG_1:def 4;
  s1.n = arity o1 by A10,A12,A4,A5,UNIALG_1:def 4;
  then len(h1*a) = arity o2 by A3,A13,A9,FINSEQ_3:120;
  then dom o2 = (arity o2)-tuples_on (the carrier of U2) & b in {s where s is
  Element of (the carrier of U2)*: len s = arity o2} by MARGREL1:22;
  then h1*a in dom o2 by FINSEQ_2:def 4;
  then
A14: h2.(o2.(h1*a)) = o3.(h2*(h1*a)) by A2,A3,A10,A11,A4,A6;
  h1.(o1.a) = o2.(h1*a) by A1,A4,A5,A7;
  hence (h2 * h1).(o1.a) = o3.(h2*(h1*a)) by A8,A14,FUNCT_2:15
    .= o3.((h2 * h1)*a) by Th4;
end;
