reserve r,t for Real;
reserve i for Integer;
reserve k,n for Nat;
reserve p for Polynomial of F_Real;
reserve e for Element of F_Real;
reserve L for non empty ZeroStr;
reserve z,z0,z1,z2 for Element of L;

theorem Th52:
  1 <= n & e = 2*cos t implies
  ex p being monic INT -valued Polynomial of F_Real
  st eval(p,e) = 2*cos(n*t) & deg p = n &
  (n = 1 implies p = <%0.F_Real,1.F_Real%>) &
  (n = 2 implies
    ex r being Element of F_Real st r = -2 & p = <%r,0.F_Real,1.F_Real%>)
  proof
    assume that
A1: 1 <= n and
A2: e = 2*cos t;
    defpred P[Nat] means
    1 <= $1 implies
    ex p being monic INT -valued Polynomial of F_Real st
    eval(p,e) = 2*cos($1*t) & deg p = $1 &
    ($1 = 1 implies p = <%0.F_Real,1.F_Real%>) &
    ($1 = 2 implies
    ex r being Element of F_Real st r = -2 & p = <%r,0.F_Real,1.F_Real%>);
A3: P[1]
    proof
      assume 1 <= 1;
      reconsider p = <%0.F_Real,1.F_Real%>
        as monic INT -valued Polynomial of F_Real;
      take p;
      thus eval(p,e) = 2*cos(1*t) by A2,POLYNOM5:48;
      len p = 2 by POLYNOM5:40;
      hence deg p = 1;
      thus thesis;
    end;
A4: P[2]
    proof
      assume 1 <= 2;
      reconsider r = -2 as Element of F_Real by XREAL_0:def 1;
      reconsider p = <%r,0.F_Real,1.F_Real%>
        as monic INT -valued Polynomial of F_Real;
      take p;
      cos(2*t) = 2*(cos t)^2-1 by SIN_COS5:7;
      hence 2*cos(2*t) = r+0.F_Real*e+1.F_Real*e*e by A2
      .= eval(p,e) by Th36;
      len p = 3 by Th26;
      hence deg p = 2;
      thus thesis;
    end;
A5: for k being non zero Nat st P[k] & P[k+1] holds P[k+2]
    proof
      let k be non zero Nat such that
A6:   P[k] and
A7:   P[k+1] and
      1 <= k+2;
      per cases;
      suppose k+2 = 1;
        then k = -1;
        hence thesis;
      end;
      suppose k+2 = 2;
        hence thesis;
      end;
      suppose
A8:     k+2 <> 1 & k+2 <> 2;
A9:     0+1 <= k by NAT_1:13;
        then consider p2 being monic INT -valued Polynomial of F_Real
        such that
A10:    eval(p2,e) = 2*cos(k*t) and
A11:    deg p2 = k by A6;
        consider p1 being monic INT -valued Polynomial of F_Real
        such that
A12:    eval(p1,e) = 2*cos((k+1)*t) and
A13:    deg p1 = k+1 by A7,A9,NAT_1:13;
        set f = <%0.F_Real,1.F_Real%>;
        set p = f*'p1 - p2;
        p1 is non-zero; then
A14:    len(f*'p1) = len p1 + 1 by UPROOTS:38; then
A15:    deg(f*'p1) > deg p2 by A11,A13,XREAL_1:8;
        then reconsider p as monic INT -valued Polynomial of F_Real by Th46;
        take p;
A16:    eval(f*'p1,e) = eval(f,e) * eval(p1,e) by POLYNOM4:24;
        cos((k+2)*t) + cos(k*t)
        = 2*(cos((((k+2)*t)+(k*t))/2)*cos((((k+2)*t)-(k*t))/2))
        by SIN_COS4:17
        .= cos t*(2*cos(k*t+t));
        then 2*cos t*(2*cos(k*t+t)) - (2*cos(k*t)) = 2*cos((k+2)*t);
        hence 2*cos((k+2)*t) = eval(f*'p1,e) - eval(p2,e)
        by A2,A10,A12,A16,POLYNOM5:48
        .= eval(p,e) by POLYNOM4:21;
        thus deg p = k+2 by A13,A14,A15,Th41;
        thus thesis by A8;
      end;
    end;
    for k being non zero Nat holds P[k] from FIB_NUM2:sch 1(A3,A4,A5);
    hence thesis by A1;
  end;
