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,c,d,e for Integer;

theorem Th9:
  for a,b,i1,i2,i3 holds
    {p: a*p.i1 = b*p.i2*p.i3} is diophantine Subset of n -xtuples_of NAT
proof
  let a,b be Integer,i1,i2,i3;
  set F=F_Real;
  reconsider ar=a,br=b as integer Element of F  by XREAL_0:def 1;
  set D = {p: a*p.i1 = b*(p.i2) * (p.i3)};
  D c= n -xtuples_of NAT
  proof
    let y be object;
    assume y in D;
    then ex p st y=p & a*p.i1 = b*(p.i2) * (p.i3);
    hence thesis by HILB10_2:def 5;
  end;
  then reconsider D as Subset of n -xtuples_of NAT;
  per cases;
  suppose n=0;
    then D is diophantine Subset of n -xtuples_of NAT;
    hence thesis;
  end;
  suppose A1: n<>0;
    set Q= ar*1_1(i1,F) - br*(1_1(i2,F) *' 1_1(i3,F));
    reconsider Q as INT -valued Polynomial of n+0,F_Real;
    for s be object holds
        s in D iff ex x be n-element XFinSequence of NAT,
                  y be 0-element XFinSequence of NAT st
                    s=x &  eval(Q,@(x^y)) = 0
    proof
      let s be object;
      thus s in D implies ex x be n-element XFinSequence of NAT,
        y be 0-element XFinSequence of NAT st
        s=x &  eval(Q,@(x^y)) = 0
      proof
        assume s in D;
        then consider p such that
        A2: s=p & a * (p.i1)=b*(p.i2) * (p.i3);
        reconsider Z=<%>NAT as 0-element XFinSequence of NAT;
        take p,Z;
        set pZ=p^Z;
        A3: eval(1_1(i1,F),@p) = p.i1 &
        eval(1_1(i2,F),@p) = p.i2 &
        eval(1_1(i3,F),@p) = p.i3 by A1, Th1;
        A4:eval(ar*1_1(i1,F),@p) = ar*eval(1_1(i1,F),@p) by POLYNOM7:29
        .= a*(p.i1) by A1,  Th1;
        A5: eval(br*(1_1(i2,F) *' 1_1(i3,F)),@p)
        = br*eval(1_1(i2,F) *' 1_1(i3,F),@p) by POLYNOM7:29
        .= br*(eval(1_1(i2,F),@p)*eval(1_1(i3,F),@p))
        by POLYNOM2:25
        .= b*((p.i2)*(p.i3)) by A3;
        eval(Q,@(pZ)) =
        eval(ar*1_1(i1,F),@p)- eval(br*1_1(i2,F)*' 1_1(i3,F),@p) by POLYNOM2:24
        .= 0  by A2,A4,A5;
        hence thesis by A2;
      end;
      given p be n-element XFinSequence of NAT,
      Z be 0-element XFinSequence of NAT such that
      A6: s=p &  eval(Q,@(p^Z)) = 0;
      A7: eval(1_1(i1,F),@p) = p.i1 &
      eval(1_1(i2,F),@p) = p.i2 &
      eval(1_1(i3,F),@p) = p.i3 by A1, Th1;
      A8: eval(br*(1_1(i2,F) *' 1_1(i3,F)),@p)
      = br*eval(1_1(i2,F) *' 1_1(i3,F),@p) by POLYNOM7:29
      .= br*(eval(1_1(i2,F),@p)*eval(1_1(i3,F),@p))
      by POLYNOM2:25
      .= b*((p.i2)*(p.i3)) by A7;
      A9:eval(ar*1_1(i1,F),@p) = ar*eval(1_1(i1,F),@p) by POLYNOM7:29
      .= a*(p.i1) by  A1, Th1;
      set P=p^Z;
      eval(Q,@P) =
      eval(ar*1_1(i1,F),@p)- eval(br*1_1(i2,F)*' 1_1(i3,F),@p) by POLYNOM2:24
      .=a*(p.i1) - (b*((p.i2)*(p.i3))) by A8,A9;
      then a*p.i1 = b*(p.i2)*(p.i3)  by A6;
      hence s in D by A6;
    end;
    then D is diophantine;
    hence thesis;
  end;
end;
