Commit Graph

5275 Commits

Author SHA1 Message Date
Rafal Kolanski 59bf9d92c8 docs: style: right- vs left-wrapping of operators
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-05-04 11:36:50 +10:00
Gerwin Klein 2545aa0e51 github: add manual triggers for testing
The worklow_dispatch trigger adds a button in the GitHub UI that lets
one trigger the workflow manually. Useful for testing the workflows.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-05-03 14:23:06 +10:00
Michael McInerney ca589b635c c-parser: add dom_lift_t_heap_update and lemmas for proj_d
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-05-01 15:16:22 +09:30
Michael McInerney ac5fe5bd59 refine: add obj_range'_disjoint
This also moves several lemmas required for obj_range'_disjoint
to Invariants_H

Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-05-01 10:52:50 +09:30
Michael McInerney 1273ba314a clib: generalise monadic_rewrite_ccorres_assemble
This makes the flags schematic

Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-04-27 08:12:31 +10:00
Corey Lewis b8714328cb word_lib+crefine: add and_one_neq_simps and adjust proofs
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-04-18 13:23:42 +10:00
Corey Lewis 68e33858e2 crefine: simp rules for true and false
These rules allow the simplifier to solve almost all existing goals that
involve the C constants true and false, without unfolding their
definitions.

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-04-18 13:23:42 +10:00
Corey Lewis ba241aac64 riscv+x64 crefine: remove unused lemma
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-04-18 13:23:42 +10:00
Gerwin Klein 1d2e75fd81
word_lib: lemma to turn < into bitwise reasoning
word_less_bit_eq turns `<` into a bitwise expression on abstract word
length to make it easier to reason about the relationship of < and bit
operations (boolean, but also shift etc).

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-04-11 13:17:54 +10:00
Gerwin Klein d4a63b2784
word_lib: more docs on word_bitwise and word_eqI
The Eisbach method command doesn't seem to allow providing a doc
string. Instead at least place a comment right next to the definition
so that people can find that when they discover the method name with
print_methods.

Update doc string of word_bitwise to clarify where it is useful.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-04-11 13:17:53 +10:00
Gerwin Klein b72e177677
word_lib: laws about min, max, and NOT
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-04-11 13:17:53 +10:00
Gerwin Klein d163d41b63
word_lib: some cleanup in More_Word
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-04-11 13:17:53 +10:00
Gerwin Klein 20ef209b30
word_lib: boolean operations and arithmetic
Adds generic (ring_bit_operations) relationships between boolean and
arithmetic operations. These automatically hold for word and int.

In particular:

   x + y = (x OR y) + (x AND y)
   x + y = (x XOR y) + 2 * (x AND y)
   x XOR y = (x OR y) - (x AND y)

Similar laws for OR, AND, and -.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-04-11 13:17:53 +10:00
Gerwin Klein d1858007d2
word_lib: all binary boolean inequalities
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-04-11 13:17:53 +10:00
Gerwin Klein 4bae25bb93
word_lib: sgn and abs instances for word
Provide sgn (sign, mapping to -1, 0, 1) and abs (absolute value)
functions for 'a word by instantiating the relevant type classes.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-04-11 13:17:53 +10:00
Gerwin Klein ac1cda74f9
word_lib: remove warning
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-04-11 13:17:49 +10:00
Gerwin Klein 83ddb4def9
aarch64 ainvs: remove unused physBase lemmas (#625)
The condition `pptrBase < kernelELFBase` is not required on AArch64 in
hyp mode and was left over from the initial RISC-V setup.

Since this check does fail for some platforms (where physBase = 0 and
consequently pptrBase = kernelELFBase) we remove it here.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-04-05 13:50:33 +10:00
Gerwin Klein 5a7e6406cd
docs/setup: mlton for M1 now available on homebrew (#624)
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-04-01 19:10:12 +11:00
Gerwin Klein 9ba34e2690
docs/setup: mention release manifests
Extracted from verification-manifest README which now only points to
the instructions in this repo.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-31 15:33:50 +11:00
Gerwin Klein 7b0599a035
README: flatten installation instructions
- Provide one flattened set of instructions to install all
  dependencies, google repo, manifest checkout, and Isabelle
  installation. At the end of it, link to the description on how to run
  the proofs.

- Remove jEdit section from main README, since it's duplicated in
  `setup.md`.

- update Google repo link to a page that contains installation
  instructions

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-31 15:22:45 +11:00
Gerwin Klein 0cf64b5498
READMEs: use run_tests consistently in READMEs (#622)
Avoid mixing `isabelle`, `make`, and `run_tests` invocations.
Standardise on `run_tests` and mention `L4V_ARCH` each time to
indicate that you can and should set `L4V_ARCH`.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-30 13:59:18 +11:00
Corey Lewis fc7a113286
riscv infoflow: physBase abstraction
- Distinguish between virtual and physical address for the shared page
  in the example state.

- Reuse lemmas from ArchKernelInit to solve address translation proofs.

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-03-29 11:05:27 +11:00
Gerwin Klein 5fc1c13613
riscv machine+ainvs: physBase abstraction
Move physBase into Arch_Kernel_Config_Lemmas, and move basic lemmas
about kernel constants that do not directly unfold physBase into
ArchInvariants_AI.

Because Arch_Kernel_Config_Lemmas does not have all names available
yet, some of the lemmas are folded and shadowed later in
ArchInvariants_AI.

Also refactor translate_address_kernel_elf_window to have two helper
lemmas that can be used in infoflow.

Co-authored-by: Corey Lewis <corey.lewis@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-29 11:05:27 +11:00
Gerwin Klein c969e4769c
riscv aspec: make example init state more flexible
- adjust the example init state such that it does not constrain the
  value of physBase and kernelELFBase too much. We assume 4M physical
  memory and 4k of kernel ELF memory. We need 4M for the infoflow
  example, because it requires a 2M RISCVLargePage plus additional
  kernel objects.

- make the PagePTE for kernelELFBase point to kernelELFPAddrBase so
  that the mapping stays consistent when physBase changes.

- introduce shorthand constants for the index in the page table that
  is responsible for kernelELFBase, and for the number of bits left
  to translate from the top-level page table (= size of the pages in
  that table).

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-29 11:05:26 +11:00
Gerwin Klein 662245c8cb
riscv machine+design+crefine: explicitly set pptrTop
Factor out pptrTop from the definition in kernelELFBase and define it
as a constant as on other platforms. Shadows the equivalent definition
in Haskell.

Also remove incorrect comment -- the term was not PADDR_TOP, but
PPTR_TOP in C.

Co-authored-by: Corey Lewis <corey.lewis@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-29 11:05:26 +11:00
Gerwin Klein 6d7b540963
aarch64 machine+ainvs: physBase abstraction
Remove the only unfolding of Kernel_Config.physBase_def in
ArchKernelInit by removing an unused lemma. Move the remaining
unfolding in ArchAInvariants to Kernel_Config_Lemmas.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-29 11:05:26 +11:00
Corey Lewis 7514d9ee69
arm access+infoflow: physBase abstraction
The example valid state is changed to correctly use both the virtual
and physical address of the shared page, instead of just the virtual
address.

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-03-29 11:05:26 +11:00
Rafal Kolanski 0fc9a0542c
arm+arm-hyp machine+ainvs+refine+crefine: physBase abstraction
physBase is reduced to be unfolded only in Arch_Kernel_Config_Lemmas.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-03-29 11:05:25 +11:00
Corey Lewis 75db914627
word_lib: new lemmas about mask, AND, and shift
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-03-29 11:05:25 +11:00
Rafal Kolanski 9288b78694
machine+aspec: add Arch_Kernel_Config_Lemmas
While having a single Kernel_Config_Lemmas was fine for constraining the
number of domains, it does not work for constraining architecture-specific
configuration options/values.

Add an (empty for now) Arch_Kernel_Config_Lemmas theory to every architecture
that imports the generic Kernel_Config_Lemmas. Change all imports of
Kernel_Config_Lemmas to import Arch_Kernel_Config_Lemmas instead.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-03-29 10:04:47 +11:00
Michael McInerney 27d838af86 lib+proof: rename bind_assoc_reverse to bind_assoc_return_reverse
This also improves the style of this lemma

Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-03-27 10:34:03 +10:30
Michael McInerney 3981e9a60e lib+ainvs: make monadic_rewrite available in AInvs session
This also reduces the imports of MonadicRewrite

Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-03-21 18:22:34 +10:30
Gerwin Klein e6b080ac38
tests: add kernel-config session (#614)
Make the C kernel config extraction visible as a separate test session
in run_tests so that run_tests can do concurrency control for it.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-21 13:50:37 +11:00
Michael McInerney 96e6e6a983 lib: add empty_fail_ifME and empty_fail_notM
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-03-21 10:45:28 +10:30
Michael McInerney fa9373674c lib: some corres rules for monadic combinators
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-03-21 10:45:28 +10:30
Michael McInerney adc7499aea lib: add ifME_liftE
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-03-21 10:45:28 +10:30
Gerwin Klein f4a9758d8b lib: add ifME
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-21 10:45:28 +10:30
Michael McInerney f74d42f745 lib: add ifM_throwError_returnOk
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-03-21 10:45:28 +10:30
Michael McInerney dc27565fbb lib: add notM and notM_wp
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-03-21 10:45:28 +10:30
Michael McInerney 1c0ceba850 lib: several lemmas involving exs_valid and the reader monad
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-03-20 18:55:49 +10:30
Rafal Kolanski d5fa6043cb proof: update (non-x64) for physBase-dependent defs
Co-authored-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-03-20 09:34:42 +11:00
Rafal Kolanski 317164b3b7 machine: prepare Platform for physBase definition
physBase is now a generated definition on all arches except X64, with
the expectation that this value can change (for static multikernel systems).
All definitions that depend on physBase in C must therefore adapt to
depend on the physBase constant instead of its unfolded value.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-03-20 09:34:42 +11:00
Rafal Kolanski ccce2b8071 arm+arm_hyp machine: update pptrBase comment
Update to match C, the old version was very confusing.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-03-20 09:34:42 +11:00
Matthew Brecknell 59dd0452fe ci: Fix broken external workflow
A previous commit added a new job which depended on a job that didn't
exist. We rename the `all` job to `proofs` for consistency with other
workflows.

Signed-off-by: Matthew Brecknell <matt@kry10.com>
2023-03-16 14:17:05 +11:00
Gerwin Klein c762b99b3b
docs: fix typo in setup.md (#613)
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-16 14:12:04 +11:00
Michael McInerney d844d691cb lib: move bind_assoc_reverse to lib
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-03-10 16:53:08 +10:30
Michael McInerney 909402d887 clib: add ccorres_call_getter_setter
This rule allows us to prove correspondence in the case
where the result of a function call is assigned to a
global variable

Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-03-10 16:53:08 +10:30
Gerwin Klein 3ca3553cc6
aarch64 ainvs: avoid global [simp] for if_option_eq (#608)
Keep simp set more in line with other architectures.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-09 18:21:08 +11:00
Gerwin Klein 56c1a7ca68
aarch64 ainvs: use new if_option_eq
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-09 10:34:00 +11:00
Gerwin Klein 63ef58cbdb
lib: simp setup for If and option
Terms of the form "(if P then None else Some _) = None" and all their
combinations can be simplified automatically. For the "Some" variants
we provide a safer form, e.g.:

    ((if P then Some x else None) = Some x) = P

because

    ((if P then Some x else None) = Some y) = (P /\ x = y)

adds an equation to the goal that the simplifier will pick up. That is
often wanted, but sometimes leads to non-termination.

Even the safer form can lead to non-termination if P is an equation, so
none of these are [simp] by default.

- `if_option_eq` is the safer set
- `if_option` is the less safe set that simplifies more

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-09 10:34:00 +11:00