reserve S for non empty non void ManySortedSign;
reserve X for non-empty ManySortedSet of S;
reserve x,y,z for set, i,j for Nat;
reserve
  A0 for (X,S)-terms non-empty MSAlgebra over S,
  A1 for all_vars_including (X,S)-terms MSAlgebra over S,
  A2 for all_vars_including inheriting_operations (X,S)-terms MSAlgebra over S,
  A for all_vars_including inheriting_operations free_in_itself
  (X,S)-terms MSAlgebra over S;

theorem Th63:
  for w being ManySortedFunction of X, (the carrier of S)-->NAT
  ex h being ManySortedFunction of FreeGen X, the Sorts of TermAlg S st
  for s being SortSymbol of S, i being Element of X.s holds
  h.s.root-tree [i,s] = root-tree [w.s.i, s]
  proof
    set Y = (the carrier of S)-->NAT;
    let w be ManySortedFunction of X, Y;
    deffunc F(set,Function) = root-tree [w.$1.($2.{})`1, $1];
    consider ww being ManySortedFunction of the carrier of S such that
A1: for x st x in the carrier of S holds dom(ww.x) = (FreeGen X).x &
    for y being Element of (FreeGen X).x holds ww.x .y = F(x,y) from Sch1;
A2: ww is ManySortedFunction of FreeGen X, FreeGen Y
    proof
      let x be object; assume x in the carrier of S;
      then reconsider s = x as SortSymbol of S;
A3:   dom(ww.s) = (FreeGen X).s by A1;
A4:   (FreeGen X).s = FreeGen(s,X) & (FreeGen Y).s = FreeGen(s,Y)
      by MSAFREE:def 16;
      rng(ww.s) c= (FreeGen Y).s
      proof
        let y be object; assume y in rng(ww.s);
        then consider z being object such that
A5:     z in dom(ww.s) & y = ww.s.z by FUNCT_1:def 3;
        reconsider z as Element of (FreeGen X).s by A1,A5;
        consider v being set such that
A6:     v in X.s & z = root-tree [v,s] by A4,MSAFREE:def 15;
A7:     y = F(s,z) by A1,A5;
        z.{} = [v,s] by A6,TREES_4:3;
        then (z.{})`1 = v;
        then w.s.(z.{})`1 in Y.s by A6,FUNCT_2:5;
        hence thesis by A4,A7,MSAFREE:def 15;
      end;
      hence thesis by A3,FUNCT_2:2;
    end;
    set A = the all_vars_including inheriting_operations free_in_itself
    (X,S)-terms MSAlgebra over S;
    reconsider G = FreeGen X as GeneratorSet of A by Th45;
    reconsider ww as ManySortedFunction of FreeGen X,
    the Sorts of TermAlg S by A2,Th22;
    take ww;
    let s be SortSymbol of S, i be Element of X.s;
    root-tree [i,s] in FreeGen(s,X) & FreeGen(s,X) = G.s
    by MSAFREE:def 15,def 16;
    then reconsider z = root-tree [i,s] as Element of (FreeGen X).s;
    thus ww.s.root-tree [i,s]
    = F(s,z) by A1 .= root-tree [w.s.[i,s]`1, s] by TREES_4:3
    .= root-tree [w.s.i, s];
  end;
