Commit Graph

308 Commits

Author SHA1 Message Date
Michael McInerney 3c322eab1d cparser+crefine: move h_t_array_valid_array_assertion to cparser session
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-01-30 18:00:42 +10:30
Gerwin Klein 2d2cadb86b
lib+proof+tools: move LemmaBucket_C into CParser
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 10:18:11 +11:00
Gerwin Klein 1ea235c152
lib+c-parser: move TypHeapLib into CParser
It has no other lib dependencies and over time should probably be
merged directly into umm theories. For now, move the entire file
and keep dependency structure.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 10:13:44 +11:00
Gerwin Klein 238acb46bb
lib+tools: MLUtils -> ML_Utils for consistency
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-20 13:43:39 +11:00
Gerwin Klein 9092a0f115
c-parser+autocorres: use ML_Utils session
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-20 13:43:39 +11:00
Michael McInerney 619e941631 c-parser+crefine+clib: move is_aligned_c_guard to c-parser session
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-01-12 11:48:59 +10:30
Michael McInerney 640d352148 c-parser+crefine: move h_t_array_valid_field to c-parser session
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-01-11 14:39:57 +10:30
Gerwin Klein 5ff1ac1346 c-parser: fix default target for standalone parser
The default (=first) Makefile target for the standalone parser was
`all`, which gains additional dependencies in the included Makefile.
We want `make` in this directory to just build the standalone parser,
so we set `stp_all` as the default.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-30 10:27:59 +11:00
Corey Lewis 821f9ed0c7 isabelle2022 c-parser: update CParser
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-11-09 11:45:46 +11:00
Gerwin Klein 76ee4634e6 c-parser: update release notes
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-31 11:45:05 +11:00
Gerwin Klein 98bb90e0c3 Makefiles: remove unused report-regression target
This target was used in the regression test setup before this repo
switched to `run_tests` and has been unused for some time.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Rafal Kolanski 6095e9ecb2 cparser: annotate AST printing for top-level decls
In order to compare ASTs for appearance/disappearance/modification of
declarations, it is easier to have the annotations obvious to any
external tool for ease of parsing.

Annotations take the form:
"##<decl_type>: <name>", e.g. "##Function: ctzl"

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-05-10 16:40:42 +10:00
Gerwin Klein 3196054268 isabelle2021-1: remove extend from TheoryData
No longer required in Isabelle2021-1 for TheoryData and GenericData

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein ed194a6bc4 isabelle2021-1 c-parser: update CParser + tests
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein a235a0aec6 isabelle2021-1: sync Simpl from AFP
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein ffcaff6af9 c-parser: provide AARCH64 setup
The setup for L4V_ARCH=AARCH64 is identical to RISCV64, i.e. same word
length, encoding, and endianness. The setup includes the standalone
parser used for compile and preprocess checks in the seL4 repo.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-02-03 16:13:45 +11:00
Gerwin Klein 770e7a31b9 cparser: add release notes for c-parser-1.18
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-10-31 13:41:58 +11:00
Gerwin Klein c8a5b00bbc cparpser: make release notes more readable
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-10-31 13:41:58 +11:00
Gerwin Klein 0c06287c19 cparser: adjust mkrelease for MacOS
Makes the release script more portable between BSD (MacOs etc) and
Linux. Assumes a `brew` install on MacOs instead of the older macports.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-10-31 13:41:58 +11:00
Gerwin Klein 71bbff2eca cparser: guard bash invocation
Standard bash on MacOS is very old; invoking it via /usr/bin/env allows
the user to put a newer version in the PATH.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-10-31 13:41:58 +11:00
Gerwin Klein 1b6d1e9d3c isabelle-2021 c-parser: simp rules for word types
typ_name of word types was not simplifying fully, because a shorter
simp rule is taking precedence over the shortcut rules. The added
rules make the system confluent again.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-09-30 16:53:17 +10:00
Gerwin Klein 956b2b85e5 isabelle-2021: CParser update for all L4V_ARCH
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-09-30 16:53:17 +10:00
Gerwin Klein 90032b64b5 isabelle-2021 cparser: Word_Lib include
Word_Lib was included multiple times in the graph, leading to name
shadowing. This commit makes Addr_Type the single point of entry.

Includes some cleanup/warning reductions.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2021-09-30 16:53:17 +10:00
Gerwin Klein 9d7efd75e2 isabelle-2021: cparser+tests update
This includes a tweak to Word_Lib to simplify ucast(-1) which
is now a term that occurs more often.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2021-09-30 16:53:17 +10:00
Florian Haftmann ea9a25950d isabelle-2021: ad-hoc adjustions to preview
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2021-09-30 16:53:17 +10:00
Gerwin Klein 411b4221b1 isabelle-2021: sync Simpl with AFP
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2021-09-30 16:53:17 +10:00
Gerwin Klein 28bc26c925 isabelle-2021: HOL-Word now in HOL-Library
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2021-09-30 16:53:17 +10:00
Matthew Brecknell 4278e99aa4 riscv crefine: generalise and move some lemmas
Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2021-03-23 22:40:46 +11:00
vjackson725 f6009f8531 c-parser: rewrite functional-record-update fN defs
Loading the FunctionaRecordUpdate file in Isabelle is slow.
This change expands the fN family of functions, which fixes the problem.

Signed-off-by: vjackson725 <v.jackson@unsw.edu.au>
2021-03-05 18:32:43 +11:00
Matthew Brecknell 96545a8312 c-parser: use fresh names for temporaries
Prior to rendering an expression to SIMPL, the C parser extracts
function calls from the expression and reinserts them as new statements
placed just before the statement containing the expression. The result
of each such function call is assigned to a temporary variable which
takes the place of the function call in the original expression.

Prior to this commit, the C parser would not always generate fresh
temporary variable names when multiple temporaries were needed. In
particular, when the left-hand side of an assignment contained a
function call returning the same type as a function call in the
right-hand side expression, the extracted function calls would be
assigned to the *same* temporary variable.

This commit addresses the issue by carrying name generation state across
all expressions in each statement. It implements a state monad as an
abstract data type for this purpose.

Fixes https://sel4.atlassian.net/browse/VER-1389.

Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2021-03-02 19:39:12 +11:00
Matthew Brecknell 898e5afc63 c-parser: improve asm support in modifies proofs
This commit adds support for inline assembly whose `lhs` updates a
global variable (such as the heap).

Prior to this commit, the modifies prover assumed that the `lhs` update
of an `asm_spec` only updated local variables. Specifically, the use of
`asm_store_eq_helper[OF globals.surjective globals.surjective]` as a
rewrite rule assumes that `globals (lhs v s)` simplifies to `globals s`,
exposing the `asm_store` inside `s` to the rewrite rule.

This commit avoids the assumption by using `globals.equality` as an
introduction rule. This produces more subgoals, but the subgoals are
relatively simple, so the perfomance is essentially unchanged.

This also slightly refactors `modifies_tactic` slightly:
- `asm_spec` is handled without the `vcg`, using a new rule
  `asm_spec_preserves`. This avoids having to deal with
  `asm_spec_enabled` separately in `modifies_tactic`.
- `seq_all_new`, which chains `THEN_ALL_NEW`, avoid the need to
  repeatedly use `ALLGOALS`.

Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2020-11-23 15:32:23 +11:00
Gerwin Klein aff203786c c-parser: now Isabelle2020; mention RISCV64
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-11-02 17:16:46 +10:00
Gerwin Klein be78194fee c-parser: RELASES was renamed
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-11-02 17:16:46 +10:00
Gerwin Klein 3ab83bb94a c-parser: also release RISCV64 arch
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-11-02 17:16:46 +10:00
Gerwin Klein 40d9783ef2 c-parser: use markdown extension
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-11-02 17:16:46 +10:00
Gerwin Klein 7437943fa8 c-parser: release script update for Isabelle2020
Adjust ROOT file generation and add an explicit Lib session in
the release.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-11-02 17:16:46 +10:00
Gerwin Klein 2b6b4c6bb5 c-parser: update release info
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-11-02 17:16:46 +10:00
Gerwin Klein a45adef66a all: remove theory import path references
In Isabelle2020, when isabelle jedit is started without a session
context, e.g. `isabelle jedit -l ASpec`, theory imports with path
references cause the isabelle process to hang.

Since sessions now declare directories, Isabelle can find those files
without path reference and we therefore remove all such path references
from import statements. With this, `jedit` and `build` should work with
and without explicit session context as before.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-11-02 10:16:17 +10:00
Gerwin Klein 18428256f0 c-parser: update to Isabelle2020
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein adc22ae58f c-parser: sync Simpl with AFP-2020
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein e7fb36b7e2 ROOT files: file reorg for new ROOT requirements
Isabelle2020 requires each session to declare it own set of directories that
may not overlap with other session's directories. This commit reorganises
files to comply with that requirement.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Matthew Brecknell 6f23d50ea9 c-parser: avoid cleaning `umm_heap/ARM_HYP`
Initially the `Makefile` copied `umm_heap/ARM_HYP` from `umm_heap/ARM`,
and deleted `umm_heap/ARM_HYP` during `make clean`. However, the
contents of `umm_heap/ARM_HYP` have since been committed, so this is no
longer appropriate.

Reported-by: Michael Norrish <Michael.Norrish@data61.csiro.au>
Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2020-08-26 14:58:15 +10:00
Edward Pierzchalski 55d9f5741f c-parser: include alias info in mungedb
Changes the mungedb to also indicate whether a given munged name has an
alias.

In the Distant Past, the C parser emitted long and short names, and the
mungedb output recorded those names. When definitions were reordered in
a C file, different C variables might get the short name; this could
break proofs, but the mungedb output would indicate the change ahead of
time.

Now, the C parser emits long names for every C variable, but it also
emits a short abbreviation to replicate the behaviour of the C parser in
the Distant Past. However, the mungedb only displayed *definitions*, not
*abbreviations*, so if the variable abbreviated by a short name changed
then the mungedb wouldn't pick up on the change.

This commit changes the output to include an "alias status", indicating
whether the short C name has been exported as an alias for the indicated
Isabelle name. It also adds a test to confirm that the mungedb output
tracks aliasing correctly.

Signed-off-by: Edward Pierzchalski <ed.pierzchalski@data61.csiro.au>
2020-05-03 10:22:36 +10:00
Brian Huffman 3c3514fe99 c-parser: Faster automation for proving packed_type class instances.
Co-authored-by: Simon Winwood <simonjwinwood@gmail.com>

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-04-25 11:22:56 +10:00
Brian Huffman 2ae97d8b38 c-parser: Remove unused assumptions from field_lookup rules.
This gives a significant speedup to the install_C_file command
when it generates field_lookup lemmas for struct types.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-04-25 11:22:56 +10:00
Gerwin Klein 7e30711edf c-parser: AUXUPD modifies the heap
Previously AUXUPD did not contribute to modifies proofs, and the only
reason this worked was that there usually is some heap assignment
somewhere else in the function if there is an AUXUPD. This commit adds
a modifies clause for the heap if a function has an AUXUPD.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-04-10 17:53:29 +08:00
Matthew Brecknell cf48906b26 regression: force use of python3
Python 2 has passed its sunset date, and many distributions are
withdrawing support for Python 2.

PEP 394 recommends distributions always install versioned interpreter
commands (e.g. `python3`), but does not make a recommendation about
whether or not an unversioned command (`python`) should exist, or what
version it should run.

It therefore seems advisable to explicitly run scripts using the
`python3` command, for scripts that are compatible with Python 3.

Here, we do this for Python scripts used by `run_tests`. For this to
work, some scripts have been updated in ways that will break Python 2
compatibility. But for some other scripts which were already compatible
with both Python 2 and 3, we have not yet removed Python 2
compatibility. There are also miscellaneous scripts that are not used by
`run_tests`, and these have not yet been updated to Python 3.

Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2020-04-01 14:31:36 +11:00
Gerwin Klein c68915b92b license: provide documentation under CC-BY-SA-4.0
Datat61 provides all docs under CC-BY-SA-4.0.
2020-03-16 14:19:15 +08:00
Gerwin Klein d6953e2f0e spdx: provide copyright info for mllex/mlyacc 2020-03-16 14:19:15 +08:00
Gerwin Klein 86a941e7e7 spdx: review missing copyright & license info
Some files were missing machine-readable copyright info, others were tagged
incorrectly.
2020-03-16 14:19:15 +08:00