reserve i,j,n,n1,n2,m,k,l,u for Nat,
        r,r1,r2 for Real,
        x,y for Integer,
        a,b for non trivial Nat,
        F for XFinSequence,
        cF,cF1,cF2 for complex-valued XFinSequence,
        c,c1,c2 for Complex;
reserve x,y,x1,u,w for Nat;
reserve n,m,k for Nat,
        p,q for n-element XFinSequence of NAT,
        i1,i2,i3,i4,i5,i6 for Element of n,
        a,b,d,f for Integer;

theorem Th37:
  for i1,i2,i3 st n<>0 holds
    {p: p.i3 = Product ( (p.i2+1)+(-idseq (p.i1))) & p.i2 > p.i1}
  is diophantine Subset of n -xtuples_of NAT
proof
  let i1,i2,i3;set n2=n+2;
  defpred R[XFinSequence of NAT] means
  $1.i3 = Product((($1.i2)+1)+(-idseq ($1.i1))) & $1.i2 > $1.i1;
  set RR = {p: R[p] };
 assume
A1: n<>0;
    n=n+0;then
    reconsider Y=i3,X2=i2,X1=i1,C=n,F=n+1 as Element of n2 by HILB10_3:2,3;
    defpred P1[XFinSequence of NAT] means
      $1.X2 >= $1.X1 & $1.C = ($1.X2) choose ($1.X1);
A2: {p where p is n2-element XFinSequence of NAT:P1[p]}
        is diophantine Subset of n2 -xtuples_of NAT by Th30;
    defpred P2[XFinSequence of NAT] means $1.F=($1.X1)!;
A3: {p where p is n2-element XFinSequence of NAT:P2[p]}
        is diophantine Subset of n2 -xtuples_of NAT by Th32;
    defpred P3[XFinSequence of NAT] means 1*$1.X2 > 1*$1.X1+0;
A4: {p where p is n2-element XFinSequence of NAT:P3[p]}
        is diophantine Subset of n2 -xtuples_of NAT by HILB10_3:7;
    defpred P4[XFinSequence of NAT] means 1*$1.Y = 1* ($1 .F) * ($1 .C);
A5: {p where p is n2-element XFinSequence of NAT:P4[p]}
        is diophantine Subset of n2 -xtuples_of NAT by HILB10_3:9;
    defpred P12[XFinSequence of NAT] means P1[$1] & P2[$1];
A6: {p where p is n2-element XFinSequence of NAT:P12[p]}
        is diophantine Subset of n2 -xtuples_of NAT
       from HILB10_3:sch 3(A2,A3);
    defpred P123[XFinSequence of NAT] means P12[$1] & P3[$1];
A7: {p where p is n2-element XFinSequence of NAT:P123[p]}
       is diophantine Subset of n2 -xtuples_of NAT
       from HILB10_3:sch 3(A6,A4);
    defpred P1234[XFinSequence of NAT] means P123[$1] & P4[$1];
    set PP = {p where p is n2-element XFinSequence of NAT:P1234[p]};
A8: PP is diophantine Subset of n2 -xtuples_of NAT
    from HILB10_3:sch 3(A7,A5);
    reconsider
    PPn = {p | n where p is n2-element XFinSequence of NAT: p in PP} as
      diophantine Subset of n -xtuples_of NAT by NAT_1:11,HILB10_3:5,A8;
A9: PPn c= RR
    proof
      let x be object; assume x in PPn;
      then consider p be n2-element XFinSequence of NAT such that
A10:  x= p|n & p in PP;
      ex q be n2-element XFinSequence of NAT st q=p & P1234[q] by A10;
      then
A11:    R[p] by Th23;
      (p|n).X2 = p.i2 & (p|n).X1 = p.i1 & (p|n).Y=p.i3 by A1,HILB10_3:4;
      hence thesis by A11,A10;
    end;
    RR c= PPn
    proof
      let x be object;
      assume x in RR;
      then consider p such that
A12:    x=p & R[p];
      reconsider F=(p.i1)!,C=(p.i2) choose (p.i1) as Element of NAT;
      set Y = <%C,F%>;set PY = p ^ Y;
A13:  len p = n & len Y = 2 by CARD_1:def 7;
A14:  PY|n =p by A13,AFINSQ_1:57;
A15:  PY.i2 = (PY|n).i2 by A1,HILB10_3:4
        .= p.i2 by A13,AFINSQ_1:57;
A16:  PY.i3 = (PY|n).i3 by A1,HILB10_3:4
        .= p.i3 by A13,AFINSQ_1:57;
      0 in dom Y by AFINSQ_1:66;
      then
A17:  PY.(n+0) = Y.0 by A13,AFINSQ_1:def 3
        .= C;
      1 in dom Y by A13,AFINSQ_1:66;
      then A18:PY.(n+1) = Y.1 by A13,AFINSQ_1:def 3
        .= F;
      P1234[PY] by A12,A14,A1,HILB10_3:4,A16,A15,A17,A18, Th23;
      then PY in PP;
      hence thesis by A14,A12;
    end;
    hence thesis by A9,XBOOLE_0:def 10;
end;
