reserve x,y for set,
        r,s for Real,
        S for non empty addLoopStr,
        LS,LS1,LS2 for Linear_Combination of S,
        G for Abelian add-associative right_zeroed right_complementable
          non empty addLoopStr,
        LG,LG1,LG2 for Linear_Combination of G,
        g,h for Element of G,
        RLS for non empty RLSStruct,
        R for vector-distributive scalar-distributive scalar-associative
        scalar-unitalnon empty RLSStruct,
        AR for Subset of R,
        LR,LR1,LR2 for Linear_Combination of R,
        V for RealLinearSpace,
        v,v1,v2,w,p for VECTOR of V,
        A,B for Subset of V,
        F1,F2 for Subset-Family of V,
        L,L1,L2 for Linear_Combination of V;
reserve I for affinely-independent Subset of V;

theorem Th60:
  I c=A implies ex Ia be affinely-independent Subset of V st
    I c= Ia & Ia c= A & Affin Ia = Affin A
 proof
  assume A1: I c=A;
  A2: A c=Affin A by Lm7;
  per cases;
  suppose A3: I is empty;
   per cases;
   suppose A4: A is empty;
    take I;
    thus thesis by A3,A4;
   end;
   suppose A is non empty;
    then consider p be object such that
     A5: p in A;
    reconsider p as Element of V by A5;
    set L=Lin(-p+A);
    -p+A c=[#]L
    proof
     let x be object;
     assume x in -p+A;
     then x in Lin(-p+A) by RLVECT_3:15;
     hence thesis;
    end;
    then reconsider pA=-p+A as Subset of L;
    L=Lin(pA) by RLVECT_5:20;
    then consider Ia be Subset of L such that
     A6: Ia c=pA and
     A7: Ia is linearly-independent and
     A8: Lin(Ia)=L by RLVECT_3:25;
    [#]L c=[#]V by RLSUB_1:def 2;
    then reconsider IA=Ia as Subset of V by XBOOLE_1:1;
    set IA0=IA\/{0.V};
    not 0.V in IA by A7,RLVECT_3:6,RLVECT_5:14;
    then A9: IA0\{0.V}=IA by ZFMISC_1:117;
    0.V in {0.V} by TARSKI:def 1;
    then A10: 0.V in IA0 by XBOOLE_0:def 3;
    IA is linearly-independent by A7,RLVECT_5:14;
    then IA0 is affinely-independent by A9,A10,Th46;
    then reconsider pIA0=p+IA0 as affinely-independent Subset of V;
    take pIA0;
    thus I c=pIA0 by A3;
    thus pIA0 c=A
    proof
     let x be object;
     assume x in pIA0;
     then consider v such that
      A11: x=p+v and
      A12: v in IA0;
     per cases by A12,XBOOLE_0:def 3;
     suppose v in IA;
      then v in {-p+w:w in A} by A6;
      then consider w such that
       A13: v=-p+w and
       A14: w in A;
      x=(p+-p)+w by A11,A13,RLVECT_1:def 3
       .=0.V+w by RLVECT_1:5
       .=w;
      hence thesis by A14;
     end;
     suppose v in {0.V};
      then v=0.V by TARSKI:def 1;
      hence thesis by A5,A11;
     end;
    end;
    A15: pIA0 c=Affin pIA0 by Lm7;
    A16: -p+pIA0=(-p+p)+IA0 by Th5
     .=0.V+IA0 by RLVECT_1:5
     .=IA0 by Th6;
    p+0.V=p;
    then p in pIA0 by A10;
    hence Affin pIA0=p+Up Lin(IA0) by A15,A16,Th57
     .=p+Up Lin(IA) by Lm9
     .=p+Up L by A8,RLVECT_5:20
     .=Affin A by A2,A5,Th57;
   end;
  end;
  suppose I is non empty;
   then consider p be object such that
    A17: p in I;
   reconsider p as Element of V by A17;
   A18: (-p+I)\{0.V} is linearly-independent by A17,Th41;
   A19: -p+I c=-p+A by A1,RLTOPSP1:8;
   set L=Lin(-p+A);
   A20: -p+I\{0.V}c=-p+I by XBOOLE_1:36;
   A21: -p+A c=Up L
   proof
    let x be object;
    assume x in -p+A;
    then x in L by RLVECT_3:15;
    hence thesis;
   end;
   then -p+I c=Up L by A19;
   then reconsider pI0=-p+I\{0.V},pA=-p+A as Subset of L by A20,A21,XBOOLE_1:1;
   L=Lin(pA) & pI0 c=pA by A19,A20,RLVECT_5:20;
   then consider i be linearly-independent Subset of L such that
    A22: pI0 c=i and
    A23: i c=pA and
    A24: Lin(i)=L by A18,Th15,RLVECT_5:15;
   reconsider Ia=i as linearly-independent Subset of V by RLVECT_5:14;
   set I0=Ia\/{0.V};
   A25: 0.V in {0.V} by TARSKI:def 1;
   not 0.V in Ia by RLVECT_3:6;
   then I0\{0.V}=Ia & 0.V in I0 by A25,XBOOLE_0:def 3,ZFMISC_1:117;
   then I0 is affinely-independent by Th46;
   then reconsider pI0=p+I0 as affinely-independent Subset of V;
   take pI0;
   A26: -p+p=0.V by RLVECT_1:5;
   then A27: p+(-p+I)=0.V+I by Th5
    .=I by Th6;
   0.V in {-p+v where v is Element of V:v in I} by A17,A26;
   then (-p+I\{0.V})\/{0.V}=-p+I by ZFMISC_1:116;
   then A28: -p+I c=I0 by A22,XBOOLE_1:9;
   hence I c=pI0 by A27,RLTOPSP1:8;
   p+(-p+I)c=pI0 by A28,RLTOPSP1:8;
   then A29: p in pI0 by A17,A27;
   thus pI0 c=A
   proof
    let x be object;
    assume x in pI0;
    then consider v such that
     A30: x=p+v and
     A31: v in I0;
    per cases by A31,XBOOLE_0:def 3;
    suppose v in Ia;
     then v in {-p+w:w in A} by A23;
     then consider w such that
      A32: v=-p+w and
      A33: w in A;
     x=(p+-p)+w by A30,A32,RLVECT_1:def 3
      .=0.V+w by RLVECT_1:5
      .=w;
     hence thesis by A33;
    end;
    suppose v in {0.V};
     then v=0.V by TARSKI:def 1;
     then x=p by A30;
     hence thesis by A1,A17;
    end;
   end;
   A34: pI0 c=Affin pI0 by Lm7;
   A35: p in A by A1,A17;
   -p+pI0=0.V+I0 by A26,Th5
    .=I0 by Th6;
   hence Affin pI0=p+Up Lin(I0) by A29,A34,Th57
    .=p+Up Lin(Ia) by Lm9
    .=p+Up L by A24,RLVECT_5:20
    .=Affin A by A2,A35,Th57;
  end;
 end;
