reserve i,j,n,n1,n2,m,k,u for Nat,
        r,r1,r2 for Real,
        x,y for Integer,
        a,b for non trivial Nat;

theorem Th7:
  [n1,n2] is Pell's_solution of (a^2-'1) implies
    ex n st n1 = Px(a,n) & n2 = Py(a,n)
proof
  set D=a^2-'1;
  assume
A1: [n1,n2] is Pell's_solution of D;
  then reconsider N=[n1,n2] as Pell's_solution of D;
A2: n1^2-(a^2-'1)*n2^2 = 1 by A1,Lm3;
  per cases;
  suppose
A3:   n2=0;
    then n1 <=1 & n1 >=1 by A2,SQUARE_1:51,NAT_1:14;
    then n1=1 by XXREAL_0:1;
    then n1=Px(a,0) & n2=Py(a,0) by A3,Th6;
    hence thesis;
  end;
  suppose n2 >0;
    then N is positive by A2;
    then consider n be positive Nat such that
A4:   n1 + n2 * sqrt D =( (min_Pell's_solution_of D)`1 +
     (min_Pell's_solution_of D)`2 *sqrt D ) |^ n by PELLS_EQ:21;
   consider y be Nat such that
     A5: Px(a,n) + y*sqrt D =
      ( (min_Pell's_solution_of D)`1 +
            (min_Pell's_solution_of D)`2 *sqrt (D) ) |^ n
       by Def1;
A6:   n1 = Px(a,n) by A5,A4,PELLS_EQ:3;
     Px(a,n) + Py(a,n)*sqrt D = n1 + n2 * sqrt D  by A4,Def2;
    then n2 = Py(a,n) by PELLS_EQ:3;
    hence thesis by A6;
  end;
end;
