reserve p,q for Rational;
reserve g,m,m1,m2,n,n1,n2 for Nat;
reserve i,i1,i2,j,j1,j2 for Integer;
reserve R for Ring, F for Field;

theorem Th81:
for R being Ring,
    n being non negative Element of INT.Ring
holds Char R = n iff ker(canHom_Int R) = {n}-Ideal
proof
let R be Ring,
    n be non negative Element of INT.Ring;
set f = canHom_Int R;
reconsider k = n as Integer;
A1: now assume A2: Char R = n;
     reconsider k as Nat;
   per cases;
   suppose A3: k = 0;
     then A4: {n}-Ideal = {0.I} by IDEAL_1:47;
     now let x1,x2 be object;
       assume A5: x1 in the carrier of I &
                   x2 in the carrier of I & f.x1 = f.x2;
       then reconsider y1=x1,y2=x2 as Integer;
       y1 '*' 1.R = f.y1 by A5,Def8 .= y2 '*' 1.R by A5,Def8;
       then A6: 0.R = y1 '*' 1.R - y2 '*' 1.R by RLVECT_1:15
                  .= (y1 - y2) '*' 1.R by Th63;
       now assume y1 - y2 <> 0;
         then A7: y1 <> y2;
         ex n being positive Nat st n '*' 1.R = 0.R
           proof
           per cases by A7,XREAL_1:55;
           suppose y1 - y2 > 0;
             hence thesis by A6;
             end;
           suppose A8: 0 < y2 - y1;
             (y2-y1) '*' 1.R = (0-(y1-y2)) '*' 1.R
                            .= -((y1 - y2) '*' 1.R) by Th62
                            .= 0.R by A6;
             hence thesis by A8;
             end;
           end;
         hence contradiction by Def5,A2,A3;
         end;
       hence x1 = x2;
       end;
     then f is one-to-one by FUNCT_2:19;
     hence ker(canHom_Int R) = {n}-Ideal by A4,RING_2:12;
     end;
   suppose A9: k > 0;
     A10: now let x be object;
        assume x in {n}-Ideal;
        then x in the set of all n*r where r is Element of I by IDEAL_1:64;
        then consider r being Element of I such that A11: x = n * r;
        f.x = f.n * f.r by A11,GROUP_6:def 6
           .= (n'*'1.R) * f.r by Def8
           .= 0.R * f.r by A2,Def5,A9
           .= 0.R;
        hence x in ker(canHom_Int R) by A11;
        end;
     now let x be object;
        assume x in ker(canHom_Int R);
        then consider y being Element of I such that
        A12: y = x & f.y = 0.R;
        reconsider d = y div n, r = y mod n as Element of I;
        A13: y mod n < n by A9,INT_1:58;
        A14: y = d * n + r by A9,INT_1:59;
        (y mod n) in NAT by INT_1:3,INT_1:57;
        then reconsider rr = y mod n as Nat;
        0.R = f.(d * n) + f.r by A12,A14,VECTSP_1:def 20
           .= f.d * f.n + f.r by GROUP_6:def 6
           .= f.d * (n'*'1.R) + f.r by Def8
           .= (f.d * 0.R) + f.r by Def5,A9,A2
           .= (y mod n) '*' 1.R by Def8;
        then rr = 0 by A13,Def5,A2;
        then y in the set of all n*a where a is Element of I by A14;
        hence x in {n}-Ideal by A12,IDEAL_1:64;
        end;
     hence ker(canHom_Int R) = {n}-Ideal by A10,TARSKI:2;
     end;
   end;
now assume A15: ker(canHom_Int R) = {n}-Ideal;
  per cases;
  suppose A16: n = 0;
     then ker(canHom_Int R) = {0.I} by A15,IDEAL_1:47;
     then A17: canHom_Int R is monomorphism by RING_2:12;
     now assume ex n being positive Nat st n '*' 1.R = 0.R;
       then consider k being positive Nat such that
       A18: k '*' 1.R = 0.R;
       reconsider kk = k as Element of I by INT_1:def 2;
       f.kk = 0.R by A18,Def8 .= f.(0.I) by RING_2:6;
       hence contradiction by A17,FUNCT_2:19;
       end;
     hence Char R = n by A16,Def5;
     end;
  suppose A19: n <> 0;
      reconsider l = n as positive Nat by A19;
      n in ker(canHom_Int R) by A15,IDEAL_1:66;
      then consider y being Element of I such that
      A20: y = n & f.y = 0.R;
      f.n = n '*' 1.R by Def8;
      then A21: n in CharSet R by A19,A20;
      now let x be Nat;
        assume x in CharSet R;
        then consider m being positive Nat such that
        A22: x = m & m '*' 1.R = 0.R;
        reconsider a = m as Element of I by INT_1:def 2;
        f.a = 0.R by A22,Def8;
        then a in {n}-Ideal by A15;
        then a in the set of all n*r where r is Element of I by IDEAL_1:64;
        then consider q being Element of I such that A23: a = n * q;
        reconsider qq = q as Integer;
        now assume n > a;
          then l/l > (l * qq)/l by A23,XREAL_1:74;
          then 1 > qq * (l/l) by XCMPLX_1:60;
          then 1 > qq * 1 by XCMPLX_1:60;
          then qq + 1 <= 1 by INT_1:7;
          then (qq + 1) - 1 <= 1 - 1 by XREAL_1:13;
          hence contradiction by A23;
          end;
        hence n <= x by A22;
        end;
      then n = min*(CharSet R) by A21,NAT_1:def 1;
      hence Char R = n by Th79;
      end;
    end;
hence thesis by A1;
end;
