let V be RealUnitarySpace; :: thesis: for A being Subset of V st Lin A = V holds
ex B being Subset of V st
( B c= A & B is linearly-independent & Lin B = V )

let A be Subset of V; :: thesis: ( Lin A = V implies ex B being Subset of V st
( B c= A & B is linearly-independent & Lin B = V ) )

assume A1: Lin A = V ; :: thesis: ex B being Subset of V st
( B c= A & B is linearly-independent & Lin B = V )

defpred S1[ set ] means ex B being Subset of V st
( B = $1 & B c= A & B is linearly-independent );
consider Q being set such that
A2: for Z being set holds
( Z in Q iff ( Z in bool the carrier of V & S1[Z] ) ) from XBOOLE_0:sch 1();
( {} the carrier of V in bool the carrier of V & {} the carrier of V c= A & {} the carrier of V is linearly-independent ) by RLVECT_3:8, XBOOLE_1:2;
then A3: Q <> {} by A2;
now
let Z be set ; :: thesis: ( Z <> {} & Z c= Q & Z is c=-linear implies union Z in Q )
assume that
Z <> {} and
A4: Z c= Q and
A5: Z is c=-linear ; :: thesis: union Z in Q
set W = union Z;
union Z c= the carrier of V
proof
let x be set ; :: according to TARSKI:def 3 :: thesis: ( not x in union Z or x in the carrier of V )
assume x in union Z ; :: thesis: x in the carrier of V
then consider X being set such that
A6: x in X and
A7: X in Z by TARSKI:def 4;
X in bool the carrier of V by A2, A4, A7;
hence x in the carrier of V by A6; :: thesis: verum
end;
then reconsider W = union Z as Subset of V ;
A8: W c= A
proof
let x be set ; :: according to TARSKI:def 3 :: thesis: ( not x in W or x in A )
assume x in W ; :: thesis: x in A
then consider X being set such that
A9: x in X and
A10: X in Z by TARSKI:def 4;
ex B being Subset of V st
( B = X & B c= A & B is linearly-independent ) by A2, A4, A10;
hence x in A by A9; :: thesis: verum
end;
W is linearly-independent
proof
let l be Linear_Combination of W; :: according to RLVECT_3:def 1 :: thesis: ( not Sum l = 0. V or Carrier l = {} )
assume that
A11: Sum l = 0. V and
A12: Carrier l <> {} ; :: thesis: contradiction
deffunc H1( set ) -> set = { C where C is Subset of V : ( $1 in C & C in Z ) } ;
consider f being Function such that
A13: dom f = Carrier l and
A14: for x being set st x in Carrier l holds
f . x = H1(x) from FUNCT_1:sch 3();
reconsider M = rng f as non empty set by A12, A13, RELAT_1:65;
consider F being Choice_Function of M;
A15: now
assume {} in M ; :: thesis: contradiction
then consider x being set such that
A16: x in dom f and
A17: f . x = {} by FUNCT_1:def 5;
Carrier l c= W by RLVECT_2:def 8;
then consider X being set such that
A18: x in X and
A19: X in Z by A13, A16, TARSKI:def 4;
reconsider X = X as Subset of V by A2, A4, A19;
X in { C where C is Subset of V : ( x in C & C in Z ) } by A18, A19;
hence contradiction by A13, A14, A16, A17; :: thesis: verum
end;
set S = rng F;
A20: ( dom F = M & M <> {} ) by A15, RLVECT_3:35;
then A21: rng F <> {} by RELAT_1:65;
A22: now
let X be set ; :: thesis: ( X in rng F implies X in Z )
assume X in rng F ; :: thesis: X in Z
then consider x being set such that
A23: x in dom F and
A24: F . x = X by FUNCT_1:def 5;
consider y being set such that
A25: y in dom f and
A26: f . y = x by A20, A23, FUNCT_1:def 5;
A27: X in x by A15, A20, A23, A24, ORDERS_1:def 1;
x = { C where C is Subset of V : ( y in C & C in Z ) } by A13, A14, A25, A26;
then ex C being Subset of V st
( C = X & y in C & C in Z ) by A27;
hence X in Z ; :: thesis: verum
end;
A28: now
let X, Y be set ; :: thesis: ( X in rng F & Y in rng F & not X c= Y implies Y c= X )
assume ( X in rng F & Y in rng F ) ; :: thesis: ( X c= Y or Y c= X )
then ( X in Z & Y in Z ) by A22;
then X,Y are_c=-comparable by A5, ORDINAL1:def 9;
hence ( X c= Y or Y c= X ) by XBOOLE_0:def 9; :: thesis: verum
end;
dom F is finite by A13, A20, FINSET_1:26;
then rng F is finite by FINSET_1:26;
then union (rng F) in rng F by A21, A28, CARD_2:81;
then union (rng F) in Z by A22;
then consider B being Subset of V such that
A29: B = union (rng F) and
B c= A and
A30: B is linearly-independent by A2, A4;
Carrier l c= union (rng F)
proof
let x be set ; :: according to TARSKI:def 3 :: thesis: ( not x in Carrier l or x in union (rng F) )
assume A31: x in Carrier l ; :: thesis: x in union (rng F)
then A32: f . x in M by A13, FUNCT_1:def 5;
set X = f . x;
A33: F . (f . x) in f . x by A15, A32, ORDERS_1:def 1;
f . x = { C where C is Subset of V : ( x in C & C in Z ) } by A14, A31;
then A34: ex C being Subset of V st
( F . (f . x) = C & x in C & C in Z ) by A33;
F . (f . x) in rng F by A20, A32, FUNCT_1:def 5;
hence x in union (rng F) by A34, TARSKI:def 4; :: thesis: verum
end;
then l is Linear_Combination of B by A29, RLVECT_2:def 8;
hence contradiction by A11, A12, A30, RLVECT_3:def 1; :: thesis: verum
end;
hence union Z in Q by A2, A8; :: thesis: verum
end;
then consider X being set such that
A35: X in Q and
A36: for Z being set st Z in Q & Z <> X holds
not X c= Z by A3, ORDERS_1:177;
consider B being Subset of V such that
A37: B = X and
A38: B c= A and
A39: B is linearly-independent by A2, A35;
take B ; :: thesis: ( B c= A & B is linearly-independent & Lin B = V )
thus ( B c= A & B is linearly-independent ) by A38, A39; :: thesis: Lin B = V
assume A40: Lin B <> V ; :: thesis: contradiction
now
assume A41: for v being VECTOR of V st v in A holds
v in Lin B ; :: thesis: contradiction
now
let v be VECTOR of V; :: thesis: ( v in Lin A implies v in Lin B )
assume v in Lin A ; :: thesis: v in Lin B
then consider l being Linear_Combination of A such that
A42: v = Sum l by Th1;
A43: Carrier l c= the carrier of (Lin B)
proof
let x be set ; :: according to TARSKI:def 3 :: thesis: ( not x in Carrier l or x in the carrier of (Lin B) )
assume A44: x in Carrier l ; :: thesis: x in the carrier of (Lin B)
then reconsider a = x as VECTOR of V ;
Carrier l c= A by RLVECT_2:def 8;
then a in Lin B by A41, A44;
hence x in the carrier of (Lin B) by STRUCT_0:def 5; :: thesis: verum
end;
reconsider F = the carrier of (Lin B) as Subset of V by RUSUB_1:def 1;
reconsider l = l as Linear_Combination of F by A43, RLVECT_2:def 8;
Sum l = v by A42;
then v in Lin F by Th1;
hence v in Lin B by Th5; :: thesis: verum
end;
then Lin A is Subspace of Lin B by RUSUB_1:23;
hence contradiction by A1, A40, RUSUB_1:20; :: thesis: verum
end;
then consider v being VECTOR of V such that
A45: v in A and
A46: not v in Lin B ;
A47: B \/ {v} is linearly-independent
proof
let l be Linear_Combination of B \/ {v}; :: according to RLVECT_3:def 1 :: thesis: ( not Sum l = 0. V or Carrier l = {} )
assume A48: Sum l = 0. V ; :: thesis: Carrier l = {}
now
per cases ( v in Carrier l or not v in Carrier l ) ;
suppose A49: v in Carrier l ; :: thesis: Carrier l = {}
deffunc H1( VECTOR of V) -> Element of REAL = l . $1;
consider f being Function of the carrier of V,REAL such that
A50: f . v = 0 and
A51: for u being VECTOR of V st u <> v holds
f . u = H1(u) from FUNCT_2:sch 6();
reconsider f = f as Element of Funcs the carrier of V,REAL by FUNCT_2:11;
now
let u be VECTOR of V; :: thesis: ( not u in (Carrier l) \ {v} implies f . u = 0 )
assume not u in (Carrier l) \ {v} ; :: thesis: f . u = 0
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 A50, A51; :: thesis: verum
end;
then reconsider f = f as Linear_Combination of V by RLVECT_2:def 5;
Carrier f c= B
proof
let x be set ; :: according to TARSKI:def 3 :: thesis: ( not x in Carrier f or x in B )
assume x in Carrier f ; :: thesis: x in B
then consider u being VECTOR of V such that
A52: u = x and
A53: f . u <> 0 ;
f . u = l . u by A50, A51, A53;
then ( u in Carrier l & Carrier l c= B \/ {v} ) by A53, RLVECT_2:def 8;
then ( u in B or u in {v} ) by XBOOLE_0:def 3;
hence x in B by A50, A52, A53, TARSKI:def 1; :: thesis: verum
end;
then reconsider f = f as Linear_Combination of B by RLVECT_2:def 8;
deffunc H2( set ) -> Element of NAT = 0 ;
consider g being Function of the carrier of V,REAL such that
A54: g . v = - (l . v) and
A55: for u being VECTOR of V st u <> v holds
g . u = H2(u) from FUNCT_2:sch 6();
reconsider g = g as Element of Funcs the carrier of V,REAL by FUNCT_2:11;
now
let u be VECTOR of V; :: thesis: ( not u in {v} implies g . u = 0 )
assume not u in {v} ; :: thesis: g . u = 0
then u <> v by TARSKI:def 1;
hence g . u = 0 by A55; :: thesis: verum
end;
then reconsider g = g as Linear_Combination of V by RLVECT_2:def 5;
Carrier g c= {v}
proof
let x be set ; :: according to TARSKI:def 3 :: thesis: ( not x in Carrier g or x in {v} )
assume x in Carrier g ; :: thesis: x in {v}
then ex u being VECTOR of V st
( x = u & g . u <> 0 ) ;
then x = v by A55;
hence x in {v} by TARSKI:def 1; :: thesis: verum
end;
then reconsider g = g as Linear_Combination of {v} by RLVECT_2:def 8;
A56: f - g = l
proof
let u be VECTOR of V; :: according to RLVECT_2:def 11 :: thesis: (f - g) . u = l . u
now
per cases ( v = u or v <> u ) ;
suppose A57: v = u ; :: thesis: (f - g) . u = l . u
thus (f - g) . u = (f . u) - (g . u) by RLVECT_2:79
.= l . u by A50, A54, A57 ; :: thesis: verum
end;
suppose A58: v <> u ; :: thesis: (f - g) . u = l . u
thus (f - g) . u = (f . u) - (g . u) by RLVECT_2:79
.= (l . u) - (g . u) by A51, A58
.= (l . u) - 0 by A55, A58
.= l . u ; :: thesis: verum
end;
end;
end;
hence (f - g) . u = l . u ; :: thesis: verum
end;
A59: Sum g = (- (l . v)) * v by A54, RLVECT_2:50;
0. V = (Sum f) - (Sum g) by A48, A56, RLVECT_3:4;
then Sum f = (0. V) + (Sum g) by RLSUB_2:78
.= (- (l . v)) * v by A59, RLVECT_1:10 ;
then A60: (- (l . v)) * v in Lin B by Th1;
A61: - (l . v) <> 0 by A49, RLVECT_2:28;
((- (l . v)) " ) * ((- (l . v)) * v) = (((- (l . v)) " ) * (- (l . v))) * v by RLVECT_1:def 9
.= 1 * v by A61, XCMPLX_0:def 7
.= v by RLVECT_1:def 9 ;
hence Carrier l = {} by A46, A60, RUSUB_1:15; :: thesis: verum
end;
end;
end;
hence Carrier l = {} ; :: thesis: verum
end;
v in {v} by TARSKI:def 1;
then A64: ( v in B \/ {v} & not v in B ) by A46, Th2, XBOOLE_0:def 3;
{v} c= A by A45, ZFMISC_1:37;
then B \/ {v} c= A by A38, XBOOLE_1:8;
then B \/ {v} in Q by A2, A47;
hence contradiction by A36, A37, A64, XBOOLE_1:7; :: thesis: verum