reserve x, y for object, X for set,
  i, j, k, l, n, m for Nat,
  D for non empty set,
  K for commutative Ring,
  a,b for Element of K,
  perm, p, q for Element of Permutations(n),
  Perm,P for Permutation of Seg n,
  F for Function of Seg n,Seg n,
  perm2, p2, q2, pq2 for Element of Permutations(n+2),
  Perm2 for Permutation of Seg (n+2);
reserve s for Element of 2Set Seg (n+2);
reserve pD for FinSequence of D,
  M for Matrix of n,m,D,
  pK,qK for FinSequence of K,
  A for Matrix of n,K;

theorem
  for M,pD st len pD=width M for p9 be Element of D* st pD = p9 holds
  RLine(M,l,pD) = Replace(M,l,p9)
proof
  let M,pD such that
A1: len pD=width M;
  set RL=RLine(M,l,pD);
  let p9 be Element of D* such that
A2: pD=p9;
  set R=Replace(M,l,p9);
A3: len R=len M by FINSEQ_7:5;
A4: now
    let i be Nat such that
A5: 1 <= i and
A6: i <=len R;
A7: i in Seg len R by A5,A6;
    then
A8: i in dom R by FINSEQ_1:def 3;
A9: i in Seg n by A3,A7,MATRIX_0:def 2;
A10: i in dom M by A3,A7,FINSEQ_1:def 3;
    now
      per cases;
      case
A11:    i=l;
        then
A12:    Line(RL,i)=pD by A1,A9,Th28;
A13:    R/.i=R.i by A8,PARTFUN1:def 6;
        R/.i=p9 by A3,A5,A6,A11,FINSEQ_7:8;
        hence R.i=RL.i by A2,A9,A13,A12,MATRIX_0:52;
      end;
      case
A14:    i<>l;
        then
A15:    Line(M,i)=Line(RL,i) by A9,Th28;
A16:    R.i=R/.i by A8,PARTFUN1:def 6;
A17:    M.i=Line(M,i) by A9,MATRIX_0:52;
A18:    M/.i=M.i by A10,PARTFUN1:def 6;
        R/.i=M/.i by A3,A5,A6,A14,FINSEQ_7:10;
        hence R.i=RL.i by A9,A16,A18,A17,A15,MATRIX_0:52;
      end;
    end;
    hence R.i=RL.i;
  end;
  len M=len RL by Lm4;
  hence thesis by A4,FINSEQ_1:14,FINSEQ_7:5;
end;
