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;

theorem Th15:
  A is linearly-independent & A c= B & Lin B = V implies
    ex I be linearly-independent Subset of V st A c= I & I c= B & Lin I = V
  proof
    assume that
    A1: A is linearly-independent & A c=B and
    A2: Lin B =V;
    defpred P[set] means
    (ex I be Subset of V st I=$1 & A c=I & I c=B & I is linearly-independent);
    consider Q be set such that
    A3: for Z be set holds Z in Q iff Z in bool(the carrier of V) & P[Z]
      from XFAMILY:sch 1;
    A4: now let Z be set;
          assume that
          A5: Z<>{} and
          A6: Z c=Q and
          A7: Z is c=-linear;
          set W=union Z;
          W c=the carrier of V
          proof
            let x be object;
            assume x in W;
            then consider X be set such that
            A8: x in X and
            A9: X in Z by TARSKI:def 4;
            X in bool(the carrier of V) by A3,A6,A9;
            hence thesis by A8;
          end;
          then reconsider W as Subset of V;
          set y=the Element of Z;
          y in Q by A5,A6;
          then A10: ex I being Subset of V st I=y & A c=I & I c=B & I is
          linearly-independent by A3;
          A11: W is linearly-independent
          proof
            deffunc F(object)={D where D is Subset of V:$1 in D & D in Z};
            let l be Linear_Combination of W;
            assume that
            A12: Sum(l)=0.V and
            A13: Carrier(l)<>{};
            consider f being Function such that
            A14: dom f=Carrier(l) and
            A15: for x be object st x in Carrier(l) holds f.x=F(x)
              from FUNCT_1:sch 3;
            reconsider M=rng f as non empty set by A13,A14,RELAT_1:42;
       A16: now assume{} in M;
              then consider x be object such that
              A17: x in dom f and
              A18: f.x={} by FUNCT_1:def 3;
              Carrier(l)c=W by RLVECT_2:def 6;
              then consider X be set such that
              A19: x in X and
              A20: X in Z by A14,A17,TARSKI:def 4;
              reconsider X as Subset of V by A3,A6,A20;
              X in {D where D is Subset of V:x in D & D in Z} by A19,A20;
              hence contradiction by A14,A15,A17,A18;
            end;
            set F = the Choice_Function of M;
            set S=rng F;
A21:         F is Function of M, union M by A16,ORDERS_1:90;
            the Element of M in M;
            then A22: union M<>{} by A16,ORDERS_1:6;
            then A23: dom F=M by FUNCT_2:def 1,A21;
       A24: now let X be set;
              assume X in S;
              then consider x be object such that
              A25: x in dom F and
              A26: F.x=X by FUNCT_1:def 3;
          reconsider x as set by TARSKI:1;
              consider y be object such that
              A27: y in dom f & f.y=x by A23,A25,FUNCT_1:def 3;
              A28: x={D where D is Subset of V:y in D & D in Z} by A14,A15,A27;
              X in x by A16,A23,A25,A26,ORDERS_1:89;
              then ex D be Subset of V st D=X & y in D & D in Z by A28;
              hence X in Z;
            end;
       A29: now let X,Y be set;
              assume X in S & Y in S;
              then X in Z & Y in Z by A24;
              then X,Y are_c=-comparable by A7,ORDINAL1:def 8;
              hence X c=Y or Y c=X;
            end;
            dom F is finite by A14,A23,FINSET_1:8;
            then S is finite by FINSET_1:8;
            then union S in S by A22,A29,CARD_2:62,A21;
            then union S in Z by A24;
            then consider I be Subset of V such that
            A30: I=union S and
            A c=I and
            I c=B and
            A31: I is linearly-independent by A3,A6;
            Carrier(l) c= union S
            proof
              let x be object;
              assume A32: x in Carrier(l);
              then A33: f.x={D where D is Subset of V:x in D & D in Z} by A15;
              A34: f.x in M by A14,A32,FUNCT_1:def 3;
              then F.(f.x) in f.x by A16,ORDERS_1:89;
              then A35: ex D be Subset of V st F.(f.x)=D & x in D & D in Z
                by A33;
              F.(f.x) in S by A23,A34,FUNCT_1:def 3;
              hence thesis by A35,TARSKI:def 4;
            end;
            then l is Linear_Combination of I by A30,RLVECT_2:def 6;
            hence thesis by A12,A13,A31;
          end;
          A36: W c=B
          proof
            let x be object;
            assume x in W;
            then consider X be set such that
            A37: x in X and
            A38: X in Z by TARSKI:def 4;
            ex I be Subset of V st I=X & A c=I & I c=B &
              I is linearly-independent by A3,A6,A38;
            hence thesis by A37;
          end;
          y c=W by A5,ZFMISC_1:74;
          then A c=W by A10;
          hence union Z in Q by A3,A11,A36;
        end;
        Q<>{} by A1,A3;
        then consider X be set such that
        A39: X in Q and
        A40: for Z be set st Z in Q & Z<>X holds not X c=Z by A4,ORDERS_1:67;
        consider I be Subset of V such that
        A41: I=X and
        A42: A c=I and
        A43: I c=B and
        A44: I is linearly-independent by A3,A39;
        reconsider I as linearly-independent Subset of V by A44;
        take I;
        thus A c=I & I c=B by A42,A43;
        assume A45: Lin(I)<>V;
        now assume A46: for v st v in B holds v in Lin(I);
            now let v;
              assume v in Lin(B);
              then consider l be Linear_Combination of B such that
              A47: v = Sum(l) by RLVECT_3:14;
              Carrier(l) c= the carrier of Lin(I)
              proof
                let x be object;
                assume A48: x in Carrier(l);
                then reconsider a=x as VECTOR of V;
                Carrier(l)c=B by RLVECT_2:def 6;
                then a in Lin(I) by A46,A48;
                hence thesis;
              end;
              then reconsider l as Linear_Combination of Up Lin I
                by RLVECT_2:def 6;
              Sum(l)=v by A47;
              then v in Lin(Up Lin I) by RLVECT_3:14;
              hence v in Lin(I) by RLVECT_3:18;
            end;
            then Lin(B) is Subspace of Lin(I) by RLSUB_1:29;
            hence contradiction by A2,A45,RLSUB_1:26;
        end;
        then consider v such that
        A49: v in B and
        A50: not v in Lin(I);
        A51: not v in I by A50,RLVECT_3:15;
        {v}c=B by A49,ZFMISC_1:31;
        then A52: I\/{v}c=B by A43,XBOOLE_1:8;
        v in {v} by TARSKI:def 1;
        then A53: v in I\/{v} by XBOOLE_0:def 3;
        A54: I\/{v} is linearly-independent
        proof
          let l be Linear_Combination of I\/{v};
          assume A55: Sum(l)=0.V;
          per cases;
          suppose v in Carrier(l);
            then A56: -l.v<>0 by RLVECT_2:19;
            deffunc G(VECTOR of V)=In(0,REAL);
            deffunc F(VECTOR of V)=l.$1;
            consider f be Function of the carrier of V,REAL such that
            A57: f.v=In(0,REAL) and
            A58: for u be Element of V st u<>v holds f.u=F(u)
               from FUNCT_2:sch 6;
            reconsider f as Element of Funcs(the carrier of V,REAL)
              by FUNCT_2:8;
            now let u be Element of V;
              assume not u in Carrier(l)\{v};
              then not u in Carrier(l) or u in {v} by XBOOLE_0:def 5;
              then l.u=0 & u<>v or u=v by TARSKI:def 1;
              hence f.u=0 by A57,A58;
            end;
            then reconsider f as Linear_Combination of V by RLVECT_2:def 3;
            Carrier(f) c= I
            proof
              let x be object;
              assume x in Carrier(f);
              then consider u be Element of V such that
              A59: u=x and
              A60: f.u<>0;
              f.u=l.u by A57,A58,A60;
              then Carrier(l)c=I\/{v} & u in Carrier(l) by A60,RLVECT_2:def 6;
              then u in I or u in {v} by XBOOLE_0:def 3;
              hence thesis by A57,A59,A60,TARSKI:def 1;
            end;
            then reconsider f as Linear_Combination of I by RLVECT_2:def 6;
            consider g be Function of the carrier of V,REAL such that
            A61: g.v=-l.v and
            A62: for u be Element of V st u<>v holds g.u=G(u)
               from FUNCT_2:sch 6;
            reconsider g as Element of Funcs(the carrier of V,REAL)
              by FUNCT_2:8;
            now let u be Element of V;
              assume not u in {v};
              then u<>v by TARSKI:def 1;
              hence g.u=0 by A62;
            end;
            then reconsider g as Linear_Combination of V by RLVECT_2:def 3;
            Carrier(g)c={v}
            proof
              let x be object;
              assume x in Carrier(g);
              then ex u be Element of V st x=u & g.u<>0;
              then x=v by A62;
              hence thesis by TARSKI:def 1;
            end;
            then reconsider g as Linear_Combination of{v} by RLVECT_2:def 6;
            A63: Sum(g)=(-l.v)*v by A61,RLVECT_2:32;
            now let u be Element of V;
              now per cases;
                suppose A64: v=u;
                  thus(f-g).u=f.u-g.u by RLVECT_2:54
                  .=l.u by A57,A61,A64;
                end;
                suppose A65: v<>u;
                  thus(f-g).u=f.u-g.u by RLVECT_2:54
                  .=l.u-g.u by A58,A65
                  .=l.u-0 by A62,A65
                  .=l.u;
                end;
              end;
              hence (f-g).u=l.u;
            end;
            then f-g=l;
            then 0.V=Sum(f)-Sum(g) by A55,RLVECT_3:4;
            then Sum(f)=0.V+Sum(g) by RLSUB_2:61
            .=(-l.v)*v by A63;
            then A66: (-l.v)*v in Lin(I) by RLVECT_3:14;
            (-l.v)"*((-l.v)*v)=(-l.v)"*(-l.v)*v by RLVECT_1:def 7
            .=1*v by A56,XCMPLX_0:def 7
            .=v by RLVECT_1:def 8;
            hence thesis by A50,A66,RLSUB_1:21;
          end;
          suppose A67: not v in Carrier(l);
            Carrier(l)c=I
            proof
              let x be object;
              assume A68: x in Carrier(l);
              Carrier(l)c=I\/{v} by RLVECT_2:def 6;
              then x in I or x in {v} by A68,XBOOLE_0:def 3;
              hence thesis by A67,A68,TARSKI:def 1;
            end;
            then l is Linear_Combination of I by RLVECT_2:def 6;
            hence thesis by A55,RLVECT_3:def 1;
          end;
    end;
    A c=I\/{v} by A42,XBOOLE_1:10;
    then I\/{v} in Q by A3,A52,A54;
    hence contradiction by A40,A41,A51,A53,XBOOLE_1:7;
  end;
