let n be Element of NAT ; :: thesis: for x0 being Element of (REAL-US n)
for B being Subset of (REAL-US n) st B = RN_Base n holds
ex l being Linear_Combination of B st x0 = Sum l

let x0 be Element of (REAL-US n); :: thesis: for B being Subset of (REAL-US n) st B = RN_Base n holds
ex l being Linear_Combination of B st x0 = Sum l

let B be Subset of (REAL-US n); :: thesis: ( B = RN_Base n implies ex l being Linear_Combination of B st x0 = Sum l )
reconsider x1 = x0 as Element of REAL n by REAL_NS1:def 6;
A1: REAL n = the carrier of (REAL-US n) by REAL_NS1:def 6;
assume A2: B = RN_Base n ; :: thesis: ex l being Linear_Combination of B st x0 = Sum l
A3: { x where x is Element of REAL n : ex i being Element of NAT st
( 1 <= i & i <= n & x = Base_FinSeq (n,i) ) } c= B
proof
let y be set ; :: according to TARSKI:def 3 :: thesis: ( not y in { x where x is Element of REAL n : ex i being Element of NAT st
( 1 <= i & i <= n & x = Base_FinSeq (n,i) )
}
or y in B )

assume y in { x where x is Element of REAL n : ex i being Element of NAT st
( 1 <= i & i <= n & x = Base_FinSeq (n,i) )
}
; :: thesis: y in B
then ex x being Element of REAL n st
( y = x & ex i being Element of NAT st
( 1 <= i & i <= n & x = Base_FinSeq (n,i) ) ) ;
hence y in B by A2; :: thesis: verum
end;
B c= { x where x is Element of REAL n : ex i being Element of NAT st
( 1 <= i & i <= n & x = Base_FinSeq (n,i) )
}
proof
let y be set ; :: according to TARSKI:def 3 :: thesis: ( not y in B or y in { x where x is Element of REAL n : ex i being Element of NAT st
( 1 <= i & i <= n & x = Base_FinSeq (n,i) )
}
)

assume y in B ; :: thesis: y in { x where x is Element of REAL n : ex i being Element of NAT st
( 1 <= i & i <= n & x = Base_FinSeq (n,i) )
}

then ex i2 being Element of NAT st
( y = Base_FinSeq (n,i2) & 1 <= i2 & i2 <= n ) by A2;
hence y in { x where x is Element of REAL n : ex i being Element of NAT st
( 1 <= i & i <= n & x = Base_FinSeq (n,i) )
}
; :: thesis: verum
end;
then A4: B = { x where x is Element of REAL n : ex i being Element of NAT st
( 1 <= i & i <= n & x = Base_FinSeq (n,i) )
}
by A3, XBOOLE_0:def 10;
A5: { x where x is Element of REAL n : ex i being Element of NAT st
( 1 <= i & i <= n & x = Base_FinSeq (n,i) & |(x1,x)| <> 0 ) } c= B
proof
let x2 be set ; :: according to TARSKI:def 3 :: thesis: ( not x2 in { x where x is Element of REAL n : ex i being Element of NAT st
( 1 <= i & i <= n & x = Base_FinSeq (n,i) & |(x1,x)| <> 0 )
}
or x2 in B )

assume x2 in { x where x is Element of REAL n : ex i being Element of NAT st
( 1 <= i & i <= n & x = Base_FinSeq (n,i) & |(x1,x)| <> 0 )
}
; :: thesis: x2 in B
then ex x being Element of REAL n st
( x = x2 & ex i being Element of NAT st
( 1 <= i & i <= n & x = Base_FinSeq (n,i) & |(x1,x)| <> 0 ) ) ;
hence x2 in B by A4; :: thesis: verum
end;
then reconsider B0 = { x where x is Element of REAL n : ex i being Element of NAT st
( 1 <= i & i <= n & x = Base_FinSeq (n,i) & |(x1,x)| <> 0 )
}
as Subset of (REAL-US n) by XBOOLE_1:1;
defpred S1[ set , set ] means ( $1 in B0 implies ex i being Element of NAT st
( $2 = i & 1 <= i & i <= n & $1 = Base_FinSeq (n,i) ) );
A6: rng (ProjFinSeq x1) c= REAL n ;
A7: for x being set st x in B0 holds
ex y being set st
( y in Seg n & S1[x,y] )
proof
let x be set ; :: thesis: ( x in B0 implies ex y being set st
( y in Seg n & S1[x,y] ) )

assume x in B0 ; :: thesis: ex y being set st
( y in Seg n & S1[x,y] )

then consider x2 being Element of REAL n such that
A8: x = x2 and
A9: ex i being Element of NAT st
( 1 <= i & i <= n & x2 = Base_FinSeq (n,i) & |(x1,x2)| <> 0 ) ;
consider i0 being Element of NAT such that
A10: 1 <= i0 and
A11: i0 <= n and
A12: x2 = Base_FinSeq (n,i0) and
|(x1,x2)| <> 0 by A9;
i0 in Seg n by A10, A11, FINSEQ_1:1;
hence ex y being set st
( y in Seg n & S1[x,y] ) by A8, A10, A11, A12; :: thesis: verum
end;
consider f being Function of B0,(Seg n) such that
A13: for x being set st x in B0 holds
S1[x,f . x] from FUNCT_2:sch 1(A7);
defpred S2[ set , set ] means ( ( $1 in B0 implies for i being Element of NAT st 1 <= i & i <= n & $1 = Base_FinSeq (n,i) holds
$2 = |(x1,(Base_FinSeq (n,i)))| ) & ( not $1 in B0 implies $2 = 0 ) );
A14: for x being set st x in the carrier of (REAL-US n) holds
ex y being set st
( y in REAL & S2[x,y] )
proof
let x be set ; :: thesis: ( x in the carrier of (REAL-US n) implies ex y being set st
( y in REAL & S2[x,y] ) )

assume x in the carrier of (REAL-US n) ; :: thesis: ex y being set st
( y in REAL & S2[x,y] )

per cases ( x in B0 or not x in B0 ) ;
suppose A15: x in B0 ; :: thesis: ex y being set st
( y in REAL & S2[x,y] )

then consider x2 being Element of REAL n such that
A16: x2 = x and
ex i being Element of NAT st
( 1 <= i & i <= n & x2 = Base_FinSeq (n,i) & |(x1,x2)| <> 0 ) ;
reconsider y0 = |(x1,x2)| as Element of REAL ;
for i2 being Element of NAT st 1 <= i2 & i2 <= n & x = Base_FinSeq (n,i2) holds
y0 = |(x1,(Base_FinSeq (n,i2)))| by A16;
hence ex y being set st
( y in REAL & S2[x,y] ) by A15; :: thesis: verum
end;
suppose not x in B0 ; :: thesis: ex y being set st
( y in REAL & S2[x,y] )

hence ex y being set st
( y in REAL & S2[x,y] ) ; :: thesis: verum
end;
end;
end;
consider l2 being Function of the carrier of (REAL-US n),REAL such that
A17: for x being set st x in the carrier of (REAL-US n) holds
S2[x,l2 . x] from FUNCT_2:sch 1(A14);
A18: l2 is Element of Funcs ( the carrier of (REAL-US n),REAL) by FUNCT_2:8;
for v being Element of (REAL-US n) st not v in B0 holds
l2 . v = 0 by A17;
then reconsider l3 = l2 as Linear_Combination of REAL-US n by A2, A5, A18, RLVECT_2:def 3;
Carrier l3 c= B0
proof
let x be set ; :: according to TARSKI:def 3 :: thesis: ( not x in Carrier l3 or x in B0 )
assume x in Carrier l3 ; :: thesis: x in B0
then x in { v where v is Element of (REAL-US n) : l3 . v <> 0 } by RLVECT_2:def 4;
then ex v being Element of (REAL-US n) st
( x = v & l3 . v <> 0 ) ;
hence x in B0 by A17; :: thesis: verum
end;
then reconsider l0 = l3 as Linear_Combination of B0 by RLVECT_2:def 6;
A19: Carrier l0 c= B0 by RLVECT_2:def 6;
then Carrier l0 c= B by A5, XBOOLE_1:1;
then reconsider l2 = l0 as Linear_Combination of B by RLVECT_2:def 6;
A20: B0 c= Carrier l0
proof
let x be set ; :: according to TARSKI:def 3 :: thesis: ( not x in B0 or x in Carrier l0 )
assume A21: x in B0 ; :: thesis: x in Carrier l0
then consider x6 being Element of REAL n such that
A22: x = x6 and
A23: ex i being Element of NAT st
( 1 <= i & i <= n & x6 = Base_FinSeq (n,i) & |(x1,x6)| <> 0 ) ;
reconsider x66 = x6 as Element of (REAL-US n) by REAL_NS1:def 6;
consider i8 being Element of NAT such that
1 <= i8 and
i8 <= n and
A24: x6 = Base_FinSeq (n,i8) and
|(x1,x6)| <> 0 by A23;
l0 . x66 = |(x1,(Base_FinSeq (n,i8)))| by A17, A21, A22, A23, A24;
then x in { v where v is Element of (REAL-US n) : l0 . v <> 0 } by A22, A23, A24;
hence x in Carrier l0 by RLVECT_2:def 4; :: thesis: verum
end;
A25: dom (Sgm (rng f)) = Seg (len (Sgm (rng f))) by FINSEQ_1:def 3;
A26: rng ((f ") * (Sgm (rng f))) c= rng (f ") by RELAT_1:26;
A27: dom (Sgm (rng f)) = Seg (len (Sgm (rng f))) by FINSEQ_1:def 3;
for x1, x2 being set st x1 in dom f & x2 in dom f & f . x1 = f . x2 holds
x1 = x2
proof
let x1, x2 be set ; :: thesis: ( x1 in dom f & x2 in dom f & f . x1 = f . x2 implies x1 = x2 )
assume that
A28: x1 in dom f and
A29: x2 in dom f and
A30: f . x1 = f . x2 ; :: thesis: x1 = x2
A31: ex i2 being Element of NAT st
( f . x2 = i2 & 1 <= i2 & i2 <= n & x2 = Base_FinSeq (n,i2) ) by A13, A29;
ex i1 being Element of NAT st
( f . x1 = i1 & 1 <= i1 & i1 <= n & x1 = Base_FinSeq (n,i1) ) by A13, A28;
hence x1 = x2 by A30, A31; :: thesis: verum
end;
then A32: f is one-to-one by FUNCT_1:def 4;
A33: ( Seg n = {} implies B0 = {} )
proof
set y = the Element of B0;
assume A34: Seg n = {} ; :: thesis: B0 = {}
assume B0 <> {} ; :: thesis: contradiction
then the Element of B0 in B0 ;
then ex x being Element of REAL n st
( x = the Element of B0 & ex i being Element of NAT st
( 1 <= i & i <= n & x = Base_FinSeq (n,i) & |(x1,x)| <> 0 ) ) ;
hence contradiction by A34; :: thesis: verum
end;
A35: for i3 being Element of NAT st i3 in dom (ProjFinSeq x1) & not i3 in rng (Sgm (rng f)) holds
(ProjFinSeq x1) . i3 = 0* n
proof
let i3 be Element of NAT ; :: thesis: ( i3 in dom (ProjFinSeq x1) & not i3 in rng (Sgm (rng f)) implies (ProjFinSeq x1) . i3 = 0* n )
assume that
A36: i3 in dom (ProjFinSeq x1) and
A37: not i3 in rng (Sgm (rng f)) ; :: thesis: (ProjFinSeq x1) . i3 = 0* n
A38: i3 in Seg (len (ProjFinSeq x1)) by A36, FINSEQ_1:def 3;
then A39: 1 <= i3 by FINSEQ_1:1;
len (ProjFinSeq x1) = n by Def12;
then A40: i3 <= n by A38, FINSEQ_1:1;
A41: not i3 in rng f by A37, FINSEQ_1:def 13;
A42: now
assume |(x1,(Base_FinSeq (n,i3)))| <> 0 ; :: thesis: contradiction
then A43: Base_FinSeq (n,i3) in B0 by A39, A40;
then consider i5 being Element of NAT such that
A44: f . (Base_FinSeq (n,i3)) = i5 and
1 <= i5 and
i5 <= n and
A45: Base_FinSeq (n,i3) = Base_FinSeq (n,i5) by A13;
A46: Base_FinSeq (n,i3) in dom f by A33, A43, FUNCT_2:def 1;
i3 = i5 by A39, A40, A45, Th27;
hence contradiction by A41, A44, A46, FUNCT_1:def 3; :: thesis: verum
end;
(ProjFinSeq x1) . i3 = |(x1,(Base_FinSeq (n,i3)))| * (Base_FinSeq (n,i3)) by A39, A40, Def12;
hence (ProjFinSeq x1) . i3 = 0* n by A42, EUCLID_4:3; :: thesis: verum
end;
rng ((ProjFinSeq x1) * (Sgm (rng f))) c= rng (ProjFinSeq x1) by RELAT_1:26;
then A47: rng ((ProjFinSeq x1) * (Sgm (rng f))) c= REAL n by A6, XBOOLE_1:1;
A48: rng (Sgm (rng f)) = rng f by FINSEQ_1:def 13;
A49: dom f = B0 by A33, FUNCT_2:def 1;
then rng (f ") = B0 by A32, FUNCT_1:33;
then A50: rng ((f ") * (Sgm (rng f))) c= the carrier of (REAL-US n) by A26, XBOOLE_1:1;
dom ((f ") * (Sgm (rng f))) = (Sgm (rng f)) " (dom (f ")) by RELAT_1:147
.= (Sgm (rng f)) " (rng f) by A32, FUNCT_1:33
.= dom (Sgm (rng f)) by A48, Th2 ;
then (f ") * (Sgm (rng f)) is FinSequence by A27, FINSEQ_1:def 2;
then reconsider F0 = (f ") * (Sgm (rng f)) as FinSequence of the carrier of (REAL-US n) by A50, FINSEQ_1:def 4;
dom F0 = (Sgm (rng f)) " (dom (f ")) by RELAT_1:147
.= (Sgm (rng f)) " (rng f) by A32, FUNCT_1:33
.= dom (Sgm (rng f)) by A48, Th2 ;
then A51: dom F0 = Seg (len (Sgm (rng f))) by FINSEQ_1:def 3;
A52: dom (ProjFinSeq x1) = Seg (len (ProjFinSeq x1)) by FINSEQ_1:def 3
.= Seg n by Def12 ;
then dom ((ProjFinSeq x1) * (Sgm (rng f))) = (Sgm (rng f)) " (Seg n) by RELAT_1:147
.= dom (Sgm (rng f)) by A48, Th2 ;
then (ProjFinSeq x1) * (Sgm (rng f)) is FinSequence by A25, FINSEQ_1:def 2;
then reconsider F2 = (ProjFinSeq x1) * (Sgm (rng f)) as FinSequence of the carrier of (REAL-US n) by A1, A47, FINSEQ_1:def 4;
dom F2 = (Sgm (rng f)) " (Seg n) by A52, RELAT_1:147
.= dom (Sgm (rng f)) by A48, Th2 ;
then A53: dom F2 = Seg (len (Sgm (rng f))) by FINSEQ_1:def 3;
then A54: Seg (len F2) = Seg (len (Sgm (rng f))) by FINSEQ_1:def 3;
A55: len F2 = len (Sgm (rng f)) by A53, FINSEQ_1:def 3;
dom (f ") = rng f by A32, FUNCT_1:33;
then rng F0 = rng (f ") by A48, RELAT_1:28
.= dom f by A32, FUNCT_1:33 ;
then A56: rng F0 = Carrier l0 by A49, A19, A20, XBOOLE_0:def 10;
A57: for i being Element of NAT st i in dom F2 holds
F2 . i = (l0 . (F0 /. i)) * (F0 /. i)
proof
let i be Element of NAT ; :: thesis: ( i in dom F2 implies F2 . i = (l0 . (F0 /. i)) * (F0 /. i) )
A58: Sgm (rng f) is one-to-one by FINSEQ_3:92;
assume i in dom F2 ; :: thesis: F2 . i = (l0 . (F0 /. i)) * (F0 /. i)
then A59: i in Seg (len F2) by FINSEQ_1:def 3;
then A60: i in dom (Sgm (rng f)) by A55, FINSEQ_1:def 3;
then (Sgm (rng f)) . i in rng (Sgm (rng f)) by FUNCT_1:def 3;
then reconsider i2 = (Sgm (rng f)) . i as Element of NAT ;
reconsider r = Base_FinSeq (n,i2) as Element of (REAL-US n) by REAL_NS1:def 6;
i2 in rng (Sgm (rng f)) by A60, FUNCT_1:def 3;
then consider x2 being set such that
A61: x2 in dom f and
A62: f . x2 = i2 by A48, FUNCT_1:def 3;
dom f = B0 by A33, FUNCT_2:def 1;
then reconsider r2 = x2 as Element of (REAL-US n) by A61;
A63: ex i22 being Element of NAT st
( f . r2 = i22 & 1 <= i22 & i22 <= n & r2 = Base_FinSeq (n,i22) ) by A13, A61;
then consider i4 being Element of NAT such that
A64: f . r = i4 and
1 <= i4 and
i4 <= n and
A65: r = Base_FinSeq (n,i4) by A62;
A66: dom f = B0 by A33, FUNCT_2:def 1;
F0 . i = (f ") . ((Sgm (rng f)) . i) by A60, FUNCT_1:13
.= Base_FinSeq (n,i2) by A32, A61, A62, A63, FUNCT_1:32 ;
then Base_FinSeq (n,i2) in rng F0 by A51, A54, A59, FUNCT_1:def 3;
then Base_FinSeq (n,i2) in { v where v is Element of (REAL-US n) : l0 . v <> 0 } by A56, RLVECT_2:def 4;
then A67: ex v0 being Element of (REAL-US n) st
( Base_FinSeq (n,i2) = v0 & l0 . v0 <> 0 ) ;
then Base_FinSeq (n,i2) in B0 by A17;
then A68: (f ") . (f . (Base_FinSeq (n,i2))) = Base_FinSeq (n,i2) by A32, A66, FUNCT_1:34;
then A69: ((f ") * (Sgm (rng f))) . i = Base_FinSeq (n,i2) by A60, A62, A63, FUNCT_1:13;
A70: i2 in rng f by A48, A60, FUNCT_1:def 3;
then A71: 1 <= i2 by FINSEQ_1:1;
A72: i2 <= n by A70, FINSEQ_1:1;
then i4 = i2 by A71, A65, Th27;
then A73: ((Sgm (rng f)) ") . (f . (Base_FinSeq (n,i2))) = i by A60, A64, A58, FUNCT_1:32;
A74: f . (Base_FinSeq (n,i2)) in rng (Sgm (rng f)) by A48, A61, A62, A63, FUNCT_1:def 3;
then A75: (f ") . ((Sgm (rng f)) . (((Sgm (rng f)) ") . (f . (Base_FinSeq (n,i2))))) = Base_FinSeq (n,i2) by A58, A68, FUNCT_1:35;
dom ((Sgm (rng f)) ") = rng (Sgm (rng f)) by A58, FUNCT_1:33;
then ((Sgm (rng f)) ") . (f . (Base_FinSeq (n,i2))) in rng ((Sgm (rng f)) ") by A74, FUNCT_1:def 3;
then A76: ((Sgm (rng f)) ") . (f . (Base_FinSeq (n,i2))) in dom (Sgm (rng f)) by A58, FUNCT_1:33;
l0 . (F0 /. i) = l0 . (((f ") * (Sgm (rng f))) . i) by A51, A55, A59, PARTFUN1:def 6
.= l0 . (Base_FinSeq (n,i2)) by A73, A76, A75, FUNCT_1:13
.= |(x1,(Base_FinSeq (n,i2)))| by A17, A71, A72, A67 ;
then (l0 . (F0 /. i)) * (F0 /. i) = |(x1,(Base_FinSeq (n,i2)))| * (Base_FinSeq (n,i2)) by A51, A55, A59, A69, PARTFUN1:def 6
.= (ProjFinSeq x1) . ((Sgm (rng f)) . i) by A71, A72, Def12
.= ((ProjFinSeq x1) * (Sgm (rng f))) . i by A60, FUNCT_1:13 ;
hence F2 . i = (l0 . (F0 /. i)) * (F0 /. i) ; :: thesis: verum
end;
A77: Sgm (rng f) is one-to-one by FINSEQ_3:92;
reconsider F3 = F2 as FinSequence of REAL n by REAL_NS1:def 6;
A78: x0 = Sum (ProjFinSeq x1) by Th33
.= Sum F3 by A48, A52, A35, Th26, FINSEQ_3:92
.= Sum F2 by Th37 ;
len F2 = len F0 by A51, A54, FINSEQ_1:def 3;
then x1 = Sum (l0 (#) F0) by A78, A57, RLVECT_2:def 7;
then x1 = Sum l2 by A32, A77, A56, RLVECT_2:def 8;
hence ex l being Linear_Combination of B st x0 = Sum l ; :: thesis: verum