SlideShare ist ein Scribd-Unternehmen logo
1 von 17
Downloaden Sie, um offline zu lesen
Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì
ìåòîäîì ïîñòðîåíèÿ äèàãðàìì ñîñòîÿíèé
Àíäðåé Ìèðîíîâ
amironov66@gmail.com
ÔÈÖ Èíôîðìàòèêà è óïðàâëåíèå ÐÀÍ
Ìîñêâà, 2015 ã.
Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
Êðàòêîå ñîäåðæàíèå
Îïèñàíèå ïðîáëåìû
Ðàññìàòðèâàåòñÿ ïðîáëåìà âåðèôèêàöèè ôóíêöèîíàëüíûõ ïðîãðàìì
(ÔÏ) íàä ñèìâîëüíûìè ñòðîêàìè, ãäå
ñïåöèôèêàöèè ñâîéñòâ ÔÏ îïðåäåëÿþòñÿ äðóãèìè ÔÏ, è
ÔÏ Σ1 óäîâëåòâîðÿåò ñïåöèôèêàöèè, îïðåäåëÿåìîé ÔÏ Σ2, åñëè
êîìïîçèöèÿ ôóíêöèé, îïðåäåëÿåìûõ ÔÏ Σ1 è Σ2, ïðèíèìàåò
çíà÷åíèå 1 íà âñåõ àðãóìåíòàõ.
Ìû ââîäèì ïîíÿòèå äèàãðàììû ñîñòîÿíèé ÔÏ, è ñâîäèì ïðîáëåìó
âåðèôèêàöèè ÔÏ ê ïðîáëåìå àíàëèçà äèàãðàìì ñîñòîÿíèé ÔÏ.
Ïðåäëîæåííûé ïîäõîä èëëþñòðèðóåòñÿ ïðèìåðîì âåðèôèêàöèè ÔÏ
ñîðòèðîâêè.
Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
Ïðèìåð âåðèôèêàöèè ñïåöèôèêàöèè ôóíêöèîíàëüíîé
ïðîãðàììû ñîðòèðîâêè ñòðîê
Ïðîãðàììà:
sort(x) = (x = ε)? ε : insert(xh, sort(xt))
insert(a, y) = (y = ε) ? aε
: (a ≤ yh) ? ay
: yh insert(a, yt)
(1)
Ñïåöèôèêàöèÿ:
∀ x ∈ S ord(sort(x)) = 1 (2)
ãäå
ord(x) =
= (x = ε) ? 1
: (xt = ε) ? 1
: (xh ≤ (xt)h) ? ord(xt)
: 0
(3)
Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
Îáû÷íîå ìàòåìàòè÷åñêîå äîêàçàòåëüñòâî êîððåêòíîñòè
ïðîãðàììû ñîðòèðîâêè
Èíäóêöèÿ ïî äëèíå ñòðîêè x.
Åñëè x = ε, òî, ñîãëàñíî ïåðâîìó óðàâíåíèþ ñèñòåìû (1), âåðíî
ðàâåíñòâî sort(x) = ε, è ïîýòîìó
ord(sort(x)) = ord(ε) = 1
Ïóñòü x = ε. Äîêàæåì ðàâåíñòâî (2) äëÿ ýòîãî ñëó÷àÿ ìåòîäîì
ìàòåìàòè÷åñêîé èíäóêöèè.
Ïðåäïîëîæèì, ÷òî âåðíî ðàâåíñòâî, ïîëó÷àåìîå èç ðàâåíñòâà â (2)
çàìåíîé x íà ëþáóþ ñòðîêó, äëèíà êîòîðîé ìåíüøå äëèíû x.
Äîêàæåì, ÷òî â ýòîì ñëó÷àå ðàâåíñòâî â (2) òàêæå áóäåò âåðíûì.
Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
Îáû÷íîå ìàòåìàòè÷åñêîå äîêàçàòåëüñòâî êîððåêòíîñòè
ïðîãðàììû ñîðòèðîâêè (ïðîäîëæåíèå)
Ðàâåíñòâî â (2) ìîæíî ïåðåïèñàòü â âèäå
ord( insert(xh, sort(xt))) = 1 (4)
Ïî èíäóêòèâíîìó ïðåäïîëîæåíèþ, âåðíî ðàâåíñòâî
ord(sort(xt)) = 1
èç êîòîðîãî ñëåäóåò (4) ïî íèæåñëåäóþùåé ëåììå.
Ëåììà.
Èìååò ìåñòî èìïëèêàöèÿ
ord(y) = 1 ⇒ ord(insert(a, y)) = 1 (5)
Äîêàçàòåëüñòâî.
Äîêàçûâàåì ëåììó èíäóêöèåé ïî äëèíå y.
Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
Îáû÷íîå ìàòåìàòè÷åñêîå äîêàçàòåëüñòâî êîððåêòíîñòè
ïðîãðàììû ñîðòèðîâêè (ïðîäîëæåíèå)
Åñëè y = ε, òî ïðàâàÿ ÷àñòü â (5) èìååò âèä
ord(aε) = 1
÷òî âåðíî ïî îïðåäåëåíèþ ord.
Ïóñòü y = ε, è äëÿ êàæäîé ñòðîêè z, äëèíà êîòîðîé ìåíüøå äëèíû y,
âåðíà èìïëèêàöèÿ
ord(z) = 1 ⇒ ord(insert(a, z)) = 1 (6)
Îáîçíà÷èì c
def
= yh, d
def
= yt.
(5) èìååò âèä
ord(cd) = 1 ⇒ ord(insert(a, cd)) = 1 (7)
Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
Îáû÷íîå ìàòåìàòè÷åñêîå äîêàçàòåëüñòâî êîððåêòíîñòè
ïðîãðàììû ñîðòèðîâêè (ïðîäîëæåíèå)
Äëÿ äîêàçàòåëüñòâà èìïëèêàöèè (7) íóæíî äîêàçàòü, ÷òî ïðè óñëîâèè
ord(cd) = 1 âåðíû èìïëèêàöèè
(a) a ≤ c ⇒ ord(a(cd)) = 1,
(b) c  a ⇒ ord(c insert(a, d)) = 1.
(a) âåðíî ïîòîìó, ÷òî èç a ≤ c ñëåäóåò
ord(a(cd)) = ord(cd) = 1.
Äîêàæåì (b).
Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
Îáû÷íîå ìàòåìàòè÷åñêîå äîêàçàòåëüñòâî êîððåêòíîñòè
ïðîãðàììû ñîðòèðîâêè (ïðîäîëæåíèå)
d = ε.  ýòîì ñëó÷àå ïðàâàÿ ÷àñòü â (b) èìååò âèä
ord(c(aε)) = 1 (8)
(8) ñëåäóåò èç c  a.
d = ε. Îáîçíà÷èì p
def
= dh, q
def
= dt.
 ýòîì ñëó÷àå íàäî äîêàçàòü, ÷òî ïðè c  a
ord(c insert(a, pq)) = 1 (9)
Åñëè a ≤ p, òî (9) èìååò âèä
ord(c(a(pq))) = 1 (10)
Ò.ê. c  a ≤ p, òî (10) ñëåäóåò èç ðàâåíñòâ
ord(c(a(pq))) = ord(a(pq)) = ord(pq) =
= ord(c(pq)) = ord(cd) = 1
Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
Îáû÷íîå ìàòåìàòè÷åñêîå äîêàçàòåëüñòâî êîððåêòíîñòè
ïðîãðàììû ñîðòèðîâêè (ïðîäîëæåíèå)
Åñëè p  a, òî (9) èìååò âèä
ord(c(p insert(a, q))) = 1 (11)
Ïîñêîëüêó ïî ïðåäïîëîæåíèþ
ord(cd) = ord(c(pq)) = 1
òî c ≤ p, è ïîýòîìó (11) ìîæíî ïåðåïèñàòü â âèäå
ord(p insert(a, q)) = 1 (12)
Ïðè p  a
insert(a, d) = insert(a, pq) = p insert(a, q)
ïîýòîìó (12) ìîæíî ïåðåïèñàòü â âèäå
ord(insert(a, d)) = 1 (13)
Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
Îáû÷íîå ìàòåìàòè÷åñêîå äîêàçàòåëüñòâî êîððåêòíîñòè
ïðîãðàììû ñîðòèðîâêè (ïðîäîëæåíèå)
(13) ñëåäóåò ïî èíäóêòèâíîìó ïðåäïîëîæåíèþ äëÿ ëåììû (ò.å. èç
èìïëèêàöèè (6), â êîòîðîé z
def
= d) èç ðàâåíñòâà
ord(d) = 1
êîòîðîå îáîñíîâûâàåòñÿ öåïî÷êîé ðàâåíñòâ
1 = ord(cd) = ord(c(pq)) = (ò.ê. c ≤ p)
= ord(pq) = ord(d).
Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
Èäåÿ íîâîãî ìåòîäà âåðèôèêàöèè ôóíêöèîíàëüíûõ
ïðîãðàìì
Îòêàç îò äîêàçàòåëüñòâà óòâåðæäåíèÿ î êîððåêòíîñòè ïðîãðàììû,
âûðàæàåìîãî ôîðìóëîé èñ÷èñëåíèÿ ïðåäèêàòîâ ïåðâîãî ïîðÿäêà,
ïóòåì ïîñòðîåíèÿ ôîðìàëüíîãî âûâîäà â ëîãèêå ïåðâîãî ïîðÿäêà.
Ìåòîä âåðèôèêàöèè  ïîñòðîåíèå
ãðàôîâîé ìîäåëè âåðèôèöèðóåìîé ïðîãðàììû è
ãðàôîâîé ìîäåëè ïðîãðàììû, âûðàæàùåé ïðîâåðÿåìîå ñâîéñòâî,
ïîñëå ÷åãî âû÷èñëÿåòñÿ ãðàôîâàÿ ìîäåëü äëÿ ñóïåðïîçèöèè
àíàëèçèðóåìîé è ïðîâåðÿþùåé ôóíêöèé, è èññëåäóþòñÿ òåðìèíàëüíûå
âåðøèíû ïîëó÷èâøåéñÿ ãðàôîâîé ìîäåëè.
Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
Èäåÿ íîâîãî ìåòîäà âåðèôèêàöèè ôóíêöèîíàëüíûõ
ïðîãðàìì
Òåîðåìà .
Ïóñòü ÔÏ Σ ◦ Σspec èìååò êîíå÷íóþ äèàãðàììó ñîñòîÿíèé (ÄÑ),
ïðè÷åì çíà÷åíèÿ ñîñòîÿíèé, ñîîòâåòñòâóþùèõ òåì òåðìèíàëüíûì
âåðøèíàì ýòîé ÄÑ, êîòîðûå äîñòèæèìû èç íà÷àëüíîãî ñîñòîÿíèÿ,
ðàâíû 1. Òîãäà fΣ◦Σspec ïðèíèìàåò çíà÷åíèå 1 íà âñåõ ñâîèõ
àðãóìåíòàõ.
Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
Ïðèìåð ãðàôîâîé ìîäåëè ôóíêöèîíàëüíîé ïðîãðàììû








y := sort(x)
ε



ε := x
'

$
%
y := a → u
u := sort(b)
ab := x
y
y
aε



aε := x
'

$
%
z := a → d
cd := sort(b)
ab := x
tail
tail
tail
tail
{a ≤ c}.acd
{c  a}.cz
' $
z := a → d, d := p → j
cj := sort(q)
apq := x
'

$
%
z := a → ij
ij := sort(q)
acq := x
'

$
%
cd := sort(b)
ab := x
{c  a}.caε




acε := x
c
c
E
E
E
c
rrr
rr‰
¨¨
¨¨¨¨B
rr
rrr‰
¨¨¨
¨¨B
d
d
dds
 
 
 d
d
d
ds
 
 
 
A B
C
D E
G
F
I
H
{c  a, c ≤ i}.cz
{c  a, c  p}.cz
Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
Ðåäóöèðîâàííàÿ ãðàôîâàÿ ìîäåëü äëÿ ÔÏ ñîðòèðîâêè








y := sort(x)
ε



ε := x
'

$
%
y := a → u
u := sort(b)
ab := x
y
y
aε



aε := x
'

$
%
z := a → d
cd := sort(b)
ab := x
tail
tail
{a ≤ c}.acd
{c  a}.cz
'

$
%
cd := sort(b)
ab := x c
c
E
Er
rrr
r‰
¨¨¨
¨¨¨B
d
d
dds
 
 
 
A B
C
D E
G
Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
Ãðàôîâàÿ ìîäåëü ÔÏ ïðîâåðêè óïîðÿäî÷åííîñòè ñòðîêè
a b
c d
e f g
s







s := ord(y)
s



s := ord(cz)
cz := y
1



ε := y
1



cε := y
s'

$
%
s := ord(cvw)
cvw := y




cvw := y
'

$
%
s := ord(vw)
cvw := y
c
c
'
{c ≤ v}.s
E
{v  c}.0
E
EE

Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
Ãðàôîâàÿ ìîäåëü ñóïåðïîçèöèè
Aa BaCe
Gc Da
Ec
Gf Ge
1'

$
%
. . .
1'

$
%
. . .E
'

$
%
'

$
%
s := ord(y)
y := sort(x)
c'

$
%
s := ord(y)
y := a → u
u := sort(b)
ab := x
d
d
d
d
ds
'
c
EE
'

$
%
s := ord(cz)
z := a → d
cd := sort(b)
ab := x
'

$
%
s := ord(vw)
vw := a → d
cd := sort(b)
ab := x
E
'

$
%
s := ord(cvw)
vw := a → d
cd := sort(b)
ab := x
'

$
%
s := ord(cd)
cd := sort(b)
ab := x
{a ≤ c}.s
{c  a, c ≤ v}.s{c  a}.s
{c  a}.s s
s
d
d
dds
 
 
 


Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
Ñïàñèáî çà âíèìàíèå!
Âîïðîñû?
Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (11)

8 g i 2016
8 g i 20168 g i 2016
8 g i 2016
 
3.1 himiin temdeg
3.1 himiin temdeg3.1 himiin temdeg
3.1 himiin temdeg
 
H.el205 l6
H.el205 l6H.el205 l6
H.el205 l6
 
32 Osteoporosis Drugs
32 Osteoporosis Drugs32 Osteoporosis Drugs
32 Osteoporosis Drugs
 
Lecture9
Lecture9Lecture9
Lecture9
 
Tailan 2011 on
Tailan 2011 onTailan 2011 on
Tailan 2011 on
 
MIGRAINE DRUGS
MIGRAINE DRUGSMIGRAINE DRUGS
MIGRAINE DRUGS
 
Web d auexs
Web d auexsWeb d auexs
Web d auexs
 
дэлхийн дулаарал
дэлхийн дулаарал  дэлхийн дулаарал
дэлхийн дулаарал
 
Zuvulguu
ZuvulguuZuvulguu
Zuvulguu
 
тэгш өнцөгт гурвалжин
тэгш өнцөгт гурвалжинтэгш өнцөгт гурвалжин
тэгш өнцөгт гурвалжин
 

Andere mochten auch

TMPA-2015: FPGA-Based Low Latency Sponsored Access
TMPA-2015: FPGA-Based Low Latency Sponsored AccessTMPA-2015: FPGA-Based Low Latency Sponsored Access
TMPA-2015: FPGA-Based Low Latency Sponsored AccessIosif Itkin
 
TMPA-2015: Formal Methods in Robotics
TMPA-2015: Formal Methods in RoboticsTMPA-2015: Formal Methods in Robotics
TMPA-2015: Formal Methods in RoboticsIosif Itkin
 
TMPA-2015: A Need To Specify and Verify Standard Functions
TMPA-2015: A Need To Specify and Verify Standard FunctionsTMPA-2015: A Need To Specify and Verify Standard Functions
TMPA-2015: A Need To Specify and Verify Standard FunctionsIosif Itkin
 
TMPA-2015: Automated Testing of Multi-thread Data Structures Solutions Lineri...
TMPA-2015: Automated Testing of Multi-thread Data Structures Solutions Lineri...TMPA-2015: Automated Testing of Multi-thread Data Structures Solutions Lineri...
TMPA-2015: Automated Testing of Multi-thread Data Structures Solutions Lineri...Iosif Itkin
 
TMPA-2015: Kotlin: From Null Dereference to Smart Casts
TMPA-2015: Kotlin: From Null Dereference to Smart CastsTMPA-2015: Kotlin: From Null Dereference to Smart Casts
TMPA-2015: Kotlin: From Null Dereference to Smart CastsIosif Itkin
 
TMPA-2015: Standards and Standartization in Program Engineering. Why Would Yo...
TMPA-2015: Standards and Standartization in Program Engineering. Why Would Yo...TMPA-2015: Standards and Standartization in Program Engineering. Why Would Yo...
TMPA-2015: Standards and Standartization in Program Engineering. Why Would Yo...Iosif Itkin
 
TMPA-2015: Software Engineering Education: The Messir Approach
TMPA-2015: Software Engineering Education: The Messir ApproachTMPA-2015: Software Engineering Education: The Messir Approach
TMPA-2015: Software Engineering Education: The Messir ApproachIosif Itkin
 
TMPA-2015: Automated process of creating test scenarios for financial protoco...
TMPA-2015: Automated process of creating test scenarios for financial protoco...TMPA-2015: Automated process of creating test scenarios for financial protoco...
TMPA-2015: Automated process of creating test scenarios for financial protoco...Iosif Itkin
 
TMPA-2015: ClearTH: a Tool for Automated Testing of Post Trade Systems
TMPA-2015: ClearTH: a Tool for Automated Testing of Post Trade SystemsTMPA-2015: ClearTH: a Tool for Automated Testing of Post Trade Systems
TMPA-2015: ClearTH: a Tool for Automated Testing of Post Trade SystemsIosif Itkin
 
TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...
TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...
TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...Iosif Itkin
 
TMPA-2015: Implementing the MetaVCG Approach in the C-light System
TMPA-2015: Implementing the MetaVCG Approach in the C-light SystemTMPA-2015: Implementing the MetaVCG Approach in the C-light System
TMPA-2015: Implementing the MetaVCG Approach in the C-light SystemIosif Itkin
 
TMPA-2015: Expanding the Meta-Generation of Correctness Conditions by Means o...
TMPA-2015: Expanding the Meta-Generation of Correctness Conditions by Means o...TMPA-2015: Expanding the Meta-Generation of Correctness Conditions by Means o...
TMPA-2015: Expanding the Meta-Generation of Correctness Conditions by Means o...Iosif Itkin
 
TMPA-2015: The Application of Static Analysis to Optimize the Dynamic Detecti...
TMPA-2015: The Application of Static Analysis to Optimize the Dynamic Detecti...TMPA-2015: The Application of Static Analysis to Optimize the Dynamic Detecti...
TMPA-2015: The Application of Static Analysis to Optimize the Dynamic Detecti...Iosif Itkin
 
TMPA-2015: The dynamic Analysis of Executable Code in ELF Format Based on Sta...
TMPA-2015: The dynamic Analysis of Executable Code in ELF Format Based on Sta...TMPA-2015: The dynamic Analysis of Executable Code in ELF Format Based on Sta...
TMPA-2015: The dynamic Analysis of Executable Code in ELF Format Based on Sta...Iosif Itkin
 
TMPA-2015: Towards a Usable Defect Prediction Tool: Crossbreeding Machine Lea...
TMPA-2015: Towards a Usable Defect Prediction Tool: Crossbreeding Machine Lea...TMPA-2015: Towards a Usable Defect Prediction Tool: Crossbreeding Machine Lea...
TMPA-2015: Towards a Usable Defect Prediction Tool: Crossbreeding Machine Lea...Iosif Itkin
 
TMPA-2015: Lexical analysis of dynamically formed string expressions
TMPA-2015: Lexical analysis of dynamically formed string expressionsTMPA-2015: Lexical analysis of dynamically formed string expressions
TMPA-2015: Lexical analysis of dynamically formed string expressionsIosif Itkin
 
TMPA-2015: Generation of Test Scenarios for Non Deterministic and Concurrent ...
TMPA-2015: Generation of Test Scenarios for Non Deterministic and Concurrent ...TMPA-2015: Generation of Test Scenarios for Non Deterministic and Concurrent ...
TMPA-2015: Generation of Test Scenarios for Non Deterministic and Concurrent ...Iosif Itkin
 
TMPA-2015: Information Support System for Autonomous Spacecraft Control Macro...
TMPA-2015: Information Support System for Autonomous Spacecraft Control Macro...TMPA-2015: Information Support System for Autonomous Spacecraft Control Macro...
TMPA-2015: Information Support System for Autonomous Spacecraft Control Macro...Iosif Itkin
 
TMPA-2015: Multi-Module Application Tracing in z/OS Environment
TMPA-2015: Multi-Module Application Tracing in z/OS EnvironmentTMPA-2015: Multi-Module Application Tracing in z/OS Environment
TMPA-2015: Multi-Module Application Tracing in z/OS EnvironmentIosif Itkin
 
TMPA-2015: Multi-Platform Approach to Reverse Debugging of Virtual Machines
TMPA-2015: Multi-Platform Approach to Reverse Debugging of Virtual MachinesTMPA-2015: Multi-Platform Approach to Reverse Debugging of Virtual Machines
TMPA-2015: Multi-Platform Approach to Reverse Debugging of Virtual MachinesIosif Itkin
 

Andere mochten auch (20)

TMPA-2015: FPGA-Based Low Latency Sponsored Access
TMPA-2015: FPGA-Based Low Latency Sponsored AccessTMPA-2015: FPGA-Based Low Latency Sponsored Access
TMPA-2015: FPGA-Based Low Latency Sponsored Access
 
TMPA-2015: Formal Methods in Robotics
TMPA-2015: Formal Methods in RoboticsTMPA-2015: Formal Methods in Robotics
TMPA-2015: Formal Methods in Robotics
 
TMPA-2015: A Need To Specify and Verify Standard Functions
TMPA-2015: A Need To Specify and Verify Standard FunctionsTMPA-2015: A Need To Specify and Verify Standard Functions
TMPA-2015: A Need To Specify and Verify Standard Functions
 
TMPA-2015: Automated Testing of Multi-thread Data Structures Solutions Lineri...
TMPA-2015: Automated Testing of Multi-thread Data Structures Solutions Lineri...TMPA-2015: Automated Testing of Multi-thread Data Structures Solutions Lineri...
TMPA-2015: Automated Testing of Multi-thread Data Structures Solutions Lineri...
 
TMPA-2015: Kotlin: From Null Dereference to Smart Casts
TMPA-2015: Kotlin: From Null Dereference to Smart CastsTMPA-2015: Kotlin: From Null Dereference to Smart Casts
TMPA-2015: Kotlin: From Null Dereference to Smart Casts
 
TMPA-2015: Standards and Standartization in Program Engineering. Why Would Yo...
TMPA-2015: Standards and Standartization in Program Engineering. Why Would Yo...TMPA-2015: Standards and Standartization in Program Engineering. Why Would Yo...
TMPA-2015: Standards and Standartization in Program Engineering. Why Would Yo...
 
TMPA-2015: Software Engineering Education: The Messir Approach
TMPA-2015: Software Engineering Education: The Messir ApproachTMPA-2015: Software Engineering Education: The Messir Approach
TMPA-2015: Software Engineering Education: The Messir Approach
 
TMPA-2015: Automated process of creating test scenarios for financial protoco...
TMPA-2015: Automated process of creating test scenarios for financial protoco...TMPA-2015: Automated process of creating test scenarios for financial protoco...
TMPA-2015: Automated process of creating test scenarios for financial protoco...
 
TMPA-2015: ClearTH: a Tool for Automated Testing of Post Trade Systems
TMPA-2015: ClearTH: a Tool for Automated Testing of Post Trade SystemsTMPA-2015: ClearTH: a Tool for Automated Testing of Post Trade Systems
TMPA-2015: ClearTH: a Tool for Automated Testing of Post Trade Systems
 
TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...
TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...
TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...
 
TMPA-2015: Implementing the MetaVCG Approach in the C-light System
TMPA-2015: Implementing the MetaVCG Approach in the C-light SystemTMPA-2015: Implementing the MetaVCG Approach in the C-light System
TMPA-2015: Implementing the MetaVCG Approach in the C-light System
 
TMPA-2015: Expanding the Meta-Generation of Correctness Conditions by Means o...
TMPA-2015: Expanding the Meta-Generation of Correctness Conditions by Means o...TMPA-2015: Expanding the Meta-Generation of Correctness Conditions by Means o...
TMPA-2015: Expanding the Meta-Generation of Correctness Conditions by Means o...
 
TMPA-2015: The Application of Static Analysis to Optimize the Dynamic Detecti...
TMPA-2015: The Application of Static Analysis to Optimize the Dynamic Detecti...TMPA-2015: The Application of Static Analysis to Optimize the Dynamic Detecti...
TMPA-2015: The Application of Static Analysis to Optimize the Dynamic Detecti...
 
TMPA-2015: The dynamic Analysis of Executable Code in ELF Format Based on Sta...
TMPA-2015: The dynamic Analysis of Executable Code in ELF Format Based on Sta...TMPA-2015: The dynamic Analysis of Executable Code in ELF Format Based on Sta...
TMPA-2015: The dynamic Analysis of Executable Code in ELF Format Based on Sta...
 
TMPA-2015: Towards a Usable Defect Prediction Tool: Crossbreeding Machine Lea...
TMPA-2015: Towards a Usable Defect Prediction Tool: Crossbreeding Machine Lea...TMPA-2015: Towards a Usable Defect Prediction Tool: Crossbreeding Machine Lea...
TMPA-2015: Towards a Usable Defect Prediction Tool: Crossbreeding Machine Lea...
 
TMPA-2015: Lexical analysis of dynamically formed string expressions
TMPA-2015: Lexical analysis of dynamically formed string expressionsTMPA-2015: Lexical analysis of dynamically formed string expressions
TMPA-2015: Lexical analysis of dynamically formed string expressions
 
TMPA-2015: Generation of Test Scenarios for Non Deterministic and Concurrent ...
TMPA-2015: Generation of Test Scenarios for Non Deterministic and Concurrent ...TMPA-2015: Generation of Test Scenarios for Non Deterministic and Concurrent ...
TMPA-2015: Generation of Test Scenarios for Non Deterministic and Concurrent ...
 
TMPA-2015: Information Support System for Autonomous Spacecraft Control Macro...
TMPA-2015: Information Support System for Autonomous Spacecraft Control Macro...TMPA-2015: Information Support System for Autonomous Spacecraft Control Macro...
TMPA-2015: Information Support System for Autonomous Spacecraft Control Macro...
 
TMPA-2015: Multi-Module Application Tracing in z/OS Environment
TMPA-2015: Multi-Module Application Tracing in z/OS EnvironmentTMPA-2015: Multi-Module Application Tracing in z/OS Environment
TMPA-2015: Multi-Module Application Tracing in z/OS Environment
 
TMPA-2015: Multi-Platform Approach to Reverse Debugging of Virtual Machines
TMPA-2015: Multi-Platform Approach to Reverse Debugging of Virtual MachinesTMPA-2015: Multi-Platform Approach to Reverse Debugging of Virtual Machines
TMPA-2015: Multi-Platform Approach to Reverse Debugging of Virtual Machines
 

Mehr von Iosif Itkin

Foundations of Software Testing Lecture 4
Foundations of Software Testing Lecture 4Foundations of Software Testing Lecture 4
Foundations of Software Testing Lecture 4Iosif Itkin
 
QA Financial Forum London 2021 - Automation in Software Testing. Humans and C...
QA Financial Forum London 2021 - Automation in Software Testing. Humans and C...QA Financial Forum London 2021 - Automation in Software Testing. Humans and C...
QA Financial Forum London 2021 - Automation in Software Testing. Humans and C...Iosif Itkin
 
Exactpro FinTech Webinar - Global Exchanges Test Oracles
Exactpro FinTech Webinar - Global Exchanges Test OraclesExactpro FinTech Webinar - Global Exchanges Test Oracles
Exactpro FinTech Webinar - Global Exchanges Test OraclesIosif Itkin
 
Exactpro FinTech Webinar - Global Exchanges FIX Protocol
Exactpro FinTech Webinar - Global Exchanges FIX ProtocolExactpro FinTech Webinar - Global Exchanges FIX Protocol
Exactpro FinTech Webinar - Global Exchanges FIX ProtocolIosif Itkin
 
Operational Resilience in Financial Market Infrastructures
Operational Resilience in Financial Market InfrastructuresOperational Resilience in Financial Market Infrastructures
Operational Resilience in Financial Market InfrastructuresIosif Itkin
 
20 Simple Questions from Exactpro for Your Enjoyment This Holiday Season
20 Simple Questions from Exactpro for Your Enjoyment This Holiday Season20 Simple Questions from Exactpro for Your Enjoyment This Holiday Season
20 Simple Questions from Exactpro for Your Enjoyment This Holiday SeasonIosif Itkin
 
Testing the Intelligence of your AI
Testing the Intelligence of your AITesting the Intelligence of your AI
Testing the Intelligence of your AIIosif Itkin
 
EXTENT 2019: Exactpro Quality Assurance for Financial Market Infrastructures
EXTENT 2019: Exactpro Quality Assurance for Financial Market InfrastructuresEXTENT 2019: Exactpro Quality Assurance for Financial Market Infrastructures
EXTENT 2019: Exactpro Quality Assurance for Financial Market InfrastructuresIosif Itkin
 
ClearTH Test Automation Framework: Case Study in IRS & CDS Swaps Lifecycle Mo...
ClearTH Test Automation Framework: Case Study in IRS & CDS Swaps Lifecycle Mo...ClearTH Test Automation Framework: Case Study in IRS & CDS Swaps Lifecycle Mo...
ClearTH Test Automation Framework: Case Study in IRS & CDS Swaps Lifecycle Mo...Iosif Itkin
 
EXTENT Talks 2019 Tbilisi: Failover and Recovery Test Automation - Ivan Shamrai
EXTENT Talks 2019 Tbilisi: Failover and Recovery Test Automation - Ivan ShamraiEXTENT Talks 2019 Tbilisi: Failover and Recovery Test Automation - Ivan Shamrai
EXTENT Talks 2019 Tbilisi: Failover and Recovery Test Automation - Ivan ShamraiIosif Itkin
 
EXTENT Talks QA Community Tbilisi 20 April 2019 - Conference Open
EXTENT Talks QA Community Tbilisi 20 April 2019 - Conference OpenEXTENT Talks QA Community Tbilisi 20 April 2019 - Conference Open
EXTENT Talks QA Community Tbilisi 20 April 2019 - Conference OpenIosif Itkin
 
User-Assisted Log Analysis for Quality Control of Distributed Fintech Applica...
User-Assisted Log Analysis for Quality Control of Distributed Fintech Applica...User-Assisted Log Analysis for Quality Control of Distributed Fintech Applica...
User-Assisted Log Analysis for Quality Control of Distributed Fintech Applica...Iosif Itkin
 
QAFF Chicago 2019 - Complex Post-Trade Systems, Requirements Traceability and...
QAFF Chicago 2019 - Complex Post-Trade Systems, Requirements Traceability and...QAFF Chicago 2019 - Complex Post-Trade Systems, Requirements Traceability and...
QAFF Chicago 2019 - Complex Post-Trade Systems, Requirements Traceability and...Iosif Itkin
 
QA Community Saratov: Past, Present, Future (2019-02-08)
QA Community Saratov: Past, Present, Future (2019-02-08)QA Community Saratov: Past, Present, Future (2019-02-08)
QA Community Saratov: Past, Present, Future (2019-02-08)Iosif Itkin
 
Machine Learning and RoboCop Testing
Machine Learning and RoboCop TestingMachine Learning and RoboCop Testing
Machine Learning and RoboCop TestingIosif Itkin
 
Behaviour Driven Development: Oltre i limiti del possibile
Behaviour Driven Development: Oltre i limiti del possibileBehaviour Driven Development: Oltre i limiti del possibile
Behaviour Driven Development: Oltre i limiti del possibileIosif Itkin
 
2018 - Exactpro Year in Review
2018 - Exactpro Year in Review2018 - Exactpro Year in Review
2018 - Exactpro Year in ReviewIosif Itkin
 
Exactpro Discussion about Joy and Strategy
Exactpro Discussion about Joy and StrategyExactpro Discussion about Joy and Strategy
Exactpro Discussion about Joy and StrategyIosif Itkin
 
FIX EMEA Conference 2018 - Post Trade Software Testing Challenges
FIX EMEA Conference 2018 - Post Trade Software Testing ChallengesFIX EMEA Conference 2018 - Post Trade Software Testing Challenges
FIX EMEA Conference 2018 - Post Trade Software Testing ChallengesIosif Itkin
 
BDD. The Outer Limits. Iosif Itkin at Youcon (in Russian)
BDD. The Outer Limits. Iosif Itkin at Youcon (in Russian)BDD. The Outer Limits. Iosif Itkin at Youcon (in Russian)
BDD. The Outer Limits. Iosif Itkin at Youcon (in Russian)Iosif Itkin
 

Mehr von Iosif Itkin (20)

Foundations of Software Testing Lecture 4
Foundations of Software Testing Lecture 4Foundations of Software Testing Lecture 4
Foundations of Software Testing Lecture 4
 
QA Financial Forum London 2021 - Automation in Software Testing. Humans and C...
QA Financial Forum London 2021 - Automation in Software Testing. Humans and C...QA Financial Forum London 2021 - Automation in Software Testing. Humans and C...
QA Financial Forum London 2021 - Automation in Software Testing. Humans and C...
 
Exactpro FinTech Webinar - Global Exchanges Test Oracles
Exactpro FinTech Webinar - Global Exchanges Test OraclesExactpro FinTech Webinar - Global Exchanges Test Oracles
Exactpro FinTech Webinar - Global Exchanges Test Oracles
 
Exactpro FinTech Webinar - Global Exchanges FIX Protocol
Exactpro FinTech Webinar - Global Exchanges FIX ProtocolExactpro FinTech Webinar - Global Exchanges FIX Protocol
Exactpro FinTech Webinar - Global Exchanges FIX Protocol
 
Operational Resilience in Financial Market Infrastructures
Operational Resilience in Financial Market InfrastructuresOperational Resilience in Financial Market Infrastructures
Operational Resilience in Financial Market Infrastructures
 
20 Simple Questions from Exactpro for Your Enjoyment This Holiday Season
20 Simple Questions from Exactpro for Your Enjoyment This Holiday Season20 Simple Questions from Exactpro for Your Enjoyment This Holiday Season
20 Simple Questions from Exactpro for Your Enjoyment This Holiday Season
 
Testing the Intelligence of your AI
Testing the Intelligence of your AITesting the Intelligence of your AI
Testing the Intelligence of your AI
 
EXTENT 2019: Exactpro Quality Assurance for Financial Market Infrastructures
EXTENT 2019: Exactpro Quality Assurance for Financial Market InfrastructuresEXTENT 2019: Exactpro Quality Assurance for Financial Market Infrastructures
EXTENT 2019: Exactpro Quality Assurance for Financial Market Infrastructures
 
ClearTH Test Automation Framework: Case Study in IRS & CDS Swaps Lifecycle Mo...
ClearTH Test Automation Framework: Case Study in IRS & CDS Swaps Lifecycle Mo...ClearTH Test Automation Framework: Case Study in IRS & CDS Swaps Lifecycle Mo...
ClearTH Test Automation Framework: Case Study in IRS & CDS Swaps Lifecycle Mo...
 
EXTENT Talks 2019 Tbilisi: Failover and Recovery Test Automation - Ivan Shamrai
EXTENT Talks 2019 Tbilisi: Failover and Recovery Test Automation - Ivan ShamraiEXTENT Talks 2019 Tbilisi: Failover and Recovery Test Automation - Ivan Shamrai
EXTENT Talks 2019 Tbilisi: Failover and Recovery Test Automation - Ivan Shamrai
 
EXTENT Talks QA Community Tbilisi 20 April 2019 - Conference Open
EXTENT Talks QA Community Tbilisi 20 April 2019 - Conference OpenEXTENT Talks QA Community Tbilisi 20 April 2019 - Conference Open
EXTENT Talks QA Community Tbilisi 20 April 2019 - Conference Open
 
User-Assisted Log Analysis for Quality Control of Distributed Fintech Applica...
User-Assisted Log Analysis for Quality Control of Distributed Fintech Applica...User-Assisted Log Analysis for Quality Control of Distributed Fintech Applica...
User-Assisted Log Analysis for Quality Control of Distributed Fintech Applica...
 
QAFF Chicago 2019 - Complex Post-Trade Systems, Requirements Traceability and...
QAFF Chicago 2019 - Complex Post-Trade Systems, Requirements Traceability and...QAFF Chicago 2019 - Complex Post-Trade Systems, Requirements Traceability and...
QAFF Chicago 2019 - Complex Post-Trade Systems, Requirements Traceability and...
 
QA Community Saratov: Past, Present, Future (2019-02-08)
QA Community Saratov: Past, Present, Future (2019-02-08)QA Community Saratov: Past, Present, Future (2019-02-08)
QA Community Saratov: Past, Present, Future (2019-02-08)
 
Machine Learning and RoboCop Testing
Machine Learning and RoboCop TestingMachine Learning and RoboCop Testing
Machine Learning and RoboCop Testing
 
Behaviour Driven Development: Oltre i limiti del possibile
Behaviour Driven Development: Oltre i limiti del possibileBehaviour Driven Development: Oltre i limiti del possibile
Behaviour Driven Development: Oltre i limiti del possibile
 
2018 - Exactpro Year in Review
2018 - Exactpro Year in Review2018 - Exactpro Year in Review
2018 - Exactpro Year in Review
 
Exactpro Discussion about Joy and Strategy
Exactpro Discussion about Joy and StrategyExactpro Discussion about Joy and Strategy
Exactpro Discussion about Joy and Strategy
 
FIX EMEA Conference 2018 - Post Trade Software Testing Challenges
FIX EMEA Conference 2018 - Post Trade Software Testing ChallengesFIX EMEA Conference 2018 - Post Trade Software Testing Challenges
FIX EMEA Conference 2018 - Post Trade Software Testing Challenges
 
BDD. The Outer Limits. Iosif Itkin at Youcon (in Russian)
BDD. The Outer Limits. Iosif Itkin at Youcon (in Russian)BDD. The Outer Limits. Iosif Itkin at Youcon (in Russian)
BDD. The Outer Limits. Iosif Itkin at Youcon (in Russian)
 

TMPA-2015: The Verification of Functional Programs by Applying Statechart Diagrams Construction Method

  • 1. Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòðîåíèÿ äèàãðàìì ñîñòîÿíèé Àíäðåé Ìèðîíîâ amironov66@gmail.com ÔÈÖ Èíôîðìàòèêà è óïðàâëåíèå ÐÀÍ Ìîñêâà, 2015 ã. Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
  • 2. Êðàòêîå ñîäåðæàíèå Îïèñàíèå ïðîáëåìû Ðàññìàòðèâàåòñÿ ïðîáëåìà âåðèôèêàöèè ôóíêöèîíàëüíûõ ïðîãðàìì (ÔÏ) íàä ñèìâîëüíûìè ñòðîêàìè, ãäå ñïåöèôèêàöèè ñâîéñòâ ÔÏ îïðåäåëÿþòñÿ äðóãèìè ÔÏ, è ÔÏ Σ1 óäîâëåòâîðÿåò ñïåöèôèêàöèè, îïðåäåëÿåìîé ÔÏ Σ2, åñëè êîìïîçèöèÿ ôóíêöèé, îïðåäåëÿåìûõ ÔÏ Σ1 è Σ2, ïðèíèìàåò çíà÷åíèå 1 íà âñåõ àðãóìåíòàõ. Ìû ââîäèì ïîíÿòèå äèàãðàììû ñîñòîÿíèé ÔÏ, è ñâîäèì ïðîáëåìó âåðèôèêàöèè ÔÏ ê ïðîáëåìå àíàëèçà äèàãðàìì ñîñòîÿíèé ÔÏ. Ïðåäëîæåííûé ïîäõîä èëëþñòðèðóåòñÿ ïðèìåðîì âåðèôèêàöèè ÔÏ ñîðòèðîâêè. Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
  • 3. Ïðèìåð âåðèôèêàöèè ñïåöèôèêàöèè ôóíêöèîíàëüíîé ïðîãðàììû ñîðòèðîâêè ñòðîê Ïðîãðàììà: sort(x) = (x = ε)? ε : insert(xh, sort(xt)) insert(a, y) = (y = ε) ? aε : (a ≤ yh) ? ay : yh insert(a, yt) (1) Ñïåöèôèêàöèÿ: ∀ x ∈ S ord(sort(x)) = 1 (2) ãäå ord(x) = = (x = ε) ? 1 : (xt = ε) ? 1 : (xh ≤ (xt)h) ? ord(xt) : 0 (3) Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
  • 4. Îáû÷íîå ìàòåìàòè÷åñêîå äîêàçàòåëüñòâî êîððåêòíîñòè ïðîãðàììû ñîðòèðîâêè Èíäóêöèÿ ïî äëèíå ñòðîêè x. Åñëè x = ε, òî, ñîãëàñíî ïåðâîìó óðàâíåíèþ ñèñòåìû (1), âåðíî ðàâåíñòâî sort(x) = ε, è ïîýòîìó ord(sort(x)) = ord(ε) = 1 Ïóñòü x = ε. Äîêàæåì ðàâåíñòâî (2) äëÿ ýòîãî ñëó÷àÿ ìåòîäîì ìàòåìàòè÷åñêîé èíäóêöèè. Ïðåäïîëîæèì, ÷òî âåðíî ðàâåíñòâî, ïîëó÷àåìîå èç ðàâåíñòâà â (2) çàìåíîé x íà ëþáóþ ñòðîêó, äëèíà êîòîðîé ìåíüøå äëèíû x. Äîêàæåì, ÷òî â ýòîì ñëó÷àå ðàâåíñòâî â (2) òàêæå áóäåò âåðíûì. Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
  • 5. Îáû÷íîå ìàòåìàòè÷åñêîå äîêàçàòåëüñòâî êîððåêòíîñòè ïðîãðàììû ñîðòèðîâêè (ïðîäîëæåíèå) Ðàâåíñòâî â (2) ìîæíî ïåðåïèñàòü â âèäå ord( insert(xh, sort(xt))) = 1 (4) Ïî èíäóêòèâíîìó ïðåäïîëîæåíèþ, âåðíî ðàâåíñòâî ord(sort(xt)) = 1 èç êîòîðîãî ñëåäóåò (4) ïî íèæåñëåäóþùåé ëåììå. Ëåììà. Èìååò ìåñòî èìïëèêàöèÿ ord(y) = 1 ⇒ ord(insert(a, y)) = 1 (5) Äîêàçàòåëüñòâî. Äîêàçûâàåì ëåììó èíäóêöèåé ïî äëèíå y. Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
  • 6. Îáû÷íîå ìàòåìàòè÷åñêîå äîêàçàòåëüñòâî êîððåêòíîñòè ïðîãðàììû ñîðòèðîâêè (ïðîäîëæåíèå) Åñëè y = ε, òî ïðàâàÿ ÷àñòü â (5) èìååò âèä ord(aε) = 1 ÷òî âåðíî ïî îïðåäåëåíèþ ord. Ïóñòü y = ε, è äëÿ êàæäîé ñòðîêè z, äëèíà êîòîðîé ìåíüøå äëèíû y, âåðíà èìïëèêàöèÿ ord(z) = 1 ⇒ ord(insert(a, z)) = 1 (6) Îáîçíà÷èì c def = yh, d def = yt. (5) èìååò âèä ord(cd) = 1 ⇒ ord(insert(a, cd)) = 1 (7) Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
  • 7. Îáû÷íîå ìàòåìàòè÷åñêîå äîêàçàòåëüñòâî êîððåêòíîñòè ïðîãðàììû ñîðòèðîâêè (ïðîäîëæåíèå) Äëÿ äîêàçàòåëüñòâà èìïëèêàöèè (7) íóæíî äîêàçàòü, ÷òî ïðè óñëîâèè ord(cd) = 1 âåðíû èìïëèêàöèè (a) a ≤ c ⇒ ord(a(cd)) = 1, (b) c a ⇒ ord(c insert(a, d)) = 1. (a) âåðíî ïîòîìó, ÷òî èç a ≤ c ñëåäóåò ord(a(cd)) = ord(cd) = 1. Äîêàæåì (b). Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
  • 8. Îáû÷íîå ìàòåìàòè÷åñêîå äîêàçàòåëüñòâî êîððåêòíîñòè ïðîãðàììû ñîðòèðîâêè (ïðîäîëæåíèå) d = ε.  ýòîì ñëó÷àå ïðàâàÿ ÷àñòü â (b) èìååò âèä ord(c(aε)) = 1 (8) (8) ñëåäóåò èç c a. d = ε. Îáîçíà÷èì p def = dh, q def = dt.  ýòîì ñëó÷àå íàäî äîêàçàòü, ÷òî ïðè c a ord(c insert(a, pq)) = 1 (9) Åñëè a ≤ p, òî (9) èìååò âèä ord(c(a(pq))) = 1 (10) Ò.ê. c a ≤ p, òî (10) ñëåäóåò èç ðàâåíñòâ ord(c(a(pq))) = ord(a(pq)) = ord(pq) = = ord(c(pq)) = ord(cd) = 1 Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
  • 9. Îáû÷íîå ìàòåìàòè÷åñêîå äîêàçàòåëüñòâî êîððåêòíîñòè ïðîãðàììû ñîðòèðîâêè (ïðîäîëæåíèå) Åñëè p a, òî (9) èìååò âèä ord(c(p insert(a, q))) = 1 (11) Ïîñêîëüêó ïî ïðåäïîëîæåíèþ ord(cd) = ord(c(pq)) = 1 òî c ≤ p, è ïîýòîìó (11) ìîæíî ïåðåïèñàòü â âèäå ord(p insert(a, q)) = 1 (12) Ïðè p a insert(a, d) = insert(a, pq) = p insert(a, q) ïîýòîìó (12) ìîæíî ïåðåïèñàòü â âèäå ord(insert(a, d)) = 1 (13) Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
  • 10. Îáû÷íîå ìàòåìàòè÷åñêîå äîêàçàòåëüñòâî êîððåêòíîñòè ïðîãðàììû ñîðòèðîâêè (ïðîäîëæåíèå) (13) ñëåäóåò ïî èíäóêòèâíîìó ïðåäïîëîæåíèþ äëÿ ëåììû (ò.å. èç èìïëèêàöèè (6), â êîòîðîé z def = d) èç ðàâåíñòâà ord(d) = 1 êîòîðîå îáîñíîâûâàåòñÿ öåïî÷êîé ðàâåíñòâ 1 = ord(cd) = ord(c(pq)) = (ò.ê. c ≤ p) = ord(pq) = ord(d). Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
  • 11. Èäåÿ íîâîãî ìåòîäà âåðèôèêàöèè ôóíêöèîíàëüíûõ ïðîãðàìì Îòêàç îò äîêàçàòåëüñòâà óòâåðæäåíèÿ î êîððåêòíîñòè ïðîãðàììû, âûðàæàåìîãî ôîðìóëîé èñ÷èñëåíèÿ ïðåäèêàòîâ ïåðâîãî ïîðÿäêà, ïóòåì ïîñòðîåíèÿ ôîðìàëüíîãî âûâîäà â ëîãèêå ïåðâîãî ïîðÿäêà. Ìåòîä âåðèôèêàöèè ïîñòðîåíèå ãðàôîâîé ìîäåëè âåðèôèöèðóåìîé ïðîãðàììû è ãðàôîâîé ìîäåëè ïðîãðàììû, âûðàæàùåé ïðîâåðÿåìîå ñâîéñòâî, ïîñëå ÷åãî âû÷èñëÿåòñÿ ãðàôîâàÿ ìîäåëü äëÿ ñóïåðïîçèöèè àíàëèçèðóåìîé è ïðîâåðÿþùåé ôóíêöèé, è èññëåäóþòñÿ òåðìèíàëüíûå âåðøèíû ïîëó÷èâøåéñÿ ãðàôîâîé ìîäåëè. Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
  • 12. Èäåÿ íîâîãî ìåòîäà âåðèôèêàöèè ôóíêöèîíàëüíûõ ïðîãðàìì Òåîðåìà . Ïóñòü ÔÏ Σ ◦ Σspec èìååò êîíå÷íóþ äèàãðàììó ñîñòîÿíèé (ÄÑ), ïðè÷åì çíà÷åíèÿ ñîñòîÿíèé, ñîîòâåòñòâóþùèõ òåì òåðìèíàëüíûì âåðøèíàì ýòîé ÄÑ, êîòîðûå äîñòèæèìû èç íà÷àëüíîãî ñîñòîÿíèÿ, ðàâíû 1. Òîãäà fΣ◦Σspec ïðèíèìàåò çíà÷åíèå 1 íà âñåõ ñâîèõ àðãóìåíòàõ. Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
  • 13. Ïðèìåð ãðàôîâîé ìîäåëè ôóíêöèîíàëüíîé ïðîãðàììû y := sort(x) ε ε := x ' $ % y := a → u u := sort(b) ab := x y y aε aε := x ' $ % z := a → d cd := sort(b) ab := x tail tail tail tail {a ≤ c}.acd {c a}.cz ' $ z := a → d, d := p → j cj := sort(q) apq := x ' $ % z := a → ij ij := sort(q) acq := x ' $ % cd := sort(b) ab := x {c a}.caε acε := x c c E E E c rrr rr‰ ¨¨ ¨¨¨¨B rr rrr‰ ¨¨¨ ¨¨B d d dds      d d d ds       A B C D E G F I H {c a, c ≤ i}.cz {c a, c p}.cz Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
  • 14. Ðåäóöèðîâàííàÿ ãðàôîâàÿ ìîäåëü äëÿ ÔÏ ñîðòèðîâêè y := sort(x) ε ε := x ' $ % y := a → u u := sort(b) ab := x y y aε aε := x ' $ % z := a → d cd := sort(b) ab := x tail tail {a ≤ c}.acd {c a}.cz ' $ % cd := sort(b) ab := x c c E Er rrr r‰ ¨¨¨ ¨¨¨B d d dds       A B C D E G Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
  • 15. Ãðàôîâàÿ ìîäåëü ÔÏ ïðîâåðêè óïîðÿäî÷åííîñòè ñòðîêè a b c d e f g s s := ord(y) s s := ord(cz) cz := y 1 ε := y 1 cε := y s' $ % s := ord(cvw) cvw := y cvw := y ' $ % s := ord(vw) cvw := y c c ' {c ≤ v}.s E {v c}.0 E EE Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
  • 16. Ãðàôîâàÿ ìîäåëü ñóïåðïîçèöèè Aa BaCe Gc Da Ec Gf Ge 1' $ % . . . 1' $ % . . .E ' $ % ' $ % s := ord(y) y := sort(x) c' $ % s := ord(y) y := a → u u := sort(b) ab := x d d d d ds ' c EE ' $ % s := ord(cz) z := a → d cd := sort(b) ab := x ' $ % s := ord(vw) vw := a → d cd := sort(b) ab := x E ' $ % s := ord(cvw) vw := a → d cd := sort(b) ab := x ' $ % s := ord(cd) cd := sort(b) ab := x {a ≤ c}.s {c a, c ≤ v}.s{c a}.s {c a}.s s s d d dds       Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð
  • 17. Ñïàñèáî çà âíèìàíèå! Âîïðîñû? Àíäðåé Ìèðîíîâ Âåðèôèêàöèÿ ôóíêöèîíàëüíûõ ïðîãðàìì ìåòîäîì ïîñòð