reserve x,y,z,a,b,c,X,X1,X2,Y,Z for set,
  W,W1,W2 for Tree,
  w,w9 for Element of W,
  f for Function,
  D,D9 for non empty set,
  i,k,k1,k2,l,m,n for Nat,
  v,v1,v2 for FinSequence,
  p,q,r,r1,r2 for FinSequence of NAT;
reserve C for Chain of W,
  B for Branch of W;

theorem Th29:
  for T being Tree st (for n ex C being finite Chain of T st card C = n) &
  for t being Element of T holds succ t is finite
  ex B being Chain of T st not B is finite
proof
  let T be Tree;
  assume that
A1: for n ex X being finite Chain of T st card X = n and
A2: for t being Element of T holds succ t is finite;
  defpred P[FinSequence] means for n ex B being Branch of T st
  $1 in B & ex p st p in B & len p >= len $1 + n;
A3: for x being Element of T st P[x] ex n st x^<*n*> in T & P[x^<*n*>]
  proof
    let x be Element of T such that
A4: P[x] and
A5: for n st x^<*n*> in T holds not P[x^<*n*>];
A6: succ x is finite by A2;
    defpred X[object,Nat] means for B being Branch of T,p,q st
    p = $1 & $1 in B & q in B holds len p + $2 > len q;
A7: for y being object st y in succ x ex n st X[y,n]
    proof
      let y be object;
      assume y in succ x;
      then consider k such that
A8:   y = x^<*k*> and
A9:  x^<*k*> in T;
      consider n such that
A10:  for B being Branch of T st x^<*k*> in B for p st p in B holds
      len p < len (x^<*k*>) + n by A5,A9;
      take n;
      thus thesis by A8,A10;
    end;
    consider f such that
A11: dom f = succ x and
A12: for y being object st y in succ x ex n st f.y = n & X[y,n] &
    for m st X[y,m] holds n <= m from FuncExOfMinNat(A7);
    consider k such that
A13: for m st m in rng f holds m <= k by A6,A11,Lm1,FINSET_1:8;
    consider B being Branch of T such that
A14: x in B and
A15: ex p st p in B & len p >= len x + (k+1) by A4;
    consider p such that
A16: p in B and
A17: len p >= len x + (k+1) by A15;
    reconsider r = p|Seg(len x + 1) as FinSequence of NAT by FINSEQ_1:18;
 len x + 1 <= len x + 1 + k by NAT_1:11;
then A18: len p >= len x + 1 by A17,XXREAL_0:2;
A19: r is_a_prefix_of p;
A20: len r = len x + 1 by A18,FINSEQ_1:17;
A21: r in B by A16,A19,Th25;
then  x is_a_prefix_of r by A14,A20,Th27,NAT_1:11;
    then consider j being FinSequence such that
A22: r = x^j by TREES_1:1;
 len x + len j = len r by A22,FINSEQ_1:22;
then A23: j = <*j.1*> by A20,FINSEQ_1:40;
A24: dom r = Seg len r & 1 <= 1+len x by FINSEQ_1:def 3,NAT_1:11;
 len x+1 <= len r by A18,FINSEQ_1:17;
    then  (
x^<*j.1*>).(len x+1) = j.1 & len x + 1 in dom r by A24,FINSEQ_1:1,42;
then  j.1 in rng r by A22,A23,FUNCT_1:def 3;
    then reconsider l = j.1 as Nat;
A25: x^<*l*> in succ x by A21,A22,A23;
    then consider n such that
A26: f.(x^<*l*>) = n and
A27: for B being Branch of T,p,q st p = x^<*l*> & x^<*l*> in B & q in B
    holds len p + n > len q
    and for m st for B being Branch of T,p,q st p = x^<*l*> & x^<*l*> in B
    & q in B holds len p + m > len q holds n <= m
    by A12;
 n in rng f by A11,A25,A26,FUNCT_1:def 3;
then  n <= k by A13;
then  len r + n <= len x + 1 + k by A20,XREAL_1:7;
    hence contradiction by A16,A17,A21,A22,A23,A27,XXREAL_0:2;
  end;
  reconsider e = {} as Element of T by TREES_1:22;
A28: P[e]
  proof
    given n such that
A29: for B being Branch of T st e in B for p st p in B holds len p < len e + n;
    consider C being finite Chain of T such that
A30: card C = n+1 by A1;
    consider B being Branch of T such that
A31: C c= B by Th28;
 n+0 < n+1 by XREAL_1:6;
then A32: ex p st p in C & len p >= n by A30,Th23;
 e in B & len e = 0 by Th26;
    hence contradiction by A29,A31,A32;
  end;
  defpred QQ[object] means ex t being Element of T st t = $1 & P[t];
  defpred PP[object,object] means
   ex p,n st $1 = p & p^<*n*> in T & $2 = p^<*n*>;
A33: e in T & QQ[e] by A28;
A34: for x being object st x in T & QQ[x]
ex y being object st y in T & PP[x,y] & QQ[y]
  proof
    let x being object such that x in T;
    given t being Element of T such that
A35: t = x and
A36: P[t];
    consider n such that
A37: t^<*n*> in T and
A38: P[t^<*n*>] by A3,A36;
    reconsider y = t^<*n*> as set;
    take y;
    thus y in T & PP[x,y] by A35,A37;
    reconsider t1 = t^<*n*> as Element of T by A37;
    take t1;
    thus thesis by A38;
  end;
 ex f st dom f = NAT & rng f c= T & f.0 = e &
  for k holds PP[f.k,f.(k+1)] & QQ[f.k] from InfiniteChain(A33,A34);
  then consider f such that
A39: dom f = NAT and
A40: rng f c= T and
A41: f.0 = e and
A42: for k holds (ex p,n st f.k = p & p^<*n*> in T & f.(k+1) = p^<*n*>) &
  ex t being Element of T st t = f.k & P[t];
  reconsider C = rng f as Subset of T by A40;
A43: now
    let k be Nat;
    defpred X[Nat] means
    for p,q st p = f.k & q = f.(k+$1) holds p is_a_prefix_of q;
A44: X[0];
A45: for n be Nat st X[n] holds X[n+1]
    proof
      let n be Nat;
      assume
A46:  for p,q st p = f.k & q = f.(k+n) holds p is_a_prefix_of q;
      let p,q such that
A47:  p = f.k and
A48:  q = f.(k+(n+1));
      reconsider k,n as Nat;
      consider r,l such that
A49:  f.(k+n) = r and r^<*l*> in T and
A50:  f.((k+n)+1) = r^<*l*> by A42;
A51:  p is_a_prefix_of r by A46,A47,A49;
  r is_a_prefix_of r^<*l*> by TREES_1:1;
      hence thesis by A48,A50,A51;
    end;
    thus for n be Nat holds X[n] from NAT_1:sch 2(A44,A45);
  end;
A52: now
    let k,l;
    assume k <= l;
then  ex n be Nat st l = k+n by NAT_1:10;
    hence for p,q st p = f.k & q = f.l holds p is_a_prefix_of q by A43;
  end;
 C is Chain of T
  proof
    let p,q;
    assume that
A53: p in C and
A54: q in C;
    consider x being object such that
A55: x in NAT and
A56: p = f.x by A39,A53,FUNCT_1:def 3;
    consider y being object such that
A57: y in NAT and
A58: q = f.y by A39,A54,FUNCT_1:def 3;
    reconsider x, y as Nat by A55,A57;
 x <= y or y <= x;
    hence p is_a_prefix_of q or q is_a_prefix_of p by A52,A56,A58;
  end;
  then reconsider C as Chain of T;
  take C;
  defpred X[Nat] means for p st p = f.$1 holds len p = $1;
A59: X[0] by A41;
A60: X[k] implies X[k+1]
  proof
    assume
A61: for p st p = f.k holds len p = k;
    let p such that
A62: p = f.(k+1);
    consider q,n such that
A63: f.k = q and q^<*n*> in T and
A64: f.(k+1) = q^<*n*> by A42;
    thus len p = len q + len <*n*> by A62,A64,FINSEQ_1:22
      .= len q + 1 by FINSEQ_1:39
      .= k+1 by A61,A63;
  end;
A65: X[k] from NAT_1:sch 2(A59,A60);
 f is one-to-one
  proof
    let x,y be object;
    assume x in dom f & y in dom f;
    then reconsider x9 = x, y9 = y as Nat by A39;
    consider p,n such that
A66: f.x9 = p and p^<*n*> in T
    and f.(x9+1) = p^<*n*> by A42;
A67: ex q,k st f.y9 = q & q^<*k*> in T & f.(y9+1) = q^<*k*> by A42;
 len p = x9 by A65,A66;
    hence thesis by A65,A66,A67;
  end;
then  NAT,C are_equipotent by A39,WELLORD2:def 4;
  hence thesis by CARD_1:38;
end;
