reserve x,y,z for object,
  i,j,n,m for Nat,
  D for non empty set,
  s,t for FinSequence,
  a,a1,a2,b1,b2,d for Element of D,
  p, p1,p2,q,r for FinSequence of D;
reserve M,M1,M2 for Matrix of D;
reserve f for FinSequence of D;
reserve i,j,i1,j1 for Nat;
reserve k for Nat, G for Matrix of D;
reserve x,y,x1,x2,y1,y2 for object,
  i,j,k,l,n,m for Nat,
  D for non empty set,
  s,s2 for FinSequence,
  a,b,c,d for Element of D,
  q,r for FinSequence of D,
  a9,b9 for Element of D;

theorem
  for M being Matrix of D st len M=n holds M is Matrix of n,width M,D
proof
  let M be Matrix of D;
  assume that
A1: len M=n and
A2: not M is Matrix of n,width M,D;
  set m= width M;
  per cases by A2,Def2;
  suppose
    len M<>n;
    hence contradiction by A1;
  end;
  suppose
A3: ex p be FinSequence of D st p in rng M & not len p=m;
    consider k such that
A4: for x st x in rng M ex q st x = q & len q = k by Th9;
    consider p be FinSequence of D such that
A5: p in rng M and
A6: len p<>m by A3;
    reconsider x=p as set;
A7: ex q st x = q & len q = k by A5,A4;
    now
      per cases;
      suppose
        n= 0;
        then M={} by A1;
        hence len p= m by A5;
      end;
      suppose
        n>0;
        then consider s being FinSequence such that
A8:     s in rng M and
A9:     len s = width M by A1,Def3;
        reconsider y=s as set;
        ex r st y = r & len r = k by A4,A8;
        hence len p= m by A7,A9;
      end;
    end;
    hence contradiction by A6;
  end;
end;
