reserve x,y,x1,x2,z for set,
  n,m,k for Nat,
  t1 for (DecoratedTree of [: NAT,NAT :]),
  w,s,t,u for FinSequence of NAT,
  D for non empty set;
reserve s9,w9,v9 for Element of NAT*;

theorem Th19:
  for Z being Tree,x1,x2 be Element of Z st x1 = <*0*> & x2 = <*1
*> & succ (Root Z) = {x1,x2} holds Z = (elementary_tree 2 with-replacement (<*0
  *>,Z|x1)) with-replacement (<*1*>,Z|x2)
proof
  set e = elementary_tree 2;
  let Z be Tree,x1,x2 be Element of Z such that
A1: x1 = <*0*> and
A2: x2 = <*1*> and
A3: succ (Root Z) = {x1,x2};
  set T1 = elementary_tree 2 with-replacement (<*0*>,Z|x1);
A4: <*0*> in e by ENUMSET1:def 1,TREES_1:53;
A5: now
    let s;
    thus s in Z implies s in T1 & not <*1*> is_a_proper_prefix_of s or ex w st
    w in Z|x2 & s = <*1*>^w
    proof
      assume
A6:   s in Z;
      per cases;
      suppose
        s = {};
        hence thesis by TREES_1:22;
      end;
      suppose
        s <> {};
        then consider w be FinSequence of NAT,
         n being Element of NAT such that
A7:     s = <*n*>^w by FINSEQ_2:130;
        <*n*> is_a_prefix_of s by A7,TREES_1:1;
        then
A8:     <*n*> in Z by A6,TREES_1:20;
        <*n*> = (Root Z)^<*n*> by FINSEQ_1:34;
        then
A9:     <*n*> in succ (Root Z) by A8,TREES_2:12;
        now
          per cases by A1,A2,A3,A9,TARSKI:def 2;
          suppose
A10:        <*n*> = <*0*>;
            then w in Z|x1 by A1,A6,A7,TREES_1:def 6;
            hence thesis by A4,A7,A10,Th2,TREES_1:def 9;
          end;
          suppose
A11:        <*n*> = <*1*>;
            then w in Z|x2 by A2,A6,A7,TREES_1:def 6;
            hence thesis by A7,A11;
          end;
        end;
        hence thesis;
      end;
    end;
    assume
A12: s in T1 & not <*1*> is_a_proper_prefix_of s or ex w st w in Z|x2
    & s = <*1*>^w;
    now
      per cases by A12;
      suppose
A13:    s in T1 & not <*1*> is_a_proper_prefix_of s;
        now
          per cases by A4,A13,TREES_1:def 9;
          suppose
            s in e & not <*0*> is_a_proper_prefix_of s;
            then s = {} or s = <*0*> or s = <*1*> by ENUMSET1:def 1,TREES_1:53;
            hence s in Z by A1,A2,A3;
          end;
          suppose
            ex w st w in Z|x1 & s = <*0*>^w;
            hence s in Z by A1,TREES_1:def 6;
          end;
        end;
        hence s in Z;
      end;
      suppose
        ex w st w in Z|x2 & s = <*1*>^w;
        hence s in Z by A2,TREES_1:def 6;
      end;
    end;
    hence s in Z;
  end;
A14: not <*0*> is_a_proper_prefix_of <*1*> by TREES_1:3;
  <*1*> in e by ENUMSET1:def 1,TREES_1:53;
  then <*1*> in T1 by A4,A14,TREES_1:def 9;
  hence thesis by A5,TREES_1:def 9;
end;
