Skip to content

Commit 4743f0b

Browse files
committed
autocorres: update release ROOT files and manifest
AutoCorres no longer depends on the Lib session. This means: - remove Lib session ROOT parsing in release.py - copy over ROOT files of new library sessions - add new theory NatBitWise to manifest - update release ROOTS and ROOT files Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
1 parent de58596 commit 4743f0b

File tree

4 files changed

+11
-33
lines changed

4 files changed

+11
-33
lines changed

tools/autocorres/tools/release.py

+4-29
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,10 @@ def copy_manifest(output_dir, manifest_file, manifest_base, target):
200200
shutil.copyfile(f_src, f_dest)
201201

202202
# Copy various other files.
203-
shutil.copyfile(
204-
os.path.join(args.repository, 'lib', 'Word_Lib', 'ROOT'),
205-
os.path.join(target_dir, 'lib', 'Word_Lib', 'ROOT'))
203+
for session in ['Basics', 'Eisbach_Tools', 'ML_Utils', 'Monads', 'Word_Lib']:
204+
shutil.copyfile(
205+
os.path.join(args.repository, 'lib', session, 'ROOT'),
206+
os.path.join(target_dir, 'lib', session, 'ROOT'))
206207
shutil.copyfile(
207208
os.path.join(release_files_dir, "ROOT.release"),
208209
os.path.join(target_dir, "autocorres", "ROOT"))
@@ -222,37 +223,11 @@ def copy_manifest(output_dir, manifest_file, manifest_base, target):
222223
os.path.join(args.repository, "LICENSES"),
223224
os.path.join(target_dir, "LICENSES"))
224225

225-
# Extract dependent sessions in lib. FIXME: rather kludgy
226-
print('Extracting sessions from lib/ROOT...')
227-
228226
# Set up ROOT for the tests dir, for the thydeps tool
229227
subprocess.check_call(
230228
['make', 'tests/ROOT'],
231229
cwd=os.path.join(args.repository, 'tools', 'autocorres'))
232230

233-
lib_sessions = ['Lib', 'CLib']
234-
lib_ROOT = os.path.join(args.repository, 'lib', 'ROOT')
235-
with open(lib_ROOT, 'r') as lib_root:
236-
data = lib_root.read()
237-
# Split out session specs. Assume ROOT file has standard indentation.
238-
chunks = data.split('\nsession ')
239-
# This will have the license header, etc.
240-
header = chunks[0]
241-
# Remaining sections. Try to remove comments
242-
sessions = ['session ' + re.sub(r'\(\*.*?\*\)', '', x, flags=re.DOTALL)
243-
for x in chunks[1:]]
244-
245-
new_root = header
246-
wanted_specs = {}
247-
for wanted in lib_sessions:
248-
spec = [spec for spec in sessions if spec.startswith('session %s ' % wanted)]
249-
if len(spec) != 1:
250-
print('error: %s session not found in %r' % (wanted, lib_ROOT))
251-
new_root += '\n' + spec[0]
252-
253-
with open(os.path.join(target_dir, 'lib', 'ROOT'), 'w') as root_f:
254-
root_f.write(new_root)
255-
256231
# For the examples, generate ".thy" files where appropriate, and also
257232
# generate an "All.thy" which contains all the examples.
258233
def gen_thy_file(c_file):

tools/autocorres/tools/release_files/AUTOCORRES_FILES

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ exception_rewrite.ML:
3333
Proof frameworks and code to rewrite monadic specifications to
3434
avoid using exceptions where possible.
3535

36+
NatBitwise.thy:
3637
WordAbstract.thy:
3738
word_abstract.ML:
3839
Word abstraction framework and theorems.

tools/autocorres/tools/release_files/ROOT.release

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@
88
session AutoCorres = CParser +
99
sessions
1010
"HOL-Eisbach"
11-
Lib
12-
CLib
11+
Monads
1312
theories
13+
"DataStructures"
1414
"AutoCorres"
1515

1616
session AutoCorresTest in "tests" = AutoCorres +
1717
sessions
1818
"HOL-Number_Theory"
19-
AutoCorres
2019
directories
2120
"parse-tests"
2221
"proof-tests"
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
lib
1+
lib/Basics
2+
lib/Eisbach_Tools
3+
lib/ML_Utils
4+
lib/Monads
25
lib/Word_Lib
36
c-parser
47
autocorres

0 commit comments

Comments
 (0)