reserve i,j,m,n,k for Nat,
  x,y for set,
  K for Field,
  a,a1,a2 for Element of K,
  D for non empty set,
  d,d1,d2 for Element of D,
  M,M1,M2 for (Matrix of D),
  A,A1,A2,B1,B2 for (Matrix of K),
  f,g for FinSequence of NAT;
reserve F,F1,F2 for FinSequence_of_Matrix of D,
  G,G9,G1,G2 for FinSequence_of_Matrix of K;
reserve S,S1,S2 for FinSequence_of_Square-Matrix of D,
  R,R1,R2 for FinSequence_of_Square-Matrix of K;
reserve N for (Matrix of n,K),
  N1 for (Matrix of m,K);

theorem Th54:
  len A1 <> width A1 & N = block_diagonal(<*A1,A2*>,0.K) implies Det N = 0.K
proof
  defpred P[Nat] means for A1 st len A1<>width A1 & width A1=$1 for n,N st N=
  block_diagonal(<*A1,A2*>,0.K) holds Det N=0.K;
A1: for k st P[k] holds P[k+1]
  proof
    let k such that
A2: P[k];
    set k1=k+1;
    let A1 such that
A3: len A1<>width A1 and
A4: width A1=k1;
A5: Sum Len <*A1,A2*>=len A1+len A2 by Th16;
    1<=k1 by NAT_1:14;
    then
A6: 1 in Seg width A1 by A4;
A7: len(A1^A2)=len A1+len A2 by FINSEQ_1:22;
A8: Sum Width <*A1,A2*>=width A1+width A2 by Th20;
    let n,N such that
A9: N=block_diagonal(<*A1,A2*>,0.K);
A10: len N=Sum Len <*A1,A2*> by A9,Def5;
    set C=LaplaceExpC(N,1);
A11: n=len N by MATRIX_0:24;
    then
A12: len C=len N by LAPLACE:def 8;
A13: len A1<>0 by A3,MATRIX_0:def 3;
    then
A14: 1+0<=len N by A10,A5,NAT_1:14;
    then
A15: 1 in Seg n by A11;
A16: width N= Sum Width <*A1,A2*> by A9,Def5;
    set L0=len N|->0.K;
A17: n=width N by MATRIX_0:24;
A18: len A1>=1 by A13,NAT_1:14;
A19: now
      let i such that
A20:  1<=i and
A21:  i<=len N;
A22:  i in Seg n by A11,A20,A21;
      i in dom C by A12,A20,A21,FINSEQ_3:25;
      then
A23:  C.i=N*(i,1)*Cofactor(N,i,1) by LAPLACE:def 8;
A24:  N*(i,1)=Line(N,i).1 by A17,A15,MATRIX_0:def 7;
A25:  i in dom (A1^A2) by A10,A5,A7,A20,A21,FINSEQ_3:25;
      now
        per cases by A25,FINSEQ_1:25;
        suppose
A26:      i in dom A1;
          now
            per cases by A18,XXREAL_0:1;
            suppose
A27:          len A1=1;
              then k<>0 by A3,A4;
              then k in Seg k by FINSEQ_1:3;
              then
A28:          1<=k by FINSEQ_1:1;
              then 1+1<=k1 by XREAL_1:7;
              then
A29:          2 in Seg k1;
A30:          1<=i by A26,FINSEQ_3:25;
              i<=1 by A26,A27,FINSEQ_3:25;
              then
A31:          i=1 by A30,XXREAL_0:1;
              set Q=Seg n\{1};
              Seg 1 c= Seg n by A11,A14,FINSEQ_1:5;
              then
A32:          card Q = card Seg n-card Seg 1 by CARD_2:44,FINSEQ_1:2
                .= card Seg n-1 by FINSEQ_1:57
                .= n-1 by FINSEQ_1:57
                .= k+width A2 by A4,A17,A16,A8;
              then
A33:          card Q = k+width A2+1-'1 by NAT_D:34
                .= n-'1 by A4,A9,A17,A8,Def5;
              1+0<=card Q by A32,A28,XREAL_1:7;
              then
A34:          1 in Seg card Q;
              Delete(N,i,1) = Deleting(N,i,1) by A15,A22,LAPLACE:def 1
                .= Segm(N,Q,Q) by A31,MATRIX13:58;
              then
A35:          Col(Delete(N,i,1),1) = Col(N,Sgm Q.1)*Sgm Q by A11,A34,
MATRIX13:49,XBOOLE_1:36;
              now
A36:            dom (len A2|->0.K)=Seg len A2 by FINSEQ_2:124;
A37:            n=1+card Q by A4,A9,A17,A8,A32,Def5;
A38:            len Col(A1,2)=1 by A27,CARD_1:def 7;
                let j be Element of NAT such that
A39:            j in Seg (n-'1);
                dom Sgm Q=Seg card Q by FINSEQ_3:40;
                hence Col(Delete(N,i,1),1).j = Col(N,Sgm Q.1).((Sgm Q).j)
                by A33,A35,A39,FUNCT_1:13
                  .= Col(N,1+1).(Sgm Q.j) by A34,A37,FINSEQ_1:2,MATRIX15:8
                  .= Col(N,1+1).(j+1) by A33,A39,A37,FINSEQ_1:2,MATRIX15:8
                  .= (Col(A1,2)^(len A2|->0.K)).(j+1)by A4,A9,A29,Th24
                  .= (len A2|->0.K).j by A4,A10,A11,A17,A16,A5,A8,A27,A32,A33
,A39,A38,A36,FINSEQ_1:def 7
                  .= 0.K by A4,A10,A11,A17,A16,A5,A8,A27,A32,A33,A39,
FINSEQ_2:57;
              end;
              hence Det Delete(N,i,1)=0.K by A33,A34,MATRIX_9:53;
            end;
            suppose
A40:          len A1>1;
              set DL=DelLine(A1,i);
              set DC=DelCol(DL,1);
A41:          k1-'1=k by NAT_D:34;
              reconsider L1=len A1-1 as Element of NAT by A40,NAT_1:21;
A42:          len DC=len DL by MATRIX_0:def 13;
A43:          width A1=width DL by A40,LAPLACE:4;
              then
A44:          width DC=width A1-'1 by A6,LAPLACE:3;
A45:          Delete(N,i,1) = Deleting(N,i,1) by A15,A22,LAPLACE:def 1
                .= DelCol(DelLine(N,i),1)
                .= DelCol(block_diagonal(<*DL*>^<*A2*>,0.K),1) by A9,A26,A43
,Th41
                .= block_diagonal(<*DC,A2*>,0.K) by A6,A43,Th43;
              len A1=L1+1;
              then len DC<>width DC by A3,A4,A26,A44,A42,A41,FINSEQ_3:109;
              hence 0.K=Det Delete(N,i,1) by A2,A4,A44,A45,NAT_D:34;
            end;
          end;
          then 0.K = Cofactor(N,i,1);
          hence 0.K=C.i by A23;
        end;
        suppose
A46:      ex j st j in dom A2 & i=len A1+j;
A47:      dom (width A1|->0.K)=Seg width A1 by FINSEQ_2:124;
          consider j such that
A48:      j in dom A2 and
A49:      i=len A1+j by A46;
          N*(i,1) = ((width A1|->0.K)^Line(A2,j)).1 by A9,A24,A48,A49,Th23
            .= (width A1|->0.K).1 by A6,A47,FINSEQ_1:def 7
            .= 0.K by A6,FINSEQ_2:57;
          hence 0.K=C.i by A23;
        end;
      end;
      hence C.i=L0.i by A11,A22,FINSEQ_2:57;
    end;
    len L0=len N by CARD_1:def 7;
    then C=L0 by A12,A19;
    then C=len N|->(0.K*0.K);
    then Sum C = Sum (0.K*(len N|->0.K)) by FVSUM_1:53
      .= 0.K*Sum(len N|->0.K) by FVSUM_1:73
      .= 0.K;
    hence thesis by A15,LAPLACE:27;
  end;
A50: P[0]
  proof
    let A1 such that
A51: len A1<>width A1 and
A52: width A1=0;
A53: len A1 in Seg len A1 by A51,A52,FINSEQ_1:3;
A54: Sum Width <*A1,A2*>= width A1+width A2 by Th20;
A55: Sum Len <*A1,A2*>=len A1+len A2 by Th16;
A56: len A1<=len A1+len A2 by NAT_1:11;
    let n,N such that
A57: N=block_diagonal(<*A1,A2*>,0.K);
A58: width N=Sum Width <*A1,A2*> by A57,Def5;
    len N=Sum Len <*A1,A2*> by A57,Def5;
    then
A59: Seg len A1 c= Seg len N by A55,A56,FINSEQ_1:5;
A60: n=len N by MATRIX_0:def 2;
    dom A1=Seg len A1 by FINSEQ_1:def 3;
    then Line(N,len A1) = Line(A1,len A1)^(width A2|->0.K) by A57,A53,Th23
      .= (<*>(the carrier of K))^(width A2|->0.K) by A52
      .= width A2|->0.K by FINSEQ_1:34
      .= 0.K * Line(N,len A1) by A52,A58,A54,FVSUM_1:58;
    hence Det N = Det RLine(N,len A1,0.K*Line(N,len A1)) by MATRIX11:30
      .= 0.K*Det N by A60,A53,A59,MATRIX11:35
      .= 0.K;
  end;
  for n holds P[n] from NAT_1:sch 2(A50,A1);
  hence thesis;
end;
