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 Th52:
  Det block_diagonal(<*N,N1*>,0.K) = Det N * Det N1
proof
  defpred P[Nat] means for n,m,N,N1 st n=$1 holds Det block_diagonal(<*N,N1*>,
  0.K) = (Det N) * (Det N1);
A1: for i st P[i] holds P[i+1]
  proof
    let i such that
A2: P[i];
    set i1=i+1;
    let n,m,N,N1 such that
A3: n=i1;
    1<=i+m+1 by NAT_1:11;
    then
A4: 1 in Seg (n+m) by A3;
    1<=i1 by NAT_1:11;
    then
A5: 1 in Seg n by A3;
    set L0=len N1|->0.K;
    reconsider nn=n as Element of NAT by ORDINAL1:def 12;
    set D=Det N1;
    set L1=LaplaceExpL(N,1);
    set NN=<*N,N1*>;
    reconsider M=N as Matrix of K;
    set bN=block_diagonal(NN,0.K);
    set L=LaplaceExpL(bN,1);
A6: width N=n by MATRIX_0:24;
    set Ln=L|n;
A7: len L1=n by LAPLACE:def 7;
    set L9n=L/^n;
A8: L=(L|n)^(L/^n) by RFINSEQ:8;
A9: len N=n by MATRIX_0:24;
    then
A10: dom N=Seg n by FINSEQ_1:def 3;
    reconsider L1 as Element of nn-tuples_on the carrier of K by A7,FINSEQ_2:92
;
A11: len N1=m by MATRIX_0:24;
    then
A12: len L0=m by CARD_1:def 7;
A13: Sum Len NN=len N+len N1 by Th16;
    then
A14: len L=n+m by A9,A11,LAPLACE:def 7;
    then
A15: len Ln=n by FINSEQ_1:59,NAT_1:11;
A16: width bN=Sum Len NN by MATRIX_0:24;
A17: now
A18:  i=n-'1 by A3,NAT_D:34;
      let j such that
A19:  1<=j and
A20:  j<=n;
A21:  len Delete(N,1,j)=n-'1 by MATRIX_0:def 2;
A22:  j in dom Ln by A15,A19,A20,FINSEQ_3:25;
      then j in dom L/\Seg n by RELAT_1:61;
      then
A23:  j in dom L by XBOOLE_0:def 4;
      j in dom L1 by A7,A19,A20,FINSEQ_3:25;
      then
A24:  N*(1,j)*Cofactor(N,1,j)=L1.j by LAPLACE:def 7;
A25:  i+m+1-'1=i+m by NAT_D:34;
A26:  dom Line(N,1)=Seg n by A6,FINSEQ_2:124;
A27:  dom Ln= Seg n by A15,FINSEQ_1:def 3;
A28:  dom L=Seg (n+m) by A14,FINSEQ_1:def 3;
      then
A29:  Delete(bN,1,j) = Deleting(bN,1,j) by A13,A9,A11,A4,A23,LAPLACE:def 1
        .= block_diagonal(<*Deleting(N,1,j)*>^<*N1*>,0.K) by A5,A10,A22,A27
,Th47
        .= block_diagonal(<*Delete(N,1,j),N1*>,0.K) by A5,A22,A27,LAPLACE:def 1
;
      Minor(N,1,j) *D = Det block_diagonal(<*Delete(N,1,j),N1*>,0.K) by A2,A3,
NAT_D:34
        .= Minor(bN,1,j) by A3,A13,A9,A11,A29,A18,A25,A21,Th16;
      then
A30:  Cofactor(bN,1,j)= D*Cofactor(N,1,j) by GROUP_1:def 3;
A31:  bN*(1,j) = Line(block_diagonal(<*M,N1*>,0.K),1).j by A16,A13,A9,A11,A23
,A28,MATRIX_0:def 7
        .= (Line(N,1)^(width N1|->0.K)).j by A5,A10,Th23
        .= Line(N,1).j by A22,A27,A26,FINSEQ_1:def 7
        .= N*(1,j) by A6,A22,A27,MATRIX_0:def 7;
      thus Ln.j = L.j by A22,FUNCT_1:47
        .= N*(1,j)*(D*Cofactor(N,1,j)) by A23,A30,A31,LAPLACE:def 7
        .= D*(N*(1,j)*Cofactor(N,1,j)) by GROUP_1:def 3
        .= (D*L1).j by A22,A27,A24,FVSUM_1:51;
    end;
    n<=n+m by NAT_1:11;
    then
A32: len L9n=(n+m)-n by A14,RFINSEQ:def 1;
A33: width N1=m by MATRIX_0:24;
    now
A34:  len Line(N,1)=n by A6,CARD_1:def 7;
      let i such that
A35:  1<=i and
A36:  i<=m;
A37:  i in Seg m by A35,A36;
A38:  i in dom L0 by A12,A35,A36,FINSEQ_3:25;
A39:  i in dom L9n by A32,A35,A36,FINSEQ_3:25;
      then
A40:  n+i in dom L by FINSEQ_5:26;
      dom L=Seg width bN by A16,A13,A9,A11,A14,FINSEQ_1:def 3;
      then
A41:  bN*(1,i+n) = Line(block_diagonal(<*M,N1*>,0.K),1).(i+n) by A40,
MATRIX_0:def 7
        .= (Line(N,1)^L0).(i+n) by A11,A33,A5,A10,Th23
        .= L0.i by A38,A34,FINSEQ_1:def 7
        .= 0.K by A11,A37,FINSEQ_2:57;
      thus L9n.i = L9n/.i by A39,PARTFUN1:def 6
        .= L/.(i+n) by A39,FINSEQ_5:27
        .= L.(i+n) by A40,PARTFUN1:def 6
        .= bN*(1,i+n)*Cofactor(bN,1,i+n) by A40,LAPLACE:def 7
        .= 0.K by A41
        .= L0.i by A11,A37,FINSEQ_2:57;
    end;
    then
A42: L/^n=(len N1) |->0.K by A32,A12;
    len (D*L1)=nn by A7,MATRIXR1:16;
    then L|n=D*L1 by A15,A17;
    then Sum L = Sum (D*L1)+Sum(len N1|->0.K) by A42,A8,RLVECT_1:41
      .= Sum (D*L1)+Sum (len N1|->(0.K*0.K))
      .= Sum (D*L1)+Sum (0.K*(len N1|->0.K)) by FVSUM_1:53
      .= D*Sum L1+Sum (0.K*(len N1|->0.K)) by FVSUM_1:73
      .= D*Sum L1+0.K*Sum (len N1|->0.K) by FVSUM_1:73
      .= D*Sum L1+0.K
      .= D*Sum L1 by RLVECT_1:def 4
      .= D*Det N by A5,LAPLACE:25;
    hence thesis by A13,A9,A11,A4,LAPLACE:25;
  end;
A43: P[0]
  proof
    let n,m,N,N1 such that
A44: n=0;
A45: len N=n by MATRIX_0:def 2;
    then N={} by A44;
    then
A46: block_diagonal(<*N,N1*>,0.K) = block_diagonal(<*N1*>,0.K) by Th40
      .= N1 by Th34;
    len N1=m by MATRIX_0:def 2;
    then Sum Len <*N,N1*>=0+m by A44,A45,Th16;
    hence Det block_diagonal(<*N,N1*>,0.K) = (Det N1)*1_K by A46
      .= Det N*Det N1 by A44,MATRIXR2:41;
  end;
  for i holds P[i] from NAT_1:sch 2(A43,A1);
  hence thesis;
end;
