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));
reserve C for (context of x), C1 for (context of y), C9 for (context of z),
  C11 for (context of x11), C12 for (context of y11), D for context of s,X;
reserve
  S9 for sufficiently_rich non empty non void ManySortedSign,
  s9 for SortSymbol of S9,
  o9 for s9-dependent OperSymbol of S9,
  X9 for non-trivial ManySortedSet of the carrier of S9,
  x9 for (Element of X9.s9);
reserve h1 for x-constant Homomorphism of Free(S,X), T,
  h2 for y-constant Homomorphism of Free(S,Y), Q;
reserve
  s2 for s1-reachable SortSymbol of S,
  g1 for Translation of Free(S,Y),s1,s2,
  g for Translation of Free(S,X),s1,s2;

theorem Th97:
  for f being vf-sequence of t, B being FinSequence of the carrier of S
  st B = pr2 f holds pr1 f is B-sorts FinSequence of Union X
  proof
    let f be vf-sequence of t;
    let B be FinSequence of the carrier of S;
    assume Z0: B = pr2 f;
    consider g being one-to-one FinSequence such that
A1: rng g = {xi where xi is Element of dom t: ex s,x st t.xi = [x,s]} &
    dom f = dom g & for i st i in dom f holds f.i = t.(g.i) by VFS;
    pr1 f is FinSequence of Union X
    proof
      let a; assume a in rng pr1 f;
      then consider b such that
A2:   b in dom pr1 f & a = (pr1 f).b by FUNCT_1:def 3;
      reconsider b as Nat by A2;
A3:   dom pr1 f = dom f by MCART_1:def 12;
      then g.b in rng g by A1,A2,FUNCT_1:def 3;
      then consider xi being Element of dom t such that
A4:   g.b = xi & ex s,x st t.xi = [x,s] by A1;
      consider s,x such that
A5:   t.xi = [x,s] by A4;
      a = (f.b)`1 by A2,A3,MCART_1:def 12 .= [x,s]`1 by A1,A2,A3,A4,A5;
      hence a in Union X;
    end;
    then reconsider V = pr1 f as FinSequence of Union X;
    V is B-sorts
    proof
A6:   dom V = dom f = dom B by Z0,MCART_1:def 12,def 13;
      hence dom V = dom B;
      let i; assume
A7:   i in dom B;
      then g.i in rng g by A1,A6,FUNCT_1:def 3;
      then consider xi being Element of dom t such that
A4:   g.i = xi & ex s,x st t.xi = [x,s] by A1;
      consider s,x such that
A5:   t.xi = [x,s] by A4;
      B.i = (f.i)`2 & V.i = (f.i)`1 & f.i = [x,s]
      by Z0,A1,A4,A5,A6,A7,MCART_1:def 12,def 13;
      hence V.i in X.(B.i);
    end;
    hence pr1 f is B-sorts FinSequence of Union X;
  end;
