reserve x for set;
reserve i,j for Integer;
reserve n,n1,n2,n3 for Nat;
reserve K,K1,K2,K3 for Field;
reserve SK1,SK2 for Subfield of K;
reserve ek,ek1,ek2 for Element of K;
reserve p for Prime;
reserve a,b,c for Element of GF(p);
reserve F for FinSequence of GF(p);
reserve Px,Py,Pz for Element of GF(p);

theorem Th60:
  for p be Prime, a, b be Element of GF(p)
  st p > 3 & Disc(a,b,p) <> 0.GF(p) holds
  ex F be FinSequence of NAT st len F = p
  & (for n be Nat st n in Seg p
  ex d be Element of GF(p) st d=n-1 & F.n = 1 + Lege_p(d|^3 + a*d + b))
  & card {Class(R_EllCur(a,b,p),P)
  where P is Element of ProjCo(GF(p)): P in EC_SetProjCo(a,b,p) &
  ex X,Y be Element of GF(p) st P=[X,Y,1]} = Sum(F)
  proof
    let p be Prime, a, b be Element of GF(p);
    assume A1: p > 3 & Disc(a,b,p) <> 0.GF(p); then
    consider S be Function such that
A2: dom S =Seg p & (for n be Nat st n in dom S holds
    S.n= {Class(R_EllCur(a,b,p),[(n-1),Y,1])
    where Y is Element of GF(p) :
    [(n-1),Y,1] in EC_SetProjCo(a,b,p) } ) &
    S is disjoint_valued & (for n be Nat st n in dom S holds S.n is finite)
    & Union S = {Class(R_EllCur(a,b,p),P)
    where P is Element of ProjCo(GF(p)): P in EC_SetProjCo(a,b,p) &
    ex X,Y be Element of GF(p) st P=[X,Y,1]} by Lm8;
    defpred P0[Nat,Nat] means $2= card (S.$1);
A3:now let i be Nat;
      assume i in Seg p;
      then S.i is finite by A2; then
      reconsider x = card (S.i) as Element of NAT by ORDINAL1:def 12;
      take x;
      thus P0[i,x];
    end;
    consider L be FinSequence of NAT such that
    A4: dom L= Seg p &
    for i be Nat st i in Seg p holds P0[i,L.i] from FINSEQ_1:sch 5(A3);
    take L;
    p is Element of NAT by ORDINAL1:def 12;
    hence len L = p by A4,FINSEQ_1:def 3;
A5: now let n be Nat;
      assume A6:n in Seg p; then
      1<=n & n<= p by FINSEQ_1:1; then
   A7:1-1 <=n-1 & n-1 <=p-1 by XREAL_1:9; then
  A8: n-1 is Element of NAT by INT_1:3;
      p-1 < p-0 by XREAL_1:15; then
      n-1 < p by A7,XXREAL_0:2; then
      reconsider d=n-1 as Element of GF(p) by A8,NAT_1:44;
      take d;
      thus d=n-1;
      thus L.n = card (S.n) by A4,A6
      .= card ({Class(R_EllCur(a,b,p),[(n-1),Y,1])
      where Y is Element of GF(p) :
      [(n-1),Y,1] in EC_SetProjCo(a,b,p) } ) by A2,A6
      .= card ({Class(R_EllCur(a,b,p),[d,Y,1])
      where Y is Element of GF(p) : [d,Y,1] in EC_SetProjCo(a,b,p) } )
      .= 1 + Lege_p(d|^3 + a*d + b) by Th59,A1;
    end;
    for i be Nat st i in dom S holds
    S.i is finite & L.i = card (S.i) by A2,A4;
    hence thesis by A2,A4,A5,DIST_1:17;
  end;
