Professional Documents
Culture Documents
TON RI RC 2
Assignment 2
Software verification
GVHD:
Lp A01,
SV:
Nguyn An Khng
Hunh Tng Nguyn
Bi Hoi Thng
Chiu th 4
Nguyn Tun Kin - 51307060
ng Quc Tng - 51307132
L Anh Kit - 51001624
Nguyn Ngc Thanh Bnh - 51307005
Mc lc
1 Problem 1: Return the
1.1 Model . . . . . . . .
1.2 Example . . . . . . .
1.3 Failure example . . .
maximum
. . . . . . .
. . . . . . .
. . . . . . .
absolute
. . . . . .
. . . . . .
. . . . . .
. . . . . .
number between
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
value of a number
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
an
. .
. .
. .
5 Kt lun
two
. . .
. . .
. . .
any numbers
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
2
2
2
2
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
2
2
2
2
3
function
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
3
3
3
3
3
3
numbers
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
4
4
4
4
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
for a quadratic
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
array/list of N
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Trang 1/4
This report describe 6 programming problems using Propositional/ Predicate logics. All expression are in
Conjunctive Normal Form (CNF) Using SPIN tool to model check 2 problems
1
1.1
1.2
Example
1.3
Failure example
2
2.1
P = (x 0 z = x) ((x 0) z = x)
rewritten in CNF
P = (x 0 z = x) ((x 0) z = x) (z = x z = x)
2.2
Example 1
2.3
Example 2
Trang 2/4
2.4
Failure example
3
3.1
Let = b2 4ac
P = ( > 0 z = 2) ( = 0 z = 1) ( < 0 z = 0)
rewritten in CNF
P = ( 6= 0 z = 1) ( 0 z = 2) ( < 0 z = 1 z = 2) ( 0 z = 0) ( > 0 z = 0 z =
1) ( = 0 z = 0 z = 2) (z = 0 z = 1 z = 2)
3.2
Example 1
3.3
Example 2
3.4
Example 3
3.5
Failure example
Trang 3/4
4
4.1
Let P(x,N) is the specification of the program to find the maximum of an array x of N elements
P (x, N ) = (x[N ] > P (x, N 1) z = x[N ]) ((x[N ] > P (x, N 1) z = P (x, N 1))
rewritten in CNF
P (x, N ) = (x[N ] > P (x, N 1) z = P (x, N 1)) ((x[N ] > P (x, N 1) z = x[N ]) (z = x[N ] z =
P (x, N 1))
4.2
Example 1
4.3
Failure example
Kt lun
Trong bo co ny chng ti trnh by v mt cch pht hin li v nh gi tin cy ca d liu thu thp.
Ti liu
[1] Nguyn An Khng, Hunh Tng Nguyn "Propositional Logic I & II.", Lecture Notes
Trang 4/4