reserve S for non void non empty ManySortedSign,
  V for non-empty ManySortedSet of the carrier of S;
reserve A for MSAlgebra over S,
  t for Term of S,V;
reserve S for non void non empty ManySortedSign,
  A for non-empty MSAlgebra over S,
  V for Variables of A,
  t for c-Term of A,V,
  f for ManySortedFunction of V, the Sorts of A;

theorem Th38:
  for vt being finite DecoratedTree st vt is_an_evaluation_of t,f
  holds vt.{} in (the Sorts of A).the_sort_of t
proof
  defpred P[c-Term of A,V] means for vt being finite DecoratedTree st vt
  is_an_evaluation_of $1,f holds vt.{} in (the Sorts of A).the_sort_of $1;
A1: now
    let s be SortSymbol of S, v be Element of V.s;
    thus P[v-term A]
    proof
      let vt be finite DecoratedTree;
      set t = v-term A;
      assume
A2:   vt is_an_evaluation_of t,f;
      root-tree (f.s.v) is_an_evaluation_of t,f by Th32;
      then vt = root-tree (f.s.v) by A2,Th37;
      then
A3:   vt.{} = f.s.v by TREES_4:3;
      s = the_sort_of t by Th19;
      hence thesis by A3;
    end;
  end;
A4: now
    let o be OperSymbol of S, p be ArgumentSeq of o,A,V;
    assume
A5: for t being c-Term of A,V st t in rng p holds P[t];
    thus P[Sym(o,(the Sorts of A) (\/) V)-tree p]
    proof
      let vt be finite DecoratedTree;
      set t = Sym(o,(the Sorts of A) (\/) V)-tree p;
A6:   dom ((the Sorts of A) * the ResultSort of S) = the carrier' of S by
PARTFUN1:def 2;
      assume vt is_an_evaluation_of t qua c-Term of A,V,f;
      then consider q being DTree-yielding FinSequence such that
A7:   len q = len p and
A8:   vt = (Den(o,A).roots q)-tree q and
A9:   for i being Nat, t being c-Term of A,V st i in dom p & t = p.i
ex vt being finite DecoratedTree st vt = q.i & vt is_an_evaluation_of t,f by
Th35;
A10:  vt.{} = Den(o,A).roots q by A8,TREES_4:def 4;
      now
A11:    rng the_arity_of o c= the carrier of S by FINSEQ_1:def 4;
A12:    dom the Sorts of A = the carrier of S by PARTFUN1:def 2;
A13:    dom roots q = dom q by TREES_3:def 18;
        hence
A14:    dom roots q = Seg len q by FINSEQ_1:def 3
          .= Seg len the_arity_of o by A7,Lm8
          .= dom the_arity_of o by FINSEQ_1:def 3
          .= dom ((the Sorts of A)*the_arity_of o) by A12,A11,RELAT_1:27;
        let x be object;
        assume
A15:    x in dom ((the Sorts of A)*the_arity_of o);
        then consider i being Element of NAT such that
A16:    x = i+1 and
A17:    i < len q by A13,A14,Lm1;
A18:    ex T being DecoratedTree st T = q.(i+1) & (roots q).(i+1 ) = T.
        {} by A13,A14,A15,A16,TREES_3:def 18;
        i+1 in dom p by A7,A17,Lm9;
        then
A19:    ex t being c-Term of A,V st t = p.(i+1) & t = (p qua FinSequence
of S-Terms ((the Sorts of A) (\/) V) qua non empty set)/.(i+1) &
     the_sort_of t =
(the_arity_of o).(i+1) & the_sort_of t = (the_arity_of o)/.(i+1) by Lm8;
        reconsider t = p.(i+1) as c-Term of A,V by A7,A17,Lm2;
        consider vt being finite DecoratedTree such that
A20:    vt = q.(i+1) and
A21:    vt is_an_evaluation_of t,f by A7,A9,A17,Lm9;
        vt.{} in (the Sorts of A).the_sort_of t by A5,A7,A17,A21,Lm9;
        hence
        (roots q).x in ((the Sorts of A)*the_arity_of o).x by A15,A16,A18,A20
,A19,FUNCT_1:12;
      end;
      then roots q in product ((the Sorts of A)*the_arity_of o) by CARD_3:9;
      then roots q in (the Sorts of A)#.the_arity_of o by FINSEQ_2:def 5;
      then
A22:  roots q in (the Sorts of A)#.((the Arity of S).o) by MSUALG_1:def 1;
      dom ((the Sorts of A)#*the Arity of S) = the carrier' of S by
PARTFUN1:def 2;
      then roots q in ((the Sorts of A)# * the Arity of S).o by A22,FUNCT_1:12;
      then
A23:  roots q in Args(o,A) by MSUALG_1:def 4;
      Result(o,A) = ((the Sorts of A) * the ResultSort of S).o by
MSUALG_1:def 5
        .= (the Sorts of A).((the ResultSort of S).o) by A6,FUNCT_1:12
        .= (the Sorts of A).the_result_sort_of o by MSUALG_1:def 2
        .= (the Sorts of A).the_sort_of (t qua c-Term of A,V) by Th20;
      hence thesis by A10,A23,FUNCT_2:5;
    end;
  end;
A24: now
    let s be SortSymbol of S, x be Element of (the Sorts of A).s;
    thus P[x-term (A, V)]
    proof
      let vt be finite DecoratedTree;
      set t = x-term (A, V);
      assume
A25:  vt is_an_evaluation_of t,f;
      root-tree x is_an_evaluation_of t,f by Th31;
      then vt = root-tree x by A25,Th37;
      then
A26:  vt.{} = x by TREES_4:3;
      s = the_sort_of t by Th15;
      hence thesis by A26;
    end;
  end;
  for t being c-Term of A,V holds P[t] from TermInd2(A24,A1,A4);
  hence thesis;
end;
