Commit Graph

186 Commits

Author SHA1 Message Date
Gerwin Klein 314158480a
proof: update to Isabelle2023 mapsto syntax
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-10-06 14:41:41 +11:00
Corey Lewis 7999632872 proof: update for changes to nondet monad
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-10-05 11:24:05 +11:00
Rafal Kolanski deade608ac crefine: change misleading proof step in CSpace_RAB_C
Trying to figure this out was very educational, since ccorres_abstract
was used without intending to abstract a variable, the xf' and lambda
name were both red herrings (in fact, this proof only worked if xf' was
instantiated with an *irrelevant* C local var name), and the body was
not transformed.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-09-15 06:10:04 +10:00
Gerwin Klein 71dc79a879 arm crefine: proof updates for object_type enum reorder
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-08-14 15:51:34 +02:00
Corey Lewis 02116815be proof+autocorres: update for select_wp and alternative_wp
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-08-09 16:42:01 +10:00
Corey Lewis 2c8f9eeff1 lib+spec+proof+autocorres: consistent Nondet filename prefix
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-08-09 12:07:06 +10:00
Corey Lewis d87f5e13b5 crefine: update for no_name_eta
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-07-05 17:04:50 +10:00
Corey Lewis 1f06802350 crefine: update for new ccorres cong rules
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-06-30 10:14:57 +10:00
Corey Lewis 163b9fe58a crefine: remove some duplicated lemmas
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-06-30 10:14:57 +10:00
Gerwin Klein f75a3481ae
lib+refine+crefine: disambiguate corres_pre
- rename corres_pre set in CRefine to ccorres_pre
- rename internal corres_pre method in Corres_Method to corres_pre'
- use corres_pre instead of old wp_pre in refine

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-15 10:46:39 +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
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
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
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
Gerwin Klein e89813ecf2
proofs: updates for monad refactor
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:55 +11:00
Gerwin Klein 8c1d67945d
crefine: NonDetMonad.valid -> NonDetMonadVCG.valid
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:51 +11:00
Gerwin Klein 8791c1be22
proofs: hoare_pre_cont variable renamed
s/hoare_pre_cont[where a=/hoare_pre_cont[where f=/

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:51 +11:00
Gerwin Klein 49c93e64ee
lib: eliminate hoare_gets_post
duplicate of hoare_gets_sp

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 11:48:39 +11:00
Gerwin Klein b1daf38dda
lib+crefine: eliminate list_case_return2
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 11:48:38 +11:00
Gerwin Klein 6bf7c92d22
lib+crefine: zipWith lemma [simp] consolidation
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 10:19:41 +11:00
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 2e608b5a5c
crefine+capDL: proof updates for theLeft/theRight
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-19 17:41:11 +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
Corey Lewis db6b3b839e isabelle2022 crefine: update CRefine for all architectures
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-11-09 11:45:46 +11:00
Rafal Kolanski 2909c56924 arm+arm-hyp crefine: indent pass over Fastpath_Equiv
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Rafal Kolanski 536eec39e4 proof: update copyrights for monadic_rewrite improvements
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Rafal Kolanski 60b3573d46 proof: improve monadic_rewrite usage based on new tactics
Deploy monadic_rewrite tactics, misc improvements.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Rafal Kolanski 7c127a65cd proof: apply monadic_rewrite updates (except Fastpath_Equiv in CRefine)
Adapt to changes from previous commit, mostly renames.

Fastpath_Equiv needs more work, pending tactical improvements.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Rafal Kolanski 94f21c8d09 crefine: minor improvements to IsolatedThreadAction
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Rafal Kolanski d55a65e96b proof: apply monadic_rewrite renames
renamed:
* `monadic_rewrite_refl3` -> `monadic_rewrite_pre_imp_refl`
* `monadic_rewrite_symb_exec2` -> `monadic_rewrite_symb_exec_drop`

removed:
* `monadic_rewrite_refl2`: use `monadic_rewrite_is_refl[OF ext]` instead
* `monadic_rewrite_bind2`: use `monadic_rewrite_bind_l` instead
* `monadic_rewrite_bind_alt`: use `monadic_rewrite_bind_l` instead

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Rafal Kolanski 04552f487a arm+arm-hyp crefine: clear warnings from Fastpath_Equiv
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Rafal Kolanski 82056c9746 proof: apply monadic_rewrite renames
Previous commit renamed the following:
* `monadic_rewrite_imp` -> `monadic_rewrite_guard_imp`
* `monadic_rewrite_weaken` -> `monadic_rewrite_weaken_flags`
* `monadic_rewrite_weaken2` -> `monadic_rewrite_weaken_flags'`

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Rafal Kolanski 10a814ed67 crefine: use modern datatype tech for tcb_state_regs
Using named constructor arguments added to the datatype package allows
removal of the old way of writing them out explicitly.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Corey Lewis a52c73ad0b crefine: update for changed corres split rules
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-10-20 08:59:52 +11:00
Corey Lewis f4e9295424 proof: change simple corres_split_deprecated cases
perl -0777 -pi -e 's/corres_split_deprecated *\[ *OF +_ +([^_].*)\)\n\s*prefer 2/corres_split[OF \1\)/g' **/*.thy
perl -0777 -pi -e 's/corres_split_deprecated *\[ *OF +_ +(?!_)/corres_split[OF /g' **/*.thy
perl -0777 -pi -e 's/corres_split_deprecated *\[ *OF +([^_]\w+) +([^_]\w+) +(.*)\)\n\s*prefer +2/corres_split[OF \2 \1 \3\)/g' **/*.thy
perl -0777 -pi -e 's/corres_split_deprecated *\[ *OF +([^_]\w+) +([^_]\w+)/corres_split[OF \2 \1/g' **/*.thy
perl -0777 -pi -e 's/corres_split_deprecated *(.*)\)\n\s*prefer +2/corres_split\1\)/g' **/*.thy

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-10-20 08:59:52 +11:00
Ryan Barry 9bf8cf35bb refine+crefine: update refinement proofs
Co-authored-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
Signed-off-by: Ryan Barry <ryan.barry@proofcraft.systems>
2022-06-17 15:32:16 +10:00
Rafal Kolanski 02a9ecaf00 proof: remove generic monadic_rewrite lemmas
Lemmas not relying on any specifications or more local concepts will be
moved into MonadicRewrite.thy

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-06-09 08:56:37 +10:00
Rafal Kolanski 9d404be331 crefine: split fastpath, rearrange Refine-based theory imports
Several parts of CRefine did not or should not depend on anything
C-related, but the import hierarchy (and theory content) did not reflect
this. Namely:
* Move_C and ArchMove_C were intended to hold items that could be moved
  to Refine yet used `kernel_m` locale and imported the C spec.
* IsolatedThreadAction indicates how to rearrange statements in the
  design spec and has nothing to do with the C spec or framework.
* Fastpath_C contained the design spec of the fastpath, the design spec
  rewrite proofs, and the C refinement. Having to rebuild nearly all of
  CRefine to work on rewrite proofs wasted time.

In the new import hierarchy:
* Move_C imports only Refine; ArchMove_C builds on Move_C
* IsolatedThreadAction imports only ArchMove_C
* The fastpath proofs are split into the spec definition (Fastpath_Defs)
  and rewrite proofs (Fastpath_Equiv), which don't depend on anything
  C-related, with their C refinement remaining in Fastpath_C.

While it is possible to separate out the fastpath definitions and rewire
proofs into a separate image or even move them to Refine, development
experience indicates keeping them alongside their C refinement remains
more convenient for the proof engineer involved.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-05-13 20:02:57 +10:00
Corey Lewis d7867393f0 crefine: remove duplicate lemmas from CLevityCatch
Signed-off-by: Corey Lewis <corey.lewis@unsw.edu.au>
2022-05-11 10:54:33 +10:00
Corey Lewis 6f13828560 crefine: remove duplicate lemma
The lemma map_to_ko_atI2 was exactly the same as map_to_ko_atI.

Signed-off-by: Corey Lewis <corey.lewis@unsw.edu.au>
2022-05-10 08:01:10 +10:00
Gerwin Klein 7535796778 crefine: remove useless comments
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein b29a3433ef isabelle2021-1: remove no_take_bit
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein 56d6216401 isabelle2021-1: CRefine
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein 24c0c5c390 spec+proof: use generated config constants
This includes replacing previous ASpec names for such constants with
the names used in Haskell/ExecSpec to avoid duplication. This also
makes some of the proofs slightly more generic.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-12-23 14:54:13 +11:00
Rafal Kolanski b57a755e40 crefine: make proofs independent of number of domains
For CRefine, this process is much more complex than for Refine and up,
as the C code both has its own definitions `maxDom` and `numDomains`,
but they are not defined in terms of each other, only numbers.
Similarly, array size types and their corresponding ArrayGuard bounds
checks refer to specific numbers, making a fullproof abstraction impossible.

A reasonably constrained interface to numDomains/maxDomain/maxDom in
Wellformed_C provides a sufficient abstraction to allow the proofs to be
independent of the number of domains (constrained to <= 256). Using the
value_type command allows more abstraction techniques, such as linking
the size of the scheduler queues back to numDomains*numPriorities,
without stating what the numbers are. Finally, for getting past the
ArrayGuard bounds checks, we do leak some information in the form of
`explicit` lemmas. These are the least safe, but short of augmenting the
C parser to re-wrap array sizes into equivalent constants/types, they
constitute a limited risk. Nonetheless, `explicit` lemmas should be used
as sparingly as possible.

Refinement to C proceeds by pretending we don't know the number of
domains, and whenever a control flow decision is made based on
`numDomains > 1`, we follow both branches, as we did for Refine. We also
attempt to avoid clever rewrites such as `(x < 1) = (x = 0)` which mess
up bounds checks into a domain-size array when `numDomains = 1`.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2021-12-22 23:50:22 +11:00
Gerwin Klein 46a1d2509a crefine: update for PR seL4/seL4#321
The aim of the PR was readability, but it actually also brings the
C more in line with the spec.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-12-06 16:44:39 +11:00
Ryan Barry 8124b326b4 infoflow+crefine: refine arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-10-05 08:46:11 +11:00
Gerwin Klein 8730572756 crefine: remove Arch_finaliseInterrupt
The PR seL4/seL4#473 removes Arch_finaliseInterrupt; this commit
updates the C proofs accordingly.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-10-01 15:19:07 +10:00