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));
reserve C for (context of x), C1 for (context of y), C9 for (context of z),
  C11 for (context of x11), C12 for (context of y11), D for context of s,X;
reserve
  S9 for sufficiently_rich non empty non void ManySortedSign,
  s9 for SortSymbol of S9,
  o9 for s9-dependent OperSymbol of S9,
  X9 for non-trivial ManySortedSet of the carrier of S9,
  x9 for (Element of X9.s9);
reserve h1 for x-constant Homomorphism of Free(S,X), T,
  h2 for y-constant Homomorphism of Free(S,Y), Q;
reserve
  s2 for s1-reachable SortSymbol of S,
  g1 for Translation of Free(S,Y),s1,s2,
  g for Translation of Free(S,X),s1,s2;

theorem Lem10:
  for t,t1 for xi being Element of dom t st
  t1 = t with-replacement(xi,x-term) & t is x-omitting holds t1 is context of x
  proof
    let t,t1;
    let xi be Element of dom t;
    assume Z1: t1 = t with-replacement(xi,x-term);
    assume Z2: t is x-omitting;
    Coim(t1,[x,s]) = {xi}
    proof
      thus Coim(t1,[x,s]) c= {xi}
      proof
        let a; assume
A0:     a in Coim(t1,[x,s]);
        then
A1:     a in dom t1 & t1.a in {[x,s]} by FUNCT_1:def 7;
        reconsider nu = a as Element of dom t1 by A0,FUNCT_1:def 7;
        nu in dom t1;
        then
A5:     xi in dom t & nu in dom t with-replacement(xi, dom (x-term))
        by Z1,TREES_2:def 11;
        then per cases by Z1,TREES_2:def 11;
        suppose
A3:       t1.nu = t.nu & not xi is_a_prefix_of nu;
          then not ex r being FinSequence of NAT st r in dom (x-term) &
          nu = xi^r by TREES_1:1;
          then [x,s] in {[x,s]} & nu in dom t by A5,TARSKI:def 1,TREES_1:def 9;
          hence thesis by Z2,A3,A1,FUNCT_1:def 7;
        end;
        suppose ex r being FinSequence of NAT st r in dom (x-term) & nu = xi^r
          & t1.nu = (x-term).r;
          then consider r being FinSequence of NAT such that
A6:       r in dom (x-term) & nu = xi^r & t1.nu = (x-term).r;
          r in {{}} by A6,TREES_1:29;
          then r = {};
          hence thesis by A6,TARSKI:def 1;
        end;
      end;
      let a; assume a in {xi};
      then
A7:   a = xi by TARSKI:def 1;
A9:   xi in dom t with-replacement(xi, dom(x-term)) = dom t1
      by Z1,TREES_1:def 9,TREES_2:def 11;
      then consider r being FinSequence of NAT such that
A8:   r in dom (x-term) & xi = xi^r & t1.xi = (x-term).r by Z1,TREES_2:def 11;
      r = {} by A8,FINSEQ_1:87;
      then t1.xi = [x,s] in {[x,s]} by A8,TARSKI:def 1,TREES_4:3;
      hence thesis by A7,A9,FUNCT_1:def 7;
    end;
    then card Coim(t1,[x,s]) = 1 by CARD_1:30;
    hence t1 is context of x by CONTEXT;
  end;
