
theorem lembasx1:
for F being Field,
    E being FieldExtension of F
for a being Element of E
for n being Element of NAT
for M being Subset of VecSp(E,F)
   st M = {a|^i where i is Element of NAT : i <= n} &
      for i,j being Element of NAT st i < j & j <= n holds a|^i <> a|^j
for l being Linear_Combination of M
for p being Polynomial of F
st deg p <= n &
   for i being Element of NAT st i <= n holds p.i = l.(a|^i)
holds Ext_eval(p,a) = Sum l
proof
let F be Field, E be FieldExtension of F; let a be Element of E;
let n be Element of NAT; let M be Subset of VecSp(E,F);
assume AS1: M = {a|^i where i is Element of NAT : i <= n} &
            for i,j being Element of NAT st i < j & j <= n holds a|^i <> a|^j;
let l be Linear_Combination of M; let p be Polynomial of F;
assume AS2: deg p <= n &
            for i being Element of NAT st i <= n holds p.i = l.(a|^i);
set V = VecSp(E,F);

defpred P[Nat] means
  for l being Linear_Combination of M st card Carrier(l) = $1
  for p being Polynomial of F
  st deg p <= n &
     for i being Element of NAT st i <=n holds p.i = l.(a|^i)
  holds Sum l = Ext_eval(p,a);

IA: P[0]
   proof
   let l be Linear_Combination of M;
   assume card Carrier(l) = 0; then
   Carrier l = {}; then
   A2: l = ZeroLC(V) by VECTSP_6:def 3;
   let p be Polynomial of F; assume
   A4: deg p <= n &
     for i being Element of NAT st i <= n holds p.i = l.(a|^i);
   now let i be Element of NAT;
     per cases;
     suppose i > n;
       then A5: i > deg p by A4,XXREAL_0:2;
       deg p = len p - 1 by HURWITZ:def 2;
       then i + 1 > len p - 1 + 1 by A5,XREAL_1:6;
       hence p.i = (0_.(F)).i by NAT_1:13,ALGSEQ_1:8;
       end;
     suppose A5: i <= n; then
       a|^i in M by AS1; then
       reconsider v = a|^i as Element of V;
       thus p.i = l.v by A4,A5 .= (0_.(F)).i by A2,VECTSP_6:3;
       end;
     end;
   then p = 0_.(F);
   hence Ext_eval(p,a) = 0.E by ALGNUM_1:13
                      .= 0.V by FIELD_4:def 6
                      .= Sum l by A2,VECTSP_6:15;
   end;

IS: now let k be Nat;
   assume B0: P[k];
   now let l be Linear_Combination of M;
     assume B1: card Carrier(l) = k+1;
     let pp be Polynomial of F;
     assume B2: deg pp <= n &
       for i being Element of NAT st i <= n holds pp.i=l.(a|^i);
  now assume C0: pp = 0_.(F);
    now let o be object;
      assume C1: o in Carrier l;
      Carrier l c= M by VECTSP_6:def 4;
      then o in M by C1;
      then consider i being Element of NAT such that
      C2: o = a|^i & i <= n by AS1;
      l.(a|^i) = pp.i by B2,C2 .= 0.F by C0;
      hence contradiction by C1,C2,VECTSP_6:2;
      end;
    then Carrier l = {} by XBOOLE_0:def 1;
    hence contradiction by B1;
    end;
  then reconsider p = pp as non zero Polynomial of F by UPROOTS:def 5;
  defpred Q[object,object] means
         ($1 = a|^(deg p) & $2 = LC p) or ($1 <> a|^(deg p) & $2 = 0.F);
  A: for x being object st x in the carrier of V
     ex y being object st y in the carrier of F & Q[x,y]
         proof
         let x be object;
         assume x in the carrier of V;
         per cases;
         suppose x = a|^(deg p);
           hence ex y being object st y in the carrier of F & Q[x,y];
           end;
         suppose x <> a|^(deg p);
           hence ex y being object st y in the carrier of F & Q[x,y];
           end;
         end;
      consider lp being Function of the carrier of V,the carrier of F such that
      L: for x being object st x in the carrier of V holds Q[x,lp.x]
         from FUNCT_2:sch 1(A);
      reconsider lp as Element of Funcs(the carrier of V, the carrier of F)
        by FUNCT_2:8;
      U: M is finite
         proof
         deffunc F(Nat) = a|^($1);
         defpred P[Nat] means $1 <= n;
         D: {F(i) where i is Nat: i<=n & P[i]} is finite from FINSEQ_1:sch 6;
         E: now let o be object;
            assume o in {F(i) where i is Nat: i<=n & P[i]};
            then consider i being Nat such that
            E1: o = a|^i & i <= n & i <= n;
            i is Element of NAT by ORDINAL1:def 12;
            hence o in M by E1,AS1;
            end;
         now let o be object;
            assume o in M; then
            consider i being Element of NAT such that
            E1: o = a|^i & i <= n by AS1;
            thus o in {F(i) where i is Nat: i<=n & P[i]} by E1;
            end;
         hence thesis by D,E,TARSKI:2;
         end;
      for v being Element of V st not v in M holds lp.v = 0.F
        proof
        let v being Element of V;
        assume not v in M;
        then v <> a|^(deg p) by B2,AS1;
        hence lp.v = 0.F by L;
        end;
      then reconsider lp as Linear_Combination of V by U,VECTSP_6:def 1;
      now let o be object;
        assume o in Carrier lp;
        then consider v being Element of V such that
        A1: o = v & lp.v <> 0.F by VECTSP_6:1;
        v = a|^(deg p) & lp.v = LC p by L,A1;
        hence o in M by A1,B2,AS1;
        end;
      then Carrier(lp) c= M;
      then reconsider lp as Linear_Combination of M by VECTSP_6:def 4;
        X1: {a} is Subset of FAdj(F,{a}) by FAt;
        a in {a} by TARSKI:def 1; then
        reconsider a1 = a as Element of the carrier of FAdj(F,{a}) by X1;
     X: a|^(deg p) is Element of V by FIELD_4:def 6;
     C0: Carrier lp = {a|^(deg p)}
             proof
             C2: now let o be object;
                 assume o in {a|^(deg p)}; then
                 C3: o = a|^(deg p) by TARSKI:def 1; then
                 lp.o <> 0.F by X,L;
                 hence o in Carrier lp by X,C3,VECTSP_6:2;
                 end;
             now let o be object;
               assume C3: o in Carrier lp;
               Carrier lp = {v where v is Element of V: lp.v <> 0.F}
                                                        by VECTSP_6:def 2;
               then consider v being Element of V such that
               C4: o = v & lp.v <> 0.F by C3;
               o = a|^(deg p) by C4,L;
               hence o in {a|^(deg p)} by TARSKI:def 1;
               end;
             hence thesis by C2,TARSKI:2;
             end;
         lp.(a|^(deg p)) = LC p by X,L; then
     C: Ext_eval(LM p,a) = Sum lp by C0,lembasx1a;

     set q = p - (LM p);
     reconsider lk = l - lp as Linear_Combination of M by VECTSP_6:42;
     C2: l = lk + lp
         proof
         thus lk + lp = (l + -lp) + lp by VECTSP_6:def 11
                     .= l + (-lp + lp) by VECTSP_6:26
                     .= l + (lp + -lp) by VECTSP_6:25
                     .= l + (lp - lp) by VECTSP_6:def 11
                     .= l + ZeroLC(V) by VECTSP_6:43
                     .= l by VECTSP_6:27;
         end;
     C3: Carrier lk = Carrier(l) \ Carrier(lp)
         proof
         C4: now let o be object;
             assume o in Carrier lk;
             then consider v being Element of V such that
             C5: o = v & lk.v <> 0.F by VECTSP_6:1;
             C6: now assume C7: v = a|^(deg p); then
                 C9: l.v = p.(deg p) by B2 .= LC p by thLC;
                 lk.v = l.v - lp.v by VECTSP_6:40
                     .= LC p - LC p by L,C7,C9;
                 hence contradiction by C5,RLVECT_1:15;
                 end; then
             C7: not v in Carrier(lp) by C0,TARSKI:def 1;
             lk.v = l.v - lp.v by VECTSP_6:40
                 .= l.v - 0.F by C6,L; then
             v in Carrier l by C5,VECTSP_6:2;
             hence o in Carrier(l) \ Carrier(lp) by C7,C5,XBOOLE_0:def 5;
             end;
         now let o be object;
           assume o in Carrier(l) \ Carrier(lp); then
           C5: o in Carrier(l) & not o in Carrier(lp) by XBOOLE_0:def 5; then
           consider v being Element of V such that
           C6: o = v & l.v <> 0.F by VECTSP_6:1;
           C7: o <> a|^(deg p) by C0,C5,TARSKI:def 1;
           lk.v = l.v - lp.v by VECTSP_6:40
               .= l.v - 0.F by C6,C7,L;
           hence o in Carrier lk by C6,VECTSP_6:1;
           end;
         hence thesis by C4,TARSKI:2;
         end;
     now let o be object;
       assume C5: o in Carrier lp; then
       C4: o = a|^(deg p) by C0,TARSKI:def 1;
       reconsider v = o as Element of V by C5;
       lp.v = LC p by L,C4 .= pp.(deg p) by thLC .= l.v by C4,B2; then
       l.v <> 0.F by C5,VECTSP_6:2;
       hence o in Carrier l by VECTSP_6:2;
       end; then
     Carrier lp c= Carrier l; then
     A: card(Carrier(l) \ Carrier(lp))
         = card(Carrier l) - card(Carrier lp) by CARD_2:44
        .= (k + 1) - 1 by B1,C0,CARD_2:42;
     B: deg q < n by thdLM,B2,XXREAL_0:2;
     for i being Element of NAT st i <= n holds q.i = lk.(a|^i)
       proof
       let i be Element of NAT;
       assume B1: i <= n;
       reconsider v = a|^i as Element of V by FIELD_4:def 6;
       per cases;
       suppose B3: i = deg p;
         hence q.i = p.(deg p) - (LM p).(deg p) by POLYNOM3:27
            .= p.(deg p) - (LM p).(deg (LM p)) by thdegLM
            .= l.v - (LM p).(deg (LM p)) by B3,B2
            .= l.v - LC(LM p) by thLC
            .= l.v - LC p by thdegLC
            .= l.v - lp.v by B3,L
            .= lk.(a|^i) by VECTSP_6:40;
         end;
       suppose D2: i <> deg p;
         D3: a|^i <> a|^(deg p)
            proof
            per cases by D2,XXREAL_0:1;
            suppose i < deg p;
              hence thesis by B2,AS1;
              end;
            suppose i > deg p;
              hence thesis by B1,AS1;
              end;
            end;
         p <> 0_.(F);
         then len p <> 0 by POLYNOM4:5;
         then len p + 1 > 0 + 1 by XREAL_1:6;
         then len p >= 1 by NAT_1:13;
         then D5: len p -' 1 = len p - 1 by XREAL_0:def 2;
         D4: i <> len p -' 1 by D5,D2,HURWITZ:def 2;
         thus q.i = p.i - (LM p).i by POLYNOM3:27
            .= p.i - 0.F by D4,POLYNOM4:def 1
            .= l.v - 0.F by B2,B1
            .= l.v - lp.v by D3,L
            .= lk.(a|^i) by VECTSP_6:40;
         end;
       end;
     then D: Ext_eval(q,a) = Sum lk by A,C3,B,B0;
     thus  Sum l
         = Sum(lk) + Sum(lp) by C2,VECTSP_6:44
        .= (the addF of E).(Sum(lk),Sum(lp)) by FIELD_4:def 6
        .= (Ext_eval(p,a) - Ext_eval(LM p,a)) + Ext_eval(LM p,a)
               by C,D,exevalminus2
        .= Ext_eval(p,a) + (-Ext_eval(LM p,a) + Ext_eval(LM p,a))
               by RLVECT_1:def 3
        .= Ext_eval(p,a) + 0.E by RLVECT_1:5
        .= Ext_eval(pp,a);
     end;
   hence P[k+1];
   end;
I: for k being Nat holds P[k] from NAT_1:sch 2(IA,IS);
consider n being Nat such that H: card Carrier(l) = n;
thus thesis by AS2,I,H;
end;
