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
  deg t >= height t
  proof
    defpred P[Element of Free(S,X)] means deg $1 >= height $1;
A1: for s being SortSymbol of S, x being Element of X.s holds P[x-term]
    by TREES_1:42;
A2: for o being OperSymbol of S, p being Element of Args(o,Free(S,X)) st
      for t being Element of Free(S,X) st t in rng p holds P[t]
    holds P[o-term p]
    proof let o,p;
      assume
A3:   for t being Element of Free(S,X) st t in rng p holds P[t];
      per cases;
      suppose the_arity_of o = {};
        hence thesis by Th20;
      end;
      suppose
A4:     the_arity_of o <> {};
        set i = the Element of dom the_arity_of o;
        dom the_arity_of o <> {} by A4;
        then
A9:     i in dom the_arity_of o = dom p by MSUALG_3:6;
        then p/.i = p.i in rng p by PARTFUN1:def 6,FUNCT_1:def 3;
        then height(p/.i) in {height t1: t1 in rng p};
        then reconsider I = {height t1: t1 in rng p} as
        non empty finite natural-membered set by Th25;
        reconsider n = union I as Nat;
        union I in I by SIMPLEX0:9;
        then consider t1 such that
A7:     n = height t1 & t1 in rng p;
        consider i being object such that
A8:     i in dom p & t1 = p.i by A7,FUNCT_1:def 3;
        reconsider i as Element of NAT by A8;
A5:     height(o-term p) = n+1 by A4,Th26;
        deffunc G(object) = deg(p/.$1);
        consider g being Function such that
A6:     dom g = dom the_arity_of o &
        for i being object st i in dom the_arity_of o holds g.i = G(i)
        from FUNCT_1:sch 3;
        dom g = Seg len the_arity_of o by A6,FINSEQ_1:def 3;
        then reconsider g as FinSequence by FINSEQ_1:def 2;
        rng g c= NAT
        proof let a be object;
          assume a in rng g;
          then consider b being object such that
B2:       b in dom g & a = g.b by FUNCT_1:def 3;
          a = G(b) by A6,B2;
          hence thesis;
        end;
        then reconsider g as FinSequence of NAT by FINSEQ_1:def 4;
        now let i,t;
          assume i in dom the_arity_of o & t = p.i;
          then t = p/.i & g.i = G(i) by A6,A9,PARTFUN1:def 6;
          hence g.i = deg t;
        end;
        then
B3:     deg(o-term p) = Sum g + 1 by A6,Th29;
        Sum g >= g.i = G(i) = deg t1 >= n
        by A3,A7,A8,A9,A6,PARTFUN1:def 6,POLYNOM3:4;
        then Sum g >= n by XXREAL_0:2;
        hence deg(o-term p) >= height(o-term p) by B3,A5,XREAL_1:6;
      end;
    end;
    thus P[t] from TermInd(A1,A2);
  end;
