theorem Th18:
  [:rng nt,rng mt:] c= Indices A & (n = 0 iff m = 0) implies Segm(
  A,nt,mt)@ = Segm(A@,mt,nt)
proof
  assume that
A1: [:rng nt,rng mt:] c= Indices A and
A2: n = 0 iff m = 0;
  set A9=A@;
  set SA=Segm(A,nt,mt);
  set SA9=Segm(A9,mt,nt);
  per cases;
  suppose
A3: n=0;
    then width SA=0 by A2,Th1;
    then len (SA@)=0 by MATRIX_0:def 6;
    then
A4: SA@ ={};
    len SA9=0 by A2,A3,Th1;
    hence thesis by A4;
  end;
  suppose
A5: n>0;
    then
A6: width SA=m by Th1;
A7: width SA9=n by A2,Th1;
A8: now
A9:   Indices SA9=[:Seg m,Seg n:] by A7,MATRIX_0:25;
      let i,j such that
A10:  [i,j] in Indices (SA@);
      reconsider i9=i,j9=j as Element of NAT by ORDINAL1:def 12;
A11:  [j9,i9] in Indices SA by A10,MATRIX_0:def 6;
      then
A12:  (SA@)*(i9,j9)=SA*(j9,i9) by MATRIX_0:def 6;
      Indices SA=[:Seg n,Seg m:] by A6,MATRIX_0:25;
      then
A13:  j9 in Seg n by A11,ZFMISC_1:87;
      i9 in Seg m by A6,A11,ZFMISC_1:87;
      then
A14:  [i9,j9] in Indices SA9 by A13,A9,ZFMISC_1:87;
A15:  SA*(j9,i9)=A*(nt.j,mt.i) by A11,Def1;
      [nt.j,mt.i] in Indices A by A1,A11,Th17;
      then (SA@)*(i9,j9)=A9*(mt.i,nt.j) by A15,A12,MATRIX_0:def 6;
      hence (SA@)*(i,j)=SA9* (i,j) by A14,Def1;
    end;
    len SA9=m by A2,Th1;
    then
A16: len (SA@) = len SA9 by A2,A5,A6,MATRIX_0:54;
    len SA=n by A5,Th1;
    hence thesis by A2,A5,A6,A7,A16,A8,MATRIX_0:21,54;
  end;
end;
