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 Th48:
  (canonical_homomorphism A2)**(canonical_homomorphism A2)
  = canonical_homomorphism A2
  proof set A = A2;
    set f = canonical_homomorphism A;
    now
      let x be object; assume x in the carrier of S;
      then reconsider s = x as SortSymbol of S;
      the Sorts of A is MSSubset of Free(S,X) by Def6;
      then
      the Sorts of A c= the Sorts of Free(S,X) &
      dom (f**f) = the carrier of S by PARTFUN1:def 2,PBOOLE:def 18;
      then
A1:   (f**f).s = (f.s)*(f.s) & dom (f.s) = (the Sorts of Free(S,X)).s &
      rng (f.s) c= (the Sorts of A).s &
      (the Sorts of A).s c= (the Sorts of Free(S,X)).s
      by PBOOLE:def 19,FUNCT_2:def 1;
      then
A2:   dom ((f**f).s) = (the Sorts of Free(S,X)).s by XBOOLE_1:1,RELAT_1:27;
      now let y be object; assume
A3:     y in (the Sorts of Free(S,X)).s;
        then
A4:     f.s.y in (the Sorts of A).s by FUNCT_2:5;
        thus (f**f).s.y = f.s.(f.s.y) by A1,A3,FUNCT_1:13 .= f.s.y by A4,Th47;
      end;
      hence (f**f).x = f.x by A1,A2;
    end;
    hence thesis;
  end;
