reserve M,N for non empty multMagma,
  f for Function of M, N;
reserve M for multMagma;
reserve N,K for multSubmagma of M;
reserve M,N for non empty multMagma,
  A for Subset of M,
  f,g for Function of M,N,
  X for stable Subset of M,
  Y for stable Subset of N;
reserve X for set;
reserve x,y,Y for set;
reserve n,m,p for Nat;
reserve v,v1,v2,w,w1,w2 for Element of free_magma X;
reserve X,Y,Z for non empty set;
reserve M for non empty multMagma;
reserve M,N for non empty multMagma,
      f for Function of M, N,
      H for non empty multSubmagma of N,
      R for compatible Equivalence_Relation of M;
reserve f for Function of X,Y;
reserve g for Function of Y,Z;

theorem
  f is onto implies free_magmaF f is onto
proof
  assume A1: f is onto;
  for y being object
   st y in the carrier of free_magma Y holds y in rng free_magmaF f
  proof
    let y be object;
    assume A2: y in the carrier of free_magma Y;
    defpred P[Nat] means for w being Element of free_magma Y st length w = $1
    holds ex v being Element of free_magma X st w = (free_magmaF f).v;
    A3: for k being Nat st for n being Nat st n < k holds P[n] holds P[k]
    proof
      let k be Nat;
      assume A4: for n being Nat st n < k holds P[n];
      thus for w being Element of free_magma Y st length w = k
      holds ex v being Element of free_magma X st w = (free_magmaF f).v
      proof
        let w be Element of free_magma Y;
        assume A5: length w = k;
        A6: w = [w`1,w`2] & length w >= 1 by Th32; then
        length w = 1 or length w > 1 by XXREAL_0:1; then
        A7: length w = 1 or length w +1 > 1+1 by XREAL_1:8;
        per cases by A7,NAT_1:13;
        suppose A8: length w = 1;
          set y = w`1;
          y in {w9`1 where w9 is Element of free_magma Y: length w9 = 1}
          by A8; then
          A9: y in Y by Th30;
          (free_magmaF f) extends
          (canon_image(Y,1)*f)*(canon_image(X,1)") by Def21; then
          A10: dom((canon_image(Y,1)*f)*(canon_image(X,1)")) c=
          dom(free_magmaF f) &
          (canon_image(Y,1)*f)*(canon_image(X,1)") tolerates
          free_magmaF f;
          A11: canon_image(Y,1).y = [y,1] by A9,Lm3 .= w by Def18,A6,A8;
          A12: rng f = Y by A1,FUNCT_2:def 3; then
          consider x being object such that
          A13: x in dom f & y = f.x by A9,FUNCT_1:def 3;
          A14: 1 in {1} by TARSKI:def 1;
          A15: x in X by A13; then
          x in free_magma(X,1) by Def13; then
          A16: [x,1] in [:free_magma(X,1),{1}:] by A14,ZFMISC_1:def 2;
          [:free_magma(X,1),{1}:] c= free_magma_carrier X by Lm1; then
          reconsider v = [x,1] as Element of free_magma X by A16;
          take v;
          A17: x in dom canon_image(X,1) by Lm3,A15;
          A18: v = canon_image(X,1).x by Lm3,A13; then
          v in rng canon_image(X,1) by A17,FUNCT_1:3; then
          A19: v in dom(canon_image(X,1)") by FUNCT_1:33;
          rng f = dom canon_image(Y,1) by Lm3,A12; then
          dom f = dom(canon_image(Y,1)*f) by RELAT_1:27; then
          X c= dom(canon_image(Y,1)*f) by FUNCT_2:def 1; then
          dom canon_image(X,1) c= dom(canon_image(Y,1)*f) by Lm3; then
          rng(canon_image(X,1)") c= dom(canon_image(Y,1)*f) by FUNCT_1:33; then
          A20: v in dom((canon_image(Y,1)*f)*(canon_image(X,1)"))
          by A19,RELAT_1:27; then
          A21: (free_magmaF f).v
          = ((canon_image(Y,1)*f)*(canon_image(X,1)")).v by A10,PARTFUN1:53
          .= (canon_image(Y,1)*f).((canon_image(X,1)").v) by A20,FUNCT_1:12;
          x in dom canon_image(X,1) by A15,Lm3; then
          (canon_image(X,1)").v = x by A18,FUNCT_1:34;
          hence thesis by A11,A13,A21,FUNCT_1:13;
        end;
        suppose length w >= 2; then
          consider w1,w2 be Element of free_magma Y such that
          A22: w = w1*w2 & length w1 < length w & length w2 < length w by Th34;
          consider v1 be Element of free_magma X such that
          A23: w1 = (free_magmaF f).v1 by A22,A4,A5;
          consider v2 be Element of free_magma X such that
          A24: w2 = (free_magmaF f).v2 by A22,A4,A5;
          take v1*v2;
          thus thesis by A23,A24,A22,GROUP_6:def 6;
        end;
      end;
    end;
    A25: for k being Nat holds P[k] from NAT_1:sch 4(A3);
    A26: for w being Element of free_magma Y holds
    ex v being Element of free_magma X st w = (free_magmaF f).v
    proof
      let w be Element of free_magma Y;
      reconsider k=length w as Nat;
      P[k] by A25;
      hence thesis;
    end;
    ex x st x in dom free_magmaF f & y = (free_magmaF f).x
    proof
      consider x be Element of free_magma X such that
      A27: y = (free_magmaF f).x by A2,A26;
      take x;
      x in the carrier of free_magma X;
      hence x in dom free_magmaF f by FUNCT_2:def 1;
      thus y = (free_magmaF f).x by A27;
    end;
    hence y in rng free_magmaF f by FUNCT_1:def 3;
  end; then
  the carrier of free_magma Y c= rng free_magmaF f; then
  rng free_magmaF f = the carrier of free_magma Y by XBOOLE_0:def 10;
  hence free_magmaF f is onto by FUNCT_2:def 3;
end;
