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;

theorem Th42:
  i in dom A & width A = width DelLine(A,i) implies DelLine(
  block_diagonal(G^<*A*>,a),Sum Len G+i) = block_diagonal(G^<*DelLine(A,i)*>,a)
proof
  assume that
A1: i in dom A and
A2: width A= width DelLine(A,i);
A3: i in Seg len A by A1,FINSEQ_1:def 3;
  set da=DelLine(A,i);
  consider m such that
A4: len A = m + 1 and
A5: len da = m by A1,FINSEQ_3:104;
  set Si=Sum Len G+i;
  set bG=block_diagonal(G,a);
  set DA=<*da*>;
  set AA=<*A*>;
  set BG=<*bG*>;
  set bGA=block_diagonal(<*bG,A*>,a);
  set bGdA=block_diagonal(<*bG,da*>,a);
A6: Seg len bGA=dom bGA by FINSEQ_1:def 3;
A7: len bGdA=Sum Len (BG^DA) by Def5;
  then
A8: len bGdA=m+len bG by A5,Th16;
A9: len bG=Sum Len G by Def5;
A10: len bGA=Sum Len (BG^AA) by Def5;
  then
A11: len bGA=len A +len bG by Th16;
  then
A12: len bGA=(m+len bG) +1 by A4;
A13: len bGdA=len da +len bG by A7,Th16;
A14: now
    m+len bG <=len bGA by A12,NAT_1:11;
    then
A15: Seg (m+len bG) c= Seg len bGA by FINSEQ_1:5;
    reconsider da9=da as Matrix of len da,width da,K by MATRIX_0:51;
    reconsider A9=A as Matrix of len A,width A,K by MATRIX_0:51;
    let j such that
A16: 1<=j and
A17: j<=m+len bG;
A18: j in Seg (m+len bG) by A16,A17;
A19: 1<=1+j by NAT_1:11;
    j+1<=len bGA by A12,A17,XREAL_1:7;
    then
A20: j+1 in Seg len bGA by A19;
    now
      per cases;
      suppose
A21:    j<=len bG;
        then
A22:    j in dom bG by A16,FINSEQ_3:25;
        0<i by A3;
        then j+0<len bG+i by A21,XREAL_1:8;
        then j<Si by Def5;
        hence Del(bGA,Si).j = bGA.j by FINSEQ_3:110
          .= Line(bGA,j) by A10,A18,A15,MATRIX_0:52
          .= Line(bG,j)^(width da|-> a) by A2,A22,Th23
          .= Line(bGdA,j) by A22,Th23
          .= bGdA.j by A5,A7,A13,A18,MATRIX_0:52;
      end;
      suppose
A23:    j>len bG;
        then reconsider jL=j-len bG as Element of NAT by NAT_1:21;
A24:    0+1<=jL+1 by NAT_1:13;
        jL+len bG <=m +len bG by A17;
        then
A25:    jL<=m by XREAL_1:8;
        then
A26:    jL+1<=len A by A4,XREAL_1:7;
        then
A27:    jL+1 in dom A by A24,FINSEQ_3:25;
        jL<>0 by A23;
        then
A28:    1<=jL by NAT_1:14;
        then
A29:    jL in dom da by A5,A25,FINSEQ_3:25;
A30:    jL+1 in Seg len A by A24,A26;
A31:    jL in Seg len da by A5,A28,A25;
A32:    jL<=len A by A4,A25,NAT_1:13;
        then
A33:    jL in Seg len A by A28;
A34:    jL in dom A by A28,A32,FINSEQ_3:25;
        now
          per cases;
          suppose
A35:        j<Si;
            then jL+len bG<i+len bG by Def5;
            then
A36:        jL<i by XREAL_1:7;
A37:        Line(A,jL) = A9.(jL) by A33,MATRIX_0:52
              .= da9.(jL) by A36,FINSEQ_3:110
              .= Line(da,jL) by A31,MATRIX_0:52;
            thus Del(bGA,Si).j = bGA.j by A35,FINSEQ_3:110
              .= Line(bGA,jL+len bG)by A10,A18,A15,MATRIX_0:52
              .=(width bG|->a)^Line(da,jL) by A34,A37,Th23
              .= Line(bGdA,jL+len bG) by A29,Th23;
          end;
          suppose
A38:        j>=Si;
            then jL+len bG>=i+len bG by Def5;
            then
A39:        jL>=i by XREAL_1:8;
A40:        Line(A,1+jL) = A9.(1+jL) by A30,MATRIX_0:52
              .= da9.jL by A1,A4,A25,A39,FINSEQ_3:111
              .= Line(da,jL) by A31,MATRIX_0:52;
            thus Del(bGA,Si).j = bGA.(j+1) by A9,A11,A12,A3,A6,A17,A38,
FINSEQ_1:60,FINSEQ_3:111
              .= Line(bGA,jL+1+len bG) by A10,A20,MATRIX_0:52
              .= (width bG|->a)^Line(da,jL) by A27,A40,Th23
              .= Line(bGdA,jL+len bG) by A29,Th23;
          end;
        end;
        hence Del(bGA,Si).j=bGdA.j by A5,A7,A13,A18,MATRIX_0:52;
      end;
    end;
    hence Del(bGA,i+Sum Len G).j=bGdA.j;
  end;
A41: block_diagonal(G^DA,a)=bGdA by Th35;
A42: block_diagonal(G^AA,a)=bGA by Th35;
  len Del(bGA,Si)=m+len bG by A9,A11,A12,A3,A6,FINSEQ_1:60,FINSEQ_3:109;
  hence thesis by A8,A42,A41,A14;
end;
