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;

theorem
  v1*v2 = w1*w2 implies v1 = w1 & v2 = w2
proof
  assume A1: v1*v2 = w1*w2;
  per cases;
  suppose A2: X is non empty; then
    v1*v2 = [[[v1`1,v2`1],v1`2],length v1 + length v2] &
    w1*w2 = [[[w1`1,w2`1],w1`2],length w1 + length w2] by Th31; then
    A3: [[v1`1,v2`1],v1`2] = [[w1`1,w2`1],w1`2] &
    length v1 + length v2 = length w1 + length w2 by A1,XTUPLE_0:1; then
    A4: [v1`1,v2`1] = [w1`1,w2`1] & v1`2 = w1`2 by XTUPLE_0:1;
    length v1 = v1`2 by A2,Def18 .= length w1 by A2,A4,Def18; then
    v2`2 = length w2 by A2,A3,Def18; then
    A5: v2`2 = w2`2 by A2,Def18;
    thus v1 = [v1`1,v1`2] by A2,Th32 .= [w1`1,w1`2] by A4,XTUPLE_0:1
    .= w1 by A2,Th32;
    thus v2 = [v2`1,v2`2] by A2,Th32 .= [w2`1,w2`2] by A5,A4,XTUPLE_0:1
    .= w2 by A2,Th32;
  end;
  suppose X is empty; then
    v1 = {} & w1 = {} & v2 = {} & w2 = {} by SUBSET_1:def 1;
    hence thesis;
  end;
end;
