Ranked labeled histories of coalescent trees
AbbreviationUnordered pairs of lineages#✓fully proved
The unordered pairs of lineages when there are k lineages labeled 0, …, k - 1.
Used by 36
2^{n-1} / (n! (n - 1)!) · Every ranked history is equally likely under random joining · Ranked labeled historyAbbreviationRanked labeled history#✓fully proved
A ranked labeled history of n labeled genes, encoded by its coalescence events: at
step i < n - 1 there are n - i lineages and the step records the pair that merges (the
merged lineage takes the smaller label; the others keep their relative order).
abbrev RankedHistory (n : ℕ) : Type := (i : Fin (n - 1)) → LineagePair (n - i)
abbrev LineagePair (k : ℕ) : Type := {s : Finset (Fin k) // s.card = 2}
MathlibExt/Biology/PopulationGenetics/Coalescent/Topology.lean:65
Uses 1 · Used by 41
2^{n-1} / (n! (n - 1)!) · Every ranked history is equally likely under random joiningTheoremNumber of pairs of lineages#✓fully proved
The number of pairs of k lineages is k.choose 2.
theorem card_lineagePair (k : ℕ) : Fintype.card (LineagePair k) = k.choose 2
abbrev LineagePair (k : ℕ) : Type := {s : Finset (Fin k) // s.card = 2}
MathlibExt/Biology/PopulationGenetics/Coalescent/Topology.lean:65
Uses 1 · Used by 2
Ancestral partitions of a history
DefinitionMerging two lineage blocks#✓fully proved
Merge the lineages (blocks of sampled genes) at positions a < b of a list of blocks: the
merged block replaces position a, and position b is removed.
DefinitionLineage blocks after the first coalescence events#✓fully proved
The lineages (as blocks of sampled genes, indexed by lineage label) after the first t
coalescence events of a history, starting from the singletons {0}, …, {n - 1}.
def blocksAfter {n : ℕ} (h : RankedHistory n) (t : ℕ) : List (Finset (Fin n)) :=
((List.finRange (n - 1)).take t).foldl
(fun bs i =>
let s : Finset ℕ := (h i).1.map Fin.valEmbedding
mergeBlocks bs (s.min.getD 0) (s.max.getD 0))
((List.finRange n).map fun j => {j})
abbrev RankedHistory (n : ℕ) : Type := (i : Fin (n - 1)) → LineagePair (n - i)
MathlibExt/Biology/PopulationGenetics/Coalescent/Topology.lean:70
def mergeBlocks {n : ℕ} (bs : List (Finset (Fin n))) (a b : ℕ) : List (Finset (Fin n)) :=
(bs.set a (bs.getD a ∅ ∪ bs.getD b ∅)).eraseIdx b
MathlibExt/Biology/PopulationGenetics/Coalescent/Topology.lean:80
Uses 2 · Used by 3
DefinitionAncestral partitions along a history, indexed by lineage label#✓fully proved
The ancestral partitions of the sample along a history, as lists of blocks indexed by
lineage label; entry t (for t < n) is the partition after t coalescence events.
def blocksOf {n : ℕ} (h : RankedHistory n) : List (List (Finset (Fin n))) :=
(List.range n).map (blocksAfter h)
abbrev RankedHistory (n : ℕ) : Type := (i : Fin (n - 1)) → LineagePair (n - i)
MathlibExt/Biology/PopulationGenetics/Coalescent/Topology.lean:70
def blocksAfter {n : ℕ} (h : RankedHistory n) (t : ℕ) : List (Finset (Fin n)) :=
((List.finRange (n - 1)).take t).foldl
(fun bs i =>
let s : Finset ℕ := (h i).1.map Fin.valEmbedding
mergeBlocks bs (s.min.getD 0) (s.max.getD 0))
((List.finRange n).map fun j => {j})
MathlibExt/Biology/PopulationGenetics/Coalescent/Topology.lean:85
Uses 2 · Used by 1
DefinitionAncestral partitions along a history as sets of blocks#✓fully proved
The ancestral partitions of the sample along a history, as sets of blocks (forgetting the lineage labels): the ranked labeled history in the sense of Edwards (1970).
def partitionsOf {n : ℕ} (h : RankedHistory n) : List (Finset (Finset (Fin n))) :=
(blocksOf h).map List.toFinset
abbrev RankedHistory (n : ℕ) : Type := (i : Fin (n - 1)) → LineagePair (n - i)
MathlibExt/Biology/PopulationGenetics/Coalescent/Topology.lean:70
def blocksOf {n : ℕ} (h : RankedHistory n) : List (List (Finset (Fin n))) :=
(List.range n).map (blocksAfter h)
MathlibExt/Biology/PopulationGenetics/Coalescent/Topology.lean:94
Uses 2 · Used by 2
Counting
TheoremProduct of pair counts times a power of two is \(n!(n-1)!\)#✓fully proved
∏_{k=2}^n C(k, 2) * 2^{n-1} = n! (n - 1)!.
theorem prod_choose_two_mul_two_pow (n : ℕ) :
(∏ k ∈ Icc 2 n, k.choose 2) * 2 ^ (n - 1) = n.factorial * (n - 1).factorial
TheoremReindexing the product of pair counts#✓fully proved
Reindexing: ∏_{i < n - 1} C(n - i, 2) = ∏_{k=2}^n C(k, 2).
TheoremNumber of ranked labeled histories#✓fully proved
∏_{k=2}^n C(k, 2) (Edwards 1970).
theorem card_rankedHistory (n : ℕ) :
Fintype.card (RankedHistory n) = ∏ k ∈ Icc 2 n, k.choose 2
abbrev RankedHistory (n : ℕ) : Type := (i : Fin (n - 1)) → LineagePair (n - i)
MathlibExt/Biology/PopulationGenetics/Coalescent/Topology.lean:70
Uses 4 · Used by 2
TheoremNumber of ranked labeled histories#✓fully proved
#histories * 2^{n-1} = n! (n - 1)!, i.e. there are
n! (n - 1)! / 2^{n-1} ranked labeled histories of n labeled genes (Edwards 1970).
theorem card_rankedHistory_mul_two_pow (n : ℕ) :
Fintype.card (RankedHistory n) * 2 ^ (n - 1) = n.factorial * (n - 1).factorial
abbrev RankedHistory (n : ℕ) : Type := (i : Fin (n - 1)) → LineagePair (n - i)
MathlibExt/Biology/PopulationGenetics/Coalescent/Topology.lean:70
Uses 4
Random joining
DefinitionRandom joining#✓fully proved
Random joining (Edwards 1970; Kingman 1982): the pair merging at each step is uniform
among the current (n - i).choose 2 pairs and independent of the earlier steps. Kingman (1982)
shows that this is the law of the tree topology of the coalescent.
noncomputable def randomJoining (n : ℕ) : Measure (RankedHistory n) :=
Measure.pi fun i => ProbabilityTheory.uniformOn (Set.univ : Set (LineagePair (n - i)))
abbrev RankedHistory (n : ℕ) : Type := (i : Fin (n - 1)) → LineagePair (n - i)
MathlibExt/Biology/PopulationGenetics/Coalescent/Topology.lean:70
abbrev LineagePair (k : ℕ) : Type := {s : Finset (Fin k) // s.card = 2}
MathlibExt/Biology/PopulationGenetics/Coalescent/Topology.lean:65
Uses 2 · Used by 31
2^{n-1} / (n! (n - 1)!) · Every ranked history is equally likely under random joiningTheoremEvery ranked history is equally likely under random joining#✓fully proved
Under random joining each history has probability ∏_{k=2}^n C(k, 2)⁻¹.
theorem randomJoining_singleton_eq_inv (n : ℕ) (h : RankedHistory n) :
randomJoining n {h} = ((∏ k ∈ Icc 2 n, k.choose 2 : ℕ) : ENNReal)⁻¹
abbrev RankedHistory (n : ℕ) : Type := (i : Fin (n - 1)) → LineagePair (n - i)
MathlibExt/Biology/PopulationGenetics/Coalescent/Topology.lean:70
noncomputable def randomJoining (n : ℕ) : Measure (RankedHistory n) :=
Measure.pi fun i => ProbabilityTheory.uniformOn (Set.univ : Set (LineagePair (n - i)))
MathlibExt/Biology/PopulationGenetics/Coalescent/Topology.lean:159
Uses 5 · Used by 2
TheoremEach ranked labeled history has probability 2^{n-1} / (n! (n - 1)!)#✓fully proved
Each ranked labeled history has probability 2^{n-1} / (n! (n - 1)!) under random
joining (Edwards 1970; Tajima 1983).
theorem randomJoining_singleton (n : ℕ) (h : RankedHistory n) :
randomJoining n {h} = 2 ^ (n - 1) / (n.factorial * (n - 1).factorial : ℕ)
abbrev RankedHistory (n : ℕ) : Type := (i : Fin (n - 1)) → LineagePair (n - i)
MathlibExt/Biology/PopulationGenetics/Coalescent/Topology.lean:70
noncomputable def randomJoining (n : ℕ) : Measure (RankedHistory n) :=
Measure.pi fun i => ProbabilityTheory.uniformOn (Set.univ : Set (LineagePair (n - i)))
MathlibExt/Biology/PopulationGenetics/Coalescent/Topology.lean:159
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.