reserve I for set;
reserve S for non empty non void ManySortedSign,
  U0, U1 for non-empty MSAlgebra over S;

theorem Th25:
  for I being non empty finite set, A being non-empty MSAlgebra
  over S for F being MSAlgebra-Family of I, S st for i being Element of I ex C
  being strict non-empty finitely-generated MSSubAlgebra of A st C = F.i ex B
  being strict non-empty finitely-generated MSSubAlgebra of A st for i being
  Element of I holds F.i is MSSubAlgebra of B
proof
  let I be non empty finite set, A be non-empty MSAlgebra over S, F be
  MSAlgebra-Family of I, S such that
A1: for i being Element of I ex C being strict non-empty
  finitely-generated MSSubAlgebra of A st C = F.i;
  set Z = { C where C is Element of MSSub A : ex i being (Element of I), D
being strict non-empty finitely-generated MSSubAlgebra of A st C = F.i & C = D
  };
  set J = the carrier of S;
  set m = the Element of I;
  consider W being strict non-empty finitely-generated MSSubAlgebra of A such
  that
A2: W = F.m by A1;
  W is Element of MSSub A by MSUALG_2:def 19;
  then W in Z by A2;
  then reconsider Z as non empty set;
  defpred P[set,set] means ex Q being strict non-empty MSSubAlgebra of A, G
  being GeneratorSet of Q st $1 = Q & $2 = G & G is non-empty finite-yielding;
A3: for a being Element of Z ex b being Element of Bool the Sorts of A st P[
  a,b]
  proof
    let a be Element of Z;
    a in Z;
    then consider C being Element of MSSub A such that
A4: a = C and
A5: ex i being (Element of I), D being strict non-empty
    finitely-generated MSSubAlgebra of A st C = F.i & C = D;
    consider i being (Element of I), D being strict non-empty
    finitely-generated MSSubAlgebra of A such that
    C = F.i and
A6: C = D by A5;
    consider G being GeneratorSet of D such that
A7: G is finite-yielding by MSAFREE2:def 10;
    consider S being non-empty finite-yielding ManySortedSubset of the Sorts
    of D such that
A8: G c= S by A7,MSUALG_9:7;
    the Sorts of D is MSSubset of A by MSUALG_2:def 9;
    then S c= the Sorts of D & the Sorts of D c= the Sorts of A by
PBOOLE:def 18;
    then S c= the Sorts of A by PBOOLE:13;
    then S is ManySortedSubset of the Sorts of A by PBOOLE:def 18;
    then reconsider b = S as Element of Bool the Sorts of A by CLOSURE2:def 1;
    reconsider S as GeneratorSet of D by A8,MSSCYC_1:21;
    take b, D;
    take S;
    thus a = D by A4,A6;
    thus thesis;
  end;
  consider f being Function of Z, Bool the Sorts of A such that
A9: for B being Element of Z holds P[B,f.B] from FUNCT_2:sch 3(A3);
  deffunc F(object) =
  union { a where a is Element of bool ((the Sorts of A).$1)
: ex i being (Element of I), K being ManySortedSet of J st K = f.(F.i) & a = K.
  $1 };
  consider SOR being ManySortedSet of J such that
A10: for j being object st j in J holds SOR.j = F(j) from PBOOLE:sch 4;
  SOR is ManySortedSubset of the Sorts of A
  proof
    let j be object such that
A11: j in J;
    let q be object;
    set UU = { a where a is Element of bool ((the Sorts of A).j) : ex i being
    (Element of I), K being ManySortedSet of J st K = f.(F.i) & a = K.j };
    assume q in SOR.j;
    then q in union UU by A10,A11;
    then consider w being set such that
A12: q in w and
A13: w in UU by TARSKI:def 4;
    consider a being Element of bool ((the Sorts of A).j) such that
A14: w = a and
    ex i being (Element of I), K being ManySortedSet of J st K = f.(F.i) &
    a = K.j by A13;
    thus thesis by A12,A14;
  end;
  then reconsider SOR as MSSubset of A;
  SOR is non-empty
  proof
    set i = the Element of I;
    consider C being strict non-empty finitely-generated MSSubAlgebra of A
    such that
A15: C = F.i by A1;
    C is Element of MSSub A by MSUALG_2:def 19;
    then
A16: F.i in Z by A15;
    then
A17: ex Q being strict non-empty MSSubAlgebra of A st ex G being
GeneratorSet of Q st F.i = Q & f.(F.i) = G & G is non-empty finite-yielding by
A9;
    then reconsider
    G1 = f.(F.i) as finite-yielding Element of Bool the Sorts of A
    by A16,FUNCT_2:5;
    let j be object such that
A18: j in J;
    consider q be object such that
A19: q in G1.j by A18,A17,XBOOLE_0:def 1;
    set UU = { a where a is Element of bool ((the Sorts of A).j) : ex i being
    (Element of I), K being ManySortedSet of J st K = f.(F.i) & a = K.j };
    G1 c= the Sorts of A by PBOOLE:def 18;
    then G1.j c= (the Sorts of A).j by A18;
    then G1.j in UU;
    then q in union UU by A19,TARSKI:def 4;
    hence thesis by A10,A18;
  end;
  then reconsider SOR as non-empty MSSubset of A;
A20: now
    set i = the Element of I;
    let j be set such that
A21: j in J;
    set UU = { a where a is Element of bool ((the Sorts of A).j) : ex i being
    (Element of I), K being ManySortedSet of J st K = f.(F.i) & a = K.j };
    consider C being strict non-empty finitely-generated MSSubAlgebra of A
    such that
A22: C = F.i by A1;
    C is Element of MSSub A by MSUALG_2:def 19;
    then
A23: F.i in Z by A22;
    then ex Q being strict non-empty MSSubAlgebra of A st ex G being
GeneratorSet of Q st F.i = Q & f.(F.i) = G & G is non-empty finite-yielding by
A9;
    then reconsider
    G1 = f.(F.i) as finite-yielding Element of Bool the Sorts of A
    by A23,FUNCT_2:5;
    G1 c= the Sorts of A by PBOOLE:def 18;
    then G1.j c= (the Sorts of A).j by A21;
    then G1.j in UU;
    hence UU is non empty;
  end;
  SOR is finite-yielding
  proof
    let j be object such that
A24: j in J;
    set UU = { a where a is Element of bool ((the Sorts of A).j) : ex i being
    (Element of I), K being ManySortedSet of J st K = f.(F.i) & a = K.j };
    reconsider VV = UU as non empty set by A20,A24;
A25: now
      defpred P[set,set] means ex L being ManySortedSet of J st f.(F.$1) = L &
      $2 = L.j;
      consider r being FinSequence such that
A26:  rng r = I by FINSEQ_1:52;
A27:  for a being Element of I ex b being Element of VV st P[a,b]
      proof
        let a be Element of I;
        consider W being strict non-empty finitely-generated MSSubAlgebra of A
        such that
A28:    W = F.a by A1;
        W is Element of MSSub A by MSUALG_2:def 19;
        then
A29:    W in Z by A28;
        then ex Q being strict non-empty MSSubAlgebra of A st ex G being
GeneratorSet of Q st W = Q & f.W = G & G is non-empty finite-yielding by A9;
        then reconsider
        G1 = f.(F.a) as finite-yielding Element of Bool the Sorts
        of A by A28,A29,FUNCT_2:5;
        G1 c= the Sorts of A by PBOOLE:def 18;
        then G1.j c= (the Sorts of A).j by A24;
        then G1.j in UU;
        then reconsider b = G1.j as Element of VV;
        take b, G1;
        thus thesis;
      end;
      consider h being Function of I, VV such that
A30:  for i being Element of I holds P[i,h.i] from FUNCT_2:sch 3(A27);
A31:  rng r = dom h by A26,FUNCT_2:def 1;
      then reconsider p = h*r as FinSequence by FINSEQ_1:16;
A32:  VV c= rng p
      proof
        let q be object;
        assume q in VV;
        then consider a being Element of bool ((the Sorts of A).j) such that
A33:    q = a and
A34:    ex i being (Element of I), K being ManySortedSet of J st K =
        f.(F.i) & a = K.j;
        consider i being (Element of I), K being ManySortedSet of J such that
A35:    K = f.(F.i) & a = K.j by A34;
A36:    rng p = rng h & dom h = I by A31,FUNCT_2:def 1,RELAT_1:28;
        ex L being ManySortedSet of J st f.(F.i) = L & h.i = L.j by A30;
        hence thesis by A33,A35,A36,FUNCT_1:def 3;
      end;
      take p;
      rng p c= rng h
      by FUNCT_1:14;
      then rng p c= VV by XBOOLE_1:1;
      hence rng p = VV by A32;
    end;
    for x being set st x in UU holds x is finite
    proof
      let x be set;
      assume x in UU;
      then consider a being Element of bool ((the Sorts of A).j) such that
A37:  x = a and
A38:  ex w being (Element of I), K being ManySortedSet of J st K = f.
      (F.w) & a = K.j;
      consider w being (Element of I), K being ManySortedSet of J such that
A39:  K = f.(F.w) & a = K.j by A38;
A40:  ex E being strict non-empty finitely-generated MSSubAlgebra of A st
      E = F.w by A1;
      then F.w is Element of MSSub A by MSUALG_2:def 19;
      then F.w in Z by A40;
      then P[F.w,f.(F.w)] by A9;
      hence thesis by A37,A39;
    end;
    then union UU is finite by A25,FINSET_1:7;
    hence thesis by A10,A24;
  end;
  then reconsider SOR as non-empty finite-yielding MSSubset of A;
  take GenMSAlg SOR;
  let i be Element of I;
  consider C being strict non-empty finitely-generated MSSubAlgebra of A such
  that
A41: C = F.i by A1;
  C is Element of MSSub A by MSUALG_2:def 19;
  then F.i in Z by A41;
  then consider
  Q being strict non-empty MSSubAlgebra of A, G being GeneratorSet of
  Q such that
A42: F.i = Q and
A43: f.(F.i) = G and
A44: G is non-empty finite-yielding by A9;
  the Sorts of Q is MSSubset of A by MSUALG_2:def 9;
  then G c= the Sorts of Q & the Sorts of Q c= the Sorts of A by PBOOLE:def 18;
  then
A45: G c= the Sorts of A by PBOOLE:13;
  then reconsider G1 = G as non-empty MSSubset of A by A44,PBOOLE:def 18;
A46: G1 is ManySortedSubset of SOR
  proof
    let j be object such that
A47: j in J;
    set UU = { a where a is Element of bool ((the Sorts of A).j) : ex i being
    (Element of I), K being ManySortedSet of J st K = f.(F.i) & a = K.j };
    G1.j c= (the Sorts of A).j by A45,A47;
    then
A48: G1.j in UU by A43;
    let q be object;
    assume q in G1.j;
    then q in union UU by A48,TARSKI:def 4;
    hence thesis by A10,A47;
  end;
  C = GenMSAlg G by A41,A42,MSAFREE:3
    .= GenMSAlg G1 by EXTENS_1:18;
  hence thesis by A41,A46,EXTENS_1:17;
end;
