reserve x,y for object,
  N for Element of NAT,
  c,i,j,k,m,n for Nat,
  D for non empty set,
  s for Element of 2Set Seg (n+2),
  p for Element of Permutations(n) ,
  p1, q1 for Element of Permutations(n+1),
  p2 for Element of Permutations(n +2),
  K for Field,
  a for Element of K,
  f for FinSequence of K,
  A for (Matrix of K),
  AD for Matrix of n,m,D,
  pD for FinSequence of D,
  M for Matrix of n,K;

theorem Th19:
  for A be Matrix of n,m,D, A9 be Matrix of m,n,D st A9 = A@ & (m=
  0 implies n=0) holds ReplaceCol(A,c,pD) = ReplaceLine(A9,c,pD)@
proof
  let A be Matrix of n,m,D,A9 be Matrix of m,n,D such that
A1: A9=A@ and
A2: m=0 implies n=0;
  set RC=ReplaceCol(A,c,pD);
  set RL=ReplaceLine(A9,c,pD);
  now
    per cases;
    suppose
A3:   n=0;
      then 0=len A by MATRIX_0:def 2;
      then 0=width A by MATRIX_0:def 3
        .=len A9 by A1,MATRIX_0:def 6;
      then m=0 by MATRIX_0:def 2;
      then len RL=0 by MATRIX_0:def 2;
      then width RL=0 by MATRIX_0:def 3;
      then len (RL@)=0 by MATRIX_0:def 6;
      then
A4:   RL@={};
      len RC=0 by A3,MATRIX_0:def 2;
      hence thesis by A4;
    end;
    suppose
A5:   len pD <> len A & n>0;
      then
A6:   width A=m by MATRIX_0:23;
      then
A7:   width A9=len A by A1,A2,A5,MATRIX_0:54;
A8:   len A=n by A5,MATRIX_0:23;
      thus RC = A by A5,Def2
        .= (A@)@ by A2,A5,A8,A6,MATRIX_0:57
        .= RL@ by A1,A5,A7,MATRIX11:def 3;
    end;
    suppose
A9:   len pD = len A & n>0;
      then
A10:  width RL=n by A2,MATRIX_0:23;
      then
A11:  len (RL@)=n by A9,MATRIX_0:54;
      len RL=m by A2,A9,MATRIX_0:23;
      then width (RL@)=m by A9,A10,MATRIX_0:54;
      then reconsider RL9=RL@ as Matrix of n,m,D by A11,MATRIX_0:51;
A12:  len A=n by A9,MATRIX_0:23;
A13:  width A9=n by A2,A9,MATRIX_0:23;
      now
A14:    Indices RC=Indices A by MATRIX_0:26;
A15:    Indices RL=Indices A9 by MATRIX_0:26;
        let i,j be Nat such that
A16:    [i,j] in Indices RC;
        reconsider I=i,J=j as Element of NAT by ORDINAL1:def 12;
        Indices RC=Indices RL9 by MATRIX_0:26;
        then
A17:    [j,i] in Indices RL by A16,MATRIX_0:def 6;
        per cases;
        suppose
A18:      J=c;
          hence RC*(i,j) = pD.I by A9,A16,A14,Def2
            .= RL*(J,I) by A9,A12,A13,A17,A15,A18,MATRIX11:def 3
            .= RL9*(i,j) by A17,MATRIX_0:def 6;
        end;
        suppose
A19:      J<>c;
          hence RC*(i,j) = A*(I,J) by A9,A16,A14,Def2
            .= A9*(j,i) by A1,A16,A14,MATRIX_0:def 6
            .= RL*(J,I) by A9,A12,A13,A17,A15,A19,MATRIX11:def 3
            .= RL9*(i,j) by A17,MATRIX_0:def 6;
        end;
      end;
      hence thesis by MATRIX_0:27;
    end;
  end;
  hence thesis;
end;
