reserve x,y for object, X for set;

theorem
  for p be Prime holds Z/Z*(p) is cyclic Group
proof
  let p be Prime;
  set a = the Element of Z/Z*(p);
  set ZP=Z/Z*(p);
  defpred P[Nat,Element of ZP,Element of ZP] means ord $2 < ord $3;
  assume
A1: not Z/Z*(p) is cyclic Group;
A2: for x be Element of Z/Z*(p) holds ord x < card (Z/Z*(p))
  proof
    let x be Element of Z/Z*(p);
A3: ord x <= card (Z/Z*(p)) by GR_CY_1:8,NAT_D:7;
    ord x <> card (Z/Z*(p)) by A1,GR_CY_1:19;
    hence thesis by A3,XXREAL_0:1;
  end;
A4: for n being Nat for x being Element of ZP ex y being Element
  of ZP st P[n,x,y]
  proof
    let n being Nat, x being Element of ZP;
    set n=ord x;
    n < card Z/Z*(p) by A2;
    then
A5: card gr {x} <> card Z/Z*(p) by GR_CY_1:7;
    the carrier of (gr {x}) c= the carrier of Z/Z*(p) by GROUP_2:def 5;
    then the carrier of (gr {x}) c< the carrier of Z/Z*(p) by A5,XBOOLE_0:def 8
;
    then (the carrier of Z/Z*(p)) \ (the carrier of (gr {x})) <> {} by
XBOOLE_1:105;
    then consider z be object such that
A6: z in (the carrier of Z/Z*(p)) \ (the carrier of (gr {x}))
    by XBOOLE_0:def 1;
    reconsider z as Element of ZP by A6;
    set m=ord z;
    now
        set l= m lcm n;
        1 <=card gr {x} by GROUP_1:45;
        then
A7:    1 <= n by GR_CY_1:7;
        not m divides n
        proof
          assume m divides n;
          then consider j be Integer such that
A8:      n=m* j by INT_1:def 3;
          z |^n =(z |^m) |^j by A8,GROUP_1:35
            .= (1_(Z/Z*(p))) |^j by GROUP_1:41
            .= 1_(Z/Z*(p)) by GROUP_1:31
            .= 1 by Th21;
          then z is Element of gr {x} by A7,Th29;
          hence contradiction by A6,XBOOLE_0:def 5;
        end;
        then
A9:    n <> l by INT_2:18;
        1 <=card gr {z} by GROUP_1:45;
        then
A10:    1 <= m by GR_CY_1:7;
        then consider m0,n0 be Element of NAT such that
A11:    l=n0*m0 and
A12:    n0 gcd m0 = 1 and
A13:    n0 divides n and
A14:    m0 divides m and
A15:    n0 <> 0 and
A16:    m0 <> 0 by A7,Th17;
        consider j be Integer such that
A17:    n=n0* j by A13,INT_1:def 3;
        consider u be Integer such that
A18:    m=m0* u by A14,INT_1:def 3;
        m/m0 = u by A16,A18,XCMPLX_1:89;
        then reconsider d2=m/m0 as Element of NAT by INT_1:3;
        m=(m/m0)*m0 by A16,XCMPLX_1:87;
        then
A19:    ord (z|^d2) = m0 by Th30;
        n/n0= j by A15,A17,XCMPLX_1:89;
        then reconsider d1=n/n0 as Element of NAT by INT_1:3;
        n divides (m lcm n) by INT_2:18;
        then consider j be Integer such that
A20:    l=n* j by INT_1:def 3;
        take y =(x|^d1)*(z|^d2);
        n=(n/n0)*n0 by A15,XCMPLX_1:87;
        then ord (x|^d1) = n0 by Th30;
        then
A21:    ord y = m0*n0 by A12,A19,Th25;
        l/n = j by A7,A20,XCMPLX_1:89;
        then
A22:    j is Element of NAT by INT_1:3;
        j <> 0 by A7,A10,A20,INT_2:4;
        then n*1 <=n*j by A22,NAT_1:14,XREAL_1:64;
        hence n < ord y by A11,A21,A9,A20,XXREAL_0:1;
    end;
    hence thesis;
  end;
  consider f being sequence of the carrier of ZP such that
A23: f.0 = a & for n being Nat holds P[n,f.n,f.(n+1)] from
  RECDEF_1:sch 2(A4);
  deffunc F(Nat) =ord (f.$1);
  consider g be sequence of NAT such that
A24: for k be Element of NAT holds g.k=F(k) from FUNCT_2:sch 4;
A25: for k be Nat holds g.k=F(k)
   proof let k be Nat;
     k in NAT by ORDINAL1:def 12;
    hence thesis by A24;
   end;
A26: now
    let k be Nat;
A27: g.(k+1) = ord (f.(k+1)) by A25;
    g.k = ord (f.k) by A25;
    hence g.k < g.(k+1) by A23,A27;
  end;
A28: for k,m be Element of NAT holds g.k< g.(k+1+m)
  proof
    let k be Element of NAT;
    defpred P[Nat] means g.k< g.(k+1+$1);
A29: now
      let m be Nat;
      assume
A30:  P[m];
      g.(k+1+m) < g.((k+1+m) + 1) by A26;
      hence P[m+1] by A30,XXREAL_0:2;
    end;
A31: P[ 0 ] by A26;
    for m be Nat holds P[m] from NAT_1:sch 2(A31,A29);
    hence thesis;
  end;
A32: for k,m be Element of NAT st k < m holds g.k< g.m
  proof
    let k,m be Element of NAT;
    assume
A33: k < m;
    then m-k is Element of NAT by INT_1:5;
    then reconsider mk=m-k as Nat;
    m-k <> 0 by A33;
    then consider n0 be Nat such that
A34: mk=n0+1 by NAT_1:6;
    reconsider n=n0 as Element of NAT by ORDINAL1:def 12;
    m=k+1+n by A34;
    hence thesis by A28;
  end;
  now
    let x1,x2 be object;
    assume that
A35: x1 in NAT and
A36: x2 in NAT and
A37: g.x1 = g.x2;
    reconsider xx1=x1,xx2=x2 as Element of NAT by A35,A36;
A38: xx2 <= xx1 by A32,A37;
    xx1 <= xx2 by A32,A37;
    hence x2=x1 by A38,XXREAL_0:1;
  end;
  then g is one-to-one by FUNCT_2:19;
  then dom g,rng g are_equipotent by WELLORD2:def 4;
  then card (dom g) = card (rng g) by CARD_1:5;
  then
A39: card rng g = card NAT by FUNCT_2:def 1;
  rng g c= Segm(card ZP)
  proof
    let y be object;
    assume y in rng g;
    then consider x be object such that
A40: x in NAT and
A41: y=g.x by FUNCT_2:11;
    reconsider x as Element of NAT by A40;
    reconsider gg=g.x as Element of NAT;
    g.x =ord (f.x) by A25;
    then gg < card ZP by A2;
    hence thesis by A41,NAT_1:44;
  end;
  hence contradiction by A39;
end;
