reserve i,j,m,n,k for Nat,
  x,y for set,
  K for Field,
  a,L for Element of K;

theorem
  L <> 0.K implies ex M be Matrix of n,K st Jordan_block(L,n)~ = M & for
i,j st [i,j] in Indices M holds (i > j implies M*(i,j) = 0.K) & (i <= j implies
  M*(i,j) = - power(K).(-L",j-'i+1))
proof
  reconsider N=n as Element of NAT by ORDINAL1:def 12;
  defpred P[Nat,Nat,set] means ($1 > $2 implies $3 = 0.K) & ($1<= $2 implies
  $3 = -power(K).(-L",$2-'$1+1) );
A1: for i,j st [i,j] in [:Seg N, Seg N:] ex x be Element of K st P[i,j,x]
  proof
    let i,j such that
    [i,j] in [:Seg N,Seg N:];
    per cases;
    suppose
A2:   i>j;
      take 0.K;
      thus thesis by A2;
    end;
    suppose
A3:   i<=j;
      take -power(K).(-L",j-'i+1);
      thus thesis by A3;
    end;
  end;
  consider M be Matrix of N,K such that
A4: for i,j st [i,j] in Indices M holds P[i,j,M*(i,j)] from MATRIX_0:sch
  2(A1);
  set ONE=1.(K,n);
  set J=Jordan_block(L,n);
A5: Indices ONE= [:Seg n,Seg n:] by MATRIX_0:24;
  assume
A6: L <> 0.K;
  then
A7: J is invertible by Th3;
  reconsider M as Matrix of n,K;
  set MJ=M*J;
A8: Indices M=Indices J & Indices J=Indices ONE by MATRIX_0:26;
A9: width M=n by MATRIX_0:24;
A10: Indices MJ=Indices ONE by MATRIX_0:26;
A11: len J=n by MATRIX_0:24;
  now
    let i,j such that
A12: [i,j] in Indices ONE;
A13: i in Seg n by A5,A12,ZFMISC_1:87;
    set LL=Line(M,i);
A14: MJ*(i,j) = LL"*"Col(J,j) by A9,A10,A12,A11,MATRIX_3:def 4
      .= Col(J,j)"*"LL by FVSUM_1:90;
A15: j in Seg n by A5,A12,ZFMISC_1:87;
    then
A16: LL.j=M*(i,j) by A9,MATRIX_0:def 7;
A17: dom LL=Seg n by A9,FINSEQ_2:124;
    then
A18: LL/.j=LL.j by A15,PARTFUN1:def 6;
    now
      per cases;
      suppose
A19:    j=1;
        then
A20:    MJ*(i,j)= L* (M*(i,j)) by A9,A15,A18,A16,A14,Th7;
        now
          per cases;
          suppose
A21:        i=j;
            hence MJ*(i,j) = L*(-power(K).(-L",i-'i+1)) by A4,A8,A12,A20
              .= L*(-power(K).(-L",0+1)) by XREAL_1:232
              .= L*(-(-L")) by GROUP_1:50
              .= L*L" by RLVECT_1:17
              .= 1_K by A6,VECTSP_1:def 10
              .= ONE*(i,j) by A12,A21,MATRIX_1:def 3;
          end;
          suppose
A22:        i<>j;
            1<=i by A13,FINSEQ_1:1;
            then j<i by A19,A22,XXREAL_0:1;
            hence MJ*(i,j) = L*0.K by A4,A8,A12,A20
              .= 0.K
              .= ONE*(i,j) by A12,A22,MATRIX_1:def 3;
          end;
        end;
        hence ONE*(i,j)=MJ*(i,j);
      end;
      suppose
A23:    j<>1;
A24:    j>=1 by A15,FINSEQ_1:1;
        then reconsider j1=j-1 as Element of NAT by NAT_1:21;
        j1<=j1+1 & j<=n by A15,FINSEQ_1:1,NAT_1:11;
        then
A25:    n>=j1 by XXREAL_0:2;
        j1+1>0+1 by A23,A24,XXREAL_0:1;
        then j1>=1 by NAT_1:14;
        then
A26:    j1 in Seg n by A25;
        then
A27:    [i,j1] in Indices ONE by A5,A13,ZFMISC_1:87;
        LL/.j1=LL.j1 & LL.j1=M*(i,j1) by A9,A17,A26,MATRIX_0:def 7
,PARTFUN1:def 6;
        then
A28:    MJ*(i,j)= L* (M*(i,j))+M*(i,j1) by A9,A15,A18,A16,A14,A23,Th7;
        now
          per cases by XXREAL_0:1;
          suppose
A29:        i<j1+1;
            set P=power(K).(-L",j1-'i+1);
A30:        j-'i=j-i by A29,XREAL_1:233;
A31:        i<=j1 by A29,NAT_1:13;
            then
A32:        j1-'i=j1-i by XREAL_1:233;
            thus MJ*(i,j) = L* (M*(i,j))+(-P) by A4,A8,A27,A28,A31
              .= L*(-power(K).(-L",j-'i+1))+(-P) by A4,A8,A12,A29
              .= L*(-(-L")*P)+(-P) by A32,A30,GROUP_1:def 7
              .= L*((-(-L"))*P)+(-P) by VECTSP_1:9
              .= L*(L"*P)+(-P) by RLVECT_1:17
              .= (L*L")*P + (-P) by GROUP_1:def 3
              .= 1_K*P + (-P) by A6,VECTSP_1:def 10
              .= P + (-P)
              .= 0.K by RLVECT_1:def 10
              .= ONE*(i,j) by A12,A29,MATRIX_1:def 3;
          end;
          suppose
A33:        i=j1+1;
            then i>j1 by NAT_1:13;
            hence MJ*(i,j) = L* (M*(i,j))+0.K by A4,A8,A27,A28
              .= L* (M*(i,j)) by RLVECT_1:def 4
              .= L* (-power(K).(-L",i-'i+1)) by A4,A8,A12,A33
              .= L*(-power(K).(-L",0+1)) by XREAL_1:232
              .= L*(-(-L")) by GROUP_1:50
              .= L*L" by RLVECT_1:17
              .= 1_K by A6,VECTSP_1:def 10
              .= ONE*(i,j) by A12,A33,MATRIX_1:def 3;
          end;
          suppose
A34:        i>j1+1;
            then i>j1 by NAT_1:13;
            hence MJ*(i,j) = L* (M*(i,j))+0.K by A4,A8,A27,A28
              .= L* (M*(i,j)) by RLVECT_1:def 4
              .= L* 0.K by A4,A8,A12,A34
              .= 0.K
              .= ONE*(i,j) by A12,A34,MATRIX_1:def 3;
          end;
        end;
        hence MJ*(i,j)=ONE*(i,j);
      end;
    end;
    hence ONE*(i,j)=MJ*(i,j);
  end;
  then
A35: ONE=MJ by MATRIX_0:27;
  set JM=J*M;
A36: len M=n by MATRIX_0:24;
  take M;
A37: Indices JM=Indices ONE & width J=n by MATRIX_0:24,26;
  now
    let i,j such that
A38: [i,j] in Indices ONE;
A39: i in Seg n by A5,A38,ZFMISC_1:87;
    set i1=i+1;
A40: j in Seg n by A5,A38,ZFMISC_1:87;
A41: JM*(i,j)=Line(J,i)"*"Col(M,j) by A36,A37,A38,MATRIX_3:def 4;
    set C=Col(M,j);
A42: dom M=Seg n by A36,FINSEQ_1:def 3;
    then
A43: C.i=M*(i,j) by A39,MATRIX_0:def 8;
A44: dom C=Seg n by A36,FINSEQ_2:124;
    then
A45: C/.i=C.i by A39,PARTFUN1:def 6;
    now
      per cases;
      suppose
A46:    i=n;
        then
A47:    JM*(i,j)=L*(M*(i,j)) by A36,A39,A45,A43,A41,Th6;
        now
          per cases;
          suppose
A48:        i>j;
            hence JM*(i,j) = L*0.K by A4,A8,A38,A47
              .= 0.K
              .= ONE*(i,j) by A38,A48,MATRIX_1:def 3;
          end;
          suppose
A49:        i<=j;
            j<=n by A40,FINSEQ_1:1;
            then
A50:        j=n by A46,A49,XXREAL_0:1;
            hence JM*(i,j) = L*(-power(K).(-L",n-'n+1)) by A4,A8,A38,A46,A47
              .= L*(-power(K).(-L",0+1)) by XREAL_1:232
              .= L*(-(-L")) by GROUP_1:50
              .= L*L" by RLVECT_1:17
              .= 1_K by A6,VECTSP_1:def 10
              .= ONE*(i,j) by A38,A46,A50,MATRIX_1:def 3;
          end;
        end;
        hence JM*(i,j)=ONE*(i,j);
      end;
      suppose
A51:    i<>n;
        i<=n by A39,FINSEQ_1:1;
        then i<n by A51,XXREAL_0:1;
        then 1<=i1 & i1<=n by NAT_1:11,13;
        then
A52:    i1 in Seg n;
        then
A53:    [i1,j] in Indices M by A8,A5,A40,ZFMISC_1:87;
        C/.i1=C.i1 & C.i1=M*(i1,j) by A42,A44,A52,MATRIX_0:def 8,PARTFUN1:def 6
;
        then
A54:    JM*(i,j)=L*(M*(i,j)) + M*(i1,j) by A36,A39,A45,A43,A41,A51,Th6;
        now
          per cases by XXREAL_0:1;
          suppose
A55:        i>j;
            then i1>j by NAT_1:13;
            hence JM*(i,j) = L*(M*(i,j)) + 0.K by A4,A53,A54
              .= L*(M*(i,j)) by RLVECT_1:def 4
              .= L*0.K by A4,A8,A38,A55
              .= 0.K
              .= ONE*(i,j) by A38,A55,MATRIX_1:def 3;
          end;
          suppose
A56:        i=j;
            then i1>j by NAT_1:13;
            hence JM*(i,j) = L*(M*(i,j)) + 0.K by A4,A53,A54
              .= L*(M*(i,i)) by A56,RLVECT_1:def 4
              .= L*(-power(K).(-L",i-'i+1)) by A4,A8,A38,A56
              .= L*(-power(K).(-L",0+1)) by XREAL_1:232
              .= L*(-(-L")) by GROUP_1:50
              .= L*L" by RLVECT_1:17
              .= 1_K by A6,VECTSP_1:def 10
              .= ONE*(i,j) by A38,A56,MATRIX_1:def 3;
          end;
          suppose
A57:        i<j;
            set P=power(K).(-L",j-'i1+1);
A58:        j-'i=j-i by A57,XREAL_1:233;
A59:        i1<=j by A57,NAT_1:13;
            then
A60:        j-'i1=j-i1 by XREAL_1:233;
            thus JM*(i,j) = L*(M*(i,j)) + (-P) by A4,A53,A54,A59
              .= L*(-power(K).(-L",j-'i+1)) + (-P) by A4,A8,A38,A57
              .= L*(-(-L")*P) + (-P) by A60,A58,GROUP_1:def 7
              .= L*((-(-L"))*P) + (-P) by VECTSP_1:9
              .= L*(L"*P) + (-P) by RLVECT_1:17
              .= (L*L")*P + (-P) by GROUP_1:def 3
              .= 1_K*P + (-P) by A6,VECTSP_1:def 10
              .= P + (-P)
              .= 0.K by RLVECT_1:def 10
              .= ONE*(i,j) by A38,A57,MATRIX_1:def 3;
          end;
        end;
        hence ONE*(i,j)=JM*(i,j);
      end;
    end;
    hence ONE*(i,j)=JM*(i,j);
  end;
  then ONE = JM by MATRIX_0:27;
  then M is_reverse_of J by A35,MATRIX_6:def 2;
  hence thesis by A4,A7,MATRIX_6:def 4;
end;
