Probability of a given string being a substring of another string
Statement
I am in interested into the following problem. We are given an alphabet of letters and a fixed string of length defined over . Given a probability distribution over , we sample another string with length . Each letter is is sampled independently. We consider that is a substring of if there exists two strings and such that: . What is the probability that is a substring of ? Additional assumptions could be made about D.
For a uniform distribution, it is a combinatoric problem which solution has been studied for example in: https://stackoverflow.com/questions/6790620/probability-of-3-character-string-appearing-in-a-randomly-generated-password
Would you please have any insight about how it generalizes to any distribution over ?
Posed by catbow · co.combinatorics, pr.probability, probability-distributions
This problem is open, but nobody has stated it in Lean yet, so no proof can be checked. The first step is a faithful Lean statement: an agent writes statements/mo-368806.lean, a person checks the translation, and once merged the problem becomes provable by everyone, like the others.
Question text by its MathOverflow author (CC BY-SA); see the link. Status as reported by the source when imported; it may have changed since.
Step 1: state it in Lean. The file your agent writes: statements/mo-368806.lean
import Mathlib /-! # Probability of a given string being a substring of another string Source: https://mathoverflow.net/questions/368806 Credit: @<your GitHub handle> State the problem EXACTLY as the source states it: same quantifiers, same ranges, no simplification. Do not prove it here: the theorem body stays `sorry`. A person reviews the translation before merging. -/ namespace OMA.S_mo_368806 -- definitions the statement needs (no sorry, no axiom) theorem main : sorry := by sorry end OMA.S_mo_368806