reserve x,y, X,Y,Z for set,
        D for non empty set,
        n,k for Nat,
        i,i1,i2 for Integer;

theorem Th12:
  for X be non empty set ex Y be Subset-Family of X st
      Y is with_non-empty_elements c=-linear & X in Y & card X = card Y &
      for Z st Z in Y & card Z <> 1 ex x st x in Z & Z\{x} in Y
 proof
  let X be non empty set;
  consider R be Relation such that
   A1: R well_orders X by WELLORD2:17;
  set RX=R|_2 X;
  deffunc F(object)=X\(RX-Seg($1));
  A2: for x being object st x in X holds F(x) in bool X;
  consider f be Function of X,bool X such that
A3: for x being object st x in X holds f.x=F(x) from FUNCT_2:sch 2(A2);
  take Y=rng f;
  A4: dom f=X by FUNCT_2:def 1;
  thus Y is with_non-empty_elements
  proof
   assume Y is with_empty_element;
   then {} in Y;
   then consider x being object such that
    A5: x in dom f and
    A6: f.x={} by FUNCT_1:def 3;
   {}=F(x) by A3,A5,A6;
   then X c=RX-Seg(x) by XBOOLE_1:37;
   hence thesis by A4,A5,WELLORD1:1;
  end;
  thus Y is c=-linear
  proof
   let x,y;
   assume that
    A7: x in Y and
    A8: y in Y;
   consider a be object such that
    A9: a in dom f & f.a=x by A7,FUNCT_1:def 3;
   consider b be object such that
    A10: b in dom f & f.b=y by A8,FUNCT_1:def 3;
   RX-Seg(a),RX-Seg(b)are_c=-comparable by A1,WELLORD1:26,WELLORD2:16;
   then RX-Seg(a)c=RX-Seg(b) or RX-Seg(b)c=RX-Seg(a);
   then F(b)c=F(a) or F(a)c=F(b) by XBOOLE_1:34;
   then A11: F(a),F(b)are_c=-comparable;
   x=F(a) by A3,A9;
   hence thesis by A3,A10,A11;
  end;
  A12: field RX=X by A1,WELLORD2:16;
  then consider x being object such that
   A13: x in X and
   A14: for y being object st y in X holds[x,y] in RX
by A1,WELLORD1:7,WELLORD2:16;
  A15: RX is well-ordering by A1,WELLORD2:16;
  then A16: RX is well_founded by WELLORD1:def 4;
  RX is antisymmetric by A15,WELLORD1:def 4;
  then A17: RX is_antisymmetric_in X by A12,RELAT_2:def 12;
  A18: RX-Seg(x)={}
  proof
   assume RX-Seg(x)<>{};
   then consider y being object such that
    A19: y in RX-Seg(x) by XBOOLE_0:def 1;
   A20: y<>x by A19,WELLORD1:1;
   A21: [y,x] in RX by A19,WELLORD1:1;
   then A22: x in X by A12,RELAT_1:15;
   A23: y in X by A12,A21,RELAT_1:15;
   then [x,y] in RX by A14;
   hence thesis by A17,A20,A21,A22,A23,RELAT_2:def 4;
  end;
  f.x=F(x) by A3,A13;
  hence X in Y by A4,A13,A18,FUNCT_1:def 3;
  now let x1,x2 be object;
   reconsider R1=RX-Seg(x1),R2=RX-Seg(x2) as Subset of X by A12,WELLORD1:9;
   assume that
    A24: x1 in X & x2 in X and
    A25: f.x1=f.x2;
   R1`=f.x1 & f.x2=R2` by A3,A24;
   then R1=R2 by A25,SUBSET_1:42;
   then [x1,x2] in RX & [x2,x1] in RX by A12,A15,A24,WELLORD1:29;
   hence x1=x2 by A17,A24,RELAT_2:def 4;
  end;
  then f is one-to-one by FUNCT_2:19;
  then X,Y are_equipotent by A4,WELLORD2:def 4;
  hence card X=card Y by CARD_1:5;
  let Z;
  assume that
   A26: Z in Y and
   A27: card Z<>1;
  consider x being object such that
   A28: x in dom f and
   A29: f.x=Z by A26,FUNCT_1:def 3;
  A30: {x}c=X by A28,ZFMISC_1:31;
  reconsider x as set by TARSKI:1;
  take x;
  A31: not x in RX-Seg(x) by WELLORD1:1;
  A32: Z=X\(RX-Seg(x)) by A3,A28,A29;
  hence x in Z by A28,A31,XBOOLE_0:def 5;
  RX-Seg(x)c=X by A12,WELLORD1:9;
  then reconsider Rxx=RX-Seg(x)\/{x} as Subset of X by A30,XBOOLE_1:8;
  X\Rxx<>{}
  proof
   assume X\Rxx={};
   then X c=Rxx by XBOOLE_1:37;
   then Z=Rxx\RX-Seg(x) by A32,XBOOLE_0:def 10
    .={x}\RX-Seg(x) by XBOOLE_1:40
    .={x} by A31,ZFMISC_1:59;
   hence contradiction by A27,CARD_1:30;
  end;
  then consider a be object such that
   A33: a in Rxx` and
   A34: RX-Seg(a)misses Rxx` by A12,A16,WELLORD1:def 2;
  A35: not a in Rxx by A33,XBOOLE_0:def 5;
  x in {x} by TARSKI:def 1;
  then A36: x<>a by A35,XBOOLE_0:def 3;
  RX is connected by A15,WELLORD1:def 4;
  then RX is_connected_in X by A12,RELAT_2:def 14;
  then A37: [x,a] in RX or[a,x] in RX by A28,A33,A36,RELAT_2:def 6;
  A38: not a in RX-Seg(x) by A35,XBOOLE_0:def 3;
  then x in RX-Seg(a) by A36,A37,WELLORD1:1;
  then A39: {x}c=RX-Seg(a) by ZFMISC_1:31;
  RX-Seg(a)c=X by A12,WELLORD1:9;
  then A40: RX-Seg(a)c=Rxx by A34,SUBSET_1:24;
  RX-Seg(x)c=RX-Seg(a) by A12,A15,A28,A33,A37,A38,WELLORD1:1,29;
  then Rxx c=RX-Seg(a) by A39,XBOOLE_1:8;
  then Rxx=RX-Seg(a) by A40;
  then f.a=X\Rxx by A3,A33
   .=(X\RX-Seg(x))\{x} by XBOOLE_1:41
   .=Z\{x} by A3,A28,A29;
  hence thesis by A4,A33,FUNCT_1:def 3;
 end;
