
theorem
  for L being Z_Lattice,
  b being OrdBasis of L
  st GramMatrix(InnerProduct(L), b) is Matrix of dim(L), INT.Ring
  holds L is INTegral
  proof
    let L be Z_Lattice, b be OrdBasis of L such that
    A1: GramMatrix(InnerProduct(L), b) is Matrix of dim(L), INT.Ring;
    set I = rng b;
    reconsider I as Basis of L by ZMATRLIN:def 5;
    set GM = GramMatrix(InnerProduct(L), b);
    reconsider GMI = GM as Matrix of dim(L), INT.Ring by A1;
    for v, u being Vector of L st v in I & u in I holds
    <; v, u ;> in INT
    proof
      let v, u be Vector of L such that
      B1: v in I & u in I;
      consider i be Nat such that
      B2: i in dom b & b.i = v by B1,FINSEQ_2:10;
      consider j be Nat such that
      B3: j in dom b & b.j = u by B1,FINSEQ_2:10;
      B4: b/.i = v by B2,PARTFUN1:def 6;
      B6: GM*(i, j) = (InnerProduct(L)).(b/.i, b/.j) by B2,B3,ZMODLAT1:def 32
      .= <; v, u ;> by B3,B4,PARTFUN1:def 6;
      B7: dom b = Seg(len b) by FINSEQ_1:def 3
      .= Seg dim(L) by ZMATRLIN:49;
      Indices GM = [:Seg dim(L), Seg dim(L):] by MATRIX_0:24;
      then [i, j] in Indices GM by B2,B3,B7,ZFMISC_1:87;
      then GM*(i, j) = GMI*(i, j) by ZMATRLIN:1;
      hence thesis by B6;
    end;
    hence thesis by ZMODLAT1:15;
  end;
