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 Th55:
  for w being ManySortedFunction of X, (the carrier of S) --> NAT
  for F being ManySortedSet of S-Terms X st
  (for s being SortSymbol of S, x being Element of X.s holds
  F.root-tree [x,s] = root-tree [w.s.x,s]) &
  for o being OperSymbol of S, p being ArgumentSeq of Sym(o,X) holds
  F.(Sym(o,X)-tree p) = Sym(o,(the carrier of S)-->NAT)-tree(F*p)
  holds
  for t being Element of Free(S,X) holds F.t = #(t,w)
  proof
    let w be ManySortedFunction of X, (the carrier of S) --> NAT;
    deffunc R(set,set) = root-tree [w.$2.$1,$2];
    deffunc F(OperSymbol of S,FinSequence)
    = Sym($1,(the carrier of S)-->NAT)-tree($2);
    let F be ManySortedSet of S-Terms X such that
A1: (for s being SortSymbol of S, x being Element of X.s holds
    F.root-tree [x,s] = R(x,s)) and
A2: for o being OperSymbol of S, p being ArgumentSeq of Sym(o,X) holds
    F.(Sym(o,X)-tree p) = F(o,F*p);
    let t be Element of Free(S,X);
    consider G being ManySortedSet of S-Terms X such that
A3: #(t,w) = G.t and
A4: (for s being SortSymbol of S, x being Element of X.s holds
    G.root-tree [x,s] = R(x,s)) and
A5: for o being OperSymbol of S, p being ArgumentSeq of Sym(o,X) holds
    G.(Sym(o,X)-tree p) = F(o,G*p) by Def15;
    F = G from TermDefUniq(A1,A2,A4,A5);
    hence F.t = #(t,w) by A3;
  end;
