reserve x,y for object,X,Y for set,
  D for non empty set,
  i,j,k,l,m,n,m9,n9 for Nat,
  i0,j0,n0,m0 for non zero Nat,
  K for Field,
  a,b for Element of K,
  p for FinSequence of K,
  M for Matrix of n,K;
reserve A for (Matrix of D),
  A9 for Matrix of n9,m9,D,
  M9 for Matrix of n9, m9,K,
  nt,nt1,nt2 for Element of n-tuples_on NAT,
  mt,mt1 for Element of m -tuples_on NAT,
  M for Matrix of K;

theorem Th42:
  nt = idseq len A & mt = idseq width A implies Segm(A,nt,mt) = A
proof
  set S=Segm(A,nt,mt);
  assume that
A1: nt = idseq len A and
A2: mt = idseq width A;
A3: len nt=n by CARD_1:def 7;
A4: len idseq width A=width A by CARD_1:def 7;
A5: len idseq len A =len A by CARD_1:def 7;
A6: len mt=m by CARD_1:def 7;
  per cases;
  suppose
A7: n=0;
    then
A8: len S=0 by MATRIX_0:def 2;
    A={} by A1,A7;
    hence thesis by A8;
  end;
  suppose
A9: n>0;
    then
A10: width S=m by Th1;
    then
A11: Indices S=[:Seg n,Seg m:] by MATRIX_0:25;
A12: now
      let i,j such that
A13:  [i,j] in Indices S;
      reconsider i9=i,j9=j as Element of NAT by ORDINAL1:def 12;
      j in Seg m by A10,A13,ZFMISC_1:87;
      then
A14:  mt.j9=j by A2,A6,A4,FINSEQ_2:49;
      i in Seg n by A11,A13,ZFMISC_1:87;
      then nt.i9=i by A1,A3,A5,FINSEQ_2:49;
      hence S*(i,j)=A*(i,j) by A13,A14,Def1;
    end;
    len S=n by A9,Th1;
    hence thesis by A1,A2,A3,A6,A5,A4,A10,A12,MATRIX_0:21;
  end;
end;
