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 Th37:
  cell(l,r) in cells(d,G) iff (for i holds [l.i,r.i] is Gap of G.i) &
  ((for i holds l.i < r.i) or for i holds r.i < l.i )
proof
  hereby
    assume cell(l,r) in cells(d,G);
    then consider l9,r9 such that
A1: cell(l,r) = cell(l9,r9) and
A2: for i holds [l9.i,r9.i] is Gap of G.i and
A3: (for i holds l9.i < r9.i) or for i holds r9.i < l9.i by Th36;
A4: (for i holds l9.i <= r9.i) or for i holds r9.i < l9.i by A3;
    then
A5: l = l9 by A1,Th28;
    r = r9 by A1,A4,Th28;
    hence (for i holds [l.i,r.i] is Gap of G.i) &
    ((for i holds l.i < r.i) or for i holds r.i < l.i ) by A2,A3,A5;
  end;
  thus thesis by Th36;
end;
