reserve x,y,z for object, X,Y for set,
  i,k,n for Nat,
  p,q,r,s for FinSequence,
  w for FinSequence of NAT,
  f for Function;

theorem
  for T1,T2 being Tree holds
  tree(T1,T2) = (elementary_tree 2 with-replacement(<*0*>,T1))
  with-replacement (<*1*>, T2)
proof
  let T1,T2 be Tree;
  let p be FinSequence of NAT;
A1: <*T1,T2*>.1 = T1;
A2: <*T1,T2*>.2 = T2;
A3: len <*T1,T2*> = 2 by FINSEQ_1:44;
A4: 1+1 = 2;
A5: 0+1 = 1;
A6: {} in T1 by TREES_1:22;
A7: {} in T2 by TREES_1:22;
A8: <*0*> in elementary_tree 2 by ENUMSET1:def 1,TREES_1:53;
A9: <*1*> in elementary_tree 2 by ENUMSET1:def 1,TREES_1:53;
  not <*0*> is_a_proper_prefix_of <*1*> by TREES_1:52;
  then
A10: <*1*> in elementary_tree 2 with-replacement(<*0*>, T1) by A8,A9,
TREES_1:def 9;
  thus p in tree(T1,T2) implies
  p in (elementary_tree 2 with-replacement (<*0*>,T1))
  with-replacement(<*1*>, T2)
  proof
    assume
A11: p in tree(T1,T2);
    now
      assume p <> {};
      then consider n,q such that
A12:  n < len <*T1,T2*> and
A13:  q in <*T1,T2*>.(n+1) and
A14:  p = <*n*>^q by A11,Def15;
      reconsider q as FinSequence of NAT by A14,FINSEQ_1:36;
A15:  not <*1*> is_a_prefix_of <*0*>^q by TREES_1:50;
      reconsider n as Element of NAT by ORDINAL1:def 12;
A16:  now
        assume
A17:    n = 0;
        then
A18:    not <*1*> is_a_proper_prefix_of <*n*>^q by A15;
        <*n*>^q in elementary_tree 2 with-replacement(<*0*>, T1) by A8,A13
,A17,TREES_1:def 9;
        hence thesis by A10,A14,A18,TREES_1:def 9;
      end;
      n <= 0+1 by A3,A4,A12,NAT_1:13;
      then n = 1 & (n = 1 implies
      <*n*>^q in (elementary_tree 2 with-replacement (<*0*>,T1))
      with-replacement(<*1*>,T2)) or
      n >= 0 & n <= 0 by A10,A13,NAT_1:8,TREES_1:def 9;
      hence thesis by A14,A16;
    end;
    hence thesis by TREES_1:22;
  end;
  assume p in (elementary_tree 2 with-replacement (<*0*>,T1))
  with-replacement(<*1*>,T2);
  then
A19: p in elementary_tree 2 with-replacement(<*0*>,T1) &
  not <*1*> is_a_proper_prefix_of p or ex r being FinSequence of NAT st r in
  T2 & p = <*1*>^r by A10,TREES_1:def 9;
  now
    assume p in elementary_tree 2 with-replacement(<*0*>,T1);
    then
A20: p in elementary_tree 2 & not <*0*> is_a_proper_prefix_of p or
    ex r being FinSequence of NAT st r in T1 & p = <*0*>^r
    by A8,TREES_1:def 9;
    now
      assume p in elementary_tree 2;
      then
A21:  p = {} or p = <*0*> or p = <*1*> by ENUMSET1:def 1,TREES_1:53;
      p^{} = p by FINSEQ_1:34;
      hence thesis by A1,A2,A3,A4,A5,A6,A7,A21,Def15;
    end;
    hence thesis by A1,A3,A5,A20,Def15;
  end;
  hence thesis by A2,A3,A4,A19,Def15;
end;
