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 Th28:
  ex B st C c= B
proof
  defpred X[set] means $1 is Chain of W & C c= $1 &
  for p st p in $1 holds ProperPrefixes p c= $1;
  consider X such that
A1: Y in X iff Y in bool W & X[Y] from XFAMILY:sch 1;
  set Z = { w: ex p st p in C & w is_a_prefix_of p };
A2: Z is Chain of W by Th24;
A3: C c= Z
  proof
    let x be object;
    assume
A4: x in C;
    then reconsider w = x as Element of W;
 w is_a_prefix_of w;
    hence thesis by A4;
  end;
 now
    let p;
    assume p in Z;
then A5: ex w st p = w & ex p st p in C & w is_a_prefix_of p;
    then consider q such that
A6: q in C and
A7: p is_a_prefix_of q;
    thus ProperPrefixes p c= Z
    proof
      let x be object;
      assume x in ProperPrefixes p;
      then consider r being FinSequence such that
A8:  x = r and
A9:  r is_a_proper_prefix_of p by TREES_1:def 2;
  r is_a_prefix_of p by A9;
then   r is_a_prefix_of q & r in W by A5,A7,TREES_1:20;
      hence thesis by A6,A8;
    end;
  end;
then A10: X <> {} by A1,A2,A3;
 now
    let Z;
    assume that
A11: Z <> {} and
A12: Z c= X and
A13: Z is c=-linear;
 union Z c= W
    proof
      let x be object;
      assume x in union Z;
      then consider Y such that
A14:  x in Y and
A15:  Y in Z by TARSKI:def 4;
  Y in bool W by A1,A12,A15;
      hence thesis by A14;
    end;
    then reconsider Z9 = union Z as Subset of W;
A16: Z9 is Chain of W
    proof
      let p,q;
      assume p in Z9;
      then consider X1 such that
A17:  p in X1 and
A18:  X1 in Z by TARSKI:def 4;
      assume q in Z9;
      then consider X2 such that
A19:  q in X2 and
A20:  X2 in Z by TARSKI:def 4;
  X1,X2 are_c=-comparable by A13,A18,A20;
then A21:  X1 c= X2 or X2 c= X1;
A22:  X1 is Chain of W by A1,A12,A18;
  X2 is Chain of W by A1,A12,A20;
      hence thesis by A17,A19,A21,A22,Def3;
    end;
A23: now
      let p;
      assume p in union Z;
      then consider X1 such that
A24:  p in X1 & X1 in Z by TARSKI:def 4;
        ProperPrefixes p c= X1 & X1 c= union Z by A1,A12,A24,ZFMISC_1:74;
      hence ProperPrefixes p c= union Z;
    end;
    set x = the Element of Z;
 x in X by A11,A12;
then A25: C c= x by A1;
 x c= union Z by A11,ZFMISC_1:74;
then  C c= union Z by A25;
    hence union Z in X by A1,A16,A23;
  end;
  then consider Y such that
A26: Y in X and
A27: for Z st Z in X & Z <> Y holds not Y c= Z by A10,ORDERS_1:67;
  reconsider Y as Chain of W by A1,A26;
 now
    thus for p st p in Y holds ProperPrefixes p c= Y by A1,A26;
    given p such that
A28: p in W and
A29: for q st q in Y holds q is_a_proper_prefix_of p;
    set Z = (ProperPrefixes p) \/ {p};
     ProperPrefixes p c= W & {p} c= W by A28,TREES_1:def 3,ZFMISC_1:31;
    then reconsider Z9 = Z as Subset of W by XBOOLE_1:8;
A30: Z9 is Chain of W
    proof
      let q,r;
      assume that
A31:  q in Z9 and
A32:  r in Z9;
A33:  q in ProperPrefixes p or q in {p} by A31,XBOOLE_0:def 3;
A34:  r in ProperPrefixes p or r in {p} by A32,XBOOLE_0:def 3;
A35:  q is_a_proper_prefix_of p or q = p by A33,TARSKI:def 1,TREES_1:12;
A36:  r is_a_proper_prefix_of p or r = p by A34,TARSKI:def 1,TREES_1:12;
A37:  q is_a_prefix_of p by A35;
  r is_a_prefix_of p by A36;
      hence thesis by A37,Th1;
    end;
A38: now
      let q;
      assume q in Z;
then   q in ProperPrefixes p or q in {p} by XBOOLE_0:def 3;
then   q is_a_proper_prefix_of p or q = p by TARSKI:def 1,TREES_1:12;
then   q is_a_prefix_of p;
then A39:  ProperPrefixes q c= ProperPrefixes p by TREES_1:17;
  ProperPrefixes p c= Z by XBOOLE_1:7;
      hence ProperPrefixes q c= Z by A39;
    end;
A40: Y c= Z
    proof
      let x be object;
      assume
A41:  x in Y;
      then reconsider t = x as Element of W;
  t is_a_proper_prefix_of p by A29,A41;
then   t in ProperPrefixes p by TREES_1:12;
      hence thesis by XBOOLE_0:def 3;
    end;
 C c= Y by A1,A26;
then  C c= Z by A40;
then A42: Z in X by A1,A30,A38;
A43: p in {p} by TARSKI:def 1;
A44: not p in Y by A29;
 p in Z by A43,XBOOLE_0:def 3;
    hence contradiction by A27,A40,A42,A44;
  end;
  then reconsider Y as Branch of W by Def7;
  take Y;
  thus thesis by A1,A26;
end;
