# Compute the conjunction probability of $contains$ operators in string

I have an unknown string S of length n. I have to given small string A1 and A2. Supposed that I know the probability of S.contains(A1) = true (which mean A1 appears in S at least once) and S.contains (A2) = true.

How do we compute the probability of S.contains(A1) && S.contains(A2)?

The general problem: Compute the probability P[S.contains(A1) && S.contains(A2) && ... && S.contains(An)] when we know P[S.contains(A1)], P[S.contains(A2)], ..., P[S.contains(An)]

Thank you

Update: We can compute P[S.contains(x) == true] in which x is an arbitrary string.

-

What do you mean by intersection of A1 and A2? For example, if A1 = '101' && A2 = '000', then if you mean the intersection is the part X that either is prefix of A1 and postfix of A2 or prefix of A2 and postfix of A1, then this case the intersection is blank. Then in case n = 5, we have P(S.contains(A1)) > 0, P(S.contains(A2) > 0 but P(S.contains(A1) && S.contains(A2)) = 0 – Loi.Luu Sep 6 '13 at 8:37