Performance Analysis of ARQ Protocols using a Theorem Prover Osman Hasan Sofiene Tahar Hardware Verification Group Concordia University Montreal, Canada ISPASS 2008
Performance Analysis of ARQ Protocols using a Theorem Prover
Osman Hasan Sofiene Tahar
Hardware Verification Group Concordia University
Montreal, Canada
ISPASS 2008
O. Hasan 2 Performance Analysis of ARQ Protocols using Theorem Proving
Objectives
n Probabilistic Theorem Proving “A robust and precise probabilistic analysis technique”
n What is it?
n Why do we need it? n How can we apply it for the performance analysis of
ARQ Protocols?
O. Hasan 3 Performance Analysis of ARQ Protocols using Theorem Proving
Outline
n Introduction
n Theorem Proving based Performance Analysis
n Performance Analysis of ARQ Protocols
n Conclusions
O. Hasan 4 Performance Analysis of ARQ Protocols using Theorem Proving
Motivation
n Performance Analysis
Environmental Conditions
Aging Phenomena
Probabilistic Choice
Unpredictable Inputs
Noise
n Simulation n State-of-the-art n Inaccurate results
n Theorem Proving n Proposed Solution
O. Hasan 5 Performance Analysis of ARQ Protocols using Theorem Proving
Performance Analysis
Hardware Software
System Model
Property Satisfied?
Random Components
Probabilistic and Statistical Properties
Computer Based Analysis Framework
R andom Variables(Discrete/
C ontinuous)
O. Hasan 6 Performance Analysis of ARQ Protocols using Theorem Proving
Probabilistic Analysis Approaches
Simulation Formal Methods
Model Checking Theorem Proving
Random Components
Probabilistic State Machine
good
Analysis
Accuracy
Expressiveness
No CPU Time Issue
Automation
Approximate random variable
functions
Observing some test cases
û
ü
û
ü
Probabilistic State Machine
Exhaustive Verification
ü
û
û
ü
Precise random variable
functions
Mathematical Reasoning
ü
ü
ü
û
Simulation Formal Methods
Model Checking Theorem Proving
O. Hasan 7 Performance Analysis of ARQ Protocols using Theorem Proving
Theorem Prover
n A notation (syntax) n A small set of fundamental axioms (facts)
n A Boolean variable can be True or False: ∀ a.(a = T) ∨ (a =F) n A small set of inference (deduction) rules
n Equality is transitive: ∀ a b c. (a = b) ∧ (b = c) ⇒ (a = c)
n Soundness n Every new theorem must be created from
n Basic axioms and primitive inference rules n Already proved theorems or inference rules
n Theory (collection of verified theorems in a file) n Can be reloaded in theorem provers n Facilitates the instant utilization of already verified theorems
O. Hasan 8 Performance Analysis of ARQ Protocols using Theorem Proving
Theorem Proving – Example
n Check if y>x for the given system (x is a natural number)
1 y>x Problem statement
2 (x+1)2>x Implementation
3 (x+1).(x+1)>x Definition of Square
4 (x+1).x+(x+1).1>x Distributivity
5 x.x+1.x+x.1+1.1>x Distributivity
6 x.x+x+x+1>x Multiplicative Identity
7 x.x+x+1+x>x Additive Commutivity
8 x.x+x+1>0 Addition Cancellation
9 True Natural numbers > 0
2)1( +xx y
O. Hasan 9 Performance Analysis of ARQ Protocols using Theorem Proving
Outline
n Introduction
n Theorem Proving based Performance Analysis
n Performance Analysis of ARQ Protocols
n Conclusions
O. Hasan 10 Performance Analysis of ARQ Protocols using Theorem Proving
HOL Theorem Prover
n Higher-order logic theorem prover n University of Cambridge, UK
n 5 axioms n 8 primitive inference rules
n Numerous proof assistants are available
n Inbuilt mathematical theories of Boolean, list, set, integers, real analysis, measure, and probability theory
O. Hasan 11 Performance Analysis of ARQ Protocols using Theorem Proving
Theorem Proving Based Performance Analysis
System Description
Sys
tem
Pro
pert
ies
(Dis
cret
e R
ando
m V
aria
bles
)
Sys
tem
Pro
pert
ies
(Con
tinuo
us R
ando
m V
aria
bles
)
System Model
Probabilistic Analysis
Theorems
Discrete Random Variables
Continuous Random Variables
Random Components
Probabilistic Properties
Statistical Properties
Probabilistic Properties
Statistical Properties
Theorem Prover
Formal Proofs of Properties
System Properties
O. Hasan 12 Performance Analysis of ARQ Protocols using Theorem Proving
Formal Verification of Random Variables
n Measure Theory n Probability space of Infinite Boolean sequence (B
∞)
B∞: positive integers → Boolean
n A random variable that n Accepts : α n Returns: β
can be modeled in HOL as a function
f : α → B∞ → (β x B
∞ )
0 1 2 3 4 5 6 7 T/F T/F T/F T/F T/F T/F T/F T/F
O. Hasan 13 Performance Analysis of ARQ Protocols using Theorem Proving
Random Variables in HOL Example
n Coin Flip (Head, Tail)
B∞ → (flip_outcome x B∞
)
n Algorithm
flip s = (if (top element of s) then
Head else Tail, remaining portion of s)
n Probabilistic Properties
P {s | flip s = Head} = ½
O. Hasan 14 Performance Analysis of ARQ Protocols using Theorem Proving
Discrete Random Variables in HOL
Theorems: Discrete Random Variables
Random variable
HOL Funtions PMF (Pr (X = n))
Uniform(m) unif_rv
Bernoulli(p) bern_rv
Geometric(p) geom_rv
m1
p
npp )1( −
O. Hasan 15 Performance Analysis of ARQ Protocols using Theorem Proving
Continuous Random Variables in HOL
Theorems: Continuous Random Variables
Random Variable HOL Functions CDF (Pr (X ≤ x)
Exponential(l)
exp_rv
Uniform(a,b) uniform_rv
Rayleigh(l) rayleigh_rv
⎭⎬⎫
⎩⎨⎧
<
≤
x0 ,exp-10 x ,0
lx-
⎪⎪⎭
⎪⎪⎬
⎫
⎪⎪⎩
⎪⎪⎨
⎧
<
≤<
≤
xb 1,
bxa ,a-ba-x
a x,0
⎪⎭
⎪⎬⎫
⎪⎩
⎪⎨⎧
<
≤
x0 ,exp-1
0 x ,0
2
2
2x-l
O. Hasan 16 Performance Analysis of ARQ Protocols using Theorem Proving
Verification of Statistical Properties
Theorem: Expectation Properties
[ ]∑∑==
=⎥⎦
⎤⎢⎣
⎡ n
ii
n
ii XExXEx
11
Definition: Expectation for Discrete Random Variables
∑∞
=
==1
)Pr(][i
iXiXEx
ccEx =][
O. Hasan 17 Performance Analysis of ARQ Protocols using Theorem Proving
Verification of Statistical Properties
Theorems: Discrete Random Variables
Random variable
HOL Function
Expectation Variance
Uniform(m)
unif_rv
Bernoulli(p) bern_rv
Geometric(p) geom_rv
2m
121)1( 2 −+m
p )1( pp −
p1
2
1pp−
O. Hasan 18 Performance Analysis of ARQ Protocols using Theorem Proving
Probabilistic Theorem Proving – Case Studies
n Very few examples n Roundoff error analysis of a Digital Processer
n Verification of a couple of probabilistic properties
n Probabilistic Analysis of Algorithms n Miller Rabin Test
n Coupon-Collector’s Problem
O. Hasan 19 Performance Analysis of ARQ Protocols using Theorem Proving
Outline
n Introduction
n Theorem Proving based Performance Analysis
n Performance Analysis of ARQ Protocols
n Conclusions
O. Hasan 20 Performance Analysis of ARQ Protocols using Theorem Proving
Automatic Repeat Request (ARQ)
n Reliable communication between computers
n Transmitter n Repeats transmission of a data frame until it receives an ACK
n Receiver n Discards erroneous data frames
n Sends Acknowledgment (ACK) for Error-free data frames
n Applications n Transmission Control Protocol (TCP)
n High-level Data Link Control (HDLC) Standard
O. Hasan 21 Performance Analysis of ARQ Protocols using Theorem Proving
ARQ Protocols
n Implementation variants of ARQ principle n Stop-and-Wait n Go-Back-N n Selective Repeat
n Performance Analysis Metric n Message Delay
n Both simulation and state-based formal techniques fail to produce reasonable results n A subtle interaction of a number of distributed
components
O. Hasan 22 Performance Analysis of ARQ Protocols using Theorem Proving
Stop-and-Wait Protocol
n Delay (Unsuccessful Transmission Trial)
n Delay (Successful Transmission Trial)
outfu ttT +=
)(2 procpropafs ttttT +++=
O. Hasan 23 Performance Analysis of ARQ Protocols using Theorem Proving
Go-Back-N Protocol
n Delay (Unsuccessful Transmission Trial)
n Delay (Successful Transmission Trial)
outfu ttT +=
fs tT =
O. Hasan 24 Performance Analysis of ARQ Protocols using Theorem Proving
Selective Repeat Protocol
n Delay (Unsuccessful Transmission Trial)
n Delay (Successful Transmission Trial)
fu tT =
fs tT =
O. Hasan 25 Performance Analysis of ARQ Protocols using Theorem Proving
Average Message Delay of ARQ Protocols
n p: Bit-error probability of the channel
n Average (Message Delay) = ?
n Step 1: Message Delay (Tu,Ts,p) n Geometric Random Variable
§ Delay = (G-1)Tu + Ts
n Step 2: Average of the above random variable
O. Hasan 26 Performance Analysis of ARQ Protocols using Theorem Proving
Step 1: Message Delay in HOL
n Geometric random variable function (geom_rv) n Success probability = ?
n Error behaviour of single bit: bern_rv(p)
⊢∀ n p. f_err 0 p = false ∧ f_err (n + 1) p = bern_rv(p) ∨ (f_err n p)
Definition: Frame Error
⊢∀ nf na p. suc_p_arq nf na p = P { (f_err nf p) ∨ (f_err na p) = false }
Definition: Probability of Successful Transmission
O. Hasan 27 Performance Analysis of ARQ Protocols using Theorem Proving
Step 1: Message Delay in HOL
n Proof n Boolean Logic, Positive Integers, Real Numbers, Set,
Probability
⊢∀ nf na p. 0 ≤ p ∧ p ≤ 1 ⇒ suc_p_arq nf na p = (1-p) (nf + na)
Theorem: Probability of Successful Transmission
⊢∀ nf na p Tu Ts. arq_del = Tu (geom_rv ((1-p) (nf + na)) – 1) + Ts
Definition: ARQ Message Delay
O. Hasan 28 Performance Analysis of ARQ Protocols using Theorem Proving
Step 2: Average Message Delay
n Proof n Already verified Expectation properties
n Boolean Logic, Positive Integers, Real Numbers, Set, Probability
Theorem: Linearity of Expectation
bXaEbaXEx +=+ ][][
[ ]∑∑==
=⎥⎦
⎤⎢⎣
⎡ n
ii
n
ii XExXEx
11
ccEx =][
O. Hasan 29 Performance Analysis of ARQ Protocols using Theorem Proving
Average Message Delay in HOL Stop-and-Wait Protocol
n Proof: n n Expectation of Geometric random variable
⊢∀ nf na p tout tprop tproc tf ta. sw_del nf na p tout tprop tproc tf ta = (tf + tout) (geom_rv ((1-p) (nf + na)) – 1) + tf + ta + 2(tproc + tprop)
Definition: Stop-and-Wait Message Delay
⊢∀ nf na p tout tprop tproc tf ta. (0 ≤ p) ∧ (p < 1) ⇒ expec (sw_del nf na p tout tprop tproc tf ta) = (tf + tout) (1 - (1-p) (nf + na))/((1-p) (nf + na)) + tf + ta + 2(tproc + tprop)
Theorem: Average Stop-and-Wait Message Delay
bXaEbaXEx +=+ ][][
O. Hasan 30 Performance Analysis of ARQ Protocols using Theorem Proving
Average Message Delay in HOL Go-Back-N Protocol
n Proof: n n Expectation of Geometric random variable
⊢∀ nf na p tout tf. gbn_del nf na p tout tf = (tf + tout) (geom_rv ((1-p) (nf + na)) – 1) + tf
Definition: Go-Back-N Message Delay
⊢∀ nf na p tout tf. (0 ≤ p) ∧ (p < 1) ⇒ expec (gbn_del nf na p tout tf) = (tf + tout) (1 - (1-p) (nf + na))/((1-p) (nf + na)) +tf
Theorem: Average Go-Back-N Message Delay
bXaEbaXEx +=+ ][][
O. Hasan 31 Performance Analysis of ARQ Protocols using Theorem Proving
Average Message Delay in HOL Selective Repeat Protocol
n Proof: n n Expectation of Geometric random variable
⊢∀ nf na p tf. sr_del nf na p tf = (tf) (geom_rv ((1-p) (nf + na)) – 1) + tf
Definition: Stop-and-Wait Message Delay
⊢∀ nf na p tf. (0 ≤ p) ∧ (p < 1) ⇒ expec (sr_del nf na p tf) = (tf)/((1-p) (nf + na))
Theorem: Average Stop-and-Wait Message Delay
bXaEbaXEx +=+ ][][
O. Hasan 32 Performance Analysis of ARQ Protocols using Theorem Proving
Outline
n Introduction
n Theorem Proving based Performance Analysis
n Performance Analysis of ARQ Protocols
n Conclusions
O. Hasan 33 Performance Analysis of ARQ Protocols using Theorem Proving
Conclusions
n Probabilistic Theorem Proving n Model randomness in systems with higher-order-logic random
variables n Verify probabilistic and statistical properties in a theorem prover n Exact Answers
n Useful for the analysis of Safety critical application
n Performance Analysis of ARQ Protocols n Delay Characteristic → Higher-order-logic random variable n Verification of Linearity of Expectation Property in HOL
n Results exactly match the paper-and-pencil based analysis methods § 100% precise
O. Hasan 34 Performance Analysis of ARQ Protocols using Theorem Proving
Conclusions
n Probabilistic Theorem Proving is not a “golden solution” to all performance analysis problems n Interactive and tedious nature
n Less critical sections of the system n Simulation
n Critical sections of the system that can be expressed as a Markov Chain n Model Checking
n Critical sections of the system that cannot be handled by Model Checking n Thereom Proving
O. Hasan 35 Performance Analysis of ARQ Protocols using Theorem Proving
Thank you
For more information: http://hvg.ece.concordia.ca
Contact: [email protected]
O. Hasan 37 Performance Analysis of ARQ Protocols using Theorem Proving
Performance Analysis Basics – Random Variables
n Discrete Random Variables n Attain a countable number of values
n Examples n Uniform (countable values in an interval [a,b])
n Bernoulli (True, False)
n Continuous Random Variables n Attain an uncountable (infinite) number of values
n Examples n Uniform (all real values in an interval [a,b])
n Exponential (The time between independent events)
O. Hasan 38 Performance Analysis of ARQ Protocols using Theorem Proving
Performance Analysis Basics – Properties of Random Variables
n Used to characterize system’s behaviour n Probabilistic properties
n Probability (Multiplier delay = x)
n Statistical properties n Average message delay of a telecommunication
protocol
n Major decision making criteria in performance analysis