reserve X,x,y,z for set;
reserve n,m,k,k9,d9 for Nat;
reserve d for non zero Nat;
reserve i,i0,i1 for Element of Seg d;
reserve l,r,l9,r9,l99,r99,x,x9,l1,r1,l2,r2 for Element of REAL d;
reserve Gi for non trivial finite Subset of REAL;
reserve li,ri,li9,ri9,xi,xi9 for Real;
reserve G for Grating of d;

theorem Th11:
  ex li,ri st li in Gi & ri in Gi &
  li < ri & for xi st xi in Gi holds not (li < xi & xi < ri)
proof
  defpred P[set] means ex li,ri st li in $1 & ri in $1 &
  li < ri & for xi st xi in $1 holds not (li < xi & xi < ri);
A1: now
    let li,ri be Element of REAL;
    assume that
    li in Gi and ri in Gi and
A2: li <> ri;
A3: now
      let li,ri;
      assume
A4:   li < ri;
      thus P[{li,ri}]
      proof
        take li,ri;
        thus thesis by A4,TARSKI:def 2;
      end;
    end;
    li < ri or ri < li by A2,XXREAL_0:1;
    hence P[{li,ri}] by A3;
  end;
A5: for x being Element of REAL, B being non trivial finite Subset of REAL
  st x in Gi & B c= Gi & not x in B & P[B] holds P[B \/ {x}]
  proof
    let x be Element of REAL;
    let B be non trivial finite Subset of REAL;
    assume that
    x in Gi and B c= Gi and
A6: not x in B and
A7: P[B];
    consider li,ri such that
A8: li in B and
A9: ri in B and
A10: li < ri and
A11: for xi st xi in B holds not (li < xi & xi < ri) by A7;
    per cases by A6,A8,A9,XXREAL_0:1;
    suppose
A12:  x < li;
      take li,ri;
      thus li in B \/ {x} & ri in B \/ {x} & li < ri by A8,A9,A10,
XBOOLE_0:def 3;
      let xi;
      assume xi in B \/ {x};
      then xi in B or xi in {x} by XBOOLE_0:def 3;
      hence thesis by A11,A12,TARSKI:def 1;
    end;
    suppose
A13:  li < x & x < ri;
      take li,x;
      x in {x} by TARSKI:def 1;
      hence li in B \/ {x} & x in B \/ {x} & li < x by A8,A13,XBOOLE_0:def 3;
      let xi;
      assume xi in B \/ {x};
      then xi in B or xi in {x} by XBOOLE_0:def 3;
      then not (li < xi & xi < ri) or xi = x by A11,TARSKI:def 1;
      hence thesis by A13,XXREAL_0:2;
    end;
    suppose
A14:  ri < x;
      take li,ri;
      thus li in B \/ {x} & ri in B \/ {x} & li < ri by A8,A9,A10,
XBOOLE_0:def 3;
      let xi;
      assume xi in B \/ {x};
      then xi in B or xi in {x} by XBOOLE_0:def 3;
      hence thesis by A11,A14,TARSKI:def 1;
    end;
  end;
  thus P[Gi] from NonTrivialFinite(A1,A5);
end;
