Commit Graph

179 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
Gerwin Klein 7595c02d49 riscv refine: adjust for (no_asm) in Corres_Method
The (no_asm) for corres goals is now properly enforced, which means
it is now really necessary to provide terminal corres rules in their
proper form.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-08-30 21:59:37 +02:00
Corey Lewis a084de4993 refine: update for changes to nondet monad
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-08-23 11:48:13 +10: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
Gerwin Klein 01a42167f9
riscv refine: example corres method use
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-30 15:58:14 +10:00
Gerwin Klein fad4b70825
refine: make corres method available in Refine
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-30 15:58:14 +10:00
Gerwin Klein c1fe4ad10f
lib+refine: rename Corres_Method to CorresK_Method
This also renames most of the corres* methods to corresK* methods,
including corressimp -> corresKsimp.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-30 10:56:47 +10:00
Gerwin Klein 9298456475
refine: update other architectures for ghost state change
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-05-26 18:04:48 +10:00
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 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
Corey Lewis a2ffb3b4f5 proof: remove is_thread_control and thread_control_target
Instead use discriminator and selector provided by the datatype
package.

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-02-14 18:33:44 +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 0733fa582a
proofs: alternative_valid -> alternative_wp
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-09 11:46:51 +11:00
Michael McInerney 924209c251 refine: remove bind_dummy_ret_val duplicates (now in Lib)
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-02-07 11:30:30 +10:30
Gerwin Klein 60a1469f20 riscv+aarch64 ainvs+refine: adjust for opt_mapE change
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-02 17:56:55 +11:00
Gerwin Klein e3c2e878b9
lib+proof+autocorres: consolidate when[E]/unless[E]_wp naming
wp rules for most operators such as return, get, gets are named
return_wp, get_wp, etc. Then when, whenE, unless, unlessE operators had
an additional hoare_.. prefix that this commit removes for more
consistency.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 11:48:39 +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 625c6e359d
lib+proof: eliminate hoare_ex_wp
duplicate of hoare_vcg_ex_lift

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 11:48:38 +11:00
Gerwin Klein b4b9a00a28
lib+refine: eliminate select_singleton_is_return
Also make select_singleton [simp], because it is later declared
globally [simp] anyway.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-25 11:48:38 +11:00
Gerwin Klein 79eccd3c10
lib+spec+proofs: proof fixes for NonDetMonadLemmaBucket split
Very minor changes, but in many modules.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-19 17:01:34 +11:00
Gerwin Klein 3960115459
lib+proofs+sys-init+tools: proof updates for Fun_Pred_Syntax
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-01-09 14:54:11 +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 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
Corey Lewis c51d812de7 riscv refine: 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 73a52be413 proof: change more simple corres split cases
perl -0777 -pi -e "s/corres_split_nor([\w'-]*) *\[ *OF +_ +([^_][\w'-]+) +([\w'-]+)/corres_split_nor\1\[OF \2 _ \3/g" **/*.thy
perl -0777 -pi -e 's/corres_split_nor([\w]?) *\[ *OF +_ +(?!_)/corres_split_nor\1\[OF /g' **/*.thy
perl -0777 -pi -e 's/corres_split_eqr([\w]?) *\[ *OF +_ +(?!_)/corres_split_eqr\1\[OF /g' **/*.thy
perl -0777 -pi -e 's/corres_split_mapr([\w]?) *\[ *OF +_ +(?!_)/corres_split_mapr\1\[OF /g' **/*.thy
perl -0777 -pi -e 's/corres_split_noop_rhs([\w]?) *\[ *OF +_ +(?!_)/corres_split_noop_rhs\1\[OF /g' **/*.thy
perl -0777 -pi -e 's/corres_split_dc([\w]?) *\[ *OF +_ +(?!_)/corres_split_dc\1\[OF /g' **/*.thy
perl -0777 -pi -e 's/corres_split_handle([\w]?) *\[ *OF +_ +(?!_)/corres_split_handle\1\[OF /g' **/*.thy
perl -0777 -pi -e 's/corres_split_catch([\w]?) *\[ *OF +_ +(?!_)/corres_split_catch\1\[OF /g' **/*.thy
perl -0777 -pi -e "s/corres_split_eqr(\w?) *\[ *OF +([^\W_][\w'-]+) +([^\W_][\w'-]*)/corres_split_eqr\1\[OF \3 \2/g" **/*.thy
perl -0777 -pi -e 's/corres_split_nor(\w?) *(.*)\)\n\s*prefer +2/corres_split_nor\1\2\)/g' **/*.thy

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-10-20 08:59:52 +11:00
Corey Lewis 8ffdb5eb76 proof: change simple corres_splitEE cases
perl -0777 -pi -e 's/corres_splitEE *\[ *OF +_ +([^_]\w+) +(\w+)/corres_splitEE[OF \1 _ \2/g' **/*.thy
perl -0777 -pi -e 's/corres_splitEE *\[ *OF +_ +(?!_)/corres_splitEE[OF /g' **/*.thy
perl -0777 -pi -e 's/corres_splitEE *\[ *OF +([^_]\w+) +([^_]\w+)/corres_splitEE[OF \2 \1/g' **/*.thy
perl -0777 -pi -e 's/corres_splitEE *(.*)\)\n\s*prefer +2/corres_splitEE\1\)/g' **/*.thy

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
Corey Lewis 6d37587b0b proof: rename corres_split' to corres_underlying_split
sed -E -i "s/\bcorres_split'\b/corres_underlying_split/g" proof/**/*.thy

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-10-20 08:59:52 +11:00
Corey Lewis 17ed8b9f25 proof: rename corres_underlying_split to corres_split_forwards
sed -E -i "s/\bcorres_underlying_split\b/corres_split_forwards'/g" proof/**/*.thy

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-10-20 08:59:52 +11:00
Gerwin Klein ba033cc300 riscv haskell+proofs: fix PageTablePTE encoding
According to the RISC-V spec, PageTablePTEs must have the access,
dirty, and user bits set to 0. This means that

- there is no user attribute that can be set on PageTablePTEs
  (removed from Haskell spec)
- the encoding for PageTablePTEs in C must have 0 in these fields
  instead of 1.

See PR seL4/seL4#880 for discussion and corresponding C changes.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-07-18 10:40:17 +10:00
Ryan Barry 7aaaabf15b riscv refine+crefine+access+infoflow: update proofs
Signed-off-by: Ryan Barry <ryan.barry@proofcraft.systems>
2022-06-17 15:32:16 +10:00
Gerwin Klein 6418bda962 aarch64/riscv/x64: remove findVSpaceForASIDAssert
findVSpaceForASIDAssert is needed for modeling the hardware ASID lookup
on ARM. None of AARCH64, RISCV64, X64 use that mechanism and the
function is unused. There are some proof about it, but those are unused
as well. This commit removes all of these.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein 954b42cdd9 refine: speed up CSpace1_R+CSpace_R proofs
Three main thrusts:
  - speed up the `updateMDB_the_lot` chain by using more targeted
    proof methods
  - drastically reduce goal size by removing unused assumptions when
    that becomes possible (this is the largest overall speed win)
  - use `subgoal` to unblock interactive proof progress

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-19 15:27:44 +10:00
Gerwin Klein c953ab0396 word_lib/proofs: bundle word simp set changes
Add a bundle for global word simp set changes -- unfortunately we
can't actually do this globally, because they are mostly simp rule
removals which will be overwritten by theory merges. So this new
l4v_word_lib bundle will have to be activated/unbundled multiple times.

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 b864ae0159 isabelle2021-1 riscv: Refine
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 b8fc709d21 refine+orphanage: update proofs to never unfold numDomains
Proofs now don't care about numDomains, except for a small interface in
Invariants_H. The interface is currently by convention only, and has no
enforcement capabilities.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2021-12-22 23:50:22 +11:00
Ryan Barry 72ab7cc180 various: resolve some new fixmes
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-11-12 09:39:16 +11:00
Ryan Barry 9f1d259f87 infoflow refine + refine: add refinement proofs
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-11-12 09:39:16 +11:00
Gerwin Klein 492c236121 isabelle-2021 riscv: update Refine
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-09-30 16:53:17 +10:00
Miki Tanaka 7648bf01e1 arm/arm_hyp/x64/riscv refine: add a method for setter valid_idle' rules
- in VSpace_R
- the same method added to each arch; would be good to unify via
  arch split in the future
- also includes some style cleanup

Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2021-07-24 12:09:57 +10:00
Miki Tanaka de7c2f7605 riscv refine: define valid_idle' directly, without using itcb
- this introduces idle_tcb' which is defined directly using tcb fields
- backport from MCS ARM Refine

Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2021-07-24 12:09:57 +10:00
Ryan Barry 0d53d6909f lib+ainvs+access+refine: resolve most of the new fixmes
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-07-22 10:44:43 +10:00
Mitchell Buckley 2cf89e20c8 Cleanup some FIXMEs in AInvs and related sessions
Mostly moving lemmas up into various lemma bucket theories. Also:
* replace cte_wp_at_eqD with cte_wp_at_norm (equal lemmas)
* pd_shifting_gen generalise pd_shifting' in 2 architectures
* remove some redundant crunch lemmas

Signed-off-by: Mitchell Buckley <Mitchell.Buckley@data61.csiro.au>
2021-07-16 14:13:07 +10:00
Mitchell Buckley 184bdfb954 refine: fix regression caused by bad theory import
Importing Init_R into ADT_H was causing EmptyFail_H to fail. Since
no other theories actually depend on Init_R we can instead include
it in the Refine session directly.

Signed-off-by: Mitchell Buckley <mitchell.alan.buckley@gmail.com>
2021-06-27 10:13:01 +10:00
Mitchell Buckley ee3b84fb57 refine: Give a trivial member of the abstract-haskell state relation
Describe an extremely simple abstract kernel state, and haskell state
that obey the state relation. These states are `zeroed` in the sense
that they have empty heaps, and default values of 0, False, None, []
and similar in all fields.

These states do not satisfy invs or invs', and this is not as strong
a result as showing that kernel initial states satisfy the state
relation, but it is a good sanity check on the relation itself.

Signed-off-by: Mitchell Buckley <mitchell.buckley@data61.csiro.au>
2021-06-26 10:58:14 +10:00
Mitchell Buckley 7180ee4e70 refine: Standardise names of some corres lemmas
Ideally all corres lemmas of the form
`corres rrel P P' my_abstract_function myHaskellFunction`
should be named `myHaskellFunction_corres`.

This commit renames over 200 lemmas to match this style.

Signed-off-by: Mitchell Buckley <mitchell.alan.buckley@gmail.com>
Co-authored-by: Victor Phan <Victor.Phan@data61.csiro.au>
2021-06-21 10:30:04 +10:00