Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PROSA - Formally Proven Schedulability Analysis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RT-PROOFS
PROSA - Formally Proven Schedulability Analysis
Commits
bd37be63
Commit
bd37be63
authored
4 years ago
by
Björn Brandenburg
Browse files
Options
Downloads
Patches
Plain Diff
proof state recorder: add more out-of-sync checks
parent
fa25f0dc
No related branches found
Branches containing commit
No related tags found
1 merge request
!117
proof-state recorder tweaks and fixes
Pipeline
#34406
passed
4 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/record-proof-state.py
+36
-9
36 additions, 9 deletions
scripts/record-proof-state.py
with
36 additions
and
9 deletions
scripts/record-proof-state.py
+
36
−
9
View file @
bd37be63
...
@@ -319,14 +319,32 @@ def report(n, interaction):
...
@@ -319,14 +319,32 @@ def report(n, interaction):
print
(
"
-
"
*
80
)
print
(
"
-
"
*
80
)
def
check
_sync
(
opts
,
input_number
,
interaction
):
def
prompt_out_of
_sync
(
opts
,
input_number
,
interaction
):
if
'
prompt_number
'
in
interaction
:
if
'
prompt_number
'
in
interaction
:
if
interaction
[
'
prompt_number
'
]
!=
input_number
:
if
interaction
[
'
prompt_number
'
]
!=
input_number
:
print
(
"
Out of sync: prompt %d in response to input %d
"
%
print
(
"
[%s] Out of sync: prompt %d in response to input %d
"
%
(
interaction
[
'
prompt_number
'
],
input_number
))
(
opts
.
fname
,
interaction
[
'
prompt_number
'
],
input_number
))
if
not
opts
.
verbose
:
return
True
report
(
input_number
,
interaction
)
return
False
assert
False
# out of sync: we missed an answer somewhere
def
output_out_of_sync
(
opts
,
cmd
,
interactions
):
if
cmd
==
'
Qed.
'
:
# QED: there should be no more proof obligations.
if
'
output
'
in
interactions
[
-
2
]
and
\
interactions
[
-
2
][
'
output
'
]
!=
[
'
No more subgoals.
'
]:
print
(
"
[%s] Out of sync:
'
Qed.
'
before
'
No more subgoals.
'"
%
opts
.
fname
)
return
True
# QED: there should be no output.
if
'
output
'
in
interactions
[
-
1
]:
print
(
"
[%s] Out of sync:
'
Qed.
'
produced output.
'"
%
opts
.
fname
)
return
True
elif
cmd
.
startswith
(
'
End
'
):
# End of section.
if
'
output
'
in
interactions
[
-
1
]:
print
(
"
[%s] Out of sync:
'
End
'
produced output.
'"
%
opts
.
fname
)
return
True
return
False
# Some vernacular commands that we need to check for because they change
# Some vernacular commands that we need to check for because they change
# coqtop's prompt counter. This list is likely incomplete.
# coqtop's prompt counter. This list is likely incomplete.
...
@@ -349,15 +367,23 @@ def feed_to_coqtop(opts, src):
...
@@ -349,15 +367,23 @@ def feed_to_coqtop(opts, src):
for
end
in
statement_end_offsets
(
opts
,
src
):
for
end
in
statement_end_offsets
(
opts
,
src
):
if
opts
.
pause
:
if
opts
.
pause
:
time
.
sleep
(
0.1
)
time
.
sleep
(
0.1
)
if
VERNACULAR_COMMANDS_RE
.
match
(
src
[
last
:
end
+
1
].
strip
()):
cmd
=
src
[
last
:
end
+
1
].
strip
()
if
VERNACULAR_COMMANDS_RE
.
match
(
cmd
):
coq_prompt_offset
+=
1
coq_prompt_offset
+=
1
interaction
=
interact
(
opts
,
coqtop
,
src
,
last
,
end
)
interaction
=
interact
(
opts
,
coqtop
,
src
,
last
,
end
)
interactions
.
append
(
interaction
)
interactions
.
append
(
interaction
)
last
=
end
+
1
last
=
end
+
1
check_sync
(
opts
,
len
(
interactions
)
+
coq_prompt_offset
,
interaction
)
if
opts
.
verbose
:
sync_failure
=
False
sync_failure
|=
prompt_out_of_sync
(
opts
,
len
(
interactions
)
+
coq_prompt_offset
,
interaction
)
sync_failure
|=
output_out_of_sync
(
opts
,
cmd
,
interactions
)
if
opts
.
verbose
or
sync_failure
:
report
(
len
(
interactions
)
+
coq_prompt_offset
,
interaction
)
report
(
len
(
interactions
)
+
coq_prompt_offset
,
interaction
)
assert
not
sync_failure
# signal end of input
# signal end of input
coqtop
.
stdin
.
close
()
coqtop
.
stdin
.
close
()
...
@@ -377,6 +403,7 @@ def feed_to_coqtop(opts, src):
...
@@ -377,6 +403,7 @@ def feed_to_coqtop(opts, src):
def
process
(
opts
,
fname
):
def
process
(
opts
,
fname
):
print
(
"
Collecting proof state for %s...
"
%
fname
)
print
(
"
Collecting proof state for %s...
"
%
fname
)
opts
.
fname
=
fname
src
=
open
(
fname
,
'
r
'
).
read
()
src
=
open
(
fname
,
'
r
'
).
read
()
interactions
=
feed_to_coqtop
(
opts
,
src
)
interactions
=
feed_to_coqtop
(
opts
,
src
)
ext
=
'
.proofstate.yaml
'
if
opts
.
yaml
else
'
.proofstate.json
'
ext
=
'
.proofstate.yaml
'
if
opts
.
yaml
else
'
.proofstate.json
'
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment