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 Th20:
  for Z being (DecoratedTree of D),x1,x2 being Element of dom Z st
  x1 = <*0*> & x2 = <*1*> & succ (Root dom Z) = {x1,x2} holds Z = (((
elementary_tree 2) --> Root Z) with-replacement (<*0*>, Z|x1)) with-replacement
  (<*1*>,Z|x2)
proof
A1: not <*0*> is_a_proper_prefix_of <*1*> by TREES_1:52;
  set e = elementary_tree 2;
  let Z be (DecoratedTree of D),x1,x2 be Element of dom Z such that
A2: x1 = <*0*> and
A3: x2 = <*1*> and
A4: succ (Root dom Z) = {x1,x2};
A5: dom (Z|x2) = (dom Z)|x2 by TREES_2:def 10;
  set T1 = ((elementary_tree 2) --> Root Z) with-replacement (<*0*>,Z|x1);
  set E = (elementary_tree 2) --> Root Z;
A6: dom (Z|x1) = (dom Z)|x1 by TREES_2:def 10;
  set T = T1 with-replacement (<*1*>,Z|x2);
A7: <*0*> in e by ENUMSET1:def 1,TREES_1:53;
  then
A8: <*0*> in dom E by FUNCOP_1:13;
  then
A9: dom T1 = dom E with-replacement (<*0*>,dom (Z|x1)) by TREES_2:def 11;
  <*1*> in e by ENUMSET1:def 1,TREES_1:53;
  then <*1*> in dom E by FUNCOP_1:13;
  then
A10: <*1*> in dom T1 by A8,A9,A1,TREES_1:def 9;
  then
A11: dom T = dom T1 with-replacement (<*1*>,dom (Z|x2)) by TREES_2:def 11;
A12: dom E = e by FUNCOP_1:13;
  then
A13: dom T1 = e with-replacement (<*0*>,(dom Z)|x1) by A7,A6,TREES_2:def 11;
A14: for s st s in dom T holds T.s = Z.s
  proof
    let s;
    assume
A15: s in dom T;
    then
A16: not <*1*> is_a_prefix_of s & T.s = T1.s or ex u st u in dom(Z|x2) & s
    = <*1*>^u & T.s = (Z|x2).u by A10,A11,TREES_2:def 11;
    now
      per cases by A10,A11,A15,TREES_1:def 9;
      suppose
A17:    s in dom T1 & not <*1*> is_a_proper_prefix_of s;
        then
A18:    not <*0*> is_a_prefix_of s & T1.s = E.s or ex u st u in dom(Z|x1)
        & s = <*0*>^u & T1.s = (Z|x1).u by A8,A9,TREES_2:def 11;
        now
          per cases by A7,A13,A17,TREES_1:def 9;
          suppose
A19:        s in e & not <*0*> is_a_proper_prefix_of s;
            now
              per cases by A19,ENUMSET1:def 1,TREES_1:53;
              suppose
A20:            s = {};
                then
                ( not ex u st u in dom(Z|x2) & s = <*1*>^u & T.s = (Z|x2)
                .u)& E.s = Z.s by A19,FUNCOP_1:7;
                hence thesis by A10,A11,A15,A18,A20,TREES_2:def 11;
              end;
              suppose
                s = <*0*>;
                hence thesis by A2,A3,A6,A5,A16,A18,TREES_2:def 10;
              end;
              suppose
                s = <*1*>;
                hence thesis by A3,A5,A16,TREES_2:def 10;
              end;
            end;
            hence thesis;
          end;
          suppose
            ex w st w in (dom Z)|x1 & s = <*0*>^w;
            hence thesis by A2,A3,A6,A5,A16,A18,TREES_1:1,TREES_2:def 10;
          end;
        end;
        hence thesis;
      end;
      suppose
        ex w st w in dom (Z|x2) & s = <*1*>^w;
        hence thesis by A3,A5,A16,TREES_1:1,TREES_2:def 10;
      end;
    end;
    hence thesis;
  end;
  dom Z = dom T by A2,A3,A4,A12,A6,A5,A9,A11,Th19;
  hence thesis by A14,TREES_2:31;
end;
