reserve S for non void non empty ManySortedSign,
  U0 for MSAlgebra over S;
reserve S for non void non empty ManySortedSign,
  X for ManySortedSet of the carrier of S,
  o for OperSymbol of S,
  b for Element of ([:the carrier' of S,{the
  carrier of S}:] \/ Union (coprod X))*;
reserve x for set;

theorem Th18:
  for S be non void non empty ManySortedSign, U1 be non-empty
  MSAlgebra over S ex U0 be strict free non-empty MSAlgebra over S, F be
  ManySortedFunction of U0,U1 st F is_epimorphism U0,U1
proof
  let S be non void non empty ManySortedSign, U1 be non-empty MSAlgebra over S;
  set S1 = the Sorts of U1, FA = FreeMSA(S1), FG = FreeGen(S1);
  reconsider fa = FA as strict free non-empty MSAlgebra over S by Th17;
  set f = Reverse(S1);
  take fa;
  FG is free by Th16;
  then consider F be ManySortedFunction of FA,U1 such that
A1: F is_homomorphism FA,U1 and
A2: F || FG = f;
  reconsider a = F as ManySortedFunction of fa,U1;
  take a;
  thus a is_homomorphism fa,U1 by A1;
  thus a is "onto"
  proof
    let s be set;
    assume s in the carrier of S;
    then reconsider s0 = s as SortSymbol of S;
    reconsider g = a.s as Function of (the Sorts of fa).s0, S1.s0 by
PBOOLE:def 15;
A3: f.s0 = g | (FG.s0) by A2,Def1;
    then
A4: rng (f.s0) c= rng g by RELAT_1:70;
    thus rng (a.s) c= S1.s by A3,RELAT_1:def 19;
    let x be object;
    set D = DTConMSA(S1), t = [x,s0];
    assume x in S1.s;
    then
A5: t in Terminals D by Th7;
    then reconsider t as Symbol of D;
    t`2 = s0;
    then root-tree t in {root-tree tt where tt is Symbol of D : tt in
    Terminals D & tt`2 = s0} by A5;
    then
A6: root-tree t in FreeGen(s0,S1) by Th13;
A7: f.s0 = Reverse(s0,S1) by Def18;
    then dom (f.s0) = FreeGen(s0,S1) by FUNCT_2:def 1;
    then
A8: (f.s0).(root-tree t) in rng (f.s0) by A6,FUNCT_1:def 3;
    (f.s0).(root-tree t) = t`1 by A7,A6,Def17
      .= x;
    hence thesis by A4,A8;
  end;
end;
