reserve S for non empty non void ManySortedSign;
reserve X for non-empty ManySortedSet of S;
reserve x,y,z for set, i,j for Nat;
reserve
  A0 for (X,S)-terms non-empty MSAlgebra over S,
  A1 for all_vars_including (X,S)-terms MSAlgebra over S,
  A2 for all_vars_including inheriting_operations (X,S)-terms MSAlgebra over S,
  A for all_vars_including inheriting_operations free_in_itself
  (X,S)-terms MSAlgebra over S;

theorem
  for T being free_in_itself non-empty (X,S)-terms MSAlgebra over S
  for A being image of T
  for G being GeneratorSet of T st G = FreeGen X
  for f being ManySortedFunction of G, the Sorts of A
  ex h being ManySortedFunction of T,A st
  h is_homomorphism T,A & f = h||G
  proof
    let T be free_in_itself non-empty (X,S)-terms MSAlgebra over S;
    let A be image of T;
    let G be GeneratorSet of T such that
A1: G = FreeGen X;
    let f be ManySortedFunction of G, the Sorts of A;
    reconsider H = FreeGen X as non-empty GeneratorSet of Free(S,X)
    by MSAFREE3:31;
    consider j being ManySortedFunction of T,A such that
A2: j is_epimorphism T,A by Def5;
A3: j is_homomorphism T,A & j is "onto" by A2;
    consider jj being ManySortedFunction of A,T such that
A4: j**jj = id the Sorts of A by A3,Th23,Th21;
    consider h being ManySortedFunction of T,T such that
A5: h is_homomorphism T,T & jj**f = h || G by A1,Def9;
    take k = j**h;
    thus k is_homomorphism T,A by A3,A5,MSUALG_3:10;
    thus f = (id the Sorts of A)**f by MSUALG_3:4
    .= j**(jj**f) by A4,PBOOLE:140
    .= k || G by A5,EXTENS_1:4;
  end;
