reserve

  k,n,m,i,j for Element of NAT,
  K for Field;
reserve L for non empty addLoopStr;
reserve G for non empty multLoopStr;

theorem Th29:
  for A being Matrix of n,K holds A=1.(K,n) iff for i,j being
  Nat st 1<=i & i<=n & 1<=j & j<=n holds A*(i,j)=IFEQ(i,j,1.K,0.K)
proof
  let A be Matrix of n,K;
A1: Indices A=[: Seg n,Seg n :] by MATRIX_0:24;
  thus A=1.(K,n) implies for i,j being Nat st 1<=i & i<=n & 1<=j &
  j<=n holds A*(i,j)=IFEQ(i,j,1.K,0.K)
  proof
    assume
A2: A=1.(K,n);
    let i,j be Nat;
    assume 1<=i & i<=n & 1<=j & j<=n;
    then
A3: [i,j] in Indices A by MATRIX_0:31;
    per cases;
    suppose
A4:   i=j;
      then A*(i,j)=1.K by A2,A3,MATRIX_1:def 3;
      hence thesis by A4,FUNCOP_1:def 8;
    end;
    suppose
A5:   i<>j;
      then A*(i,j)=0.K by A2,A3,MATRIX_1:def 3;
      hence thesis by A5,FUNCOP_1:def 8;
    end;
  end;
A6: len (1.(K,n))=n & width (1.(K,n))=n by MATRIX_0:24;
A7: Indices (1.(K,n))=[: Seg n,Seg n :] by MATRIX_0:24;
A8: width A=n by MATRIX_0:24;
  thus (for i,j being Nat st 1<=i & i<=n & 1<=j & j<=n holds A*(i,j
  )=IFEQ(i,j,1.K,0.K)) implies A=1.(K,n)
  proof
    assume
A9: for i,j being Nat st 1<=i & i<=n & 1<=j & j<=n holds A
    *(i,j)=IFEQ(i,j,1.K,0.K);
A10: for i,j being Nat st [i,j] in Indices A holds A*(i,j) = (1.(K,n))*(i, j)
    proof
      let i,j be Nat;
      reconsider i0=i,j0=j as Element of NAT by ORDINAL1:def 12;
      assume
A11:  [i,j] in Indices A;
      then j in Seg n by A8,ZFMISC_1:87;
      then
A12:  1<=j & j<=n by FINSEQ_1:1;
      i in Seg n by A1,A11,ZFMISC_1:87;
      then 1<=i & i<=n by FINSEQ_1:1;
      then
A13:  A*(i0,j0)=IFEQ(i0,j0,1.K,0.K) by A9,A12;
      per cases;
      suppose
A14:    i0=j0;
        then A*(i0,j0)=1_K by A13,FUNCOP_1:def 8;
        hence thesis by A1,A7,A11,A14,MATRIX_1:def 3;
      end;
      suppose
A15:    i0<>j0;
        then A*(i0,j0)=0.K by A13,FUNCOP_1:def 8;
        hence thesis by A1,A7,A11,A15,MATRIX_1:def 3;
      end;
    end;
    len A = len (1.(K,n)) & width A = width (1.(K,n)) by A6,MATRIX_0:24;
    hence thesis by A10,MATRIX_0:21;
  end;
end;
