reserve S for non empty non void ManySortedSign,
  V for non-empty ManySortedSet of the carrier of S,
  A for non-empty MSAlgebra over S,
  X for non empty Subset of S-Terms V,
  t for Element of X;
reserve S for non empty non void ManySortedSign,
  A for non-empty finite-yielding MSAlgebra over S,
  V for Variables of A,
  X for SetWithCompoundTerm of S,V;

theorem Th37:
  for S1, S2 being non empty ManySortedSign for f, g being Function
  for C1 being non-empty MSAlgebra over S1
  for C2 being non-empty MSAlgebra over S2 holds C1, C2 are_similar_wrt f, g
  iff S1, S2 are_equivalent_wrt f, g & the Sorts of C1 = (the Sorts of C2)*f &
  the Charact of C1 = (the Charact of C2)*g
proof
  let S1, S2 be non empty ManySortedSign;
  let f,g be Function;
  let C1 be non-empty MSAlgebra over S1;
  let C2 be non-empty MSAlgebra over S2;
  hereby
    assume
A1: C1, C2 are_similar_wrt f, g;
    hence S1, S2 are_equivalent_wrt f, g by Th36;
    f, g form_embedding_of C1, C2 by A1;
    hence the Sorts of C1 = (the Sorts of C2)*f &
    the Charact of C1 = (the Charact of C2)*g;
  end;
  assume that
A2: f is one-to-one and
A3: g is one-to-one and
A4: f, g form_morphism_between S1, S2 and
A5: f", g" form_morphism_between S2, S1 and
A6: the Sorts of C1 = (the Sorts of C2)*f and
A7: the Charact of C1 = (the Charact of C2)*g;
  thus
  f is one-to-one & g is one-to-one & f, g form_morphism_between S1, S2 &
  the Sorts of C1 = (the Sorts of C2)*f &
  the Charact of C1 = (the Charact of C2)*g by A2,A3,A4,A6,A7;
  thus f" is one-to-one & g" is one-to-one by A2,A3;
  thus f", g" form_morphism_between S2, S1 by A5;
  dom (f") = the carrier of S2 by A5;
  then rng f = the carrier of S2 by A2,FUNCT_1:33;
  then f*(f") = id the carrier of S2 by A2,FUNCT_1:39
    .= id dom the Sorts of C2 by PARTFUN1:def 2;
  hence the Sorts of C2 = (the Sorts of C2)*(f*f") by RELAT_1:52
    .= (the Sorts of C1)*f" by A6,RELAT_1:36;
  dom (g") = the carrier' of S2 by A5;
  then rng g = the carrier' of S2 by A3,FUNCT_1:33;
  then g*(g") = id the carrier' of S2 by A3,FUNCT_1:39
    .= id dom the Charact of C2 by PARTFUN1:def 2;
  hence the Charact of C2 = (the Charact of C2)*(g*g") by RELAT_1:52
    .= (the Charact of C1)*g" by A7,RELAT_1:36;
end;
