reserve i for Nat, x,y for set;
reserve S for non empty non void ManySortedSign;
reserve X for non-empty ManySortedSet of S;

theorem Th56:
  for I,N being set
  for S being (1,I,N)-array non empty non void ConnectivesSignature
  for Y being non empty set
  for X being non-empty ManySortedSet of Y st
  ((the ResultSort of S).((the connectives of S).2) nin Y or
  X.((the ResultSort of S).((the connectives of S).2)) = (X.I)^omega) &
  X.N = INT & I in Y
  ex A being non-empty strict MSAlgebra over S st A is (1,I,N)-array &
  the Sorts of A tolerates X
  proof
    let I,N be set;
    let S be (1,I,N)-array non empty non void ConnectivesSignature;
    let A be non empty set;
    let V be non-empty ManySortedSet of A;
    assume A1: (the ResultSort of S).((the connectives of S).2) nin A or
    V.((the ResultSort of S).((the connectives of S).2)) = (V.I)^omega;
    assume A2: V.N = INT & I in A;
    set X0 = the non-empty ManySortedSet of the carrier of S;
    set X = (X0)+*(V|the carrier of S);
    reconsider X as non-empty ManySortedSet of the carrier of S;
A3: len the connectives of S >= 1+3 by Def50;
    consider J,K,L being Element of S such that
A4: L = I & K = N & J <> L & J <> K &
    (the connectives of S).1 is_of_type <*J,K*>, L &
    (the connectives of S).(1+1) is_of_type <*J,K,L*>, J &
    (the connectives of S).(1+2) is_of_type <*J*>, K &
    (the connectives of S).(1+3) is_of_type <*K,L*>, J by Def50;
A5: J nin A or V.J = (V.L)^omega by A1,A4;
    set Z = X+*(N,INT);
    set Y = Z+*(J,(Z.L)^omega);
    set O = the ManySortedFunction of Y# * the Arity of S,
    Y * the ResultSort of S;
A6: dom V = A & dom X = the carrier of S by PARTFUN1:def 2;
    then
A7: dom (V|the carrier of S) = A /\ the carrier of S by RELAT_1:61;
    then I in dom (V|the carrier of S) by A2,A4,XBOOLE_0:def 4;
    then
A8: X.I = (V|the carrier of S).I by FUNCT_4:13 .= V.I by A4,FUNCT_1:49;
    N in dom V by A2,FUNCT_1:def 2;
    then N in dom (V|the carrier of S) by A6,A7,A4,XBOOLE_0:def 4;
    then
A9: X.N = (V|the carrier of S).N by FUNCT_4:13 .= V.N by A4,FUNCT_1:49;
    deffunc F(Function) = IFIN($1.2,proj1($1.1),$1..(1,$1.2),
    the Element of Y.L);
    N = I or N <> I;
    then
A10: Z.I = X.I or Z.I = INT & X.I = INT by A2,A4,A9,A6,FUNCT_7:31,32;
    consider f being Function such that
A11: dom f = product <*Y.J,Y.K*> &
    for x being Element of product <*Y.J,Y.K*> holds f.x = F(x)
    from FUNCT_1:sch 4;
A12: dom Y = the carrier of S & dom Z = the carrier of S &
    dom X = the carrier of S by PARTFUN1:def 2;
    then
A13: Y.L = Z.L & Z.K = INT by A4,FUNCT_7:31,32;
    then
A14: Y.J = (Y.L)^omega & Y.K = INT by A12,A4,FUNCT_7:31,32;
    rng f c= Y.L
    proof
      let x be object; assume x in rng f;
      then consider y being object such that
A15:   y in dom f & x = f.y by FUNCT_1:def 3;
      reconsider y as Element of product <*Y.J,Y.K*> by A11,A15;
A16:   x = F(y) by A11,A15;
      consider a,b being object such that
A17:   a in Y.J & b in Y.K & y = <*a,b*> by FINSEQ_3:124;
      reconsider a as Element of (Y.L)^omega by A13,A17,A12,FUNCT_7:31;
A18:   a = y.1 & b = y.2 & a is XFinSequence of Y.L by A17;
      per cases;
      suppose
A19:     y.2 in proj1(y.1);
        then x = y..(1,y.2) by A16,MATRIX_7:def 1 .= a.b by A18,Th5;
        hence thesis by A18,A19,FUNCT_1:102;
      end;
      suppose y.2 nin proj1(y.1);
        then x = the Element of Y.L by A16,MATRIX_7:def 1;
        hence thesis;
      end;
    end;
    then reconsider f as Function of product <*Y.J,Y.K*>, Y.L by A11,FUNCT_2:2;
    1 <= len the connectives of S by A3,XXREAL_0:2;
    then
A20: 1 in dom the connectives of S by FINSEQ_3:25;
    then reconsider o1 = (the connectives of S).1 as OperSymbol of S
    by FUNCT_1:102;
A21: (the Arity of S).o1 = <*J,K*> & (the ResultSort of S).o1 = L by A4;
    <*J,K*> in (the carrier of S)* by FINSEQ_1:def 11;
    then Y#.((the Arity of S).o1) = product (Y*<*J,K*>) &
    Y*<*J,K*> = <*Y.J,Y.K*> &
    Y.((the ResultSort of S).o1) = Y.L by A21,A12,FINSEQ_2:def 5,125;
    then (Y#*(the Arity of S)).o1 = product <*Y.J,Y.K*> &
    (Y*(the ResultSort of S)).o1 = Y.L by FUNCT_2:15;
    then reconsider f as Function of (Y#*(the Arity of S)).o1,
    (Y*(the ResultSort of S)).o1;
    deffunc G(Element of product <*(Y.L)^omega,Y.K,Y.L*>) = $1.1+*($1.2,$1.3);
    consider g being Function such that
A22: dom g = product <*(Y.L)^omega,Y.K,Y.L*> &
    for x being Element of product <*(Y.L)^omega,Y.K,Y.L*> holds g.x = G(x)
    from FUNCT_1:sch 4;
    rng g c= Y.J
    proof
      let x be object; assume x in rng g;
      then consider y being object such that
A23:   y in dom g & x = g.y by FUNCT_1:def 3;
      reconsider y as Element of product <*(Y.L)^omega,Y.K,Y.L*> by A22,A23;
      consider a,b,c being object such that
A24:   a in (Y.L)^omega & b in Y.K & c in Y.L & y = <*a,b,c*> by FINSEQ_3:125;
      reconsider a as XFinSequence of Y.L by A24;
      reconsider c as Element of Y.L by A24;
A25:   a = y.1 & b = y.2 & c = y.3 by A24;
A26:    x = a+*(b,c) by A25,A22,A23;
      x is XFinSequence of Y.L by A26;
      then x in (Y.L)^omega by AFINSQ_1:def 7;
      hence thesis by A14;
    end;
    then reconsider g as Function of product <*Y.J,Y.K,Y.L*>, Y.J
    by A14,A22,FUNCT_2:2;
    2 <= len the connectives of S by A3,XXREAL_0:2;
    then
A27: 2 in dom the connectives of S by FINSEQ_3:25;
    then reconsider o2 = (the connectives of S).2 as OperSymbol of S
    by FUNCT_1:102;
A28: (the Arity of S).o2 = <*J,K,L*> & (the ResultSort of S).o2 = J
    by A4;
    <*J,K,L*> in (the carrier of S)* by FINSEQ_1:def 11;
    then Y#.((the Arity of S).o2) = product (Y*<*J,K,L*>) &
    Y*<*J,K,L*> = <*Y.J,Y.K,Y.L*> &
    Y.((the ResultSort of S).o2) = Y.J by A28,A12,FINSEQ_2:def 5,126;
    then (Y#*(the Arity of S)).o2 = product <*Y.J,Y.K,Y.L*> &
    (Y*(the ResultSort of S)).o2 = Y.J by FUNCT_2:15;
    then reconsider g as Function of (Y#*(the Arity of S)).o2,
    (Y*(the ResultSort of S)).o2;
    deffunc H(Element of product <*(Y.L)^omega *>) = card ($1.1);
    consider h being Function such that
A29: dom h = product <*(Y.L)^omega *> &
    for x being Element of product <*(Y.L)^omega *> holds h.x = H(x)
    from FUNCT_1:sch 4;
    rng h c= Y.K
    proof
      let x be object; assume x in rng h;
      then consider y being object such that
A30:   y in dom h & x = h.y by FUNCT_1:def 3;
      reconsider y as Element of product <*(Y.L)^omega*> by A29,A30;
A31:   x = H(y) by A29,A30;
      consider a being object such that
A32:   a in (Y.L)^omega & y = <*a*> by FINSEQ_3:123;
      reconsider a as 0-based finite array of Y.L by A32;
      x = len a by A31,A32;
      hence thesis by A14,INT_1:def 2;
    end;
    then reconsider h as Function of product <*Y.J*>, Y.K by A14,A29,FUNCT_2:2;
    3 <= len the connectives of S by A3,XXREAL_0:2; then
A33: 3 in dom the connectives of S by FINSEQ_3:25;
    then reconsider o3 = (the connectives of S).3 as OperSymbol of S
    by FUNCT_1:102;
A34: (the Arity of S).o3 = <*J*> & (the ResultSort of S).o3 = K by A4;
    <*J*> in (the carrier of S)* by FINSEQ_1:def 11;
    then Y#.((the Arity of S).o3) = product (Y*<*J*>) & Y*<*J*> = <*Y.J*> &
    Y.((the ResultSort of S).o3) = Y.K by A34,A12,FINSEQ_2:def 5,FINSEQ_2:34;
    then (Y#*(the Arity of S)).o3 = product <*Y.J*> &
    (Y*(the ResultSort of S)).o3 = Y.K by FUNCT_2:15;
    then reconsider h as Function of (Y#*(the Arity of S)).o3,
    (Y*(the ResultSort of S)).o3;
    deffunc H(Element of product <*INT,Y.L*>)
    = IFGT(0,$1.1,{},($1.1)-->($1.2));
    consider j being Function such that
A35: dom j = product <*INT,Y.L*> &
    for x being Element of product <*INT,Y.L*> holds j.x = H(x)
    from FUNCT_1:sch 4;
    rng j c= Y.J
    proof
      let x be object; assume x in rng j;
      then consider y being object such that
A36:   y in dom j & x = j.y by FUNCT_1:def 3;
      reconsider y as Element of product <*Y.K,Y.L*>
      by A35,A36,A13,A4,FUNCT_7:32;
      consider b,c being object such that
A37:   b in Y.K & c in Y.L & y = <*b,c*> by FINSEQ_3:124;
      reconsider c as Element of Y.L by A37;
      reconsider b as Integer by A37,A14;
A38:  b = y.1 & c = y.2 by A37;
      x = IFGT(0,b,{},Segm(b)-->c) by A38,A35,A36;
      then x = {} or b >= 0 & x = Segm(b)-->c &
      (b is non negative implies b is Nat) by XXREAL_0:def 11;
      then x = <%>(Y.L) or ex b being non negative Nat st x = b-->c;
      hence thesis by A14,AFINSQ_1:def 7;
    end;
    then reconsider j as Function of product <*Y.K,Y.L*>, Y.J
    by A14,A35,FUNCT_2:2;
A39: 4 in dom the connectives of S by A3,FINSEQ_3:25;
    then reconsider o4 = (the connectives of S).4 as OperSymbol of S
    by FUNCT_1:102;
A40: (the Arity of S).o4 = <*K,L*> & (the ResultSort of S).o4 = J
    by A4;
    <*K,L*> in (the carrier of S)* by FINSEQ_1:def 11;
    then Y#.((the Arity of S).o4) = product (Y*<*K,L*>) &
    Y*<*K,L*> = <*Y.K,Y.L*> &
    Y.((the ResultSort of S).o4) = Y.J by A40,A12,FINSEQ_2:def 5,125;
    then (Y#*(the Arity of S)).o4 = product <*Y.K,Y.L*> &
    (Y*(the ResultSort of S)).o4 = Y.J by FUNCT_2:15;
    then reconsider j as Function of (Y#*(the Arity of S)).o4,
    (Y*(the ResultSort of S)).o4;
    set U = O+*(o1,f)+*(o2,g)+*(o3,h)+*(o4,j);
A41: dom O = the carrier' of S & dom (O+*(o1,f)) = the carrier' of S &
    dom (O+*(o1,f)+*(o2,g)) = the carrier' of S & dom U = the carrier' of S &
    dom (O+*(o1,f)+*(o2,g)+*(o3,h)) = the carrier' of S by PARTFUN1:def 2;
    card ((the Arity of S).o1) = 2 & card ((the Arity of S).o2) = 3 &
    card ((the Arity of S).o3) = 1 & card ((the Arity of S).o4) = 2
    by A21,A28,A34,A40,CARD_1:def 7;
    then
A42: o1 <> o2 & o2 <> o3 & o3 <> o1 & o1 <> o4 & o2 <> o4 & o3 <> o4 by A4;
A43: U.o1 = (O+*(o1,f)+*(o2,g)+*(o3,h)).o1 by A42,FUNCT_7:32
    .= (O+*(o1,f)+*(o2,g)).o1 by A42,FUNCT_7:32
    .= (O+*(o1,f)).o1 by A42,FUNCT_7:32 .= f by A41,FUNCT_7:31;
A44: U.o2 = (O+*(o1,f)+*(o2,g)+*(o3,h)).o2 by A42,FUNCT_7:32
    .= (O+*(o1,f)+*(o2,g)).o2 by A42,FUNCT_7:32 .= g by A41,FUNCT_7:31;
A45: U.o3 = (O+*(o1,f)+*(o2,g)+*(o3,h)).o3 by A42,FUNCT_7:32
    .= h by A41,FUNCT_7:31;
A46: U.o4 = j by A41,FUNCT_7:31;
    U is ManySortedFunction of Y#*the Arity of S, Y*the ResultSort of S
    proof
      let x be object; assume x in the carrier' of S;
      then reconsider o = x as OperSymbol of S;
      per cases;
      suppose o = o1 or o = o2 or o = o3 or o = o4;
        hence U.x is Function of (Y#*the Arity of S).x,
        (Y*the ResultSort of S).x
        by A43,A44,A45,A41,FUNCT_7:31;
      end;
      suppose
A47:     o <> o1 & o <> o2 & o <> o3 & o <> o4;
        U.o = (O+*(o1,f)+*(o2,g)+*(o3,h)).o by A47,FUNCT_7:32
        .= (O+*(o1,f)+*(o2,g)).o by A47,FUNCT_7:32
        .= (O+*(o1,f)).o by A47,FUNCT_7:32 .= O.o by A47,FUNCT_7:32;
        hence U.x is Function of (Y#*the Arity of S).x,
        (Y*the ResultSort of S).x;
      end;
    end;
    then reconsider U as ManySortedFunction of Y#*the Arity of S,
    Y*the ResultSort of S;
    set A = MSAlgebra(#Y, U#);
    A is non-empty;
    then reconsider A as non-empty strict MSAlgebra over S;
    take A;
    thus A is (1,I,N)-array
    proof
    take J,L; thus L = I by A4;
    thus (the connectives of S).1 is_of_type <*J,N*>, L by A4;
    thus (the Sorts of A).J = ((the Sorts of A).L)^omega &
    (the Sorts of A).N = INT by A4,A13,A12,FUNCT_7:31,32;
    hereby
      let a be 0-based finite array of (the Sorts of A).L;
A48:   a in (Y.L)^omega by AFINSQ_1:def 7;
      hereby let i be Integer; assume
A49:     i in dom a;
A50:     i in Y.N by A4,A14,INT_1:def 2;
        then
A51:     <*a,i*> in product <*(Y.L)^omega,Y.N*> by A48,FINSEQ_3:124;
A52:     <*a,i*>.1 = a & <*a,i*>.2 = i;
        (the connectives of S)/.1 = o1 by A20,PARTFUN1:def 6;
        hence Den((the connectives of S)/.1,A).<*a,i*> = F(<*a,i*>)
        by A4,A11,A14,A43,A51
        .= <*a,i*>..(1,i) by A49,MATRIX_7:def 1 .= a.i by A52,Th5;
        let x be Element of A,L;
A53:     <*a,i,x*> in product <*(Y.L)^omega,Y.N,Y.L*> by A48,A50,FINSEQ_3:125;
A54:     <*a,i,x*>.1 = a & <*a,i,x*>.2 = i & <*a,i,x*>.3 = x;
        (the connectives of S)/.2 = o2 by A27,PARTFUN1:def 6;
        hence Den((the connectives of S)/.(1+1),A).<*a,i,x*> = a+*(i,x)
        by A4,A22,A44,A53,A54;
      end;
A55:   <*a*> in product <*(Y.L)^omega*> by A48,FINSEQ_3:123;
A56:   <*a*>.1 = a;
      (the connectives of S)/.3 = o3 by A33,PARTFUN1:def 6;
      hence Den((the connectives of S)/.(1+2),A).<*a*> = card a by A29,A45,A55,
A56;
    end;
    let i be Integer;
    let x be Element of A,L;
    assume A57: i >= 0;
A58: o4 = (the connectives of S)/.(1+3) by A39,PARTFUN1:def 6;
    i in INT & x in Y.L by INT_1:def 2;
    then <*i,x*> in product <*INT,Y.L*> & <*i,x*>.1 = i & <*i,x*>.2 = x
    by FINSEQ_3:124;
    hence Den((the connectives of S)/.(1+3),A).<*i,x*>
    = IFGT(0,i,{},Segm(i)-->x) by A35,A46,A58
    .= Segm(i)-->x by A57,XXREAL_0:def 11;
    end;
    thus the Sorts of A tolerates V
    proof
      let x be object; assume
A59:   x in dom (the Sorts of A)/\dom V;
      then x in (the carrier of S)/\dom V by PARTFUN1:def 2;
      then
A60:   x in dom(V|the carrier of S) by RELAT_1:61;
      then
A61:   X.x = (V|the carrier of S).x by FUNCT_4:13 .= V.x by A60,FUNCT_1:47;
      per cases;
      suppose x <> N & x <> J;
        then Z.x = X.x & Y.x = Z.x by FUNCT_7:32;
        hence (the Sorts of A).x = V.x by A61;
      end;
      suppose x = N;
        hence (the Sorts of A).x = V.x by A2,A13,A4,FUNCT_7:32;
      end;
      suppose
A62:     x = J;
        then x nin dom V or x in dom V & V.x = (V.L)^omega
        by A5,PARTFUN1:def 2;
        hence (the Sorts of A).x = V.x
        by A59,A10,A62,A12,A4,FUNCT_7:31,XBOOLE_0:def 4,A8;
      end;
    end;
  end;
