 reserve X,Y for set,
         n,m,k,i for Nat,
         r for Real,
         R for Element of F_Real,
         K for Field,
         f,f1,f2,g1,g2 for FinSequence,
         rf,rf1,rf2 for real-valued FinSequence,
         cf,cf1,cf2 for complex-valued FinSequence,
         F for Function;

theorem
  for A be Matrix of n,m,K st the_rank_of A = m
    ex B be Matrix of n,n-' m,K st the_rank_of(A^^B) = n
proof
  let A be Matrix of n,m,K such that
   A1: the_rank_of A=m;
  A2: len A=n by MATRIX_0:def 2;
  per cases;
  suppose A3: m=0;
   then n-' m=n-m by XREAL_0:def 2;
   then reconsider ONE=1.(K,n) as Matrix of n,n-' m,K by A3;
   A4: len 1.(K,n)=n by MATRIX_0:24;
   Det 1.(K,n)<>0.K by LAPLACE:34;
   then A5: the_rank_of ONE=n by MATRIX13:83;
   width A=m by A3,MATRIX13:1;
   then A^^ONE=ONE by A2,A3,A4,MATRIX15:22;
   hence thesis by A5;
  end;
  suppose A6: m>0;
   n-m>=0 by A1,A2,MATRIX13:74,XREAL_1:48;
   then A7: n-' m=n-m by XREAL_0:def 2;
   A8: n>0 by A1,A2,A6,MATRIX13:74;
   then A9: width A=m by MATRIX13:1;
   per cases;
   suppose A10: n=m;
    take B=the Matrix of n,n-' m,K;
    len B=n & width B=0 by A6,A7,A10,MATRIX_0:23;
    hence thesis by A1,A2,A10,MATRIX15:22;
   end;
   suppose A11: n<>m;
    A12: width(A@)=n by A2,A6,A9,MATRIX_0:54;
    len(A@)=m by A6,A9,MATRIX_0:54;
    then reconsider A1=A@ as Matrix of m,n,K by A12,MATRIX_0:51;
    the_rank_of A1=m by A1,MATRIX13:84;
    then consider B be Matrix of n-' m,n,K such that
     A13: the_rank_of(A1^B)=n by Th16;
    A14: n-' m<>0 by A7,A11;
    then A15: width B=n by MATRIX13:1;
    then A16: len(B@)=n by A8,MATRIX_0:54;
    len B=n-' m by A14,MATRIX13:1;
    then width(B@)=n-' m by A8,A15,MATRIX_0:54;
    then reconsider B1=B@ as Matrix of n,n-' m,K by A16,MATRIX_0:51;
    A1@=A by A2,A6,A8,A9,MATRIX_0:57;
    then A17: (A1^B)@=A^^B1 by A12,A15,MATRLIN:28;
    the_rank_of((A1^B)@)=n by A13,MATRIX13:84;
    hence thesis by A17;
   end;
  end;
end;
