reserve
  a,b for object, I,J for set, f for Function, R for Relation,
  i,j,n for Nat, m for (Element of NAT),
  S for non empty non void ManySortedSign,
  s,s1,s2 for SortSymbol of S,
  o for OperSymbol of S,
  X for non-empty ManySortedSet of the carrier of S,
  x,x1,x2 for (Element of X.s), x11 for (Element of X.s1),
  T for all_vars_including inheriting_operations free_in_itself
  (X,S)-terms MSAlgebra over S,
  g for Translation of Free(S,X),s1,s2,
  h for Endomorphism of Free(S,X);
reserve
  r,r1,r2 for (Element of T),
  t,t1,t2 for (Element of Free(S,X));
reserve
  Y for infinite-yielding ManySortedSet of the carrier of S,
  y,y1 for (Element of Y.s), y11 for (Element of Y.s1),
  Q for all_vars_including inheriting_operations free_in_itself
  (Y,S)-terms MSAlgebra over S,
  q,q1 for (Element of Args(o,Free(S,Y))),
  u,u1,u2 for (Element of Q),
  v,v1,v2 for (Element of Free(S,Y)),
  Z for non-trivial ManySortedSet of the carrier of S,
  z,z1 for (Element of Z.s),
  l,l1 for (Element of Free(S,Z)),
  R for all_vars_including inheriting_operations free_in_itself
  (Z,S)-terms MSAlgebra over S,
  k,k1 for Element of Args(o,Free(S,Z));
reserve c,c1,c2 for set, d,d1 for DecoratedTree;
reserve
  w for (Element of Args(o,T)),
  p,p1 for Element of Args(o,Free(S,X));

theorem Th80:
  J = [o,the carrier of S] implies (o-term p)"I = IFIN(J,I,{{}},{}) \/
  union {<*i*>^^((p.(i+1))"I): i < len p}
  proof set X = {<*i*>^^((p.(i+1))"I): i < len p};
    assume
A0: J = [o,the carrier of S];
    dom doms p = dom p by FUNCT_6:def 2;
    then
A4: len doms p = len p by FINSEQ_3:29;
    thus (o-term p)"I c= IFIN(J,I,{{}},{}) \/ union X
    proof
      let x be object;
      assume x in (o-term p)"I;
      then
A1:   x in dom (o-term p) & (o-term p).x in I by FUNCT_1:def 7;
      then x in tree doms p by TREES_4:10;
      then per cases by TREES_3:def 15;
      suppose x = {};
        then (o-term p).x = J & x in {{}} by A0,TARSKI:def 1,TREES_4:def 4;
        then x in IFIN(J,I,{{}},{}) by A1,MATRIX_7:def 1;
        hence thesis by XBOOLE_0:def 3;
      end;
      suppose ex i being Nat, q being FinSequence st
        i < len doms p & q in (doms p).(i+1) & x = <*i*>^q;
        then consider i being Nat, q being FinSequence such that
A2:     i < len doms p & q in (doms p).(i+1) & x = <*i*>^q;
        1 <= i+1 <= len p by A4,A2,NAT_1:11,13;
        then
A5:     i+1 in dom p by FINSEQ_3:25;
        then reconsider px = p.(i+1) as DecoratedTree by TREES_3:24;
A6:     dom px = (doms p).(i+1) by A5,FUNCT_6:def 2;
        then (o-term p).x = px.q by A2,A4,TREES_4:12;
        then q in px"I by A1,A2,A6,FUNCT_1:def 7;
        then <*i*>^q in <*i*>^^(px"I) in X by A2,A4;
        then x in union X by A2,TARSKI:def 4;
        hence thesis by XBOOLE_0:def 3;
      end;
    end;
    let x be object;
    assume x in IFIN(J,I,{{}},{}) \/ union X;
    then per cases by XBOOLE_0:def 3;
    suppose x in IFIN(J,I,{{}},{});
      then J in I & x in {{}} or J nin I & x in {} by MATRIX_7:def 1;
      then x = {} & J in I & (o-term p).{} = J & {} in dom (o-term p)
      by A0,TREES_1:22,TREES_4:def 4;
      hence x in (o-term p)"I by FUNCT_1:def 7;
    end;
    suppose x in union X;
      then consider Y being set such that
A7:   x in Y in X by TARSKI:def 4;
      consider i such that
A8:   Y = <*i*>^^((p.(i+1))"I) & i < len p by A7;
      consider q being Element of (p.(i+1))"I such that
A9:   x = <*i*>^q & q in (p.(i+1))"I by A7,A8;
      1 <= i+1 <= len p by A8,NAT_1:11,13;
      then
AA:   i+1 in dom p by FINSEQ_3:25;
      then reconsider px = p.(i+1) as DecoratedTree by TREES_3:24;
      q in dom px = (doms p).(i+1) & dom (o-term p) = tree doms p
      by AA,A9,FUNCT_1:def 7,FUNCT_6:def 2,TREES_4:10;
      then (o-term p).x = px.q & px.q in I & x in dom (o-term p)
      by A4,A8,A9,FUNCT_1:def 7,TREES_3:def 15,TREES_4:12;
      hence thesis by FUNCT_1:def 7;
    end;
  end;
