
theorem Th51:
  for d being non zero Element of NAT, i being Element of NAT
  holds ((cyclotomic_poly d).0 = 1 or (cyclotomic_poly d).0 = -1) & (
  cyclotomic_poly d).i is integer
proof
  deffunc cp(non zero Nat) = cyclotomic_poly($1);
  set cPRFC = the carrier of Polynom-Ring F_Complex;
  set cFC = the carrier of F_Complex;
  defpred P[non zero Element of NAT] means (cp($1).0 = 1 or cp($1).0 = -1) &
  for i being Element of NAT holds cp($1).i is integer;
A1: -1_F_Complex = -1 by COMPLFLD:2,8;
A2: now
    let k be non zero Element of NAT such that
A3: for n being non zero Element of NAT st n < k holds P[n];
A4: 1 <= k by Lm1;
    per cases by A4,XXREAL_0:1;
    suppose
A5:   k = 1;
      now
        let i be Element of NAT;
        per cases by NAT_1:23;
        suppose
          i = 0;
          hence cp(k).i is integer by A1,A5,Th48,POLYNOM5:38;
        end;
        suppose
          i = 1;
          hence cp(k).i is integer by A5,Th48,COMPLFLD:8,POLYNOM5:38;
        end;
        suppose
          i >= 2;
          hence cp(k).i is integer by A5,Th48,COMPLFLD:7,POLYNOM5:38;
        end;
      end;
      hence P[k] by A1,A5,Th48,POLYNOM5:38;
    end;
    suppose
A6:   k > 1;
      consider f being FinSequence of cPRFC, p being Polynomial of F_Complex
      such that
A7:   p = Product(f) and
A8:   dom f = Seg k and
A9:   for i being non zero Element of NAT st i in Seg k holds (not i
      divides k or i = k implies f.i = <%1_F_Complex%>) & (i divides k & i <> k
      implies f.i = cp(i)) and
A10:  unital_poly(F_Complex,k) = (cyclotomic_poly k)*'p by Th50;
      defpred G[Nat,object] means ex g being FinSequence of cPRFC, p being
Polynomial of F_Complex st g = f | Seg $1 & p = Product(g) & $2 = p & (p.0 = 1
      or p.0 = -1) & for j being Element of NAT holds p.j is integer;
      defpred H[Nat] means $1 in Seg len f implies ex x being object
      st G[$1,x];
A11:  k = len f by A8,FINSEQ_1:def 3;
A12:  for l being Nat st H[l] holds H[l+1]
      proof
        let l be Nat;
        assume
A13:    H[l];
        assume
A14:    l+1 in Seg len f;
        per cases;
        suppose
A15:      l = 0;
          reconsider fl1 = f.(l+1) as Element of cPRFC by A8,A11,A14,
FINSEQ_2:11;
          reconsider g = f | Seg (l+1) as FinSequence of cPRFC by FINSEQ_1:18;
          reconsider p = Product(g) as Polynomial of F_Complex by
POLYNOM3:def 10;
          <*>cPRFC = f |(Seg 0 qua set);
          then g = (<*>cPRFC)^<*f.(l+1)*> by A8,A11,A14,A15,FINSEQ_5:10
            .= <*f.(l+1)*> by FINSEQ_1:34;
          then
A16:      p = fl1 by FINSOP_1:11;
          take p;
          take g;
          take p;
          thus g = f | Seg (l+1) & p = Product(g) & p = p;
          1 divides k by NAT_D:6;
          then
A17:      f.1 = cp(1) by A6,A9,A11,A14,A15;
          hence p.0 = 1 or p.0 = -1 by A1,A15,A16,Th48,POLYNOM5:38;
          let j be Element of NAT;
          thus p.j is integer
          proof
            per cases by NAT_1:23;
            suppose
              j = 0;
              hence thesis by A1,A15,A16,A17,Th48,POLYNOM5:38;
            end;
            suppose
              j = 1;
              hence thesis by A15,A16,A17,Th48,COMPLFLD:8,POLYNOM5:38;
            end;
            suppose
              j >= 2;
              hence thesis by A15,A16,A17,Th48,COMPLFLD:7,POLYNOM5:38;
            end;
          end;
        end;
        suppose
A18:      0 < l;
          l+1 <= len f & l <= l+1 by A14,FINSEQ_1:1,NAT_1:12;
          then
A19:      l <= len f by XXREAL_0:2;
          0+1 <= l by A18,NAT_1:13;
          then consider x being set such that
A20:      G[l,x] by A13,A19,FINSEQ_1:1;
          reconsider fl1 = f.(l+1) as Element of cPRFC by A8,A11,A14,
FINSEQ_2:11;
          reconsider g1 = f | Seg (l+1) as FinSequence of cPRFC by FINSEQ_1:18;
          reconsider p1 = Product(g1) as Polynomial of F_Complex by
POLYNOM3:def 10;
          take p1;
          take g1;
          take p1;
          thus g1 = f | Seg (l+1) & p1 = Product(g1) & p1 = p1;
          reconsider fl1p = fl1 as Polynomial of F_Complex by POLYNOM3:def 10;
          reconsider m1 = -1 as Element of COMPLEX by XCMPLX_0:def 2;
          consider g being FinSequence of cPRFC, p being Polynomial of
          F_Complex such that
A21:      g = f | Seg l and
A22:      p = Product(g) and
          x = p and
A23:      p.0 = 1 or p.0 = -1 and
A24:      for j being Element of NAT holds p.j is integer by A20;
          g1 = g^<*fl1*> by A8,A11,A14,A21,FINSEQ_5:10;
          then Product g1 = (Product g) * fl1 by GROUP_4:6;
          then
A25:      p1 = p *' fl1p by A22,POLYNOM3:def 10;
          thus thesis
          proof
            per cases;
            suppose
              not (l+1) divides k or (l+1) = k;
              then
A26:          fl1p = <%1_F_Complex%> by A9,A11,A14;
              consider r be FinSequence of F_Complex such that
A27:          len r = 0+1 and
A28:          p1.0 = Sum r and
A29:          for m be Element of NAT st m in dom r holds r.m = p.(m
              -'1) * fl1p.(0+1-'m) by A25,POLYNOM3:def 9;
              1 in dom r by A27,FINSEQ_3:25;
              then reconsider r1 = r.1 as Element of F_Complex by FINSEQ_2:11;
              r = <*r1*> by A27,FINSEQ_1:40;
              then
A30:          p1.0 = r1 by A28,RLVECT_1:44;
              1 in dom r by A27,FINSEQ_3:25;
              then
A31:          p1.0 = p.(1-'1) * fl1p.(0+1-'1) by A29,A30
                .= p.(0+1-'1) * fl1p.(0) by NAT_D:34
                .= p.0 * fl1p.(0) by NAT_D:34
                .= p.0 * 1_F_Complex by A26,POLYNOM5:32;
              thus p1.0 = 1 or p1.0 = -1
              proof
                per cases by A23;
                suppose
                  p.0 = 1;
                  hence thesis by A31;
                end;
                suppose
                  p.0 = -1;
                  hence thesis by A31;
                end;
              end;
              let j be Element of NAT;
              consider r be FinSequence of F_Complex such that
              len r = j+1 and
A32:          p1.j = Sum r and
A33:          for m be Element of NAT st m in dom r holds r.m = p.(m
              -'1) * fl1p.(j+1-'m) by A25,POLYNOM3:def 9;
              for i being Element of NAT st i in dom r holds r.i is integer
              proof
                let i be Element of NAT;
                reconsider pi1 = p.(i-'1) as Integer by A24;
                set j1i = j+1-'i;
                now
A34:              j1i = 0 or j1i >= 0+1 by NAT_1:13;
                  per cases by A34;
                  case
                    j1i = 0;
                    hence fl1p.j1i = 1 by A26,COMPLFLD:8,POLYNOM5:32;
                  end;
                  case
                    j1i >= 1;
                    hence fl1p.j1i = 0 by A26,COMPLFLD:7,POLYNOM5:32;
                  end;
                end;
                then reconsider fl1pj1i = fl1p.(j+1-'i) as Integer;
                assume i in dom r;
                then r.i = p.(i-'1) * fl1p.(j+1-'i) by A33
                  .= pi1 * fl1pj1i;
                hence thesis;
              end;
              hence thesis by A32,Th4;
            end;
            suppose
A35:          (l+1) divides k & (l+1) <> k;
              consider r be FinSequence of F_Complex such that
A36:          len r = 0+1 and
A37:          p1.0 = Sum r and
A38:          for m be Element of NAT st m in dom r holds r.m = p.(m
              -'1) * fl1p.(0+1-'m) by A25,POLYNOM3:def 9;
              1 in dom r by A36,FINSEQ_3:25;
              then reconsider r1 = r.1 as Element of F_Complex by FINSEQ_2:11;
              r = <*r1*> by A36,FINSEQ_1:40;
              then
A39:          p1.0 = r1 by A37,RLVECT_1:44;
              1 in dom r by A36,FINSEQ_3:25;
              then
A40:          p1.0 = p.(1-'1) * fl1p.(0+1-'1) by A38,A39
                .= p.(0+1-'1) * fl1p.0 by NAT_D:34
                .= p.0 * fl1p.0 by NAT_D:34;
              l+1 <= k by A35,NAT_D:7;
              then
A41:          l+1 < k by A35,XXREAL_0:1;
A42:           l+1 in NAT by ORDINAL1:def 12;
A43:          fl1p = cp(l+1) by A9,A11,A14,A35;
              then reconsider fl1p0 = fl1p.0
                    as Integer by A3,A41,A42;
A44:          fl1p0 = 1 or fl1p0 = m1 by A3,A43,A41,A42;
              thus p1.0 = 1 or p1.0 = -1
              proof
                per cases by A23;
                suppose
                  p.0 = 1;
                  hence thesis by A3,A43,A41,A40;
                end;
                suppose
                  p.0 = -1;
                  hence thesis by A40,A44;
                end;
              end;
              let j be Element of NAT;
              consider r be FinSequence of F_Complex such that
              len r = j+1 and
A45:          p1.j = Sum r and
A46:          for m be Element of NAT st m in dom r holds r.m = p.(m
              -'1) * fl1p.(j+1-'m) by A25,POLYNOM3:def 9;
              for i being Element of NAT st i in dom r holds r.i is integer
              proof
                let i be Element of NAT;
                l+1 in NAT by ORDINAL1:def 12;
                then reconsider fl1pj1i = fl1p.(j+1-'i) as Integer
                     by A3,A43,A41;
                reconsider pi1 = p.(i-'1) as Integer by A24;
                assume i in dom r;
                then r.i = p.(i-'1) * fl1p.(j+1-'i) by A46
                  .= pi1 * fl1pj1i;
                hence thesis;
              end;
              hence thesis by A45,Th4;
            end;
          end;
        end;
      end;
      defpred C[Nat] means cp(k).$1 is integer;
A47:  0+1-'1 = 0 by NAT_D:34;
A48:  H[0] by FINSEQ_1:1;
      for l being Nat holds H[l] from NAT_1:sch 2(A48,A12 );
      then
A49:  for l being Nat st l in Seg len f ex x being object st G[l,x];
      consider F being FinSequence such that
      dom F = Seg len f and
A50:  for i being Nat st i in Seg len f holds G[i,F.i] from FINSEQ_1:
      sch 1 (A49);
      consider g being FinSequence of cPRFC, p1 being Polynomial of F_Complex
      such that
A51:  g = f | Seg k & p1 = Product(g) and
      F.k = p1 and
A52:  p1.0 = 1 or p1.0 = -1 and
A53:  for j being Element of NAT holds p1.j is integer by A11,A50,FINSEQ_1:3;
A54:  p = p1 by A7,A11,A51,FINSEQ_3:49;
A55:  now
        let m be Nat;
        reconsider m1 = m as Element of NAT by ORDINAL1:def 12;
        consider r be FinSequence of cFC such that
A56:    len r = m+1 and
A57:    unital_poly(F_Complex,k).m = Sum r and
A58:    for l be Element of NAT st l in dom r holds r.l = p.(l-'1) *
        (cp(k).(m1+1-'l)) by A10,POLYNOM3:def 9;
        reconsider Src = Sum r as Element of COMPLEX by COMPLFLD:def 1;
        now
          per cases;
          suppose
            m1 = 0;
            hence Src is integer by A1,A57,Th38;
          end;
          suppose
            m1 = k;
            hence Src is integer by A57,Th38,COMPLFLD:8;
          end;
          suppose
            m1 <> 0 & m1 <> k;
            hence Src is integer by A57,Th39,COMPLFLD:7;
          end;
        end;
        then reconsider Sr = Src as Integer;
A59:    (1,1)-cut r ^ (1+1,len r)-cut r = r by A56,FINSEQ_6:135,NAT_1:11;
        set s = (1+1,len r)-cut r;
        reconsider Ssc = Sum s as Element of COMPLEX by COMPLFLD:def 1;
        assume
A60:    for n being Nat st n < m holds C[n];
        now
          let i be Element of NAT;
          assume
A61:      i in dom s;
          per cases;
          suppose
            len r < 2;
            then s = {} by FINSEQ_6:def 4;
            hence s.i is integer;
          end;
          suppose
A62:        1+1 <= len r;
            then
A63:        len s +(1+1) = len r + 1 by FINSEQ_6:def 4;
            per cases;
            suppose
              m = 0;
              hence s.i is integer by A56,A62;
            end;
            suppose
A64:          m > 0;
              i <> 0 by A61,FINSEQ_3:25;
              then reconsider cpkmi = cp(k).(m-'i) as Integer by A60,A64,
NAT_2:9;
              reconsider ppi = p.i as Integer by A53,A54;
              i <> 0 by A61,FINSEQ_3:25;
              then consider i1 being Nat such that
A65:          i = i1+1 by NAT_1:6;
A66:          i <= len s by A61,FINSEQ_3:25;
              then 1 <= i+1 & i+1 <= len s +1 by NAT_1:11,XREAL_1:6;
              then 1+i in dom r by A63,FINSEQ_3:25;
              then
A67:          r.(1+i) = p.(1+i-'1) * cp(k).(m+1-'(1+i)) by A58
                .= p.(i+1-'1) * cp(k).(m+1-'1-'i) by NAT_2:30
                .= p.i * cp(k).(m+1-'1-'i) by NAT_D:34
                .= ppi *cpkmi by NAT_D:34;
              i1 < len s by A66,A65,NAT_1:13;
              then s.i = r.(1+1+i1) by A62,A65,FINSEQ_6:def 4
                .= r.(1+i) by A65;
              hence s.i is integer by A67;
            end;
          end;
        end;
        then reconsider Ss = Ssc as Integer by Th4;
A68:    1 <= len r by A56,NAT_1:11;
        then
A69:    1 in dom r by FINSEQ_3:25;
        then reconsider r1 = r.1 as Element of cFC by FINSEQ_2:11;
        reconsider r1c = r1 as Element of COMPLEX by COMPLFLD:def 1;
        (1,1)-cut r = <*r1*> by A68,FINSEQ_6:132;
        then Sum r = r1 + Sum s by A59,FVSUM_1:72;
        then r1c = Sr -Ss;
        then reconsider r1i = r1 as Integer;
A70:    r1i = p.(1-'1) * cp(k).(m+1-'1) by A58,A69
          .= p.0 * cp(k).m1 by A47,NAT_D:34;
        per cases by A7,A11,A51,A52,FINSEQ_3:49;
        suppose
          p.0 = 1;
          hence C[m] by A70;
        end;
        suppose
          p.0 = -1;
          then r1 = (-1_F_Complex) * cp(k).m1 by A70,COMPLFLD:2,8
            .= -1_F_Complex * cp(k).m1 by VECTSP_1:9
            .= - cp(k).m1;
          then 0.F_Complex = - cp(k).m1 + - r1 by RLVECT_1:def 10
            .= -r1 - cp(k).m1;
          then - r1 = cp(k).m by VECTSP_1:19;
          then - r1i = cp(k).m by COMPLFLD:2;
          hence C[m];
        end;
      end;
A71:  for i being Nat holds C[i] from NAT_1:sch 4(A55);
      consider r be FinSequence of cFC such that
A72:  len r = 0+1 and
A73:  unital_poly(F_Complex,k).0 = Sum r and
A74:  for l be Element of NAT st l in dom r holds r.l = p.(l-'1) * (
      cp(k).(0+1-'l)) by A10,POLYNOM3:def 9;
A75:  1 in dom r by A72,FINSEQ_3:25;
      then reconsider r1 = r.1 as Element of cFC by FINSEQ_2:11;
      r = <*r1*> by A72,FINSEQ_1:40;
      then
A76:  Sum r = r.1 by RLVECT_1:44
        .= p.0 * (cp(k).0) by A74,A47,A75;
      cp(k).0 = 1 or cp(k).0 = -1
      proof
        per cases by A7,A11,A51,A52,FINSEQ_3:49;
        suppose
          p.0 = 1;
          hence thesis by A1,A73,A76,Th38;
        end;
        suppose
          p.0 = -1;
          then -1_F_Complex = (-1_F_Complex) * cp(k).0 by A1,A73,A76,Th38
            .= -1_F_Complex * cp(k).0 by VECTSP_1:9
            .= - cp(k).0;
          hence thesis by COMPLFLD:8,RLVECT_1:18;
        end;
      end;
      hence P[k] by A71;
    end;
  end;
  for d being non zero Element of NAT holds P[d] from CompIndNE(A2);
  hence thesis;
end;
