reserve i1 for Element of INT;
reserve j1,j2,j3 for Integer;
reserve p,s,k,n for Nat;
reserve x,y,xp,yp for set;
reserve G for Group;
reserve a,b for Element of G;
reserve F for FinSequence of G;
reserve I for FinSequence of INT;

theorem Th7:
  for G being finite Group, a being Element of G holds ord a = card gr {a}
proof
  let G be finite Group, a be Element of G;
  deffunc F(Nat) = a|^$1;
  consider F being FinSequence such that
A1: len F = ord a and
A2: for p be Nat st p in dom F holds F.p = F(p) from FINSEQ_1:sch 2;
A3: dom F = Seg ord a by A1,FINSEQ_1:def 3;
A4: for y st y in rng F holds ex n st y=a|^n
  proof
    let y;
    assume y in rng F;
    then consider x being object such that
A5: x in dom F and
A6: F.x=y by FUNCT_1:def 3;
    reconsider n=x as Element of NAT by A5;
    take n;
    thus thesis by A2,A5,A6;
  end;
  for x being object st x in rng F holds x in the carrier of gr {a}
  proof
    let y be object;
    assume y in rng F;
    then ex n st y= a|^n by A4;
    then y in gr {a} by Th5;
    hence thesis;
  end;
  then
A7: rng F c= the carrier of gr {a};
  a is not being_of_order_0 by Th6;
  then
A8: ord a <> 0 by GROUP_1:def 11;
A9: ex x st x in dom F & F.x=a
  proof
    set x9=1;
    (ord a)+x9 > 0+x9 by A8,XREAL_1:6;
    then (ord a) >= x9 by NAT_1:13;
    then
A10: x9 in dom F by A3;
    then F.x9=a|^x9 by A2
      .=a by GROUP_1:26;
    hence thesis by A10;
  end;
  then
A11: a in rng F by FUNCT_1:def 3;
  the carrier of gr {a} c= rng F
  proof
    ex H being strict Subgroup of G st the carrier of H = rng F
    proof
      reconsider car=rng F as non empty set by A9,FUNCT_1:def 3;
      the carrier of gr {a} c= the carrier of G by GROUP_2:def 5;
      then
A12:  car c= the carrier of G by A7;
      dom(the multF of G)= [:the carrier of G,the carrier of G:] by
FUNCT_2:def 1;
      then
A13:  dom((the multF of G)||car)=[:car,car:] by A12,RELAT_1:62,ZFMISC_1:96;
      for y being object st y in rng((the multF of G)||car) holds y in car
      proof
        let y be object;
        set f=(the multF of G)||car;
        assume y in rng(f);
        then consider x being object such that
A14:    x in dom(f) and
A15:    f.x=y by FUNCT_1:def 3;
        consider xp,yp being object such that
A16:    [xp,yp]=x by A13,A14,RELAT_1:def 1;
        yp in car by A13,A14,A16,ZFMISC_1:87;
        then consider s such that
A17:    yp = a|^s by A4;
        xp in car by A13,A14,A16,ZFMISC_1:87;
        then consider p such that
A18:    xp = a|^p by A4;
A19:    ex x st x in dom F & F.x=a|^(p+s)
        proof
          set t=(p+s) mod (ord a);
A20:      t < ord a by A8,NAT_D:1;
          per cases;
          suppose
A21:        t=0;
            take ord a;
            a |^(p+s)=a|^((ord a)*((p+s) div (ord a)) + ((p+s) mod (ord a
            ))) by A8,NAT_D:2
              .=a|^((ord a)*((p+s) div (ord a)))*(a|^ ((p+s) mod (ord a)))
            by GROUP_1:33
              .=a|^(ord a)|^((p+s) div (ord a))*(a|^ ((p+s) mod (ord a))) by
GROUP_1:35
              .=(1_G)|^((p+s) div (ord a))*(a|^ ((p+s) mod (ord a))) by
GROUP_1:41
              .=(1_G) *(a|^ ((p+s) mod (ord a))) by GROUP_1:31
              .=a|^0 by A21,GROUP_1:def 4
              .= 1_G by GROUP_1:25
              .= a|^(ord a) by GROUP_1:41
              .= F.ord a by A2,A3,A8,FINSEQ_1:3;
            hence thesis by A3,A8,FINSEQ_1:3;
          end;
          suppose
            t>0;
            then t+1 > 0+1 by XREAL_1:6;
            then t >= 1 by NAT_1:13;
            then
A22:        t in dom F by A3,A20;
            take t;
            a|^(p+s)=a|^((ord a)*((p+s) div (ord a)) + ((p+s) mod (ord a)
            )) by A8,NAT_D:2
              .=a|^((ord a)*((p+s) div (ord a))) *(a|^ ((p+s) mod (ord a)))
            by GROUP_1:33
              .=a|^(ord a)|^((p+s) div (ord a)) *(a|^ ((p+s) mod (ord a)))
            by GROUP_1:35
              .=(1_G)|^((p+s) div (ord a)) *(a|^ ((p+s) mod (ord a))) by
GROUP_1:41
              .=(1_G) *(a|^ ((p+s) mod (ord a))) by GROUP_1:31
              .=a|^ ((p+s) mod (ord a)) by GROUP_1:def 4;
            hence thesis by A2,A22;
          end;
        end;
        y = a|^p*(a|^s) by A14,A15,A16,A18,A17,FUNCT_1:47
          .= a|^(p+s) by GROUP_1:33;
        hence thesis by A19,FUNCT_1:def 3;
      end;
      then rng((the multF of G)||car) c= car;
      then reconsider op=(the multF of G)||car as BinOp of car by A13,
FUNCT_2:def 1,RELSET_1:4;
      set H=multMagma(#car,op#);
A23:  for f,g being Element of H, f9,g9 being Element of G st f = f9 & g
      = g9 holds f9*g9 = f*g
      proof
        let f,g be Element of H;
        let f9,g9 be Element of G;
A24:    f*g = ((the multF of G)||car).[f,g];
        assume f = f9 & g =g9;
        hence thesis by A24,FUNCT_1:49;
      end;
A25:  ex e being Element of H st for h being Element of H holds h * e = h
      & e * h = h & ex g being Element of H st h * g = e & g * h = e
      proof
        ex x st x in dom F & F.x=a|^(ord a)
        proof
          set x9=(ord a);
          F.x9=a|^x9 by A2,A3,A8,FINSEQ_1:3;
          hence thesis by A3,A8,FINSEQ_1:3;
        end;
        then a|^(ord a) in car by FUNCT_1:def 3;
        then reconsider e=1_G as Element of H by GROUP_1:41;
        take e;
        for h being Element of H holds h * e = h & e * h = h & ex g being
        Element of H st h * g = e & g * h = e
        proof
          let h be Element of H;
          reconsider h9=h as Element of G by A12;
          h*e = h9 *(1_G) by A23
            .= h9 by GROUP_1:def 4;
          hence h * e = h;
          e*h = (1_G)*h9 by A23
            .= h9 by GROUP_1:def 4;
          hence e * h = h;
          thus ex g being Element of H st h * g = e & g * h = e
          proof
            ex n st h=a|^n & 1 <= n & ord a >= n
            proof
              consider x being object such that
A26:          x in dom F and
A27:          F.x=h by FUNCT_1:def 3;
              reconsider n=x as Element of NAT by A26;
              take n;
              thus thesis by A2,A3,A26,A27,FINSEQ_1:1;
            end;
            then consider n such that
A28:        h=a|^n and
A29:        ord a >= n;
            ex x st x in dom F & F.x =a|^(ord a - n)
            proof
              per cases by A29,XXREAL_0:1;
              suppose
A30:            ord a = n;
                set x = ord a;
                F.x=a|^x by A2,A3,A8,FINSEQ_1:3
                  .= 1_G by GROUP_1:41
                  .= a|^(ord a - n) by A30,GROUP_1:25;
                hence thesis by A3,A8,FINSEQ_1:3;
              end;
              suppose
A31:            ord a > n;
                then reconsider x = ord a - n as Element of NAT by INT_1:5;
                take x;
                x in Seg ord a
                proof
                  set r1 = ord a;
                  r1 <= r1 + n by NAT_1:11;
                  then
A32:              x <= r1 by XREAL_1:20;
                  r1 - n > n -n by A31,XREAL_1:9;
                  then x >= 0 +1 by NAT_1:13;
                  hence thesis by A32;
                end;
                hence thesis by A2,A3;
              end;
            end;
            then reconsider g =a|^(ord a - n) as Element of H by FUNCT_1:def 3;
A33:        n+(ord a-n) =ord a;
A34:        g * h =a|^(ord a - n) * (a|^n) by A23,A28
              .=a|^(ord a) by A33,GROUP_1:33
              .= e by GROUP_1:41;
            h * g =a|^n *(a|^(ord a - n)) by A23,A28
              .=a|^(ord a) by A33,GROUP_1:33
              .= e by GROUP_1:41;
            hence thesis by A34;
          end;
        end;
        hence thesis;
      end;
      for f,g,h being Element of H holds (f * g) * h = f * (g * h)
      proof
        let f,g,h be Element of H;
        reconsider f9=f,g9=g,h9=h as Element of G by A12;
A35:    g * h = g9 * h9 by A23;
        f9*g9 = f*g by A23;
        then (f*g)*h =(f9*g9)*h9 by A23
          .= f9*(g9*h9) by GROUP_1:def 3
          .=f*(g*h) by A23,A35;
        hence thesis;
      end;
      then reconsider H1=H as Group by A25,GROUP_1:1;
      the carrier of gr {a} c= the carrier of G by GROUP_2:def 5;
      then the carrier of H1 c= the carrier of G by A7;
      then H1 is Subgroup of G by GROUP_2:def 5;
      hence thesis;
    end;
    then consider H being strict Subgroup of G such that
A36: the carrier of H = rng F;
    {a} c= the carrier of H by A11,A36,ZFMISC_1:31;
    then gr {a} is Subgroup of H by GROUP_4:def 4;
    hence thesis by A36,GROUP_2:def 5;
  end;
  then
A37: rng F = the carrier of gr {a} by A7,XBOOLE_0:def 10;
  reconsider So = Seg ord a as finite set;
  set ca = the carrier of gr {a};
  F is one-to-one
  proof
    let x,y be object;
    assume that
A38: x in dom F and
A39: y in dom F and
A40: F.x = F.y and
A41: x<>y;
    reconsider s=y as Element of NAT by A39;
    reconsider p=x as Element of NAT by A38;
A42: F.p=a|^p & F.s=a|^s by A2,A38,A39;
    reconsider s9=s,p9=p,z= ord a as Real;
    per cases;
    suppose
      p<=s;
      then reconsider r1=s-p as Element of NAT by INT_1:5;
      p >0 by A3,A38,FINSEQ_1:1;
      then
A43:  z<z+p9 by XREAL_1:29;
      s9<=z by A3,A39,FINSEQ_1:1;
      then s9<z+p9 by A43,XXREAL_0:2;
      then
A44:  s9-p9<z+p9-p9 by XREAL_1:9;
      1_G=a|^s*(a|^p)" by A40,A42,GROUP_1:def 5;
      then a|^0=a|^s*(a|^p)" by GROUP_1:25;
      then a|^0=a|^s*(a|^(-p)) by GROUP_1:36;
      then a|^0=a|^(s+(-p)) by GROUP_1:33;
      then
A45:  1_G=a|^r1 by GROUP_1:25;
      r1 <> 0 & a is not being_of_order_0 by A41,Th6;
      hence thesis by A45,A44,GROUP_1:def 11;
    end;
    suppose
      s<=p;
      then reconsider r2=p-s as Element of NAT by INT_1:5;
      s >0 by A3,A39,FINSEQ_1:1;
      then
A46:  z<z+s9 by XREAL_1:29;
      p9<=z by A3,A38,FINSEQ_1:1;
      then p9<z+s9 by A46,XXREAL_0:2;
      then
A47:  p9-s9<z+s9-s9 by XREAL_1:9;
      1_G=a|^p*(a|^s)" by A40,A42,GROUP_1:def 5;
      then a|^0=a|^p*(a|^s)" by GROUP_1:25;
      then a|^0=a|^p*(a|^(-s)) by GROUP_1:36;
      then a|^0=a|^(p+(-s)) by GROUP_1:33;
      then
A48:  1_G=a|^r2 by GROUP_1:25;
      r2 <> 0 & a is not being_of_order_0 by A41,Th6;
      hence thesis by A48,A47,GROUP_1:def 11;
    end;
  end;
  then Seg ord a,the carrier of gr {a} are_equipotent by A3,A37,WELLORD2:def 4;
  then card So = card ca by CARD_1:5;
  hence thesis by FINSEQ_1:57;
end;
