theorem Th135:
  for t
  for h being Endomorphism of Free(S,X) holds dom t c= dom (h.t) &
  for I st
  I = {xi where xi is Element of dom t: ex s,x st t.xi = [x,s]}
  holds t|((dom t) \ I) = (h.t)|((dom t) \ I)
  proof
    let t;
    let h be Endomorphism of Free(S,X);
    defpred P[Element of Free(S,X)] means dom $1 c= dom (h.$1) & for I st
    I = {xi where xi is Element of dom $1: ex s,x st $1.xi = [x,s]}
    holds $1|((dom $1) \ I) = (h.$1)|((dom $1) \ I);
A1: P[x-term]
    proof
      {} in dom (h.(x-term)) by TREES_1:22;
      then {{}} c= dom (h.(x-term));
      hence dom (x-term) c= dom (h.(x-term)) by TREES_1:29;
      let I; assume
A2:   I = {xi where xi is Node of x-term: ex s,x1 st (x-term).xi = [x1,s]};
      {} in dom (x-term) & (x-term).{} = [x,s] by TREES_1:22,TREES_4:3;
      then {} in I by A2;
      then {{}} c= I;
      then dom (x-term) c= I by TREES_1:29;
      then (x-term)|((dom(x-term))\I) = {} &
      (h.(x-term))|((dom(x-term))\I) = {};
      hence thesis;
    end;
A3: for o,p st for t st t in rng p holds P[t] holds P[o-term p]
    proof
      let o,p;
      assume Z0: for t st t in rng p holds P[t];
      the_sort_of (o-term p) = the_result_sort_of o by Th8;
      then
A6:   h.(o-term p) = h.(the_result_sort_of o).(o-term p) by ABBR
      .= h.(the_result_sort_of o).(Den(o,Free(S,X)).p) by MSAFREE4:13
      .= Den(o,Free(S,X)).(h#p) by MSUALG_6:def 2,MSUALG_3:def 7
      .= o-term (h#p) by MSAFREE4:13;
      thus
B3:   dom(o-term p) c= dom(h.(o-term p))
      proof let a;
        assume a in dom(o-term p);
        then per cases by TREES_4:11;
        suppose a = {};
          hence thesis by TREES_1:22;
        end;
        suppose
          ex i being Nat, T being DecoratedTree, r being Node of T st
          i < len p & T = p.(i+1) & a = <*i*>^r;
          then consider i being Nat, T being DecoratedTree, r being Node of T
          such that
A7:       i < len p & T = p.(i+1) & a = <*i*>^r;
          1 <= i+1 <= len p by A7,NAT_1:12,13;
          then
A8:       i+1 in dom p by FINSEQ_3:25;
          then reconsider T as Element of Free(S,X) by A7,FUNCT_1:102;
          T in rng p by A7,A8,FUNCT_1:def 3;
          then dom T c= dom (h.T) by Z0;
          then
A9:       r in dom(h.T);
A10:      (h#p).(i+1) = h.((the_arity_of o)/.(i+1)).T by A7,A8,MSUALG_3:def 6
          .= h.((the_arity_of o)/.(i+1)).(p/.(i+1)) by A7,A8,PARTFUN1:def 6
          .= h.(the_sort_of (p/.(i+1))).(p/.(i+1)) by A8,Th4A
          .= h.(p/.(i+1)) by ABBR
          .= h.T by A7,A8,PARTFUN1:def 6;
          dom (h#p) = dom the_arity_of o = dom p by MSUALG_6:2;
          then len(h#p) = len p by FINSEQ_3:29;
          hence thesis by A7,A9,A10,A6,TREES_4:11;
        end;
      end;
      let I; assume
A4:   I = {xi where xi is Node of o-term p: ex s,x st (o-term p).xi = [x,s]};
B2:   (dom (o-term p))\I c= dom(h.(o-term p)) by B3;
      thus dom((o-term p)|((dom (o-term p))\I))
      = dom((h.(o-term p))|((dom (o-term p))\I)) by B2,RELAT_1:62;
      let q being object; assume
BB:   q in dom((o-term p)|((dom (o-term p))\I));
      reconsider q as Node of o-term p by BB;
B6:   ((o-term p)|((dom (o-term p))\I)).q = (o-term p).q &
      ((h.(o-term p))|((dom (o-term p))\I)).q = h.(o-term p).q
      by BB,FUNCT_1:49;
      per cases by TREES_4:11;
      suppose q = {};
        then (o-term p).q = [o,the carrier of S] = (o-term (h#p)).q
        by TREES_4:def 4;
        hence thesis by A6,B6;
      end;
      suppose
        ex i being Nat, T being DecoratedTree, r being Node of T st
        i < len p & T = p.(i+1) & q = <*i*>^r;
        then consider i being Nat, T being DecoratedTree, r being Node of T
        such that
A7:     i < len p & T = p.(i+1) & q = <*i*>^r;
        1 <= i+1 <= len p by A7,NAT_1:12,13;
        then
A8:     i+1 in dom p by FINSEQ_3:25;
        then reconsider T as Element of Free(S,X) by A7,FUNCT_1:102;
        set II = {xi where xi is Node of T: ex s,x st T.xi = [x,s]};
        T in rng p by A7,A8,FUNCT_1:def 3;
        then
B9:     dom T c= dom (h.T) & T|((dom T)\II) = (h.T)|((dom T)\II) by Z0;
B8:     (o-term p).q = T.r by A7,TREES_4:12;
        r nin II
        proof
          assume r in II;
          then consider xi being Node of T such that
B7:       r = xi & ex s,x st T.xi = [x,s];
          q in I by A4,B8,B7;
          hence contradiction by BB,XBOOLE_0:def 5;
        end;
        then r in (dom T)\II by XBOOLE_0:def 5;
        then
A11:    T.r = (T|((dom T)\II)).r = h.T.r by B9,FUNCT_1:49;
A10:    (h#p).(i+1) = h.((the_arity_of o)/.(i+1)).T by A7,A8,MSUALG_3:def 6
        .= h.((the_arity_of o)/.(i+1)).(p/.(i+1)) by A7,A8,PARTFUN1:def 6
        .= h.(the_sort_of (p/.(i+1))).(p/.(i+1)) by A8,Th4A
        .= h.(p/.(i+1)) by ABBR
        .= h.T by A7,A8,PARTFUN1:def 6;
        dom (h#p) = dom the_arity_of o = dom p by MSUALG_6:2;
        then len(h#p) = len p & r in dom(h.T) by B9,FINSEQ_3:29;
        hence thesis by B6,B8,A6,A7,A10,A11,TREES_4:12;
      end;
    end;
    thus P[t] from TermInd(A1,A3);
  end;
