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 Three Events
  for B,A1,A2,A3,P st 0<P.B & 0<P.A1 & 0<P.A2 & 0<P.A3 & A1 misses A2 &
A3=(A1 \/ A2)` holds P.|.B.A1 = (P.|.A1.B * P.A1)/((P.|.A1.B * P.A1 + P.|.A2.B
* P.A2) + P.|. A3.B * P.A3) & P.|.B.A2 = (P.|.A2.B * P.A2)/((P.|.A1.B * P.A1 +
P.|.A2.B * P.A2) + P.|. A3.B * P.A3) & P.|.B.A3 = (P.|.A3.B * P.A3)/((P.|.A1.B
  * P.A1 + P.|.A2.B * P.A2) + P.|. A3.B * P.A3)
proof
  let B,A1,A2,A3,P;
  assume that
A1: 0<P.B and
A2: 0<P.A1 and
A3: 0<P.A2 and
A4: 0<P.A3 and
A5: A1 misses A2 & A3=(A1 \/ A2)`;
  thus (P.|.A1.B * P.A1)/((P.|.A1.B * P.A1 + P.|.A2.B * P.A2) + P.|. A3.B * P.
  A3) = (P.|.A1.B * P.A1)/P.B by A2,A3,A4,A5,Th32
    .= P.|.B.A1 by A1,A2,Th36;
  thus (P.|.A2.B * P.A2)/((P.|.A1.B * P.A1 + P.|.A2.B * P.A2) + P.|. A3.B * P.
  A3) = (P.|.A2.B * P.A2)/P.B by A2,A3,A4,A5,Th32
    .= P.|.B.A2 by A1,A3,Th36;
  thus (P.|.A3.B * P.A3)/((P.|.A1.B * P.A1 + P.|.A2.B * P.A2) + P.|. A3.B * P.
  A3) = (P.|.A3.B * P.A3)/P.B by A2,A3,A4,A5,Th32
    .= P.|.B.A3 by A1,A4,Th36;
end;
