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 Th6:
  for a,b,c be Integer,i1,i2 holds
    {p: a*p.i1 = b*p.i2+c} is diophantine Subset of n -xtuples_of NAT
proof
  let c,a,b be Integer,i1,i2;
  set F=F_Real;
  reconsider ar=a,br=b,cr = c as integer Element of F by XREAL_0:def 1;
  set D = {p: c * p.i1 = a*(p.i2)+b};
  D c= n -xtuples_of NAT
  proof
    let y be object;
    assume y in D;
    then ex p st
    y=p & c*p.i1 = a*(p.i2)+b;
    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= cr*1_1(i1,F) - ar*1_1(i2,F)- br*1_(n,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 & c* p.i1=a*(p.i2)+b;
        reconsider Z=<%>NAT as 0-element XFinSequence of NAT;
        take pZ=p,Z;
        A3: eval(br*1_(n,F),@p) = br*eval(1_(n,F),@p) by POLYNOM7:29
        .= br* 1.F by POLYNOM2:21
        .= b;
        A4:eval(ar*1_1(i2,F),@p) = ar*eval(1_1(i2,F),@p) by POLYNOM7:29
        .= a*(p.i2) by A1,Th1;
        A5:eval(cr*1_1(i1,F),@p)  = cr*eval(1_1(i1,F),@p) by POLYNOM7:29
        .= c*(p.i1) by A1,Th1;
        eval(Q,@(p^Z)) =
        eval(cr*1_1(i1,F) - ar*1_1(i2,F),@p)- eval(br*1_(n,F),@p)
        by POLYNOM2:24
        .= eval(cr*1_1(i1,F),@p) - eval(ar*1_1(i2,F),@p)- eval(br*1_(n,F),@p)
        by POLYNOM2:24
        .= 0 by A2,A3,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(br*1_(n,F),@p) = br*eval(1_(n,F),@p) by POLYNOM7:29
      .= br* 1.F by POLYNOM2:21
      .= b;
      A8:eval(ar*1_1(i2,F),@p) = ar*eval(1_1(i2,F),@p) by POLYNOM7:29
      .= a*(p.i2) by A1,Th1;
      A9:
      eval(cr*1_1(i1,F),@p) = cr*eval(1_1(i1,F),@p) by POLYNOM7:29
      .= c*(p.i1) by A1,Th1;
      eval(Q,@(p^Z))
      = eval(cr*1_1(i1,F)-ar*1_1(i2,F),@p)- eval(br*1_(n,F),@p) by POLYNOM2:24
      .= eval(cr*1_1(i1,F),@p) - eval(ar*1_1(i2,F),@p)- eval(br*1_(n,F),@p)
      by POLYNOM2:24
      .= c*p.i1 - a*(p.i2) - b by A7,A8,A9;
      then c*p.i1 = a*(p.i2)+b by A6;
      hence thesis by A6;
    end;
    then D is diophantine;
    hence thesis;
  end;
end;
