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;
reserve v,v1,v2,u,w for Vector of n-VectSp_over K,
  t,t1,t2 for Element of n -tuples_on the carrier of K,

  L for Linear_Combination of n-VectSp_over K,
  M,M1 for Matrix of m,n,K;

theorem Th110:
  the_rank_of M = m implies lines M is linearly-independent
proof
  assume
A1: the_rank_of M = m;
  reconsider N=n as Element of NAT by ORDINAL1:def 12;
  set V=n-VectSp_over K;
  per cases;
  suppose
    m=0;
    then len M=0 by MATRIX_0:def 2;
    then M = {};
    hence thesis;
  end;
  suppose
A2: m<>0;
    then
A3: width M=n by Th1;
A4: M is without_repeated_line by A1,Th105;
A5: now
      set n0=n|->0.K;
      set NULL=0.(K,m,n);
      let M1 such that
A6:   for i st i in Seg m ex a st Line(M1,i) = a * Line(M,i) and
A7:   for j st j in Seg n holds Sum Col(M1,j) = 0.K;
      assume M1 <> 0.(K,m,n);
      then consider i,j such that
A8:   [i,j] in Indices M1 and
A9:   M1*(i,j)<>NULL*(i,j) by MATRIX_0:27;
      reconsider i,j as Element of NAT by ORDINAL1:def 12;
A10:  len M=m by MATRIX_0:def 2;
      Indices M1=Indices NULL by MATRIX_0:26;
      then
A11:  M1*(i,j)<>0.K by A8,A9,MATRIX_3:1;
A12:  Indices M=[:Seg m,Seg n:] by A3,MATRIX_0:25;
      Indices M1=Indices M by MATRIX_0:26;
      then
A13:  i in Seg m by A12,A8,ZFMISC_1:87;
      then consider a such that
A14:  Line(M1,i) = a * Line(M,i) by A6;
A15:  width M1=n by A2,Th1;
      then
A16:  j in Seg n by A8,ZFMISC_1:87;
      then
A17:  Line(M,i).j=M*(i,j) by A3,MATRIX_0:def 7;
      set R=RLine(M,i,a*Line(M,i));
      consider L be Linear_Combination of lines M such that
A18:  L (#) MX2FinS M = M1 by A1,A6,Th105,Th108;
      set LM=L (#) MX2FinS M;
      len M1=len M by A18,VECTSP_6:def 5;
      then consider f be sequence of  the carrier of V such that
A19:  Sum LM= f.m and
A20:  f.0 = 0.V and
A21:  for j be Nat,v st j < m & v = LM.(j+1) holds f.(j+1)
      = f.j+v by A18,A10,RLVECT_1:def 12;
      set RR=RLine(R,i,n0);
A22:  len RR=m by MATRIX_0:def 2;
      defpred P[Nat] means $1 < i implies for t st t=f.$1 holds the_rank_of R=
      the_rank_of RLine(R,i,Line(R,i)+t);
      width M = len Line(M,i) by MATRIX_0:def 7
        .= len (a*Line(M,i)) by MATRIXR1:16;
      then
A23:  width R=width M by MATRIX11:def 3;
A24:  for k st P[k] holds P[k+1]
      proof
        let k such that
A25:    P[k];
        reconsider kk=k as Element of NAT by ORDINAL1:def 12;
        set k1=k+1;
A26:    1<=k1 by NAT_1:14;
A27:    i<=m by A13,FINSEQ_1:1;
        reconsider LR=Line(R,i),LM1=Line(M1,k1) as Element of N-tuples_on the
        carrier of K by A2,Th1;
        assume
A28:    k1 < i;
        let t such that
A29:    t = f.k1;
        reconsider t1=f.kk,T=t as Element of N-tuples_on the carrier of K by
Th102;
        set RR=RLine(R,i,Line(R,i)+t1);
        reconsider LRt=LR+t,LRt1=LR+t1 as Element of (the carrier of K)* by
FINSEQ_1:def 11;
A30:    len (LR+T)=n by CARD_1:def 7;
A31:    len (LR+t1)=width R by A3,A23,CARD_1:def 7;
        then width RR=width R by MATRIX11:def 3;
        then
A32:    RLine(RR,i,LR+t) = Replace(RR,i,LRt) by A3,A23,A30,MATRIX11:29
          .= Replace(Replace(R,i,LRt1),i,LRt) by A31,MATRIX11:29
          .= Replace(R,i,LRt) by FUNCT_7:34
          .= RLine(R,i,LR+t)by A3,A23,A30,MATRIX11:29;
        i<=m by A13,FINSEQ_1:1;
        then k1 <m by A28,XXREAL_0:2;
        then
A33:    k1 in Seg m by A26;
        then
A34:    Line(M1,k1)=M1.k1 by MATRIX_0:52;
        Line(M1,k1) in lines M1 by A33,Th103;
        then reconsider LMk1=LM.k1 as Element of V by A18,A33,MATRIX_0:52;
        consider a such that
A35:    Line(M1,k1) = a * Line(M,k1) by A6,A33;
A36:    Line(M,k1) = Line(R,k1) by A28,A33,MATRIX11:28
          .= Line(RR,k1) by A28,A33,MATRIX11:28;
        k < i by A28,NAT_1:13;
        then k<m by A27,XXREAL_0:2;
        then t = f.kk+LMk1 by A21,A29
          .= t1+Line(M1,k1) by A15,A18,A34,Th102;
        then
A37:    LR+t = LR+t1 + LM1 by FINSEQOP:28
          .= Line(RR,i) + a * Line(RR,k1) by A13,A35,A31,A36,MATRIX11:28;
A38:    len RR=m by MATRIX_0:def 2;
        the_rank_of R=the_rank_of RR by A25,A28,NAT_1:13;
        hence thesis by A28,A33,A38,A32,A37,Th92;
      end;
      defpred Q[Nat] means i<=$1 & $1<=m implies for t st t=f.$1 holds
      the_rank_of R=the_rank_of RLine(R,i,t);
A39:  P[0]
      proof
        assume 0<i;
        let t;
        assume t=f.0;
        then t = n|-> 0.K by A20,Th102;
        then Line(R,i)+t=Line(R,i) by A3,A23,FVSUM_1:21;
        hence thesis by MATRIX11:30;
      end;
A40:  for k holds P[k] from NAT_1:sch 2(A39,A24);
A41:  for k st Q[k] holds Q[k+1]
      proof
        let k such that
A42:    Q[k];
        reconsider kk=k as Element of NAT by ORDINAL1:def 12;
        reconsider t1=f.kk as Element of N-tuples_on the carrier of K by Th102;
        set k1=k+1;
        reconsider LR=Line(R,i),LM1=Line(M1,k1) as Element of n-tuples_on the
        carrier of K by A2,Th1;
        assume that
A43:    i<=k1 and
A44:    k1<=m;
A45:    k<m by A44,NAT_1:13;
        1<=k1 by NAT_1:14;
        then
A46:    k1 in Seg m by A44;
        then
A47:    Line(M1,k1)=M1.k1 by MATRIX_0:52;
        Line(M1,k1) in lines M1 by A46,Th103;
        then reconsider LMk1=LM.k1 as Element of V by A18,A46,MATRIX_0:52;
        let t;
        assume t=f.k1;
        then
A48:    t = f.kk+LMk1 by A21,A45
          .= t1+LM1 by A18,A47,Th102;
        consider b such that
A49:    Line(M1,k1) = b * Line(M,k1) by A6,A46;
        reconsider T=t,T1=t1 as Element of (the carrier of K)* by
FINSEQ_1:def 11;
        per cases by A43,XXREAL_0:1;
        suppose
A50:      i=k1;
          len LM1=n by CARD_1:def 7;
          then LR=LM1 by A3,A14,A46,A50,MATRIX11:28;
          then
A51:      LR+t1=t by A48,FINSEQOP:33;
          k<i by A50,NAT_1:13;
          hence thesis by A40,A51;
        end;
        suppose
A52:      i<k1;
          set RR=RLine(R,i,t1);
A53:      len t1=width R by A3,A23,CARD_1:def 7;
          then Line(RR,i)=t1 by A13,MATRIX11:28;
          then
A54:      t = Line(RR,i)+b* Line(R,k1) by A46,A49,A48,A52,MATRIX11:28
            .= Line(RR,i)+ b * Line(RR,k1) by A46,A52,MATRIX11:28;
A55:      len t=n by CARD_1:def 7;
          width RR=width R by A53,MATRIX11:def 3;
          then
A56:      RLine(RR,i,t) = Replace(RR,i,T)by A3,A23,A55,MATRIX11:29
            .= Replace(Replace(R,i,T1),i,T) by A53,MATRIX11:29
            .= Replace(R,i,T) by FUNCT_7:34
            .= RLine(R,i,t) by A3,A23,A55,MATRIX11:29;
A57:      len RR=m by MATRIX_0:def 2;
          the_rank_of R=the_rank_of RLine(R,i,t1) by A42,A44,A52,NAT_1:13;
          hence thesis by A46,A52,A54,A56,A57,Th92;
        end;
      end;
A58:  Q[0] by A13;
A59:  for k holds Q[k] from NAT_1:sch 2(A58,A41);
      reconsider SumLM=Sum LM as Element of n-tuples_on the carrier of K by
Th102;
A60:  now
        let j such that
A61:    1<=j and
A62:    j<=n;
A63:    j in Seg n by A61,A62;
A64:    Carrier L c= lines M by VECTSP_6:def 4;
        M1 = FinS2MX(L (#) MX2FinS M) by A18;
        then Sum Col(M1,j) = (Sum L).j by A1,A63,A64,Th105,Th107
          .= SumLM.j by A4,A64,VECTSP_9:3;
        hence SumLM.j = 0.K by A7,A63
          .= n0.j by A63,FINSEQ_2:57;
      end;
      dom RR=Seg len RR by FINSEQ_1:def 3;
      then consider k such that
A65:  m = k + 1 and
A66:  len Del(RR,i) = k by A13,A22,FINSEQ_3:104;
A67:  len SumLM=n by CARD_1:def 7;
      M1*(i,j) = Line(M1,i).j by A15,A16,MATRIX_0:def 7
        .= a * (M*(i,j)) by A3,A16,A14,A17,FVSUM_1:51;
      then a<>0.K by A11;
      then
A68:  m=the_rank_of R by A1,Th89;
A69:  len n0=n by CARD_1:def 7;
      then
A70:  width RR=width R by A3,A23,MATRIX11:def 3;
A71:  Line(RR,i)=n0 by A3,A13,A23,A69,MATRIX11:28;
      i<=m by A13,FINSEQ_1:1;
      then m=the_rank_of RLine(R,i,n0) by A68,A19,A59,A67,A69,A60,FINSEQ_1:14;
      then m=the_rank_of DelLine(RR,i) by A3,A23,A71,A70,Th90;
      then m<=k by A66,Th74;
      hence contradiction by A65,NAT_1:13;
    end;
    now
A72:  len M = m by MATRIX_0:def 2;
A73:  dom M=Seg len M by FINSEQ_1:def 3;
      let i;
      assume i in Seg m;
      then consider k such that
A74:  m = k + 1 and
A75:  len Del(M,i) = k by A73,A72,FINSEQ_3:104;
      assume Line(M,i) = n |-> 0.K;
      then the_rank_of DelLine(M,i) = m by A1,A3,Th90;
      then m<= k by A75,Th74;
      hence contradiction by A74,NAT_1:13;
    end;
    hence thesis by A4,A5,Th109;
  end;
end;
