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 Th18:
  for Z being finite (DecoratedTree of D),z be Element of dom Z st
  succ (Root dom Z) = {z} holds Z = ((elementary_tree 1) --> Root Z)
  with-replacement (<*0*>,Z|z)
proof
  set e = elementary_tree 1;
  let Z be finite (DecoratedTree of D),z be Element of dom Z;
  set E = (elementary_tree 1) --> Root Z;
A1: dom E = e by FUNCOP_1:13;
A2: dom (Z|z) = (dom Z)|z by TREES_2:def 10;
A3: <*0*> in e by TARSKI:def 2,TREES_1:51;
  then
A4: <*0*> in dom E by FUNCOP_1:13;
  assume
A5: succ (Root dom Z) = {z};
  then card succ (Root dom Z) = 1 by CARD_1:30;
  then branchdeg (Root dom Z) = 1 by TREES_2:def 12;
  then {z} = { <*0*> } by A5,Th13;
  then z in { <*0*> } by TARSKI:def 1;
  then
A6: z = <*0*> by TARSKI:def 1;
A7: for s st s in dom (E with-replacement (<*0*>,Z|z)) holds (E
  with-replacement (<*0*>,Z|z)).s = Z.s
  proof
    let s;
    assume
A8: s in dom (E with-replacement (<*0*>,Z|z));
A9: dom (E with-replacement (<*0*>,Z|z)) = dom E with-replacement(<*0*>,
    dom (Z|z)) by A4,TREES_2:def 11;
    then
A10: not <*0*> is_a_prefix_of s & (E with-replacement (<*0*>,Z|z)).s = E.s
or ex w st w in dom (Z|z) & s = <*0*>^w & (E with-replacement (<*0*>,Z|z)).s =
    (Z|z).w by A4,A8,TREES_2:def 11;
    now
      per cases by A4,A9,A8,TREES_1:def 9;
      suppose
A11:    s in dom E & not <*0*> is_a_proper_prefix_of s;
        now
          per cases by A11,TARSKI:def 2,TREES_1:51;
          suppose
A12:        s = {};
            then s in e by TREES_1:22;
            then
A13:        E.s = Z.s by A12,FUNCOP_1:7;
            not ex w st w in dom (Z|z) & s = <*0*>^w & (E
            with-replacement (<*0*>,Z|z)).s = (Z|z).w by A12;
            hence thesis by A4,A9,A8,A13,TREES_2:def 11;
          end;
          suppose
            s = <*0*>;
            hence thesis by A6,A2,A10,TREES_2:def 10;
          end;
        end;
        hence thesis;
      end;
      suppose
        ex w st w in dom (Z|z) & s = <*0*>^w;
        hence thesis by A6,A2,A10,TREES_1:1,TREES_2:def 10;
      end;
    end;
    hence thesis;
  end;
  dom (E with-replacement (<*0*>,Z|z)) = e with-replacement (<*0*>, (dom
  Z)|z) by A3,A1,A2,TREES_2:def 11;
  then dom (E with-replacement (<*0*>,Z|z)) = dom Z by A5,Th17;
  hence thesis by A7,TREES_2:31;
end;
