 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;
reserve f,f1,f2 for n-element real-valued FinSequence,
        p,p1,p2 for Point of TOP-REAL n,
        M,M1,M2 for Matrix of n,m,F_Real,
        A,B for Matrix of n,F_Real;

theorem Th39:
  Mx2Tran M is one-to-one iff the_rank_of M = n
proof
  set MM=Mx2Tran M;
  per cases;
  suppose A1: n=0 iff m=0;
  set nV=n-VectSp_over F_Real,mV=m-VectSp_over F_Real;
  reconsider Bn=MX2FinS 1.(F_Real,n) as OrdBasis of nV by MATRLIN2:45;
  reconsider Bm=MX2FinS 1.(F_Real,m) as OrdBasis of mV by MATRLIN2:45;
  A2: len Bm=m by Th19;
  A3: len Bn=n by Th19;
  then reconsider M1=M as Matrix of len Bn,len Bm,F_Real by A2;
  A4: len M1=n by A1,MATRIX13:1;
  A5: len Bm=m by Th19;
  set T=Mx2Tran(M1,Bn,Bm);
  A6: T is one-to-one iff ker T=(0).nV by MATRLIN2:43;
  A7: width M1=m by A1,MATRIX13:1;
  per cases;
  suppose A8: m=0;
   A9: the carrier of TOP-REAL 0 ={0.TOP-REAL 0} by EUCLID:22,77;
   then rng MM c={0.TOP-REAL 0} by A8,RELAT_1:def 19;
   then rng MM={0.TOP-REAL 0} by ZFMISC_1:33;
   then card{0.TOP-REAL 0}=card{0.TOP-REAL 0} & MM is onto
     by A8,A9,FUNCT_2:def 3;
   hence thesis by A1,A4,A8,A9,MATRIX13:74,FINSEQ_4:63;
  end;
  suppose A10: m>0;
   then reconsider SS=Space_of_Solutions_of(M1@) as Subspace of nV
     by A4,A7,MATRIX_0:54;
   A11: width(M1@)=n by A4,A7,A10,MATRIX_0:54;
   hereby assume A12: Mx2Tran M is one-to-one;
    [#]SS c={0.nV}
    proof
     let x be object;
     assume A13: x in [#]SS;
     then reconsider v=x as Vector of nV by VECTSP_4:10;
     v=v|--Bn by A3,MATRLIN2:46;
     then v|--Bn in SS by A13;
     then v in ker T by A1,A3,A5,A10,MATRLIN2:41;
     then v=0.nV by A6,A12,Th20,VECTSP_4:35;
     hence thesis by TARSKI:def 1;
    end;
    then [#]SS={0.nV} by ZFMISC_1:33;
    then SS=(0).nV by VECTSP_4:def 3;
    then dim SS=0 by RANKNULL:16;
    then 0=n-the_rank_of(M1@) by A1,A10,A11,MATRIX15:68;
    hence the_rank_of M=n by MATRIX13:84;
   end;
   A14: the_rank_of(M1@)=the_rank_of M by MATRIX13:84;
   assume the_rank_of M=n;
   then dim SS=n-n by A1,A10,A11,A14,MATRIX15:68;
   then A15: SS is trivial by MATRLIN2:42;
   [#]ker T c={0.nV}
   proof
    let x be object;
    assume A16: x in [#]ker T;
    then reconsider v=x as Vector of nV by VECTSP_4:10;
    v in ker T by A16;
    then v|--Bn in SS by A1,A3,A5,A10,MATRLIN2:41;
    then v in SS by A3,MATRLIN2:46;
    then v in the carrier of SS;
    then v=0.SS by A15;
    then v=0.nV by VECTSP_4:11;
    hence thesis by TARSKI:def 1;
   end;
   then [#]ker T={0.nV} by ZFMISC_1:33;
   hence thesis by A6,Th20,VECTSP_4:def 3;
  end;
  end;
  suppose A17: n=0 & m<>0;
    A18: now
      let x1,x2 be object such that
       A19: x1 in dom MM & x2 in dom MM & MM.x1 = MM.x2;
      A20: dom MM = [#]TOP-REAL 0 by A17,FUNCT_2:def 1
       .= {0.TOP-REAL 0} by EUCLID:22,77;
      hence x1 = 0.TOP-REAL 0 by A19,TARSKI:def 1
       .= x2 by A19,A20,TARSKI:def 1;
    end;
    len M = n by MATRIX_0:def 2;
    hence thesis by A18,A17,FUNCT_1:def 4,MATRIX13:74;
  end;
  suppose A21: n<>0 & m=0;
    reconsider x1 = n |-> 1 as Point of TOP-REAL n by Lm2;
    reconsider x2 = n |-> 2 as Point of TOP-REAL n by Lm2;
    A22: dom MM = [#]TOP-REAL n by FUNCT_2:def 1;
    A23: MM.x1 = 0.TOP-REAL 0 by A21 .=MM.x2 by A21;
    A24: x1 <> x2
    proof
      assume A25: x1 = x2;
      A26: x1 = (Seg n) --> 1 by FINSEQ_2:def 2
      .= [:Seg n,{1}:] by FUNCOP_1:def 2;
      x2 = (Seg n) --> 2 by FINSEQ_2:def 2
      .= [:Seg n,{2}:] by FUNCOP_1:def 2;
      then {1} = {2} by A25,A26,A21,ZFMISC_1:110;
      then 2 in {1} by TARSKI:def 1;
      hence contradiction by TARSKI:def 1;
    end;
    width M = m by A21,MATRIX13:1;
    hence thesis by A24,A21,A23,A22,FUNCT_1:def 4,MATRIX13:74;
  end;
end;
