
theorem Th53:
  for n, ni being non zero Element of NAT, f being FinSequence of
(the carrier of Polynom-Ring F_Complex), s being finite Subset of F_Complex st
s = {y where y is Element of MultGroup F_Complex : ord y divides n & not ord y
divides ni & ord y <> n} & dom f = Seg n & for i being non zero Element of NAT
st i in dom f holds (not i divides n or i divides ni or i = n implies f.i = <%
  1_F_Complex%>) & (i divides n & not i divides ni & i <> n implies f.i =
  cyclotomic_poly(i)) holds Product(f) = poly_with_roots((s,1)-bag)
proof
  set cMGFC = the carrier of MultGroup F_Complex;
  set cPRFC = the carrier of Polynom-Ring F_Complex;
  let n, ni be non zero Element of NAT;
  let f be FinSequence of cPRFC, s be finite Subset of F_Complex such that
A1: s = {y where y is Element of cMGFC: ord y divides n & not ord y
  divides ni & ord y <> n} and
A2: dom f = Seg n and
A3: for i being non zero Element of NAT st i in dom f holds (not i
divides n or i divides ni or i = n implies f.i = <%1_F_Complex%>) & (i divides
  n & not i divides ni & i <> n implies f.i = cyclotomic_poly(i));
  deffunc MG(Nat) = {y where y is Element of cMGFC : y in s & ord y <= $1 };
A4: now
    let i be Element of NAT;
    MG(i) c= s
    proof
      let x be object;
      assume x in MG(i);
      then ex y being Element of cMGFC st x = y & y in s & ord y <= i;
      hence thesis;
    end;
    hence MG(i) is finite Subset of F_Complex by XBOOLE_1:1;
  end;
  then reconsider sB = MG(n) as finite Subset of F_Complex;
A5: len f = n by A2,FINSEQ_1:def 3;
  defpred P[Nat,set] means for fi being FinSequence of cPRFC st fi = f|Seg $1
  holds $2 = Product(fi);
A6: now
    let i being Nat;
    assume i in Seg len f;
    reconsider fi = f|Seg i as FinSequence of cPRFC by FINSEQ_1:18;
    set x = Product fi;
    take x;
    thus P[i,x];
  end;
  consider F being FinSequence of cPRFC such that
  dom F = Seg len f and
A7: for i being Nat st i in Seg len f holds P[i,F.i] from FINSEQ_1:sch 5
  ( A6);
  defpred R[Nat] means ex t being finite Subset of F_Complex st t =
  MG($1) & F.$1 = poly_with_roots((t,1)-bag);
A8: for i being Element of NAT st 1 <= i & i < len f holds R[i] implies R[i +1]
  proof
    let i be Element of NAT such that
A9: 1 <= i and
A10: i < len f and
A11: R[i];
    reconsider fi = f|Seg i as FinSequence of (the carrier of Polynom-Ring
    F_Complex) by FINSEQ_1:18;
    i in Seg len f by A9,A10,FINSEQ_1:1;
    then
A12: F.i = Product fi by A7;
    reconsider fi1 = f|Seg (i+1) as FinSequence of (the carrier of
    Polynom-Ring F_Complex) by FINSEQ_1:18;
A13: i+1 <= len f by A10,NAT_1:13;
    then i+1 = min(i+1,len f) by XXREAL_0:def 9;
    then
A14: len fi1 = i+1 by FINSEQ_2:21;
    i+1 in NAT by ORDINAL1:def 12;
    then reconsider sB = MG(i+1) as finite Subset of F_Complex by A4;
    take sB;
    thus sB = MG(i+1);
    set B = (sB, 1)-bag;
    consider sb being finite Subset of F_Complex such that
A15: sb = MG(i) and
A16: F.i = poly_with_roots((sb,1)-bag) by A11;
    1 <= i+1 by A9,NAT_1:13;
    then
A17: i+1 in Seg len f by A13,FINSEQ_1:1;
    then
A18: i+1 in dom f by FINSEQ_1:def 3;
A19: (f|Seg (i+1)).(i+1) = f.(i+1) by FINSEQ_1:4,FUNCT_1:49;
    then reconsider
    fi1d1 = fi1.(i+1) as Element of (the carrier of Polynom-Ring
    F_Complex) by A18,FINSEQ_2:11;
    reconsider fi1d1p = fi1d1 as Polynomial of F_Complex by POLYNOM3:def 10;
A20: F.(i+1) = Product fi1 by A7,A17;
    set b = (sb, 1)-bag;
    fi = fi1 | Seg i by Lm2,NAT_1:12;
    then fi1 = fi ^ <* fi1d1 *> by A14,FINSEQ_3:55;
    then Product fi1 = Product fi * fi1d1 by GROUP_4:6;
    then
A21: Product fi1=(poly_with_roots b)*' fi1d1p by A12,A16,POLYNOM3:def 10;
    per cases;
    suppose
A22:  not (i+1) divides n or (i+1) divides ni or i+1 = n;
A23:  now
        let x be object;
        hereby
          assume x in sB;
          then consider y being Element of MultGroup F_Complex such that
A24:      x = y and
A25:      y in s and
A26:      ord y <= i+1;
          ex y1 being Element of cMGFC st y = y1 & ord y1 divides n & not
          ord y1 divides ni & ord y1 <> n by A1,A25;
          then ord y < i+1 by A22,A26,XXREAL_0:1;
          then ord y <= i by NAT_1:13;
          hence x in sb by A15,A24,A25;
        end;
        assume x in sb;
        then consider y being Element of MultGroup F_Complex such that
A27:    x = y & y in s and
A28:    ord y <= i by A15;
        ord y <= i+1 by A28,NAT_1:12;
        hence x in sB by A27;
      end;
      f.(i+1) = <%1_F_Complex%> by A3,A18,A22;
      then F.(i+1) = (poly_with_roots b) by A20,A19,A21,UPROOTS:32
        .= poly_with_roots(B) by A23,TARSKI:2;
      hence thesis;
    end;
    suppose
A29:  (i+1) divides n & not (i+1) divides ni & (i+1) <> n;
      consider scb being non empty finite Subset of F_Complex such that
A30:  scb = { y where y is Element of cMGFC : ord y = i+1 } and
A31:  cyclotomic_poly(i+1) = poly_with_roots((scb,1)-bag) by Def5;
      now
        let x be object;
        hereby
          assume x in sB;
          then consider y being Element of cMGFC such that
A32:      x = y and
A33:      y in s and
A34:      ord y <= i+1;
          ord y <= i or ord y = i+1 by A34,NAT_1:8;
          then y in sb or y in scb by A15,A30,A33;
          hence x in sb \/ scb by A32,XBOOLE_0:def 3;
        end;
        assume
A35:    x in sb \/ scb;
        per cases by A35,XBOOLE_0:def 3;
        suppose
          x in sb;
          then consider y being Element of cMGFC such that
A36:      x = y & y in s and
A37:      ord y <= i by A15;
          ord y <= i+1 by A37,NAT_1:12;
          hence x in sB by A36;
        end;
        suppose
          x in scb;
          then consider y being Element of cMGFC such that
A38:      x = y and
A39:      ord y = i+1 by A30;
          y in s by A1,A29,A39;
          hence x in sB by A38,A39;
        end;
      end;
      then
A40:  sB = sb \/ scb by TARSKI:2;
      set cb = (scb,1)-bag;
A41:  sb misses scb
      proof
        assume sb /\ scb <> {};
        then consider x being object such that
A42:    x in sb /\ scb by XBOOLE_0:def 1;
        x in scb by A42,XBOOLE_0:def 4;
        then
A43:    ex y2 being Element of cMGFC st x = y2 & ord y2 = i+1 by A30;
        x in sb by A42,XBOOLE_0:def 4;
        then ex y1 being Element of cMGFC st x = y1 & y1 in s & ord y1 <= i by
A15;
        hence contradiction by A43,NAT_1:13;
      end;
      f.(i+1) = poly_with_roots(cb) by A3,A18,A29,A31;
      then F.(i+1) = (poly_with_roots b)*' poly_with_roots(cb) by A7,A17,A19
,A21
        .= poly_with_roots (b+cb) by UPROOTS:64
        .= poly_with_roots(B) by A40,A41,UPROOTS:10;
      hence thesis;
    end;
  end;
  now
    let x be object;
    hereby
      assume
A44:  x in s;
      then consider y being Element of MultGroup F_Complex such that
A45:  x = y and
A46:  ord y divides n and
      not ord y divides ni and
      ord y <> n by A1;
      ord y <= n by A46,NAT_D:7;
      hence x in sB by A44,A45;
    end;
    assume x in sB;
    then ex y being Element of MultGroup F_Complex st y = x & y in s & ord y
    <= n;
    hence x in s;
  end;
  then
A47: s = sB by TARSKI:2;
A48: 0+1 <= n by NAT_1:13;
A49: R[1]
  proof
    reconsider t = MG(1) as finite Subset of F_Complex by A4;
    take t;
    thus t = MG(1);
    reconsider f1 = f|Seg 1 as FinSequence of cPRFC by FINSEQ_1:18;
A50: 1 in dom f by A5,A48,FINSEQ_3:25;
A51: 1 divides ni by NAT_D:6;
    now
      assume t is non empty;
      then consider x being object such that
A52:  x in t;
      consider y being Element of cMGFC such that
      x = y and
A53:  y in s and
A54:  ord y <= 1 by A52;
      consider y1 being Element of cMGFC such that
A55:  y = y1 and
A56:  ord y1 divides n and
A57:  not ord y1 divides ni and
      ord y1 <> n by A1,A53;
      now
        assume ord y1 = 0;
        then ex u being Nat st n = 0 * u by A56,NAT_D:def 3;
        hence contradiction;
      end;
      then 0+1 <= ord y1 by NAT_1:13;
      hence contradiction by A51,A54,A55,A57,XXREAL_0:1;
    end;
    then
A58: (t,1)-bag = EmptyBag the carrier of F_Complex by UPROOTS:9;
A59: 1 in Seg len f by A5,A48,FINSEQ_1:1;
    then 1 in dom f by FINSEQ_1:def 3;
    then reconsider fd1 = f.1 as Element of cPRFC by FINSEQ_2:11;
    f1 = <*f.1*> by A5,A48,Th1;
    then F.1 = Product <*fd1*> by A7,A59
      .= fd1 by FINSOP_1:11
      .= <%1_F_Complex%> by A3,A50,A51;
    hence thesis by A58,UPROOTS:60;
  end;
  for i being Element of NAT st 1 <= i & i <= len f holds R[i] from
  INT_1:sch 7 (A49,A8);
  then f = f|Seg len f & ex S being finite Subset of F_Complex st S = MG(len
  f) & F.len f = poly_with_roots((S,1)-bag) by A5,A48,FINSEQ_3:49;
  hence thesis by A5,A7,A47,FINSEQ_1:3;
end;
