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 Th58:
  for n being Nat, I being set st n >= 4
  for B being bool-correct non empty non void BoolSignature
  st B is (n,I) integer
  for A1 being bool-correct non-empty MSAlgebra over B
  st A1 is (n,I) integer
  for C being non empty non void ConnectivesSignature
  st the carrier' of B misses the carrier' of C
  for A2 being non-empty MSAlgebra over C
  st the Sorts of A1 tolerates the Sorts of A2
  for S being bool-correct non empty non void BoolSignature
  st the BoolSignature of S = B+*C
  for A being bool-correct non-empty MSAlgebra over S
  st A = (B,A1)+*A2 holds A is (n,I) integer
  proof
    let n be Nat, s be set such that
A1: n >= 4;
    let B be bool-correct non empty non void BoolSignature;
    assume A2: B is (n,s) integer;
    let A1 be bool-correct non-empty MSAlgebra over B;
    given I being SortSymbol of B such that
A3: I = s &
    (the connectives of B).n is_of_type {},I & (the Sorts of A1).I = INT &
    Den(In((the connectives of B).n, the carrier' of B), A1).{} = 0 &
    Den(In((the connectives of B).(n+1), the carrier' of B), A1).{} = 1 &
    for i,j being Integer holds
    Den(In((the connectives of B).(n+2), the carrier' of B), A1).<*i*> = -i &
    Den(In((the connectives of B).(n+3), the carrier' of B), A1).<*i,j*>
    = i+j &
    Den(In((the connectives of B).(n+4), the carrier' of B), A1).<*i,j*>
    = i*j &
    (j <> 0 implies
    Den(In((the connectives of B).(n+5), the carrier' of B), A1).<*i,j*>
    = i div j) &
    Den(In((the connectives of B).(n+6), the carrier' of B), A1).<*i,j*>
    = IFGT(i,j,FALSE,TRUE);
    let C be non empty non void ConnectivesSignature;
    assume A4: the carrier' of B misses the carrier' of C;
    let A2 be non-empty MSAlgebra over C;
    assume A5: the Sorts of A1 tolerates the Sorts of A2;
    let S be bool-correct non empty non void BoolSignature;
    assume A6: the BoolSignature of S = B+*C;
    let A be bool-correct non-empty MSAlgebra over S;
    assume A7: A = (B,A1)+*A2;
    the carrier of S = (the carrier of B)\/the carrier of C by A6,Th51; then
    reconsider I as SortSymbol of S by XBOOLE_0:def 3;
    take I; thus I = s by A3;
A8: dom the Sorts of A1 = the carrier of B by PARTFUN1:def 2;
A9: the Sorts of A = (the Sorts of A1)+*the Sorts of A2 &
    the Charact of A = (the Charact of A1)+*the Charact of A2
    by A5,A7,CIRCCOMB:def 4;
A10: len the connectives of B >= n+6 & n <= n+6 by A2,NAT_1:12;
    then 1 <= n & n <= len the connectives of B by A1,XXREAL_0:2;
    then
A11: n in dom the connectives of B &
    the connectives of S = (the connectives of B)^the connectives of C
    by A6,Def52,FINSEQ_3:25;
    then
A12: (the connectives of S).n = (the connectives of B).n &
    (the connectives of B).n in the carrier' of B
    by FUNCT_1:102,FINSEQ_1:def 7;
A13: dom the ResultSort of B = the carrier' of B &
    dom the ResultSort of C = the carrier' of C &
    dom the Arity of B = the carrier' of B &
    dom the Arity of C = the carrier' of C by FUNCT_2:def 1;
    the ResultSort of S = (the ResultSort of B)+*the ResultSort of C &
    the Arity of S = (the Arity of B)+*the Arity of C by A6,Th51;
    then (the ResultSort of S).((the connectives of S).n) =
    (the ResultSort of B).((the connectives of B).n) &
    (the Arity of S).((the connectives of S).n) =
    (the Arity of B).((the connectives of B).n) by A4,A12,A13,FUNCT_4:16;
    hence (the Arity of S).((the connectives of S).n) = {} &
    (the ResultSort of S).((the connectives of S).n) = I by A3;
    thus (the Sorts of A).I = INT by A8,A9,A3,A5,FUNCT_4:15;
A14: now
      let i be Nat;
      assume i >= 4 & i <= n+6;
      then 1 <= i & i <= len the connectives of B by A10,XXREAL_0:2;
      then
A15:   i in dom the connectives of B by FINSEQ_3:25;
      then
A16:   (the connectives of B).i in the carrier' of B &
      (the connectives of B).i = (the connectives of S).i
      by A11,FUNCT_1:102,FINSEQ_1:def 7;
      the carrier' of S = (the carrier' of B)\/the carrier' of C
      by A6,Th51;
      then (the connectives of S).i in the carrier' of S by A16,XBOOLE_0:def 3;
      then
A17:   In((the connectives of B).i, the carrier' of B) =
      (the connectives of B).i &
      In((the connectives of S).i, the carrier' of S) =
      (the connectives of S).i by A15,FUNCT_1:102,SUBSET_1:def 8;
      dom the Charact of A1 = the carrier' of B &
      dom the Charact of A2 = the carrier' of C by PARTFUN1:def 2;
      hence Den(In((the connectives of S).i, the carrier' of S), A)
      = Den(In((the connectives of B).i, the carrier' of B), A1)
      by A9,A16,A17,A4,FUNCT_4:16;
    end;
    n <= n+6 by NAT_1:11;
    hence Den(In((the connectives of S).n, the carrier' of S), A).{} = 0
    by A1,A3,A14;
    n+1 >= 4 & n+1 <= n+6 by A1,NAT_1:12,XREAL_1:6;
    hence Den(In((the connectives of S).(n+1), the carrier' of S), A).{} = 1
    by A3,A14;
    let i,j be Integer;
    n+2 >= 4 & n+2 <= n+6 by A1,NAT_1:12,XREAL_1:6;
    hence Den(In((the connectives of S).(n+2), the carrier' of S), A).<*i*>
    = Den(In((the connectives of B).(n+2), the carrier' of B), A1).<*i*> by A14
    .= -i by A3;
    n+3 >= 4 & n+3 <= n+6 by A1,NAT_1:12,XREAL_1:6;
    hence Den(In((the connectives of S).(n+3), the carrier' of S), A).<*i,j*>
    = Den(In((the connectives of B).(n+3), the carrier' of B), A1).<*i,j*>
    by A14
    .= i+j by A3;
    n+4 >= 4 & n+4 <= n+6 by NAT_1:12,XREAL_1:6;
    hence Den(In((the connectives of S).(n+4), the carrier' of S), A).<*i,j*>
    = Den(In((the connectives of B).(n+4), the carrier' of B), A1).<*i,j*>
    by A14
    .= i*j by A3;
    hereby assume
A18:   j <> 0;
      n+5 >= 4 & n+5 <= n+6 by NAT_1:12,XREAL_1:6;
      hence Den(In((the connectives of S).(n+5), the carrier' of S), A).<*i,j*>
      = Den(In((the connectives of B).(n+5), the carrier' of B), A1).<*i,j*>
      by A14
      .= i div j by A18,A3;
    end;
    n+6 >= 4 by NAT_1:12;
    hence Den(In((the connectives of S).(n+6), the carrier' of S), A).<*i,j*>
    = Den(In((the connectives of B).(n+6), the carrier' of B), A1).<*i,j*>
    by A14
    .= IFGT(i,j,FALSE,TRUE) by A3;
  end;
