reserve x,y for set,
  i,j,k,l,m,n for Nat,
  K for Field,
  N for without_zero finite Subset of NAT,
  a,b for Element of K,
  A,B,B1,B2,X,X1,X2 for (Matrix of K),
  A9 for (Matrix of m,n,K),
  B9 for (Matrix of m,k,K);
reserve D for non empty set,
  bD for FinSequence of D,
  b,f,g for FinSequence of K,
  MD for Matrix of D;

theorem Th50:
  for A be Matrix of n,m,K, B be Matrix of n,l,K, N st card N = n
& N c= Seg m & n>0 & Segm(A,Seg n,N) = 1.(K,n) ex X be Matrix of m,l,K st Segm(
X,Seg m \ N,Seg l) = 0.(K,m-'n,l) & Segm(X,N,Seg l) = B & X in Solutions_of(A,B
  )
proof
  let A be Matrix of n,m,K, B be Matrix of n,l,K, N such that
A1: card N = n and
A2: N c= Seg m and
A3: n>0 and
A4: Segm(A,Seg n,N) = 1.(K,n);
A5: width A=m by A3,MATRIX_0:23;
  set Z=0.(K,m,l);
  set SN=Seg m\N;
A6: card Seg m=m by FINSEQ_1:57;
  then
A7: m-'n=m-n & card SN=m-n by A1,A2,CARD_2:44,NAT_1:43,XREAL_1:233;
  set ZERO=0.(K,m-'n,l);
A8: N misses SN by XBOOLE_1:79;
  [:N,Seg l:]/\[:SN,Seg l:] = [:N/\SN,Seg l:] by ZFMISC_1:99
    .= [:{},Seg l:] by A8
    .= {} by ZFMISC_1:90;
  then
A9: for i,j,bi,bj,ci,cj be Nat st [i,j] in [:N,Seg l:]/\[:SN,Seg l:] & bi =
Sgm N".i & bj = Sgm (Seg l)".j & ci = Sgm SN".i & cj = Sgm (Seg l)".j holds B*(
  bi,bj) = ZERO*(ci,cj);
A10: Indices A=[:Seg n,Seg m:] by A3,MATRIX_0:23;
A11: n <=card Seg m by A1,A2,NAT_1:43;
  then
A12: len Z=m & width Z=l by A3,A6,MATRIX_0:23;
A13: Indices Z=[:Seg m,Seg l:] by A3,A11,A6,MATRIX_0:23;
  then
A14: [:N,Seg l:] c= Indices Z by A2,ZFMISC_1:95;
A15: SN c= Seg m by XBOOLE_1:36;
  then card Seg l=l & [:SN,Seg l:] c= Indices Z by A13,FINSEQ_1:57,ZFMISC_1:95;
  then consider X be Matrix of m,l,K such that
A16: Segm(X,N,Seg l) = B and
A17: Segm(X,SN,Seg l) = ZERO and
  for i,j st [i,j] in Indices X\([:N,Seg l:]\/[:SN,Seg l:]) holds X*(i,j)
  = Z*(i,j) by A1,A7,A12,A14,A9,Th9;
  set AX=A*X;
A18: len X=m by A3,A11,A6,MATRIX_0:23;
  then
A19: dom X=Seg m by FINSEQ_1:def 3;
  len A=n by A3,MATRIX_0:23;
  then
A20: len AX=n by A5,A18,MATRIX_3:def 4;
  take X;
  thus Segm(X,SN,Seg l) = ZERO & Segm(X,N,Seg l) = B by A16,A17;
A21: Indices X=[:Seg m,Seg l:] by A3,A11,A6,MATRIX_0:23;
A22: width B=l by A3,MATRIX_0:23;
A23: width X=l by A3,A11,A6,MATRIX_0:23;
  then width AX=l by A5,A18,MATRIX_3:def 4;
  then reconsider AX as Matrix of n,l,K by A20,MATRIX_0:51;
A24: Indices B=[:Seg n,Seg l:] by A3,MATRIX_0:23;
  now
A25: [:N,Seg l:] c= Indices X by A2,A21,ZFMISC_1:95;
    let i,j such that
A26: [i,j] in Indices AX;
    reconsider I=i,J=j as Element of NAT by ORDINAL1:def 12;
A27: Indices AX=Indices B by MATRIX_0:26;
    then
A28: i in Seg n by A24,A26,ZFMISC_1:87;
    len Line(A,i)=m & len Col(X,j)=m by A5,A18,CARD_1:def 7;
    then len mlt(Line(A,i),Col(X,j))=m by MATRIX_3:6;
    then
A29: dom mlt(Line(A,i),Col(X,j))=Seg m by FINSEQ_1:def 3;
A30: rng Sgm (Seg l)=Seg l by FINSEQ_1:def 14;
A31: rng Sgm (Seg n)=Seg n & [:Seg n,N:] c= Indices A
     by A2,A10,FINSEQ_1:def 14,ZFMISC_1:95;
A32: rng Sgm N=N by FINSEQ_1:def 14;
    dom Sgm N=Seg n by A1,FINSEQ_3:40;
    then
A33: Sgm N.i in N by A28,A32,FUNCT_1:def 3;
A34: j in Seg l by A22,A26,A27,ZFMISC_1:87;
    then
A35: j = (idseq l).j by FINSEQ_2:49
      .= Sgm (Seg l).j by FINSEQ_3:48;
    then [Sgm N.I,Sgm(Seg l).J] in Indices X by A2,A21,A34,A33,ZFMISC_1:87;
    then
A36: [I,J] in Indices B by A16,A32,A30,A25,MATRIX13:17;
A37: rng Sgm SN=SN by FINSEQ_1:def 14;
A38: i = (idseq n).i by A28,FINSEQ_2:49
      .= Sgm (Seg n).i by FINSEQ_3:48;
    then [Sgm (Seg n).i,Sgm N.i] in Indices A by A2,A10,A28,A33,ZFMISC_1:87;
    then
A39: [I,I] in Indices 1.(K,n) by A4,A32,A31,MATRIX13:17;
A40: [:SN,Seg l:] c= Indices X by A15,A21,ZFMISC_1:95;
A41: now
      let kk be Nat such that
A42:  kk in Seg m and
A43:  kk <> Sgm N.I;
      per cases by A42,XBOOLE_0:def 5;
      suppose
A44:    kk in N;
        then consider x being object such that
A45:    x in dom Sgm N and
A46:    Sgm N.x=kk by A32,FUNCT_1:def 3;
        reconsider x as Element of NAT by A45;
        [Sgm (Seg n).i,Sgm N.x] in Indices A by A2,A10,A28,A38,A44,A46,
ZFMISC_1:87;
        then
A47:    [I,x] in Indices 1.(K,n) by A4,A32,A31,MATRIX13:17;
A48:    Col(X,j).kk = X*(kk,j) by A2,A19,A44,MATRIX_0:def 8;
        Line(A,i).(Sgm N.x) = A*(I,Sgm N.x) by A2,A5,A44,A46,MATRIX_0:def 7
          .= (Segm(A,Seg n,N))*(I,x) by A4,A38,A47,MATRIX13:def 1
          .= 0.K by A4,A43,A46,A47,MATRIX_1:def 3;
        hence
        mlt(Line(A,i),Col(X,j)).kk = 0.K*(X*(kk,j)) by A2,A5,A18,A44,A46,A48,
FVSUM_1:61
          .= 0.K;
      end;
      suppose
A49:    kk in SN;
        then consider x being object such that
A50:    x in dom Sgm SN and
A51:    Sgm SN.x=kk by A37,FUNCT_1:def 3;
        reconsider x as Element of NAT by A50;
A52:    Line(A,i).kk=A*(I,Sgm SN.x) by A5,A42,A51,MATRIX_0:def 7;
        [Sgm SN.x,Sgm (Seg l).J] in Indices X by A15,A21,A34,A35,A49,A51,
ZFMISC_1:87;
        then
A53:    [x,J] in Indices ZERO by A17,A30,A37,A40,MATRIX13:17;
        Col(X,j).kk = X*(Sgm SN.x,Sgm (Seg l).j) by A15,A19,A35,A49,A51,
MATRIX_0:def 8
          .= ZERO*(x,J) by A17,A53,MATRIX13:def 1
          .= 0.K by A53,MATRIX_3:1;
        hence
        mlt(Line(A,i),Col(X,j)).kk = (A*(I,Sgm SN.x))*0.K by A5,A18,A42,A52,
FVSUM_1:61
          .= 0.K;
      end;
    end;
A54: Col(X,j).(Sgm N.i) = X*(Sgm N.i,j) by A2,A19,A33,MATRIX_0:def 8
      .= B*(I,J) by A16,A35,A36,MATRIX13:def 1;
    Line(A,i).(Sgm N.i) = A*(I,Sgm N.I) by A2,A5,A33,MATRIX_0:def 7
      .= (Segm(A,Seg n,N))*(I,I) by A4,A38,A39,MATRIX13:def 1
      .= 1_K by A4,A39,MATRIX_1:def 3;
    then
A55: mlt(Line(A,i),Col(X,j)).(Sgm N.i) = 1_K * (B*(I,J)) by A2,A5,A18,A33,A54,
FVSUM_1:61
      .= B*(I,J);
    AX*(i,j) = Line(A,i)"*"Col(X,j) by A5,A18,A26,MATRIX_3:def 4
      .= Sum(mlt(Line(A,i),Col(X,j)));
    hence AX*(i,j)=B*(i,j) by A2,A33,A55,A29,A41,MATRIX_3:12;
  end;
  then AX=B by MATRIX_0:27;
  hence thesis by A5,A22,A18,A23;
end;
