reserve i,j,k,n,m for Nat,
        X for set,
        b,s for bag of X,
        x for object;
reserve O for Ordinal,
        R for right_zeroed add-associative right_complementable
          right_unital distributive non trivial doubleLoopStr,
        p for Polynomial of O, R;
reserve O for Ordinal,
        R for right_zeroed add-associative right_complementable
             right_unital distributive non trivial doubleLoopStr,
        p for Polynomial of O, R;

theorem Th73:
  for M be Jpolynom of 4,F_Complex
    for x1,x2,x3 be Nat st x1 is odd & x2 is odd
      for z be Integer st eval(Jsqrt M,@<%z,x1,4*x2,16*x3%>)=0 holds
        x1 is square & x2 is square  & x3 is square &
        -z <= sqrt x1+2*sqrt x2 + 4*sqrt x3
proof
  let M be Jpolynom of 4,F_Complex;
  let x1,x2,x3 be Nat such that
A1: x1 is odd & x2 is odd;
  set AF=the addF of F_Complex;
  let z be Integer such that
A2: eval(Jsqrt M,@<%z,x1,4*x2,16*x3%>)=0;
  set f=<%z,x1,4*x2,16*x3%>;
  set F = <* z,x1,4*x2,16*x3 *>;
A3: XFS2FS f= F by Lm1;
  4 is non trivial by NEWTON03:def 1;
  then consider A be Subset of Seg 4\{1} such that
A4: AF "**" SignGen(_sqrt XFS2FS(@@f),AF,A) = 0 by A2,Th70;
  set c = _sqrt XFS2FS(f);
  set S = SignGen(c,AF,A);
A5:dom S = dom c by HILB10_7:def 11;
  len F = 4 by CARD_1:def 7;
  then
A6:len S = len c = 4 by A3,Def11,CARD_1:def 7;
  then
A7:S/.1 =S.1 & S/.2 =S.2 & S/.3 =S.3 & S/.4 =S.4
  by A5,PARTFUN1:def 6,FINSEQ_3:25;
A8: AF "**" <*S/.1,S/.2,S/.3,S/.4*> = 0 by A7,A6,FINSEQ_4:76,A4;
  set iz=1;
  not 1 in A & 1 in dom S by A6,ZFMISC_1:56,FINSEQ_3:25;
  then
A9: S.1 = c.1 by HILB10_7:def 11;
  consider i1 be Integer such that
A10: (i1 = 1 or i1 =-1) & S.2 = i1 * (c.2) by Th72;
  consider i2 be Integer such that
A11: (i2 = 1 or i2 =-1) & S.3 = i2 * (c.3) by Th72;
  consider i3 be Integer such that
A12: (i3 = 1 or i3 =-1) & S.4 = i3 * (c.4) by Th72;
A13: c.1 = F.1 = z by A3,Def11;
  F.2 = x1;
  then
A14: c.2 = sqrt x1 by Th71,A3;
  F.3 = 4*x2;
  then
A15: c.3 = sqrt (4*x2) by Th71,A3
  .= 2 * sqrt x2 by SQUARE_1:20,29;
  F.4 = 16*x3;
  then
A16: c.4 = sqrt (4*4*x3) by Th71,A3
  .= sqrt (4*4) * sqrt (x3) by SQUARE_1:29
  .= 2* 2 * sqrt x3 by SQUARE_1:20,29;
A17: sqrt x1 * sqrt x1 = sqrt (x1*x1) by SQUARE_1:29
     .= sqrt (x1^2) by SQUARE_1:def 1
  .= x1 by SQUARE_1:22;
A18: sqrt x2 * sqrt x2 = sqrt (x2*x2) by SQUARE_1:29
  .= sqrt (x2^2) by SQUARE_1:def 1
  .= x2 by SQUARE_1:22;
A19: sqrt x3 * sqrt x3 = sqrt (x3*x3) by SQUARE_1:29
  .=sqrt (x3^2) by SQUARE_1:def 1
  .= x3 by SQUARE_1:22;
A20:AF=addcomplex by COMPLFLD:def 1;
A21: AF "**" <*S/.1,S/.2,S/.3,S/.4*> = AF "**" (<*S/.1,S/.2,S/.3*>^<*S/.4*>)
  by FINSEQ_4:74
  .= AF.(AF "**" <*S/.1,S/.2,S/.3*>,S/.4) by FVSUM_1:8,FINSOP_1:4
  .=AF.(AF.(AF.(S/.1,S/.2),S/.3),S/.4) by FINSOP_1:14;
  AF.(S/.1,S/.2) = (S.1) + (S.2) by A20,A7,BINOP_2:def 3;
  then AF.(AF.(S/.1,S/.2),S/.3) = (S.1) + (S.2)+(S.3) by A20,A7,BINOP_2:def 3;
  then
A22: 0 = (S.1) + (S.2) + (S.3)+(S.4) by A21,A8,A20,A7,BINOP_2:def 3;
A23: S.1<>0
  proof
    assume S.1 = 0;
    then (- (i1 * (c.2))) * (- (i1 * (c.2))) = ((S.3)+(S.4)) * ((S.3)+(S.4))
    by A22,A10;
    then
A24: x1 = 2*2*x2+(i2*i3)*16*(sqrt x2*sqrt x3) + 4*4*x3
    by A14,A15,A16,A17,A18,A19,A10,A11,A12;
    then x1 - 4*x2 - 16*x3 =(i2*i3)*16*(sqrt x2*sqrt x3);
    then reconsider ss= (i2*i3)*16*(sqrt x2*sqrt x3) as Integer;
    16*16=16^2 by SQUARE_1:def 1;
    then ss^2=ss*ss = 16^2*(x2*x3) by A11,A12,A18,A19,SQUARE_1:def 1;
    then 16 divides ss by Th3,INT_1:def 3;
    then ex i be Integer st
       ss = 16*i by INT_1:def 3;
    hence thesis by A1,A24;
  end;
  set Y = z*z+16*x3-x1-4*x2;
  ((S.1) + (S.4))*((S.1) + (S.4)) = (-(S.2)+-(S.3))*(-(S.2)+-(S.3)) by A22;
  then
A25: z*z + 2* (iz*i3)*z * 4* sqrt x3 + 4*4*x3 =
  x1 + 2* S.2 * S.3 + 2*2*x2 by A14,A15,A17,A18,A10,A11,A13,A16,A19,A9,A12;
  then
A26:Y + 8* (iz*i3)*z * sqrt x3=4*(i1*i2)*sqrt x1*sqrt x2 by A14,A15,A10,A11;
A27: Y<>0
  proof
    assume Y=0;
    then (2*(iz*i3)*z * sqrt x3)*(2*(iz*i3)*z * sqrt x3)=
     (2*(iz*i3)*z * sqrt x3)^2 = ((i1*i2)*sqrt x1*sqrt x2)^2 =
      ((i1*i2)*sqrt x1*sqrt x2) * ((i1*i2)*sqrt x1*sqrt x2) & z^2=z*z
     by A26,SQUARE_1:def 1;
    then 2*(2* z^2 * x3) = x1*x2 by A17,A18,A19,A10,A11,A12;
    hence thesis by A1;
  end;
  (Y + 8* (iz*i3)*z * sqrt x3)*(Y  + 8*  (iz*i3)*z * sqrt x3)=
    (Y + 8* (iz*i3)*z * sqrt x3)^2 = (4*(i1*i2)*sqrt x1*sqrt x2)^2=
    (4*(i1*i2)*sqrt x1*sqrt x2)*(4*(i1*i2)*sqrt x1*sqrt x2)
    by A25,A14,A15,A10,A11,SQUARE_1:def 1;
  then Y*Y + 2*Y*8* (iz*i3)*z * sqrt x3 + z*z*64*x3 = 4*4*x1*x2
    by A17,A18,A19,A10,A11,A12;
  then 2*Y*8* (iz*i3)*z * sqrt x3 = 4*4*x1*x2 - Y*Y - z*z*64*x3;
  then reconsider Y1 = 2*Y*8* (iz*i3)*z * sqrt x3 as Integer;
  (16*Y*z)^2 = (16*Y*z)*(16*Y*z) by SQUARE_1:def 1;
  then (16*Y*z)^2*x3 = Y1*Y1 = Y1^2 by A19,A12,SQUARE_1:def 1;
  then 16*Y*z divides Y1 by Th3,INT_1:def 3;
  then consider m be Integer such that
A28:  16*Y*z*m = Y1 by INT_1:def 3;
  (16*Y)*(z*m) = (16*Y)* ((iz*i3)*z * sqrt x3) by A28;
  then z*m = (iz*i3) * sqrt x3*z by A27,XCMPLX_1:5;
  then m = (iz*i3) * sqrt x3 by A23,A13,A9,XCMPLX_1:5;
  then -m = sqrt x3 or m = sqrt x3 by A12;
  then reconsider S3 = sqrt x3 as Integer;
  sqrt x3 >=0 by SQUARE_1:def 2;
  then reconsider S3 as Element of NAT by INT_1:3;
  set Z1 = (iz*2*z) - 1 +(i3*8*S3);
A29: Z1<>0
  proof
    assume Z1=0;
    then
A30: (-(sqrt 1))*(-(sqrt 1)) =
     (-(sqrt 1))^2 = ((2*i1*sqrt x1) +(i2*4*sqrt x2))^2=
     ((2*i1*sqrt x1) +(i2*4*sqrt x2))*((2*i1*sqrt x1) +(i2*4*sqrt x2))
    by SQUARE_1:def 1, A22,A13,A14,A15,A16,A9,A10,A11,A12;
    then 1-4*x1 -16*x2= 16*(i1*i2)*sqrt x1*sqrt x2 by A17,A18,A10,A11;
    then reconsider ss = 16*(i1*i2)*sqrt x1*sqrt x2 as Integer;
    16^2=16*16 by SQUARE_1:def 1;
    then ss^2=ss*ss= 16^2 * (x1*x2) by A17,A18,A10,A11,SQUARE_1:def 1;
    then 16^2 divides ss^2 by INT_1:def 3;
    then consider s be Integer such that
A31: 16*s = ss by Th3,INT_1:def 3;
    2*0+1 = 1 = 2*(2*x1+8*x2+8*s)
    by A31,A30,A17,A18,A10,A11;
    hence thesis;
  end;
  set Y1 = Z1*Z1+16*x2-1-4*x1;
A32:(- Z1 -(i2*4*sqrt x2))*(- Z1 -(i2*4*sqrt x2))=
    (- Z1 -(i2*4*sqrt x2))^2 = (sqrt 1 + (2*i1*sqrt x1))^2=
    (sqrt 1 + (2*i1*sqrt x1))*(sqrt 1 + (2*i1*sqrt x1))
    by SQUARE_1:def 1,A22,A13,A14,A15,A16,A9,A10,A11,A12;
A33: Y1<>0
  proof
    assume Y1=0;
    then (2*Z1*i2*4*sqrt x2)^2 =(2*Z1*i2*4*sqrt x2)*(2*Z1*i2*4*sqrt x2)
     = (2*(2*i1*sqrt x1))*(2*(2*i1*sqrt x1))= (2*(2*i1*sqrt x1))^2
    by A32,A17,A10,A18,A11,SQUARE_1:def 1;
    then 64*Z1^2*x2 = 64*(Z1*Z1)*x2 = 16*x1 by A17,A10,A18,A11,SQUARE_1:def 1;
    then 2*(2*Z1^2*x2) = x1;
    hence thesis by A1;
  end;
  (Y1 + 2*Z1*i2*4*sqrt x2)*(Y1 + 2*Z1*i2*4*sqrt x2)=
    (Y1 + 2*Z1*i2*4*sqrt x2)^2 = (2*(2*i1*sqrt x1))^2=
  (2*(2*i1*sqrt x1))*(2*(2*i1*sqrt x1)) & Z1^2=Z1*Z1
  by A32,A17,A10,A18,A11,SQUARE_1:def 1;
  then Y1*Y1 + 16*Y1*Z1*i2*sqrt x2 + 64*Z1^2*x2 = 16*x1
  by A10,A17,A18,A11;
  then 16*Y1*Z1*i2*sqrt x2 = 16*x1 - Y1*Y1  - 64*Z1^2*x2;
  then reconsider Y2=16*Y1*Z1*i2*sqrt x2 as Integer;
  Y2^2 =Y2*Y2= (16*Y1*Z1)*(16*Y1*Z1)*x2=
     (16*Y1*Z1)^2*x2 by A18,A11,SQUARE_1:def 1;
  then (16*Y1*Z1)^2 divides Y2^2 by INT_1:def 3;
  then consider m1 be Integer such that
A34:16*Y1*Z1*m1 = Y2 by Th3,INT_1:def 3;
  (16*Y1*Z1)*m1=(16*Y1*Z1)*(i2*sqrt x2) by A34;
  then m1 = i2 * sqrt x2 by A29,A33,XCMPLX_1:5;
  then -m1 = sqrt x2 or m1 = sqrt x2 by A11;
  then reconsider S2=sqrt x2 as Integer;
  sqrt x2 >=0 by SQUARE_1:def 2;
  then reconsider S2 as Element of NAT by INT_1:3;
  2*i1*sqrt x1 = - Z1 -1 - i2*4*S2 by A22,A13,A14,A15,A16,A9,A10,A11,A12;
  then reconsider Y3=2*i1*sqrt x1 as Integer;
  Y3^2=Y3*Y3= (2*2)*x1=2^2*x1 by A17,A10,SQUARE_1:def 1;
  then 2^2 divides Y3^2 by INT_1:def 3;
  then consider m2 be Integer such that
A35:  2*m2 = Y3 by Th3,INT_1:def 3;
  (2*i1*sqrt x1)*(2*i1*sqrt x1)=(2*i1*sqrt x1)^2 = Y3*Y3 by SQUARE_1:def 1;
  then 2*2*x1 = 2*2*(m2*m2) by A35,A17,A10;
  hence x1 is square;
A36: sqrt x1>=0 & sqrt x2>=0 & sqrt x3>=0 by SQUARE_1:def 2;
  S2^2 = x2 & S3^2 = x3 by A18,A19,SQUARE_1:def 1;
  hence x2 is square & x3 is square;
A37: (i1*sqrt x1) + (i2*2*sqrt x2) <= 1*sqrt x1+1*2*sqrt x2
  by A10,A36,XREAL_1:7,A11;
  (i1*sqrt x1) + (i2*2*sqrt x2)+(i3*4*sqrt x3) <=
  1*sqrt x1+2*sqrt x2 + 4*sqrt x3 by A37,XREAL_1:7,A12,A36;
  hence thesis by A22,A13,A14,A15,A16,A9,A10,A11,A12;
end;
