English: Software Reliability Methods
Doron A.Peled
http://u.cs.biu.ac.il/~doronp/srm.html
形式化方法的研究牵涉了数学、计算机科学中的不同领域。本书中描述的主要技术是基于自动机理论和逻辑。
而形式化方法、技术和工具中还用到一些更深的思想,比如机器学习、微分方程、数据结构、博弈论等。
经过对其多年的研究,我已经确信这是最有意思的研究领域。
软件开发过程中的质量控制
演绎软件验证(deductive software verification)
图2.1中表示的是有向图的一个例子。节点的集合是{r1,r2,…,r9}。
所有的边如下:{(r1,r2),(r2,r3),(r3,r1),(r2,r5),(r3,r4),(r4,r4),(r5,r6),
Turning Machine
复杂度指标
- 空间/时间
- 度量(多项式,指数)
- 确定性/非确定性
first order loigc
codomain
first order: 公式中所有变元的值域为一常量domain
集合变元x:x的取值可以是对象的集合
signature G=(V,F,R)
arity(元数):参数的个数。 加法函数add()的元数为2,
sine()函数的元数为1
项:函数和变元所构造的表达式。
例如,令v1为一变元,zero和one为常量,add为二元函数符号,
则add(one,one)和add(add(one,one),v1)为项
BNF
term:=var|const|func(term,...terms)
论域 D : 一个值的集合
结构 S=(G,D,F,R,f)
Examples:
+
本身只是一个语法对象,通过f映射赋予加法含义assignment: 将变元集合V中变元映射到论域D中值,记作: α:V→D
Examples:
设D为整数集,变元集合V={v1,v2,v3};可设一赋值为 α={v1↦3,v2↦0,v3↦−5}
递归定义:
Example:
整数域和赋值 α={v1↦2,v2↦3,v3↦4}
令f将add映射到整数上的加法:
简单公式:
simpform::=rel(term,term,...,term)|term≡term
量词(quantifier):
一阶公式的语义解释:
变体(variant): 令a为赋值,v为变元,d为给定论域D中一值。
变体a[d/v]表示:
the semantic of quantified formulas is defined as follows:
??
When $$ for every strucuture $\Gamma \models^{S} \varphi $, we say $\varphi$ follow from $\Gamma$,
and write $\Gamma \models \varphi$.
a proof system
Fermat’s conjecture:
正确性(soundness)的含义是:该系统只能被用来证明正确的事实。也就是说,如果 Γ⊢φ ,那么一定有 Γ⊨φ 。
完备性(completeness)的含义是:如果 Γ⊨φ ,那么一定有 Γ⊢φ 。
一阶逻辑是半可判定的(semi-decidable):没有算法能够检验 Γ⊨φ 是否成立,
但存在一算法,当时 Γ⊨φ 成立时,可构造出 Γ⊢φ 的证明
可满足性问题(satisfiability problem): 检查是否存在赋值以满足一个给定命题逻辑公式的问题
PVS system
type system
机械化定理证明器(mechanized theorem prover)
the aim of modeling is to reduce the checked system.
sequential system
concurrent system
reactive system
Example:(distributed systems): a specification of airline
reservation system.
non-determinism:
the following are some of the topics one may consider when modeling software system.
transition system
Question:
In reality, transitions among different processes maybe overlapped
in time. How does the interleaving model to deal with it?
交换代数么?
Formally, a transition system (S,T,) is defined as follows:
A first order structure S
An execution of a system is a sequence of states.
A nondetermined scheduler
LTL
CTL
fairness: refer to semantic constraints imposed on interleaved
executions of concurrent systems.
fairness assumption: to rule out infinite executions that
are unreasonable for architecture of systems.
To demonstrate this, and some of the above fairness conditions,
consider a program with two processors P1 and P2 .
the criticism of the interleaving model:
to relate the partial order execution model to concurrent software,
observe that concurrent programs usually have a number of
components, each having its own local state space.
For example, we may have a separate component for each
the linearization of partial order
验证与规约:
形式化规约 -> formal specification can be used as a contract
between client and developers.
A specification needs to be precise and has a unique and agreed upon
interpretation. Therefore, a specification formalization is required to have
a well-defined syntax and precise semantics.
Question: Does the system satisfy its specification?
trade off: effective vs. expressiveness -> no sliver bullet
modal logic
the syntax of LTL:
the semantic of LTL:
the modal operator:
nexttime
eventually
always
until
release
the axiomatization includes three parts
- the first part consists of eight axioms:
the second part consists of a sound and complete axiomatization for propositional logic.
the proof system also includes the proof rule:
?
ω automata: finite automata over infinite words.
ω regular language:
Bu¨chi automata:
?
büchi自动机 wiki
Model checking: the algorithmic verification of programs against temporal logic specification.
a typical state representation:
Buchi automata
the question in the next section: Buchi automata are closed
under intersection, union and complementation.
An important property for a specification formalism is its closure
under the Boolean operators and
, or
and not
.
question: how to translate LTL into generalized Buchi automata
safety property
Floyd
a flowchart has four kinds of nodes (see Figure 7.1)
partial correctness: {φ}P{ψ}
total correctness:
7.2.1 含数组变量赋值的问题
7.2.2 修改证明系统
prrtially ordered domain:
example:
>
well founded domain: a partially ordered domain that
contains no infinite decreasing sequence, i.e.,
no sequence of the form w0>w1>⋯>wn>…
Hoare Axiom
It takes the postcondition , describing states after the
execution of the assignment , and translates it to the
corresponding precondition, stated in terms of the
variables before the assignment。
process algebras are formalisms for modelling the behavior of systems.
nondeterministic choice
Since process algebra usually deals with the issues of comparing
different systems, choosing right corresponding criteria
between system is of great importance.
agent: an abstract description of a system.
the main research contents of process algebra:
another important ingredient of process algebra: a collection of comparsion criteria,
i.e., equivalence relations between agents.
In process algebra, there is usually no explicit notation of a state as
a mapping from variables to values.
process algebra is focus on the the actions of a system,
rather than its states.
invisible(silent,internal)
event: E1→αE2
Graph vs configuration
extended event: E1⇒αE2
CCS
the agents can be defined in BNF as follows:
α.E→αE
E→αE′E+F→αE′
F→αF′E+F→αF′
E→αE′,α,α¯∉RE∖R→→αE′∖R
how the event α||A→βα||(α||A) is derived from the the axiom and rules.
Figure 8.3 describes the graph of agent α.(β.(δ||δ¯)+γ) .
example: buy(x).(insure¯¯¯¯¯¯¯¯¯¯(x).(drive¯¯¯¯¯¯¯¯(x)))
the hierarchy (a partial order) of different equvalence
trace: a finite sequence of actions executed by a given agent.
T(E) : the set of all the traces that can be performed from an agent E.
a failure of an agent E:
Let Fail(E) be the set of failures of agent E. If Fail(E) = Fail(F),
say that E and F are failure equivalent.
Figure 8.10 depicts the hierarchy of equvalences.
检查agent E和F之间互摸拟等价的经典算法:
the partition algorithm is as follows:
Language of Temporal Ordering Specification.
In Lotos, agents are called processes, a process is defined as follows:
process process_name [action_list] :=
behavior_expression
end proc
differ from CCS, Lotos does not contains co-action.
LOTOS provides three kinds methods to merge concurrent processes:
Selective synchronization
enabling operator
the levels of tesing:
regression
white box
the hierarchy of dataflow coverage criteria
markov chain
two verification tasks:
abstract: reduce a system of infitine state to a finite state one.
Consider a concrete transition system P (its structure will be given later)
whose state space is AP={S,}
two simultion relations:
The forward simulation relation R must satisfy the following conditions
combination lock automata
Figure 10.4 gives a combination lock automata for n =5.
10.2.4 黑盒死锁检测
Calculating distinguishing sequence
distiguishing set: ds(C)={dist(s,r)|s∈C∨r∉C}
10.2.7 黑盒检验
cleanroom method
Reference: 《零缺陷程序设计》
10.3.1 验证
10.3.2 证明审查
10.3.3 测试
UML
SCADE Suite建模语言为 SSM(Graphical Esterel) + Lustre
Message Sequence Chart(MSC)
the goal of MSC: to describe scenario involving processes communication.
It can be used to denote the communication structure of typical or exceptional executions of a system,
or a counterexample found during testing or model checking.
Figure 11.1 and 11.2 show corresponding graphical and
textual representation of an MSC.
tools:
- an analyzer for message sequence charts
MSC semantics: partically ordered set of events (偏序集)
The sematics of an MSC dependes on the architectural parameters;
it can differ between architectures with fifo (first-in, first out) or
non-fifo queues, or between architectures with one or
multiple incoming message queues.
Each MSC corresponds to a graph (S,<) , its semantic interpretation
that assumes that for a pair of MSC events p,q∈S ,
p<q means p precedes q:
Notices: Controlability
the figure 11.1 describes an interaction between three processes,
P1,P2 and P3.
verification algorithms for MSC:
Race: a pair of MSC events p,q such that
HMSC(Highlevel Message Sequence Chart)
the specification of MSC is a template, denoting a set of events
(sending and receiving of message) and their relative order;
An example of a template and a matching MSC scenario appears in
Figure 11.5. In both charts, there are three processor, P1, P2 and P3.
The result of this match is that s2 is paired with σ1 ,
r2 with ρ1 , s1 with σ3 , and r1 with ρ3 .
Figure 11.6 represents the flowchart of the process mutex()
form the following attempt at solving the mutual exclusion:
limitations
hierarchical state graphs -> STATECHART
In Figure 11.7, the state C contains a subgraph which consists of
the states A and B.
A transition from a superstate replaces a transition from
any of the substate that are included within it.
in Figure 11.8,
A superstate can contains several concurrent components
In Figure 11.9, superstate S incliudes two concurrent components,
C and F
STATECHARTS are intended especially for specifying reactive system.
en(T)
ex(T)
in(T)
transition: bar