Article INT_3, MML version 4.99.1005

:: INT_3:funcnot 1 => BINOP_2:func 46
definition
  func multint -> Function-like quasi_total Relation of [:INT,INT:],INT means
    for b1, b2 being Element of INT holds
    it .(b1,b2) = multreal .(b1,b2);
end;

:: INT_3:def 1
theorem
for b1 being Function-like quasi_total Relation of [:INT,INT:],INT holds
      b1 = multint
   iff
      for b2, b3 being Element of INT holds
      b1 .(b2,b3) = multreal .(b2,b3);

:: INT_3:funcnot 2 => BINOP_2:func 43
definition
  func compint -> Function-like quasi_total Relation of INT,INT means
    for b1 being Element of INT holds
       it . b1 = compreal . b1;
end;

:: INT_3:def 2
theorem
for b1 being Function-like quasi_total Relation of INT,INT holds
      b1 = compint
   iff
      for b2 being Element of INT holds
         b1 . b2 = compreal . b2;

:: INT_3:funcnot 3 => INT_3:func 1
definition
  func INT.Ring -> doubleLoopStr equals
    doubleLoopStr(#INT,addint,multint,In(1,INT),In(0,INT)#);
end;

:: INT_3:def 3
theorem
INT.Ring = doubleLoopStr(#INT,addint,multint,In(1,INT),In(0,INT)#);

:: INT_3:funcreg 1
registration
  cluster INT.Ring -> non empty strict;
end;

:: INT_3:condreg 1
registration
  cluster -> integer (Element of the carrier of INT.Ring);
end;

:: INT_3:funcreg 2
registration
  cluster INT.Ring -> well-unital;
end;

:: INT_3:funcreg 3
registration
  cluster INT.Ring -> non degenerated right_complementable associative commutative distributive Abelian add-associative right_zeroed domRing-like;
end;

:: INT_3:funcnot 4 => INT_3:func 2
definition
  let a1 be Element of the carrier of INT.Ring;
  redefine func abs A1 -> Element of the carrier of INT.Ring equals
    a1
    if 0. INT.Ring <= a1
    otherwise - a1;
  projectivity;
::  for a1 being Element of the carrier of INT.Ring holds
::     abs abs a1 = abs a1;
end;

:: INT_3:def 5
theorem
for b1 being Element of the carrier of INT.Ring holds
   (0. INT.Ring <= b1 implies abs b1 = b1) &
    (0. INT.Ring <= b1 or abs b1 = - b1);

:: INT_3:funcnot 5 => INT_3:func 3
definition
  func absint -> Function-like quasi_total Relation of the carrier of INT.Ring,NAT means
    for b1 being Element of the carrier of INT.Ring holds
       it . b1 = absreal . b1;
end;

:: INT_3:def 6
theorem
for b1 being Function-like quasi_total Relation of the carrier of INT.Ring,NAT holds
      b1 = absint
   iff
      for b2 being Element of the carrier of INT.Ring holds
         b1 . b2 = absreal . b2;

:: INT_3:th 1
theorem
for b1 being Element of the carrier of INT.Ring holds
   absint . b1 = abs b1;

:: INT_3:th 2
theorem
for b1, b2, b3, b4, b5, b6 being Element of the carrier of INT.Ring
      st b2 <> 0. INT.Ring & b1 = (b3 * b2) + b5 & 0. INT.Ring <= b5 & b5 < abs b2 & b1 = (b4 * b2) + b6 & 0. INT.Ring <= b6 & b6 < abs b2
   holds b3 = b4 & b5 = b6;

:: INT_3:funcnot 6 => INT_3:func 4
definition
  let a1, a2 be Element of the carrier of INT.Ring;
  assume a2 <> 0. INT.Ring;
  func A1 div A2 -> Element of the carrier of INT.Ring means
    ex b1 being Element of the carrier of INT.Ring st
       a1 = (it * a2) + b1 & 0. INT.Ring <= b1 & b1 < abs a2;
end;

:: INT_3:def 7
theorem
for b1, b2 being Element of the carrier of INT.Ring
   st b2 <> 0. INT.Ring
for b3 being Element of the carrier of INT.Ring holds
      b3 = b1 div b2
   iff
      ex b4 being Element of the carrier of INT.Ring st
         b1 = (b3 * b2) + b4 & 0. INT.Ring <= b4 & b4 < abs b2;

:: INT_3:funcnot 7 => INT_3:func 5
definition
  let a1, a2 be Element of the carrier of INT.Ring;
  assume a2 <> 0. INT.Ring;
  func A1 mod A2 -> Element of the carrier of INT.Ring means
    ex b1 being Element of the carrier of INT.Ring st
       a1 = (b1 * a2) + it & 0. INT.Ring <= it & it < abs a2;
end;

:: INT_3:def 8
theorem
for b1, b2 being Element of the carrier of INT.Ring
   st b2 <> 0. INT.Ring
for b3 being Element of the carrier of INT.Ring holds
      b3 = b1 mod b2
   iff
      ex b4 being Element of the carrier of INT.Ring st
         b1 = (b4 * b2) + b3 & 0. INT.Ring <= b3 & b3 < abs b2;

:: INT_3:th 3
theorem
for b1, b2 being Element of the carrier of INT.Ring
      st b2 <> 0. INT.Ring
   holds b1 = ((b1 div b2) * b2) + (b1 mod b2);

:: INT_3:attrnot 1 => INT_3:attr 1
definition
  let a1 be non empty doubleLoopStr;
  attr a1 is Euclidian means
    ex b1 being Function-like quasi_total Relation of the carrier of a1,NAT st
       for b2, b3 being Element of the carrier of a1
             st b3 <> 0. a1
          holds ex b4, b5 being Element of the carrier of a1 st
             b2 = (b4 * b3) + b5 &
              (b5 <> 0. a1 implies b1 . b5 < b1 . b3);
end;

:: INT_3:dfs 8
definiens
  let a1 be non empty doubleLoopStr;
To prove
     a1 is Euclidian
it is sufficient to prove
  thus ex b1 being Function-like quasi_total Relation of the carrier of a1,NAT st
       for b2, b3 being Element of the carrier of a1
             st b3 <> 0. a1
          holds ex b4, b5 being Element of the carrier of a1 st
             b2 = (b4 * b3) + b5 &
              (b5 <> 0. a1 implies b1 . b5 < b1 . b3);

:: INT_3:def 9
theorem
for b1 being non empty doubleLoopStr holds
      b1 is Euclidian
   iff
      ex b2 being Function-like quasi_total Relation of the carrier of b1,NAT st
         for b3, b4 being Element of the carrier of b1
               st b4 <> 0. b1
            holds ex b5, b6 being Element of the carrier of b1 st
               b3 = (b5 * b4) + b6 &
                (b6 <> 0. b1 implies b2 . b6 < b2 . b4);

:: INT_3:funcreg 4
registration
  cluster INT.Ring -> Euclidian;
end;

:: INT_3:exreg 1
registration
  cluster non empty non degenerated right_complementable strict unital associative commutative right-distributive left-distributive right_unital well-unital distributive left_unital Abelian add-associative right_zeroed domRing-like Euclidian doubleLoopStr;
end;

:: INT_3:modenot 1
definition
  mode EuclidianRing is non empty non degenerated right_complementable associative commutative well-unital distributive Abelian add-associative right_zeroed domRing-like Euclidian doubleLoopStr;
end;

:: INT_3:exreg 2
registration
  cluster non empty non degenerated non trivial right_complementable strict unital associative commutative right-distributive left-distributive right_unital well-unital distributive left_unital Abelian add-associative right_zeroed domRing-like Euclidian doubleLoopStr;
end;

:: INT_3:modenot 2 => INT_3:mode 1
definition
  let a1 be non empty Euclidian doubleLoopStr;
  mode DegreeFunction of A1 -> Function-like quasi_total Relation of the carrier of a1,NAT means
    for b1, b2 being Element of the carrier of a1
          st b2 <> 0. a1
       holds ex b3, b4 being Element of the carrier of a1 st
          b1 = (b3 * b2) + b4 &
           (b4 <> 0. a1 implies it . b4 < it . b2);
end;

:: INT_3:dfs 9
definiens
  let a1 be non empty Euclidian doubleLoopStr;
  let a2 be Function-like quasi_total Relation of the carrier of a1,NAT;
To prove
     a2 is DegreeFunction of a1
it is sufficient to prove
  thus for b1, b2 being Element of the carrier of a1
          st b2 <> 0. a1
       holds ex b3, b4 being Element of the carrier of a1 st
          b1 = (b3 * b2) + b4 &
           (b4 <> 0. a1 implies a2 . b4 < a2 . b2);

:: INT_3:def 10
theorem
for b1 being non empty Euclidian doubleLoopStr
for b2 being Function-like quasi_total Relation of the carrier of b1,NAT holds
      b2 is DegreeFunction of b1
   iff
      for b3, b4 being Element of the carrier of b1
            st b4 <> 0. b1
         holds ex b5, b6 being Element of the carrier of b1 st
            b3 = (b5 * b4) + b6 &
             (b6 <> 0. b1 implies b2 . b6 < b2 . b4);

:: INT_3:th 4
theorem
for b1 being non empty non degenerated right_complementable associative commutative well-unital distributive Abelian add-associative right_zeroed domRing-like Euclidian doubleLoopStr holds
   b1 is non empty non degenerated right_complementable associative commutative well-unital distributive Abelian add-associative right_zeroed domRing-like gcd-like doubleLoopStr;

:: INT_3:condreg 2
registration
  cluster non empty non degenerated right_complementable associative commutative right-distributive well-unital Abelian add-associative right_zeroed domRing-like Euclidian -> gcd-like (doubleLoopStr);
end;

:: INT_3:funcnot 8 => INT_3:func 6
definition
  redefine func absint -> DegreeFunction of INT.Ring;
end;

:: INT_3:th 5
theorem
for b1 being non empty almost_left_invertible associative commutative well-unital right_zeroed doubleLoopStr holds
   b1 is Euclidian;

:: INT_3:condreg 3
registration
  cluster non empty almost_left_invertible associative commutative well-unital right_zeroed -> Euclidian (doubleLoopStr);
end;

:: INT_3:th 6
theorem
for b1 being non empty almost_left_invertible associative commutative well-unital right_zeroed doubleLoopStr
for b2 being Function-like quasi_total Relation of the carrier of b1,NAT holds
   b2 is DegreeFunction of b1;

:: INT_3:th 8
theorem
for b1, b2, b3 being integer set holds
(b1 = 0 or (b2 + (b1 * b3)) div b1 = (b2 div b1) + b3) &
 (b2 + (b1 * b3)) mod b1 = b2 mod b1;

:: INT_3:th 9
theorem
for b1 being natural set
   st 0 < b1
for b2 being integer set holds
   0 <= b2 mod b1 & b2 mod b1 < b1;

:: INT_3:th 10
theorem
for b1, b2 being integer set holds
(0 <= b2 & b2 < b1 implies b2 mod b1 = b2) &
 (b2 < 0 & - b1 <= b2 implies b2 mod b1 = b1 + b2);

:: INT_3:th 12
theorem
for b1, b2, b3 being integer set holds
(b1 <> 0 & b2 mod b1 = b3 mod b1 implies b2,b3 are_congruent_mod b1) &
 (b2,b3 are_congruent_mod b1 implies b2 mod b1 = b3 mod b1);

:: INT_3:th 13
theorem
for b1 being natural set
for b2 being integer set holds
   (b2 mod b1) mod b1 = b2 mod b1;

:: INT_3:th 14
theorem
for b1, b2, b3 being integer set holds
(b2 + b3) mod b1 = ((b2 mod b1) + (b3 mod b1)) mod b1;

:: INT_3:th 15
theorem
for b1, b2, b3 being integer set holds
(b2 * b3) mod b1 = ((b2 mod b1) * (b3 mod b1)) mod b1;

:: INT_3:th 16
theorem
for b1, b2 being integer set holds
ex b3, b4 being integer set st
   b1 gcd b2 = (b3 * b1) + (b4 * b2);

:: INT_3:funcnot 9 => INT_3:func 7
definition
  let a1 be natural set;
  assume 0 < a1;
  func multint A1 -> Function-like quasi_total Relation of [:Segm a1,Segm a1:],Segm a1 means
    for b1, b2 being Element of Segm a1 holds
    it .(b1,b2) = (b1 * b2) mod a1;
end;

:: INT_3:def 11
theorem
for b1 being natural set
   st 0 < b1
for b2 being Function-like quasi_total Relation of [:Segm b1,Segm b1:],Segm b1 holds
      b2 = multint b1
   iff
      for b3, b4 being Element of Segm b1 holds
      b2 .(b3,b4) = (b3 * b4) mod b1;

:: INT_3:funcnot 10 => INT_3:func 8
definition
  let a1 be natural set;
  assume 0 < a1;
  func compint A1 -> Function-like quasi_total Relation of Segm a1,Segm a1 means
    for b1 being Element of Segm a1 holds
       it . b1 = (a1 - b1) mod a1;
end;

:: INT_3:def 12
theorem
for b1 being natural set
   st 0 < b1
for b2 being Function-like quasi_total Relation of Segm b1,Segm b1 holds
      b2 = compint b1
   iff
      for b3 being Element of Segm b1 holds
         b2 . b3 = (b1 - b3) mod b1;

:: INT_3:th 17
theorem
for b1 being natural set
   st 0 < b1
for b2, b3 being Element of Segm b1 holds
(b1 <= b2 + b3 or (addint b1) .(b2,b3) = b2 + b3) &
 ((addint b1) .(b2,b3) = b2 + b3 implies b2 + b3 < b1) &
 (b1 <= b2 + b3 implies (addint b1) .(b2,b3) = (b2 + b3) - b1) &
 ((addint b1) .(b2,b3) = (b2 + b3) - b1 implies b1 <= b2 + b3);

:: INT_3:th 18
theorem
for b1 being natural set
   st 0 < b1
for b2, b3 being Element of Segm b1
for b4 being natural set holds
      b4 * b1 <= b2 * b3 & b2 * b3 < (b4 + 1) * b1
   iff
      (multint b1) .(b2,b3) = (b2 * b3) - (b4 * b1);

:: INT_3:th 19
theorem
for b1 being natural set
   st 0 < b1
for b2 being Element of Segm b1 holds
   (b2 = 0 implies (compint b1) . b2 = 0) &
    ((compint b1) . b2 = 0 implies b2 = 0) &
    (b2 = 0 or (compint b1) . b2 = b1 - b2) &
    ((compint b1) . b2 = b1 - b2 implies b2 <> 0);

:: INT_3:funcnot 11 => INT_3:func 9
definition
  let a1 be natural set;
  func INT.Ring A1 -> doubleLoopStr equals
    doubleLoopStr(#Segm a1,addint a1,multint a1,In(1,Segm a1),In(0,Segm a1)#);
end;

:: INT_3:def 13
theorem
for b1 being natural set holds
   INT.Ring b1 = doubleLoopStr(#Segm b1,addint b1,multint b1,In(1,Segm b1),In(0,Segm b1)#);

:: INT_3:funcreg 5
registration
  let a1 be non empty natural set;
  cluster INT.Ring a1 -> non empty strict;
end;

:: INT_3:th 20
theorem
INT.Ring 1 is degenerated &
 INT.Ring 1 is non empty right_complementable associative well-unital distributive Abelian add-associative right_zeroed doubleLoopStr &
 INT.Ring 1 is almost_left_invertible &
 INT.Ring 1 is unital &
 INT.Ring 1 is distributive &
 INT.Ring 1 is commutative;

:: INT_3:exreg 3
registration
  cluster non empty degenerated right_complementable almost_left_invertible strict unital associative commutative right-distributive left-distributive right_unital well-unital distributive left_unital Abelian add-associative right_zeroed doubleLoopStr;
end;

:: INT_3:th 21
theorem
for b1 being natural set
      st 1 < b1
   holds INT.Ring b1 is not degenerated &
    INT.Ring b1 is non empty right_complementable associative commutative well-unital distributive Abelian add-associative right_zeroed doubleLoopStr;

:: INT_3:th 22
theorem
for b1 being natural set
      st 1 < b1
   holds    INT.Ring b1 is non empty non degenerated right_complementable almost_left_invertible associative commutative well-unital distributive Abelian add-associative right_zeroed doubleLoopStr
   iff
      b1 is natural prime set;

:: INT_3:condreg 4
registration
  cluster natural prime -> non empty (set);
end;

:: INT_3:funcreg 6
registration
  let a1 be natural prime set;
  cluster INT.Ring a1 -> non degenerated right_complementable almost_left_invertible associative commutative well-unital distributive Abelian add-associative right_zeroed;
end;

:: INT_3:th 23
theorem
1. INT.Ring = 1;

:: INT_3:th 24
theorem
for b1 being natural set
      st 1 < b1
   holds 1. INT.Ring b1 = 1;