reserve i,j,x,y for object,
  f,g for Function;
reserve T,T1 for finite Tree,
  t,p for Element of T,
  t1 for Element of T1;

theorem Th9:
  T with-replacement (p,T1) =
  { t : not p is_a_prefix_of t } \/ the set of all p^t1
proof
  defpred P2[set] means not contradiction;
  defpred P1[set] means $1=$1;
  deffunc F(FinSequence) = p^$1;
  set A = { t : not p is_a_proper_prefix_of t }, B = { F(t1) : P1[t1] }, C = {
t: not p is_a_prefix_of t }, D = { F(t1) : P2[t1] };
  now
    let x be object;
    hereby
      assume x in A;
      then consider t such that
A1:   x = t and
A2:   not p is_a_proper_prefix_of t;
      not p is_a_prefix_of t or t = p by A2;
      hence x in C or x in {p} by A1,TARSKI:def 1;
    end;
    assume x in C or x in {p};
    then x = p or ex t st t = x & not p is_a_prefix_of t by TARSKI:def 1;
    then consider t such that
A3: t = x and
A4: t = p or not p is_a_prefix_of t;
    not p is_a_proper_prefix_of t by A4;
    hence x in A by A3;
  end;
  then
A5: A = C \/ {p} by XBOOLE_0:def 3;
  {} is Element of T1 & p^{} = p by FINSEQ_1:34,TREES_1:22;
  then
A6: p in D;
  thus T with-replacement (p,T1) = C \/ {p} \/ D by A5,TREES_1:32
    .= C \/ ({p} \/ D) by XBOOLE_1:4
    .= C \/ D by A6,ZFMISC_1:40;
end;
