reserve x,y,z for Real,
  a,b,c,d,e,f,g,h for Nat,
  k,l,m,n,m1,n1,m2,n2 for Integer,
  q for Rational;
reserve fs,fs1,fs2,fs3 for FinSequence;
reserve D for non empty set,
  v,v1,v2,v3 for object,
  fp for FinSequence of NAT,
  fr,fr1,fr2 for FinSequence of INT,
  ft for FinSequence of REAL;
reserve x,y,t for Integer;
reserve n for Nat;
reserve i1,i2,i3 for Integer;

theorem ::: INT_4:14
  i1,i2 are_congruent_mod i3 implies i1 gcd i3 = i2 gcd i3
proof
  set d=i2 gcd i3;
  reconsider d as Nat;
  assume i1,i2 are_congruent_mod i3;
  then i3 divides (i1-i2);
  then consider i being Integer such that
A1: i1-i2=i3*i;
A2: d = |.i2.| gcd |.i3.| by INT_2:34;
  then d divides |.i2.| by NAT_D:def 5;
  then |.d.| divides |.i2.| by ABSVALUE:def 1;
  then
A3: d divides i2 by INT_2:16;
A4: i2=i1-i3*i by A1;
A5: for n being Nat st n divides |.i1.| & n divides |.i3.| holds n divides d
  proof
    let n be Nat;
    assume that
A6: n divides |.i1.| and
A7: n divides |.i3.|;
    |.n.| divides |.i3.| by A7,ABSVALUE:def 1;
    then n divides i3 by INT_2:16;  
    then
A8: n divides i3*i by INT_2:2;
    |.n.| divides |.i1.| by A6,ABSVALUE:def 1;
    then n divides i1 by INT_2:16;
    then n divides i2 by A4,A8,Lm4;
    then |.n.| divides |.i2.| by INT_2:16;
    then n divides |.i2.| by ABSVALUE:def 1;
    hence thesis by A2,A7,NAT_D:def 5;
  end;
A9: d divides |.i3.| by A2,NAT_D:def 5;
  then |.d.| divides |.i3.| by ABSVALUE:def 1;
  then d divides i3 by INT_2:16;
  then
A10: d divides i3*i by INT_2:2;
  i1=i3*i+i2 by A1;
  then |.d.|=d & d divides i1 by A3,A10,ABSVALUE:def 1,Th4;
  then d divides |.i1.| by INT_2:16;
  then |.i1.| gcd |.i3.| = d by A9,A5,NAT_D:def 5;
  hence thesis by INT_2:34;
end;
