
theorem Th8:
  for t being finite-branching DecoratedTree ex x being set, p
  being DTree-yielding FinSequence st t = x-tree p
proof
  let t be finite-branching DecoratedTree;
  take t.{};
  reconsider e = {} as Node of t by TREES_1:22;
  defpred X[object,object] means
    ex n being Element of NAT st n+1 = $1 & $2 = t|<*n*>;
  (dom t)-level 1 = succ e by TREES_2:13;
  then reconsider A = (dom t)-level 1 as finite set;
  reconsider e = {} as Element of dom t by TREES_1:22;
A1: for z being object st z in Seg card A ex u being object st X[z,u]
  proof
    let z be object;
    assume
A2: z in Seg card A;
    then reconsider m = z as Nat;
    m >= 1 by A2,FINSEQ_1:1;
    then consider n being Nat such that
A3: m = 1+n by NAT_1:10;
    reconsider n as Element of NAT by ORDINAL1:def 12;
    reconsider y = t|<*n*> as set;
    take y, n;
    thus thesis by A3;
  end;
  consider p being Function such that
A4: dom p = Seg card A and
A5: for z being object st z in Seg card A holds X[z,p.z]
from CLASSES1:sch
  1( A1);
  reconsider p as FinSequence by A4,FINSEQ_1:def 2;
A6: len p = card A by A4,FINSEQ_1:def 3;
A7: now
    let x be object;
    assume x in dom p;
    then ex n being Element of NAT st n+1 = x & p.x = t|<*n*> by A4,A5;
    hence p.x is DecoratedTree;
  end;
A8: now
    let n be Nat;
    thus e^<*n*> = <*n*> & succ e = A by FINSEQ_1:34,TREES_2:13;
    hence <*n*> in A iff n < card A by Th7;
  end;
  reconsider p as DTree-yielding FinSequence by A7,TREES_3:24;
A9: len doms p = len p by TREES_3:38;
  now
    let x be object;
    hereby
      assume that
A10:  x in dom t and
A11:  x <> {};
      reconsider r = x as Node of t by A10;
      consider q being FinSequence of NAT,
      n being Element of NAT such that
A12:  r = <*n*>^q by A11,FINSEQ_2:130;
A13:  <*n*> in dom t by A12,TREES_1:21;
      reconsider q as FinSequence;
       reconsider nn=n as Nat;
      take nn, q;
      e^<*n*> = <*n*> by A8;
      then <*n*> in A by A8,A13;
      hence nn < len doms p by A6,A8,A9;
      then
      n+1 in dom p & ex k being Element of NAT st k+1 = n+1 & p.(n+1) = t
      |<*k *> by A4,A5,A9,Lm3;
      then (doms p).(n+1) = dom (t|<*n*>) by FUNCT_6:22
        .= (dom t)|<*n*> by TREES_2:def 10;
      hence q in (doms p).(nn+1) & x = <*nn*>^q by A12,A13,TREES_1:def 6;
    end;
    assume
A14: x = {} or ex n being Nat, q being FinSequence st n <
    len doms p & q in (doms p).(n+1) & x = <*n*>^q;
    assume
A15: not x in dom t;
    then consider n being Nat, q being FinSequence such that
A16: n < len doms p and
A17: q in (doms p).(n+1) and
A18: x = <*n*>^q by A14,TREES_1:22;
    reconsider n as Element of NAT by ORDINAL1:def 12;
    n+1 in dom p & ex k being Element of NAT st k+1 = n+1 & p.(n+1) = t|
    <*k *> by A4,A5,A9,A16,Lm3;
    then (doms p).(n+1) = dom (t|<*n*>) by FUNCT_6:22
      .= (dom t)|<*n*> by TREES_2:def 10;
    then reconsider q as Element of (dom t)|<*n*> by A17;
    <*n*> in A by A6,A8,A9,A16;
    then <*n*>^q in dom t by TREES_1:def 6;
    hence contradiction by A15,A18;
  end;
  then
A19: dom t = tree doms p by TREES_3:def 15;
  take p;
  now
    let n be Nat;
    assume n < len p;
    then ex m being Element of NAT st m+1 = n+1 & p.(n+1) = t|<*m *>
        by A4,A5,Lm3;
    hence t|<*n*> = p.(n+1);
  end;
  hence thesis by A19,TREES_4:def 4;
end;
