On the Formal Analysis of Hidden Markov Models
using Theorem Proving
Li Ya Liu, Vincent Aravantinos, Osman Hasan, Sofiène Tahar
ECE Department, Concordia University
Montreal, Canada
ICFEM 2014
Luxembourg City, Luxembourg
November 03, 2014
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Outline
Introduction and Motivation
Proposed Methodology
Formalizations
Case Study : A DNA Sequence Analysis
Conclusions
On the Formal Analysis of Hidden Markov Models using Theorem Proving
2/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Markov Chain
Stochastic Process
Markov Property
On the Formal Analysis of Hidden Markov Models using Theorem Proving
3/30
Introduction
Related Work
Proposed
C Methodology
Markov Chain
G
0.25
C
G
0.05
0.25
0.25
T
Stochastic Process
0.25
Formalization
T
0.95
T
0.1
0
E
Conclusions
G
0.1
0.4
1.0
0.9
1.0
Case Study
0.4
0
A Start
sequence
1.0 of states
0.1
E
5
Determining the next state is random
Start
C
I
0.1
End
0.1
End
0.9
0.1
5
0.9
1.0
I
0.9
Markov Property
On the Formal Analysis of Hidden Markov Models using Theorem Proving
3/30
Introduction
Related Work
Proposed
C Methodology
Markov Chain
G
0.25
C
G
0.05
0.25
0.25
T
Stochastic Process
0.25
Formalization
T
0.95
T
0.1
0
E
Conclusions
G
0.1
0.4
1.0
0.9
1.0
Case Study
0.4
0
A Start
sequence
1.0 of states
0.1
E
5
Determining the next state is random
Start
C
I
0.1
End
0.1
End
0.9
0.1
5
0.9
1.0
I
0.9
Markov Property
The probability of the next state is only dependent on the
current state
Pr {Xtn+1 = fn+1 |Xtn = fn , . . . , Xt0 = f0 } = Pr {Xtn+1 = fn+1 |Xtn = fn }
On the Formal Analysis of Hidden Markov Models using Theorem Proving
3/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Markov Chain - Example
Weather Prediction Problem
On the Formal Analysis of Hidden Markov Models using Theorem Proving
4/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Markov Chain - Example
Weather Prediction Problem
Liya records the weather conditions (sunny or rainy/snowy)
daily
On the Formal Analysis of Hidden Markov Models using Theorem Proving
4/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Markov Chain - Example
Weather Prediction Problem
Liya records the weather conditions (sunny or rainy/snowy)
daily
Based on this collected data she wants to obtain the
probability of a specific weather pattern
On the Formal Analysis of Hidden Markov Models using Theorem Proving
4/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Markov Chain - Example
Solution : Discrete Time Markov Chains
Set of States = {Sunny, Rainy}
State Transition Probabilities can be obtained from the
observed data
Example : P{“Tomorrow is sunny” given that “Today is
sunny”}
On the Formal Analysis of Hidden Markov Models using Theorem Proving
5/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Markov Chains - Types
Discrete-time Markov Chain
Continuous-time Markov Chain
On the Formal Analysis of Hidden Markov Models using Theorem Proving
6/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Applications of DTMCs
Biology
Physics
Markov
Chain
Chemistry
Medical
aerospace
Economics &
Finance
On the Formal Analysis of Hidden Markov Models using Theorem Proving
7/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Hidden Markov Models - Example
Weather Prediction Problem 2
On the Formal Analysis of Hidden Markov Models using Theorem Proving
8/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Hidden Markov Models - Example
Weather Prediction Problem 2
I want to know the probabilities of weather patterns
I do not have access to her Markov Chain(its hidden)
I have access to her daily activity calendar and know the
dependancy of her daily activities (walking, shopping and
cleaning) on weather
On the Formal Analysis of Hidden Markov Models using Theorem Proving
8/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Hidden Markov Models - Example
Remote Weather Prediction Problem
I want to know the weather patterns in Montreal where Liya
lives
I do not have access to her Markov Chain(its hidden)
I have access to her daily activity calendar and know the
dependancy of her daily activities (walking, shopping and
cleaning) on weather
On the Formal Analysis of Hidden Markov Models using Theorem Proving
9/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Hidden Markov Model
A pair of two stochastic processes {Xk , Yk }k≥0 such that
{Xk }k≥0 is an underlying Markov chain
Stochastic Process {Yk }k≥0
{Xk }k≥0 and {Yk }k≥0 are Conditional Independent
On the Formal Analysis of Hidden Markov Models using Theorem Proving
10/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Hidden Markov Model
A pair of two stochastic processes {Xk , Yk }k≥0 such that
{Xk }k≥0 is an underlying Markov chain
Stochastic Process {Yk }k≥0
{Xk }k≥0 and {Yk }k≥0 are Conditional Independent
On the Formal Analysis of Hidden Markov Models using Theorem Proving
10/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Hidden Markov Model
A pair of two stochastic processes {Xk , Yk }k≥0
{Xk }k≥0 is an underlying Markov chain (including states Sunny and
Rainy)
Stochastic Process {Yk }k≥0
Conditional Independent
On the Formal Analysis of Hidden Markov Models using Theorem Proving
11/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Hidden Markov Model
A pair of two stochastic processes {Xk , Yk }k≥0
{Xk }k≥0 is an underlying Markov chain
Stochastic Process {Yk }k≥0 (including states Walk, Shop and
Clean)
Conditional Independent
On the Formal Analysis of Hidden Markov Models using Theorem Proving
11/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Hidden Markov Model
A pair of two conditionally independent stochastic processes {Xk , Yk }k≥0
{Xk }k≥0 is an underlying Markov chain
Stochastic Process {Yk }k≥0
Conditional Independent Yk depends only on Xk and not on any
Xt , such that t 6= k
On the Formal Analysis of Hidden Markov Models using Theorem Proving
12/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Hidden Markov Model - Utilization
HMMs can be used to find
Observation Sequence Probability
State Path Probability
On the Formal Analysis of Hidden Markov Models using Theorem Proving
13/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Hidden Markov Model - Utilization
HMMs can be used to find
Observation Sequence Probability
State Path Probability
Find the probability of occurrence of a particular sequence of X
given an observed sequence of Y (Joint Probability)
On the Formal Analysis of Hidden Markov Models using Theorem Proving
13/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Hidden Markov Model - Utilization
HMMs can be used to find
Observation Sequence Probability
State Path Probability
Find the probability of occurrence of a particular sequence of X
given an observed sequence of Y (Joint Probability)
Find the most probable state sequence of X to generate a
given observed sequence
On the Formal Analysis of Hidden Markov Models using Theorem Proving
13/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Hidden Markov Model - Utilization
HMMs can be used to find
Observation Sequence Probability
State Path Probability
Find the probability of occurrence of a particular sequence of X
given an observed sequence of Y (Joint Probability)
Find the most probable state sequence of X to generate a
given observed sequence
These problems are typically solved by applying
Forward-Backward, Viterbi, or Baum-Welch algorithms
On the Formal Analysis of Hidden Markov Models using Theorem Proving
13/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Hidden Markov Models - Some Applications
HMMs are used in some very safety-critical domains
Tumor/cancer detection
Heart signal recognition
https ://www.myurifemme.com
https ://www.pnas.org
On the Formal Analysis of Hidden Markov Models using Theorem Proving
14/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Analysis of Hidden Markov Models : Comparison
On the Formal Analysis of Hidden Markov Models using Theorem Proving
15/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Analysis of Hidden Markov Models : Comparison
On the Formal Analysis of Hidden Markov Models using Theorem Proving
15/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Analysis of Hidden Markov Models : Comparison
On the Formal Analysis of Hidden Markov Models using Theorem Proving
15/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Analysis of Hidden Markov Models : Comparison
On the Formal Analysis of Hidden Markov Models using Theorem Proving
15/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Analysis of Hidden Markov Models : Comparison
On the Formal Analysis of Hidden Markov Models using Theorem Proving
15/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Analysis of Hidden Markov Models : Comparison
On the Formal Analysis of Hidden Markov Models using Theorem Proving
15/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Higher-order-logic Theorem Proving
Probability Theory
J. Hurd (2002), PhD Thesis, University of Cambridge
Formal Verification of Probabilistic Algorithms.
O. Hasan (2008), PhD Thesis, Concorida University
Formal Probabilistic Analysis using Theorem Proving.
, ITP 2011 T. Mhamdi (2011)
Information-Theoretic Analysis using Theorem Proving.
J. Hölzl and A. Heller (2011), ITP 2011
Three Chapters of Measure Theory.
On the Formal Analysis of Hidden Markov Models using Theorem Proving
16/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Higher-order-logic Theorem Proving
Probability Theory
J. Hurd (2002), PhD Thesis, University of Cambridge
Formal Verification of Probabilistic Algorithms.
O. Hasan (2008), PhD Thesis, Concorida University
Formal Probabilistic Analysis using Theorem Proving.
, ITP 2011 T. Mhamdi (2011)
Information-Theoretic Analysis using Theorem Proving.
J. Hölzl and A. Heller (2011), ITP 2011
Three Chapters of Measure Theory.
Markov Chains
J. Hölzl and T. Nipkow (2012), TACAS 2012
Verifying pCTL Model Checking.
L. Liu, O. Hasan and S. Tahar (2011), ATVA 2011
Formalization of Finite-state Discrete-Time Markov Chains in
HOL
On the Formal Analysis of Hidden Markov Models using Theorem Proving
16/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Proposed Methodology
System Description
System Specification
Higher-Order Logic
Discrete-Time Markov Chains Theory
Formal System Model
Formal System Properties
Theorem Prover
Formal Proofs of System Properties
On the Formal Analysis of Hidden Markov Models using Theorem Proving
17/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Proposed Methodology
System Description
System Specification
Higher-Order Logic
Discrete
Time
Markov
Chain
Classical
Properties
Classified
States
Formal System Model
Classified
Discrete
Time
Markov
Chain
Stationary
Properties
Formal System Properties
Theorem Prover
Formal Proofs of System Properties
On the Formal Analysis of Hidden Markov Models using Theorem Proving
17/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Proposed Methodology
System Description
System Specification
Higher-Order Logic
Discrete
Time
Markov
Chain
Hidden
Markov Model
Properties
Hidden
Markov
Model
Classical
Properties
Classified
States
Formal System Model
Classified
Discrete
Time
Markov
Chain
Stationary
Properties
Formal System Properties
Theorem Prover
Formal Proofs of System Properties
On the Formal Analysis of Hidden Markov Models using Theorem Proving
17/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Proposed Methodology
System Description
System Specification
Higher-Order Logic
Discrete
Time
Markov
Chain
Hidden
Markov Model
Properties
Hidden
Markov
Model
Classical
Properties
Classified
States
Formal System Model
Classified
Discrete
Time
Markov
Chain
Stationary
Properties
Formal System Properties
Theorem Prover
Formal Proofs of System Properties
On the Formal Analysis of Hidden Markov Models using Theorem Proving
17/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Formalization of DTMC
Initial Distribution : ∀ s ∈ S. p0 (s) = Pr (X0 = s)
Transition Probabilities : ∀i, j ∈ S, pij = Pr {Xt+1 = j|Xt = i}
Markov Property :
Pr {Xtn+1 = fn+1 |Xtn = fn , . . . , Xt0 = f0 } = Pr {Xtn+1 = fn+1 |Xtn = fn }
On the Formal Analysis of Hidden Markov Models using Theorem Proving
18/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Formalization of DTMC
Initial Distribution : ∀ s ∈ S. p0 (s) = Pr (X0 = s)
Transition Probabilities : ∀i, j ∈ S, pij = Pr {Xt+1 = j|Xt = i}
Markov Property :
Pr {Xtn+1 = fn+1 |Xtn = fn , . . . , Xt0 = f0 } = Pr {Xtn+1 = fn+1 |Xtn = fn }
Definition : DTMC
` ∀ X p s p0 pij .
dtmc X p s p0 =
(∀ i. i ∈ space s ⇒
(∀ i. i ∈ space s ⇒
(∀ t i j.P{X0 = i} 6=
(pij t i j = Trans
mc property X p s
{i} ∈ subsets s) ∧
(p0 i = P{X0 = i})) ∧
0 ⇒
X p s t 1 i j)) ∧
On the Formal Analysis of Hidden Markov Models using Theorem Proving
18/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Formalization of DTMC
Initial Distribution : ∀ s ∈ S. p0 (s) = Pr (X0 = s)
Transition Probabilities : ∀i, j ∈ S, pij = Pr {Xt+1 = j|Xt = i}
Markov Property :
Pr {Xtn+1 = fn+1 |Xtn = fn , . . . , Xt0 = f0 } = Pr {Xtn+1 = fn+1 |Xtn = fn }
Definition : DTMC
` ∀ X p s p0 pij .
dtmc X p s p0 =
(∀ i. i ∈ space s ⇒
(∀ i. i ∈ space s ⇒
(∀ t i j.P{X0 = i} 6=
(pij t i j = Trans
mc property X p s
{i} ∈ subsets s) ∧
(p0 i = P{X0 = i})) ∧
0 ⇒
X p s t 1 i j)) ∧
On the Formal Analysis of Hidden Markov Models using Theorem Proving
18/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Formalization of DTMC
Initial Distribution : ∀ s ∈ S. p0 (s) = Pr (X0 = s)
Transition Probabilities : ∀i, j ∈ S, pij = Pr {Xt+1 = j|Xt = i}
Markov Property :
Pr {Xtn+1 = fn+1 |Xtn = fn , . . . , Xt0 = f0 } = Pr {Xtn+1 = fn+1 |Xtn = fn }
Definition : DTMC
` ∀ X p s p0 pij .
dtmc X p s p0 =
(∀ i. i ∈ space s ⇒
(∀ i. i ∈ space s ⇒
(∀ t i j.P{X0 = i} 6=
(pij t i j = Trans
mc property X p s
{i} ∈ subsets s) ∧
(p0 i = P{X0 = i})) ∧
0 ⇒
X p s t 1 i j)) ∧
On the Formal Analysis of Hidden Markov Models using Theorem Proving
18/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Formalization of Time-Homogeneous DTMC
Time-Homogeneous Property :
∀ t. pij (t + 1) = pij (t)
On the Formal Analysis of Hidden Markov Models using Theorem Proving
19/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Formalization of Time-Homogeneous DTMC
Time-Homogeneous Property :
∀ t. pij (t + 1) = pij (t)
Definition : Time-Homogeneous DTMC
` ∀ X p s p0 pij .
th dtmc X p s p0 pij =
dtmc X p s p0 pij ∧ FINITE (space s) ∧
∀ t i j.
P{Xt = i} 6= 0 P{X(t+1) = i} 6= 0 ⇒
Trans X p s (t + 1) 1 i j = Trans X p s t 1 i j
On the Formal Analysis of Hidden Markov Models using Theorem Proving
19/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Formalization of Time-Homogeneous DTMC
Time-Homogeneous Property :
∀ t. pij (t + 1) = pij (t)
Definition : Time-Homogeneous DTMC
` ∀ X p s p0 pij .
th dtmc X p s p0 pij =
dtmc X p s p0 pij ∧ FINITE (space s) ∧
∀ t i j.
P{Xt = i} 6= 0 P{X(t+1) = i} 6= 0 ⇒
Trans X p s (t + 1) 1 i j = Trans X p s t 1 i j
On the Formal Analysis of Hidden Markov Models using Theorem Proving
19/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Formalization of Time-Homogeneous DTMC
Time-Homogeneous Property :
∀ t. pij (t + 1) = pij (t)
Definition : Time-Homogeneous DTMC
` ∀ X p s p0 pij .
th dtmc X p s p0 pij =
dtmc X p s p0 pij ∧ FINITE (space s) ∧
∀ t i j.
P{Xt = i} 6= 0 P{X(t+1) = i} 6= 0 ⇒
Trans X p s (t + 1) 1 i j = Trans X p s t 1 i j
On the Formal Analysis of Hidden Markov Models using Theorem Proving
19/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Formalization of Time-Homogeneous DTMC
Time-Homogeneous Property :
∀ t. pij (t + 1) = pij (t)
Definition : Time-Homogeneous DTMC
` ∀ X p s p0 pij .
th dtmc X p s p0 pij =
dtmc X p s p0 pij ∧ FINITE (space s) ∧
∀ t i j.
P{Xt = i} 6= 0 P{X(t+1) = i} 6= 0 ⇒
Trans X p s (t + 1) 1 i j = Trans X p s t 1 i j
On the Formal Analysis of Hidden Markov Models using Theorem Proving
19/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Verification of DTMC Properties
Joint Probability Theorem
Chapman-Kolmogorov Equation
Absolute Probability
On the Formal Analysis of Hidden Markov Models using Theorem Proving
20/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Verification of DTMC Properties
Joint Probability Theorem
Pr (Xt = L0 , · · · , Xt+n = Ln ) =
n−1
Y
(Pr (Xt+k+1 = Lk+1 |Xt+k = Lk ))Pr (Xt = L0 )
k=0
Chapman-Kolmogorov Equation
Absolute Probability
On the Formal Analysis of Hidden Markov Models using Theorem Proving
20/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Verification of DTMC Properties
Joint Probability Theorem
Chapman-Kolmogorov Equation
(m+n)
pij
=
X
(m) (n)
pik pkj
k∈Ω
Absolute Probability
On the Formal Analysis of Hidden Markov Models using Theorem Proving
20/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Verification of DTMC Properties
Joint Probability Theorem
Chapman-Kolmogorov Equation
Absolute Probability
(n)
pj
= Pr (Xn = j) =
X
Pr (X0 = k)Pr (Xn = j|X0 = k)
k∈Ω
On the Formal Analysis of Hidden Markov Models using Theorem Proving
20/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Formalization of Hidden Markov Model
Definition : HMM
` ∀ X Y p sX sY p0 pij pXY .
hmm X Y p sX sY p0 pij pXY =
dtmc X p sX p0 pij ∧ (∀ t. random variable (Y t) p sY ) ∧
(∀ i. i ∈ space sY ⇒ {i} ∈ subsets sY ) ∧
(∀ t a i. P{x | X t x = i} 6= 0 ⇒
(P({x | Y t x = a}|{x | X t x = i}) = pXY t a i)) ∧
∀ t a i tx0 ty0 stsX stsY tsX tsY .
T
P({x | X t x = i} ∩ ktsX {x |
T
ktsY {x | Y (ty0 + k) x = EL
(P({x | Y t x = a}|{x | X t x =
T
{x |
TktsX
ktsY {x |
P({x | Y t x = a}|{x | X t x =
X (tx0 + k) x = EL k stsX } ∩
k stsY }) 6= 0 ⇒
i} ∩
X (tx0 + k) x = EL k stsX } ∩
Y (ty0 + k) x = EL k stsY }) =
i}))
On the Formal Analysis of Hidden Markov Models using Theorem Proving
21/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Formalization of Hidden Markov Model
Definition : Time-Homogenous HMM
` ∀ X Y p sX sY p0 pij pXY .
thmm X Y p sX sY p0 pij pXY =
hmm X Y p sX sY p0 pij pXY ∧
FINITE (space sX ) ∧ FINITE (space sY ) ∧
∀ t a i j. P{x | X t x = i} 6= 0 ∧ P{x | X (t + 1) x = i} 6= 0 ⇒
(Trans X p s (t + 1) 1 i j = Trans X p s t 1 i j) ∧
(pxy (t + 1) i j = pxy t i j)
On the Formal Analysis of Hidden Markov Models using Theorem Proving
22/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Verification of HMM Properties
Joint Probability of HMM
Pr (Y0 , · · · , Yt , X0 , · · · , Xt ) = Pr (X0 )Pr (Y0 |X0 )
t−1
Y
Pr (Xk+1 |Xk )Pr (Yk+1 |Xk+1 )
k=0
Observation Sequence Probability
State Path Probability
Best Path Selection
On the Formal Analysis of Hidden Markov Models using Theorem Proving
23/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Verification of HMM Properties
Joint Probability of HMM
Observation Sequence Probability
Pr (Y0 , · · · , Yt ) =
X
Pr (X0 )Pr (Y0 |X0 )
X0 ,··· ,Xt ∈
space s
t−1
Y
Pr (Xk+1 |Xk )Pr (Yk+1 |Xk+1 )
k=0
State Path Probability
Best Path Selection
On the Formal Analysis of Hidden Markov Models using Theorem Proving
23/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Verification of HMM Properties
Joint Probability of HMM
Observation Sequence Probability
State Path Probability
Pr {X0 , · · · , Xt } =
X
Pr {X0 }Pr {Y0 |X0 }
Y0 ,··· ,Yt ∈
space s1
t−1
Y
Pr {Xk+1 |Xk }Pr {Yk+1 |Xk+1 }
k=0
Best Path Selection
On the Formal Analysis of Hidden Markov Models using Theorem Proving
23/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Verification of HMM Properties
Joint Probability of HMM
Observation Sequence Probability
State Path Probability
Best Path Selection
Maximum{Pr {X0 , · · · , Xt }}
On the Formal Analysis of Hidden Markov Models using Theorem Proving
23/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Application : DNA Sequence Analysis - Labelling
Possible DNA labels
Exons (E)
5’ splice site (5)
Introns (I)
On the Formal Analysis of Hidden Markov Models using Theorem Proving
24/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Application : DNA Sequence Analysis - Labelling
Possible DNA labels
Exons (E)
5’ splice site (5)
Introns (I)
Every DNA Fragment is composed of one of the following
nucleotides
A : Adenine
T : Thymine
G : Guanine
C : Cytosine
On the Formal Analysis of Hidden Markov Models using Theorem Proving
24/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Application : DNA Sequence Analysis - Labelling
Possible DNA labels
Exons (E)
5’ splice site (5)
Introns (I)
Every DNA Fragment is composed of one of the following
nucleotides
A : Adenine
T : Thymine
G : Guanine
C : Cytosine
We know the probabilities of emissions of A, T, G, C
We want to find the probability associated with a particular
DNA labelling sequence if we observe the following sequence
of nucleotides :
[C ;T ;T ;C ;A ;T ;G ;T ;G ;A ;A ;A ;G ;C ;A ;G ;A ;C ;G ;T ;A ;A ;G ;T ;C ;A]
On the Formal Analysis of Hidden Markov Models using Theorem Proving
24/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Application : DNA Sequence Analysis
A
A
A
C
C
C
G
0.25
G
0.05
0.25
0.25
0.1
T
0.95
0.25
Start
1.0
G
0.4
0
T
T
0.1
0
E
0.1
0.4
5
0.9
On the Formal Analysis of Hidden Markov Models using Theorem Proving
1.0
I
0.1
End
0.9
25/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Application : DNA Sequence Analysis
A
A
A
C
C
C
G
0.25
G
0.05
0.25
0.25
0.1
T
0.95
0.25
Start
1.0
G
0.4
0
T
T
0.1
0
E
0.1
0.4
5
0.9
1.0
I
0.1
End
0.9
Joint Probability Example :
P[E E E E E E E E E E E E E E E E E E 5 I I I I I I I] ∩
[C ;T ;T ;C ;A ;T ;G ;T ;G ;A ;A ;A ;G ;C ;A ;G ;A ;C ;G ;T ;A ;A ;G ;T ;C ;A]
On the Formal Analysis of Hidden Markov Models using Theorem Proving
25/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Application : DNA Sequence Analysis
A
A
A
C
C
C
G
0.25
G
0.05
0.25
0.25
0.1
T
0.95
0.25
Start
1.0
G
0.4
0
T
T
0.1
0
E
0.1
0.4
5
0.9
1.0
I
0.1
End
0.9
State Space
` dna = A | G | T | C
` state = START | E | I | FIVE | END
On the Formal Analysis of Hidden Markov Models using Theorem Proving
25/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Application : DNA Sequence Analysis
A
A
C
C
C
G
G
G
0.25
0.05
0.25
0.4
0
0.1
T
0.25
T
0.95
0.25
Start
A
1.0
T
0.1
0
E
0.1
0.4
5
0.9
1.0
I
0.1
End
0.9
State Path and DNA Sequence
` state seq = [START; E; E; E; E; E; E; E; E; E; E; E; E; E; E; E; E; E; E; 5; I; I; I; I; I; I; I; END]
` dna seq = [C; T; T; C; A; T; G; T; G; A; A; A; G; C; A; G; A; C; G; T; A; A; G; T; C; A]
On the Formal Analysis of Hidden Markov Models using Theorem Proving
25/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Application : DNA Sequence Analysis
DNA Model
thmm X Y p sX sY ini distr trans distr e distr
∧ space sX = univ(: state) ∧ space sY = univ(: dna)
Joint Probability of the DNA Sequence
` ∀ X Y p sX sY .
thmm X Y p sX sY ini distr trans distr e distr ∧
space sX = univ(: state) ∧ space sY = univ(: dna) ⇒
T|state seq|−1
P( k=0
{x | X k x = EL k state seq} ∩
T|dna seq|−1
{x | Y k x = EL k dna seq}) =
k=0
0.2518 ∗ 0.923 ∗ 0.14 ∗ 0.95 ∗ 0.45
0.2518 ∗ 0.923 ∗ 0.14 ∗ 0.95 ∗ 0.45 ≈ e −41.22
log(P[E E E E E E E E E E E E E E E E E E 5 I I I I I I I]) = -41.22
On the Formal Analysis of Hidden Markov Models using Theorem Proving
26/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Proof Automation
An SML function that accepts
Initial distribution
Transition probabilities
Emission distribution
List of Markov Chain states
List of observation states
and returns the corresponding joint probability distribution
using our formally verified Joint Probability theorem
On the Formal Analysis of Hidden Markov Models using Theorem Proving
27/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Proof Automation
An SML function that accepts
Initial distribution
Transition probabilities
Emission distribution
List of Markov Chain states
List of observation states
and returns the corresponding joint probability distribution
using our formally verified Joint Probability theorem
Based on an intermediate lemma and some arithmetic rewriting
techniques
On the Formal Analysis of Hidden Markov Models using Theorem Proving
27/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Proof Automation
We also automated the process to find the state path which
has the best probability of generating a given observation
sequence
On the Formal Analysis of Hidden Markov Models using Theorem Proving
28/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Proof Automation
We also automated the process to find the state path which
has the best probability of generating a given observation
sequence
Compute the set of all possible state paths
Compute the probability of each of these paths as described
earlier
Returns the path which has the best probability
On the Formal Analysis of Hidden Markov Models using Theorem Proving
28/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Proof Automation
We also automated the process to find the state path which
has the best probability of generating a given observation
sequence
Compute the set of all possible state paths
Compute the probability of each of these paths as described
earlier
Returns the path which has the best probability
These automatic procedures make the usage of our
formalization quite user-friendly for non-experts in formal
methods
On the Formal Analysis of Hidden Markov Models using Theorem Proving
28/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Conclusions
Summary
Formalization of Discrete-time Markov Chains and Hidden
Markov Models
Formal Verification of their classical Properties
On the Formal Analysis of Hidden Markov Models using Theorem Proving
29/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Conclusions
Summary
Formalization of Discrete-time Markov Chains and Hidden
Markov Models
Formal Verification of their classical Properties
Facilitate Formal reasoning about HMMs
On the Formal Analysis of Hidden Markov Models using Theorem Proving
29/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Conclusions
Summary
Formalization of Discrete-time Markov Chains and Hidden
Markov Models
Formal Verification of their classical Properties
Facilitate Formal reasoning about HMMs
Case Study : A DNA Analysis Example
On the Formal Analysis of Hidden Markov Models using Theorem Proving
29/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Conclusions
Summary
Formalization of Discrete-time Markov Chains and Hidden
Markov Models
Formal Verification of their classical Properties
Facilitate Formal reasoning about HMMs
Case Study : A DNA Analysis Example
Some Proof Automation
On the Formal Analysis of Hidden Markov Models using Theorem Proving
29/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Conclusions
Summary
Formalization of Discrete-time Markov Chains and Hidden
Markov Models
Formal Verification of their classical Properties
Facilitate Formal reasoning about HMMs
Case Study : A DNA Analysis Example
Some Proof Automation
Future Work
More Case Studies
Formal Verification of Forward-Backward, Viterbi and
Baum-Welch algorithms
On the Formal Analysis of Hidden Markov Models using Theorem Proving
29/30
Introduction
Related Work
Proposed Methodology
Formalization
Case Study
Conclusions
Thanks !
More information : hvg.ece.concordia.ca
On the Formal Analysis of Hidden Markov Models using Theorem Proving
30/30
© Copyright 2026 Paperzz