reserve x,y,z,a,b,c,X,X1,X2,Y,Z for set,
  W,W1,W2 for Tree,
  w,w9 for Element of W,
  f for Function,
  D,D9 for non empty set,
  i,k,k1,k2,l,m,n for Nat,
  v,v1,v2 for FinSequence,
  p,q,r,r1,r2 for FinSequence of NAT;

theorem
  p in W implies W = W with-replacement (p,W|p)
proof
  assume
A1: p in W;
 now
    let q;
    thus q in W implies q in W with-replacement (p,W|p)
    proof
      assume
A2:   q in W;
   now
        assume p is_a_proper_prefix_of q;
then      p is_a_prefix_of q;
        then consider r being FinSequence such that
A3:     q = p^r by TREES_1:1;
     rng r c= rng q by A3,FINSEQ_1:30;
then      rng r c= NAT by XBOOLE_1:1;
        then reconsider r as FinSequence of NAT by FINSEQ_1:def 4;
        take r;
        thus r in W|p & q = p^r by A1,A2,A3,TREES_1:def 6;
      end;
      hence thesis by A1,A2,TREES_1:def 9;
    end;
    assume that
A4: q in W with-replacement (p,W|p) and
A5: not q in W;
 ex r st r in W|p & q = p^r by A1,A4,A5,TREES_1:def 9;
    hence contradiction by A1,A5,TREES_1:def 6;
  end;
  hence thesis;
end;
