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;

theorem Th31:
  a<>0 & b<>0 implies ex c,d st a gcd b=a*c-b*d
proof
  assume that
A1: a<>0 and
A2: b<>0;
  consider m,n such that
A3: (a gcd b)=a*m+b*n by Th27;
  set k=[/max(-m/b,n/a)\]+1;
  k>n/a by INT_1:32,XXREAL_0:31;
  then k*a>n by A1,XREAL_1:77;
  then
A4: k*a-n>0 by XREAL_1:50;
  k>-m/b by INT_1:32,XXREAL_0:31;
  then k>(-m)/b by XCMPLX_1:187;
  then k*b>-m by A2,XREAL_1:77;
  then k*b--m>0 by XREAL_1:50;
  then reconsider e=k*b+m,d=k*a-n as Element of NAT by A4,INT_1:3;
  a*e-b*d=a*m+(0 qua Nat)+b*n;
  hence thesis by A3;
end;
