reserve a,b,c,k,k9,m,n,n9,p,p9 for Nat;
reserve i,i9 for Integer;

theorem Th1:
  m*n is square & m,n are_coprime implies m is square & n is square
proof
  defpred P[Nat] means for m,n st m*n = $1 & m*n is square & m,n
  are_coprime holds m is square & n is square;
A1: for mn being Nat st for k being Nat st k < mn holds P[k] holds P[mn]
  proof
    let mn be Nat;
    assume
A2: for k be Nat st k < mn for m,n st m*n = k & m*n is square & m,n
    are_coprime holds m is square & n is square;
    let m,n;
    assume
A3: m*n = mn;
    assume m*n is square;
    then consider mn9 being Nat such that
A4: mn = mn9^2 by A3;
    assume
A5: m,n are_coprime;
    then
A6: m gcd n = 1^2;
    per cases by A3,NAT_1:25;
    suppose
A7:   m*n = 0;
      hereby
        per cases by A7,XCMPLX_1:6;
        suppose
          m = 0^2;
          hence thesis by A6,NEWTON:52;
        end;
        suppose
          n = 0^2;
          hence thesis by A6,NEWTON:52;
        end;
      end;
    end;
    suppose
      m*n = 1^2;
      hence thesis by NAT_1:15;
    end;
    suppose
A8:   mn > 1;
      then mn >= 1 + 1 by NAT_1:13;
      then consider p9 being Element of NAT such that
A9:   p9 is prime and
A10:  p9 divides mn by INT_2:31;
      reconsider p = p9 as prime Element of NAT by A9;
      p divides mn9 by A4,A10,NEWTON:80;
      then consider mn99 be Nat such that
A11:  mn9 = p*mn99 by NAT_D:def 3;
A12:  p > 1 by INT_2:def 4;
      then p*p > p by XREAL_1:155;
      then
A13:  p*p > 1 by A12,XXREAL_0:2;
A14:  n > 0 by A3,A8;
A15:  p <> 0 by INT_2:def 4;
A16:  m > 0 by A3,A8;
      hereby
        per cases by A3,A10,NEWTON:80;
        suppose
A17:      p divides m;
          then
A18:      not p divides n by A5;
          consider m9 be Nat such that
A19:      m = p*m9 by A17,NAT_D:def 3;
          p*(m9*n) = p*(p*(mn99*mn99)) by A3,A4,A11,A19;
          then m9*n = p*(mn99*mn99) by A15,XCMPLX_1:5;
          then p divides m9*n;
          then p divides m9 by A18,NEWTON:80;
          then consider m99 be Nat such that
A20:      m9 = p*m99 by NAT_D:def 3;
          reconsider m99 as Element of NAT by ORDINAL1:def 12;
A21:      m99 <> 0 by A3,A8,A19,A20;
          p*(p*(m99*n)) = p*(p*(mn99*mn99)) by A3,A4,A11,A19,A20;
          then p*(m99*n) = p*(mn99*mn99) by A15,XCMPLX_1:5;
          then
A22:      m99*n = mn99^2 by A15,XCMPLX_1:5;
          m = (p*p)*m99 by A19,A20;
          then m99 divides m;
          then m99 gcd n = 1 by A6,WSIERP_1:16;
          then
A23:      m99,n are_coprime;
          m = (p*p)*m99 by A19,A20;
          then 1*m99 < m by A13,A21,XREAL_1:98;
          then
A24:      m99*n < mn by A3,A14,A21,XREAL_1:98;
          then m99 is square by A2,A22,A23;
          then consider m999 being Nat such that
A25:      m99 = m999^2;
          m = (p*m999)^2 by A19,A20,A25;
          hence thesis by A2,A24,A22,A23;
        end;
        suppose
A26:      p divides n;
          then
A27:      not p divides m by A5;
          consider n9 be Nat such that
A28:      n = p*n9 by A26,NAT_D:def 3;
          p*(m*n9) = p*(p*(mn99*mn99)) by A3,A4,A11,A28;
          then m*n9 = p*(mn99*mn99) by A15,XCMPLX_1:5;
          then p divides m*n9;
          then p divides n9 by A27,NEWTON:80;
          then consider n99 be Nat such that
A29:      n9 = p*n99 by NAT_D:def 3;
          reconsider n99 as Element of NAT by ORDINAL1:def 12;
A30:      n99 <> 0 by A3,A8,A28,A29;
          p*(p*(m*n99)) = p*(p*(mn99*mn99)) by A3,A4,A11,A28,A29;
          then p*(m*n99) = p*(mn99*mn99) by A15,XCMPLX_1:5;
          then
A31:      m*n99 = mn99^2 by A15,XCMPLX_1:5;
          n = (p*p)*n99 by A28,A29;
          then n99 divides n;
          then m gcd n99 = 1 by A6,WSIERP_1:16;
          then
A32:      m,n99 are_coprime;
          n = (p*p)*n99 by A28,A29;
          then 1*n99 < n by A13,A30,XREAL_1:98;
          then
A33:      m*n99 < mn by A3,A16,A30,XREAL_1:98;
          then n99 is square by A2,A31,A32;
          then consider n999 being Nat such that
A34:      n99 = n999^2;
          n = (p*n999)^2 by A28,A29,A34;
          hence thesis by A2,A33,A31,A32;
        end;
      end;
    end;
  end;
  for mn being Nat holds P[mn] from NAT_1:sch 4(A1);
  hence thesis;
end;
