reserve V for RealLinearSpace,
  W for Subspace of V,
  x, y, y1, y2 for set,
  i, n for Element of NAT,
  v for VECTOR of V,
  KL1, KL2 for Linear_Combination of V,
  X for Subset of V;

theorem Th21:
  for A, B being finite Subset of V for v being VECTOR of V st v
in Lin(A \/ B) & not v in Lin(B) holds ex w being VECTOR of V st w in A & w in
  Lin(A \/ B \ {w} \/ {v})
proof
  let A, B be finite Subset of V;
  let v be VECTOR of V such that
A1: v in Lin(A \/ B) and
A2: not v in Lin(B);
  consider L being Linear_Combination of (A \/ B) such that
A3: v = Sum(L) by A1,RLVECT_3:14;
A4: Carrier(L) c= A \/ B by RLVECT_2:def 6;
  now
    assume
A5: for w being VECTOR of V st w in A holds L.w = 0;
    now
      let x be object;
      assume that
A6:   x in Carrier(L) and
A7:   x in A;
      ex u being VECTOR of V st x = u & L.u <> 0 by A6,Th3;
      hence contradiction by A5,A7;
    end;
    then Carrier(L) misses A by XBOOLE_0:3;
    then Carrier(L) c= B by A4,XBOOLE_1:73;
    then L is Linear_Combination of B by RLVECT_2:def 6;
    hence contradiction by A2,A3,RLVECT_3:14;
  end;
  then consider w being VECTOR of V such that
A8: w in A and
A9: L.w <> 0;
  set a = L.w;
  take w;
  consider F being FinSequence of the carrier of V such that
A10: F is one-to-one and
A11: rng F = Carrier(L) and
A12: Sum(L) = Sum(L (#) F) by RLVECT_2:def 8;
A13: w in Carrier(L) by A9,Th3;
  then reconsider Fw1 = (F -| w) as FinSequence of the carrier of V by A11,
FINSEQ_4:41;
  reconsider Fw2 = (F |-- w) as FinSequence of the carrier of V by A11,A13,
FINSEQ_4:50;
A14: rng Fw1 misses rng Fw2 by A10,A11,A13,FINSEQ_4:57;
  set Fw = Fw1 ^ Fw2;
  F just_once_values w by A10,A11,A13,FINSEQ_4:8;
  then
A15: Fw = F - {w} by FINSEQ_4:54;
  then
A16: rng Fw = Carrier(L) \ {w} by A11,FINSEQ_3:65;
  F = (F -| w) ^ <* w *> ^ (F |-- w) by A11,A13,FINSEQ_4:51;
  then F = Fw1 ^ (<* w *> ^ Fw2) by FINSEQ_1:32;
  then L (#) F = (L (#) Fw1) ^ (L (#) (<* w *> ^ Fw2)) by RLVECT_3:34
    .= (L (#) Fw1) ^ ((L (#) <* w *>) ^ (L (#) Fw2)) by RLVECT_3:34
    .= (L (#) Fw1) ^ (L (#) <* w *>) ^ (L (#) Fw2) by FINSEQ_1:32
    .= (L (#) Fw1) ^ <* a*w *> ^ (L (#) Fw2) by RLVECT_2:26;
  then
A17: Sum(L (#) F) = Sum((L (#) Fw1) ^ (<* a*w *> ^ (L (#) Fw2))) by FINSEQ_1:32
    .= Sum(L (#) Fw1) + Sum(<* a*w *> ^ (L (#) Fw2)) by RLVECT_1:41
    .= Sum(L (#) Fw1) + (Sum(<* a*w *>) + Sum(L (#) Fw2)) by RLVECT_1:41
    .= Sum(L (#) Fw1) + (Sum(L (#) Fw2) + a*w) by RLVECT_1:44
    .= (Sum(L (#) Fw1) + Sum(L (#) Fw2)) + a*w by RLVECT_1:def 3
    .= Sum((L (#) Fw1) ^ (L (#) Fw2)) + a*w by RLVECT_1:41
    .= Sum(L (#) (Fw1 ^ Fw2)) + a*w by RLVECT_3:34;
  v in {v} by TARSKI:def 1;
  then v in Lin({v}) by RLVECT_3:15;
  then consider Lv being Linear_Combination of {v} such that
A18: v = Sum(Lv) by RLVECT_3:14;
  consider K being Linear_Combination of V such that
A19: Carrier(K) = rng Fw /\ Carrier(L) and
A20: L (#) Fw = K (#) Fw by Th7;
  rng Fw = rng F \ {w} by A15,FINSEQ_3:65;
  then
A21: Carrier(K) = rng Fw by A11,A19,XBOOLE_1:28;
A22: Carrier(L) \ {w} c= A \/ B \ {w} by A4,XBOOLE_1:33;
  then reconsider K as Linear_Combination of (A \/ B \ {w}) by A16,A21,
RLVECT_2:def 6;
  a" <> 0 by A9,XCMPLX_1:202;
  then
A23: Carrier (a"*(-K + Lv)) = Carrier(-K + Lv) by RLVECT_2:42;
  set LC = a"*(-K + Lv);
  Carrier (-K + Lv) c= Carrier(-K) \/ Carrier(Lv) by RLVECT_2:37;
  then
A24: Carrier (-K + Lv) c= Carrier(K) \/ Carrier(Lv) by RLVECT_2:51;
  Carrier(Lv) c= {v} by RLVECT_2:def 6;
  then Carrier(K) \/ Carrier(Lv) c= A \/ B \ {w} \/ {v} by A16,A21,A22,
XBOOLE_1:13;
  then Carrier (-K + Lv) c= A \/ B \ {w} \/ {v} by A24;
  then
A25: LC is Linear_Combination of (A \/ B \ {w} \/ {v}) by A23,RLVECT_2:def 6;
  Fw1 is one-to-one & Fw2 is one-to-one by A10,A11,A13,FINSEQ_4:52,53;
  then Fw is one-to-one by A14,FINSEQ_3:91;
  then Sum(K (#) Fw) = Sum(K) by A21,RLVECT_2:def 8;
  then a"*v = a"*Sum(K) + a"*(a*w) by A3,A12,A17,A20,RLVECT_1:def 5
    .= a"*Sum(K) + (a"*a)*w by RLVECT_1:def 7
    .= a"*Sum(K) +1*w by A9,XCMPLX_0:def 7
    .= a"*Sum(K) + w by RLVECT_1:def 8;
  then w = a"*v - a"*Sum(K) by RLSUB_2:61
    .= a"*(v - Sum(K)) by RLVECT_1:34
    .= a"*(-Sum(K) + v) by RLVECT_1:def 11;
  then w = a"*(Sum(-K) + Sum(Lv)) by A18,RLVECT_3:3
    .= a"*Sum(-K + Lv) by RLVECT_3:1
    .= Sum(a"*(-K + Lv)) by RLVECT_3:2;
  hence thesis by A8,A25,RLVECT_3:14;
end;
