reserve x for object,
  a,b for Real,
  k,k1,i1,j1,w for Nat,
  m,m1,n,n1 for Integer;
reserve p,q for Rational;

theorem
  p = m/n & n <> 0 implies ex m1 st m = numerator(p)*m1 & n = denominator(p)*m1
proof
  assume that
A1: p=m/n and
A2: n<>0;
  per cases by A2;
  suppose
    n<0;
    then reconsider x=-n as Element of NAT by INT_1:3;
A3: p=-(-m)/n by A1
      .=(-m)/x by XCMPLX_1:188;
    x<>0 by A2;
    then consider k such that
A4: -m=numerator(p)*k and
A5: x=denominator(p)*k by A3,Th24;
    take y=-k;
    thus m=-numerator(p)*k by A4
      .=numerator(p)*y;
    thus n=-denominator(p)*k by A5
      .=denominator(p)*y;
  end;
  suppose
    0<n;
    then reconsider x=n as Element of NAT by INT_1:3;
    consider k such that
A6: m=numerator(p)*k and
A7: x=denominator(p)*k by A1,A2,Th24;
    reconsider y=k as Integer;
    take y;
    thus thesis by A6,A7;
  end;
end;
