Commit Graph

4979 Commits

Author SHA1 Message Date
Michael McInerney 03426eada0 lib: add hoare_from_abs rule
This also moves ex_abs_underlying from Corres_Method.thy to
ExtraCorres.thy and adds a variant of corres_underlying_split

Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2022-11-10 16:09:13 +11:00
Michael McInerney 9b33cfad36 update copyright
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2022-11-09 15:52:50 +11:00
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
Corey Lewis 4d46308d9e isabelle2022 cspec: update mk_umm_types.py
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-11-09 11:45:46 +11:00
Corey Lewis 5cd111a61e isabelle2022 autocorres: update Autocorres
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-11-09 11:45:46 +11:00
Corey Lewis 7e44994a55 isabelle2022 lib: update Concurrency
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-11-09 11:45:46 +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
Corey Lewis c6b137dfba isabelle2022 lib: update Lib
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-11-09 11:45:46 +11:00
Gerwin Klein e101f37cfc isabelle2022: import Word_Lib AFP changes
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 11:45:46 +11:00
Gerwin Klein 9ef097e85f aarch64 ainvs/cleanup: prefer invariant syntax
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Gerwin Klein 05838c4855 aarch64 ainvs: progress in ArchFinalise_AI
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Gerwin Klein 46adec77fd aarch64 ainvs: ArchIpc_AI sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Gerwin Klein 52fcfa5f06 aarch64 ainvs: ArchTcb_AI sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Gerwin Klein ba8f8a6be3 aarch64 ainvs: ArchVSpaceEntries_AI sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Gerwin Klein 3f4f36e05a aarch64 ainvs: ArchEmptyFail_AI sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Gerwin Klein 009fa075d5 aarch64 ainvs: ArchInterrupt_AI sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Gerwin Klein 74c525ffcc aarch64 ainvs: asid_map sorries in ArchFinalise
Close some of the more hairy asid_map-related sorries in
ArchFinalise_AI.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Gerwin Klein 1f8eff2fa9 aarch64 spec+haskell: atomic write in delete_asid
At the point we call set_asid_pool, the pool we are writing is out
of date, because invalidate_asid_entry will have changed it. This
commit adds another read operation after invalidate_asid_entry to
perform a write that is similarly atomic as the corresponding C code.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Rafal Kolanski 29a997e0fe riscv64+aarch64 ainvs: remove two unused lemmas
set_asid_pool_empty and delete_asid_empty_table_pt aren't used on
RISCV64 (despite being proved and declared [wp]). Hopefully these won't
be needed on AARCH64.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Rafal Kolanski 5040547836 aarch64 ainvs: progress on ArchFinalise_AI
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Rafal Kolanski 8544186298 aarch64 ainvs: ArchSchedule_AI and ArchUntyped_AI sorry-free
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Rafal Kolanski 2c8ccb8c81 aarch64 aspec: update arch_is_frame_type
Did not take into account VCPUs previously.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Rafal Kolanski 013c4442de aarch64 ainvs: ArchDetype_AI sorry-free
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Rafal Kolanski da9939a3be ainvs: add valid_obj_arch_valid_obj
On HYP platforms with projections it's sometimes useful to be able to
grab the `arch_valid_obj` formulation for specific arch types like page
tables before the simplifier breaks them apart for you.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Rafal Kolanski 6b4f875e9e ainvs: LevityCatch: add ranD
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Rafal Kolanski 828a410137 aarch64 ainvs: ArchRetype_AI sorry-free
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Rafal Kolanski 9dfc4c9c5b ainvs: assume invs for valid_vspace_objs in locale
For AARCH64 showing that valid_vspace_objs is preserved over a retype
operation via the retype_region_proofs_invs locale, it is not sufficient
to only know valid_vspace_objs. Since this locale already assumes invs,
use invs, which implies the other requirements for AARCH64.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-09 08:26:44 +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 87fadfcca5 lib: monadic rewrite: adjust single pass and symb exec methods
During deployment of these tactics, two problems appeared:
* monadic_rewrite_single_pass
  * would try to step after the action completed, which sometimes worked,
    yielding unpredictable results
  * finalise was called on monadic_rewrite goals generated by action,
    which was fine with the `solves <wpsimp>` default, but yielded
    unpredictable results with user-supplied finalise methods
* monadic_rewrite_symb_exec
  * did not schematise the precondition before attempting to apply the
    rule, resulting in lack of progress when it was expected;
    this now yields an extra subgoal in rare obvious-precondition
    cases, but is more user-friendly in the general case

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Rafal Kolanski 40e5f2b700 lib: monadic rewrite: overhaul tactics
In single-pass methods and symb_exec* methods, the finalise method
argument is optional, defaulting to solves<wpsimp> which is good enough
for most side-conditions and many WP goals.

`monadic_rewrite_symb_exec_l/r_known` methods internally supply the
instantiated theorem variable name, allowing specifying the
instantiation directly:
`monadic_rewrite_symb_exec_l cte_cap`

Symbolic execution removes no-name eta terms so that the actual variable
name in the monad is used, reducing need for rename_tac.

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 29ded1c71f lib: monadic_rewrite improvements and renames
`_symb_exec` rules now assume `monadic_rewrite` statement first, to allow
chaining and automation, by deferring WP goals to later

`_symb_exec_*_known*`: better use of invariance of executed statement

renamed `monadic_rewrite_rule` to `monadic_rewrite_l_method`, added
equivalent for RHS

renamed `monadic_rewrite_simple` to `monadic_rewrite_l`, and changed
action argument into a supplied rule (expected single-fire usage), and
added equivalent for RHS

renamed `lhs`->`l` and `rhs`->`r`
renamed `monadic_rewrite_pre_imp_refl` -> `_eq`

added: generic rules for rewriting under corres_underlying
* `monadic_rewrite_corres_l_generic`
* `monadic_rewrite_corres_r_generic`

added: `monadic_rewrite_if_r_True/False`

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Rafal Kolanski 9847dc7fc1 lib: monadic_rewrite symb exec and corres cleanup
Overhauled symbolic execution lemmas, improved genericity:
* monadic_rewrite_symb_exec_l' and r' are now main lemmas
* _F/_nF variants for LHS, E/nE variants for RHS
* non-apostrophied versions combine the above
* same for drop/known lemmas

Consolidated monadic_rewrite and corres lemmas:
* old monadic_rewrite_corres was never used except when rotated, so
  monadic_rewrite_corres2 -> monadic_rewrite_corres
* monadic_rewrite_corres' unused and not needed -> removed

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Rafal Kolanski dcac294aac lib: single-pass monadic_rewrite tactics
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 4137ea1635 lib: monadic_rewrite improvements and renames
renamed:
* `monadic_rewrite_refl3` -> `monadic_rewrite_pre_imp_refl`
* `monadic_rewrite_symb_exec2` -> `monadic_rewrite_symb_exec_drop`
  (also removed trivial assumption)

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

added:
* `monadic_rewrite_bindE_tail` to go with its bind version

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Rafal Kolanski 757483c897 lib: NonDetMonadVCG: add pred_conj_comm
Commutativity of `pred_conj`

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Rafal Kolanski 6c90b9002c lib: monadic_rewrite: use standard inv form
The standard form for a hoare triple showing the function is
state-invariant is `f {| P |}`, and that's what we crunch in later
proofs.
Using this form allows `[OF whatever_inv]` to instantiate, while using
the `f {|(=) s|}` form does not.

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 11b1041282 lib: monadic_rewrite improvements and renames
Isabelle allows preservation of variable names across rules if the name
associated with a DeBruijn index matches. All forms of monadic symbolic
execution lemmas should therefore use some form of:
`f >== \<lambda>rv. g rv` and refer to `\<All>rv. some_prop_of rv` in
the assumptions, to expose the bound names in the proof, avoiding
unnecessary `rename_tac`.

The following lemmas have been renamed after multiple discussions:
* `monadic_rewrite_imp` -> `monadic_rewrite_guard_imp` (to match [c]corres)
* `monadic_rewrite_weaken` -> `monadic_rewrite_weaken_flags`
  (people expected "weaken" rules to weaken the precondition, not flags)
* `monadic_rewrite_weaken2` -> `monadic_rewrite_weaken_flags'`
  (same reason)

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
Rafal Kolanski f31f689609 drefine: remove unused monadic_rewrite proofs
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Gerwin Klein 1ecfd4f90e autocorres: include AARCH64 in release
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-31 11:45:05 +11:00
Gerwin Klein 013115dcde lib: avoid @{file} for files that might be moved
The theory Value_Types is used without Value_Types_Test in the
AutoCorres release, which makes the @{file ..} antiquotation fail.
Including Value_Types_Test in the dependencies of Value_Types to
include it in the release doesn't work, because that would be a
circular dependency.

So to avoid manually enumerating release files, we make this a pure
@{text ..} antiquotation instead.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-31 11:45:05 +11:00
Gerwin Klein 91c135d440 autocorres: changelog+README for 1.9 release
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-31 11:45:05 +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