reserve S for non void non empty ManySortedSign,
  U1,U2 for MSAlgebra over S,
  o for OperSymbol of S,
  n for Nat;

theorem Th20:
  for U1,U2 being non-empty MSAlgebra over S for F be
ManySortedFunction of U1,U2, G be ManySortedFunction of U1,Image F st F = G & F
  is_homomorphism U1,U2 holds G is_epimorphism U1,Image F
proof
  let U1,U2 be non-empty MSAlgebra over S;
  let F be ManySortedFunction of U1,U2, G be ManySortedFunction of U1,Image F;
  assume that
A1: F = G and
A2: F is_homomorphism U1,U2;
  for o be OperSymbol of S st Args(o,U1) <> {} for x be Element of Args(o,
  U1) holds (G.(the_result_sort_of o)).(Den(o,U1).x) = Den(o,Image F).(G#x)
  proof
    set IF = Image F;
    reconsider SIF = the Sorts of IF as non-empty MSSubset of U2 by
MSUALG_2:def 9;
    reconsider G1 = G as ManySortedFunction of U1,U2 by A1;
    let o be OperSymbol of S such that
    Args(o,U1) <> {};
    let x be Element of Args(o,U1);
    set SIFo = SIF * (the_arity_of o), Uo = (the Sorts of U2) * (the_arity_of
    o), ao = the_arity_of o;
A3: dom Den(o,U2) = Args(o,U2) by FUNCT_2:def 1;
A4: rng ao c= the carrier of S by FINSEQ_1:def 4;
    then rng ao c= dom SIF by PARTFUN1:def 2;
    then
A5: dom SIFo = dom ao by RELAT_1:27;
    rng ao c= dom (the Sorts of U2) by A4,PARTFUN1:def 2;
    then
A6: dom SIFo = dom Uo by A5,RELAT_1:27;
A7: for x be object st x in dom SIFo holds SIFo.x c= Uo.x
    proof
      let x be object;
      assume
A8:   x in dom SIFo;
      then ao.x in rng ao by A5,FUNCT_1:def 3;
      then reconsider k = ao.x as Element of S by A4;
      set f = F.k;
A9:   dom f = (the Sorts of U1).k by FUNCT_2:def 1;
A10:  rng f c= (the Sorts of U2).k by RELAT_1:def 19;
      SIF = F.:.:(the Sorts of U1) by A2,Def12;
      then SIFo.x = (F.:.:(the Sorts of U1)).k by A8,FUNCT_1:12
        .= f.:((the Sorts of U1).k) by PBOOLE:def 20
        .= rng f by A9,RELAT_1:113;
      hence thesis by A6,A8,A10,FUNCT_1:12;
    end;
A11: dom x = dom the_arity_of o by Th6;
A12: now
      let a be object;
      assume
A13:  a in dom the_arity_of o;
      then reconsider n = a as Nat;
      (G#x).n = (G.((the_arity_of o)/.n)).(x.n) by A11,A13,Def6;
      hence (G#x).a = (G1#x).a by A11,A13,Def6;
    end;
    dom (G#x) = dom the_arity_of o & dom (G1#x) = dom the_arity_of o
    by Th6;
    then G#x = G1#x by A12,FUNCT_1:2;
    then
A14: (G.(the_result_sort_of o)).(Den(o,U1).x)= Den(o,U2).(G#x) by A1,A2;
    SIF is opers_closed by MSUALG_2:def 9;
    then
A15: SIF is_closed_on o;
    Args(o,IF) = product(SIFo) & Args(o,U2) = product(Uo) by PRALG_2:3;
    then Args(o,IF) c= Args(o,U2) by A6,A7,CARD_3:27;
    then G#x in dom Den(o,U2) by A3;
    then
A16: (SIF# * the Arity of S).o = Args(o,IF) & G#x in (dom Den(o,U2)) /\
    Args(o,IF ) by MSUALG_1:def 4,XBOOLE_0:def 4;
    the Charact of IF = Opers(U2,SIF) by MSUALG_2:def 9;
    then Den(o,IF) = (Opers(U2,SIF)).o by MSUALG_1:def 6
      .= o/.(SIF) by MSUALG_2:def 8
      .= (Den(o,U2))|((SIF# * the Arity of S).o) by A15,MSUALG_2:def 7;
    hence thesis by A14,A16,FUNCT_1:48;
  end;
  then
A17: G is_homomorphism U1,Image F;
  for i be set st i in the carrier of S holds rng(G.i) = (the Sorts of
  Image F).i
  proof
    let i be set;
    assume i in the carrier of S;
    then reconsider i as Element of S;
    set g = G.i;
    the Sorts of (Image F) = G.:.:(the Sorts of U1) by A1,A2,Def12;
    then
A18: (the Sorts of Image F).i = g.:((the Sorts of U1).i) by PBOOLE:def 20;
    dom g = (the Sorts of U1).i by FUNCT_2:def 1;
    hence thesis by A18,RELAT_1:113;
  end;
  then G is "onto";
  hence thesis by A17;
end;
