reserve D for non empty set,
  i,j,k,l for Nat,
  n for Nat,
  x for set,
  a,b,c,r,r1,r2 for Real,
  p,q for FinSequence of REAL,
  MR,MR1 for Matrix of REAL;

theorem Th23:
  for p,q being ProbFinS FinSequence of REAL holds (ColVec2Mx p) *
  (LineVec2Mx q) is Joint_Probability
proof
  let p,q be ProbFinS FinSequence of REAL;
  set M = (ColVec2Mx p) * (LineVec2Mx q);
A1: len M = len p by Th22;
A2: LineSum M = p
  proof
    set M1=LineSum M;
A3: len M1 = len M by MATRPROB:20;
    then
A4: dom M1 = dom M by FINSEQ_3:29;
A5: now
      let k be Nat such that
A6:   k in dom M1;
      k in Seg len M by A3,A6,FINSEQ_1:def 3;
      hence M1.k = Sum(Line(M,k)) by MATRPROB:20
        .= Sum(p.k * q) by A4,A6,Th22
        .= p.k * Sum q by RVSUM_1:87
        .= p.k * 1 by MATRPROB:def 5
        .= p.k;
    end;
    dom M1 = dom p by A1,A3,FINSEQ_3:29;
    hence thesis by A5,FINSEQ_1:13;
  end;
A7: width M = len q by Th22;
  now
    let i,j such that
A8: [i,j] in Indices M;
    i in Seg len p by A1,A8,MATRPROB:12;
    then i in dom p by FINSEQ_1:def 3;
    then
A9: p.i >= 0 by MATRPROB:def 5;
    j in Seg len q by A7,A8,MATRPROB:12;
    then j in dom q by FINSEQ_1:def 3;
    then
A10: q.j >= 0 by MATRPROB:def 5;
    M*(i,j) = p.i * q.j by A8,Th21;
    hence M*(i,j) >= 0 by A9,A10;
  end;
  then
A11: M is m-nonnegative by MATRPROB:def 6;
  SumAll M = Sum LineSum M by MATRPROB:def 3
    .= 1 by A2,MATRPROB:def 5;
  then M is with_sum=1 by MATRPROB:def 7;
  hence thesis by A11;
end;
