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;
reserve P,P1,P2,Q,Q1,Q2 for without_zero finite Subset of NAT;

theorem
  the_rank_of M = 1 iff ex i st i in Seg len M & (ex j st j in Seg width
  M & M*(i,j) <> 0.K) & for k st k in Seg len M ex a st Line(M,k) =a*Line(M,i)
proof
A1: Indices M=[:Seg len M,Seg width M:] by FINSEQ_1:def 3;
  thus the_rank_of M = 1 implies ex i st i in Seg len M & (ex j st j in Seg
width M & M*(i,j) <> 0.K) & for k st k in Seg len M ex a st Line(M,k) = a*Line(
  M,i)
  proof
    assume
A2: the_rank_of M = 1;
    then consider i,j such that
A3: [i,j] in Indices M and
A4: M*(i,j) <> 0.K by Th97;
    take i;
A5: j in Seg width M by A3,ZFMISC_1:87;
    hence
    i in Seg len M & ex j st j in Seg width M & M*(i,j) <> 0.K by A1,A3,A4,
ZFMISC_1:87;
    set Li=Line(M,i);
    set ij=M*(i,j);
    let k such that
A6: k in Seg len M;
    set Lk=Line(M,k);
    set kj=M*(k,j);
    take a=kj * ij";
A7: i in Seg len M by A1,A3,ZFMISC_1:87;
A8: now
      let n such that
A9:   1<=n and
A10:  n<=width M;
A11:  n in Seg width M by A9,A10;
      then
A12:  {j,n} c= Seg width M by A5,ZFMISC_1:32;
      Li.n = M*(i,n) by A11,MATRIX_0:def 7;
      then
A13:  (a*Li).n=a*(M*(i,n)) by A11,FVSUM_1:51;
A14:  kj = kj * 1_K
        .= kj * (ij * ij") by A4,VECTSP_1:def 10
        .= a * ij by GROUP_1:def 3;
      {i,k} c= Seg len M by A7,A6,ZFMISC_1:32;
      then [:{i,k},{j,n}:] c= Indices M by A1,A12,ZFMISC_1:96;
      then
A15:  ij*(M*(k,n)) = a*ij *(M*(i,n)) by A2,A14,Th97
        .= ij * (a * (M*(i,n))) by GROUP_1:def 3;
      Lk.n=M*(k,n) by A11,MATRIX_0:def 7;
      hence Lk.n=(a*Li).n by A4,A15,A13,VECTSP_2:8;
    end;
A16: len (a*Li)=width M by CARD_1:def 7;
    len Lk=width M by CARD_1:def 7;
    hence thesis by A16,A8;
  end;
  given i such that
A17: i in Seg len M and
A18: ex j st j in Seg width M & M*(i,j) <> 0.K and
A19: for k st k in Seg len M ex a st Line(M,k) = a*Line(M,i);
A20: now
    set Li=Line(M,i);
    let I,J,n,m be Nat such that
A21: [:{I,J},{n,m}:]c=Indices M;
A22: {n,m} c= Seg width M by A21,ZFMISC_1:114;
    then
A23: n in Seg width M by ZFMISC_1:32;
    then
A24: Li.n=M*(i,n) by MATRIX_0:def 7;
    set LJ=Line(M,J);
    set LI=Line(M,I);
A25: {I,J} c= Seg len M by A1,A21,ZFMISC_1:114;
    then I in Seg len M by ZFMISC_1:32;
    then consider a such that
A26: LI = a*Li by A19;
    J in Seg len M by A25,ZFMISC_1:32;
    then consider b such that
A27: LJ = b*Li by A19;
    LJ.n=M*(J,n) by A23,MATRIX_0:def 7;
    then
A28: M*(J,n)= b * (M*(i,n)) by A27,A23,A24,FVSUM_1:51;
A29: m in Seg width M by A22,ZFMISC_1:32;
    then
A30: Li.m=M*(i,m) by MATRIX_0:def 7;
    LJ.m=M*(J,m) by A29,MATRIX_0:def 7;
    then
A31: M*(J,m)= b *(M*(i,m)) by A27,A29,A30,FVSUM_1:51;
    LI.m=M*(I,m) by A29,MATRIX_0:def 7;
    then
A32: M*(I,m)= a * (M*(i,m)) by A26,A29,A30,FVSUM_1:51;
    LI.n=M*(I,n) by A23,MATRIX_0:def 7;
    then M*(I,n)= a * (M*(i,n)) by A26,A23,A24,FVSUM_1:51;
    hence M*(I,n) * (M*(J,m)) = (a * (M*(i,n)) * b) * (M*(i,m)) by A31,
GROUP_1:def 3
      .= (b *(M*(i,n)) * a) * (M*(i,m)) by GROUP_1:def 3
      .= M*(I,m) * (M*(J,n)) by A28,A32,GROUP_1:def 3;
  end;
  consider j such that
A33: j in Seg width M and
A34: M*(i,j) <> 0.K by A18;
  [i,j] in Indices M by A1,A17,A33,ZFMISC_1:87;
  hence thesis by A34,A20,Th97;
end;
