reserve Omega for set;
reserve m,n,k for Nat;
reserve x,y for object;
reserve r,r1,r2,r3 for Real;
reserve seq,seq1 for Real_Sequence;
reserve Sigma for SigmaField of Omega;
reserve ASeq,BSeq for SetSequence of Sigma;
reserve A, B, C, A1, A2, A3 for Event of Sigma;
reserve Omega for non empty set;
reserve Sigma for SigmaField of Omega;
reserve A, B, C, A1, A2, A3 for Event of Sigma;
reserve ASeq,BSeq for SetSequence of Sigma;
reserve P,P1,P2 for Probability of Sigma;

theorem ::Bayes' Theorem for Two Events
  for B,A1,A2,P st 0 < P.B & A2 = A1` & 0 < P.A1 & 0 < P.A2 holds P.|.B.
A1 = (P.|.A1.B * P.A1) / (P.|.A1.B * P.A1 + P.|.A2.B * P.A2) & P.|.B.A2 = (P.|.
  A2.B * P.A2) / (P.|.A1.B * P.A1 + P.|.A2.B * P.A2)
proof
  let B,A1,A2,P;
  assume that
A1: 0 < P.B and
A2: A2 = A1` and
A3: 0 < P.A1 and
A4: 0 < P.A2;
  thus P.|.A1.B * P.A1 / (P.|.A1.B * P.A1 + P.|.A2.B * P.A2) = P.|.A1.B * P.A1
  / P.B by A2,A3,A4,Th31
    .= P.|.B.A1 by A1,A3,Th36;
  thus P.|.A2.B * P.A2 / (P.|.A1.B * P.A1 + P.|.A2.B * P.A2) = P.|.A2.B * P.A2
  / P.B by A2,A3,A4,Th31
    .= P.|.B.A2 by A1,A4,Th36;
end;
