Time-reversible nucleotide substitution models
DefinitionGeneral time-reversible (GTR) rate matrix#✓fully proved
The GTR rate matrix (Tavaré 1986) with base frequencies π and exchangeabilities s:
s i j * π j off the diagonal and minus the off-diagonal row sum on it. The diagonal of s is
not used.
noncomputable def gtrRate (π : ι → ℝ) (s : Matrix ι ι ℝ) : Matrix ι ι ℝ :=
Matrix.of fun i j => if i = j then -∑ k ∈ univ.erase i, s i k * π k else s i j * π j
Used by 17
π is the equilibrium of the SiPhy matrix · SiPhy matrix is a rate matrix · The SiPhy rate matrix · Equal-rates GTR chain is the Jukes–Cantor model · F81 rate matrix · JC69 is the equal-rates GTR model · HKY85 rate matrix · HKY85 with κ = 1 is F81 · Time-reversibility of the GTR chain · GTR is reversible · GTR matrix is a rate matrix · K80 with κ = 1 is the Jukes–Cantor model · Rows of the GTR rate matrix sum to zero · Base frequencies are stationary for the GTR chain · Base frequencies are invariant for the GTR generatorTheoremRows of the GTR rate matrix sum to zero#✓fully proved
The rows of the GTR matrix sum to 0, for all parameters.
theorem sum_gtrRate (π : ι → ℝ) (s : Matrix ι ι ℝ) (i : ι) : ∑ j, gtrRate π s i j = 0
noncomputable def gtrRate (π : ι → ℝ) (s : Matrix ι ι ℝ) : Matrix ι ι ℝ :=
Matrix.of fun i j => if i = j then -∑ k ∈ univ.erase i, s i k * π k else s i j * π j
MathlibExt/Biology/Phylogenetics/SubstitutionModels.lean:89
Uses 1 · Used by 3
TheoremGTR matrix is a rate matrix#✓fully proved
With nonnegative base frequencies and nonnegative off-diagonal exchangeabilities, the GTR
matrix is a rate matrix (the diagonal s i i is not used by gtrRate).
theorem isRateMatrix_gtrRate {π : ι → ℝ} {s : Matrix ι ι ℝ} (hπ : ∀ i, 0 ≤ π i)
(hs : ∀ i j, i ≠ j → 0 ≤ s i j) : IsRateMatrix (gtrRate π s)
structure IsRateMatrix (Q : Matrix ι ι ℝ) : Prop where
/-- The jump rates `Q i j`, `i ≠ j`, are nonnegative. -/
nonneg_of_ne : ∀ ⦃i j : ι⦄, i ≠ j → 0 ≤ Q i j
/-- Each row sums to `0`. -/
sum_row : ∀ i, ∑ j, Q i j = 0
MathlibExt/Probability/Process/ContinuousTimeMarkovChain/RateMatrix.lean:57
noncomputable def gtrRate (π : ι → ℝ) (s : Matrix ι ι ℝ) : Matrix ι ι ℝ :=
Matrix.of fun i j => if i = j then -∑ k ∈ univ.erase i, s i k * π k else s i j * π j
MathlibExt/Biology/Phylogenetics/SubstitutionModels.lean:89
Uses 3 · Used by 4
TheoremGTR is reversible#✓fully proved
With symmetric exchangeabilities, the GTR matrix is in detailed
balance with its base frequencies, π i Q i j = π j Q j i (Tavaré 1986).
theorem isDetailedBalance_gtrRate (π : ι → ℝ) {s : Matrix ι ι ℝ} (hs : ∀ i j, s i j = s j i) :
IsDetailedBalance π (gtrRate π s)
def IsDetailedBalance (π : ι → ℝ) (Q : Matrix ι ι ℝ) : Prop :=
∀ i j, π i * Q i j = π j * Q j i
MathlibExt/Probability/Process/ContinuousTimeMarkovChain/Stationary.lean:64
noncomputable def gtrRate (π : ι → ℝ) (s : Matrix ι ι ℝ) : Matrix ι ι ℝ :=
Matrix.of fun i j => if i = j then -∑ k ∈ univ.erase i, s i k * π k else s i j * π j
MathlibExt/Biology/Phylogenetics/SubstitutionModels.lean:89
Uses 2 · Used by 7
π is the equilibrium of the SiPhy matrix · Time-reversibility of the GTR chain · Detailed balance of the F81 model · Detailed balance of the HKY85 model · Base frequencies are stationary for the GTR chain · Base frequencies are invariant for the GTR generatorTheoremBase frequencies are invariant for the GTR generator#✓fully proved
The base frequencies are invariant for the GTR generator: π Q = 0.
theorem vecMul_gtrRate (π : ι → ℝ) {s : Matrix ι ι ℝ} (hs : ∀ i j, s i j = s j i) :
π ᵥ* gtrRate π s = 0
noncomputable def gtrRate (π : ι → ℝ) (s : Matrix ι ι ℝ) : Matrix ι ι ℝ :=
Matrix.of fun i j => if i = j then -∑ k ∈ univ.erase i, s i k * π k else s i j * π j
MathlibExt/Biology/Phylogenetics/SubstitutionModels.lean:89
Uses 4
TheoremBase frequencies are stationary for the GTR chain#✓fully proved
The base frequencies are stationary for the GTR transition function at every time.
theorem vecMul_ctmcTransition_gtrRate (π : ι → ℝ) {s : Matrix ι ι ℝ}
(hs : ∀ i j, s i j = s j i) (t : ℝ) : π ᵥ* ctmcTransition (gtrRate π s) t = π
noncomputable def ctmcTransition (Q : Matrix ι ι ℝ) (t : ℝ) : Matrix ι ι ℝ :=
exp (t • Q)
MathlibExt/Probability/Process/ContinuousTimeMarkovChain/Semigroup.lean:64
noncomputable def gtrRate (π : ι → ℝ) (s : Matrix ι ι ℝ) : Matrix ι ι ℝ :=
Matrix.of fun i j => if i = j then -∑ k ∈ univ.erase i, s i k * π k else s i j * π j
MathlibExt/Biology/Phylogenetics/SubstitutionModels.lean:89
TheoremTime-reversibility of the GTR chain#✓fully proved
Detailed balance of the GTR transition function with the base frequencies,
π i P t i j = π j P t j i for every t (time-reversibility of the GTR chain).
theorem isDetailedBalance_ctmcTransition_gtrRate (π : ι → ℝ) {s : Matrix ι ι ℝ}
(hs : ∀ i j, s i j = s j i) (t : ℝ) :
IsDetailedBalance π (ctmcTransition (gtrRate π s) t)
def IsDetailedBalance (π : ι → ℝ) (Q : Matrix ι ι ℝ) : Prop :=
∀ i j, π i * Q i j = π j * Q j i
MathlibExt/Probability/Process/ContinuousTimeMarkovChain/Stationary.lean:64
noncomputable def ctmcTransition (Q : Matrix ι ι ℝ) (t : ℝ) : Matrix ι ι ℝ :=
exp (t • Q)
MathlibExt/Probability/Process/ContinuousTimeMarkovChain/Semigroup.lean:64
noncomputable def gtrRate (π : ι → ℝ) (s : Matrix ι ι ℝ) : Matrix ι ι ℝ :=
Matrix.of fun i j => if i = j then -∑ k ∈ univ.erase i, s i k * π k else s i j * π j
MathlibExt/Biology/Phylogenetics/SubstitutionModels.lean:89
Nucleotide models on Fin 4 (order A, C, G, T)
DefinitionHKY85 exchangeabilities#✓fully proved
The HKY85 exchangeabilities: κ for a transition (indices of equal parity: A ↔ G,
C ↔ T in the order A, C, G, T), 1 for a transversion. The diagonal (also κ) is not
used by gtrRate.
def hkyExchangeability (κ : ℝ) : Matrix (Fin 4) (Fin 4) ℝ :=
Matrix.of fun i j => if (i : ℕ) % 2 = (j : ℕ) % 2 then κ else 1
Used by 4
DefinitionHKY85 rate matrix#✓fully proved
The HKY85 rate matrix (Hasegawa–Kishino–Yano 1985) with base frequencies π and
transition/transversion ratio κ: rate κ π j for a transition to j, π j for a
transversion.
noncomputable def hkyRate (π : Fin 4 → ℝ) (κ : ℝ) : Matrix (Fin 4) (Fin 4) ℝ :=
gtrRate π (hkyExchangeability κ)
noncomputable def gtrRate (π : ι → ℝ) (s : Matrix ι ι ℝ) : Matrix ι ι ℝ :=
Matrix.of fun i j => if i = j then -∑ k ∈ univ.erase i, s i k * π k else s i j * π j
MathlibExt/Biology/Phylogenetics/SubstitutionModels.lean:89
def hkyExchangeability (κ : ℝ) : Matrix (Fin 4) (Fin 4) ℝ :=
Matrix.of fun i j => if (i : ℕ) % 2 = (j : ℕ) % 2 then κ else 1
MathlibExt/Biology/Phylogenetics/SubstitutionModels.lean:140
Uses 2 · Used by 5
DefinitionF81 rate matrix#✓fully proved
The F81 rate matrix (Felsenstein 1981): rate π j to every other base j.
noncomputable def f81Rate (π : Fin 4 → ℝ) : Matrix (Fin 4) (Fin 4) ℝ :=
gtrRate π (Matrix.of fun _ _ => 1)
noncomputable def gtrRate (π : ι → ℝ) (s : Matrix ι ι ℝ) : Matrix ι ι ℝ :=
Matrix.of fun i j => if i = j then -∑ k ∈ univ.erase i, s i k * π k else s i j * π j
MathlibExt/Biology/Phylogenetics/SubstitutionModels.lean:89
Uses 1 · Used by 4
DefinitionK80 rate matrix#✓fully proved
The K80 rate matrix (Kimura 1980): equal base frequencies 1/4, rate κ / 4 for a
transition and 1 / 4 for each transversion.
noncomputable def k80Rate (κ : ℝ) : Matrix (Fin 4) (Fin 4) ℝ :=
hkyRate (fun _ => 1 / 4) κ
noncomputable def hkyRate (π : Fin 4 → ℝ) (κ : ℝ) : Matrix (Fin 4) (Fin 4) ℝ :=
gtrRate π (hkyExchangeability κ)
MathlibExt/Biology/Phylogenetics/SubstitutionModels.lean:146
Uses 1 · Used by 2
TheoremHKY85 matrix is a rate matrix#✓fully proved
With nonnegative base frequencies and κ ≥ 0, the HKY85 matrix is a rate matrix.
theorem isRateMatrix_hkyRate {π : Fin 4 → ℝ} {κ : ℝ} (hπ : ∀ i, 0 ≤ π i) (hκ : 0 ≤ κ) :
IsRateMatrix (hkyRate π κ)
structure IsRateMatrix (Q : Matrix ι ι ℝ) : Prop where
/-- The jump rates `Q i j`, `i ≠ j`, are nonnegative. -/
nonneg_of_ne : ∀ ⦃i j : ι⦄, i ≠ j → 0 ≤ Q i j
/-- Each row sums to `0`. -/
sum_row : ∀ i, ∑ j, Q i j = 0
MathlibExt/Probability/Process/ContinuousTimeMarkovChain/RateMatrix.lean:57
noncomputable def hkyRate (π : Fin 4 → ℝ) (κ : ℝ) : Matrix (Fin 4) (Fin 4) ℝ :=
gtrRate π (hkyExchangeability κ)
MathlibExt/Biology/Phylogenetics/SubstitutionModels.lean:146
Uses 4 · Used by 1
TheoremF81 matrix is a rate matrix#✓fully proved
With nonnegative base frequencies, the F81 matrix is a rate matrix.
theorem isRateMatrix_f81Rate {π : Fin 4 → ℝ} (hπ : ∀ i, 0 ≤ π i) : IsRateMatrix (f81Rate π)
structure IsRateMatrix (Q : Matrix ι ι ℝ) : Prop where
/-- The jump rates `Q i j`, `i ≠ j`, are nonnegative. -/
nonneg_of_ne : ∀ ⦃i j : ι⦄, i ≠ j → 0 ≤ Q i j
/-- Each row sums to `0`. -/
sum_row : ∀ i, ∑ j, Q i j = 0
MathlibExt/Probability/Process/ContinuousTimeMarkovChain/RateMatrix.lean:57
noncomputable def f81Rate (π : Fin 4 → ℝ) : Matrix (Fin 4) (Fin 4) ℝ :=
gtrRate π (Matrix.of fun _ _ => 1)
MathlibExt/Biology/Phylogenetics/SubstitutionModels.lean:150
Uses 3
TheoremK80 matrix is a rate matrix#✓fully proved
With κ ≥ 0, the K80 matrix is a rate matrix.
theorem isRateMatrix_k80Rate {κ : ℝ} (hκ : 0 ≤ κ) : IsRateMatrix (k80Rate κ)
structure IsRateMatrix (Q : Matrix ι ι ℝ) : Prop where
/-- The jump rates `Q i j`, `i ≠ j`, are nonnegative. -/
nonneg_of_ne : ∀ ⦃i j : ι⦄, i ≠ j → 0 ≤ Q i j
/-- Each row sums to `0`. -/
sum_row : ∀ i, ∑ j, Q i j = 0
MathlibExt/Probability/Process/ContinuousTimeMarkovChain/RateMatrix.lean:57
noncomputable def k80Rate (κ : ℝ) : Matrix (Fin 4) (Fin 4) ℝ :=
hkyRate (fun _ => 1 / 4) κ
MathlibExt/Biology/Phylogenetics/SubstitutionModels.lean:155
Uses 3
TheoremDetailed balance of the HKY85 model#✓fully proved
HKY85 is in detailed balance with its base frequencies.
theorem isDetailedBalance_hkyRate (π : Fin 4 → ℝ) (κ : ℝ) :
IsDetailedBalance π (hkyRate π κ)
def IsDetailedBalance (π : ι → ℝ) (Q : Matrix ι ι ℝ) : Prop :=
∀ i j, π i * Q i j = π j * Q j i
MathlibExt/Probability/Process/ContinuousTimeMarkovChain/Stationary.lean:64
noncomputable def hkyRate (π : Fin 4 → ℝ) (κ : ℝ) : Matrix (Fin 4) (Fin 4) ℝ :=
gtrRate π (hkyExchangeability κ)
MathlibExt/Biology/Phylogenetics/SubstitutionModels.lean:146
Uses 4
TheoremDetailed balance of the F81 model#✓fully proved
F81 is in detailed balance with its base frequencies.
theorem isDetailedBalance_f81Rate (π : Fin 4 → ℝ) : IsDetailedBalance π (f81Rate π)
def IsDetailedBalance (π : ι → ℝ) (Q : Matrix ι ι ℝ) : Prop :=
∀ i j, π i * Q i j = π j * Q j i
MathlibExt/Probability/Process/ContinuousTimeMarkovChain/Stationary.lean:64
noncomputable def f81Rate (π : Fin 4 → ℝ) : Matrix (Fin 4) (Fin 4) ℝ :=
gtrRate π (Matrix.of fun _ _ => 1)
MathlibExt/Biology/Phylogenetics/SubstitutionModels.lean:150
Uses 3
TheoremHKY85 with κ = 1 is F81#✓fully proved
HKY85 with κ = 1 is F81.
theorem hkyRate_one (π : Fin 4 → ℝ) : hkyRate π 1 = f81Rate π
noncomputable def hkyRate (π : Fin 4 → ℝ) (κ : ℝ) : Matrix (Fin 4) (Fin 4) ℝ :=
gtrRate π (hkyExchangeability κ)
MathlibExt/Biology/Phylogenetics/SubstitutionModels.lean:146
noncomputable def f81Rate (π : Fin 4 → ℝ) : Matrix (Fin 4) (Fin 4) ℝ :=
gtrRate π (Matrix.of fun _ _ => 1)
MathlibExt/Biology/Phylogenetics/SubstitutionModels.lean:150
Uses 4 · Used by 1
The Jukes–Cantor model as the equal-rates case
TheoremJC69 is the equal-rates GTR model#✓fully proved
Equal base frequencies 1/4 and equal
exchangeabilities 4 μ / 3 give the Jukes–Cantor rate matrix jcRateMatrix μ.
theorem gtrRate_jukesCantor (μ : ℝ) :
gtrRate (fun _ : Fin 4 => 1 / 4) (Matrix.of fun _ _ => 4 * μ / 3) = jcRateMatrix μ
noncomputable def gtrRate (π : ι → ℝ) (s : Matrix ι ι ℝ) : Matrix ι ι ℝ :=
Matrix.of fun i j => if i = j then -∑ k ∈ univ.erase i, s i k * π k else s i j * π j
MathlibExt/Biology/Phylogenetics/SubstitutionModels.lean:89
noncomputable def jcRateMatrix (μ : ℝ) : Matrix (Fin 4) (Fin 4) ℝ :=
Matrix.of (jcRate μ)
MathlibExt/Biology/Phylogenetics/JukesCantor.lean:229
Uses 2 · Used by 2
TheoremEqual-rates GTR chain is the Jukes–Cantor model#✓fully proved
The equal-rates GTR transition function is the Jukes–Cantor transition probability
jcProb μ t (by JukesCantor.jcProb_eq_exp).
theorem ctmcTransition_gtrRate_jukesCantor (μ t : ℝ) (i j : Fin 4) :
ctmcTransition (gtrRate (fun _ : Fin 4 => 1 / 4) (Matrix.of fun _ _ => 4 * μ / 3)) t i j =
jcProb μ t i j
noncomputable def ctmcTransition (Q : Matrix ι ι ℝ) (t : ℝ) : Matrix ι ι ℝ :=
exp (t • Q)
MathlibExt/Probability/Process/ContinuousTimeMarkovChain/Semigroup.lean:64
noncomputable def gtrRate (π : ι → ℝ) (s : Matrix ι ι ℝ) : Matrix ι ι ℝ :=
Matrix.of fun i j => if i = j then -∑ k ∈ univ.erase i, s i k * π k else s i j * π j
MathlibExt/Biology/Phylogenetics/SubstitutionModels.lean:89
noncomputable def jcProb (μ t : ℝ) (i j : Fin 4) : ℝ :=
if i = j then 1 / 4 + 3 / 4 * exp (-4 * μ * t / 3) else 1 / 4 - 1 / 4 * exp (-4 * μ * t / 3)
MathlibExt/Biology/Phylogenetics/JukesCantor.lean:79
TheoremJukes–Cantor matrix is a rate matrix#✓fully proved
For μ ≥ 0 the Jukes–Cantor matrix is a rate matrix.
theorem isRateMatrix_jcRateMatrix {μ : ℝ} (hμ : 0 ≤ μ) : IsRateMatrix (jcRateMatrix μ)
structure IsRateMatrix (Q : Matrix ι ι ℝ) : Prop where
/-- The jump rates `Q i j`, `i ≠ j`, are nonnegative. -/
nonneg_of_ne : ∀ ⦃i j : ι⦄, i ≠ j → 0 ≤ Q i j
/-- Each row sums to `0`. -/
sum_row : ∀ i, ∑ j, Q i j = 0
MathlibExt/Probability/Process/ContinuousTimeMarkovChain/RateMatrix.lean:57
noncomputable def jcRateMatrix (μ : ℝ) : Matrix (Fin 4) (Fin 4) ℝ :=
Matrix.of (jcRate μ)
MathlibExt/Biology/Phylogenetics/JukesCantor.lean:229
Uses 4
TheoremK80 with κ = 1 is the Jukes–Cantor model#✓fully proved
K80 with κ = 1 is JC69 with substitution rate μ = 3/4.
theorem k80Rate_one : k80Rate 1 = jcRateMatrix (3 / 4)
noncomputable def k80Rate (κ : ℝ) : Matrix (Fin 4) (Fin 4) ℝ :=
hkyRate (fun _ => 1 / 4) κ
MathlibExt/Biology/Phylogenetics/SubstitutionModels.lean:155
noncomputable def jcRateMatrix (μ : ℝ) : Matrix (Fin 4) (Fin 4) ℝ :=
Matrix.of (jcRate μ)
MathlibExt/Biology/Phylogenetics/JukesCantor.lean:229
Uses 7
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.